diff --git a/.eslintignore b/.eslintignore
index e4fc7fe..43821ad 100644
--- a/.eslintignore
+++ b/.eslintignore
@@ -1,7 +1,5 @@
test/js
test/mocha.js
-/webgl-lint.js
dist
examples/3rdParty
out
-examples/**/*.js
diff --git a/.eslintrc.cjs b/.eslintrc.cjs
index c3b9a4f..080f24a 100644
--- a/.eslintrc.cjs
+++ b/.eslintrc.cjs
@@ -1,4 +1,5 @@
/* global module */
+/* global __dirname */
module.exports = {
parser: '@typescript-eslint/parser',
diff --git a/README.md b/README.md
index a70362c..4c7410f 100644
--- a/README.md
+++ b/README.md
@@ -1,15 +1,11 @@
-# muigui
-
-# NOT READY for USE
-
-
+I'm under sure how much time I'll continue to put into this.
+I get the feeling other people are far more motivated to make
+UIs. Maybe if I'm lucky they'll take some inspiration from
+the thoughts above and I'll find they've covered it all.
## License
diff --git a/build/pull-vsa.js b/build/pull-vsa.js
new file mode 100644
index 0000000..000c98b
--- /dev/null
+++ b/build/pull-vsa.js
@@ -0,0 +1,21 @@
+import fs from 'fs';
+import process from 'process';
+
+// node build/pull-vsa.js ...url-to-vsa
+const urls = process.argv.slice(2);
+
+for (const url of urls) {
+ const req = await fetch(`${url}?format=json`);
+ const data = await req.json();
+ const filename = `examples/js/index/effects/${data.name}.js`;
+ const shader = data.settings.shader;
+ data.settings.shader = '--shader--';
+ const s = `\
+/* eslint-disable require-trailing-comma/require-trailing-comma */
+/* eslint-disable no-useless-escape */
+export default ${JSON.stringify(data, null, 2)
+ .replace(/"(.*?)":/g, '$1:')
+ .replace('"--shader--"', `\`${shader}\``)};\n`;
+ console.log('write', filename);
+ fs.writeFileSync(filename, s);
+}
\ No newline at end of file
diff --git a/build/serve.js b/build/serve.js
index a373cb6..db9e638 100644
--- a/build/serve.js
+++ b/build/serve.js
@@ -5,6 +5,7 @@ import chokidar from 'chokidar';
spawn('./node_modules/.bin/tsc', [
'--watch',
+ '--project', 'build/tsconfig-serve.json',
], {
stdio: 'inherit',
});
diff --git a/build/tsconfig-serve.json b/build/tsconfig-serve.json
index 76f2768..91bcac4 100644
--- a/build/tsconfig-serve.json
+++ b/build/tsconfig-serve.json
@@ -1,6 +1,6 @@
{
"extends": "../tsconfig.json",
"compilerOptions": {
- "outDir": "out/src"
+ "outDir": "../out"
}
}
diff --git a/dist/0.x/controllers/Button.d.ts b/dist/0.x/controllers/Button.d.ts
index 50f0953..36c33e7 100644
--- a/dist/0.x/controllers/Button.d.ts
+++ b/dist/0.x/controllers/Button.d.ts
@@ -1,5 +1,6 @@
export default class Button extends Controller {
constructor(object: any, property: any, options?: {});
+ name(name: any): void;
setOptions(options: any): void;
#private;
}
diff --git a/dist/0.x/controllers/Canvas.d.ts b/dist/0.x/controllers/Canvas.d.ts
index bbdc33f..0e89042 100644
--- a/dist/0.x/controllers/Canvas.d.ts
+++ b/dist/0.x/controllers/Canvas.d.ts
@@ -1,5 +1,5 @@
export default class Canvas extends LabelController {
- constructor();
+ constructor(name: any);
get canvas(): HTMLElement;
#private;
}
diff --git a/dist/0.x/controllers/ColorChooser.d.ts b/dist/0.x/controllers/ColorChooser.d.ts
index ebbfe71..f753db9 100644
--- a/dist/0.x/controllers/ColorChooser.d.ts
+++ b/dist/0.x/controllers/ColorChooser.d.ts
@@ -1,4 +1,5 @@
export default class ColorChooser extends PopDownController {
+ ___setKnobHelper: boolean;
setOptions(options: any): this;
#private;
}
diff --git a/dist/0.x/controllers/PopDownController.d.ts b/dist/0.x/controllers/PopDownController.d.ts
index 97d01cf..1494c29 100644
--- a/dist/0.x/controllers/PopDownController.d.ts
+++ b/dist/0.x/controllers/PopDownController.d.ts
@@ -4,7 +4,7 @@ export default class PopDownController extends ValueController {
updateDisplay(): void;
setOptions(options: any): void;
addTop(view: any): any;
- addBottom(view: any): any;
+ addBottom(view: any): import("../views/View.js").default;
#private;
}
import ValueController from './ValueController.js';
diff --git a/dist/0.x/esm.d.ts b/dist/0.x/esm.d.ts
index 0f10034..3f79c9b 100644
--- a/dist/0.x/esm.d.ts
+++ b/dist/0.x/esm.d.ts
@@ -7,4 +7,10 @@ export { default as Select } from './controllers/Select.js';
export { default as Slider } from './controllers/Slider.js';
export { default as TextNumber } from './controllers/TextNumber.js';
export { default as Vec2 } from './controllers/Vec2.js';
+import { graph } from './libs/graph.js';
+import { monitor } from './libs/monitor.js';
+export declare const helpers: {
+ graph: typeof graph;
+ monitor: typeof monitor;
+};
export default GUI;
diff --git a/dist/0.x/libs/color-utils.d.ts b/dist/0.x/libs/color-utils.d.ts
index d145154..83fdfcc 100644
--- a/dist/0.x/libs/color-utils.d.ts
+++ b/dist/0.x/libs/color-utils.d.ts
@@ -139,6 +139,26 @@ export const colorFormatConverters: {
to: (v: any) => string;
};
};
+ 'float-hsv': {
+ color: {
+ from: (v: any) => (boolean | number[])[];
+ to: (v: any) => number[];
+ };
+ text: {
+ from: (s: any) => any[];
+ to: (v: any) => string;
+ };
+ };
+ 'float-hsva': {
+ color: {
+ from: (v: any) => (boolean | any[])[];
+ to: (v: any) => any[];
+ };
+ text: {
+ from: (s: any) => any[];
+ to: (v: any) => string;
+ };
+ };
'object-rgb': {
color: {
from: (v: any) => (boolean | {
diff --git a/dist/0.x/libs/graph.d.ts b/dist/0.x/libs/graph.d.ts
new file mode 100644
index 0000000..c51769e
--- /dev/null
+++ b/dist/0.x/libs/graph.d.ts
@@ -0,0 +1,6 @@
+export function graph(canvas: any, data: any, { min, max, interval, color, }: {
+ min?: number | undefined;
+ max?: number | undefined;
+ interval?: number | undefined;
+ color: any;
+}): void;
diff --git a/dist/0.x/libs/monitor.d.ts b/dist/0.x/libs/monitor.d.ts
new file mode 100644
index 0000000..38062e3
--- /dev/null
+++ b/dist/0.x/libs/monitor.d.ts
@@ -0,0 +1,3 @@
+export function monitor(label: any, object: any, property: any, { interval }?: {
+ interval?: number | undefined;
+}): void;
diff --git a/dist/0.x/muigui.d.ts b/dist/0.x/muigui.d.ts
index 985e780..0f79fdd 100644
--- a/dist/0.x/muigui.d.ts
+++ b/dist/0.x/muigui.d.ts
@@ -5,6 +5,7 @@ export class GUIFolder extends Folder {
addDivider(): any;
addFolder(name: any): any;
addLabel(text: any): any;
+ addButton(name: any, fn: any): any;
}
export class GUI extends GUIFolder {
static converters: {
@@ -34,6 +35,7 @@ export class GUI extends GUIFolder {
static setTheme(name: any): void;
constructor(options?: {});
setStyle(css: any): void;
+ setTheme(name: any): void;
#private;
}
export default GUI;
diff --git a/dist/0.x/muigui.js b/dist/0.x/muigui.js
index ce955f2..0b7c18f 100644
--- a/dist/0.x/muigui.js
+++ b/dist/0.x/muigui.js
@@ -1,4 +1,4 @@
-/* muigui@0.0.12, license MIT */
+/* muigui@0.0.13, license MIT */
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
typeof define === 'function' && define.amd ? define(factory) :
@@ -17,16 +17,24 @@
--menu-bg-color: #f8f8f8;
--menu-sep-color: #bbb;
--hover-bg-color: #999;
- --focus-color: #68C;
- --range-color: #888888;
+ --focus-color: #8BF;
+ --range-color: #AAA;
--invalid-color: #FF0000;
--selected-color: rgb(255, 255, 255, 0.9);
--button-bg-color: var(--value-bg-color);
+ --image-open: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPgogIDxyZWN0IHN0eWxlPSJmaWxsOiAjNDQ0OyIgeD0iMjAlIiB5PSI0NSUiIHdpZHRoPSI2MCUiIGhlaWdodD0iMTAlIj48L3JlY3Q+Cjwvc3ZnPg==);
+ --image-closed: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPgogIDxyZWN0IHN0eWxlPSJmaWxsOiAjNDQ0OyIgeD0iNDUlIiB5PSIyMCUiIHdpZHRoPSIxMCUiIGhlaWdodD0iNjAlIj48L3JlY3Q+CiAgPHJlY3Qgc3R5bGU9ImZpbGw6ICM0NDQ7IiB4PSIyMCUiIHk9IjQ1JSIgd2lkdGg9IjYwJSIgaGVpZ2h0PSIxMCUiPjwvcmVjdD4KPC9zdmc+);
+ --image-checkerboard: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPgogIDxyZWN0IHN0eWxlPSJmaWxsOiAjNDA0MDQwOyIgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSI+PC9yZWN0PgogIDxyZWN0IHN0eWxlPSJmaWxsOiAjODA4MDgwOyIgeD0iMCIgeT0iMCIgd2lkdGg9IjUwJSIgaGVpZ2h0PSI1MCUiPjwvcmVjdD4KICA8cmVjdCBzdHlsZT0iZmlsbDogIzgwODA4MDsiIHg9IjUwJSIgeT0iNTAlIiB3aWR0aD0iNTAlIiBoZWlnaHQ9IjUwJSI+PC9yZWN0Pgo8L3N2Zz4=);
+
--range-left-color: var(--value-color);
--range-right-color: var(--value-bg-color);
--range-right-hover-color: var(--hover-bg-color);
+ --button-image:
+ linear-gradient(
+ rgba(255, 255, 255, 1), rgba(0, 0, 0, 0.2)
+ );
color: var(--color);
background-color: var(--bg-color);
@@ -43,7 +51,7 @@
--menu-bg-color: #080808;
--menu-sep-color: #444444;
--hover-bg-color: #666666;
- --focus-color: #88AAFF;
+ --focus-color: #458; /*#88AAFF*/;
--range-color: #888888;
--invalid-color: #FF6666;
--selected-color: rgba(255, 255, 255, 0.3);
@@ -53,9 +61,15 @@
--range-left-color: var(--value-color);
--range-right-color: var(--value-bg-color);
--range-right-hover-color: var(--hover-bg-color);
+ --button-image: linear-gradient(
+ rgba(0, 0, 0, 0.1), rgba(0, 0, 0, 0.4)
+ );
color: var(--color);
background-color: var(--bg-color);
+
+ --image-closed: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPgogIDxyZWN0IHN0eWxlPSJmaWxsOiAjREREOyIgeD0iMjAlIiB5PSI0NSUiIHdpZHRoPSI2MCUiIGhlaWdodD0iMTAlIj48L3JlY3Q+Cjwvc3ZnPg==);
+ --image-open: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPgogIDxyZWN0IHN0eWxlPSJmaWxsOiAjREREOyIgeD0iNDUlIiB5PSIyMCUiIHdpZHRoPSIxMCUiIGhlaWdodD0iNjAlIj48L3JlY3Q+CiAgPHJlY3Qgc3R5bGU9ImZpbGw6ICNEREQ7IiB4PSIyMCUiIHk9IjQ1JSIgd2lkdGg9IjYwJSIgaGVpZ2h0PSIxMCUiPjwvcmVjdD4KPC9zdmc+);
}
}
@@ -64,7 +78,6 @@
--label-width: 45%;
--number-width: 40%;
-
--font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
--font-size: 11px;
--font-family-mono: Menlo, Monaco, Consolas, "Droid Sans Mono", monospace;
@@ -157,6 +170,9 @@
min-width: 0;
min-height: var(--line-height);
}
+.muigui-root {
+ z-index: 1;
+}
.muigui-root,
.muigui-menu {
display: flex;
@@ -181,8 +197,7 @@
color: var(--color);
background-color: var(--menu-bg-color);
min-height: var(--line-height);
- padding-top: 0.2em;
- padding-bottom: 0.2em;
+ padding: 0.2em;
cursor: pointer;
border-radius: var(--border-radius);
}
@@ -203,7 +218,7 @@
.muigui-controller>*:nth-child(1) {
flex: 1 0 var(--label-width);
min-width: 0;
- white-space: pre;
+ /* white-space: pre; why?? */
}
.muigui-controller>label:nth-child(1) {
place-content: center start;
@@ -245,32 +260,41 @@
/* fix! */
.muigui-open>button>label::before,
.muigui-closed>button>label::before {
+ content: "X";
+ color: rgba(0, 0, 0, 0);
+ background-color: var(--range-color);
+ border-radius: 0.2em;
width: 1.25em;
- height: var(--line-height);
+ margin-right: 0.25em;
+ height: 1.25em; /*var(--line-height);*/
display: inline-grid;
place-content: center start;
pointer-events: none;
}
.muigui-open>button>label::before {
- content: "ⓧ"; /*"▼";*/
+ background-image: var(--image-open);
}
.muigui-closed>button>label::before {
- content: "⨁"; /*"▶";*/
+ background-image: var(--image-closed);
}
-.muigui-open>*:nth-child(2) {
- transition: max-height 0.2s ease-out,
- opacity 0.5s ease-out;
- max-height: 100vh;
+
+.muigui-open>.muigui-open-container {
+ transition: all 0.1s ease-out;
overflow: auto;
- opacity: 1;
+ height: 100%;
}
-
-.muigui-closed>*:nth-child(2) {
- transition: max-height 0.2s ease-out,
- opacity 1s;
- max-height: 0;
- opacity: 0;
+.muigui-closed>.muigui-open-container {
+ transition: all 0.1s ease-out;
overflow: hidden;
+ min-height: 0;
+}
+.muigui-open>.muigui-open-container>* {
+ transition: all 0.1s ease-out;
+ margin-top: 0px;
+}
+.muigui-closed>.muigui-open-container>* {
+ transition: all 0.1s ease-out;
+ margin-top: -100%;
}
/* ---- popdown ---- */
@@ -282,8 +306,12 @@
.muigui-value>*:nth-child(1).muigui-pop-down-top {
flex: 0;
}
-.muigui-pop-down-bottom {
+.muigui-closed .muigui-pop-down-bottom {
+ max-height: 0;
+}
+.muigui-value .muigui-pop-down-bottom {
+ margin: 0;
}
.muigui-pop-down-values {
@@ -305,6 +333,10 @@
width: auto;
color: var(--value-color);
background-color: var(--value-bg-color);
+ background-image: var(--image-checkerboard);
+ background-size: 10px 10px;
+ background-position: 0 0, 0 5px, 5px -5px, -5px 0px;
+
cursor: pointer;
display: grid;
@@ -396,14 +428,16 @@
.muigui-button {
display: grid;
-
+ padding: 2px 0 2px 0;
}
.muigui-button button {
border: none;
color: var(--value-color);
background-color: var(--button-bg-color);
+ background-image: var(--button-image);
cursor: pointer;
place-content: center center;
+ height: var(--line-height);
}
/* ------ [ color ] ------ */
@@ -615,9 +649,9 @@
border-bottom: 1px solid rgba(0,0,0,0.2);
border-right: 1px solid rgba(0,0,0,0.2);
background-color: var(--range-color);
- margin-top: calc((var(--line-height) - 2px) / -2);
- width: calc(var(--line-height) - 2px);
- height: calc(var(--line-height) - 2px);
+ margin-top: calc((var(--line-height) - 6px) / -2);
+ width: calc(var(--line-height) - 6px);
+ height: calc(var(--line-height) - 6px);
}
.muigui-range input[type=range]::-webkit-slider-runnable-track {
@@ -701,8 +735,14 @@
`,
themes: {
- default: '',
- float: `
+ default: {
+ include: ['default'],
+ css: `
+ `,
+ },
+ float: {
+ include: ['default'],
+ css: `
:root {
color-scheme: light dark,
}
@@ -759,6 +799,58 @@
--range-color: rgba(0, 0, 0, 0.125);
}
`,
+ },
+ form: {
+ include: [],
+ css: `
+ .muigui {
+ --width: 100%;
+ --label-width: 45%;
+ --number-width: 40%;
+ }
+ .muigui-root>button {
+ display: none;
+ }
+ .muigui-controller {
+ margin-top: 1em;
+ }
+ .muigui-label-controller {
+ display: flex;
+ flex-direction: column;
+ align-items: stretch;
+ margin-top: 1em;
+ }
+ .muigui-label-controller:has(.muigui-checkbox) {
+ flex-direction: row;
+ }
+ .muigui-value {
+ display: flex;
+ align-items: stretch;
+ }
+ .muigui-value>* {
+ flex: 1 1 auto;
+ min-width: 0;
+ }
+ .muigui-controller>*:nth-child(1) {
+ flex: 1 0 var(--label-width);
+ min-width: 0;
+ white-space: pre;
+ }
+ .muigui-controller>label:nth-child(1) {
+ place-content: center start;
+ display: inline-grid;
+ overflow: hidden;
+ }
+ .muigui-controller>*:nth-child(2) {
+ flex: 1 1 75%;
+ min-width: 0;
+ }
+ `,
+ },
+ none: {
+ include: [],
+ css: '',
+ },
},
};
@@ -1120,6 +1212,9 @@
}));
this.setOptions({name: property, ...options});
}
+ name(name) {
+ this.#buttonElem.textContent = name;
+ }
setOptions(options) {
copyExistingProperties(this.#options, options);
const {name} = this.#options;
@@ -1511,15 +1606,22 @@
const wheelHelper = createWheelHelper();
super(createElem('input', {
type: 'number',
- onInput: () => this.#handleInput(setValue, true),
- onChange: () => this.#handleInput(setFinalValue, false),
+ onInput: () => {
+ this.#handleInput(setValue, true);
+ },
+ onChange: () => {
+ this.#handleInput(setFinalValue, false);
+ },
onWheel: e => {
e.preventDefault();
const {min, max, step} = this.#options;
const delta = wheelHelper(e, step);
const v = parseFloat(this.domElement.value);
const newV = clamp$1(stepify(v + delta, v => v, step), min, max);
- setter.setValue(newV);
+ const [valid, outV] = this.#from(newV);
+ if (valid) {
+ setter.setValue(outV);
+ }
},
}));
this.setOptions(options);
@@ -1564,7 +1666,7 @@
#step;
constructor(object, property, options = {}) {
- super(object, property, 'muigui-checkbox');
+ super(object, property, 'muigui-text-number');
this.#textView = this.add(new NumberView(this, options));
this.updateDisplay();
}
@@ -1722,8 +1824,12 @@
const setFinalValue = setter.setFinalValue.bind(setter);
super(createElem('input', {
type: 'text',
- onInput: () => this.#handleInput(setValue, true),
- onChange: () => this.#handleInput(setFinalValue, false),
+ onInput: () => {
+ this.#handleInput(setValue, true);
+ },
+ onChange: () => {
+ this.#handleInput(setFinalValue, false);
+ },
}));
this.setOptions(options);
}
@@ -1756,7 +1862,7 @@
class Text extends ValueController {
constructor(object, property) {
- super(object, property, 'muigui-checkbox');
+ super(object, property, 'muigui-text');
this.add(new TextView(this));
this.updateDisplay();
}
@@ -1781,6 +1887,9 @@
if (Array.isArray(arg1)) {
return new Select(object, property, {keyValues: arg1});
}
+ if (arg1 && arg1.keyValues) {
+ return new Select(object, property, {keyValues: arg1.keyValues});
+ }
const t = typeof object[property];
switch (t) {
@@ -2392,6 +2501,50 @@
to: v => Array.from(v).map(v => f3(v)).join(', '),
},
},
+ 'float-hsv': {
+ color: {
+ from: v => [true, rgbFloatToHSV01(hexToFloatRGB(v))],
+ to: v => hsv01ToRGBFloat(floatRGBToHex(v)),
+ },
+ text: {
+ from: strTo3Floats,
+ // need Array.from because map of Float32Array makes a Float32Array
+ to: v => Array.from(v).map(v => f3(v)).join(', '),
+ },
+ },
+ 'float-hsva': {
+ color: {
+ from: v => [true, rgbaFloatToHSVA01(hexToFloatRGB(v))],
+ to: v => hsva01ToRGBAFloat(floatRGBToHex(v)),
+ },
+ text: {
+ from: strTo4Floats,
+ // need Array.from because map of Float32Array makes a Float32Array
+ to: v => Array.from(v).map(v => f3(v)).join(', '),
+ },
+ },
+ //'float-hsl': {
+ // color: {
+ // from: v => [true, rgbFloatToHsl01(hexToFloatRGB(v))],
+ // to: v => hsl01ToRGBFloat(floatRGBToHex(v)),
+ // },
+ // text: {
+ // from: strTo3Floats,
+ // // need Array.from because map of Float32Array makes a Float32Array
+ // to: v => Array.from(v).map(v => f3(v)).join(', '),
+ // },
+ //},
+ //'float-hsla': {
+ // color: {
+ // from: v => [true, hexToFloatRGBA(v)],
+ // to: floatRGBAToHex,
+ // },
+ // text: {
+ // from: strTo4Floats,
+ // // need Array.from because map of Float32Array makes a Float32Array
+ // to: v => Array.from(v).map(v => f3(v)).join(', '),
+ // },
+ //},
'object-rgb': {
color: {
from: v => [true, hexToObjectRGB(v)],
@@ -2464,8 +2617,8 @@
class Canvas extends LabelController {
#canvasElem;
- constructor() {
- super('muigui-canvas');
+ constructor(name) {
+ super('muigui-canvas', name);
this.#canvasElem = this.add(
new ElementView('canvas', 'muigui-canvas'),
).domElement;
@@ -2626,6 +2779,7 @@
type: 'button',
onClick: () => this.toggleOpen(),
}, [this.#labelElem]));
+ this.pushContainer(new Container('muigui-open-container'));
this.pushContainer(new Container());
this.name(name);
this.open();
@@ -2974,7 +3128,10 @@
}));
this.#checkboxElem = checkboxElem;
this.#valuesView = this.#top.add(new ElementView('div', 'muigui-pop-down-values'));
- this.#bottom = this.add(new ElementView('div', 'muigui-pop-down-bottom'));
+ const container = new ElementView('div', 'muigui-pop-down-bottom muigui-open-container');
+ this.#bottom = new ElementView('div');
+ container.add(this.#bottom);
+ this.add(container);
this.setOptions(options);
}
setKnobColor(bgCssColor/*, fgCssColor*/) {
@@ -3010,7 +3167,6 @@
#colorView;
#textView;
#to;
- #setKnobHelper;
constructor(object, property, options = {}) {
super(object, property, 'muigui-color-chooser');
@@ -3022,20 +3178,22 @@
this.addTop(this.#textView);
this.addBottom(this.#colorView);
// WTF! FIX!
- this.#setKnobHelper = () => {
- if (this.#to) {
- const hex6Or8 = this.#to(this.getValue());
- const hsl = rgbUint8ToHsl(hexToUint8RGB(hex6Or8));
- hsl[2] = (hsl[2] + 50) % 100;
- const hex = uint8RGBToHex(hslToRgbUint8(hsl));
- this.setKnobColor(`${hex6Or8.substring(0, 7)}FF`, hex);
- }
- };
+ this.___setKnobHelper = true;
this.updateDisplay();
}
+ #setKnobHelper() {
+ if (this.#to) {
+ const hex6Or8 = this.#to(this.getValue());
+ const alpha = hex6Or8.length === 9 ? hex6Or8.substring(7, 9) : 'FF';
+ const hsl = rgbUint8ToHsl(hexToUint8RGB(hex6Or8));
+ hsl[2] = (hsl[2] + 50) % 100;
+ const hex = uint8RGBToHex(hslToRgbUint8(hsl));
+ this.setKnobColor(`${hex6Or8.substring(0, 7)}${alpha}`, hex);
+ }
+ }
updateDisplay() {
super.updateDisplay();
- if (this.#setKnobHelper) {
+ if (this.___setKnobHelper) {
this.#setKnobHelper();
}
}
@@ -3144,6 +3302,10 @@
addLabel(text) {
return this.addController(new Label(text));
}
+ addButton(name, fn) {
+ const o = {fn};
+ return this.add(o, 'fn').name(name);
+ }
}
class MuiguiElement extends HTMLElement {
@@ -3156,7 +3318,7 @@
customElements.define('muigui-element', MuiguiElement);
const baseStyleSheet = new CSSStyleSheet();
- baseStyleSheet.replaceSync(css.default);
+ //baseStyleSheet.replaceSync(css.default);
const userStyleSheet = new CSSStyleSheet();
function makeStyleSheetUpdater(styleSheet) {
@@ -3183,6 +3345,11 @@
const updateBaseStyle = makeStyleSheetUpdater(baseStyleSheet);
const updateUserStyle = makeStyleSheetUpdater(userStyleSheet);
+ function getTheme(name) {
+ const { include, css: cssStr } = css.themes[name];
+ return `${include.map(m => css[m]).join('\n')} : css.default}\n${cssStr || ''}`;
+ }
+
class GUI extends GUIFolder {
static converters = converters;
static mapRange = mapRange;
@@ -3214,13 +3381,14 @@
}
if (parent) {
const muiguiElement = createElem('muigui-element');
- muiguiElement.shadowRoot.adoptedStyleSheets = [baseStyleSheet, userStyleSheet, this.#localStyleSheet];
+ muiguiElement.shadowRoot.adoptedStyleSheets = [this.#localStyleSheet, baseStyleSheet, userStyleSheet];
muiguiElement.shadow.appendChild(this.domElement);
parent.appendChild(muiguiElement);
}
if (title) {
this.title(title);
}
+ this.#localStyleSheet.replaceSync(css.default);
this.domElement.classList.add('muigui', 'muigui-colors');
}
setStyle(css) {
@@ -3238,8 +3406,11 @@
static getUserStyleSheet() {
return userStyleSheet;
}
+ setTheme(name) {
+ this.setStyle(getTheme(name));
+ }
static setTheme(name) {
- GUI.setBaseStyles(`${css.default}\n${css.themes[name] || ''}`);
+ GUI.setBaseStyles(getTheme(name));
}
}
diff --git a/dist/0.x/muigui.js.map b/dist/0.x/muigui.js.map
index c0fb460..4dc408b 100644
--- a/dist/0.x/muigui.js.map
+++ b/dist/0.x/muigui.js.map
@@ -1 +1 @@
-{"version":3,"file":"muigui.js","sources":["../../src/styles/muigui.css.js","../../src/libs/elem.js","../../src/libs/utils.js","../../../src/views/View.ts","../../src/controllers/Controller.js","../../src/controllers/Button.js","../../src/views/EditView.js","../../src/views/CheckboxView.js","../../src/libs/taskrunner.js","../../src/libs/ids.js","../../src/views/ValueView.js","../../src/controllers/LabelController.js","../../src/controllers/ValueController.js","../../src/controllers/Checkbox.js","../../src/libs/conversions.js","../../src/libs/wheel.js","../../src/views/NumberView.js","../../src/controllers/TextNumber.js","../../src/views/SelectView.js","../../src/libs/key-values.js","../../src/controllers/Select.js","../../src/views/RangeView.js","../../src/controllers/Range.js","../../src/views/TextView.js","../../src/controllers/Text.js","../../src/controllers/create-controller.js","../../src/libs/color-utils.js","../../src/views/ElementView.js","../../src/controllers/Canvas.js","../../src/views/ColorView.js","../../src/controllers/Color.js","../../src/controllers/Divider.js","../../src/controllers/Container.js","../../src/controllers/Folder.js","../../src/controllers/Label.js","../../src/libs/touch.js","../../src/views/ColorChooserView.js","../../src/controllers/PopDownController.js","../../src/controllers/ColorChooser.js","../../src/layout/Layout.js","../../src/layout/Column.js","../../src/layout/Frame.js","../../src/layout/Grid.js","../../src/layout/Row.js","../../src/muigui.js","../../src/libs/keyboard.js","../../src/libs/assert.js","../../src/libs/svg.js","../../src/views/DirectionView.js","../../src/controllers/Direction.js","../../src/views/RadioGridView.js","../../src/controllers/RadioGrid.js","../../src/libs/resize-helpers.js","../../src/views/SliderView.js","../../src/controllers/Slider.js","../../src/views/Vec2View.js","../../src/controllers/Vec2.js","../../src/umd.js"],"sourcesContent":["export default {\n default: `\n.muigui {\n --bg-color: #ddd;\n --color: #222;\n --contrast-color: #eee;\n --value-color: #145 ;\n --value-bg-color: #eeee;\n --disabled-color: #999;\n --menu-bg-color: #f8f8f8;\n --menu-sep-color: #bbb;\n --hover-bg-color: #999;\n --focus-color: #68C;\n --range-color: #888888;\n --invalid-color: #FF0000;\n --selected-color: rgb(255, 255, 255, 0.9);\n\n --button-bg-color: var(--value-bg-color);\n\n --range-left-color: var(--value-color);\n --range-right-color: var(--value-bg-color); \n --range-right-hover-color: var(--hover-bg-color);\n\n color: var(--color);\n background-color: var(--bg-color);\n}\n\n@media (prefers-color-scheme: dark) {\n .muigui {\n --bg-color: #222222;\n --color: #dddddd;\n --contrast-color: #000;\n --value-color: #43e5f7;\n --value-bg-color: #444444;\n --disabled-color: #666666;\n --menu-bg-color: #080808;\n --menu-sep-color: #444444;\n --hover-bg-color: #666666;\n --focus-color: #88AAFF;\n --range-color: #888888;\n --invalid-color: #FF6666;\n --selected-color: rgba(255, 255, 255, 0.3);\n\n --button-bg-color: var(--value-bg-color);\n\n --range-left-color: var(--value-color);\n --range-right-color: var(--value-bg-color); \n --range-right-hover-color: var(--hover-bg-color);\n\n color: var(--color);\n background-color: var(--bg-color);\n }\n}\n\n.muigui {\n --width: 250px;\n --label-width: 45%;\n --number-width: 40%;\n\n\n --font-family: -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, Arial, sans-serif;\n --font-size: 11px;\n --font-family-mono: Menlo, Monaco, Consolas, \"Droid Sans Mono\", monospace;\n --font-size-mono: 11px;\n\n --line-height: 1.7em;\n --border-radius: 0px;\n\n width: var(--width);\n font-family: var(--font-family);\n font-size: var(--font-size);\n box-sizing: border-box;\n line-height: 100%;\n}\n.muigui * {\n box-sizing: inherit;\n}\n\n.muigui-no-scroll {\n touch-action: none;\n}\n.muigui-no-h-scroll {\n touch-action: pan-y;\n}\n.muigui-no-v-scroll {\n touch-action: pan-x;\n}\n\n.muigui-invalid-value {\n background-color: red !important;\n color: white !important;\n}\n\n.muigui-grid {\n display: grid;\n}\n.muigui-rows {\n display: flex;\n flex-direction: column;\n\n min-height: 20px;\n border: 2px solid red;\n}\n.muigui-columns {\n display: flex;\n flex-direction: row;\n\n height: 20px;\n border: 2px solid green;\n}\n.muigui-rows>*,\n.muigui-columns>* {\n flex: 1 1 auto;\n align-items: stretch;\n min-height: 0;\n min-width: 0;\n}\n\n.muigui-row {\n border: 2px solid yellow;\n min-height: 10px\n}\n.muigui-column {\n border: 2px solid lightgreen;\n}\n\n/* -------- */\n\n.muigui-show { /* */ }\n.muigui-hide { \n display: none !important;\n}\n.muigui-disabled {\n pointer-events: none;\n --color: var(--disabled-color) !important;\n --value-color: var(--disabled-color) !important;\n --range-left-color: var(--disabled-color) !important;\n}\n\n.muigui canvas,\n.muigui svg {\n display: block;\n border-radius: var(--border-radius);\n}\n.muigui canvas {\n background-color: var(--value-bg-color);\n}\n\n.muigui-controller {\n min-width: 0;\n min-height: var(--line-height);\n}\n.muigui-root,\n.muigui-menu {\n display: flex;\n flex-direction: column;\n position: relative;\n user-select: none;\n height: fit-content;\n margin: 0;\n padding-bottom: 0.1em;\n border-radius: var(--border-radius);\n}\n.muigui-menu {\n border-bottom: 1px solid var(--menu-sep-color);\n}\n\n.muigui-root>button:nth-child(1),\n.muigui-menu>button:nth-child(1) {\n border-top: 1px solid var(--menu-sep-color);\n border-bottom: 1px solid var(--menu-sep-color);\n position: relative;\n text-align: left;\n color: var(--color);\n background-color: var(--menu-bg-color);\n min-height: var(--line-height);\n padding-top: 0.2em;\n padding-bottom: 0.2em;\n cursor: pointer;\n border-radius: var(--border-radius);\n}\n.muigui-root>div:nth-child(2),\n.muigui-menu>div:nth-child(2) {\n flex: 1 1 auto;\n}\n\n.muigui-controller {\n margin-left: 0.2em;\n margin-right: 0.2em;\n}\n.muigui-root.muigui-controller,\n.muigui-menu.muigui-controller {\n margin-left: 0;\n margin-right: 0;\n}\n.muigui-controller>*:nth-child(1) {\n flex: 1 0 var(--label-width);\n min-width: 0;\n white-space: pre;\n}\n.muigui-controller>label:nth-child(1) {\n place-content: center start;\n display: inline-grid;\n overflow: hidden;\n}\n.muigui-controller>*:nth-child(2) {\n flex: 1 1 75%;\n min-width: 0;\n}\n\n/* -----------------------------------------\n a label controller is [[label][value]]\n*/\n\n.muigui-label-controller {\n display: flex;\n margin: 0.4em 0 0.4em 0;\n word-wrap: initial;\n align-items: stretch;\n}\n\n.muigui-value {\n display: flex;\n align-items: stretch;\n}\n.muigui-value>* {\n flex: 1 1 auto;\n min-width: 0;\n}\n.muigui-value>*:nth-child(1) {\n flex: 1 1 calc(100% - var(--number-width));\n}\n.muigui-value>*:nth-child(2) {\n flex: 1 1 var(--number-width);\n margin-left: 0.2em;\n}\n\n/* fix! */\n.muigui-open>button>label::before,\n.muigui-closed>button>label::before {\n width: 1.25em;\n height: var(--line-height);\n display: inline-grid;\n place-content: center start;\n pointer-events: none;\n}\n.muigui-open>button>label::before {\n content: \"ⓧ\"; /*\"▼\";*/\n}\n.muigui-closed>button>label::before {\n content: \"⨁\"; /*\"▶\";*/\n}\n.muigui-open>*:nth-child(2) {\n transition: max-height 0.2s ease-out,\n opacity 0.5s ease-out;\n max-height: 100vh;\n overflow: auto;\n opacity: 1;\n}\n\n.muigui-closed>*:nth-child(2) {\n transition: max-height 0.2s ease-out,\n opacity 1s;\n max-height: 0;\n opacity: 0;\n overflow: hidden;\n}\n\n/* ---- popdown ---- */\n\n.muigui-pop-down-top {\n display: flex;\n}\n/* fix? */\n.muigui-value>*:nth-child(1).muigui-pop-down-top {\n flex: 0;\n}\n.muigui-pop-down-bottom {\n\n}\n\n.muigui-pop-down-values {\n min-width: 0;\n display: flex;\n}\n.muigui-pop-down-values>* {\n flex: 1 1 auto;\n min-width: 0;\n}\n\n.muigui-value.muigui-pop-down-controller {\n flex-direction: column;\n}\n\n.muigui-pop-down-top input[type=checkbox] {\n -webkit-appearance: none;\n appearance: none;\n width: auto;\n color: var(--value-color);\n background-color: var(--value-bg-color);\n cursor: pointer;\n\n display: grid;\n place-content: center;\n margin: 0;\n font: inherit;\n color: currentColor;\n width: 1.7em;\n height: 1.7em;\n transform: translateY(-0.075em);\n}\n\n.muigui-pop-down-top input[type=checkbox]::before {\n content: \"+\";\n display: grid;\n place-content: center;\n border-radius: calc(var(--border-radius) + 2px);\n border-left: 1px solid rgba(255,255,255,0.3);\n border-top: 1px solid rgba(255,255,255,0.3);\n border-bottom: 1px solid rgba(0,0,0,0.2);\n border-right: 1px solid rgba(0,0,0,0.2);\n background-color: var(--range-color);\n color: var(--value-bg-color);\n width: calc(var(--line-height) - 4px);\n height: calc(var(--line-height) - 4px);\n}\n\n.muigui-pop-down-top input[type=checkbox]:checked::before {\n content: \"X\";\n}\n\n\n/* ---- select ---- */\n\n.muigui select,\n.muigui option,\n.muigui input,\n.muigui button {\n color: var(--value-color);\n background-color: var(--value-bg-color);\n font-family: var(--font-family);\n font-size: var(--font-size);\n border: none;\n margin: 0;\n border-radius: var(--border-radius);\n}\n.muigui select {\n appearance: none;\n margin: 0;\n margin-left: 0; /*?*/\n overflow: hidden; /* Safari */\n}\n\n.muigui select:focus,\n.muigui input:focus,\n.muigui button:focus {\n outline: 1px solid var(--focus-color);\n}\n\n.muigui select:hover,\n.muigui option:hover,\n.muigui input:hover,\n.muigui button:hover {\n background-color: var(--hover-bg-color); \n}\n\n/* ------ [ label ] ------ */\n\n.muigui-label {\n border-top: 1px solid var(--menu-sep-color);\n border-bottom: 1px solid var(--menu-sep-color);\n padding-top: 0.4em;\n padding-bottom: 0.3em;\n place-content: center start;\n background-color: var(--menu-bg-color);\n white-space: pre;\n border-radius: var(--border-radius);\n}\n\n/* ------ [ divider] ------ */\n\n.muigui-divider {\n min-height: 6px;\n border-top: 2px solid var(--menu-sep-color);\n margin-top: 6px;\n}\n\n/* ------ [ button ] ------ */\n\n.muigui-button {\n display: grid;\n\n}\n.muigui-button button {\n border: none;\n color: var(--value-color);\n background-color: var(--button-bg-color);\n cursor: pointer;\n place-content: center center;\n}\n\n/* ------ [ color ] ------ */\n\n.muigui-color>div {\n overflow: hidden;\n position: relative;\n margin-left: 0;\n margin-right: 0; /* why? */\n max-width: var(--line-height);\n border-radius: var(--border-radius);\n}\n\n.muigui-color>div:focus-within {\n outline: 1px solid var(--focus-color);\n}\n\n.muigui-color input[type=color] {\n border: none;\n padding: 0;\n background: inherit;\n cursor: pointer;\n position: absolute;\n width: 200%;\n left: -10px;\n top: -10px;\n height: 200%;\n}\n.muigui-disabled canvas,\n.muigui-disabled svg,\n.muigui-disabled img,\n.muigui-disabled .muigui-color input[type=color] {\n opacity: 0.2;\n}\n\n/* ------ [ checkbox ] ------ */\n\n.muigui-checkbox>label:nth-child(2) {\n display: grid;\n place-content: center start;\n margin: 0;\n}\n\n.muigui-checkbox input[type=checkbox] {\n -webkit-appearance: none;\n appearance: none;\n width: auto;\n color: var(--value-color);\n background-color: var(--value-bg-color);\n cursor: pointer;\n\n display: grid;\n place-content: center;\n margin: 0;\n font: inherit;\n color: currentColor;\n width: 1.7em;\n height: 1.7em;\n transform: translateY(-0.075em);\n}\n\n.muigui-checkbox input[type=checkbox]::before {\n content: \"\";\n color: var(--value-color);\n display: grid;\n place-content: center;\n}\n\n.muigui-checkbox input[type=checkbox]:checked::before {\n content: \"✔\";\n}\n\n.muigui input[type=number]::-webkit-inner-spin-button, \n.muigui input[type=number]::-webkit-outer-spin-button { \n -webkit-appearance: none;\n appearance: none;\n margin: 0; \n}\n.muigui input[type=number] {\n -moz-appearance: textfield;\n}\n\n/* ------ [ radio grid ] ------ */\n\n.muigui-radio-grid>div {\n display: grid;\n gap: 2px;\n}\n\n.muigui-radio-grid input {\n appearance: none;\n display: none;\n}\n\n.muigui-radio-grid button {\n color: var(--color);\n width: 100%;\n text-align: left;\n}\n\n.muigui-radio-grid input:checked + button {\n color: var(--value-color);\n background-color: var(--selected-color);\n}\n\n/* ------ [ color-chooser ] ------ */\n\n.muigui-color-chooser-cursor {\n stroke-width: 1px;\n stroke: white;\n fill: none;\n}\n.muigui-color-chooser-circle {\n stroke-width: 1px;\n stroke: white;\n fill: none;\n}\n\n\n/* ------ [ vec2 ] ------ */\n\n.muigui-vec2 svg {\n background-color: var(--value-bg-color);\n}\n\n.muigui-vec2-axis {\n stroke: 1px;\n stroke: var(--focus-color);\n}\n\n.muigui-vec2-line {\n stroke-width: 1px;\n stroke: var(--value-color);\n fill: var(--value-color);\n}\n\n/* ------ [ direction ] ------ */\n\n.muigui-direction svg {\n background-color: rgba(0,0,0,0.2);\n}\n\n.muigui-direction:focus-within svg {\n outline: none;\n}\n.muigui-direction-range {\n fill: var(--value-bg-color);\n}\n.muigui-direction svg:focus {\n outline: none;\n}\n.muigui-direction svg:focus .muigui-direction-range {\n stroke-width: 0.5px;\n stroke: var(--focus-color);\n}\n\n.muigui-direction-arrow {\n fill: var(--value-color);\n}\n\n/* ------ [ slider ] ------ */\n\n.muigui-slider>div {\n display: flex;\n align-items: stretch;\n height: var(--line-height);\n}\n.muigui-slider svg {\n flex: 1 1 auto;\n}\n.muigui-slider .muigui-slider-up #muigui-orientation {\n transform: scale(1, -1) translateY(-100%);\n}\n\n.muigui-slider .muigui-slider-up #muigui-number-orientation {\n transform: scale(1,-1);\n}\n\n.muigui-ticks {\n stroke: var(--range-color);\n}\n.muigui-thicks {\n stroke: var(--color);\n stroke-width: 2px;\n}\n.muigui-svg-text {\n fill: var(--color);\n font-size: 7px;\n}\n.muigui-mark {\n fill: var(--value-color);\n}\n\n/* ------ [ range ] ------ */\n\n\n.muigui-range input[type=range] {\n -webkit-appearance: none;\n appearance: none;\n background-color: transparent;\n}\n\n.muigui-range input[type=range]::-webkit-slider-thumb {\n -webkit-appearance: none;\n appearance: none;\n border-radius: calc(var(--border-radius) + 2px);\n border-left: 1px solid rgba(255,255,255,0.3);\n border-top: 1px solid rgba(255,255,255,0.3);\n border-bottom: 1px solid rgba(0,0,0,0.2);\n border-right: 1px solid rgba(0,0,0,0.2);\n background-color: var(--range-color);\n margin-top: calc((var(--line-height) - 2px) / -2);\n width: calc(var(--line-height) - 2px);\n height: calc(var(--line-height) - 2px);\n}\n\n.muigui-range input[type=range]::-webkit-slider-runnable-track {\n -webkit-appearance: none;\n appearance: none;\n border: 1px solid var(--menu-sep-color);\n height: 2px;\n}\n\n\n/* dat.gui style - doesn't work on Safari iOS */\n\n/*\n.muigui-range input[type=range] {\n cursor: ew-resize;\n overflow: hidden;\n}\n\n.muigui-range input[type=range] {\n -webkit-appearance: none;\n appearance: none;\n background-color: var(--range-right-color);\n margin: 0;\n}\n.muigui-range input[type=range]:hover {\n background-color: var(--range-right-hover-color);\n}\n\n.muigui-range input[type=range]::-webkit-slider-runnable-track {\n -webkit-appearance: none;\n appearance: none;\n height: max-content;\n color: var(--range-left-color);\n margin-top: -1px;\n}\n\n.muigui-range input[type=range]::-webkit-slider-thumb {\n -webkit-appearance: none;\n appearance: none;\n width: 0px;\n height: max-content;\n box-shadow: -1000px 0 0 1000px var(--range-left-color);\n}\n*/\n\n/* FF */\n/*\n.muigui-range input[type=range]::-moz-slider-progress {\n background-color: var(--range-left-color); \n}\n.muigui-range input[type=range]::-moz-slider-thumb {\n height: max-content;\n width: 0;\n border: none;\n box-shadow: -1000px 0 0 1000px var(--range-left-color);\n box-sizing: border-box;\n}\n*/\n\n.muigui-checkered-background {\n background-color: #404040;\n background-image:\n linear-gradient(45deg, #808080 25%, transparent 25%),\n linear-gradient(-45deg, #808080 25%, transparent 25%),\n linear-gradient(45deg, transparent 75%, #808080 75%),\n linear-gradient(-45deg, transparent 75%, #808080 75%);\n background-size: 16px 16px;\n background-position: 0 0, 0 8px, 8px -8px, -8px 0px;\n}\n\n/* ---------------------------------------------------------- */\n\n/* needs to be at bottom to take precedence */\n.muigui-auto-place {\n max-height: 100%;\n position: fixed;\n top: 0;\n right: 15px;\n z-index: 100001;\n}\n\n`,\nthemes: {\n default: '',\n float: `\n :root {\n color-scheme: light dark,\n }\n\n .muigui {\n --width: 400px;\n --bg-color: initial;\n --label-width: 25%;\n --number-width: 20%;\n }\n\n input,\n .muigui-label-controller>label {\n text-shadow:\n -1px -1px 0 var(--contrast-color),\n 1px -1px 0 var(--contrast-color),\n -1px 1px 0 var(--contrast-color),\n 1px 1px 0 var(--contrast-color);\n }\n\n .muigui-controller > label:nth-child(1) {\n place-content: center end;\n margin-right: 1em;\n }\n\n .muigui-value > :nth-child(2) {\n margin-left: 1em;\n }\n\n .muigui-root>*:nth-child(1) {\n display: none;\n }\n\n .muigui-range input[type=range]::-webkit-slider-thumb {\n border-radius: 1em;\n }\n\n .muigui-range input[type=range]::-webkit-slider-runnable-track {\n -webkit-appearance: initial;\n appearance: none;\n border: 1px solid rgba(0, 0, 0, 0.25);\n height: 2px;\n }\n\n .muigui-colors {\n --value-color: var(--color );\n --value-bg-color: rgba(0, 0, 0, 0.1);\n --disabled-color: #cccccc;\n --menu-bg-color: rgba(0, 0, 0, 0.1);\n --menu-sep-color: #bbbbbb;\n --hover-bg-color: rgba(0, 0, 0, 0);\n --invalid-color: #FF0000;\n --selected-color: rgba(0, 0, 0, 0.3);\n --range-color: rgba(0, 0, 0, 0.125);\n }\n`,\n},\n};\n","export function setElemProps(elem, attrs, children) {\n for (const [key, value] of Object.entries(attrs)) {\n if (typeof value === 'function' && key.startsWith('on')) {\n const eventName = key.substring(2).toLowerCase();\n elem.addEventListener(eventName, value, {passive: false});\n } else if (typeof value === 'object') {\n for (const [k, v] of Object.entries(value)) {\n elem[key][k] = v;\n }\n } else if (elem[key] === undefined) {\n elem.setAttribute(key, value);\n } else {\n elem[key] = value;\n }\n }\n for (const child of children) {\n elem.appendChild(child);\n }\n return elem;\n}\n\nexport function createElem(tag, attrs = {}, children = []) {\n const elem = document.createElement(tag);\n setElemProps(elem, attrs, children);\n return elem;\n}\n\nexport function addElem(tag, parent, attrs = {}, children = []) {\n const elem = createElem(tag, attrs, children);\n parent.appendChild(elem);\n return elem;\n}\n\nlet nextId = 0;\nexport function getNewId() {\n return `muigui-id-${nextId++}`;\n}\n","export function removeArrayElem(array, value) {\n const ndx = array.indexOf(value);\n if (ndx) {\n array.splice(ndx, 1);\n }\n return array;\n}\n\n/**\n * Converts an camelCase or snake_case id to \"camel case\" or \"snake case\"\n * @param {string} id\n */\nconst underscoreRE = /_/g;\nconst upperLowerRE = /([A-Z])([a-z])/g;\nexport function idToLabel(id) {\n return id.replace(underscoreRE, ' ')\n .replace(upperLowerRE, (m, m1, m2) => `${m1.toLowerCase()} ${m2}`);\n}\n\nexport function clamp(v, min, max) {\n return Math.max(min, Math.min(max, v));\n}\n\nexport const isTypedArray = typeof SharedArrayBuffer !== 'undefined'\n ? function isArrayBufferOrSharedArrayBuffer(a) {\n return a && a.buffer && (a.buffer instanceof ArrayBuffer || a.buffer instanceof SharedArrayBuffer);\n }\n : function isArrayBuffer(a) {\n return a && a.buffer && a.buffer instanceof ArrayBuffer;\n };\n\nexport const isArrayOrTypedArray = v => Array.isArray(v) || isTypedArray(v);\n\n// Yea, I know this should be `Math.round(v / step) * step\n// but try step = 0.1, newV = 19.95\n//\n// I get\n// Math.round(19.95 / 0.1) * 0.1\n// 19.900000000000002\n// vs\n// Math.round(19.95 / 0.1) / (1 / 0.1)\n// 19.9\n//\nexport const stepify = (v, from, step) => Math.round(from(v) / step) / (1 / step);\n\nexport const euclideanModulo = (v, n) => ((v % n) + n) % n;\nexport const lerp = (a, b, t) => a + (b - a) * t;\nexport function copyExistingProperties(dst, src) {\n for (const key in src) {\n if (key in dst) {\n dst[key] = src[key];\n }\n }\n return dst;\n}\n\nexport const mapRange = (v, inMin, inMax, outMin, outMax) => (v - inMin) * (outMax - outMin) / (inMax - inMin) + outMin;\n\nexport const makeRangeConverters = ({from, to}) => {\n return {\n to: v => mapRange(v, ...from, ...to),\n from: v => [true, mapRange(v, ...to, ...from)],\n };\n};\n\nexport const makeRangeOptions = ({from, to, step}) => {\n return {\n min: to[0],\n max: to[1],\n ...(step && {step}),\n converters: makeRangeConverters({from, to}),\n };\n};\n\n// TODO: remove an use one in conversions. Move makeRangeConverters there?\nexport const identity = {\n to: v => v,\n from: v => [true, v],\n};\nexport function makeMinMaxPair(gui, properties, minPropName, maxPropName, options) {\n const { converters: { from } = identity } = options;\n const { min, max } = options;\n const guiMinRange = options.minRange || 0;\n const valueMinRange = from(guiMinRange)[1];\n const minGui = gui\n .add(properties, minPropName, {\n ...options,\n min,\n max: max - guiMinRange,\n })\n .onChange(v => {\n maxGui.setValue(Math.min(max, Math.max(v + valueMinRange, properties[maxPropName])));\n });\n const maxGui = gui\n .add(properties, maxPropName, {\n ...options,\n min: min + guiMinRange,\n max,\n })\n .onChange(v => {\n minGui.setValue(Math.max(min, Math.min(v - valueMinRange, properties[minPropName])));\n });\n return [ minGui, maxGui ];\n}\n\n","import { removeArrayElem } from '../libs/utils.js';\n\nexport default class View {\n domElement: HTMLElement;\n\n #childDestElem: HTMLElement;\n #views: View[] = [];\n\n constructor(elem: HTMLElement) {\n this.domElement = elem;\n this.#childDestElem = elem;\n }\n addElem(elem: HTMLElement) {\n this.#childDestElem.appendChild(elem);\n return elem;\n }\n removeElem(elem: HTMLElement) {\n this.#childDestElem.removeChild(elem);\n return elem;\n }\n pushSubElem(elem: HTMLElement) {\n this.#childDestElem.appendChild(elem);\n this.#childDestElem = elem;\n }\n popSubElem() {\n this.#childDestElem = this.#childDestElem.parentElement!;\n }\n add(view: View) {\n this.#views.push(view);\n this.addElem(view.domElement);\n return view;\n }\n remove(view: View) {\n this.removeElem(view.domElement);\n removeArrayElem(this.#views, view);\n return view;\n }\n pushSubView(view: View) {\n this.pushSubElem(view.domElement);\n }\n popSubView() {\n this.popSubElem();\n }\n setOptions(options: any) {\n for (const view of this.#views) {\n view.setOptions(options);\n }\n }\n updateDisplayIfNeeded(newV: any, ignoreCache?: boolean) {\n for (const view of this.#views) {\n view.updateDisplayIfNeeded(newV, ignoreCache);\n }\n return this;\n }\n $(selector: string) {\n return this.domElement.querySelector(selector);\n }\n}","import { createElem } from '../libs/elem.js';\nimport { removeArrayElem } from '../libs/utils.js';\nimport View from '../views/View.js';\n\nexport default class Controller extends View {\n #changeFns;\n #finishChangeFns;\n #parent;\n\n constructor(className) {\n super(createElem('div', {className: 'muigui-controller'}));\n this.#changeFns = [];\n this.#finishChangeFns = [];\n // we need the specialization to come last so it takes precedence.\n if (className) {\n this.domElement.classList.add(className);\n }\n }\n get parent() {\n return this.#parent;\n }\n setParent(parent) {\n this.#parent = parent;\n this.enable(!this.disabled());\n }\n show(show = true) {\n this.domElement.classList.toggle('muigui-hide', !show);\n this.domElement.classList.toggle('muigui-show', show);\n return this;\n }\n hide() {\n return this.show(false);\n }\n disabled() {\n return !!this.domElement.closest('.muigui-disabled');\n }\n\n enable(enable = true) {\n this.domElement.classList.toggle('muigui-disabled', !enable);\n\n // If disabled we need to set the attribute 'disabled=true' to all\n // input/select/button/textarea's below\n //\n // If enabled we need to set the attribute 'disabled=false' to all below\n // until we hit a disabled controller.\n //\n // ATM the problem is we can find the input/select/button/textarea elements\n // but we can't easily find which controller they belong do.\n // But we don't need to? We can just check up if it or parent has\n // '.muigui-disabled'\n ['input', 'button', 'select', 'textarea'].forEach(tag => {\n this.domElement.querySelectorAll(tag).forEach(elem => {\n const disabled = !!elem.closest('.muigui-disabled');\n elem.disabled = disabled;\n });\n });\n\n return this;\n }\n disable(disable = true) {\n return this.enable(!disable);\n }\n onChange(fn) {\n this.removeChange(fn);\n this.#changeFns.push(fn);\n return this;\n }\n removeChange(fn) {\n removeArrayElem(this.#changeFns, fn);\n return this;\n }\n onFinishChange(fn) {\n this.removeFinishChange(fn);\n this.#finishChangeFns.push(fn);\n return this;\n }\n removeFinishChange(fn) {\n removeArrayElem(this.#finishChangeFns, fn);\n return this;\n }\n #callListeners(fns, newV) {\n for (const fn of fns) {\n fn.call(this, newV);\n }\n }\n emitChange(value, object, property) {\n this.#callListeners(this.#changeFns, value);\n if (this.#parent) {\n if (object === undefined) {\n this.#parent.emitChange(value);\n } else {\n this.#parent.emitChange({\n object,\n property,\n value,\n controller: this,\n });\n }\n }\n }\n emitFinalChange(value, object, property) {\n this.#callListeners(this.#finishChangeFns, value);\n if (this.#parent) {\n if (object === undefined) {\n this.#parent.emitChange(value);\n } else {\n this.#parent.emitFinalChange({\n object,\n property,\n value,\n controller: this,\n });\n }\n }\n }\n updateDisplay() {\n // placeholder. override\n }\n getColors() {\n const toCamelCase = s => s.replace(/-([a-z])/g, (m, m1) => m1.toUpperCase());\n const keys = [\n 'color',\n 'bg-color',\n 'value-color',\n 'value-bg-color',\n 'hover-bg-color',\n 'menu-bg-color',\n 'menu-sep-color',\n 'disabled-color',\n ];\n const div = createElem('div');\n this.domElement.appendChild(div);\n const colors = Object.fromEntries(keys.map(key => {\n div.style.color = `var(--${key})`;\n const s = getComputedStyle(div);\n return [toCamelCase(key), s.color];\n }));\n div.remove();\n return colors;\n }\n}\n","import {\n createElem,\n} from '../libs/elem.js';\nimport { copyExistingProperties } from '../libs/utils.js';\nimport Controller from './Controller.js';\n\nexport default class Button extends Controller {\n #object;\n #property;\n #buttonElem;\n #options = {\n name: '',\n };\n\n constructor(object, property, options = {}) {\n super('muigui-button', '');\n this.#object = object;\n this.#property = property;\n\n this.#buttonElem = this.addElem(\n createElem('button', {\n type: 'button',\n onClick: () => {\n this.#object[this.#property](this);\n },\n }));\n this.setOptions({name: property, ...options});\n }\n setOptions(options) {\n copyExistingProperties(this.#options, options);\n const {name} = this.#options;\n this.#buttonElem.textContent = name;\n }\n}","import { isTypedArray } from '../libs/utils.js';\nimport View from './View.js';\n\nfunction arraysEqual(a, b) {\n if (a.length !== b.length) {\n return false;\n }\n for (let i = 0; i < a.length; ++i) {\n if (a[i] !== b[i]) {\n return false;\n }\n }\n return true;\n}\n\nfunction copyArrayElementsFromTo(src, dst) {\n dst.length = src.length;\n for (let i = 0; i < src.length; ++i) {\n dst[i] = src[i];\n }\n}\n\nexport default class EditView extends View {\n #oldV;\n #updateCheck;\n\n #checkArrayNeedsUpdate(newV) {\n // It's an array, we need to compare all elements\n // Example, vec2, [r,g,b], ...\n const needUpdate = !arraysEqual(newV, this.#oldV);\n if (needUpdate) {\n copyArrayElementsFromTo(newV, this.#oldV);\n }\n return needUpdate;\n }\n\n #checkTypedArrayNeedsUpdate() {\n let once = true;\n return function checkTypedArrayNeedsUpdateImpl(newV) {\n // It's a typedarray, we need to compare all elements\n // Example: Float32Array([r, g, b])\n let needUpdate = once;\n once = false;\n if (!needUpdate) {\n needUpdate = !arraysEqual(newV, this.#oldV);\n }\n return needUpdate;\n };\n }\n\n #checkObjectNeedsUpdate(newV) {\n let needUpdate = false;\n for (const key in newV) {\n if (newV[key] !== this.#oldV[key]) {\n needUpdate = true;\n this.#oldV[key] = newV[key];\n }\n }\n return needUpdate;\n }\n\n #checkValueNeedsUpdate(newV) {\n const needUpdate = newV !== this.#oldV;\n this.#oldV = newV;\n return needUpdate;\n }\n\n #getUpdateCheckForType(newV) {\n if (Array.isArray(newV)) {\n this.#oldV = [];\n return this.#checkArrayNeedsUpdate.bind(this);\n } else if (isTypedArray(newV)) {\n this.#oldV = new newV.constructor(newV);\n return this.#checkTypedArrayNeedsUpdate(this);\n } else if (typeof newV === 'object') {\n this.#oldV = {};\n return this.#checkObjectNeedsUpdate.bind(this);\n } else {\n return this.#checkValueNeedsUpdate.bind(this);\n }\n }\n\n // The point of this is updating DOM elements\n // is slow but if we've called `listen` then\n // every frame we're going to try to update\n // things with the current value so if nothing\n // has changed then skip it.\n updateDisplayIfNeeded(newV, ignoreCache) {\n this.#updateCheck = this.#updateCheck || this.#getUpdateCheckForType(newV);\n // Note: We call #updateCheck first because it updates\n // the cache\n if (this.#updateCheck(newV) || ignoreCache) {\n this.updateDisplay(newV);\n }\n }\n setOptions(/*options*/) {\n // override this\n return this;\n }\n}\n","import { createElem } from '../libs/elem.js';\nimport EditView from './EditView.js';\n\nexport default class CheckboxView extends EditView {\n #checkboxElem;\n constructor(setter, id) {\n const checkboxElem = createElem('input', {\n type: 'checkbox',\n id,\n onInput: () => {\n setter.setValue(checkboxElem.checked);\n },\n onChange: () => {\n setter.setFinalValue(checkboxElem.checked);\n },\n });\n super(createElem('label', {}, [checkboxElem]));\n this.#checkboxElem = checkboxElem;\n }\n updateDisplay(v) {\n this.#checkboxElem.checked = v;\n }\n}\n","import { removeArrayElem } from './utils.js';\n\nconst tasks = [];\nconst tasksToRemove = new Set();\n\nlet requestId;\nlet processing;\n\nfunction removeTasks() {\n if (!tasksToRemove.size) {\n return;\n }\n\n if (processing) {\n queueProcessing();\n return;\n }\n\n tasksToRemove.forEach(task => {\n removeArrayElem(tasks, task);\n });\n tasksToRemove.clear();\n}\n\nfunction processTasks() {\n requestId = undefined;\n processing = true;\n for (const task of tasks) {\n if (!tasksToRemove.has(task)) {\n task();\n }\n }\n processing = false;\n removeTasks();\n queueProcessing();\n}\n\nfunction queueProcessing() {\n if (!requestId && tasks.length) {\n requestId = requestAnimationFrame(processTasks);\n }\n}\n\nexport function addTask(fn) {\n tasks.push(fn);\n queueProcessing();\n}\n\nexport function removeTask(fn) {\n tasksToRemove.set(fn);\n\n const ndx = tasks.indexOf(fn);\n if (ndx >= 0) {\n tasks.splice(ndx, 1);\n }\n}","let id = 0;\n\nexport function makeId() {\n return `muigui-${++id}`;\n}\n","import { createElem } from '../libs/elem.js';\nimport View from './View.js';\n\nexport default class ValueView extends View {\n constructor(className = '') {\n super(createElem('div', {className: 'muigui-value'}));\n if (className) {\n this.domElement.classList.add(className);\n }\n }\n}","import { createElem } from '../libs/elem.js';\nimport { makeId } from '../libs/ids.js';\nimport ValueView from '../views/ValueView.js';\nimport Controller from './Controller.js';\n\nexport default class LabelController extends Controller {\n #id;\n #nameElem;\n\n constructor(className = '', name = '') {\n super('muigui-label-controller');\n this.#id = makeId();\n this.#nameElem = createElem('label', {for: this.#id});\n this.domElement.appendChild(this.#nameElem);\n this.pushSubView(new ValueView(className));\n this.name(name);\n }\n get id() {\n return this.#id;\n }\n name(name) {\n if (this.#nameElem.title === this.#nameElem.textContent) {\n this.#nameElem.title = name;\n }\n this.#nameElem.textContent = name;\n return this;\n }\n tooltip(tip) {\n this.#nameElem.title = tip;\n }\n}\n\n","import {addTask, removeTask} from '../libs/taskrunner.js';\nimport { isTypedArray } from '../libs/utils.js';\nimport LabelController from './LabelController.js';\n\nexport default class ValueController extends LabelController {\n #object;\n #property;\n #initialValue;\n #listening;\n #views;\n #updateFn;\n\n constructor(object, property, className = '') {\n super(className, property);\n this.#object = object;\n this.#property = property;\n this.#initialValue = this.getValue();\n this.#listening = false;\n this.#views = [];\n }\n get initialValue() {\n return this.#initialValue;\n }\n get object() {\n return this.#object;\n }\n get property() {\n return this.#property;\n }\n add(view) {\n this.#views.push(view);\n super.add(view);\n this.updateDisplay();\n return view;\n }\n #setValueImpl(v, ignoreCache) {\n let isDifferent = false;\n if (typeof v === 'object') {\n const dst = this.#object[this.#property];\n // don't replace objects, just their values.\n if (Array.isArray(v) || isTypedArray(v)) {\n for (let i = 0; i < v.length; ++i) {\n isDifferent ||= dst[i] !== v[i];\n dst[i] = v[i];\n }\n } else {\n for (const key of Object.keys(v)) {\n isDifferent ||= dst[key] !== v[key];\n }\n Object.assign(dst, v);\n }\n } else {\n isDifferent = this.#object[this.#property] !== v;\n this.#object[this.#property] = v;\n }\n this.updateDisplay(ignoreCache);\n if (isDifferent) {\n this.emitChange(this.getValue(), this.#object, this.#property);\n }\n return isDifferent;\n }\n setValue(v) {\n this.#setValueImpl(v);\n }\n setFinalValue(v) {\n const isDifferent = this.#setValueImpl(v, true);\n if (isDifferent) {\n this.emitFinalChange(this.getValue(), this.#object, this.#property);\n }\n return this;\n }\n updateDisplay(ignoreCache) {\n const newV = this.getValue();\n for (const view of this.#views) {\n view.updateDisplayIfNeeded(newV, ignoreCache);\n }\n return this;\n }\n setOptions(options) {\n for (const view of this.#views) {\n view.setOptions(options);\n }\n this.updateDisplay();\n return this;\n }\n getValue() {\n return this.#object[this.#property];\n }\n value(v) {\n this.setValue(v);\n return this;\n }\n reset() {\n this.setValue(this.#initialValue);\n return this;\n }\n listen(listen = true) {\n if (!this.#updateFn) {\n this.#updateFn = this.updateDisplay.bind(this);\n }\n if (listen) {\n if (!this.#listening) {\n this.#listening = true;\n addTask(this.#updateFn);\n }\n } else {\n if (this.#listening) {\n this.#listening = false;\n removeTask(this.#updateFn);\n }\n }\n return this;\n }\n}\n\n","import CheckboxView from '../views/CheckboxView.js';\nimport ValueController from './ValueController.js';\n\nexport default class Checkbox extends ValueController {\n constructor(object, property) {\n super(object, property, 'muigui-checkbox');\n const id = this.id;\n this.add(new CheckboxView(this, id));\n this.updateDisplay();\n }\n}","import {\n makeRangeConverters,\n} from './utils.js';\n\nexport const identity = {\n to: v => v,\n from: v => [true, v],\n};\n\n// from: from string to value\n// to: from value to string\nexport const strToNumber = {\n to: v => v.toString(),\n from: v => {\n const newV = parseFloat(v);\n return [!Number.isNaN(newV), newV];\n },\n};\n\nexport const converters = {\n radToDeg: makeRangeConverters({to: [0, 180], from: [0, Math.PI]}),\n};\n","export function createWheelHelper() {\n let wheelAccum = 0;\n return function (e, step, wheelScale = 5) {\n wheelAccum -= e.deltaY * step / wheelScale;\n const wheelSteps = Math.floor(Math.abs(wheelAccum) / step) * Math.sign(wheelAccum);\n const delta = wheelSteps * step;\n wheelAccum -= delta;\n return delta;\n };\n}\n","import { createElem } from '../libs/elem.js';\nimport { strToNumber } from '../libs/conversions.js';\nimport { createWheelHelper } from '../libs/wheel.js';\nimport { clamp, copyExistingProperties, stepify } from '../libs/utils.js';\nimport EditView from './EditView.js';\n\nexport default class NumberView extends EditView {\n #to;\n #from;\n #step;\n #skipUpdate;\n #options = {\n step: 0.01,\n converters: strToNumber,\n min: Number.NEGATIVE_INFINITY,\n max: Number.POSITIVE_INFINITY,\n };\n\n constructor(setter, options) {\n const setValue = setter.setValue.bind(setter);\n const setFinalValue = setter.setFinalValue.bind(setter);\n const wheelHelper = createWheelHelper();\n super(createElem('input', {\n type: 'number',\n onInput: () => this.#handleInput(setValue, true),\n onChange: () => this.#handleInput(setFinalValue, false),\n onWheel: e => {\n e.preventDefault();\n const {min, max, step} = this.#options;\n const delta = wheelHelper(e, step);\n const v = parseFloat(this.domElement.value);\n const newV = clamp(stepify(v + delta, v => v, step), min, max);\n setter.setValue(newV);\n },\n }));\n this.setOptions(options);\n }\n #handleInput(setFn, skipUpdate) {\n const v = parseFloat(this.domElement.value);\n const [valid, newV] = this.#from(v);\n let inRange;\n if (valid && !Number.isNaN(v)) {\n const {min, max} = this.#options;\n inRange = newV >= min && newV <= max;\n this.#skipUpdate = skipUpdate;\n setFn(clamp(newV, min, max));\n }\n this.domElement.classList.toggle('muigui-invalid-value', !valid || !inRange);\n }\n updateDisplay(v) {\n if (!this.#skipUpdate) {\n this.domElement.value = stepify(v, this.#to, this.#step);\n }\n this.#skipUpdate = false;\n }\n setOptions(options) {\n copyExistingProperties(this.#options, options);\n const {\n step,\n converters: {to, from},\n } = this.#options;\n this.#to = to;\n this.#from = from;\n this.#step = step;\n return this;\n }\n}\n","\nimport NumberView from '../views/NumberView.js';\nimport ValueController from './ValueController.js';\n\n// Wanted to name this `Number` but it conflicts with\n// JavaScript `Number`. It most likely wouldn't be\n// an issue? But users might `import {Number} ...` and\n// things would break.\nexport default class TextNumber extends ValueController {\n #textView;\n #step;\n\n constructor(object, property, options = {}) {\n super(object, property, 'muigui-checkbox');\n this.#textView = this.add(new NumberView(this, options));\n this.updateDisplay();\n }\n}","import { createElem } from '../libs/elem.js';\nimport EditView from './EditView.js';\n\nexport default class SelectView extends EditView {\n #values;\n\n constructor(setter, keyValues) {\n const values = [];\n super(createElem('select', {\n onChange: () => {\n setter.setFinalValue(this.#values[this.domElement.selectedIndex]);\n },\n }, keyValues.map(([key, value]) => {\n values.push(value);\n return createElem('option', {textContent: key});\n })));\n this.#values = values;\n }\n updateDisplay(v) {\n const ndx = this.#values.indexOf(v);\n this.domElement.selectedIndex = ndx;\n }\n}\n","\n// 4 cases\n// (a) keyValues is array of arrays, each sub array is key value\n// (b) keyValues is array and value is number then keys = array contents, value = index\n// (c) keyValues is array and value is not number, key = array contents, value = array contents\n// (d) keyValues is object then key->value\nexport function convertToKeyValues(keyValues, valueIsNumber) {\n if (Array.isArray(keyValues)) {\n if (Array.isArray(keyValues[0])) {\n // (a) keyValues is array of arrays, each sub array is key value\n return keyValues;\n } else {\n if (valueIsNumber) {\n // (b) keyValues is array and value is number then keys = array contents, value = index\n return keyValues.map((v, ndx) => [v, ndx]);\n } else {\n // (c) keyValues is array and value is not number, key = array contents, value = array contents\n return keyValues.map(v => [v, v]);\n }\n }\n } else {\n // (d)\n return [...Object.entries(keyValues)];\n }\n}\n","import SelectView from '../views/SelectView.js';\nimport ValueController from './ValueController.js';\nimport { convertToKeyValues } from '../libs/key-values.js';\n\nexport default class Select extends ValueController {\n constructor(object, property, options) {\n super(object, property, 'muigui-select');\n const valueIsNumber = typeof this.getValue() === 'number';\n const {keyValues: keyValuesInput} = options;\n const keyValues = convertToKeyValues(keyValuesInput, valueIsNumber);\n this.add(new SelectView(this, keyValues));\n this.updateDisplay();\n }\n}","import { createElem } from '../libs/elem.js';\nimport { identity } from '../libs/conversions.js';\nimport { clamp, copyExistingProperties, stepify } from '../libs/utils.js';\nimport { createWheelHelper } from '../libs/wheel.js';\nimport EditView from './EditView.js';\n\nexport default class RangeView extends EditView {\n #to;\n #from;\n #step;\n #skipUpdate;\n #options = {\n step: 0.01,\n min: 0,\n max: 1,\n converters: identity,\n };\n\n constructor(setter, options) {\n const wheelHelper = createWheelHelper();\n super(createElem('input', {\n type: 'range',\n onInput: () => {\n this.#skipUpdate = true;\n const {min, max, step} = this.#options;\n const v = parseFloat(this.domElement.value);\n const newV = clamp(stepify(v, v => v, step), min, max);\n const [valid, validV] = this.#from(newV);\n if (valid) {\n setter.setValue(validV);\n }\n },\n onChange: () => {\n this.#skipUpdate = true;\n const {min, max, step} = this.#options;\n const v = parseFloat(this.domElement.value);\n const newV = clamp(stepify(v, v => v, step), min, max);\n const [valid, validV] = this.#from(newV);\n if (valid) {\n setter.setFinalValue(validV);\n }\n },\n onWheel: e => {\n e.preventDefault();\n const [valid, v] = this.#from(parseFloat(this.domElement.value));\n if (!valid) {\n return;\n }\n const {min, max, step} = this.#options;\n const delta = wheelHelper(e, step);\n const newV = clamp(stepify(v + delta, v => v, step), min, max);\n setter.setValue(newV);\n },\n }));\n this.setOptions(options);\n }\n updateDisplay(v) {\n if (!this.#skipUpdate) {\n this.domElement.value = stepify(v, this.#to, this.#step);\n }\n this.#skipUpdate = false;\n }\n setOptions(options) {\n copyExistingProperties(this.#options, options);\n const {\n step,\n min,\n max,\n converters: {to, from},\n } = this.#options;\n this.#to = to;\n this.#from = from;\n this.#step = step;\n this.domElement.step = step;\n this.domElement.min = min;\n this.domElement.max = max;\n return this;\n }\n}","import ValueController from './ValueController.js';\nimport NumberView from '../views/NumberView.js';\nimport RangeView from '../views/RangeView.js';\n\nexport default class Range extends ValueController {\n constructor(object, property, options) {\n super(object, property, 'muigui-range');\n this.add(new RangeView(this, options));\n this.add(new NumberView(this, options));\n }\n}\n","import { createElem } from '../libs/elem.js';\nimport { identity } from '../libs/conversions.js';\nimport EditView from './EditView.js';\nimport { copyExistingProperties } from '../libs/utils.js';\n\nexport default class TextView extends EditView {\n #to;\n #from;\n #skipUpdate;\n #options = {\n converters: identity,\n };\n\n constructor(setter, options) {\n const setValue = setter.setValue.bind(setter);\n const setFinalValue = setter.setFinalValue.bind(setter);\n super(createElem('input', {\n type: 'text',\n onInput: () => this.#handleInput(setValue, true),\n onChange: () => this.#handleInput(setFinalValue, false),\n }));\n this.setOptions(options);\n }\n #handleInput(setFn, skipUpdate) {\n const [valid, newV] = this.#from(this.domElement.value);\n if (valid) {\n this.#skipUpdate = skipUpdate;\n setFn(newV);\n }\n this.domElement.style.color = valid ? '' : 'var(--invalid-color)';\n\n }\n updateDisplay(v) {\n if (!this.#skipUpdate) {\n this.domElement.value = this.#to(v);\n this.domElement.style.color = '';\n }\n this.#skipUpdate = false;\n }\n setOptions(options) {\n copyExistingProperties(this.#options, options);\n const {\n converters: {to, from},\n } = this.#options;\n this.#to = to;\n this.#from = from;\n return this;\n }\n}\n","import TextView from '../views/TextView.js';\nimport ValueController from './ValueController.js';\n\nexport default class Text extends ValueController {\n constructor(object, property) {\n super(object, property, 'muigui-checkbox');\n this.add(new TextView(this));\n this.updateDisplay();\n }\n}","import Button from './Button.js';\nimport Checkbox from './Checkbox.js';\nimport TextNumber from './TextNumber.js';\nimport Select from './Select.js';\nimport Range from './Range.js';\nimport Text from './Text.js';\n\n// const isConversion = o => typeof o.to === 'function' && typeof o.from === 'function';\n\n/**\n * possible inputs\n * add(o, p, min: number, max: number)\n * add(o, p, min: number, max: number, step: number)\n * add(o, p, array: [value])\n * add(o, p, array: [[key, value]])\n *\n * @param {*} object\n * @param {string} property\n * @param {...any} args\n * @returns {Controller}\n */\nexport function createController(object, property, ...args) {\n const [arg1] = args;\n if (Array.isArray(arg1)) {\n return new Select(object, property, {keyValues: arg1});\n }\n\n const t = typeof object[property];\n switch (t) {\n case 'number':\n if (typeof args[0] === 'number' && typeof args[1] === 'number') {\n const min = args[0];\n const max = args[1];\n const step = args[2];\n return new Range(object, property, {min, max, ...(step && {step})});\n }\n return args.length === 0\n ? new TextNumber(object, property, ...args)\n : new Range(object, property, ...args);\n case 'boolean':\n return new Checkbox(object, property, ...args);\n case 'function':\n return new Button(object, property, ...args);\n case 'string':\n return new Text(object, property, ...args);\n case 'undefined':\n throw new Error(`no property named ${property}`);\n default:\n throw new Error(`unhandled type ${t} for property ${property}`);\n }\n}","const clamp = (v, min, max) => Math.max(min, Math.min(max, v));\nconst lerp = (a, b, t) => a + (b - a) * t;\nconst fract = v => v >= 0 ? v % 1 : 1 - (v % 1);\n\nconst f0 = v => +v.toFixed(0); // converts to string (eg 1.2 => \"1\"), then converts back to number (eg, \"1.200\" => 1.2)\nconst f3 = v => +v.toFixed(3); // converts to string (eg 1.2 => \"1.200\"), then converts back to number (eg, \"1.200\" => 1.2)\n\nconst hexToUint32RGB = v => (parseInt(v.substring(1, 3), 16) << 16) |\n (parseInt(v.substring(3, 5), 16) << 8 ) |\n (parseInt(v.substring(5, 7), 16) );\nconst uint32RGBToHex = v => `#${(Math.round(v)).toString(16).padStart(6, '0')}`;\nconst hexToUint32RGBA = v => (parseInt(v.substring(1, 3), 16) * 2 ** 24) +\n (parseInt(v.substring(3, 5), 16) * 2 ** 16) +\n (parseInt(v.substring(5, 7), 16) * 2 ** 8) +\n (parseInt(v.substring(7, 9), 16) );\nconst uint32RGBAToHex = v => `#${(Math.round(v)).toString(16).padStart(8, '0')}`;\n\nexport const hexToUint8RGB = v => [\n parseInt(v.substring(1, 3), 16),\n parseInt(v.substring(3, 5), 16),\n parseInt(v.substring(5, 7), 16),\n];\nexport const uint8RGBToHex = v => `#${Array.from(v).map(v => v.toString(16).padStart(2, '0')).join('')}`;\n\nexport const hexToUint8RGBA = v => [\n parseInt(v.substring(1, 3), 16),\n parseInt(v.substring(3, 5), 16),\n parseInt(v.substring(5, 7), 16),\n parseInt(v.substring(7, 9), 16),\n];\nexport const uint8RGBAToHex = v => `#${Array.from(v).map(v => v.toString(16).padStart(2, '0')).join('')}`;\n\nexport const hexToFloatRGB = v => hexToUint8RGB(v).map(v => f3(v / 255));\nexport const floatRGBToHex = v => uint8RGBToHex(Array.from(v).map(v => Math.round(clamp(v * 255, 0, 255))));\n\nexport const hexToFloatRGBA = v => hexToUint8RGBA(v).map(v => f3(v / 255));\nexport const floatRGBAToHex = v => uint8RGBAToHex(Array.from(v).map(v => Math.round(clamp(v * 255, 0, 255))));\n\nconst scaleAndClamp = v => clamp(Math.round(v * 255), 0, 255).toString(16).padStart(2, '0');\n\nconst hexToObjectRGB = v => ({\n r: parseInt(v.substring(1, 3), 16) / 255,\n g: parseInt(v.substring(3, 5), 16) / 255,\n b: parseInt(v.substring(5, 7), 16) / 255,\n});\nconst objectRGBToHex = v => `#${scaleAndClamp(v.r)}${scaleAndClamp(v.g)}${scaleAndClamp(v.b)}`;\nconst hexToObjectRGBA = v => ({\n r: parseInt(v.substring(1, 3), 16) / 255,\n g: parseInt(v.substring(3, 5), 16) / 255,\n b: parseInt(v.substring(5, 7), 16) / 255,\n a: parseInt(v.substring(7, 9), 16) / 255,\n});\nconst objectRGBAToHex = v => `#${scaleAndClamp(v.r)}${scaleAndClamp(v.g)}${scaleAndClamp(v.b)}${scaleAndClamp(v.a)}`;\n\nconst hexToCssRGB = v => `rgb(${hexToUint8RGB(v).join(', ')})`;\nconst cssRGBRegex = /^\\s*rgb\\(\\s*(\\d+)\\s*,\\s*(\\d+)\\s*,\\s*(\\d+)\\s*\\)\\s*$/;\nconst cssRGBToHex = v => {\n const m = cssRGBRegex.exec(v);\n return uint8RGBToHex([m[1], m[2], m[3]].map(v => parseInt(v)));\n};\nconst hexToCssRGBA = v => `rgba(${hexToUint8RGBA(v).map((v, i) => i === 3 ? v / 255 : v).join(', ')})`;\nconst cssRGBARegex = /^\\s*rgba\\(\\s*(\\d+)\\s*,\\s*(\\d+)\\s*,\\s*(\\d+)\\s*,\\s*(\\d+\\.\\d+|\\d+)\\s*\\)\\s*$/;\nconst cssRGBAToHex = v => {\n const m = cssRGBARegex.exec(v);\n return uint8RGBAToHex([m[1], m[2], m[3], m[4]].map((v, i) => i === 3 ? (parseFloat(v) * 255 | 0) : parseInt(v)));\n};\n\nconst hexToCssHSL = v => {\n const hsl = rgbUint8ToHsl(hexToUint8RGB(v)).map(v => f0(v));\n return `hsl(${hsl[0]}, ${hsl[1]}%, ${hsl[2]}%)`;\n};\nconst hexToCssHSLA = v => {\n const hsla = rgbaUint8ToHsla(hexToUint8RGBA(v)).map((v, i) => i === 3 ? f3(v) : f0(v));\n return `hsl(${hsla[0]} ${hsla[1]}% ${hsla[2]}% / ${hsla[3]})`;\n};\nconst cssHSLRegex = /^\\s*hsl\\(\\s*(\\d+)(?:deg|)\\s*(?:,|)\\s*(\\d+)%\\s*(?:,|)\\s*(\\d+)%\\s*\\)\\s*$/;\nconst cssHSLARegex = /^\\s*hsl\\(\\s*(\\d+)(?:deg|)\\s*(?:,|)\\s*(\\d+)%\\s*(?:,|)\\s*(\\d+)%\\s*\\/\\s*(\\d+\\.\\d+|\\d+)\\s*\\)\\s*$/;\n\nconst hex3DigitTo6Digit = v => `${v[0]}${v[0]}${v[1]}${v[1]}${v[2]}${v[2]}`;\nconst cssHSLToHex = v => {\n const m = cssHSLRegex.exec(v);\n const rgb = hslToRgbUint8([m[1], m[2], m[3]].map(v => parseFloat(v)));\n return uint8RGBToHex(rgb);\n};\nconst cssHSLAToHex = v => {\n const m = cssHSLARegex.exec(v);\n const rgba = hslaToRgbaUint8([m[1], m[2], m[3], m[4]].map(v => parseFloat(v)));\n return uint8RGBAToHex(rgba);\n};\n\nconst euclideanModulo = (v, n) => ((v % n) + n) % n;\n\nexport function hslToRgbUint8([h, s, l]) {\n h = euclideanModulo(h, 360);\n s = clamp(s / 100, 0, 1);\n l = clamp(l / 100, 0, 1);\n\n const a = s * Math.min(l, 1 - l);\n\n function f(n) {\n const k = (n + h / 30) % 12;\n return l - a * Math.max(-1, Math.min(k - 3, 9 - k, 1));\n }\n\n return [f(0), f(8), f(4)].map(v => Math.round(v * 255));\n}\n\nexport function hslaToRgbaUint8([h, s, l, a]) {\n const rgb = hslToRgbUint8([h, s, l]);\n return [...rgb, a * 255 | 0];\n}\n\nexport function rgbFloatToHsl01([r, g, b]) {\n const max = Math.max(r, g, b);\n const min = Math.min(r, g, b);\n const l = (min + max) * 0.5;\n const d = max - min;\n let h = 0;\n let s = 0;\n\n if (d !== 0) {\n s = (l === 0 || l === 1)\n ? 0\n : (max - l) / Math.min(l, 1 - l);\n\n switch (max) {\n case r: h = (g - b) / d + (g < b ? 6 : 0); break;\n case g: h = (b - r) / d + 2; break;\n case b: h = (r - g) / d + 4;\n }\n }\n\n return [h / 6, s, l];\n}\n\nexport function rgbaFloatToHsla01([r, g, b, a]) {\n const hsl = rgbFloatToHsl01([r, g, b]);\n return [...hsl, a];\n}\n\nexport const rgbUint8ToHsl = (rgb) => {\n const [h, s, l] = rgbFloatToHsl01(rgb.map(v => v / 255));\n return [h * 360, s * 100, l * 100];\n};\n\nexport const rgbaUint8ToHsla = (rgba) => {\n const [h, s, l, a] = rgbaFloatToHsla01(rgba.map(v => v / 255));\n return [h * 360, s * 100, l * 100, a];\n};\n\nexport function hsv01ToRGBFloat([hue, sat, val]) {\n sat = clamp(sat, 0, 1);\n val = clamp(val, 0, 1);\n return [hue, hue + 2 / 3, hue + 1 / 3].map(\n v => lerp(1, clamp(Math.abs(fract(v) * 6 - 3.0) - 1, 0, 1), sat) * val\n );\n}\n\nexport function hsva01ToRGBAFloat([hue, sat, val, alpha]) {\n const rgb = hsv01ToRGBFloat([hue, sat, val]);\n return [...rgb, alpha];\n}\n\nconst round3 = v => Math.round(v * 1000) / 1000;\n\nexport function rgbFloatToHSV01([r, g, b]) {\n const p = b > g\n ? [b, g, -1, 2 / 3]\n : [g, b, 0, -1 / 3];\n const q = p[0] > r\n ? [p[0], p[1], p[3], r]\n : [r, p[1], p[2], p[0]];\n const d = q[0] - Math.min(q[3], q[1]);\n return [\n Math.abs(q[2] + (q[3] - q[1]) / (6 * d + Number.EPSILON)),\n d / (q[0] + Number.EPSILON),\n q[0],\n ].map(round3);\n}\n\nexport function rgbaFloatToHSVA01([r, g, b, a]) {\n const hsv = rgbFloatToHSV01([r, g, b]);\n return [...hsv, a];\n}\n\n// window.hsv01ToRGBFloat = hsv01ToRGBFloat;\n// window.rgbFloatToHSV01 = rgbFloatToHSV01;\n\n// Yea, meh!\nexport const hasAlpha = format => format.endsWith('a') || format.startsWith('hex8');\n\nconst cssStringFormats = [\n { re: /^#(?:[0-9a-f]){6}$/i, format: 'hex6' },\n { re: /^(?:[0-9a-f]){6}$/i, format: 'hex6-no-hash' },\n { re: /^#(?:[0-9a-f]){8}$/i, format: 'hex8' },\n { re: /^(?:[0-9a-f]){8}$/i, format: 'hex8-no-hash' },\n { re: /^#(?:[0-9a-f]){3}$/i, format: 'hex3' },\n { re: /^(?:[0-9a-f]){3}$/i, format: 'hex3-no-hash' },\n { re: cssRGBRegex, format: 'css-rgb' },\n { re: cssHSLRegex, format: 'css-hsl' },\n { re: cssRGBARegex, format: 'css-rgba' },\n { re: cssHSLARegex, format: 'css-hsla' },\n];\n\nfunction guessStringColorFormat(v) {\n for (const formatInfo of cssStringFormats) {\n if (formatInfo.re.test(v)) {\n return formatInfo;\n }\n }\n return undefined;\n}\n\nexport function guessFormat(v) {\n switch (typeof v) {\n case 'number':\n console.warn('can not reliably guess format based on a number. You should pass in a format like {format: \"uint32-rgb\"} or {format: \"uint32-rgb\"}');\n return v <= 0xFFFFFF ? 'uint32-rgb' : 'uint32-rgba';\n case 'string': {\n const formatInfo = guessStringColorFormat(v.trim());\n if (formatInfo) {\n return formatInfo.format;\n }\n break;\n }\n case 'object':\n if (v instanceof Uint8Array || v instanceof Uint8ClampedArray) {\n if (v.length === 3) {\n return 'uint8-rgb';\n } else if (v.length === 4) {\n return 'uint8-rgba';\n }\n } else if (v instanceof Float32Array) {\n if (v.length === 3) {\n return 'float-rgb';\n } else if (v.length === 4) {\n return 'float-rgba';\n }\n } else if (Array.isArray(v)) {\n if (v.length === 3) {\n return 'float-rgb';\n } else if (v.length === 4) {\n return 'float-rgba';\n }\n } else {\n if ('r' in v && 'g' in v && 'b' in v) {\n if ('a' in v) {\n return 'object-rgba';\n } else {\n return 'object-rgb';\n }\n }\n }\n }\n throw new Error(`unknown color format: ${v}`);\n}\n\nfunction fixHex6(v) {\n return v.trim(v);\n //const formatInfo = guessStringColorFormat(v.trim());\n //const fix = formatInfo ? formatInfo.fix : v => v;\n //return fix(v.trim());\n}\n\nfunction fixHex8(v) {\n return v.trim(v);\n //const formatInfo = guessStringColorFormat(v.trim());\n //const fix = formatInfo ? formatInfo.fix : v => v;\n //return fix(v.trim());\n}\n\nfunction hex6ToHex3(hex6) {\n return (hex6[1] === hex6[2] &&\n hex6[3] === hex6[4] &&\n hex6[5] === hex6[6])\n ? `#${hex6[1]}${hex6[3]}${hex6[5]}`\n : hex6;\n}\n\nconst hex3RE = /^(#|)([0-9a-f]{3})$/i;\nfunction hex3ToHex6(hex3) {\n const m = hex3RE.exec(hex3);\n if (m) {\n const [, , m2] = m;\n return `#${hex3DigitTo6Digit(m2)}`;\n }\n return hex3;\n}\n\nfunction fixHex3(v) {\n return hex6ToHex3(fixHex6(v));\n}\n\nconst strToRGBObject = (s) => {\n try {\n const json = s.replace(/([a-z])/g, '\"$1\"');\n const rgb = JSON.parse(json);\n if (Number.isNaN(rgb.r) || Number.isNaN(rgb.g) || Number.isNaN(rgb.b)) {\n throw new Error('not {r, g, b}');\n }\n return [true, rgb];\n } catch (e) {\n return [false];\n }\n};\n\nconst strToRGBAObject = (s) => {\n try {\n const json = s.replace(/([a-z])/g, '\"$1\"');\n const rgba = JSON.parse(json);\n if (Number.isNaN(rgba.r) || Number.isNaN(rgba.g) || Number.isNaN(rgba.b) || Number.isNaN(rgba.a)) {\n throw new Error('not {r, g, b, a}');\n }\n return [true, rgba];\n } catch (e) {\n return [false];\n }\n};\n\nconst strToCssRGB = s => {\n const m = cssRGBRegex.exec(s);\n if (!m) {\n return [false];\n }\n const v = [m[1], m[2], m[3]].map(v => parseInt(v));\n const outOfRange = v.find(v => v > 255);\n return [!outOfRange, `rgb(${v.join(', ')})`];\n};\n\nconst strToCssRGBA = s => {\n const m = cssRGBARegex.exec(s);\n if (!m) {\n return [false];\n }\n const v = [m[1], m[2], m[3], m[4]].map((v, i) => i === 3 ? parseFloat(v) : parseInt(v));\n const outOfRange = v.find(v => v > 255);\n return [!outOfRange, `rgba(${v.join(', ')})`];\n};\n\nconst strToCssHSL = s => {\n const m = cssHSLRegex.exec(s);\n if (!m) {\n return [false];\n }\n const v = [m[1], m[2], m[3]].map(v => parseFloat(v));\n const outOfRange = v.find(v => Number.isNaN(v));\n return [!outOfRange, `hsl(${v[0]}, ${v[1]}%, ${v[2]}%)`];\n};\n\nconst strToCssHSLA = s => {\n const m = cssHSLARegex.exec(s);\n if (!m) {\n return [false];\n }\n const v = [m[1], m[2], m[3], m[4]].map(v => parseFloat(v));\n const outOfRange = v.find(v => Number.isNaN(v));\n return [!outOfRange, `hsl(${v[0]} ${v[1]}% ${v[2]}% / ${v[3]})`];\n};\n\nconst rgbObjectToStr = rgb => {\n return `{r:${f3(rgb.r)}, g:${f3(rgb.g)}, b:${f3(rgb.b)}}`;\n};\nconst rgbaObjectToStr = rgba => {\n return `{r:${f3(rgba.r)}, g:${f3(rgba.g)}, b:${f3(rgba.b)}}, a:${f3(rgba.a)}}`;\n};\n\nconst strTo3IntsRE = /^\\s*(\\d+)\\s*,\\s*(\\d+)\\s*,\\s*(\\d+)\\s*$/;\nconst strTo3Ints = s => {\n const m = strTo3IntsRE.exec(s);\n if (!m) {\n return [false];\n }\n const v = [m[1], m[2], m[3]].map(v => parseInt(v));\n const outOfRange = v.find(v => v > 255);\n return [!outOfRange, v];\n};\n\nconst strTo4IntsRE = /^\\s*(\\d+)\\s*,\\s*(\\d+)\\s*,\\s*(\\d+)\\s*$/;\nconst strTo4Ints = s => {\n const m = strTo4IntsRE.exec(s);\n if (!m) {\n return [false];\n }\n const v = [m[1], m[2], m[3], m[4]].map(v => parseInt(v));\n const outOfRange = v.find(v => v > 255);\n return [!outOfRange, v];\n};\n\nconst strTo3Floats = s => {\n const numbers = s.split(',').map(s => s.trim());\n const v = numbers.map(v => parseFloat(v));\n if (v.length !== 3) {\n return [false];\n }\n // Note: using isNaN not Number.isNaN\n const badNdx = numbers.findIndex(v => isNaN(v));\n return [badNdx < 0, v.map(v => f3(v))];\n};\n\nconst strTo4Floats = s => {\n const numbers = s.split(',').map(s => s.trim());\n const v = numbers.map(v => parseFloat(v));\n if (v.length !== 4) {\n return [false];\n }\n // Note: using isNaN not Number.isNaN\n const badNdx = numbers.findIndex(v => isNaN(v));\n return [badNdx < 0, v.map(v => f3(v))];\n};\n\nconst strToUint32RGBRegex = /^\\s*(?:0x){0,1}([0-9a-z]{1,6})\\s*$/i;\nconst strToUint32RGB = s => {\n const m = strToUint32RGBRegex.exec(s);\n if (!m) {\n return [false];\n }\n return [true, parseInt(m[1], 16)];\n};\n\nconst strToUint32RGBARegex = /^\\s*(?:0x){0,1}([0-9a-z]{1,8})\\s*$/i;\nconst strToUint32RGBA = s => {\n const m = strToUint32RGBARegex.exec(s);\n if (!m) {\n return [false];\n }\n return [true, parseInt(m[1], 16)];\n};\n\nconst hex6RE = /^\\s*#[a-f0-9]{6}\\s*$|^\\s*#[a-f0-9]{3}\\s*$/i;\nconst hexNoHash6RE = /^\\s*[a-f0-9]{6}\\s*$/i;\nconst hex8RE = /^\\s*#[a-f0-9]{8}\\s*$/i;\nconst hexNoHash8RE = /^\\s*[a-f0-9]{8}\\s*$/i;\n\n// For each format converter\n//\n// fromHex/toHex convert from/to '#RRGGBB'\n//\n// fromHex converts from the string '#RRBBGG' to the format\n// (eg: for uint32-rgb, '#123456' becomes 0x123456)\n//\n// toHex converts from the format to '#RRGGBB'\n// (eg: for uint8-rgb, [16, 33, 50] becomes '#102132')\n//\n//\n// fromStr/toStr convert from/to what's in the input[type=text] element\n//\n// toStr converts from the format to its string representation\n// (eg, for object-rgb, {r: 1, g: 0.5, b:0} becomes \"{r: 1, g: 0.5, b:0}\")\n// ^object ^string\n//\n// fromStr converts its string representation to its format\n// (eg, for object-rgb) \"{r: 1, g: 0.5, b:0}\" becomes {r: 1, g: 0.5, b:0})\n// ^string ^object\n// fromString returns an array which is [valid, v]\n// where valid is true if the string was a valid and v is the converted\n// format if v is true.\n//\n// Note: toStr should convert to \"ideal\" form (whatever that is).\n// (eg, for css-rgb\n// \"{ r: 0.10000, g: 001, b: 0}\" becomes \"{r: 0.1, g: 1, b: 0}\"\n// notice that css-rgb is a string to a string\n// )\nexport const colorFormatConverters = {\n 'hex6': {\n color: {\n from: v => [true, v],\n to: fixHex6,\n },\n text: {\n from: v => [hex6RE.test(v), v.trim()],\n to: v => v,\n },\n },\n 'hex8': {\n color: {\n from: v => [true, v],\n to: fixHex8,\n },\n text: {\n from: v => [hex8RE.test(v), v.trim()],\n to: v => v,\n },\n },\n 'hex3': {\n color: {\n from: v => [true, fixHex3(v)],\n to: hex3ToHex6,\n },\n text: {\n from: v => [hex6RE.test(v), hex6ToHex3(v.trim())],\n to: v => v,\n },\n },\n 'hex6-no-hash': {\n color: {\n from: v => [true, v.substring(1)],\n to: v => `#${fixHex6(v)}`,\n },\n text: {\n from: v => [hexNoHash6RE.test(v), v.trim()],\n to: v => v,\n },\n },\n 'hex8-no-hash': {\n color: {\n from: v => [true, v.substring(1)],\n to: v => `#${fixHex8(v)}`,\n },\n text: {\n from: v => [hexNoHash8RE.test(v), v.trim()],\n to: v => v,\n },\n },\n 'hex3-no-hash': {\n color: {\n from: v => [true, fixHex3(v).substring(1)],\n to: hex3ToHex6,\n },\n text: {\n from: v => [hexNoHash6RE.test(v), hex6ToHex3(v.trim())],\n to: v => v,\n },\n },\n 'uint32-rgb': {\n color: {\n from: v => [true, hexToUint32RGB(v)],\n to: uint32RGBToHex,\n },\n text: {\n from: v => strToUint32RGB(v),\n to: v => `0x${v.toString(16).padStart(6, '0')}`,\n },\n },\n 'uint32-rgba': {\n color: {\n from: v => [true, hexToUint32RGBA(v)],\n to: uint32RGBAToHex,\n },\n text: {\n from: v => strToUint32RGBA(v),\n to: v => `0x${v.toString(16).padStart(8, '0')}`,\n },\n },\n 'uint8-rgb': {\n color: {\n from: v => [true, hexToUint8RGB(v)],\n to: uint8RGBToHex,\n },\n text: {\n from: strTo3Ints,\n to: v => v.join(', '),\n },\n },\n 'uint8-rgba': {\n color: {\n from: v => [true, hexToUint8RGBA(v)],\n to: uint8RGBAToHex,\n },\n text: {\n from: strTo4Ints,\n to: v => v.join(', '),\n },\n },\n 'float-rgb': {\n color: {\n from: v => [true, hexToFloatRGB(v)],\n to: floatRGBToHex,\n },\n text: {\n from: strTo3Floats,\n // need Array.from because map of Float32Array makes a Float32Array\n to: v => Array.from(v).map(v => f3(v)).join(', '),\n },\n },\n 'float-rgba': {\n color: {\n from: v => [true, hexToFloatRGBA(v)],\n to: floatRGBAToHex,\n },\n text: {\n from: strTo4Floats,\n // need Array.from because map of Float32Array makes a Float32Array\n to: v => Array.from(v).map(v => f3(v)).join(', '),\n },\n },\n 'object-rgb': {\n color: {\n from: v => [true, hexToObjectRGB(v)],\n to: objectRGBToHex,\n },\n text: {\n from: strToRGBObject,\n to: rgbObjectToStr,\n },\n },\n 'object-rgba': {\n color: {\n from: v => [true, hexToObjectRGBA(v)],\n to: objectRGBAToHex,\n },\n text: {\n from: strToRGBAObject,\n to: rgbaObjectToStr,\n },\n },\n 'css-rgb': {\n color: {\n from: v => [true, hexToCssRGB(v)],\n to: cssRGBToHex,\n },\n text: {\n from: strToCssRGB,\n to: v => strToCssRGB(v)[1],\n },\n },\n 'css-rgba': {\n color: {\n from: v => [true, hexToCssRGBA(v)],\n to: cssRGBAToHex,\n },\n text: {\n from: strToCssRGBA,\n to: v => strToCssRGBA(v)[1],\n },\n },\n 'css-hsl': {\n color: {\n from: v => [true, hexToCssHSL(v)],\n to: cssHSLToHex,\n },\n text: {\n from: strToCssHSL,\n to: v => strToCssHSL(v)[1],\n },\n },\n 'css-hsla': {\n color: {\n from: v => [true, hexToCssHSLA(v)],\n to: cssHSLAToHex,\n },\n text: {\n from: strToCssHSLA,\n to: v => strToCssHSLA(v)[1],\n },\n },\n};","import { createElem } from '../libs/elem.js';\nimport View from './View.js';\n\nexport default class ElementView extends View {\n constructor(tag, className) {\n super(createElem(tag, {className}));\n }\n}","import ElementView from '../views/ElementView.js';\nimport LabelController from './LabelController.js';\n\n// TODO: remove this? Should just be user side\nexport default class Canvas extends LabelController {\n #canvasElem;\n\n constructor() {\n super('muigui-canvas');\n this.#canvasElem = this.add(\n new ElementView('canvas', 'muigui-canvas'),\n ).domElement;\n }\n get canvas() {\n return this.#canvasElem;\n }\n}","import { createElem } from '../libs/elem.js';\nimport { identity } from '../libs/conversions.js';\nimport EditView from './EditView.js';\nimport { copyExistingProperties } from '../libs/utils.js';\n\nexport default class ColorView extends EditView {\n #to;\n #from;\n #colorElem;\n #skipUpdate;\n #options = {\n converters: identity,\n };\n\n constructor(setter, options) {\n const colorElem = createElem('input', {\n type: 'color',\n onInput: () => {\n const [valid, newV] = this.#from(colorElem.value);\n if (valid) {\n this.#skipUpdate = true;\n setter.setValue(newV);\n }\n },\n onChange: () => {\n const [valid, newV] = this.#from(colorElem.value);\n if (valid) {\n this.#skipUpdate = true;\n setter.setFinalValue(newV);\n }\n },\n });\n super(createElem('div', {}, [colorElem]));\n this.setOptions(options);\n this.#colorElem = colorElem;\n }\n updateDisplay(v) {\n if (!this.#skipUpdate) {\n this.#colorElem.value = this.#to(v);\n }\n this.#skipUpdate = false;\n }\n setOptions(options) {\n copyExistingProperties(this.#options, options);\n const {converters: {to, from}} = this.#options;\n this.#to = to;\n this.#from = from;\n return this;\n }\n}\n","import {\n colorFormatConverters,\n guessFormat,\n} from '../libs/color-utils.js';\nimport ValueController from './ValueController.js';\nimport TextView from '../views/TextView.js';\nimport ColorView from '../views/ColorView.js';\n\nexport default class Color extends ValueController {\n #colorView;\n #textView;\n\n constructor(object, property, options = {}) {\n super(object, property, 'muigui-color');\n const format = options.format || guessFormat(this.getValue());\n const {color, text} = colorFormatConverters[format];\n this.#colorView = this.add(new ColorView(this, {converters: color}));\n this.#textView = this.add(new TextView(this, {converters: text}));\n this.updateDisplay();\n }\n setOptions(options) {\n const {format} = options;\n if (format) {\n const {color, text} = colorFormatConverters[format];\n this.#colorView.setOptions({converters: color});\n this.#textView.setOptions({converters: text});\n }\n super.setOptions(options);\n return this;\n }\n}","import Controller from './Controller.js';\n\n// This feels like it should be something else like\n// gui.addController({className: 'muigui-divider')};\nexport default class Divider extends Controller {\n constructor() {\n super('muigui-divider');\n }\n}","import Controller from './Controller.js';\n\nexport default class Container extends Controller {\n #controllers;\n #childDestController;\n\n constructor(className) {\n super(className);\n this.#controllers = [];\n this.#childDestController = this;\n }\n get children() {\n return this.#controllers; // should we return a copy?\n }\n get controllers() {\n return this.#controllers.filter(c => !(c instanceof Container));\n }\n get folders() {\n return this.#controllers.filter(c => c instanceof Container);\n }\n reset(recursive = true) {\n for (const controller of this.#controllers) {\n if (!(controller instanceof Container) || recursive) {\n controller.reset(recursive);\n }\n }\n return this;\n }\n updateDisplay() {\n for (const controller of this.#controllers) {\n controller.updateDisplay();\n }\n return this;\n }\n remove(controller) {\n const ndx = this.#controllers.indexOf(controller);\n if (ndx >= 0) {\n const c = this.#controllers.splice(ndx, 1);\n const c0 = c[0];\n const elem = c0.domElement;\n elem.remove();\n c0.setParent(null);\n }\n return this;\n }\n #addControllerImpl(controller) {\n this.domElement.appendChild(controller.domElement);\n this.#controllers.push(controller);\n controller.setParent(this);\n return controller;\n }\n addController(controller) {\n return this.#childDestController.#addControllerImpl(controller);\n }\n pushContainer(container) {\n this.addController(container);\n this.#childDestController = container;\n return container;\n }\n popContainer() {\n this.#childDestController = this.#childDestController.parent;\n return this;\n }\n}\n","import { createElem } from '../libs/elem.js';\nimport Container from './Container.js';\n\nexport default class Folder extends Container {\n #labelElem;\n\n constructor(name = 'Controls', className = 'muigui-menu') {\n super(className);\n this.#labelElem = createElem('label');\n this.addElem(createElem('button', {\n type: 'button',\n onClick: () => this.toggleOpen(),\n }, [this.#labelElem]));\n this.pushContainer(new Container());\n this.name(name);\n this.open();\n }\n open(open = true) {\n this.domElement.classList.toggle('muigui-closed', !open);\n this.domElement.classList.toggle('muigui-open', open);\n return this;\n }\n close() {\n return this.open(false);\n }\n name(name) {\n this.#labelElem.textContent = name;\n return this;\n }\n title(title) {\n return this.name(title);\n }\n toggleOpen() {\n this.open(!this.domElement.classList.contains('muigui-open'));\n return this;\n }\n}\n","import Controller from './Controller.js';\n\n// This feels like it should be something else like\n// gui.addDividing = new Controller()\nexport default class Label extends Controller {\n constructor(text) {\n super('muigui-label');\n this.text(text);\n }\n text(text) {\n this.domElement.textContent = text;\n return this;\n }\n}","function noop() {\n}\n\nexport function computeRelativePosition(elem, event, start) {\n const rect = elem.getBoundingClientRect();\n const x = event.clientX - rect.left;\n const y = event.clientY - rect.top;\n const nx = x / rect.width;\n const ny = y / rect.height;\n start = start || [x, y];\n const dx = x - start[0];\n const dy = y - start[1];\n const ndx = dx / rect.width;\n const ndy = dy / rect.width;\n return {x, y, nx, ny, dx, dy, ndx, ndy};\n}\n\nexport function addTouchEvents(elem, {onDown = noop, onMove = noop, onUp = noop}) {\n let start;\n const pointerMove = function (event) {\n const e = {\n type: 'move',\n ...computeRelativePosition(elem, event, start),\n };\n onMove(e);\n };\n\n const pointerUp = function (event) {\n elem.releasePointerCapture(event.pointerId);\n elem.removeEventListener('pointermove', pointerMove);\n elem.removeEventListener('pointerup', pointerUp);\n\n document.body.style.backgroundColor = '';\n\n onUp('up');\n };\n\n const pointerDown = function (event) {\n elem.addEventListener('pointermove', pointerMove);\n elem.addEventListener('pointerup', pointerUp);\n elem.setPointerCapture(event.pointerId);\n\n const rel = computeRelativePosition(elem, event);\n start = [rel.x, rel.y];\n onDown({\n type: 'down',\n ...rel,\n });\n };\n\n elem.addEventListener('pointerdown', pointerDown);\n\n return function () {\n elem.removeEventListener('pointerdown', pointerDown);\n };\n}","import { createElem, getNewId } from '../libs/elem.js';\nimport { addTouchEvents } from '../libs/touch.js';\nimport { identity } from '../libs/conversions.js';\nimport { clamp } from '../libs/utils.js';\nimport EditView from './EditView.js';\nimport {\n hexToFloatRGB,\n hexToFloatRGBA,\n hsv01ToRGBFloat,\n hsva01ToRGBAFloat,\n rgbFloatToHSV01,\n rgbaFloatToHSVA01,\n floatRGBToHex,\n floatRGBAToHex,\n rgbaFloatToHsla01,\n} from '../libs/color-utils.js';\nimport { copyExistingProperties } from '../libs/utils.js';\n\nconst svg = `\n\n\n\n`;\n\nfunction connectFillTargets(elem) {\n elem.querySelectorAll('[data-src]').forEach(srcElem => {\n const id = getNewId();\n srcElem.id = id;\n elem.querySelectorAll(`[data-target=${srcElem.dataset.src}]`).forEach(targetElem => {\n targetElem.setAttribute('fill', `url(#${id})`);\n });\n });\n return elem;\n}\n\n// Was originally going to make alpha an option. Issue is\n// hard coded conversions?\nexport default class ColorChooserView extends EditView {\n #to;\n #from;\n #satLevelElem;\n #circleElem;\n #hueUIElem;\n #hueElem;\n #hueCursorElem;\n #alphaUIElem;\n #alphaElem;\n #alphaCursorElem;\n #hsva;\n #skipHueUpdate;\n #skipSatLevelUpdate;\n #skipAlphaUpdate;\n #options = {\n converters: identity,\n alpha: false,\n };\n #convertInternalToHex;\n #convertHexToInternal;\n\n constructor(setter, options) {\n super(createElem('div', {\n innerHTML: svg,\n className: 'muigui-no-scroll',\n }));\n this.#satLevelElem = this.domElement.children[0];\n this.#hueUIElem = this.domElement.children[1];\n this.#alphaUIElem = this.domElement.children[2];\n connectFillTargets(this.#satLevelElem);\n connectFillTargets(this.#hueUIElem);\n connectFillTargets(this.#alphaUIElem);\n this.#circleElem = this.$('.muigui-color-chooser-circle');\n this.#hueElem = this.$('[data-src=muigui-color-chooser-hue]');\n this.#hueCursorElem = this.$('.muigui-color-chooser-hue-cursor');\n this.#alphaElem = this.$('[data-src=muigui-color-chooser-alpha]');\n this.#alphaCursorElem = this.$('.muigui-color-chooser-alpha-cursor');\n\n const handleSatLevelChange = (e) => {\n const s = clamp(e.nx, 0, 1);\n const v = clamp(e.ny, 0, 1);\n this.#hsva[1] = s;\n this.#hsva[2] = (1 - v);\n this.#skipHueUpdate = true;\n this.#skipAlphaUpdate = true;\n const [valid, newV] = this.#from(this.#convertInternalToHex(this.#hsva));\n if (valid) {\n setter.setValue(newV);\n }\n };\n\n const handleHueChange = (e) => {\n const h = clamp(e.nx, 0, 1);\n this.#hsva[0] = h;\n this.#skipSatLevelUpdate = true;\n this.#skipAlphaUpdate = true;\n const [valid, newV] = this.#from(this.#convertInternalToHex(this.#hsva));\n if (valid) {\n setter.setValue(newV);\n }\n };\n\n const handleAlphaChange = (e) => {\n const a = clamp(e.nx, 0, 1);\n this.#hsva[3] = a;\n this.#skipHueUpdate = true;\n this.#skipSatLevelUpdate = true;\n const [valid, newV] = this.#from(this.#convertInternalToHex(this.#hsva));\n if (valid) {\n setter.setValue(newV);\n }\n };\n\n addTouchEvents(this.#satLevelElem, {\n onDown: handleSatLevelChange,\n onMove: handleSatLevelChange,\n });\n addTouchEvents(this.#hueUIElem, {\n onDown: handleHueChange,\n onMove: handleHueChange,\n });\n addTouchEvents(this.#alphaUIElem, {\n onDown: handleAlphaChange,\n onMove: handleAlphaChange,\n });\n this.setOptions(options);\n }\n updateDisplay(newV) {\n if (!this.#hsva) {\n this.#hsva = this.#convertHexToInternal(this.#to(newV));\n }\n {\n const [h, s, v, a = 1] = this.#convertHexToInternal(this.#to(newV));\n // Don't copy the hue if it was un-computable.\n if (!this.#skipHueUpdate) {\n this.#hsva[0] = s > 0.001 && v > 0.001 ? h : this.#hsva[0];\n }\n if (!this.#skipSatLevelUpdate) {\n this.#hsva[1] = s;\n this.#hsva[2] = v;\n }\n if (!this.#skipAlphaUpdate) {\n this.#hsva[3] = a;\n }\n }\n {\n const [h, s, v, a] = this.#hsva;\n const [hue, sat, lum] = rgbaFloatToHsla01(hsva01ToRGBAFloat(this.#hsva));\n\n if (!this.#skipHueUpdate) {\n this.#hueCursorElem.setAttribute('transform', `translate(${h * 64}, 0)`);\n }\n this.#hueElem.children[0].setAttribute('stop-color', `hsl(${hue * 360} 0% 100% / ${a})`);\n this.#hueElem.children[1].setAttribute('stop-color', `hsl(${hue * 360} 100% 50% / ${a})`);\n if (!this.#skipAlphaUpdate) {\n this.#alphaCursorElem.setAttribute('transform', `translate(${a * 64}, 0)`);\n }\n this.#alphaElem.children[0].setAttribute('stop-color', `hsl(${hue * 360} ${sat * 100}% ${lum * 100}% / 0)`);\n this.#alphaElem.children[1].setAttribute('stop-color', `hsl(${hue * 360} ${sat * 100}% ${lum * 100}% / 1)`);\n\n if (!this.#skipSatLevelUpdate) {\n this.#circleElem.setAttribute('cx', `${s * 64}`);\n this.#circleElem.setAttribute('cy', `${(1 - v) * 48}`);\n }\n }\n this.#skipHueUpdate = false;\n this.#skipSatLevelUpdate = false;\n this.#skipAlphaUpdate = false;\n }\n setOptions(options) {\n copyExistingProperties(this.#options, options);\n const {converters: {to, from}, alpha} = this.#options;\n this.#alphaUIElem.style.display = alpha ? '' : 'none';\n this.#convertInternalToHex = alpha\n ? v => floatRGBAToHex(hsva01ToRGBAFloat(v))\n : v => floatRGBToHex(hsv01ToRGBFloat(v));\n this.#convertHexToInternal = alpha\n ? v => rgbaFloatToHSVA01(hexToFloatRGBA(v))\n : v => rgbFloatToHSV01(hexToFloatRGB(v));\n this.#to = to;\n this.#from = from;\n return this;\n }\n}\n","import ElementView from '../views/ElementView.js';\nimport ValueController from './ValueController.js';\nimport { copyExistingProperties } from '../libs/utils.js';\nimport { createElem } from '../libs/elem.js';\n/*\n\nholder = new TabHolder\ntab = holder.add(new Tab(\"name\"))\ntab.add(...)\n\n\npc = new PopdownController\ntop = pc.add(new Row())\ntop.add(new Button());\nvalues = topRow.add(new Div())\nbottom = pc.add(new Row());\n\n\n\npc = new PopdownController\npc.addTop\npc.addTop\n\npc.addBottom\n\n\n*/\n\nexport default class PopDownController extends ValueController {\n #top;\n #valuesView;\n #checkboxElem;\n #bottom;\n #options = {\n open: false,\n };\n\n constructor(object, property, options = {}) {\n super(object, property, 'muigui-pop-down-controller');\n /*\n [ValueView\n [[B][values]] upper row\n [[ visual ]] lower row\n ]\n */\n this.#top = this.add(new ElementView('div', 'muigui-pop-down-top'));\n// this.#top.add(new CheckboxView(makeSetter(this.#options, 'open')));\n const checkboxElem = this.#top.addElem(createElem('input', {\n type: 'checkbox',\n onChange: () => {\n this.#options.open = checkboxElem.checked;\n this.updateDisplay();\n },\n }));\n this.#checkboxElem = checkboxElem;\n this.#valuesView = this.#top.add(new ElementView('div', 'muigui-pop-down-values'));\n this.#bottom = this.add(new ElementView('div', 'muigui-pop-down-bottom'));\n this.setOptions(options);\n }\n setKnobColor(bgCssColor/*, fgCssColor*/) {\n if (this.#checkboxElem) {\n this.#checkboxElem.style = `\n --range-color: ${bgCssColor};\n --value-bg-color: ${bgCssColor};\n `;\n }\n }\n updateDisplay() {\n super.updateDisplay();\n const {open} = this.#options;\n this.domElement.children[1].classList.toggle('muigui-open', open);\n this.domElement.children[1].classList.toggle('muigui-closed', !open);\n }\n setOptions(options) {\n copyExistingProperties(this.#options, options);\n super.setOptions(options);\n this.updateDisplay();\n }\n addTop(view) {\n return this.#valuesView.add(view);\n }\n addBottom(view) {\n return this.#bottom.add(view);\n }\n}","/* eslint-disable no-underscore-dangle */\nimport {\n colorFormatConverters,\n guessFormat,\n hasAlpha,\n hexToUint8RGB,\n hslToRgbUint8,\n rgbUint8ToHsl,\n uint8RGBToHex,\n} from '../libs/color-utils.js';\nimport ColorChooserView from '../views/ColorChooserView.js';\nimport TextView from '../views/TextView.js';\nimport PopDownController from './PopDownController.js';\n\nexport default class ColorChooser extends PopDownController {\n #colorView;\n #textView;\n #to;\n #setKnobHelper;\n\n constructor(object, property, options = {}) {\n super(object, property, 'muigui-color-chooser');\n const format = options.format || guessFormat(this.getValue());\n const {color, text} = colorFormatConverters[format];\n this.#to = color.to;\n this.#textView = new TextView(this, {converters: text, alpha: hasAlpha(format)});\n this.#colorView = new ColorChooserView(this, {converters: color, alpha: hasAlpha(format)});\n this.addTop(this.#textView);\n this.addBottom(this.#colorView);\n // WTF! FIX!\n this.#setKnobHelper = () => {\n if (this.#to) {\n const hex6Or8 = this.#to(this.getValue());\n const hsl = rgbUint8ToHsl(hexToUint8RGB(hex6Or8));\n hsl[2] = (hsl[2] + 50) % 100;\n const hex = uint8RGBToHex(hslToRgbUint8(hsl));\n this.setKnobColor(`${hex6Or8.substring(0, 7)}FF`, hex);\n }\n };\n this.updateDisplay();\n }\n updateDisplay() {\n super.updateDisplay();\n if (this.#setKnobHelper) {\n this.#setKnobHelper();\n }\n }\n setOptions(options) {\n super.setOptions(options);\n return this;\n }\n}\n","import { createElem } from '../libs/elem.js';\nimport View from '../views/View.js';\n\nfunction showCSS(ob) {\n if (ob.prototype.css) {\n showCSS(ob.prototype);\n }\n}\n\nexport default class Layout extends View {\n static css = 'bar';\n constructor(tag, className) {\n super(createElem(tag, {className}));\n\n showCSS(this);\n }\n}\n\n/*\nclass ValueController ?? {\n const row = this.add(new Row());\n const label = row.add(new Label());\n const div = row.add(new Div());\n const row = div.add(new Row());\n}\n*/\n\n/*\nclass MyCustomThing extends ValueController {\n constructor(object, property, options) {\n const topRow = this.add(new Row());\n const bottomRow = this.add(new Row());\n topRow.add(new NumberView());\n topRow.add(new NumberView());\n topRow.add(new NumberView());\n topRow.add(new NumberView());\n bottomRow.add(new DirectionView());\n bottomRow.add(new DirectionView());\n bottomRow.add(new DirectionView());\n bottomRow.add(new DirectionView());\n }\n}\n new Grid([\n [new\n ]\n */","import Layout from './Layout.js';\n\nexport default class Column extends Layout {\n constructor() {\n super('div', 'muigui-row');\n }\n}\n","import Layout from './Layout.js';\n\nexport default class Frame extends Layout {\n static css = 'foo';\n constructor() {\n super('div', 'muigui-frame');\n }\n static get foo() {\n return 'boo';\n }\n}\n","import Layout from './Layout.js';\n\nexport default class Grid extends Layout {\n constructor() {\n super('div', 'muigui-grid');\n }\n}\n","import Layout from './Layout.js';\n\nexport default class Row extends Layout {\n constructor() {\n super('div', 'muigui-row');\n }\n}\n","import css from './styles/muigui.css.js';\nimport {createElem} from './libs/elem.js';\nimport {createController} from './controllers/create-controller.js';\nimport {\n mapRange,\n makeRangeConverters,\n makeRangeOptions,\n makeMinMaxPair,\n} from './libs/utils.js';\nimport {\n converters\n} from './libs/conversions.js';\nimport {\n hasAlpha,\n guessFormat,\n} from './libs/color-utils.js';\nimport Canvas from './controllers/Canvas.js';\nimport Color from './controllers/Color.js';\nimport Divider from './controllers/Divider.js';\nimport Folder from './controllers/Folder.js';\nimport Label from './controllers/Label.js';\nimport Controller from './controllers/Controller.js';\nimport ColorChooser from './controllers/ColorChooser.js';\n\nimport Column from './layout/Column.js';\nimport Frame from './layout/Frame.js';\nimport Grid from './layout/Grid.js';\nimport Row from './layout/Row.js';\n\nexport {\n Column,\n Frame,\n Grid,\n Row,\n};\n\nexport class GUIFolder extends Folder {\n add(object, property, ...args) {\n const controller = object instanceof Controller\n ? object\n : createController(object, property, ...args);\n return this.addController(controller);\n }\n addCanvas(name) {\n return this.addController(new Canvas(name));\n }\n addColor(object, property, options = {}) {\n const value = object[property];\n if (hasAlpha(options.format || guessFormat(value))) {\n return this.addController(new ColorChooser(object, property, options));\n } else {\n return this.addController(new Color(object, property, options));\n }\n }\n addDivider() {\n return this.addController(new Divider());\n }\n addFolder(name) {\n return this.addController(new GUIFolder(name));\n }\n addLabel(text) {\n return this.addController(new Label(text));\n }\n}\n\nclass MuiguiElement extends HTMLElement {\n constructor() {\n super();\n this.shadow = this.attachShadow({mode: 'open'});\n }\n}\n\ncustomElements.define('muigui-element', MuiguiElement);\n\nconst baseStyleSheet = new CSSStyleSheet();\nbaseStyleSheet.replaceSync(css.default);\nconst userStyleSheet = new CSSStyleSheet();\n\nfunction makeStyleSheetUpdater(styleSheet) {\n let newCss;\n let newCssPromise;\n\n function updateStyle() {\n if (newCss && !newCssPromise) {\n const s = newCss;\n newCss = undefined;\n newCssPromise = styleSheet.replace(s).then(() => {\n newCssPromise = undefined;\n updateStyle();\n });\n }\n }\n\n return function updateStyleSheet(css) {\n newCss = css;\n updateStyle();\n };\n}\n\nconst updateBaseStyle = makeStyleSheetUpdater(baseStyleSheet);\nconst updateUserStyle = makeStyleSheetUpdater(userStyleSheet);\n\nexport class GUI extends GUIFolder {\n static converters = converters;\n static mapRange = mapRange;\n static makeRangeConverters = makeRangeConverters;\n static makeRangeOptions = makeRangeOptions;\n static makeMinMaxPair = makeMinMaxPair;\n #localStyleSheet = new CSSStyleSheet();\n\n constructor(options = {}) {\n super('Controls', 'muigui-root');\n if (options instanceof HTMLElement) {\n options = {parent: options};\n }\n const {\n autoPlace = true,\n width,\n title = 'Controls',\n } = options;\n let {\n parent,\n } = options;\n\n if (width) {\n this.domElement.style.width = /^\\d+$/.test(width) ? `${width}px` : width;\n }\n if (parent === undefined && autoPlace) {\n parent = document.body;\n this.domElement.classList.add('muigui-auto-place');\n }\n if (parent) {\n const muiguiElement = createElem('muigui-element');\n muiguiElement.shadowRoot.adoptedStyleSheets = [baseStyleSheet, userStyleSheet, this.#localStyleSheet];\n muiguiElement.shadow.appendChild(this.domElement);\n parent.appendChild(muiguiElement);\n }\n if (title) {\n this.title(title);\n }\n this.domElement.classList.add('muigui', 'muigui-colors');\n }\n setStyle(css) {\n this.#localStyleSheet.replace(css);\n }\n static setBaseStyles(css) {\n updateBaseStyle(css);\n }\n static getBaseStyleSheet() {\n return baseStyleSheet;\n }\n static setUserStyles(css) {\n updateUserStyle(css);\n }\n static getUserStyleSheet() {\n return userStyleSheet;\n }\n static setTheme(name) {\n GUI.setBaseStyles(`${css.default}\\n${css.themes[name] || ''}`);\n }\n}\n\nexport default GUI;\n","function noop() {\n}\n\nconst keyDirections = {\n ArrowLeft: [-1, 0],\n ArrowRight: [1, 0],\n ArrowUp: [0, -1],\n ArrowDown: [0, 1],\n};\n\n// This probably needs to be global\nexport function addKeyboardEvents(elem, {onDown = noop, onUp = noop}) {\n const keyDown = function (event) {\n const mult = event.shiftKey ? 10 : 1;\n const [dx, dy] = (keyDirections[event.key] || [0, 0]).map(v => v * mult);\n const fn = event.type === 'keydown' ? onDown : onUp;\n fn({\n type: event.type.substring(3),\n dx,\n dy,\n event,\n });\n };\n\n elem.addEventListener('keydown', keyDown);\n elem.addEventListener('keyup', keyDown);\n\n return function () {\n elem.removeEventListener('keydown', keyDown);\n elem.removeEventListener('keyup', keyDown);\n };\n}","export function assert(truthy, msg = '') {\n if (!truthy) {\n throw new Error(msg);\n }\n}","import { assert } from '../libs/assert.js';\n\nfunction getEllipsePointForAngle(cx, cy, rx, ry, phi, theta) {\n const m = Math.abs(rx) * Math.cos(theta);\n const n = Math.abs(ry) * Math.sin(theta);\n\n return [\n cx + Math.cos(phi) * m - Math.sin(phi) * n,\n cy + Math.sin(phi) * m + Math.cos(phi) * n,\n ];\n}\n\nfunction getEndpointParameters(cx, cy, rx, ry, phi, theta, dTheta) {\n const [x1, y1] = getEllipsePointForAngle(cx, cy, rx, ry, phi, theta);\n const [x2, y2] = getEllipsePointForAngle(cx, cy, rx, ry, phi, theta + dTheta);\n\n const fa = Math.abs(dTheta) > Math.PI ? 1 : 0;\n const fs = dTheta > 0 ? 1 : 0;\n\n return { x1, y1, x2, y2, fa, fs };\n}\n\nexport function arc(cx, cy, r, start, end) {\n assert(Math.abs(start - end) <= Math.PI * 2);\n assert(start >= -Math.PI && start <= Math.PI * 2);\n assert(start <= end);\n assert(end >= -Math.PI && end <= Math.PI * 4);\n\n const { x1, y1, x2, y2, fa, fs } = getEndpointParameters(cx, cy, r, r, 0, start, end - start);\n return Math.abs(Math.abs(start - end) - Math.PI * 2) > Number.EPSILON\n ? `M${cx} ${cy} L${x1} ${y1} A ${r} ${r} 0 ${fa} ${fs} ${x2} ${y2} L${cx} ${cy}`\n : `M${x1} ${y1} L${x1} ${y1} A ${r} ${r} 0 ${fa} ${fs} ${x2} ${y2}`;\n}\n","import { identity } from '../libs/conversions.js';\nimport { createElem } from '../libs/elem.js';\nimport { addKeyboardEvents } from '../libs/keyboard.js';\nimport { arc } from '../libs/svg.js';\nimport { addTouchEvents } from '../libs/touch.js';\nimport { createWheelHelper } from '../libs/wheel.js';\nimport { clamp, copyExistingProperties, euclideanModulo, lerp, stepify } from '../libs/utils.js';\nimport EditView from './EditView.js';\n\nconst svg = `\n\n`;\n\nconst twoPiMod = v => euclideanModulo(v + Math.PI, Math.PI * 2) - Math.PI;\n\nexport default class DirectionView extends EditView {\n #arrowElem;\n #rangeElem;\n #lastV;\n #wrap;\n #options = {\n step: 1,\n min: -180,\n max: 180,\n\n /*\n --------\n / -π/2 \\\n / | \\\n |<- -π * |\n | * 0 ->| zero is down the positive X axis\n |<- +π * |\n \\ | /\n \\ π/2 /\n --------\n */\n dirMin: -Math.PI,\n dirMax: Math.PI,\n //dirMin: Math.PI * 0.5,\n //dirMax: Math.PI * 2.5,\n //dirMin: -Math.PI * 0.75, // test 10:30 to 7:30\n //dirMax: Math.PI * 0.75,\n //dirMin: Math.PI * 0.75, // test 7:30 to 10:30\n //dirMax: -Math.PI * 0.75,\n //dirMin: -Math.PI * 0.75, // test 10:30 to 1:30\n //dirMax: -Math.PI * 0.25,\n //dirMin: Math.PI * 0.25, // test 4:30 to 7:30\n //dirMax: Math.PI * 0.75,\n //dirMin: Math.PI * 0.75, // test 4:30 to 7:30\n //dirMax: Math.PI * 0.25,\n wrap: undefined,\n converters: identity,\n };\n\n constructor(setter, options = {}) {\n const wheelHelper = createWheelHelper();\n super(createElem('div', {\n className: 'muigui-direction muigui-no-scroll',\n innerHTML: svg,\n onWheel: e => {\n e.preventDefault();\n const {min, max, step} = this.#options;\n const delta = wheelHelper(e, step);\n let tempV = this.#lastV + delta;\n if (this.#wrap) {\n tempV = euclideanModulo(tempV - min, max - min) + min;\n }\n const newV = clamp(stepify(tempV, v => v, step), min, max);\n setter.setValue(newV);\n },\n }));\n const handleTouch = (e) => {\n const {min, max, step, dirMin, dirMax} = this.#options;\n const nx = e.nx * 2 - 1;\n const ny = e.ny * 2 - 1;\n const a = Math.atan2(ny, nx);\n\n const center = (dirMin + dirMax) / 2;\n\n const centeredAngle = twoPiMod(a - center);\n const centeredStart = twoPiMod(dirMin - center);\n const diff = dirMax - dirMin;\n\n const n = clamp((centeredAngle - centeredStart) / (diff), 0, 1);\n const newV = stepify(min + (max - min) * n, v => v, step);\n setter.setValue(newV);\n };\n addTouchEvents(this.domElement, {\n onDown: handleTouch,\n onMove: handleTouch,\n });\n addKeyboardEvents(this.domElement, {\n onDown: (e) => {\n const {min, max, step} = this.#options;\n const newV = clamp(stepify(this.#lastV + e.dx * step, v => v, step), min, max);\n setter.setValue(newV);\n },\n });\n this.#arrowElem = this.$('#muigui-arrow');\n this.#rangeElem = this.$('#muigui-range');\n this.setOptions(options);\n }\n updateDisplay(v) {\n this.#lastV = v;\n const {min, max} = this.#options;\n const n = (v - min) / (max - min);\n const angle = lerp(this.#options.dirMin, this.#options.dirMax, n);\n this.#arrowElem.style.transform = `rotate(${angle}rad)`;\n }\n setOptions(options) {\n copyExistingProperties(this.#options, options);\n const {dirMin, dirMax, wrap} = this.#options;\n this.#wrap = wrap !== undefined\n ? wrap\n : Math.abs(dirMin - dirMax) >= Math.PI * 2 - Number.EPSILON;\n const [min, max] = dirMin < dirMax ? [dirMin, dirMax] : [dirMax , dirMin];\n this.#rangeElem.setAttribute('d', arc(0, 0, 28.87, min, max));\n }\n}\n","import { identity } from '../libs/conversions.js';\nimport DirectionView from '../views/DirectionView.js';\nimport NumberView from '../views/NumberView.js';\n// import ValueController from './ValueController.js';\nimport PopDownController from './PopDownController.js';\n\n\n// deg2rad\n// where is 0\n// range (0, 360), (-180, +180), (0,0) Really this is a range\n\nexport default class Direction extends PopDownController {\n #options;\n constructor(object, property, options) {\n super(object, property, 'muigui-direction');\nthis.#options = options; // FIX\n this.addTop(new NumberView(this,\nidentity));\n this.addBottom(new DirectionView(this, options));\n this.updateDisplay();\n }\n}\n\n","import { createElem } from '../libs/elem.js';\nimport { makeId } from '../libs/ids.js';\nimport EditView from './EditView.js';\n\nexport default class RadioGridView extends EditView {\n #values;\n\n constructor(setter, keyValues, cols = 3) {\n const values = [];\n const name = makeId();\n super(createElem('div', {}, keyValues.map(([key, value], ndx) => {\n values.push(value);\n return createElem('label', {}, [\n createElem('input', {\n type: 'radio',\n name,\n value: ndx,\n onChange: function () {\n if (this.checked) {\n setter.setFinalValue(that.#values[this.value]);\n }\n },\n }),\n createElem('button', {\n type: 'button',\n textContent: key,\n onClick: function () {\n this.previousElementSibling.click();\n },\n }),\n ]);\n })));\n // eslint-disable-next-line @typescript-eslint/no-this-alias\n const that = this;\n this.#values = values;\n this.cols(cols);\n }\n updateDisplay(v) {\n const ndx = this.#values.indexOf(v);\n for (let i = 0; i < this.domElement.children.length; ++i) {\n this.domElement.children[i].children[0].checked = i === ndx;\n }\n }\n cols(cols) {\n this.domElement.style.gridTemplateColumns = `repeat(${cols}, 1fr)`;\n }\n}\n","import RadioGridView from '../views/RadioGridView.js';\nimport ValueController from './ValueController.js';\nimport { convertToKeyValues } from '../libs/key-values.js';\n\nexport default class RadioGrid extends ValueController {\n constructor(object, property, options) {\n super(object, property, 'muigui-radio-grid');\n const valueIsNumber = typeof this.getValue() === 'number';\n const {\n keyValues: keyValuesInput,\n cols = 3,\n } = options;\n const keyValues = convertToKeyValues(keyValuesInput, valueIsNumber);\n this.add(new RadioGridView(this, keyValues, cols));\n this.updateDisplay();\n }\n}","export function onResize(elem, callback) {\n new ResizeObserver(() => {\n callback({rect: elem.getBoundingClientRect(), elem});\n }).observe(elem);\n}\n\nexport function onResizeSVGNoScale(elem, hAnchor, vAnchor, callback) {\n onResize(elem, ({rect}) => {\n const {width, height} = rect;\n elem.setAttribute('viewBox', `-${width * hAnchor} -${height * vAnchor} ${width} ${height}`);\n callback({elem, rect});\n });\n}\n\nexport function onResizeCanvas(elem, callback) {\n onResize(elem, ({rect}) => {\n const {width, height} = rect;\n elem.width = width;\n elem.height = height;\n callback({elem, rect});\n });\n}\n","import { createElem } from '../libs/elem.js';\nimport { addKeyboardEvents } from '../libs/keyboard.js';\nimport { addTouchEvents } from '../libs/touch.js';\nimport { createWheelHelper } from '../libs/wheel.js';\nimport { onResizeSVGNoScale } from '../libs/resize-helpers.js';\nimport { clamp, copyExistingProperties, stepify } from '../libs/utils.js';\nimport EditView from './EditView.js';\n\nconst svg = `\n\n`;\n\nfunction createSVGTicks(start, end, step, min, max, height) {\n const p = [];\n if (start < min) {\n start += stepify(min - start, v => v, step);\n }\n end = Math.min(end, max);\n for (let i = start; i <= end; i += step) {\n p.push(`M${i} 0 l0 ${height}`);\n }\n return p.join(' ');\n}\n\nfunction createSVGNumbers(start, end, unitSize, unit, minusSize, min, max, labelFn) {\n const texts = [];\n if (start < min) {\n start += stepify(min - start, v => v, unitSize);\n }\n end = Math.min(end, max);\n const digits = Math.max(0, -Math.log10(unit));\n const f = v => labelFn(v.toFixed(digits));\n for (let i = start; i <= end; i += unitSize) {\n texts.push(`= 0 ? i : (i - minusSize / 2) }\" y=\"0\">${f(i / unitSize * unit)}`);\n }\n return texts.join('\\n');\n}\n\nfunction computeSizeOfMinus(elem) {\n const oldHTML = elem.innerHTML;\n elem.innerHTML = '- ';\n const text = elem.querySelector('text');\n const size = text.getComputedTextLength();\n elem.innerHTML = oldHTML;\n return size;\n}\n\nexport default class SliderView extends EditView {\n #svgElem;\n #originElem;\n #ticksElem;\n #thicksElem;\n #numbersElem;\n #leftGradElem;\n #rightGradElem;\n #width;\n #height;\n #lastV;\n #minusSize;\n #options = {\n min: -100,\n max: 100,\n step: 1,\n unit: 10,\n unitSize: 10,\n ticksPerUnit: 5,\n labelFn: v => v,\n tickHeight: 1,\n limits: true,\n thicksColor: undefined,\n orientation: undefined,\n };\n\n constructor(setter, options) {\n const wheelHelper = createWheelHelper();\n super(createElem('div', {\n innerHTML: svg,\n className: 'muigui-no-v-scroll',\n onWheel: e => {\n e.preventDefault();\n const {min, max, step} = this.#options;\n const delta = wheelHelper(e, step);\n const newV = clamp(stepify(this.#lastV + delta, v => v, step), min, max);\n setter.setValue(newV);\n },\n }));\n this.#svgElem = this.$('svg');\n this.#originElem = this.$('#muigui-origin');\n this.#ticksElem = this.$('#muigui-ticks');\n this.#thicksElem = this.$('#muigui-thicks');\n this.#numbersElem = this.$('#muigui-numbers');\n this.#leftGradElem = this.$('#muigui-left-grad');\n this.#rightGradElem = this.$('#muigui-right-grad');\n this.setOptions(options);\n let startV;\n addTouchEvents(this.domElement, {\n onDown: () => {\n startV = this.#lastV;\n },\n onMove: (e) => {\n const {min, max, unitSize, unit, step} = this.#options;\n const newV = clamp(stepify(startV - e.dx / unitSize * unit, v => v, step), min, max);\n setter.setValue(newV);\n },\n });\n addKeyboardEvents(this.domElement, {\n onDown: (e) => {\n const {min, max, step} = this.#options;\n const newV = clamp(stepify(this.#lastV + e.dx * step, v => v, step), min, max);\n setter.setValue(newV);\n },\n });\n onResizeSVGNoScale(this.#svgElem, 0.5, 0, ({rect: {width}}) => {\n this.#leftGradElem.setAttribute('x', -width / 2);\n this.#rightGradElem.setAttribute('x', width / 2 - 20);\n this.#minusSize = computeSizeOfMinus(this.#numbersElem);\n this.#width = width;\n this.#updateSlider();\n });\n }\n // |--------V--------|\n // . . | . . . | . . . |\n //\n #updateSlider() {\n // There's no size if ResizeObserver has not fired yet.\n if (!this.#width || this.#lastV === undefined) {\n return;\n }\n const {\n labelFn,\n limits,\n min,\n max,\n orientation,\n tickHeight,\n ticksPerUnit,\n unit,\n unitSize,\n thicksColor,\n } = this.#options;\n const unitsAcross = Math.ceil(this.#width / unitSize);\n const center = this.#lastV;\n const centerUnitSpace = center / unit;\n const startUnitSpace = Math.round(centerUnitSpace - unitsAcross);\n const endUnitSpace = startUnitSpace + unitsAcross * 2;\n const start = startUnitSpace * unitSize;\n const end = endUnitSpace * unitSize;\n const minUnitSpace = limits ? min * unitSize / unit : start;\n const maxUnitSpace = limits ? max * unitSize / unit : end;\n const height = labelFn(1) === '' ? 10 : 5;\n if (ticksPerUnit > 1) {\n this.#ticksElem.setAttribute('d', createSVGTicks(start, end, unitSize / ticksPerUnit, minUnitSpace, maxUnitSpace, height * tickHeight));\n }\n this.#thicksElem.style.stroke = thicksColor; //setAttribute('stroke', thicksColor);\n this.#thicksElem.setAttribute('d', createSVGTicks(start, end, unitSize, minUnitSpace, maxUnitSpace, height));\n this.#numbersElem.innerHTML = createSVGNumbers(start, end, unitSize, unit, this.#minusSize, minUnitSpace, maxUnitSpace, labelFn);\n this.#originElem.setAttribute('transform', `translate(${-this.#lastV * unitSize / unit} 0)`);\n this.#svgElem.classList.toggle('muigui-slider-up', orientation === 'up');\n }\n updateDisplay(v) {\n this.#lastV = v;\n this.#updateSlider();\n }\n setOptions(options) {\n copyExistingProperties(this.#options, options);\n return this;\n }\n}\n","import ValueController from './ValueController.js';\nimport NumberView from '../views/NumberView.js';\nimport SliderView from '../views/SliderView.js';\n\nexport default class Slider extends ValueController {\n constructor(object, property, options = {}) {\n super(object, property, 'muigui-slider');\n this.add(new SliderView(this, options));\n this.add(new NumberView(this, options));\n this.updateDisplay();\n }\n}\n","import { createElem } from '../libs/elem.js';\nimport { addTouchEvents } from '../libs/touch.js';\nimport { onResizeSVGNoScale } from '../libs/resize-helpers.js';\nimport EditView from './EditView.js';\n\nconst svg = `\n\n`;\n\nexport default class Vec2View extends EditView {\n #svgElem;\n #arrowElem;\n #circleElem;\n #lastV = [];\n\n constructor(setter) {\n super(createElem('div', {\n innerHTML: svg,\n className: 'muigui-no-scroll',\n }));\n const onTouch = (e) => {\n const {width, height} = this.#svgElem.getBoundingClientRect();\n const nx = e.nx * 2 - 1;\n const ny = e.ny * 2 - 1;\n setter.setValue([nx * width * 0.5, ny * height * 0.5]);\n };\n addTouchEvents(this.domElement, {\n onDown: onTouch,\n onMove: onTouch,\n });\n this.#svgElem = this.$('svg');\n this.#arrowElem = this.$('#muigui-arrow');\n this.#circleElem = this.$('#muigui-circle');\n onResizeSVGNoScale(this.#svgElem, 0.5, 0.5, () => this.#updateDisplayImpl);\n }\n #updateDisplayImpl() {\n const [x, y] = this.#lastV;\n this.#arrowElem.setAttribute('d', `M0,0L${x},${y}`);\n this.#circleElem.setAttribute('transform', `translate(${x}, ${y})`);\n }\n updateDisplay(v) {\n this.#lastV[0] = v[0];\n this.#lastV[1] = v[1];\n this.#updateDisplayImpl();\n }\n}\n","import NumberView from '../views/NumberView.js';\nimport Vec2View from '../views/Vec2View.js';\nimport PopDownController from './PopDownController.js';\nimport { strToNumber } from '../libs/conversions.js';\n\n// TODO: zoom with wheel and pinch?\n// TODO: grid?\n// // options\n// scale:\n// range: number (both x and y + /)\n// range: array (min, max)\n// xRange:\n// deg/rad/turn\n\nexport default class Vec2 extends PopDownController {\n constructor(object, property) {\n super(object, property, 'muigui-vec2');\n\n const makeSetter = (ndx) => {\n return {\n setValue: (v) => {\n const newV = this.getValue();\n newV[ndx] = v;\n this.setValue(newV);\n },\n setFinalValue: (v) => {\n const newV = this.getValue();\n newV[ndx] = v;\n this.setFinalValue(newV);\n },\n };\n };\n\n this.addTop(new NumberView(makeSetter(0), {\n converters: {\n to: v => v[0],\n from: strToNumber.from,\n },\n }));\n this.addTop(new NumberView(makeSetter(1), {\n converters: {\n to: v => v[1],\n from: strToNumber.from,\n },\n }));\n this.addBottom(new Vec2View(this));\n this.updateDisplay();\n }\n}\n","import GUI from './muigui.js';\n\nimport ColorChooser from './controllers/ColorChooser.js';\nimport Direction from './controllers/Direction.js';\nimport RadioGrid from './controllers/RadioGrid.js';\nimport Range from './controllers/Range.js';\nimport Select from './controllers/Select.js';\nimport Slider from './controllers/Slider.js';\nimport TextNumber from './controllers/TextNumber.js';\nimport Vec2 from './controllers/Vec2.js';\n\nGUI.ColorChooser = ColorChooser;\nGUI.Direction = Direction;\nGUI.RadioGrid = RadioGrid;\nGUI.Range = Range;\nGUI.Select = Select;\nGUI.Slider = Slider;\nGUI.TextNumber = TextNumber;\nGUI.Vec2 = Vec2;\n\nexport default GUI;"],"names":["clamp","euclideanModulo","lerp","identity","noop","svg"],"mappings":";;;;;;;AAAA,YAAe;EACf,EAAE,OAAO,EAAE,CAAC;AACZ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;EACD,MAAM,EAAE;EACR,EAAE,OAAO,EAAE,EAAE;EACb,EAAE,KAAK,EAAE,CAAC;AACV;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;EACD,CAAC;EACD,CAAC;;ECnvBM,SAAS,YAAY,CAAC,IAAI,EAAE,KAAK,EAAE,QAAQ,EAAE;EACpD,EAAE,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;EACpD,IAAI,IAAI,OAAO,KAAK,KAAK,UAAU,IAAI,GAAG,CAAC,UAAU,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AG,SAAS,CAAC;EAC1B,GAAG,CAAC,KAAK,GAAG,KAAK,CAAC;EAClB,GAAG,CAAC,MAAM,GAAG,MAAM,CAAC;EACpB,GAAG,CAAC,MAAM,GAAG,MAAM,CAAC;EACpB,GAAG,CAAC,UAAU,GAAG,UAAU,CAAC;EAC5B,GAAG,CAAC,IAAI,GAAG,IAAI;;;;;;;;"}
\ No newline at end of file
+{"version":3,"file":"muigui.js","sources":["../../src/styles/muigui.css.js","../../src/libs/elem.js","../../src/libs/utils.js","../../../src/views/View.ts","../../src/controllers/Controller.js","../../src/controllers/Button.js","../../src/views/EditView.js","../../src/views/CheckboxView.js","../../src/libs/taskrunner.js","../../src/libs/ids.js","../../src/views/ValueView.js","../../src/controllers/LabelController.js","../../src/controllers/ValueController.js","../../src/controllers/Checkbox.js","../../src/libs/conversions.js","../../src/libs/wheel.js","../../src/views/NumberView.js","../../src/controllers/TextNumber.js","../../src/views/SelectView.js","../../src/libs/key-values.js","../../src/controllers/Select.js","../../src/views/RangeView.js","../../src/controllers/Range.js","../../src/views/TextView.js","../../src/controllers/Text.js","../../src/controllers/create-controller.js","../../src/libs/color-utils.js","../../src/views/ElementView.js","../../src/controllers/Canvas.js","../../src/views/ColorView.js","../../src/controllers/Color.js","../../src/controllers/Divider.js","../../src/controllers/Container.js","../../src/controllers/Folder.js","../../src/controllers/Label.js","../../src/libs/touch.js","../../src/views/ColorChooserView.js","../../src/controllers/PopDownController.js","../../src/controllers/ColorChooser.js","../../src/layout/Layout.js","../../src/layout/Column.js","../../src/layout/Frame.js","../../src/layout/Grid.js","../../src/layout/Row.js","../../src/muigui.js","../../src/libs/keyboard.js","../../src/libs/assert.js","../../src/libs/svg.js","../../src/views/DirectionView.js","../../src/controllers/Direction.js","../../src/views/RadioGridView.js","../../src/controllers/RadioGrid.js","../../src/libs/resize-helpers.js","../../src/views/SliderView.js","../../src/controllers/Slider.js","../../src/views/Vec2View.js","../../src/controllers/Vec2.js","../../src/umd.js"],"sourcesContent":["export default {\n default: `\n.muigui {\n --bg-color: #ddd;\n --color: #222;\n --contrast-color: #eee;\n --value-color: #145 ;\n --value-bg-color: #eeee;\n --disabled-color: #999;\n --menu-bg-color: #f8f8f8;\n --menu-sep-color: #bbb;\n --hover-bg-color: #999;\n --focus-color: #8BF;\n --range-color: #AAA;\n --invalid-color: #FF0000;\n --selected-color: rgb(255, 255, 255, 0.9);\n\n --button-bg-color: var(--value-bg-color);\n\n --image-open: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPgogIDxyZWN0IHN0eWxlPSJmaWxsOiAjNDQ0OyIgeD0iMjAlIiB5PSI0NSUiIHdpZHRoPSI2MCUiIGhlaWdodD0iMTAlIj48L3JlY3Q+Cjwvc3ZnPg==);\n --image-closed: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPgogIDxyZWN0IHN0eWxlPSJmaWxsOiAjNDQ0OyIgeD0iNDUlIiB5PSIyMCUiIHdpZHRoPSIxMCUiIGhlaWdodD0iNjAlIj48L3JlY3Q+CiAgPHJlY3Qgc3R5bGU9ImZpbGw6ICM0NDQ7IiB4PSIyMCUiIHk9IjQ1JSIgd2lkdGg9IjYwJSIgaGVpZ2h0PSIxMCUiPjwvcmVjdD4KPC9zdmc+);\n --image-checkerboard: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPgogIDxyZWN0IHN0eWxlPSJmaWxsOiAjNDA0MDQwOyIgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSI+PC9yZWN0PgogIDxyZWN0IHN0eWxlPSJmaWxsOiAjODA4MDgwOyIgeD0iMCIgeT0iMCIgd2lkdGg9IjUwJSIgaGVpZ2h0PSI1MCUiPjwvcmVjdD4KICA8cmVjdCBzdHlsZT0iZmlsbDogIzgwODA4MDsiIHg9IjUwJSIgeT0iNTAlIiB3aWR0aD0iNTAlIiBoZWlnaHQ9IjUwJSI+PC9yZWN0Pgo8L3N2Zz4=);\n\n --range-left-color: var(--value-color);\n --range-right-color: var(--value-bg-color); \n --range-right-hover-color: var(--hover-bg-color);\n --button-image: \n linear-gradient(\n rgba(255, 255, 255, 1), rgba(0, 0, 0, 0.2)\n );\n\n color: var(--color);\n background-color: var(--bg-color);\n}\n\n@media (prefers-color-scheme: dark) {\n .muigui {\n --bg-color: #222222;\n --color: #dddddd;\n --contrast-color: #000;\n --value-color: #43e5f7;\n --value-bg-color: #444444;\n --disabled-color: #666666;\n --menu-bg-color: #080808;\n --menu-sep-color: #444444;\n --hover-bg-color: #666666;\n --focus-color: #458; /*#88AAFF*/;\n --range-color: #888888;\n --invalid-color: #FF6666;\n --selected-color: rgba(255, 255, 255, 0.3);\n\n --button-bg-color: var(--value-bg-color);\n\n --range-left-color: var(--value-color);\n --range-right-color: var(--value-bg-color); \n --range-right-hover-color: var(--hover-bg-color);\n --button-image: linear-gradient(\n rgba(0, 0, 0, 0.1), rgba(0, 0, 0, 0.4)\n );\n\n color: var(--color);\n background-color: var(--bg-color);\n\n --image-closed: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPgogIDxyZWN0IHN0eWxlPSJmaWxsOiAjREREOyIgeD0iMjAlIiB5PSI0NSUiIHdpZHRoPSI2MCUiIGhlaWdodD0iMTAlIj48L3JlY3Q+Cjwvc3ZnPg==);\n --image-open: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPgogIDxyZWN0IHN0eWxlPSJmaWxsOiAjREREOyIgeD0iNDUlIiB5PSIyMCUiIHdpZHRoPSIxMCUiIGhlaWdodD0iNjAlIj48L3JlY3Q+CiAgPHJlY3Qgc3R5bGU9ImZpbGw6ICNEREQ7IiB4PSIyMCUiIHk9IjQ1JSIgd2lkdGg9IjYwJSIgaGVpZ2h0PSIxMCUiPjwvcmVjdD4KPC9zdmc+);\n }\n}\n\n.muigui {\n --width: 250px;\n --label-width: 45%;\n --number-width: 40%;\n\n --font-family: -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, Arial, sans-serif;\n --font-size: 11px;\n --font-family-mono: Menlo, Monaco, Consolas, \"Droid Sans Mono\", monospace;\n --font-size-mono: 11px;\n\n --line-height: 1.7em;\n --border-radius: 0px;\n\n width: var(--width);\n font-family: var(--font-family);\n font-size: var(--font-size);\n box-sizing: border-box;\n line-height: 100%;\n}\n.muigui * {\n box-sizing: inherit;\n}\n\n.muigui-no-scroll {\n touch-action: none;\n}\n.muigui-no-h-scroll {\n touch-action: pan-y;\n}\n.muigui-no-v-scroll {\n touch-action: pan-x;\n}\n\n.muigui-invalid-value {\n background-color: red !important;\n color: white !important;\n}\n\n.muigui-grid {\n display: grid;\n}\n.muigui-rows {\n display: flex;\n flex-direction: column;\n\n min-height: 20px;\n border: 2px solid red;\n}\n.muigui-columns {\n display: flex;\n flex-direction: row;\n\n height: 20px;\n border: 2px solid green;\n}\n.muigui-rows>*,\n.muigui-columns>* {\n flex: 1 1 auto;\n align-items: stretch;\n min-height: 0;\n min-width: 0;\n}\n\n.muigui-row {\n border: 2px solid yellow;\n min-height: 10px\n}\n.muigui-column {\n border: 2px solid lightgreen;\n}\n\n/* -------- */\n\n.muigui-show { /* */ }\n.muigui-hide { \n display: none !important;\n}\n.muigui-disabled {\n pointer-events: none;\n --color: var(--disabled-color) !important;\n --value-color: var(--disabled-color) !important;\n --range-left-color: var(--disabled-color) !important;\n}\n\n.muigui canvas,\n.muigui svg {\n display: block;\n border-radius: var(--border-radius);\n}\n.muigui canvas {\n background-color: var(--value-bg-color);\n}\n\n.muigui-controller {\n min-width: 0;\n min-height: var(--line-height);\n}\n.muigui-root {\n z-index: 1;\n}\n.muigui-root,\n.muigui-menu {\n display: flex;\n flex-direction: column;\n position: relative;\n user-select: none;\n height: fit-content;\n margin: 0;\n padding-bottom: 0.1em;\n border-radius: var(--border-radius);\n}\n.muigui-menu {\n border-bottom: 1px solid var(--menu-sep-color);\n}\n\n.muigui-root>button:nth-child(1),\n.muigui-menu>button:nth-child(1) {\n border-top: 1px solid var(--menu-sep-color);\n border-bottom: 1px solid var(--menu-sep-color);\n position: relative;\n text-align: left;\n color: var(--color);\n background-color: var(--menu-bg-color);\n min-height: var(--line-height);\n padding: 0.2em;\n cursor: pointer;\n border-radius: var(--border-radius);\n}\n.muigui-root>div:nth-child(2),\n.muigui-menu>div:nth-child(2) {\n flex: 1 1 auto;\n}\n\n.muigui-controller {\n margin-left: 0.2em;\n margin-right: 0.2em;\n}\n.muigui-root.muigui-controller,\n.muigui-menu.muigui-controller {\n margin-left: 0;\n margin-right: 0;\n}\n.muigui-controller>*:nth-child(1) {\n flex: 1 0 var(--label-width);\n min-width: 0;\n /* white-space: pre; why?? */\n}\n.muigui-controller>label:nth-child(1) {\n place-content: center start;\n display: inline-grid;\n overflow: hidden;\n}\n.muigui-controller>*:nth-child(2) {\n flex: 1 1 75%;\n min-width: 0;\n}\n\n/* -----------------------------------------\n a label controller is [[label][value]]\n*/\n\n.muigui-label-controller {\n display: flex;\n margin: 0.4em 0 0.4em 0;\n word-wrap: initial;\n align-items: stretch;\n}\n\n.muigui-value {\n display: flex;\n align-items: stretch;\n}\n.muigui-value>* {\n flex: 1 1 auto;\n min-width: 0;\n}\n.muigui-value>*:nth-child(1) {\n flex: 1 1 calc(100% - var(--number-width));\n}\n.muigui-value>*:nth-child(2) {\n flex: 1 1 var(--number-width);\n margin-left: 0.2em;\n}\n\n/* fix! */\n.muigui-open>button>label::before,\n.muigui-closed>button>label::before {\n content: \"X\";\n color: rgba(0, 0, 0, 0);\n background-color: var(--range-color);\n border-radius: 0.2em;\n width: 1.25em;\n margin-right: 0.25em;\n height: 1.25em; /*var(--line-height);*/\n display: inline-grid;\n place-content: center start;\n pointer-events: none;\n}\n.muigui-open>button>label::before {\n background-image: var(--image-open);\n}\n.muigui-closed>button>label::before {\n background-image: var(--image-closed);\n}\n\n.muigui-open>.muigui-open-container {\n transition: all 0.1s ease-out;\n overflow: auto;\n height: 100%;\n}\n.muigui-closed>.muigui-open-container {\n transition: all 0.1s ease-out;\n overflow: hidden;\n min-height: 0;\n}\n.muigui-open>.muigui-open-container>* {\n transition: all 0.1s ease-out;\n margin-top: 0px;\n}\n.muigui-closed>.muigui-open-container>* {\n transition: all 0.1s ease-out;\n margin-top: -100%;\n}\n\n/* ---- popdown ---- */\n\n.muigui-pop-down-top {\n display: flex;\n}\n/* fix? */\n.muigui-value>*:nth-child(1).muigui-pop-down-top {\n flex: 0;\n}\n.muigui-closed .muigui-pop-down-bottom {\n max-height: 0;\n}\n\n.muigui-value .muigui-pop-down-bottom {\n margin: 0;\n}\n\n.muigui-pop-down-values {\n min-width: 0;\n display: flex;\n}\n.muigui-pop-down-values>* {\n flex: 1 1 auto;\n min-width: 0;\n}\n\n.muigui-value.muigui-pop-down-controller {\n flex-direction: column;\n}\n\n.muigui-pop-down-top input[type=checkbox] {\n -webkit-appearance: none;\n appearance: none;\n width: auto;\n color: var(--value-color);\n background-color: var(--value-bg-color);\n background-image: var(--image-checkerboard);\n background-size: 10px 10px;\n background-position: 0 0, 0 5px, 5px -5px, -5px 0px;\n\n cursor: pointer;\n\n display: grid;\n place-content: center;\n margin: 0;\n font: inherit;\n color: currentColor;\n width: 1.7em;\n height: 1.7em;\n transform: translateY(-0.075em);\n}\n\n.muigui-pop-down-top input[type=checkbox]::before {\n content: \"+\";\n display: grid;\n place-content: center;\n border-radius: calc(var(--border-radius) + 2px);\n border-left: 1px solid rgba(255,255,255,0.3);\n border-top: 1px solid rgba(255,255,255,0.3);\n border-bottom: 1px solid rgba(0,0,0,0.2);\n border-right: 1px solid rgba(0,0,0,0.2);\n background-color: var(--range-color);\n color: var(--value-bg-color);\n width: calc(var(--line-height) - 4px);\n height: calc(var(--line-height) - 4px);\n}\n\n.muigui-pop-down-top input[type=checkbox]:checked::before {\n content: \"X\";\n}\n\n\n/* ---- select ---- */\n\n.muigui select,\n.muigui option,\n.muigui input,\n.muigui button {\n color: var(--value-color);\n background-color: var(--value-bg-color);\n font-family: var(--font-family);\n font-size: var(--font-size);\n border: none;\n margin: 0;\n border-radius: var(--border-radius);\n}\n.muigui select {\n appearance: none;\n margin: 0;\n margin-left: 0; /*?*/\n overflow: hidden; /* Safari */\n}\n\n.muigui select:focus,\n.muigui input:focus,\n.muigui button:focus {\n outline: 1px solid var(--focus-color);\n}\n\n.muigui select:hover,\n.muigui option:hover,\n.muigui input:hover,\n.muigui button:hover {\n background-color: var(--hover-bg-color); \n}\n\n/* ------ [ label ] ------ */\n\n.muigui-label {\n border-top: 1px solid var(--menu-sep-color);\n border-bottom: 1px solid var(--menu-sep-color);\n padding-top: 0.4em;\n padding-bottom: 0.3em;\n place-content: center start;\n background-color: var(--menu-bg-color);\n white-space: pre;\n border-radius: var(--border-radius);\n}\n\n/* ------ [ divider] ------ */\n\n.muigui-divider {\n min-height: 6px;\n border-top: 2px solid var(--menu-sep-color);\n margin-top: 6px;\n}\n\n/* ------ [ button ] ------ */\n\n.muigui-button {\n display: grid;\n padding: 2px 0 2px 0;\n}\n.muigui-button button {\n border: none;\n color: var(--value-color);\n background-color: var(--button-bg-color);\n background-image: var(--button-image);\n cursor: pointer;\n place-content: center center;\n height: var(--line-height);\n}\n\n/* ------ [ color ] ------ */\n\n.muigui-color>div {\n overflow: hidden;\n position: relative;\n margin-left: 0;\n margin-right: 0; /* why? */\n max-width: var(--line-height);\n border-radius: var(--border-radius);\n}\n\n.muigui-color>div:focus-within {\n outline: 1px solid var(--focus-color);\n}\n\n.muigui-color input[type=color] {\n border: none;\n padding: 0;\n background: inherit;\n cursor: pointer;\n position: absolute;\n width: 200%;\n left: -10px;\n top: -10px;\n height: 200%;\n}\n.muigui-disabled canvas,\n.muigui-disabled svg,\n.muigui-disabled img,\n.muigui-disabled .muigui-color input[type=color] {\n opacity: 0.2;\n}\n\n/* ------ [ checkbox ] ------ */\n\n.muigui-checkbox>label:nth-child(2) {\n display: grid;\n place-content: center start;\n margin: 0;\n}\n\n.muigui-checkbox input[type=checkbox] {\n -webkit-appearance: none;\n appearance: none;\n width: auto;\n color: var(--value-color);\n background-color: var(--value-bg-color);\n cursor: pointer;\n\n display: grid;\n place-content: center;\n margin: 0;\n font: inherit;\n color: currentColor;\n width: 1.7em;\n height: 1.7em;\n transform: translateY(-0.075em);\n}\n\n.muigui-checkbox input[type=checkbox]::before {\n content: \"\";\n color: var(--value-color);\n display: grid;\n place-content: center;\n}\n\n.muigui-checkbox input[type=checkbox]:checked::before {\n content: \"✔\";\n}\n\n.muigui input[type=number]::-webkit-inner-spin-button, \n.muigui input[type=number]::-webkit-outer-spin-button { \n -webkit-appearance: none;\n appearance: none;\n margin: 0; \n}\n.muigui input[type=number] {\n -moz-appearance: textfield;\n}\n\n/* ------ [ radio grid ] ------ */\n\n.muigui-radio-grid>div {\n display: grid;\n gap: 2px;\n}\n\n.muigui-radio-grid input {\n appearance: none;\n display: none;\n}\n\n.muigui-radio-grid button {\n color: var(--color);\n width: 100%;\n text-align: left;\n}\n\n.muigui-radio-grid input:checked + button {\n color: var(--value-color);\n background-color: var(--selected-color);\n}\n\n/* ------ [ color-chooser ] ------ */\n\n.muigui-color-chooser-cursor {\n stroke-width: 1px;\n stroke: white;\n fill: none;\n}\n.muigui-color-chooser-circle {\n stroke-width: 1px;\n stroke: white;\n fill: none;\n}\n\n\n/* ------ [ vec2 ] ------ */\n\n.muigui-vec2 svg {\n background-color: var(--value-bg-color);\n}\n\n.muigui-vec2-axis {\n stroke: 1px;\n stroke: var(--focus-color);\n}\n\n.muigui-vec2-line {\n stroke-width: 1px;\n stroke: var(--value-color);\n fill: var(--value-color);\n}\n\n/* ------ [ direction ] ------ */\n\n.muigui-direction svg {\n background-color: rgba(0,0,0,0.2);\n}\n\n.muigui-direction:focus-within svg {\n outline: none;\n}\n.muigui-direction-range {\n fill: var(--value-bg-color);\n}\n.muigui-direction svg:focus {\n outline: none;\n}\n.muigui-direction svg:focus .muigui-direction-range {\n stroke-width: 0.5px;\n stroke: var(--focus-color);\n}\n\n.muigui-direction-arrow {\n fill: var(--value-color);\n}\n\n/* ------ [ slider ] ------ */\n\n.muigui-slider>div {\n display: flex;\n align-items: stretch;\n height: var(--line-height);\n}\n.muigui-slider svg {\n flex: 1 1 auto;\n}\n.muigui-slider .muigui-slider-up #muigui-orientation {\n transform: scale(1, -1) translateY(-100%);\n}\n\n.muigui-slider .muigui-slider-up #muigui-number-orientation {\n transform: scale(1,-1);\n}\n\n.muigui-ticks {\n stroke: var(--range-color);\n}\n.muigui-thicks {\n stroke: var(--color);\n stroke-width: 2px;\n}\n.muigui-svg-text {\n fill: var(--color);\n font-size: 7px;\n}\n.muigui-mark {\n fill: var(--value-color);\n}\n\n/* ------ [ range ] ------ */\n\n\n.muigui-range input[type=range] {\n -webkit-appearance: none;\n appearance: none;\n background-color: transparent;\n}\n\n.muigui-range input[type=range]::-webkit-slider-thumb {\n -webkit-appearance: none;\n appearance: none;\n border-radius: calc(var(--border-radius) + 2px);\n border-left: 1px solid rgba(255,255,255,0.3);\n border-top: 1px solid rgba(255,255,255,0.3);\n border-bottom: 1px solid rgba(0,0,0,0.2);\n border-right: 1px solid rgba(0,0,0,0.2);\n background-color: var(--range-color);\n margin-top: calc((var(--line-height) - 6px) / -2);\n width: calc(var(--line-height) - 6px);\n height: calc(var(--line-height) - 6px);\n}\n\n.muigui-range input[type=range]::-webkit-slider-runnable-track {\n -webkit-appearance: none;\n appearance: none;\n border: 1px solid var(--menu-sep-color);\n height: 2px;\n}\n\n\n/* dat.gui style - doesn't work on Safari iOS */\n\n/*\n.muigui-range input[type=range] {\n cursor: ew-resize;\n overflow: hidden;\n}\n\n.muigui-range input[type=range] {\n -webkit-appearance: none;\n appearance: none;\n background-color: var(--range-right-color);\n margin: 0;\n}\n.muigui-range input[type=range]:hover {\n background-color: var(--range-right-hover-color);\n}\n\n.muigui-range input[type=range]::-webkit-slider-runnable-track {\n -webkit-appearance: none;\n appearance: none;\n height: max-content;\n color: var(--range-left-color);\n margin-top: -1px;\n}\n\n.muigui-range input[type=range]::-webkit-slider-thumb {\n -webkit-appearance: none;\n appearance: none;\n width: 0px;\n height: max-content;\n box-shadow: -1000px 0 0 1000px var(--range-left-color);\n}\n*/\n\n/* FF */\n/*\n.muigui-range input[type=range]::-moz-slider-progress {\n background-color: var(--range-left-color); \n}\n.muigui-range input[type=range]::-moz-slider-thumb {\n height: max-content;\n width: 0;\n border: none;\n box-shadow: -1000px 0 0 1000px var(--range-left-color);\n box-sizing: border-box;\n}\n*/\n\n.muigui-checkered-background {\n background-color: #404040;\n background-image:\n linear-gradient(45deg, #808080 25%, transparent 25%),\n linear-gradient(-45deg, #808080 25%, transparent 25%),\n linear-gradient(45deg, transparent 75%, #808080 75%),\n linear-gradient(-45deg, transparent 75%, #808080 75%);\n background-size: 16px 16px;\n background-position: 0 0, 0 8px, 8px -8px, -8px 0px;\n}\n\n/* ---------------------------------------------------------- */\n\n/* needs to be at bottom to take precedence */\n.muigui-auto-place {\n max-height: 100%;\n position: fixed;\n top: 0;\n right: 15px;\n z-index: 100001;\n}\n\n`,\nthemes: {\n default: {\n include: ['default'],\n css: `\n `,\n },\n float: {\n include: ['default'],\n css: `\n :root {\n color-scheme: light dark,\n }\n\n .muigui {\n --width: 400px;\n --bg-color: initial;\n --label-width: 25%;\n --number-width: 20%;\n }\n\n input,\n .muigui-label-controller>label {\n text-shadow:\n -1px -1px 0 var(--contrast-color),\n 1px -1px 0 var(--contrast-color),\n -1px 1px 0 var(--contrast-color),\n 1px 1px 0 var(--contrast-color);\n }\n\n .muigui-controller > label:nth-child(1) {\n place-content: center end;\n margin-right: 1em;\n }\n\n .muigui-value > :nth-child(2) {\n margin-left: 1em;\n }\n\n .muigui-root>*:nth-child(1) {\n display: none;\n }\n\n .muigui-range input[type=range]::-webkit-slider-thumb {\n border-radius: 1em;\n }\n\n .muigui-range input[type=range]::-webkit-slider-runnable-track {\n -webkit-appearance: initial;\n appearance: none;\n border: 1px solid rgba(0, 0, 0, 0.25);\n height: 2px;\n }\n\n .muigui-colors {\n --value-color: var(--color );\n --value-bg-color: rgba(0, 0, 0, 0.1);\n --disabled-color: #cccccc;\n --menu-bg-color: rgba(0, 0, 0, 0.1);\n --menu-sep-color: #bbbbbb;\n --hover-bg-color: rgba(0, 0, 0, 0);\n --invalid-color: #FF0000;\n --selected-color: rgba(0, 0, 0, 0.3);\n --range-color: rgba(0, 0, 0, 0.125);\n }\n`,\n },\n form: {\n include: [],\n css: `\n .muigui {\n --width: 100%;\n --label-width: 45%;\n --number-width: 40%;\n }\n .muigui-root>button {\n display: none;\n }\n .muigui-controller {\n margin-top: 1em;\n }\n .muigui-label-controller {\n display: flex;\n flex-direction: column;\n align-items: stretch;\n margin-top: 1em;\n }\n .muigui-label-controller:has(.muigui-checkbox) {\n flex-direction: row;\n }\n .muigui-value {\n display: flex;\n align-items: stretch;\n }\n .muigui-value>* {\n flex: 1 1 auto;\n min-width: 0;\n }\n .muigui-controller>*:nth-child(1) {\n flex: 1 0 var(--label-width);\n min-width: 0;\n white-space: pre;\n }\n .muigui-controller>label:nth-child(1) {\n place-content: center start;\n display: inline-grid;\n overflow: hidden;\n }\n .muigui-controller>*:nth-child(2) {\n flex: 1 1 75%;\n min-width: 0;\n }\n `,\n },\n none: {\n include: [],\n css: '',\n },\n},\n};\n","export function setElemProps(elem, attrs, children) {\n for (const [key, value] of Object.entries(attrs)) {\n if (typeof value === 'function' && key.startsWith('on')) {\n const eventName = key.substring(2).toLowerCase();\n elem.addEventListener(eventName, value, {passive: false});\n } else if (typeof value === 'object') {\n for (const [k, v] of Object.entries(value)) {\n elem[key][k] = v;\n }\n } else if (elem[key] === undefined) {\n elem.setAttribute(key, value);\n } else {\n elem[key] = value;\n }\n }\n for (const child of children) {\n elem.appendChild(child);\n }\n return elem;\n}\n\nexport function createElem(tag, attrs = {}, children = []) {\n const elem = document.createElement(tag);\n setElemProps(elem, attrs, children);\n return elem;\n}\n\nexport function addElem(tag, parent, attrs = {}, children = []) {\n const elem = createElem(tag, attrs, children);\n parent.appendChild(elem);\n return elem;\n}\n\nlet nextId = 0;\nexport function getNewId() {\n return `muigui-id-${nextId++}`;\n}\n","export function removeArrayElem(array, value) {\n const ndx = array.indexOf(value);\n if (ndx) {\n array.splice(ndx, 1);\n }\n return array;\n}\n\n/**\n * Converts an camelCase or snake_case id to \"camel case\" or \"snake case\"\n * @param {string} id\n */\nconst underscoreRE = /_/g;\nconst upperLowerRE = /([A-Z])([a-z])/g;\nexport function idToLabel(id) {\n return id.replace(underscoreRE, ' ')\n .replace(upperLowerRE, (m, m1, m2) => `${m1.toLowerCase()} ${m2}`);\n}\n\nexport function clamp(v, min, max) {\n return Math.max(min, Math.min(max, v));\n}\n\nexport const isTypedArray = typeof SharedArrayBuffer !== 'undefined'\n ? function isArrayBufferOrSharedArrayBuffer(a) {\n return a && a.buffer && (a.buffer instanceof ArrayBuffer || a.buffer instanceof SharedArrayBuffer);\n }\n : function isArrayBuffer(a) {\n return a && a.buffer && a.buffer instanceof ArrayBuffer;\n };\n\nexport const isArrayOrTypedArray = v => Array.isArray(v) || isTypedArray(v);\n\n// Yea, I know this should be `Math.round(v / step) * step\n// but try step = 0.1, newV = 19.95\n//\n// I get\n// Math.round(19.95 / 0.1) * 0.1\n// 19.900000000000002\n// vs\n// Math.round(19.95 / 0.1) / (1 / 0.1)\n// 19.9\n//\nexport const stepify = (v, from, step) => Math.round(from(v) / step) / (1 / step);\n\nexport const euclideanModulo = (v, n) => ((v % n) + n) % n;\nexport const lerp = (a, b, t) => a + (b - a) * t;\nexport function copyExistingProperties(dst, src) {\n for (const key in src) {\n if (key in dst) {\n dst[key] = src[key];\n }\n }\n return dst;\n}\n\nexport const mapRange = (v, inMin, inMax, outMin, outMax) => (v - inMin) * (outMax - outMin) / (inMax - inMin) + outMin;\n\nexport const makeRangeConverters = ({from, to}) => {\n return {\n to: v => mapRange(v, ...from, ...to),\n from: v => [true, mapRange(v, ...to, ...from)],\n };\n};\n\nexport const makeRangeOptions = ({from, to, step}) => {\n return {\n min: to[0],\n max: to[1],\n ...(step && {step}),\n converters: makeRangeConverters({from, to}),\n };\n};\n\n// TODO: remove an use one in conversions. Move makeRangeConverters there?\nexport const identity = {\n to: v => v,\n from: v => [true, v],\n};\nexport function makeMinMaxPair(gui, properties, minPropName, maxPropName, options) {\n const { converters: { from } = identity } = options;\n const { min, max } = options;\n const guiMinRange = options.minRange || 0;\n const valueMinRange = from(guiMinRange)[1];\n const minGui = gui\n .add(properties, minPropName, {\n ...options,\n min,\n max: max - guiMinRange,\n })\n .onChange(v => {\n maxGui.setValue(Math.min(max, Math.max(v + valueMinRange, properties[maxPropName])));\n });\n const maxGui = gui\n .add(properties, maxPropName, {\n ...options,\n min: min + guiMinRange,\n max,\n })\n .onChange(v => {\n minGui.setValue(Math.max(min, Math.min(v - valueMinRange, properties[minPropName])));\n });\n return [ minGui, maxGui ];\n}\n\n","import { removeArrayElem } from '../libs/utils.js';\n\nexport default class View {\n domElement: HTMLElement;\n\n #childDestElem: HTMLElement;\n #views: View[] = [];\n\n constructor(elem: HTMLElement) {\n this.domElement = elem;\n this.#childDestElem = elem;\n }\n addElem(elem: HTMLElement) {\n this.#childDestElem.appendChild(elem);\n return elem;\n }\n removeElem(elem: HTMLElement) {\n this.#childDestElem.removeChild(elem);\n return elem;\n }\n pushSubElem(elem: HTMLElement) {\n this.#childDestElem.appendChild(elem);\n this.#childDestElem = elem;\n }\n popSubElem() {\n this.#childDestElem = this.#childDestElem.parentElement!;\n }\n add(view: View) {\n this.#views.push(view);\n this.addElem(view.domElement);\n return view;\n }\n remove(view: View) {\n this.removeElem(view.domElement);\n removeArrayElem(this.#views, view);\n return view;\n }\n pushSubView(view: View) {\n this.pushSubElem(view.domElement);\n }\n popSubView() {\n this.popSubElem();\n }\n setOptions(options: any) {\n for (const view of this.#views) {\n view.setOptions(options);\n }\n }\n updateDisplayIfNeeded(newV: any, ignoreCache?: boolean) {\n for (const view of this.#views) {\n view.updateDisplayIfNeeded(newV, ignoreCache);\n }\n return this;\n }\n $(selector: string) {\n return this.domElement.querySelector(selector);\n }\n}","import { createElem } from '../libs/elem.js';\nimport { removeArrayElem } from '../libs/utils.js';\nimport View from '../views/View.js';\n\nexport default class Controller extends View {\n #changeFns;\n #finishChangeFns;\n #parent;\n\n constructor(className) {\n super(createElem('div', {className: 'muigui-controller'}));\n this.#changeFns = [];\n this.#finishChangeFns = [];\n // we need the specialization to come last so it takes precedence.\n if (className) {\n this.domElement.classList.add(className);\n }\n }\n get parent() {\n return this.#parent;\n }\n setParent(parent) {\n this.#parent = parent;\n this.enable(!this.disabled());\n }\n show(show = true) {\n this.domElement.classList.toggle('muigui-hide', !show);\n this.domElement.classList.toggle('muigui-show', show);\n return this;\n }\n hide() {\n return this.show(false);\n }\n disabled() {\n return !!this.domElement.closest('.muigui-disabled');\n }\n\n enable(enable = true) {\n this.domElement.classList.toggle('muigui-disabled', !enable);\n\n // If disabled we need to set the attribute 'disabled=true' to all\n // input/select/button/textarea's below\n //\n // If enabled we need to set the attribute 'disabled=false' to all below\n // until we hit a disabled controller.\n //\n // ATM the problem is we can find the input/select/button/textarea elements\n // but we can't easily find which controller they belong do.\n // But we don't need to? We can just check up if it or parent has\n // '.muigui-disabled'\n ['input', 'button', 'select', 'textarea'].forEach(tag => {\n this.domElement.querySelectorAll(tag).forEach(elem => {\n const disabled = !!elem.closest('.muigui-disabled');\n elem.disabled = disabled;\n });\n });\n\n return this;\n }\n disable(disable = true) {\n return this.enable(!disable);\n }\n onChange(fn) {\n this.removeChange(fn);\n this.#changeFns.push(fn);\n return this;\n }\n removeChange(fn) {\n removeArrayElem(this.#changeFns, fn);\n return this;\n }\n onFinishChange(fn) {\n this.removeFinishChange(fn);\n this.#finishChangeFns.push(fn);\n return this;\n }\n removeFinishChange(fn) {\n removeArrayElem(this.#finishChangeFns, fn);\n return this;\n }\n #callListeners(fns, newV) {\n for (const fn of fns) {\n fn.call(this, newV);\n }\n }\n emitChange(value, object, property) {\n this.#callListeners(this.#changeFns, value);\n if (this.#parent) {\n if (object === undefined) {\n this.#parent.emitChange(value);\n } else {\n this.#parent.emitChange({\n object,\n property,\n value,\n controller: this,\n });\n }\n }\n }\n emitFinalChange(value, object, property) {\n this.#callListeners(this.#finishChangeFns, value);\n if (this.#parent) {\n if (object === undefined) {\n this.#parent.emitChange(value);\n } else {\n this.#parent.emitFinalChange({\n object,\n property,\n value,\n controller: this,\n });\n }\n }\n }\n updateDisplay() {\n // placeholder. override\n }\n getColors() {\n const toCamelCase = s => s.replace(/-([a-z])/g, (m, m1) => m1.toUpperCase());\n const keys = [\n 'color',\n 'bg-color',\n 'value-color',\n 'value-bg-color',\n 'hover-bg-color',\n 'menu-bg-color',\n 'menu-sep-color',\n 'disabled-color',\n ];\n const div = createElem('div');\n this.domElement.appendChild(div);\n const colors = Object.fromEntries(keys.map(key => {\n div.style.color = `var(--${key})`;\n const s = getComputedStyle(div);\n return [toCamelCase(key), s.color];\n }));\n div.remove();\n return colors;\n }\n}\n","import {\n createElem,\n} from '../libs/elem.js';\nimport { copyExistingProperties } from '../libs/utils.js';\nimport Controller from './Controller.js';\n\nexport default class Button extends Controller {\n #object;\n #property;\n #buttonElem;\n #options = {\n name: '',\n };\n\n constructor(object, property, options = {}) {\n super('muigui-button', '');\n this.#object = object;\n this.#property = property;\n\n this.#buttonElem = this.addElem(\n createElem('button', {\n type: 'button',\n onClick: () => {\n this.#object[this.#property](this);\n },\n }));\n this.setOptions({name: property, ...options});\n }\n name(name) {\n this.#buttonElem.textContent = name;\n }\n setOptions(options) {\n copyExistingProperties(this.#options, options);\n const {name} = this.#options;\n this.#buttonElem.textContent = name;\n }\n}","import { isTypedArray } from '../libs/utils.js';\nimport View from './View.js';\n\nfunction arraysEqual(a, b) {\n if (a.length !== b.length) {\n return false;\n }\n for (let i = 0; i < a.length; ++i) {\n if (a[i] !== b[i]) {\n return false;\n }\n }\n return true;\n}\n\nfunction copyArrayElementsFromTo(src, dst) {\n dst.length = src.length;\n for (let i = 0; i < src.length; ++i) {\n dst[i] = src[i];\n }\n}\n\nexport default class EditView extends View {\n #oldV;\n #updateCheck;\n\n #checkArrayNeedsUpdate(newV) {\n // It's an array, we need to compare all elements\n // Example, vec2, [r,g,b], ...\n const needUpdate = !arraysEqual(newV, this.#oldV);\n if (needUpdate) {\n copyArrayElementsFromTo(newV, this.#oldV);\n }\n return needUpdate;\n }\n\n #checkTypedArrayNeedsUpdate() {\n let once = true;\n return function checkTypedArrayNeedsUpdateImpl(newV) {\n // It's a typedarray, we need to compare all elements\n // Example: Float32Array([r, g, b])\n let needUpdate = once;\n once = false;\n if (!needUpdate) {\n needUpdate = !arraysEqual(newV, this.#oldV);\n }\n return needUpdate;\n };\n }\n\n #checkObjectNeedsUpdate(newV) {\n let needUpdate = false;\n for (const key in newV) {\n if (newV[key] !== this.#oldV[key]) {\n needUpdate = true;\n this.#oldV[key] = newV[key];\n }\n }\n return needUpdate;\n }\n\n #checkValueNeedsUpdate(newV) {\n const needUpdate = newV !== this.#oldV;\n this.#oldV = newV;\n return needUpdate;\n }\n\n #getUpdateCheckForType(newV) {\n if (Array.isArray(newV)) {\n this.#oldV = [];\n return this.#checkArrayNeedsUpdate.bind(this);\n } else if (isTypedArray(newV)) {\n this.#oldV = new newV.constructor(newV);\n return this.#checkTypedArrayNeedsUpdate(this);\n } else if (typeof newV === 'object') {\n this.#oldV = {};\n return this.#checkObjectNeedsUpdate.bind(this);\n } else {\n return this.#checkValueNeedsUpdate.bind(this);\n }\n }\n\n // The point of this is updating DOM elements\n // is slow but if we've called `listen` then\n // every frame we're going to try to update\n // things with the current value so if nothing\n // has changed then skip it.\n updateDisplayIfNeeded(newV, ignoreCache) {\n this.#updateCheck = this.#updateCheck || this.#getUpdateCheckForType(newV);\n // Note: We call #updateCheck first because it updates\n // the cache\n if (this.#updateCheck(newV) || ignoreCache) {\n this.updateDisplay(newV);\n }\n }\n setOptions(/*options*/) {\n // override this\n return this;\n }\n}\n","import { createElem } from '../libs/elem.js';\nimport EditView from './EditView.js';\n\nexport default class CheckboxView extends EditView {\n #checkboxElem;\n constructor(setter, id) {\n const checkboxElem = createElem('input', {\n type: 'checkbox',\n id,\n onInput: () => {\n setter.setValue(checkboxElem.checked);\n },\n onChange: () => {\n setter.setFinalValue(checkboxElem.checked);\n },\n });\n super(createElem('label', {}, [checkboxElem]));\n this.#checkboxElem = checkboxElem;\n }\n updateDisplay(v) {\n this.#checkboxElem.checked = v;\n }\n}\n","import { removeArrayElem } from './utils.js';\n\nconst tasks = [];\nconst tasksToRemove = new Set();\n\nlet requestId;\nlet processing;\n\nfunction removeTasks() {\n if (!tasksToRemove.size) {\n return;\n }\n\n if (processing) {\n queueProcessing();\n return;\n }\n\n tasksToRemove.forEach(task => {\n removeArrayElem(tasks, task);\n });\n tasksToRemove.clear();\n}\n\nfunction processTasks() {\n requestId = undefined;\n processing = true;\n for (const task of tasks) {\n if (!tasksToRemove.has(task)) {\n task();\n }\n }\n processing = false;\n removeTasks();\n queueProcessing();\n}\n\nfunction queueProcessing() {\n if (!requestId && tasks.length) {\n requestId = requestAnimationFrame(processTasks);\n }\n}\n\nexport function addTask(fn) {\n tasks.push(fn);\n queueProcessing();\n}\n\nexport function removeTask(fn) {\n tasksToRemove.set(fn);\n\n const ndx = tasks.indexOf(fn);\n if (ndx >= 0) {\n tasks.splice(ndx, 1);\n }\n}","let id = 0;\n\nexport function makeId() {\n return `muigui-${++id}`;\n}\n","import { createElem } from '../libs/elem.js';\nimport View from './View.js';\n\nexport default class ValueView extends View {\n constructor(className = '') {\n super(createElem('div', {className: 'muigui-value'}));\n if (className) {\n this.domElement.classList.add(className);\n }\n }\n}","import { createElem } from '../libs/elem.js';\nimport { makeId } from '../libs/ids.js';\nimport ValueView from '../views/ValueView.js';\nimport Controller from './Controller.js';\n\nexport default class LabelController extends Controller {\n #id;\n #nameElem;\n\n constructor(className = '', name = '') {\n super('muigui-label-controller');\n this.#id = makeId();\n this.#nameElem = createElem('label', {for: this.#id});\n this.domElement.appendChild(this.#nameElem);\n this.pushSubView(new ValueView(className));\n this.name(name);\n }\n get id() {\n return this.#id;\n }\n name(name) {\n if (this.#nameElem.title === this.#nameElem.textContent) {\n this.#nameElem.title = name;\n }\n this.#nameElem.textContent = name;\n return this;\n }\n tooltip(tip) {\n this.#nameElem.title = tip;\n }\n}\n\n","import {addTask, removeTask} from '../libs/taskrunner.js';\nimport { isTypedArray } from '../libs/utils.js';\nimport LabelController from './LabelController.js';\n\nexport default class ValueController extends LabelController {\n #object;\n #property;\n #initialValue;\n #listening;\n #views;\n #updateFn;\n\n constructor(object, property, className = '') {\n super(className, property);\n this.#object = object;\n this.#property = property;\n this.#initialValue = this.getValue();\n this.#listening = false;\n this.#views = [];\n }\n get initialValue() {\n return this.#initialValue;\n }\n get object() {\n return this.#object;\n }\n get property() {\n return this.#property;\n }\n add(view) {\n this.#views.push(view);\n super.add(view);\n this.updateDisplay();\n return view;\n }\n #setValueImpl(v, ignoreCache) {\n let isDifferent = false;\n if (typeof v === 'object') {\n const dst = this.#object[this.#property];\n // don't replace objects, just their values.\n if (Array.isArray(v) || isTypedArray(v)) {\n for (let i = 0; i < v.length; ++i) {\n isDifferent ||= dst[i] !== v[i];\n dst[i] = v[i];\n }\n } else {\n for (const key of Object.keys(v)) {\n isDifferent ||= dst[key] !== v[key];\n }\n Object.assign(dst, v);\n }\n } else {\n isDifferent = this.#object[this.#property] !== v;\n this.#object[this.#property] = v;\n }\n this.updateDisplay(ignoreCache);\n if (isDifferent) {\n this.emitChange(this.getValue(), this.#object, this.#property);\n }\n return isDifferent;\n }\n setValue(v) {\n this.#setValueImpl(v);\n }\n setFinalValue(v) {\n const isDifferent = this.#setValueImpl(v, true);\n if (isDifferent) {\n this.emitFinalChange(this.getValue(), this.#object, this.#property);\n }\n return this;\n }\n updateDisplay(ignoreCache) {\n const newV = this.getValue();\n for (const view of this.#views) {\n view.updateDisplayIfNeeded(newV, ignoreCache);\n }\n return this;\n }\n setOptions(options) {\n for (const view of this.#views) {\n view.setOptions(options);\n }\n this.updateDisplay();\n return this;\n }\n getValue() {\n return this.#object[this.#property];\n }\n value(v) {\n this.setValue(v);\n return this;\n }\n reset() {\n this.setValue(this.#initialValue);\n return this;\n }\n listen(listen = true) {\n if (!this.#updateFn) {\n this.#updateFn = this.updateDisplay.bind(this);\n }\n if (listen) {\n if (!this.#listening) {\n this.#listening = true;\n addTask(this.#updateFn);\n }\n } else {\n if (this.#listening) {\n this.#listening = false;\n removeTask(this.#updateFn);\n }\n }\n return this;\n }\n}\n\n","import CheckboxView from '../views/CheckboxView.js';\nimport ValueController from './ValueController.js';\n\nexport default class Checkbox extends ValueController {\n constructor(object, property) {\n super(object, property, 'muigui-checkbox');\n const id = this.id;\n this.add(new CheckboxView(this, id));\n this.updateDisplay();\n }\n}","import {\n makeRangeConverters,\n} from './utils.js';\n\nexport const identity = {\n to: v => v,\n from: v => [true, v],\n};\n\n// from: from string to value\n// to: from value to string\nexport const strToNumber = {\n to: v => v.toString(),\n from: v => {\n const newV = parseFloat(v);\n return [!Number.isNaN(newV), newV];\n },\n};\n\nexport const converters = {\n radToDeg: makeRangeConverters({to: [0, 180], from: [0, Math.PI]}),\n};\n","export function createWheelHelper() {\n let wheelAccum = 0;\n return function (e, step, wheelScale = 5) {\n wheelAccum -= e.deltaY * step / wheelScale;\n const wheelSteps = Math.floor(Math.abs(wheelAccum) / step) * Math.sign(wheelAccum);\n const delta = wheelSteps * step;\n wheelAccum -= delta;\n return delta;\n };\n}\n","import { createElem } from '../libs/elem.js';\nimport { strToNumber } from '../libs/conversions.js';\nimport { createWheelHelper } from '../libs/wheel.js';\nimport { clamp, copyExistingProperties, stepify } from '../libs/utils.js';\nimport EditView from './EditView.js';\n\nexport default class NumberView extends EditView {\n #to;\n #from;\n #step;\n #skipUpdate;\n #options = {\n step: 0.01,\n converters: strToNumber,\n min: Number.NEGATIVE_INFINITY,\n max: Number.POSITIVE_INFINITY,\n };\n\n constructor(setter, options) {\n const setValue = setter.setValue.bind(setter);\n const setFinalValue = setter.setFinalValue.bind(setter);\n const wheelHelper = createWheelHelper();\n super(createElem('input', {\n type: 'number',\n onInput: () => {\n this.#handleInput(setValue, true);\n },\n onChange: () => {\n this.#handleInput(setFinalValue, false);\n },\n onWheel: e => {\n e.preventDefault();\n const {min, max, step} = this.#options;\n const delta = wheelHelper(e, step);\n const v = parseFloat(this.domElement.value);\n const newV = clamp(stepify(v + delta, v => v, step), min, max);\n const [valid, outV] = this.#from(newV);\n if (valid) {\n setter.setValue(outV);\n }\n },\n }));\n this.setOptions(options);\n }\n #handleInput(setFn, skipUpdate) {\n const v = parseFloat(this.domElement.value);\n const [valid, newV] = this.#from(v);\n let inRange;\n if (valid && !Number.isNaN(v)) {\n const {min, max} = this.#options;\n inRange = newV >= min && newV <= max;\n this.#skipUpdate = skipUpdate;\n setFn(clamp(newV, min, max));\n }\n this.domElement.classList.toggle('muigui-invalid-value', !valid || !inRange);\n }\n updateDisplay(v) {\n if (!this.#skipUpdate) {\n this.domElement.value = stepify(v, this.#to, this.#step);\n }\n this.#skipUpdate = false;\n }\n setOptions(options) {\n copyExistingProperties(this.#options, options);\n const {\n step,\n converters: {to, from},\n } = this.#options;\n this.#to = to;\n this.#from = from;\n this.#step = step;\n return this;\n }\n}\n","\nimport NumberView from '../views/NumberView.js';\nimport ValueController from './ValueController.js';\n\n// Wanted to name this `Number` but it conflicts with\n// JavaScript `Number`. It most likely wouldn't be\n// an issue? But users might `import {Number} ...` and\n// things would break.\nexport default class TextNumber extends ValueController {\n #textView;\n #step;\n\n constructor(object, property, options = {}) {\n super(object, property, 'muigui-text-number');\n this.#textView = this.add(new NumberView(this, options));\n this.updateDisplay();\n }\n}","import { createElem } from '../libs/elem.js';\nimport EditView from './EditView.js';\n\nexport default class SelectView extends EditView {\n #values;\n\n constructor(setter, keyValues) {\n const values = [];\n super(createElem('select', {\n onChange: () => {\n setter.setFinalValue(this.#values[this.domElement.selectedIndex]);\n },\n }, keyValues.map(([key, value]) => {\n values.push(value);\n return createElem('option', {textContent: key});\n })));\n this.#values = values;\n }\n updateDisplay(v) {\n const ndx = this.#values.indexOf(v);\n this.domElement.selectedIndex = ndx;\n }\n}\n","\n// 4 cases\n// (a) keyValues is array of arrays, each sub array is key value\n// (b) keyValues is array and value is number then keys = array contents, value = index\n// (c) keyValues is array and value is not number, key = array contents, value = array contents\n// (d) keyValues is object then key->value\nexport function convertToKeyValues(keyValues, valueIsNumber) {\n if (Array.isArray(keyValues)) {\n if (Array.isArray(keyValues[0])) {\n // (a) keyValues is array of arrays, each sub array is key value\n return keyValues;\n } else {\n if (valueIsNumber) {\n // (b) keyValues is array and value is number then keys = array contents, value = index\n return keyValues.map((v, ndx) => [v, ndx]);\n } else {\n // (c) keyValues is array and value is not number, key = array contents, value = array contents\n return keyValues.map(v => [v, v]);\n }\n }\n } else {\n // (d)\n return [...Object.entries(keyValues)];\n }\n}\n","import SelectView from '../views/SelectView.js';\nimport ValueController from './ValueController.js';\nimport { convertToKeyValues } from '../libs/key-values.js';\n\nexport default class Select extends ValueController {\n constructor(object, property, options) {\n super(object, property, 'muigui-select');\n const valueIsNumber = typeof this.getValue() === 'number';\n const {keyValues: keyValuesInput} = options;\n const keyValues = convertToKeyValues(keyValuesInput, valueIsNumber);\n this.add(new SelectView(this, keyValues));\n this.updateDisplay();\n }\n}","import { createElem } from '../libs/elem.js';\nimport { identity } from '../libs/conversions.js';\nimport { clamp, copyExistingProperties, stepify } from '../libs/utils.js';\nimport { createWheelHelper } from '../libs/wheel.js';\nimport EditView from './EditView.js';\n\nexport default class RangeView extends EditView {\n #to;\n #from;\n #step;\n #skipUpdate;\n #options = {\n step: 0.01,\n min: 0,\n max: 1,\n converters: identity,\n };\n\n constructor(setter, options) {\n const wheelHelper = createWheelHelper();\n super(createElem('input', {\n type: 'range',\n onInput: () => {\n this.#skipUpdate = true;\n const {min, max, step} = this.#options;\n const v = parseFloat(this.domElement.value);\n const newV = clamp(stepify(v, v => v, step), min, max);\n const [valid, validV] = this.#from(newV);\n if (valid) {\n setter.setValue(validV);\n }\n },\n onChange: () => {\n this.#skipUpdate = true;\n const {min, max, step} = this.#options;\n const v = parseFloat(this.domElement.value);\n const newV = clamp(stepify(v, v => v, step), min, max);\n const [valid, validV] = this.#from(newV);\n if (valid) {\n setter.setFinalValue(validV);\n }\n },\n onWheel: e => {\n e.preventDefault();\n const [valid, v] = this.#from(parseFloat(this.domElement.value));\n if (!valid) {\n return;\n }\n const {min, max, step} = this.#options;\n const delta = wheelHelper(e, step);\n const newV = clamp(stepify(v + delta, v => v, step), min, max);\n setter.setValue(newV);\n },\n }));\n this.setOptions(options);\n }\n updateDisplay(v) {\n if (!this.#skipUpdate) {\n this.domElement.value = stepify(v, this.#to, this.#step);\n }\n this.#skipUpdate = false;\n }\n setOptions(options) {\n copyExistingProperties(this.#options, options);\n const {\n step,\n min,\n max,\n converters: {to, from},\n } = this.#options;\n this.#to = to;\n this.#from = from;\n this.#step = step;\n this.domElement.step = step;\n this.domElement.min = min;\n this.domElement.max = max;\n return this;\n }\n}","import ValueController from './ValueController.js';\nimport NumberView from '../views/NumberView.js';\nimport RangeView from '../views/RangeView.js';\n\nexport default class Range extends ValueController {\n constructor(object, property, options) {\n super(object, property, 'muigui-range');\n this.add(new RangeView(this, options));\n this.add(new NumberView(this, options));\n }\n}\n","import { createElem } from '../libs/elem.js';\nimport { identity } from '../libs/conversions.js';\nimport EditView from './EditView.js';\nimport { copyExistingProperties } from '../libs/utils.js';\n\nexport default class TextView extends EditView {\n #to;\n #from;\n #skipUpdate;\n #options = {\n converters: identity,\n };\n\n constructor(setter, options) {\n const setValue = setter.setValue.bind(setter);\n const setFinalValue = setter.setFinalValue.bind(setter);\n super(createElem('input', {\n type: 'text',\n onInput: () => {\n this.#handleInput(setValue, true);\n },\n onChange: () => {\n this.#handleInput(setFinalValue, false);\n },\n }));\n this.setOptions(options);\n }\n #handleInput(setFn, skipUpdate) {\n const [valid, newV] = this.#from(this.domElement.value);\n if (valid) {\n this.#skipUpdate = skipUpdate;\n setFn(newV);\n }\n this.domElement.style.color = valid ? '' : 'var(--invalid-color)';\n\n }\n updateDisplay(v) {\n if (!this.#skipUpdate) {\n this.domElement.value = this.#to(v);\n this.domElement.style.color = '';\n }\n this.#skipUpdate = false;\n }\n setOptions(options) {\n copyExistingProperties(this.#options, options);\n const {\n converters: {to, from},\n } = this.#options;\n this.#to = to;\n this.#from = from;\n return this;\n }\n}\n","import TextView from '../views/TextView.js';\nimport ValueController from './ValueController.js';\n\nexport default class Text extends ValueController {\n constructor(object, property) {\n super(object, property, 'muigui-text');\n this.add(new TextView(this));\n this.updateDisplay();\n }\n}","import Button from './Button.js';\nimport Checkbox from './Checkbox.js';\nimport TextNumber from './TextNumber.js';\nimport Select from './Select.js';\nimport Range from './Range.js';\nimport Text from './Text.js';\n\n// const isConversion = o => typeof o.to === 'function' && typeof o.from === 'function';\n\n/**\n * possible inputs\n * add(o, p, min: number, max: number)\n * add(o, p, min: number, max: number, step: number)\n * add(o, p, array: [value])\n * add(o, p, array: [[key, value]])\n *\n * @param {*} object\n * @param {string} property\n * @param {...any} args\n * @returns {Controller}\n */\nexport function createController(object, property, ...args) {\n const [arg1] = args;\n if (Array.isArray(arg1)) {\n return new Select(object, property, {keyValues: arg1});\n }\n if (arg1 && arg1.keyValues) {\n return new Select(object, property, {keyValues: arg1.keyValues});\n }\n\n const t = typeof object[property];\n switch (t) {\n case 'number':\n if (typeof args[0] === 'number' && typeof args[1] === 'number') {\n const min = args[0];\n const max = args[1];\n const step = args[2];\n return new Range(object, property, {min, max, ...(step && {step})});\n }\n return args.length === 0\n ? new TextNumber(object, property, ...args)\n : new Range(object, property, ...args);\n case 'boolean':\n return new Checkbox(object, property, ...args);\n case 'function':\n return new Button(object, property, ...args);\n case 'string':\n return new Text(object, property, ...args);\n case 'undefined':\n throw new Error(`no property named ${property}`);\n default:\n throw new Error(`unhandled type ${t} for property ${property}`);\n }\n}","const clamp = (v, min, max) => Math.max(min, Math.min(max, v));\nconst lerp = (a, b, t) => a + (b - a) * t;\nconst fract = v => v >= 0 ? v % 1 : 1 - (v % 1);\n\nconst f0 = v => +v.toFixed(0); // converts to string (eg 1.2 => \"1\"), then converts back to number (eg, \"1.200\" => 1.2)\nconst f3 = v => +v.toFixed(3); // converts to string (eg 1.2 => \"1.200\"), then converts back to number (eg, \"1.200\" => 1.2)\n\nconst hexToUint32RGB = v => (parseInt(v.substring(1, 3), 16) << 16) |\n (parseInt(v.substring(3, 5), 16) << 8 ) |\n (parseInt(v.substring(5, 7), 16) );\nconst uint32RGBToHex = v => `#${(Math.round(v)).toString(16).padStart(6, '0')}`;\nconst hexToUint32RGBA = v => (parseInt(v.substring(1, 3), 16) * 2 ** 24) +\n (parseInt(v.substring(3, 5), 16) * 2 ** 16) +\n (parseInt(v.substring(5, 7), 16) * 2 ** 8) +\n (parseInt(v.substring(7, 9), 16) );\nconst uint32RGBAToHex = v => `#${(Math.round(v)).toString(16).padStart(8, '0')}`;\n\nexport const hexToUint8RGB = v => [\n parseInt(v.substring(1, 3), 16),\n parseInt(v.substring(3, 5), 16),\n parseInt(v.substring(5, 7), 16),\n];\nexport const uint8RGBToHex = v => `#${Array.from(v).map(v => v.toString(16).padStart(2, '0')).join('')}`;\n\nexport const hexToUint8RGBA = v => [\n parseInt(v.substring(1, 3), 16),\n parseInt(v.substring(3, 5), 16),\n parseInt(v.substring(5, 7), 16),\n parseInt(v.substring(7, 9), 16),\n];\nexport const uint8RGBAToHex = v => `#${Array.from(v).map(v => v.toString(16).padStart(2, '0')).join('')}`;\n\nexport const hexToFloatRGB = v => hexToUint8RGB(v).map(v => f3(v / 255));\nexport const floatRGBToHex = v => uint8RGBToHex(Array.from(v).map(v => Math.round(clamp(v * 255, 0, 255))));\n\nexport const hexToFloatRGBA = v => hexToUint8RGBA(v).map(v => f3(v / 255));\nexport const floatRGBAToHex = v => uint8RGBAToHex(Array.from(v).map(v => Math.round(clamp(v * 255, 0, 255))));\n\nconst scaleAndClamp = v => clamp(Math.round(v * 255), 0, 255).toString(16).padStart(2, '0');\n\nconst hexToObjectRGB = v => ({\n r: parseInt(v.substring(1, 3), 16) / 255,\n g: parseInt(v.substring(3, 5), 16) / 255,\n b: parseInt(v.substring(5, 7), 16) / 255,\n});\nconst objectRGBToHex = v => `#${scaleAndClamp(v.r)}${scaleAndClamp(v.g)}${scaleAndClamp(v.b)}`;\nconst hexToObjectRGBA = v => ({\n r: parseInt(v.substring(1, 3), 16) / 255,\n g: parseInt(v.substring(3, 5), 16) / 255,\n b: parseInt(v.substring(5, 7), 16) / 255,\n a: parseInt(v.substring(7, 9), 16) / 255,\n});\nconst objectRGBAToHex = v => `#${scaleAndClamp(v.r)}${scaleAndClamp(v.g)}${scaleAndClamp(v.b)}${scaleAndClamp(v.a)}`;\n\nconst hexToCssRGB = v => `rgb(${hexToUint8RGB(v).join(', ')})`;\nconst cssRGBRegex = /^\\s*rgb\\(\\s*(\\d+)\\s*,\\s*(\\d+)\\s*,\\s*(\\d+)\\s*\\)\\s*$/;\nconst cssRGBToHex = v => {\n const m = cssRGBRegex.exec(v);\n return uint8RGBToHex([m[1], m[2], m[3]].map(v => parseInt(v)));\n};\nconst hexToCssRGBA = v => `rgba(${hexToUint8RGBA(v).map((v, i) => i === 3 ? v / 255 : v).join(', ')})`;\nconst cssRGBARegex = /^\\s*rgba\\(\\s*(\\d+)\\s*,\\s*(\\d+)\\s*,\\s*(\\d+)\\s*,\\s*(\\d+\\.\\d+|\\d+)\\s*\\)\\s*$/;\nconst cssRGBAToHex = v => {\n const m = cssRGBARegex.exec(v);\n return uint8RGBAToHex([m[1], m[2], m[3], m[4]].map((v, i) => i === 3 ? (parseFloat(v) * 255 | 0) : parseInt(v)));\n};\n\nconst hexToCssHSL = v => {\n const hsl = rgbUint8ToHsl(hexToUint8RGB(v)).map(v => f0(v));\n return `hsl(${hsl[0]}, ${hsl[1]}%, ${hsl[2]}%)`;\n};\nconst hexToCssHSLA = v => {\n const hsla = rgbaUint8ToHsla(hexToUint8RGBA(v)).map((v, i) => i === 3 ? f3(v) : f0(v));\n return `hsl(${hsla[0]} ${hsla[1]}% ${hsla[2]}% / ${hsla[3]})`;\n};\nconst cssHSLRegex = /^\\s*hsl\\(\\s*(\\d+)(?:deg|)\\s*(?:,|)\\s*(\\d+)%\\s*(?:,|)\\s*(\\d+)%\\s*\\)\\s*$/;\nconst cssHSLARegex = /^\\s*hsl\\(\\s*(\\d+)(?:deg|)\\s*(?:,|)\\s*(\\d+)%\\s*(?:,|)\\s*(\\d+)%\\s*\\/\\s*(\\d+\\.\\d+|\\d+)\\s*\\)\\s*$/;\n\nconst hex3DigitTo6Digit = v => `${v[0]}${v[0]}${v[1]}${v[1]}${v[2]}${v[2]}`;\nconst cssHSLToHex = v => {\n const m = cssHSLRegex.exec(v);\n const rgb = hslToRgbUint8([m[1], m[2], m[3]].map(v => parseFloat(v)));\n return uint8RGBToHex(rgb);\n};\nconst cssHSLAToHex = v => {\n const m = cssHSLARegex.exec(v);\n const rgba = hslaToRgbaUint8([m[1], m[2], m[3], m[4]].map(v => parseFloat(v)));\n return uint8RGBAToHex(rgba);\n};\n\nconst euclideanModulo = (v, n) => ((v % n) + n) % n;\n\nexport function hslToRgbUint8([h, s, l]) {\n h = euclideanModulo(h, 360);\n s = clamp(s / 100, 0, 1);\n l = clamp(l / 100, 0, 1);\n\n const a = s * Math.min(l, 1 - l);\n\n function f(n) {\n const k = (n + h / 30) % 12;\n return l - a * Math.max(-1, Math.min(k - 3, 9 - k, 1));\n }\n\n return [f(0), f(8), f(4)].map(v => Math.round(v * 255));\n}\n\nexport function hslaToRgbaUint8([h, s, l, a]) {\n const rgb = hslToRgbUint8([h, s, l]);\n return [...rgb, a * 255 | 0];\n}\n\nexport function rgbFloatToHsl01([r, g, b]) {\n const max = Math.max(r, g, b);\n const min = Math.min(r, g, b);\n const l = (min + max) * 0.5;\n const d = max - min;\n let h = 0;\n let s = 0;\n\n if (d !== 0) {\n s = (l === 0 || l === 1)\n ? 0\n : (max - l) / Math.min(l, 1 - l);\n\n switch (max) {\n case r: h = (g - b) / d + (g < b ? 6 : 0); break;\n case g: h = (b - r) / d + 2; break;\n case b: h = (r - g) / d + 4;\n }\n }\n\n return [h / 6, s, l];\n}\n\nexport function rgbaFloatToHsla01([r, g, b, a]) {\n const hsl = rgbFloatToHsl01([r, g, b]);\n return [...hsl, a];\n}\n\nexport const rgbUint8ToHsl = (rgb) => {\n const [h, s, l] = rgbFloatToHsl01(rgb.map(v => v / 255));\n return [h * 360, s * 100, l * 100];\n};\n\nexport const rgbaUint8ToHsla = (rgba) => {\n const [h, s, l, a] = rgbaFloatToHsla01(rgba.map(v => v / 255));\n return [h * 360, s * 100, l * 100, a];\n};\n\nexport function hsv01ToRGBFloat([hue, sat, val]) {\n sat = clamp(sat, 0, 1);\n val = clamp(val, 0, 1);\n return [hue, hue + 2 / 3, hue + 1 / 3].map(\n v => lerp(1, clamp(Math.abs(fract(v) * 6 - 3.0) - 1, 0, 1), sat) * val\n );\n}\n\nexport function hsva01ToRGBAFloat([hue, sat, val, alpha]) {\n const rgb = hsv01ToRGBFloat([hue, sat, val]);\n return [...rgb, alpha];\n}\n\nconst round3 = v => Math.round(v * 1000) / 1000;\n\nexport function rgbFloatToHSV01([r, g, b]) {\n const p = b > g\n ? [b, g, -1, 2 / 3]\n : [g, b, 0, -1 / 3];\n const q = p[0] > r\n ? [p[0], p[1], p[3], r]\n : [r, p[1], p[2], p[0]];\n const d = q[0] - Math.min(q[3], q[1]);\n return [\n Math.abs(q[2] + (q[3] - q[1]) / (6 * d + Number.EPSILON)),\n d / (q[0] + Number.EPSILON),\n q[0],\n ].map(round3);\n}\n\nexport function rgbaFloatToHSVA01([r, g, b, a]) {\n const hsv = rgbFloatToHSV01([r, g, b]);\n return [...hsv, a];\n}\n\n// window.hsv01ToRGBFloat = hsv01ToRGBFloat;\n// window.rgbFloatToHSV01 = rgbFloatToHSV01;\n\n// Yea, meh!\nexport const hasAlpha = format => format.endsWith('a') || format.startsWith('hex8');\n\nconst cssStringFormats = [\n { re: /^#(?:[0-9a-f]){6}$/i, format: 'hex6' },\n { re: /^(?:[0-9a-f]){6}$/i, format: 'hex6-no-hash' },\n { re: /^#(?:[0-9a-f]){8}$/i, format: 'hex8' },\n { re: /^(?:[0-9a-f]){8}$/i, format: 'hex8-no-hash' },\n { re: /^#(?:[0-9a-f]){3}$/i, format: 'hex3' },\n { re: /^(?:[0-9a-f]){3}$/i, format: 'hex3-no-hash' },\n { re: cssRGBRegex, format: 'css-rgb' },\n { re: cssHSLRegex, format: 'css-hsl' },\n { re: cssRGBARegex, format: 'css-rgba' },\n { re: cssHSLARegex, format: 'css-hsla' },\n];\n\nfunction guessStringColorFormat(v) {\n for (const formatInfo of cssStringFormats) {\n if (formatInfo.re.test(v)) {\n return formatInfo;\n }\n }\n return undefined;\n}\n\nexport function guessFormat(v) {\n switch (typeof v) {\n case 'number':\n console.warn('can not reliably guess format based on a number. You should pass in a format like {format: \"uint32-rgb\"} or {format: \"uint32-rgb\"}');\n return v <= 0xFFFFFF ? 'uint32-rgb' : 'uint32-rgba';\n case 'string': {\n const formatInfo = guessStringColorFormat(v.trim());\n if (formatInfo) {\n return formatInfo.format;\n }\n break;\n }\n case 'object':\n if (v instanceof Uint8Array || v instanceof Uint8ClampedArray) {\n if (v.length === 3) {\n return 'uint8-rgb';\n } else if (v.length === 4) {\n return 'uint8-rgba';\n }\n } else if (v instanceof Float32Array) {\n if (v.length === 3) {\n return 'float-rgb';\n } else if (v.length === 4) {\n return 'float-rgba';\n }\n } else if (Array.isArray(v)) {\n if (v.length === 3) {\n return 'float-rgb';\n } else if (v.length === 4) {\n return 'float-rgba';\n }\n } else {\n if ('r' in v && 'g' in v && 'b' in v) {\n if ('a' in v) {\n return 'object-rgba';\n } else {\n return 'object-rgb';\n }\n }\n }\n }\n throw new Error(`unknown color format: ${v}`);\n}\n\nfunction fixHex6(v) {\n return v.trim(v);\n //const formatInfo = guessStringColorFormat(v.trim());\n //const fix = formatInfo ? formatInfo.fix : v => v;\n //return fix(v.trim());\n}\n\nfunction fixHex8(v) {\n return v.trim(v);\n //const formatInfo = guessStringColorFormat(v.trim());\n //const fix = formatInfo ? formatInfo.fix : v => v;\n //return fix(v.trim());\n}\n\nfunction hex6ToHex3(hex6) {\n return (hex6[1] === hex6[2] &&\n hex6[3] === hex6[4] &&\n hex6[5] === hex6[6])\n ? `#${hex6[1]}${hex6[3]}${hex6[5]}`\n : hex6;\n}\n\nconst hex3RE = /^(#|)([0-9a-f]{3})$/i;\nfunction hex3ToHex6(hex3) {\n const m = hex3RE.exec(hex3);\n if (m) {\n const [, , m2] = m;\n return `#${hex3DigitTo6Digit(m2)}`;\n }\n return hex3;\n}\n\nfunction fixHex3(v) {\n return hex6ToHex3(fixHex6(v));\n}\n\nconst strToRGBObject = (s) => {\n try {\n const json = s.replace(/([a-z])/g, '\"$1\"');\n const rgb = JSON.parse(json);\n if (Number.isNaN(rgb.r) || Number.isNaN(rgb.g) || Number.isNaN(rgb.b)) {\n throw new Error('not {r, g, b}');\n }\n return [true, rgb];\n } catch (e) {\n return [false];\n }\n};\n\nconst strToRGBAObject = (s) => {\n try {\n const json = s.replace(/([a-z])/g, '\"$1\"');\n const rgba = JSON.parse(json);\n if (Number.isNaN(rgba.r) || Number.isNaN(rgba.g) || Number.isNaN(rgba.b) || Number.isNaN(rgba.a)) {\n throw new Error('not {r, g, b, a}');\n }\n return [true, rgba];\n } catch (e) {\n return [false];\n }\n};\n\nconst strToCssRGB = s => {\n const m = cssRGBRegex.exec(s);\n if (!m) {\n return [false];\n }\n const v = [m[1], m[2], m[3]].map(v => parseInt(v));\n const outOfRange = v.find(v => v > 255);\n return [!outOfRange, `rgb(${v.join(', ')})`];\n};\n\nconst strToCssRGBA = s => {\n const m = cssRGBARegex.exec(s);\n if (!m) {\n return [false];\n }\n const v = [m[1], m[2], m[3], m[4]].map((v, i) => i === 3 ? parseFloat(v) : parseInt(v));\n const outOfRange = v.find(v => v > 255);\n return [!outOfRange, `rgba(${v.join(', ')})`];\n};\n\nconst strToCssHSL = s => {\n const m = cssHSLRegex.exec(s);\n if (!m) {\n return [false];\n }\n const v = [m[1], m[2], m[3]].map(v => parseFloat(v));\n const outOfRange = v.find(v => Number.isNaN(v));\n return [!outOfRange, `hsl(${v[0]}, ${v[1]}%, ${v[2]}%)`];\n};\n\nconst strToCssHSLA = s => {\n const m = cssHSLARegex.exec(s);\n if (!m) {\n return [false];\n }\n const v = [m[1], m[2], m[3], m[4]].map(v => parseFloat(v));\n const outOfRange = v.find(v => Number.isNaN(v));\n return [!outOfRange, `hsl(${v[0]} ${v[1]}% ${v[2]}% / ${v[3]})`];\n};\n\nconst rgbObjectToStr = rgb => {\n return `{r:${f3(rgb.r)}, g:${f3(rgb.g)}, b:${f3(rgb.b)}}`;\n};\nconst rgbaObjectToStr = rgba => {\n return `{r:${f3(rgba.r)}, g:${f3(rgba.g)}, b:${f3(rgba.b)}}, a:${f3(rgba.a)}}`;\n};\n\nconst strTo3IntsRE = /^\\s*(\\d+)\\s*,\\s*(\\d+)\\s*,\\s*(\\d+)\\s*$/;\nconst strTo3Ints = s => {\n const m = strTo3IntsRE.exec(s);\n if (!m) {\n return [false];\n }\n const v = [m[1], m[2], m[3]].map(v => parseInt(v));\n const outOfRange = v.find(v => v > 255);\n return [!outOfRange, v];\n};\n\nconst strTo4IntsRE = /^\\s*(\\d+)\\s*,\\s*(\\d+)\\s*,\\s*(\\d+)\\s*$/;\nconst strTo4Ints = s => {\n const m = strTo4IntsRE.exec(s);\n if (!m) {\n return [false];\n }\n const v = [m[1], m[2], m[3], m[4]].map(v => parseInt(v));\n const outOfRange = v.find(v => v > 255);\n return [!outOfRange, v];\n};\n\nconst strTo3Floats = s => {\n const numbers = s.split(',').map(s => s.trim());\n const v = numbers.map(v => parseFloat(v));\n if (v.length !== 3) {\n return [false];\n }\n // Note: using isNaN not Number.isNaN\n const badNdx = numbers.findIndex(v => isNaN(v));\n return [badNdx < 0, v.map(v => f3(v))];\n};\n\nconst strTo4Floats = s => {\n const numbers = s.split(',').map(s => s.trim());\n const v = numbers.map(v => parseFloat(v));\n if (v.length !== 4) {\n return [false];\n }\n // Note: using isNaN not Number.isNaN\n const badNdx = numbers.findIndex(v => isNaN(v));\n return [badNdx < 0, v.map(v => f3(v))];\n};\n\nconst strToUint32RGBRegex = /^\\s*(?:0x){0,1}([0-9a-z]{1,6})\\s*$/i;\nconst strToUint32RGB = s => {\n const m = strToUint32RGBRegex.exec(s);\n if (!m) {\n return [false];\n }\n return [true, parseInt(m[1], 16)];\n};\n\nconst strToUint32RGBARegex = /^\\s*(?:0x){0,1}([0-9a-z]{1,8})\\s*$/i;\nconst strToUint32RGBA = s => {\n const m = strToUint32RGBARegex.exec(s);\n if (!m) {\n return [false];\n }\n return [true, parseInt(m[1], 16)];\n};\n\nconst hex6RE = /^\\s*#[a-f0-9]{6}\\s*$|^\\s*#[a-f0-9]{3}\\s*$/i;\nconst hexNoHash6RE = /^\\s*[a-f0-9]{6}\\s*$/i;\nconst hex8RE = /^\\s*#[a-f0-9]{8}\\s*$/i;\nconst hexNoHash8RE = /^\\s*[a-f0-9]{8}\\s*$/i;\n\n// For each format converter\n//\n// fromHex/toHex convert from/to '#RRGGBB'\n//\n// fromHex converts from the string '#RRBBGG' to the format\n// (eg: for uint32-rgb, '#123456' becomes 0x123456)\n//\n// toHex converts from the format to '#RRGGBB'\n// (eg: for uint8-rgb, [16, 33, 50] becomes '#102132')\n//\n//\n// fromStr/toStr convert from/to what's in the input[type=text] element\n//\n// toStr converts from the format to its string representation\n// (eg, for object-rgb, {r: 1, g: 0.5, b:0} becomes \"{r: 1, g: 0.5, b:0}\")\n// ^object ^string\n//\n// fromStr converts its string representation to its format\n// (eg, for object-rgb) \"{r: 1, g: 0.5, b:0}\" becomes {r: 1, g: 0.5, b:0})\n// ^string ^object\n// fromString returns an array which is [valid, v]\n// where valid is true if the string was a valid and v is the converted\n// format if v is true.\n//\n// Note: toStr should convert to \"ideal\" form (whatever that is).\n// (eg, for css-rgb\n// \"{ r: 0.10000, g: 001, b: 0}\" becomes \"{r: 0.1, g: 1, b: 0}\"\n// notice that css-rgb is a string to a string\n// )\nexport const colorFormatConverters = {\n 'hex6': {\n color: {\n from: v => [true, v],\n to: fixHex6,\n },\n text: {\n from: v => [hex6RE.test(v), v.trim()],\n to: v => v,\n },\n },\n 'hex8': {\n color: {\n from: v => [true, v],\n to: fixHex8,\n },\n text: {\n from: v => [hex8RE.test(v), v.trim()],\n to: v => v,\n },\n },\n 'hex3': {\n color: {\n from: v => [true, fixHex3(v)],\n to: hex3ToHex6,\n },\n text: {\n from: v => [hex6RE.test(v), hex6ToHex3(v.trim())],\n to: v => v,\n },\n },\n 'hex6-no-hash': {\n color: {\n from: v => [true, v.substring(1)],\n to: v => `#${fixHex6(v)}`,\n },\n text: {\n from: v => [hexNoHash6RE.test(v), v.trim()],\n to: v => v,\n },\n },\n 'hex8-no-hash': {\n color: {\n from: v => [true, v.substring(1)],\n to: v => `#${fixHex8(v)}`,\n },\n text: {\n from: v => [hexNoHash8RE.test(v), v.trim()],\n to: v => v,\n },\n },\n 'hex3-no-hash': {\n color: {\n from: v => [true, fixHex3(v).substring(1)],\n to: hex3ToHex6,\n },\n text: {\n from: v => [hexNoHash6RE.test(v), hex6ToHex3(v.trim())],\n to: v => v,\n },\n },\n 'uint32-rgb': {\n color: {\n from: v => [true, hexToUint32RGB(v)],\n to: uint32RGBToHex,\n },\n text: {\n from: v => strToUint32RGB(v),\n to: v => `0x${v.toString(16).padStart(6, '0')}`,\n },\n },\n 'uint32-rgba': {\n color: {\n from: v => [true, hexToUint32RGBA(v)],\n to: uint32RGBAToHex,\n },\n text: {\n from: v => strToUint32RGBA(v),\n to: v => `0x${v.toString(16).padStart(8, '0')}`,\n },\n },\n 'uint8-rgb': {\n color: {\n from: v => [true, hexToUint8RGB(v)],\n to: uint8RGBToHex,\n },\n text: {\n from: strTo3Ints,\n to: v => v.join(', '),\n },\n },\n 'uint8-rgba': {\n color: {\n from: v => [true, hexToUint8RGBA(v)],\n to: uint8RGBAToHex,\n },\n text: {\n from: strTo4Ints,\n to: v => v.join(', '),\n },\n },\n 'float-rgb': {\n color: {\n from: v => [true, hexToFloatRGB(v)],\n to: floatRGBToHex,\n },\n text: {\n from: strTo3Floats,\n // need Array.from because map of Float32Array makes a Float32Array\n to: v => Array.from(v).map(v => f3(v)).join(', '),\n },\n },\n 'float-rgba': {\n color: {\n from: v => [true, hexToFloatRGBA(v)],\n to: floatRGBAToHex,\n },\n text: {\n from: strTo4Floats,\n // need Array.from because map of Float32Array makes a Float32Array\n to: v => Array.from(v).map(v => f3(v)).join(', '),\n },\n },\n 'float-hsv': {\n color: {\n from: v => [true, rgbFloatToHSV01(hexToFloatRGB(v))],\n to: v => hsv01ToRGBFloat(floatRGBToHex(v)),\n },\n text: {\n from: strTo3Floats,\n // need Array.from because map of Float32Array makes a Float32Array\n to: v => Array.from(v).map(v => f3(v)).join(', '),\n },\n },\n 'float-hsva': {\n color: {\n from: v => [true, rgbaFloatToHSVA01(hexToFloatRGB(v))],\n to: v => hsva01ToRGBAFloat(floatRGBToHex(v)),\n },\n text: {\n from: strTo4Floats,\n // need Array.from because map of Float32Array makes a Float32Array\n to: v => Array.from(v).map(v => f3(v)).join(', '),\n },\n },\n //'float-hsl': {\n // color: {\n // from: v => [true, rgbFloatToHsl01(hexToFloatRGB(v))],\n // to: v => hsl01ToRGBFloat(floatRGBToHex(v)),\n // },\n // text: {\n // from: strTo3Floats,\n // // need Array.from because map of Float32Array makes a Float32Array\n // to: v => Array.from(v).map(v => f3(v)).join(', '),\n // },\n //},\n //'float-hsla': {\n // color: {\n // from: v => [true, hexToFloatRGBA(v)],\n // to: floatRGBAToHex,\n // },\n // text: {\n // from: strTo4Floats,\n // // need Array.from because map of Float32Array makes a Float32Array\n // to: v => Array.from(v).map(v => f3(v)).join(', '),\n // },\n //},\n 'object-rgb': {\n color: {\n from: v => [true, hexToObjectRGB(v)],\n to: objectRGBToHex,\n },\n text: {\n from: strToRGBObject,\n to: rgbObjectToStr,\n },\n },\n 'object-rgba': {\n color: {\n from: v => [true, hexToObjectRGBA(v)],\n to: objectRGBAToHex,\n },\n text: {\n from: strToRGBAObject,\n to: rgbaObjectToStr,\n },\n },\n 'css-rgb': {\n color: {\n from: v => [true, hexToCssRGB(v)],\n to: cssRGBToHex,\n },\n text: {\n from: strToCssRGB,\n to: v => strToCssRGB(v)[1],\n },\n },\n 'css-rgba': {\n color: {\n from: v => [true, hexToCssRGBA(v)],\n to: cssRGBAToHex,\n },\n text: {\n from: strToCssRGBA,\n to: v => strToCssRGBA(v)[1],\n },\n },\n 'css-hsl': {\n color: {\n from: v => [true, hexToCssHSL(v)],\n to: cssHSLToHex,\n },\n text: {\n from: strToCssHSL,\n to: v => strToCssHSL(v)[1],\n },\n },\n 'css-hsla': {\n color: {\n from: v => [true, hexToCssHSLA(v)],\n to: cssHSLAToHex,\n },\n text: {\n from: strToCssHSLA,\n to: v => strToCssHSLA(v)[1],\n },\n },\n};","import { createElem } from '../libs/elem.js';\nimport View from './View.js';\n\nexport default class ElementView extends View {\n constructor(tag, className) {\n super(createElem(tag, {className}));\n }\n}","import ElementView from '../views/ElementView.js';\nimport LabelController from './LabelController.js';\n\n// TODO: remove this? Should just be user side\nexport default class Canvas extends LabelController {\n #canvasElem;\n\n constructor(name) {\n super('muigui-canvas', name);\n this.#canvasElem = this.add(\n new ElementView('canvas', 'muigui-canvas'),\n ).domElement;\n }\n get canvas() {\n return this.#canvasElem;\n }\n}","import { createElem } from '../libs/elem.js';\nimport { identity } from '../libs/conversions.js';\nimport EditView from './EditView.js';\nimport { copyExistingProperties } from '../libs/utils.js';\n\nexport default class ColorView extends EditView {\n #to;\n #from;\n #colorElem;\n #skipUpdate;\n #options = {\n converters: identity,\n };\n\n constructor(setter, options) {\n const colorElem = createElem('input', {\n type: 'color',\n onInput: () => {\n const [valid, newV] = this.#from(colorElem.value);\n if (valid) {\n this.#skipUpdate = true;\n setter.setValue(newV);\n }\n },\n onChange: () => {\n const [valid, newV] = this.#from(colorElem.value);\n if (valid) {\n this.#skipUpdate = true;\n setter.setFinalValue(newV);\n }\n },\n });\n super(createElem('div', {}, [colorElem]));\n this.setOptions(options);\n this.#colorElem = colorElem;\n }\n updateDisplay(v) {\n if (!this.#skipUpdate) {\n this.#colorElem.value = this.#to(v);\n }\n this.#skipUpdate = false;\n }\n setOptions(options) {\n copyExistingProperties(this.#options, options);\n const {converters: {to, from}} = this.#options;\n this.#to = to;\n this.#from = from;\n return this;\n }\n}\n","import {\n colorFormatConverters,\n guessFormat,\n} from '../libs/color-utils.js';\nimport ValueController from './ValueController.js';\nimport TextView from '../views/TextView.js';\nimport ColorView from '../views/ColorView.js';\n\nexport default class Color extends ValueController {\n #colorView;\n #textView;\n\n constructor(object, property, options = {}) {\n super(object, property, 'muigui-color');\n const format = options.format || guessFormat(this.getValue());\n const {color, text} = colorFormatConverters[format];\n this.#colorView = this.add(new ColorView(this, {converters: color}));\n this.#textView = this.add(new TextView(this, {converters: text}));\n this.updateDisplay();\n }\n setOptions(options) {\n const {format} = options;\n if (format) {\n const {color, text} = colorFormatConverters[format];\n this.#colorView.setOptions({converters: color});\n this.#textView.setOptions({converters: text});\n }\n super.setOptions(options);\n return this;\n }\n}","import Controller from './Controller.js';\n\n// This feels like it should be something else like\n// gui.addController({className: 'muigui-divider')};\nexport default class Divider extends Controller {\n constructor() {\n super('muigui-divider');\n }\n}","import Controller from './Controller.js';\n\nexport default class Container extends Controller {\n #controllers;\n #childDestController;\n\n constructor(className) {\n super(className);\n this.#controllers = [];\n this.#childDestController = this;\n }\n get children() {\n return this.#controllers; // should we return a copy?\n }\n get controllers() {\n return this.#controllers.filter(c => !(c instanceof Container));\n }\n get folders() {\n return this.#controllers.filter(c => c instanceof Container);\n }\n reset(recursive = true) {\n for (const controller of this.#controllers) {\n if (!(controller instanceof Container) || recursive) {\n controller.reset(recursive);\n }\n }\n return this;\n }\n updateDisplay() {\n for (const controller of this.#controllers) {\n controller.updateDisplay();\n }\n return this;\n }\n remove(controller) {\n const ndx = this.#controllers.indexOf(controller);\n if (ndx >= 0) {\n const c = this.#controllers.splice(ndx, 1);\n const c0 = c[0];\n const elem = c0.domElement;\n elem.remove();\n c0.setParent(null);\n }\n return this;\n }\n #addControllerImpl(controller) {\n this.domElement.appendChild(controller.domElement);\n this.#controllers.push(controller);\n controller.setParent(this);\n return controller;\n }\n addController(controller) {\n return this.#childDestController.#addControllerImpl(controller);\n }\n pushContainer(container) {\n this.addController(container);\n this.#childDestController = container;\n return container;\n }\n popContainer() {\n this.#childDestController = this.#childDestController.parent;\n return this;\n }\n}\n","import { createElem } from '../libs/elem.js';\nimport Container from './Container.js';\n\nexport default class Folder extends Container {\n #labelElem;\n\n constructor(name = 'Controls', className = 'muigui-menu') {\n super(className);\n this.#labelElem = createElem('label');\n this.addElem(createElem('button', {\n type: 'button',\n onClick: () => this.toggleOpen(),\n }, [this.#labelElem]));\n this.pushContainer(new Container('muigui-open-container'));\n this.pushContainer(new Container());\n this.name(name);\n this.open();\n }\n open(open = true) {\n this.domElement.classList.toggle('muigui-closed', !open);\n this.domElement.classList.toggle('muigui-open', open);\n return this;\n }\n close() {\n return this.open(false);\n }\n name(name) {\n this.#labelElem.textContent = name;\n return this;\n }\n title(title) {\n return this.name(title);\n }\n toggleOpen() {\n this.open(!this.domElement.classList.contains('muigui-open'));\n return this;\n }\n}\n","import Controller from './Controller.js';\n\n// This feels like it should be something else like\n// gui.addDividing = new Controller()\nexport default class Label extends Controller {\n constructor(text) {\n super('muigui-label');\n this.text(text);\n }\n text(text) {\n this.domElement.textContent = text;\n return this;\n }\n}","function noop() {\n}\n\nexport function computeRelativePosition(elem, event, start) {\n const rect = elem.getBoundingClientRect();\n const x = event.clientX - rect.left;\n const y = event.clientY - rect.top;\n const nx = x / rect.width;\n const ny = y / rect.height;\n start = start || [x, y];\n const dx = x - start[0];\n const dy = y - start[1];\n const ndx = dx / rect.width;\n const ndy = dy / rect.width;\n return {x, y, nx, ny, dx, dy, ndx, ndy};\n}\n\nexport function addTouchEvents(elem, {onDown = noop, onMove = noop, onUp = noop}) {\n let start;\n const pointerMove = function (event) {\n const e = {\n type: 'move',\n ...computeRelativePosition(elem, event, start),\n };\n onMove(e);\n };\n\n const pointerUp = function (event) {\n elem.releasePointerCapture(event.pointerId);\n elem.removeEventListener('pointermove', pointerMove);\n elem.removeEventListener('pointerup', pointerUp);\n\n document.body.style.backgroundColor = '';\n\n onUp('up');\n };\n\n const pointerDown = function (event) {\n elem.addEventListener('pointermove', pointerMove);\n elem.addEventListener('pointerup', pointerUp);\n elem.setPointerCapture(event.pointerId);\n\n const rel = computeRelativePosition(elem, event);\n start = [rel.x, rel.y];\n onDown({\n type: 'down',\n ...rel,\n });\n };\n\n elem.addEventListener('pointerdown', pointerDown);\n\n return function () {\n elem.removeEventListener('pointerdown', pointerDown);\n };\n}","import { createElem, getNewId } from '../libs/elem.js';\nimport { addTouchEvents } from '../libs/touch.js';\nimport { identity } from '../libs/conversions.js';\nimport { clamp } from '../libs/utils.js';\nimport EditView from './EditView.js';\nimport {\n hexToFloatRGB,\n hexToFloatRGBA,\n hsv01ToRGBFloat,\n hsva01ToRGBAFloat,\n rgbFloatToHSV01,\n rgbaFloatToHSVA01,\n floatRGBToHex,\n floatRGBAToHex,\n rgbaFloatToHsla01,\n} from '../libs/color-utils.js';\nimport { copyExistingProperties } from '../libs/utils.js';\n\nconst svg = `\n\n\n\n`;\n\nfunction connectFillTargets(elem) {\n elem.querySelectorAll('[data-src]').forEach(srcElem => {\n const id = getNewId();\n srcElem.id = id;\n elem.querySelectorAll(`[data-target=${srcElem.dataset.src}]`).forEach(targetElem => {\n targetElem.setAttribute('fill', `url(#${id})`);\n });\n });\n return elem;\n}\n\n// Was originally going to make alpha an option. Issue is\n// hard coded conversions?\nexport default class ColorChooserView extends EditView {\n #to;\n #from;\n #satLevelElem;\n #circleElem;\n #hueUIElem;\n #hueElem;\n #hueCursorElem;\n #alphaUIElem;\n #alphaElem;\n #alphaCursorElem;\n #hsva;\n #skipHueUpdate;\n #skipSatLevelUpdate;\n #skipAlphaUpdate;\n #options = {\n converters: identity,\n alpha: false,\n };\n #convertInternalToHex;\n #convertHexToInternal;\n\n constructor(setter, options) {\n super(createElem('div', {\n innerHTML: svg,\n className: 'muigui-no-scroll',\n }));\n this.#satLevelElem = this.domElement.children[0];\n this.#hueUIElem = this.domElement.children[1];\n this.#alphaUIElem = this.domElement.children[2];\n connectFillTargets(this.#satLevelElem);\n connectFillTargets(this.#hueUIElem);\n connectFillTargets(this.#alphaUIElem);\n this.#circleElem = this.$('.muigui-color-chooser-circle');\n this.#hueElem = this.$('[data-src=muigui-color-chooser-hue]');\n this.#hueCursorElem = this.$('.muigui-color-chooser-hue-cursor');\n this.#alphaElem = this.$('[data-src=muigui-color-chooser-alpha]');\n this.#alphaCursorElem = this.$('.muigui-color-chooser-alpha-cursor');\n\n const handleSatLevelChange = (e) => {\n const s = clamp(e.nx, 0, 1);\n const v = clamp(e.ny, 0, 1);\n this.#hsva[1] = s;\n this.#hsva[2] = (1 - v);\n this.#skipHueUpdate = true;\n this.#skipAlphaUpdate = true;\n const [valid, newV] = this.#from(this.#convertInternalToHex(this.#hsva));\n if (valid) {\n setter.setValue(newV);\n }\n };\n\n const handleHueChange = (e) => {\n const h = clamp(e.nx, 0, 1);\n this.#hsva[0] = h;\n this.#skipSatLevelUpdate = true;\n this.#skipAlphaUpdate = true;\n const [valid, newV] = this.#from(this.#convertInternalToHex(this.#hsva));\n if (valid) {\n setter.setValue(newV);\n }\n };\n\n const handleAlphaChange = (e) => {\n const a = clamp(e.nx, 0, 1);\n this.#hsva[3] = a;\n this.#skipHueUpdate = true;\n this.#skipSatLevelUpdate = true;\n const [valid, newV] = this.#from(this.#convertInternalToHex(this.#hsva));\n if (valid) {\n setter.setValue(newV);\n }\n };\n\n addTouchEvents(this.#satLevelElem, {\n onDown: handleSatLevelChange,\n onMove: handleSatLevelChange,\n });\n addTouchEvents(this.#hueUIElem, {\n onDown: handleHueChange,\n onMove: handleHueChange,\n });\n addTouchEvents(this.#alphaUIElem, {\n onDown: handleAlphaChange,\n onMove: handleAlphaChange,\n });\n this.setOptions(options);\n }\n updateDisplay(newV) {\n if (!this.#hsva) {\n this.#hsva = this.#convertHexToInternal(this.#to(newV));\n }\n {\n const [h, s, v, a = 1] = this.#convertHexToInternal(this.#to(newV));\n // Don't copy the hue if it was un-computable.\n if (!this.#skipHueUpdate) {\n this.#hsva[0] = s > 0.001 && v > 0.001 ? h : this.#hsva[0];\n }\n if (!this.#skipSatLevelUpdate) {\n this.#hsva[1] = s;\n this.#hsva[2] = v;\n }\n if (!this.#skipAlphaUpdate) {\n this.#hsva[3] = a;\n }\n }\n {\n const [h, s, v, a] = this.#hsva;\n const [hue, sat, lum] = rgbaFloatToHsla01(hsva01ToRGBAFloat(this.#hsva));\n\n if (!this.#skipHueUpdate) {\n this.#hueCursorElem.setAttribute('transform', `translate(${h * 64}, 0)`);\n }\n this.#hueElem.children[0].setAttribute('stop-color', `hsl(${hue * 360} 0% 100% / ${a})`);\n this.#hueElem.children[1].setAttribute('stop-color', `hsl(${hue * 360} 100% 50% / ${a})`);\n if (!this.#skipAlphaUpdate) {\n this.#alphaCursorElem.setAttribute('transform', `translate(${a * 64}, 0)`);\n }\n this.#alphaElem.children[0].setAttribute('stop-color', `hsl(${hue * 360} ${sat * 100}% ${lum * 100}% / 0)`);\n this.#alphaElem.children[1].setAttribute('stop-color', `hsl(${hue * 360} ${sat * 100}% ${lum * 100}% / 1)`);\n\n if (!this.#skipSatLevelUpdate) {\n this.#circleElem.setAttribute('cx', `${s * 64}`);\n this.#circleElem.setAttribute('cy', `${(1 - v) * 48}`);\n }\n }\n this.#skipHueUpdate = false;\n this.#skipSatLevelUpdate = false;\n this.#skipAlphaUpdate = false;\n }\n setOptions(options) {\n copyExistingProperties(this.#options, options);\n const {converters: {to, from}, alpha} = this.#options;\n this.#alphaUIElem.style.display = alpha ? '' : 'none';\n this.#convertInternalToHex = alpha\n ? v => floatRGBAToHex(hsva01ToRGBAFloat(v))\n : v => floatRGBToHex(hsv01ToRGBFloat(v));\n this.#convertHexToInternal = alpha\n ? v => rgbaFloatToHSVA01(hexToFloatRGBA(v))\n : v => rgbFloatToHSV01(hexToFloatRGB(v));\n this.#to = to;\n this.#from = from;\n return this;\n }\n}\n","import ElementView from '../views/ElementView.js';\nimport ValueController from './ValueController.js';\nimport { copyExistingProperties } from '../libs/utils.js';\nimport { createElem } from '../libs/elem.js';\n/*\n\nholder = new TabHolder\ntab = holder.add(new Tab(\"name\"))\ntab.add(...)\n\n\npc = new PopdownController\ntop = pc.add(new Row())\ntop.add(new Button());\nvalues = topRow.add(new Div())\nbottom = pc.add(new Row());\n\n\n\npc = new PopdownController\npc.addTop\npc.addTop\n\npc.addBottom\n\n\n*/\n\nexport default class PopDownController extends ValueController {\n #top;\n #valuesView;\n #checkboxElem;\n #bottom;\n #options = {\n open: false,\n };\n\n constructor(object, property, options = {}) {\n super(object, property, 'muigui-pop-down-controller');\n /*\n [ValueView\n [[B][values]] upper row\n [[ visual ]] lower row\n ]\n */\n this.#top = this.add(new ElementView('div', 'muigui-pop-down-top'));\n// this.#top.add(new CheckboxView(makeSetter(this.#options, 'open')));\n const checkboxElem = this.#top.addElem(createElem('input', {\n type: 'checkbox',\n onChange: () => {\n this.#options.open = checkboxElem.checked;\n this.updateDisplay();\n },\n }));\n this.#checkboxElem = checkboxElem;\n this.#valuesView = this.#top.add(new ElementView('div', 'muigui-pop-down-values'));\n const container = new ElementView('div', 'muigui-pop-down-bottom muigui-open-container');\n this.#bottom = new ElementView('div');\n container.add(this.#bottom);\n this.add(container);\n this.setOptions(options);\n }\n setKnobColor(bgCssColor/*, fgCssColor*/) {\n if (this.#checkboxElem) {\n this.#checkboxElem.style = `\n --range-color: ${bgCssColor};\n --value-bg-color: ${bgCssColor};\n `;\n }\n }\n updateDisplay() {\n super.updateDisplay();\n const {open} = this.#options;\n this.domElement.children[1].classList.toggle('muigui-open', open);\n this.domElement.children[1].classList.toggle('muigui-closed', !open);\n }\n setOptions(options) {\n copyExistingProperties(this.#options, options);\n super.setOptions(options);\n this.updateDisplay();\n }\n addTop(view) {\n return this.#valuesView.add(view);\n }\n addBottom(view) {\n return this.#bottom.add(view);\n }\n}","/* eslint-disable no-underscore-dangle */\nimport {\n colorFormatConverters,\n guessFormat,\n hasAlpha,\n hexToUint8RGB,\n hslToRgbUint8,\n rgbUint8ToHsl,\n uint8RGBToHex,\n} from '../libs/color-utils.js';\nimport ColorChooserView from '../views/ColorChooserView.js';\nimport TextView from '../views/TextView.js';\nimport PopDownController from './PopDownController.js';\n\nexport default class ColorChooser extends PopDownController {\n #colorView;\n #textView;\n #to;\n\n constructor(object, property, options = {}) {\n super(object, property, 'muigui-color-chooser');\n const format = options.format || guessFormat(this.getValue());\n const {color, text} = colorFormatConverters[format];\n this.#to = color.to;\n this.#textView = new TextView(this, {converters: text, alpha: hasAlpha(format)});\n this.#colorView = new ColorChooserView(this, {converters: color, alpha: hasAlpha(format)});\n this.addTop(this.#textView);\n this.addBottom(this.#colorView);\n // WTF! FIX!\n this.___setKnobHelper = true;\n this.updateDisplay();\n }\n #setKnobHelper() {\n if (this.#to) {\n const hex6Or8 = this.#to(this.getValue());\n const alpha = hex6Or8.length === 9 ? hex6Or8.substring(7, 9) : 'FF';\n const hsl = rgbUint8ToHsl(hexToUint8RGB(hex6Or8));\n hsl[2] = (hsl[2] + 50) % 100;\n const hex = uint8RGBToHex(hslToRgbUint8(hsl));\n this.setKnobColor(`${hex6Or8.substring(0, 7)}${alpha}`, hex);\n }\n }\n updateDisplay() {\n super.updateDisplay();\n if (this.___setKnobHelper) {\n this.#setKnobHelper();\n }\n }\n setOptions(options) {\n super.setOptions(options);\n return this;\n }\n}\n","import { createElem } from '../libs/elem.js';\nimport View from '../views/View.js';\n\nfunction showCSS(ob) {\n if (ob.prototype.css) {\n showCSS(ob.prototype);\n }\n}\n\nexport default class Layout extends View {\n static css = 'bar';\n constructor(tag, className) {\n super(createElem(tag, {className}));\n\n showCSS(this);\n }\n}\n\n/*\nclass ValueController ?? {\n const row = this.add(new Row());\n const label = row.add(new Label());\n const div = row.add(new Div());\n const row = div.add(new Row());\n}\n*/\n\n/*\nclass MyCustomThing extends ValueController {\n constructor(object, property, options) {\n const topRow = this.add(new Row());\n const bottomRow = this.add(new Row());\n topRow.add(new NumberView());\n topRow.add(new NumberView());\n topRow.add(new NumberView());\n topRow.add(new NumberView());\n bottomRow.add(new DirectionView());\n bottomRow.add(new DirectionView());\n bottomRow.add(new DirectionView());\n bottomRow.add(new DirectionView());\n }\n}\n new Grid([\n [new\n ]\n */","import Layout from './Layout.js';\n\nexport default class Column extends Layout {\n constructor() {\n super('div', 'muigui-row');\n }\n}\n","import Layout from './Layout.js';\n\nexport default class Frame extends Layout {\n static css = 'foo';\n constructor() {\n super('div', 'muigui-frame');\n }\n static get foo() {\n return 'boo';\n }\n}\n","import Layout from './Layout.js';\n\nexport default class Grid extends Layout {\n constructor() {\n super('div', 'muigui-grid');\n }\n}\n","import Layout from './Layout.js';\n\nexport default class Row extends Layout {\n constructor() {\n super('div', 'muigui-row');\n }\n}\n","import css from './styles/muigui.css.js';\nimport {createElem} from './libs/elem.js';\nimport {createController} from './controllers/create-controller.js';\nimport {\n mapRange,\n makeRangeConverters,\n makeRangeOptions,\n makeMinMaxPair,\n} from './libs/utils.js';\nimport {\n converters\n} from './libs/conversions.js';\nimport {\n hasAlpha,\n guessFormat,\n} from './libs/color-utils.js';\nimport Canvas from './controllers/Canvas.js';\nimport Color from './controllers/Color.js';\nimport Divider from './controllers/Divider.js';\nimport Folder from './controllers/Folder.js';\nimport Label from './controllers/Label.js';\nimport Controller from './controllers/Controller.js';\nimport ColorChooser from './controllers/ColorChooser.js';\n\nimport Column from './layout/Column.js';\nimport Frame from './layout/Frame.js';\nimport Grid from './layout/Grid.js';\nimport Row from './layout/Row.js';\n\nexport {\n Column,\n Frame,\n Grid,\n Row,\n};\n\nexport class GUIFolder extends Folder {\n add(object, property, ...args) {\n const controller = object instanceof Controller\n ? object\n : createController(object, property, ...args);\n return this.addController(controller);\n }\n addCanvas(name) {\n return this.addController(new Canvas(name));\n }\n addColor(object, property, options = {}) {\n const value = object[property];\n if (hasAlpha(options.format || guessFormat(value))) {\n return this.addController(new ColorChooser(object, property, options));\n } else {\n return this.addController(new Color(object, property, options));\n }\n }\n addDivider() {\n return this.addController(new Divider());\n }\n addFolder(name) {\n return this.addController(new GUIFolder(name));\n }\n addLabel(text) {\n return this.addController(new Label(text));\n }\n addButton(name, fn) {\n const o = {fn};\n return this.add(o, 'fn').name(name);\n }\n}\n\nclass MuiguiElement extends HTMLElement {\n constructor() {\n super();\n this.shadow = this.attachShadow({mode: 'open'});\n }\n}\n\ncustomElements.define('muigui-element', MuiguiElement);\n\nconst baseStyleSheet = new CSSStyleSheet();\n//baseStyleSheet.replaceSync(css.default);\nconst userStyleSheet = new CSSStyleSheet();\n\nfunction makeStyleSheetUpdater(styleSheet) {\n let newCss;\n let newCssPromise;\n\n function updateStyle() {\n if (newCss && !newCssPromise) {\n const s = newCss;\n newCss = undefined;\n newCssPromise = styleSheet.replace(s).then(() => {\n newCssPromise = undefined;\n updateStyle();\n });\n }\n }\n\n return function updateStyleSheet(css) {\n newCss = css;\n updateStyle();\n };\n}\n\nconst updateBaseStyle = makeStyleSheetUpdater(baseStyleSheet);\nconst updateUserStyle = makeStyleSheetUpdater(userStyleSheet);\n\nfunction getTheme(name) {\n const { include, css: cssStr } = css.themes[name];\n return `${include.map(m => css[m]).join('\\n')} : css.default}\\n${cssStr || ''}`;\n}\n\nexport class GUI extends GUIFolder {\n static converters = converters;\n static mapRange = mapRange;\n static makeRangeConverters = makeRangeConverters;\n static makeRangeOptions = makeRangeOptions;\n static makeMinMaxPair = makeMinMaxPair;\n #localStyleSheet = new CSSStyleSheet();\n\n constructor(options = {}) {\n super('Controls', 'muigui-root');\n if (options instanceof HTMLElement) {\n options = {parent: options};\n }\n const {\n autoPlace = true,\n width,\n title = 'Controls',\n } = options;\n let {\n parent,\n } = options;\n\n if (width) {\n this.domElement.style.width = /^\\d+$/.test(width) ? `${width}px` : width;\n }\n if (parent === undefined && autoPlace) {\n parent = document.body;\n this.domElement.classList.add('muigui-auto-place');\n }\n if (parent) {\n const muiguiElement = createElem('muigui-element');\n muiguiElement.shadowRoot.adoptedStyleSheets = [this.#localStyleSheet, baseStyleSheet, userStyleSheet];\n muiguiElement.shadow.appendChild(this.domElement);\n parent.appendChild(muiguiElement);\n }\n if (title) {\n this.title(title);\n }\n this.#localStyleSheet.replaceSync(css.default);\n this.domElement.classList.add('muigui', 'muigui-colors');\n }\n setStyle(css) {\n this.#localStyleSheet.replace(css);\n }\n static setBaseStyles(css) {\n updateBaseStyle(css);\n }\n static getBaseStyleSheet() {\n return baseStyleSheet;\n }\n static setUserStyles(css) {\n updateUserStyle(css);\n }\n static getUserStyleSheet() {\n return userStyleSheet;\n }\n setTheme(name) {\n this.setStyle(getTheme(name));\n }\n static setTheme(name) {\n GUI.setBaseStyles(getTheme(name));\n }\n}\n\nexport default GUI;\n","function noop() {\n}\n\nconst keyDirections = {\n ArrowLeft: [-1, 0],\n ArrowRight: [1, 0],\n ArrowUp: [0, -1],\n ArrowDown: [0, 1],\n};\n\n// This probably needs to be global\nexport function addKeyboardEvents(elem, {onDown = noop, onUp = noop}) {\n const keyDown = function (event) {\n const mult = event.shiftKey ? 10 : 1;\n const [dx, dy] = (keyDirections[event.key] || [0, 0]).map(v => v * mult);\n const fn = event.type === 'keydown' ? onDown : onUp;\n fn({\n type: event.type.substring(3),\n dx,\n dy,\n event,\n });\n };\n\n elem.addEventListener('keydown', keyDown);\n elem.addEventListener('keyup', keyDown);\n\n return function () {\n elem.removeEventListener('keydown', keyDown);\n elem.removeEventListener('keyup', keyDown);\n };\n}","export function assert(truthy, msg = '') {\n if (!truthy) {\n throw new Error(msg);\n }\n}","import { assert } from '../libs/assert.js';\n\nfunction getEllipsePointForAngle(cx, cy, rx, ry, phi, theta) {\n const m = Math.abs(rx) * Math.cos(theta);\n const n = Math.abs(ry) * Math.sin(theta);\n\n return [\n cx + Math.cos(phi) * m - Math.sin(phi) * n,\n cy + Math.sin(phi) * m + Math.cos(phi) * n,\n ];\n}\n\nfunction getEndpointParameters(cx, cy, rx, ry, phi, theta, dTheta) {\n const [x1, y1] = getEllipsePointForAngle(cx, cy, rx, ry, phi, theta);\n const [x2, y2] = getEllipsePointForAngle(cx, cy, rx, ry, phi, theta + dTheta);\n\n const fa = Math.abs(dTheta) > Math.PI ? 1 : 0;\n const fs = dTheta > 0 ? 1 : 0;\n\n return { x1, y1, x2, y2, fa, fs };\n}\n\nexport function arc(cx, cy, r, start, end) {\n assert(Math.abs(start - end) <= Math.PI * 2);\n assert(start >= -Math.PI && start <= Math.PI * 2);\n assert(start <= end);\n assert(end >= -Math.PI && end <= Math.PI * 4);\n\n const { x1, y1, x2, y2, fa, fs } = getEndpointParameters(cx, cy, r, r, 0, start, end - start);\n return Math.abs(Math.abs(start - end) - Math.PI * 2) > Number.EPSILON\n ? `M${cx} ${cy} L${x1} ${y1} A ${r} ${r} 0 ${fa} ${fs} ${x2} ${y2} L${cx} ${cy}`\n : `M${x1} ${y1} L${x1} ${y1} A ${r} ${r} 0 ${fa} ${fs} ${x2} ${y2}`;\n}\n","import { identity } from '../libs/conversions.js';\nimport { createElem } from '../libs/elem.js';\nimport { addKeyboardEvents } from '../libs/keyboard.js';\nimport { arc } from '../libs/svg.js';\nimport { addTouchEvents } from '../libs/touch.js';\nimport { createWheelHelper } from '../libs/wheel.js';\nimport { clamp, copyExistingProperties, euclideanModulo, lerp, stepify } from '../libs/utils.js';\nimport EditView from './EditView.js';\n\nconst svg = `\n\n`;\n\nconst twoPiMod = v => euclideanModulo(v + Math.PI, Math.PI * 2) - Math.PI;\n\nexport default class DirectionView extends EditView {\n #arrowElem;\n #rangeElem;\n #lastV;\n #wrap;\n #options = {\n step: 1,\n min: -180,\n max: 180,\n\n /*\n --------\n / -π/2 \\\n / | \\\n |<- -π * |\n | * 0 ->| zero is down the positive X axis\n |<- +π * |\n \\ | /\n \\ π/2 /\n --------\n */\n dirMin: -Math.PI,\n dirMax: Math.PI,\n //dirMin: Math.PI * 0.5,\n //dirMax: Math.PI * 2.5,\n //dirMin: -Math.PI * 0.75, // test 10:30 to 7:30\n //dirMax: Math.PI * 0.75,\n //dirMin: Math.PI * 0.75, // test 7:30 to 10:30\n //dirMax: -Math.PI * 0.75,\n //dirMin: -Math.PI * 0.75, // test 10:30 to 1:30\n //dirMax: -Math.PI * 0.25,\n //dirMin: Math.PI * 0.25, // test 4:30 to 7:30\n //dirMax: Math.PI * 0.75,\n //dirMin: Math.PI * 0.75, // test 4:30 to 7:30\n //dirMax: Math.PI * 0.25,\n wrap: undefined,\n converters: identity,\n };\n\n constructor(setter, options = {}) {\n const wheelHelper = createWheelHelper();\n super(createElem('div', {\n className: 'muigui-direction muigui-no-scroll',\n innerHTML: svg,\n onWheel: e => {\n e.preventDefault();\n const {min, max, step} = this.#options;\n const delta = wheelHelper(e, step);\n let tempV = this.#lastV + delta;\n if (this.#wrap) {\n tempV = euclideanModulo(tempV - min, max - min) + min;\n }\n const newV = clamp(stepify(tempV, v => v, step), min, max);\n setter.setValue(newV);\n },\n }));\n const handleTouch = (e) => {\n const {min, max, step, dirMin, dirMax} = this.#options;\n const nx = e.nx * 2 - 1;\n const ny = e.ny * 2 - 1;\n const a = Math.atan2(ny, nx);\n\n const center = (dirMin + dirMax) / 2;\n\n const centeredAngle = twoPiMod(a - center);\n const centeredStart = twoPiMod(dirMin - center);\n const diff = dirMax - dirMin;\n\n const n = clamp((centeredAngle - centeredStart) / (diff), 0, 1);\n const newV = stepify(min + (max - min) * n, v => v, step);\n setter.setValue(newV);\n };\n addTouchEvents(this.domElement, {\n onDown: handleTouch,\n onMove: handleTouch,\n });\n addKeyboardEvents(this.domElement, {\n onDown: (e) => {\n const {min, max, step} = this.#options;\n const newV = clamp(stepify(this.#lastV + e.dx * step, v => v, step), min, max);\n setter.setValue(newV);\n },\n });\n this.#arrowElem = this.$('#muigui-arrow');\n this.#rangeElem = this.$('#muigui-range');\n this.setOptions(options);\n }\n updateDisplay(v) {\n this.#lastV = v;\n const {min, max} = this.#options;\n const n = (v - min) / (max - min);\n const angle = lerp(this.#options.dirMin, this.#options.dirMax, n);\n this.#arrowElem.style.transform = `rotate(${angle}rad)`;\n }\n setOptions(options) {\n copyExistingProperties(this.#options, options);\n const {dirMin, dirMax, wrap} = this.#options;\n this.#wrap = wrap !== undefined\n ? wrap\n : Math.abs(dirMin - dirMax) >= Math.PI * 2 - Number.EPSILON;\n const [min, max] = dirMin < dirMax ? [dirMin, dirMax] : [dirMax , dirMin];\n this.#rangeElem.setAttribute('d', arc(0, 0, 28.87, min, max));\n }\n}\n","import { identity } from '../libs/conversions.js';\nimport DirectionView from '../views/DirectionView.js';\nimport NumberView from '../views/NumberView.js';\n// import ValueController from './ValueController.js';\nimport PopDownController from './PopDownController.js';\n\n\n// deg2rad\n// where is 0\n// range (0, 360), (-180, +180), (0,0) Really this is a range\n\nexport default class Direction extends PopDownController {\n #options;\n constructor(object, property, options) {\n super(object, property, 'muigui-direction');\nthis.#options = options; // FIX\n this.addTop(new NumberView(this,\nidentity));\n this.addBottom(new DirectionView(this, options));\n this.updateDisplay();\n }\n}\n\n","import { createElem } from '../libs/elem.js';\nimport { makeId } from '../libs/ids.js';\nimport EditView from './EditView.js';\n\nexport default class RadioGridView extends EditView {\n #values;\n\n constructor(setter, keyValues, cols = 3) {\n const values = [];\n const name = makeId();\n super(createElem('div', {}, keyValues.map(([key, value], ndx) => {\n values.push(value);\n return createElem('label', {}, [\n createElem('input', {\n type: 'radio',\n name,\n value: ndx,\n onChange: function () {\n if (this.checked) {\n setter.setFinalValue(that.#values[this.value]);\n }\n },\n }),\n createElem('button', {\n type: 'button',\n textContent: key,\n onClick: function () {\n this.previousElementSibling.click();\n },\n }),\n ]);\n })));\n // eslint-disable-next-line @typescript-eslint/no-this-alias\n const that = this;\n this.#values = values;\n this.cols(cols);\n }\n updateDisplay(v) {\n const ndx = this.#values.indexOf(v);\n for (let i = 0; i < this.domElement.children.length; ++i) {\n this.domElement.children[i].children[0].checked = i === ndx;\n }\n }\n cols(cols) {\n this.domElement.style.gridTemplateColumns = `repeat(${cols}, 1fr)`;\n }\n}\n","import RadioGridView from '../views/RadioGridView.js';\nimport ValueController from './ValueController.js';\nimport { convertToKeyValues } from '../libs/key-values.js';\n\nexport default class RadioGrid extends ValueController {\n constructor(object, property, options) {\n super(object, property, 'muigui-radio-grid');\n const valueIsNumber = typeof this.getValue() === 'number';\n const {\n keyValues: keyValuesInput,\n cols = 3,\n } = options;\n const keyValues = convertToKeyValues(keyValuesInput, valueIsNumber);\n this.add(new RadioGridView(this, keyValues, cols));\n this.updateDisplay();\n }\n}","export function onResize(elem, callback) {\n new ResizeObserver(() => {\n callback({rect: elem.getBoundingClientRect(), elem});\n }).observe(elem);\n}\n\nexport function onResizeSVGNoScale(elem, hAnchor, vAnchor, callback) {\n onResize(elem, ({rect}) => {\n const {width, height} = rect;\n elem.setAttribute('viewBox', `-${width * hAnchor} -${height * vAnchor} ${width} ${height}`);\n callback({elem, rect});\n });\n}\n\nexport function onResizeCanvas(elem, callback) {\n onResize(elem, ({rect}) => {\n const {width, height} = rect;\n elem.width = width;\n elem.height = height;\n callback({elem, rect});\n });\n}\n","import { createElem } from '../libs/elem.js';\nimport { addKeyboardEvents } from '../libs/keyboard.js';\nimport { addTouchEvents } from '../libs/touch.js';\nimport { createWheelHelper } from '../libs/wheel.js';\nimport { onResizeSVGNoScale } from '../libs/resize-helpers.js';\nimport { clamp, copyExistingProperties, stepify } from '../libs/utils.js';\nimport EditView from './EditView.js';\n\nconst svg = `\n\n`;\n\nfunction createSVGTicks(start, end, step, min, max, height) {\n const p = [];\n if (start < min) {\n start += stepify(min - start, v => v, step);\n }\n end = Math.min(end, max);\n for (let i = start; i <= end; i += step) {\n p.push(`M${i} 0 l0 ${height}`);\n }\n return p.join(' ');\n}\n\nfunction createSVGNumbers(start, end, unitSize, unit, minusSize, min, max, labelFn) {\n const texts = [];\n if (start < min) {\n start += stepify(min - start, v => v, unitSize);\n }\n end = Math.min(end, max);\n const digits = Math.max(0, -Math.log10(unit));\n const f = v => labelFn(v.toFixed(digits));\n for (let i = start; i <= end; i += unitSize) {\n texts.push(`= 0 ? i : (i - minusSize / 2) }\" y=\"0\">${f(i / unitSize * unit)}`);\n }\n return texts.join('\\n');\n}\n\nfunction computeSizeOfMinus(elem) {\n const oldHTML = elem.innerHTML;\n elem.innerHTML = '- ';\n const text = elem.querySelector('text');\n const size = text.getComputedTextLength();\n elem.innerHTML = oldHTML;\n return size;\n}\n\nexport default class SliderView extends EditView {\n #svgElem;\n #originElem;\n #ticksElem;\n #thicksElem;\n #numbersElem;\n #leftGradElem;\n #rightGradElem;\n #width;\n #height;\n #lastV;\n #minusSize;\n #options = {\n min: -100,\n max: 100,\n step: 1,\n unit: 10,\n unitSize: 10,\n ticksPerUnit: 5,\n labelFn: v => v,\n tickHeight: 1,\n limits: true,\n thicksColor: undefined,\n orientation: undefined,\n };\n\n constructor(setter, options) {\n const wheelHelper = createWheelHelper();\n super(createElem('div', {\n innerHTML: svg,\n className: 'muigui-no-v-scroll',\n onWheel: e => {\n e.preventDefault();\n const {min, max, step} = this.#options;\n const delta = wheelHelper(e, step);\n const newV = clamp(stepify(this.#lastV + delta, v => v, step), min, max);\n setter.setValue(newV);\n },\n }));\n this.#svgElem = this.$('svg');\n this.#originElem = this.$('#muigui-origin');\n this.#ticksElem = this.$('#muigui-ticks');\n this.#thicksElem = this.$('#muigui-thicks');\n this.#numbersElem = this.$('#muigui-numbers');\n this.#leftGradElem = this.$('#muigui-left-grad');\n this.#rightGradElem = this.$('#muigui-right-grad');\n this.setOptions(options);\n let startV;\n addTouchEvents(this.domElement, {\n onDown: () => {\n startV = this.#lastV;\n },\n onMove: (e) => {\n const {min, max, unitSize, unit, step} = this.#options;\n const newV = clamp(stepify(startV - e.dx / unitSize * unit, v => v, step), min, max);\n setter.setValue(newV);\n },\n });\n addKeyboardEvents(this.domElement, {\n onDown: (e) => {\n const {min, max, step} = this.#options;\n const newV = clamp(stepify(this.#lastV + e.dx * step, v => v, step), min, max);\n setter.setValue(newV);\n },\n });\n onResizeSVGNoScale(this.#svgElem, 0.5, 0, ({rect: {width}}) => {\n this.#leftGradElem.setAttribute('x', -width / 2);\n this.#rightGradElem.setAttribute('x', width / 2 - 20);\n this.#minusSize = computeSizeOfMinus(this.#numbersElem);\n this.#width = width;\n this.#updateSlider();\n });\n }\n // |--------V--------|\n // . . | . . . | . . . |\n //\n #updateSlider() {\n // There's no size if ResizeObserver has not fired yet.\n if (!this.#width || this.#lastV === undefined) {\n return;\n }\n const {\n labelFn,\n limits,\n min,\n max,\n orientation,\n tickHeight,\n ticksPerUnit,\n unit,\n unitSize,\n thicksColor,\n } = this.#options;\n const unitsAcross = Math.ceil(this.#width / unitSize);\n const center = this.#lastV;\n const centerUnitSpace = center / unit;\n const startUnitSpace = Math.round(centerUnitSpace - unitsAcross);\n const endUnitSpace = startUnitSpace + unitsAcross * 2;\n const start = startUnitSpace * unitSize;\n const end = endUnitSpace * unitSize;\n const minUnitSpace = limits ? min * unitSize / unit : start;\n const maxUnitSpace = limits ? max * unitSize / unit : end;\n const height = labelFn(1) === '' ? 10 : 5;\n if (ticksPerUnit > 1) {\n this.#ticksElem.setAttribute('d', createSVGTicks(start, end, unitSize / ticksPerUnit, minUnitSpace, maxUnitSpace, height * tickHeight));\n }\n this.#thicksElem.style.stroke = thicksColor; //setAttribute('stroke', thicksColor);\n this.#thicksElem.setAttribute('d', createSVGTicks(start, end, unitSize, minUnitSpace, maxUnitSpace, height));\n this.#numbersElem.innerHTML = createSVGNumbers(start, end, unitSize, unit, this.#minusSize, minUnitSpace, maxUnitSpace, labelFn);\n this.#originElem.setAttribute('transform', `translate(${-this.#lastV * unitSize / unit} 0)`);\n this.#svgElem.classList.toggle('muigui-slider-up', orientation === 'up');\n }\n updateDisplay(v) {\n this.#lastV = v;\n this.#updateSlider();\n }\n setOptions(options) {\n copyExistingProperties(this.#options, options);\n return this;\n }\n}\n","import ValueController from './ValueController.js';\nimport NumberView from '../views/NumberView.js';\nimport SliderView from '../views/SliderView.js';\n\nexport default class Slider extends ValueController {\n constructor(object, property, options = {}) {\n super(object, property, 'muigui-slider');\n this.add(new SliderView(this, options));\n this.add(new NumberView(this, options));\n this.updateDisplay();\n }\n}\n","import { createElem } from '../libs/elem.js';\nimport { addTouchEvents } from '../libs/touch.js';\nimport { onResizeSVGNoScale } from '../libs/resize-helpers.js';\nimport EditView from './EditView.js';\n\nconst svg = `\n\n`;\n\nexport default class Vec2View extends EditView {\n #svgElem;\n #arrowElem;\n #circleElem;\n #lastV = [];\n\n constructor(setter) {\n super(createElem('div', {\n innerHTML: svg,\n className: 'muigui-no-scroll',\n }));\n const onTouch = (e) => {\n const {width, height} = this.#svgElem.getBoundingClientRect();\n const nx = e.nx * 2 - 1;\n const ny = e.ny * 2 - 1;\n setter.setValue([nx * width * 0.5, ny * height * 0.5]);\n };\n addTouchEvents(this.domElement, {\n onDown: onTouch,\n onMove: onTouch,\n });\n this.#svgElem = this.$('svg');\n this.#arrowElem = this.$('#muigui-arrow');\n this.#circleElem = this.$('#muigui-circle');\n onResizeSVGNoScale(this.#svgElem, 0.5, 0.5, () => this.#updateDisplayImpl);\n }\n #updateDisplayImpl() {\n const [x, y] = this.#lastV;\n this.#arrowElem.setAttribute('d', `M0,0L${x},${y}`);\n this.#circleElem.setAttribute('transform', `translate(${x}, ${y})`);\n }\n updateDisplay(v) {\n this.#lastV[0] = v[0];\n this.#lastV[1] = v[1];\n this.#updateDisplayImpl();\n }\n}\n","import NumberView from '../views/NumberView.js';\nimport Vec2View from '../views/Vec2View.js';\nimport PopDownController from './PopDownController.js';\nimport { strToNumber } from '../libs/conversions.js';\n\n// TODO: zoom with wheel and pinch?\n// TODO: grid?\n// // options\n// scale:\n// range: number (both x and y + /)\n// range: array (min, max)\n// xRange:\n// deg/rad/turn\n\nexport default class Vec2 extends PopDownController {\n constructor(object, property) {\n super(object, property, 'muigui-vec2');\n\n const makeSetter = (ndx) => {\n return {\n setValue: (v) => {\n const newV = this.getValue();\n newV[ndx] = v;\n this.setValue(newV);\n },\n setFinalValue: (v) => {\n const newV = this.getValue();\n newV[ndx] = v;\n this.setFinalValue(newV);\n },\n };\n };\n\n this.addTop(new NumberView(makeSetter(0), {\n converters: {\n to: v => v[0],\n from: strToNumber.from,\n },\n }));\n this.addTop(new NumberView(makeSetter(1), {\n converters: {\n to: v => v[1],\n from: strToNumber.from,\n },\n }));\n this.addBottom(new Vec2View(this));\n this.updateDisplay();\n }\n}\n","import GUI from './muigui.js';\n\nimport ColorChooser from './controllers/ColorChooser.js';\nimport Direction from './controllers/Direction.js';\nimport RadioGrid from './controllers/RadioGrid.js';\nimport Range from './controllers/Range.js';\nimport Select from './controllers/Select.js';\nimport Slider from './controllers/Slider.js';\nimport TextNumber from './controllers/TextNumber.js';\nimport Vec2 from './controllers/Vec2.js';\n\nGUI.ColorChooser = ColorChooser;\nGUI.Direction = Direction;\nGUI.RadioGrid = RadioGrid;\nGUI.Range = Range;\nGUI.Select = Select;\nGUI.Slider = Slider;\nGUI.TextNumber = TextNumber;\nGUI.Vec2 = Vec2;\n\nexport default GUI;"],"names":["clamp","euclideanModulo","lerp","identity","noop","svg"],"mappings":";;;;;;;AAAA,YAAe;EACf,EAAE,OAAO,EAAE,CAAC;AACZ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;EACD,MAAM,EAAE;EACR,EAAE,OAAO,EAAE;EACX,IAAI,OAAO,EAAE,CAAC,SAAS,CAAC;EACxB,IAAI,GAAG,EAAE,CAAC;AACV,IAAI,CAAC;EACL,GAAG;EACH,EAAE,KAAK,EAAE;EACT,IAAI,OAAO,EAAE,CAAC,SAAS,CAAC;EACxB,IAAI,GAAG,EAAE,CAAC;AACV;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAC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++ b/dist/0.x/muigui.min.js
@@ -1,2 +1,2 @@
-!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).GUI=e()}(this,(function(){"use strict";var t={default:'\n.muigui {\n --bg-color: #ddd;\n --color: #222;\n --contrast-color: #eee;\n --value-color: #145 ;\n --value-bg-color: #eeee;\n --disabled-color: #999;\n --menu-bg-color: #f8f8f8;\n --menu-sep-color: #bbb;\n --hover-bg-color: #999;\n --focus-color: #68C;\n --range-color: #888888;\n --invalid-color: #FF0000;\n --selected-color: rgb(255, 255, 255, 0.9);\n\n --button-bg-color: var(--value-bg-color);\n\n --range-left-color: var(--value-color);\n --range-right-color: var(--value-bg-color); \n --range-right-hover-color: var(--hover-bg-color);\n\n color: var(--color);\n background-color: var(--bg-color);\n}\n\n@media (prefers-color-scheme: dark) {\n .muigui {\n --bg-color: #222222;\n --color: #dddddd;\n --contrast-color: #000;\n --value-color: #43e5f7;\n --value-bg-color: #444444;\n --disabled-color: #666666;\n --menu-bg-color: #080808;\n --menu-sep-color: #444444;\n --hover-bg-color: #666666;\n --focus-color: #88AAFF;\n --range-color: #888888;\n --invalid-color: #FF6666;\n --selected-color: rgba(255, 255, 255, 0.3);\n\n --button-bg-color: var(--value-bg-color);\n\n --range-left-color: var(--value-color);\n --range-right-color: var(--value-bg-color); \n --range-right-hover-color: var(--hover-bg-color);\n\n color: var(--color);\n background-color: var(--bg-color);\n }\n}\n\n.muigui {\n --width: 250px;\n --label-width: 45%;\n --number-width: 40%;\n\n\n --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;\n --font-size: 11px;\n --font-family-mono: Menlo, Monaco, Consolas, "Droid Sans Mono", monospace;\n --font-size-mono: 11px;\n\n --line-height: 1.7em;\n --border-radius: 0px;\n\n width: var(--width);\n font-family: var(--font-family);\n font-size: var(--font-size);\n box-sizing: border-box;\n line-height: 100%;\n}\n.muigui * {\n box-sizing: inherit;\n}\n\n.muigui-no-scroll {\n touch-action: none;\n}\n.muigui-no-h-scroll {\n touch-action: pan-y;\n}\n.muigui-no-v-scroll {\n touch-action: pan-x;\n}\n\n.muigui-invalid-value {\n background-color: red !important;\n color: white !important;\n}\n\n.muigui-grid {\n display: grid;\n}\n.muigui-rows {\n display: flex;\n flex-direction: column;\n\n min-height: 20px;\n border: 2px solid red;\n}\n.muigui-columns {\n display: flex;\n flex-direction: row;\n\n height: 20px;\n border: 2px solid green;\n}\n.muigui-rows>*,\n.muigui-columns>* {\n flex: 1 1 auto;\n align-items: stretch;\n min-height: 0;\n min-width: 0;\n}\n\n.muigui-row {\n border: 2px solid yellow;\n min-height: 10px\n}\n.muigui-column {\n border: 2px solid lightgreen;\n}\n\n/* -------- */\n\n.muigui-show { /* */ }\n.muigui-hide { \n display: none !important;\n}\n.muigui-disabled {\n pointer-events: none;\n --color: var(--disabled-color) !important;\n --value-color: var(--disabled-color) !important;\n --range-left-color: var(--disabled-color) !important;\n}\n\n.muigui canvas,\n.muigui svg {\n display: block;\n border-radius: var(--border-radius);\n}\n.muigui canvas {\n background-color: var(--value-bg-color);\n}\n\n.muigui-controller {\n min-width: 0;\n min-height: var(--line-height);\n}\n.muigui-root,\n.muigui-menu {\n display: flex;\n flex-direction: column;\n position: relative;\n user-select: none;\n height: fit-content;\n margin: 0;\n padding-bottom: 0.1em;\n border-radius: var(--border-radius);\n}\n.muigui-menu {\n border-bottom: 1px solid var(--menu-sep-color);\n}\n\n.muigui-root>button:nth-child(1),\n.muigui-menu>button:nth-child(1) {\n border-top: 1px solid var(--menu-sep-color);\n border-bottom: 1px solid var(--menu-sep-color);\n position: relative;\n text-align: left;\n color: var(--color);\n background-color: var(--menu-bg-color);\n min-height: var(--line-height);\n padding-top: 0.2em;\n padding-bottom: 0.2em;\n cursor: pointer;\n border-radius: var(--border-radius);\n}\n.muigui-root>div:nth-child(2),\n.muigui-menu>div:nth-child(2) {\n flex: 1 1 auto;\n}\n\n.muigui-controller {\n margin-left: 0.2em;\n margin-right: 0.2em;\n}\n.muigui-root.muigui-controller,\n.muigui-menu.muigui-controller {\n margin-left: 0;\n margin-right: 0;\n}\n.muigui-controller>*:nth-child(1) {\n flex: 1 0 var(--label-width);\n min-width: 0;\n white-space: pre;\n}\n.muigui-controller>label:nth-child(1) {\n place-content: center start;\n display: inline-grid;\n overflow: hidden;\n}\n.muigui-controller>*:nth-child(2) {\n flex: 1 1 75%;\n min-width: 0;\n}\n\n/* -----------------------------------------\n a label controller is [[label][value]]\n*/\n\n.muigui-label-controller {\n display: flex;\n margin: 0.4em 0 0.4em 0;\n word-wrap: initial;\n align-items: stretch;\n}\n\n.muigui-value {\n display: flex;\n align-items: stretch;\n}\n.muigui-value>* {\n flex: 1 1 auto;\n min-width: 0;\n}\n.muigui-value>*:nth-child(1) {\n flex: 1 1 calc(100% - var(--number-width));\n}\n.muigui-value>*:nth-child(2) {\n flex: 1 1 var(--number-width);\n margin-left: 0.2em;\n}\n\n/* fix! */\n.muigui-open>button>label::before,\n.muigui-closed>button>label::before {\n width: 1.25em;\n height: var(--line-height);\n display: inline-grid;\n place-content: center start;\n pointer-events: none;\n}\n.muigui-open>button>label::before {\n content: "ⓧ"; /*"▼";*/\n}\n.muigui-closed>button>label::before {\n content: "⨁"; /*"▶";*/\n}\n.muigui-open>*:nth-child(2) {\n transition: max-height 0.2s ease-out,\n opacity 0.5s ease-out;\n max-height: 100vh;\n overflow: auto;\n opacity: 1;\n}\n\n.muigui-closed>*:nth-child(2) {\n transition: max-height 0.2s ease-out,\n opacity 1s;\n max-height: 0;\n opacity: 0;\n overflow: hidden;\n}\n\n/* ---- popdown ---- */\n\n.muigui-pop-down-top {\n display: flex;\n}\n/* fix? */\n.muigui-value>*:nth-child(1).muigui-pop-down-top {\n flex: 0;\n}\n.muigui-pop-down-bottom {\n\n}\n\n.muigui-pop-down-values {\n min-width: 0;\n display: flex;\n}\n.muigui-pop-down-values>* {\n flex: 1 1 auto;\n min-width: 0;\n}\n\n.muigui-value.muigui-pop-down-controller {\n flex-direction: column;\n}\n\n.muigui-pop-down-top input[type=checkbox] {\n -webkit-appearance: none;\n appearance: none;\n width: auto;\n color: var(--value-color);\n background-color: var(--value-bg-color);\n cursor: pointer;\n\n display: grid;\n place-content: center;\n margin: 0;\n font: inherit;\n color: currentColor;\n width: 1.7em;\n height: 1.7em;\n transform: translateY(-0.075em);\n}\n\n.muigui-pop-down-top input[type=checkbox]::before {\n content: "+";\n display: grid;\n place-content: center;\n border-radius: calc(var(--border-radius) + 2px);\n border-left: 1px solid rgba(255,255,255,0.3);\n border-top: 1px solid rgba(255,255,255,0.3);\n border-bottom: 1px solid rgba(0,0,0,0.2);\n border-right: 1px solid rgba(0,0,0,0.2);\n background-color: var(--range-color);\n color: var(--value-bg-color);\n width: calc(var(--line-height) - 4px);\n height: calc(var(--line-height) - 4px);\n}\n\n.muigui-pop-down-top input[type=checkbox]:checked::before {\n content: "X";\n}\n\n\n/* ---- select ---- */\n\n.muigui select,\n.muigui option,\n.muigui input,\n.muigui button {\n color: var(--value-color);\n background-color: var(--value-bg-color);\n font-family: var(--font-family);\n font-size: var(--font-size);\n border: none;\n margin: 0;\n border-radius: var(--border-radius);\n}\n.muigui select {\n appearance: none;\n margin: 0;\n margin-left: 0; /*?*/\n overflow: hidden; /* Safari */\n}\n\n.muigui select:focus,\n.muigui input:focus,\n.muigui button:focus {\n outline: 1px solid var(--focus-color);\n}\n\n.muigui select:hover,\n.muigui option:hover,\n.muigui input:hover,\n.muigui button:hover {\n background-color: var(--hover-bg-color); \n}\n\n/* ------ [ label ] ------ */\n\n.muigui-label {\n border-top: 1px solid var(--menu-sep-color);\n border-bottom: 1px solid var(--menu-sep-color);\n padding-top: 0.4em;\n padding-bottom: 0.3em;\n place-content: center start;\n background-color: var(--menu-bg-color);\n white-space: pre;\n border-radius: var(--border-radius);\n}\n\n/* ------ [ divider] ------ */\n\n.muigui-divider {\n min-height: 6px;\n border-top: 2px solid var(--menu-sep-color);\n margin-top: 6px;\n}\n\n/* ------ [ button ] ------ */\n\n.muigui-button {\n display: grid;\n\n}\n.muigui-button button {\n border: none;\n color: var(--value-color);\n background-color: var(--button-bg-color);\n cursor: pointer;\n place-content: center center;\n}\n\n/* ------ [ color ] ------ */\n\n.muigui-color>div {\n overflow: hidden;\n position: relative;\n margin-left: 0;\n margin-right: 0; /* why? */\n max-width: var(--line-height);\n border-radius: var(--border-radius);\n}\n\n.muigui-color>div:focus-within {\n outline: 1px solid var(--focus-color);\n}\n\n.muigui-color input[type=color] {\n border: none;\n padding: 0;\n background: inherit;\n cursor: pointer;\n position: absolute;\n width: 200%;\n left: -10px;\n top: -10px;\n height: 200%;\n}\n.muigui-disabled canvas,\n.muigui-disabled svg,\n.muigui-disabled img,\n.muigui-disabled .muigui-color input[type=color] {\n opacity: 0.2;\n}\n\n/* ------ [ checkbox ] ------ */\n\n.muigui-checkbox>label:nth-child(2) {\n display: grid;\n place-content: center start;\n margin: 0;\n}\n\n.muigui-checkbox input[type=checkbox] {\n -webkit-appearance: none;\n appearance: none;\n width: auto;\n color: var(--value-color);\n background-color: var(--value-bg-color);\n cursor: pointer;\n\n display: grid;\n place-content: center;\n margin: 0;\n font: inherit;\n color: currentColor;\n width: 1.7em;\n height: 1.7em;\n transform: translateY(-0.075em);\n}\n\n.muigui-checkbox input[type=checkbox]::before {\n content: "";\n color: var(--value-color);\n display: grid;\n place-content: center;\n}\n\n.muigui-checkbox input[type=checkbox]:checked::before {\n content: "✔";\n}\n\n.muigui input[type=number]::-webkit-inner-spin-button, \n.muigui input[type=number]::-webkit-outer-spin-button { \n -webkit-appearance: none;\n appearance: none;\n margin: 0; \n}\n.muigui input[type=number] {\n -moz-appearance: textfield;\n}\n\n/* ------ [ radio grid ] ------ */\n\n.muigui-radio-grid>div {\n display: grid;\n gap: 2px;\n}\n\n.muigui-radio-grid input {\n appearance: none;\n display: none;\n}\n\n.muigui-radio-grid button {\n color: var(--color);\n width: 100%;\n text-align: left;\n}\n\n.muigui-radio-grid input:checked + button {\n color: var(--value-color);\n background-color: var(--selected-color);\n}\n\n/* ------ [ color-chooser ] ------ */\n\n.muigui-color-chooser-cursor {\n stroke-width: 1px;\n stroke: white;\n fill: none;\n}\n.muigui-color-chooser-circle {\n stroke-width: 1px;\n stroke: white;\n fill: none;\n}\n\n\n/* ------ [ vec2 ] ------ */\n\n.muigui-vec2 svg {\n background-color: var(--value-bg-color);\n}\n\n.muigui-vec2-axis {\n stroke: 1px;\n stroke: var(--focus-color);\n}\n\n.muigui-vec2-line {\n stroke-width: 1px;\n stroke: var(--value-color);\n fill: var(--value-color);\n}\n\n/* ------ [ direction ] ------ */\n\n.muigui-direction svg {\n background-color: rgba(0,0,0,0.2);\n}\n\n.muigui-direction:focus-within svg {\n outline: none;\n}\n.muigui-direction-range {\n fill: var(--value-bg-color);\n}\n.muigui-direction svg:focus {\n outline: none;\n}\n.muigui-direction svg:focus .muigui-direction-range {\n stroke-width: 0.5px;\n stroke: var(--focus-color);\n}\n\n.muigui-direction-arrow {\n fill: var(--value-color);\n}\n\n/* ------ [ slider ] ------ */\n\n.muigui-slider>div {\n display: flex;\n align-items: stretch;\n height: var(--line-height);\n}\n.muigui-slider svg {\n flex: 1 1 auto;\n}\n.muigui-slider .muigui-slider-up #muigui-orientation {\n transform: scale(1, -1) translateY(-100%);\n}\n\n.muigui-slider .muigui-slider-up #muigui-number-orientation {\n transform: scale(1,-1);\n}\n\n.muigui-ticks {\n stroke: var(--range-color);\n}\n.muigui-thicks {\n stroke: var(--color);\n stroke-width: 2px;\n}\n.muigui-svg-text {\n fill: var(--color);\n font-size: 7px;\n}\n.muigui-mark {\n fill: var(--value-color);\n}\n\n/* ------ [ range ] ------ */\n\n\n.muigui-range input[type=range] {\n -webkit-appearance: none;\n appearance: none;\n background-color: transparent;\n}\n\n.muigui-range input[type=range]::-webkit-slider-thumb {\n -webkit-appearance: none;\n appearance: none;\n border-radius: calc(var(--border-radius) + 2px);\n border-left: 1px solid rgba(255,255,255,0.3);\n border-top: 1px solid rgba(255,255,255,0.3);\n border-bottom: 1px solid rgba(0,0,0,0.2);\n border-right: 1px solid rgba(0,0,0,0.2);\n background-color: var(--range-color);\n margin-top: calc((var(--line-height) - 2px) / -2);\n width: calc(var(--line-height) - 2px);\n height: calc(var(--line-height) - 2px);\n}\n\n.muigui-range input[type=range]::-webkit-slider-runnable-track {\n -webkit-appearance: none;\n appearance: none;\n border: 1px solid var(--menu-sep-color);\n height: 2px;\n}\n\n\n/* dat.gui style - doesn\'t work on Safari iOS */\n\n/*\n.muigui-range input[type=range] {\n cursor: ew-resize;\n overflow: hidden;\n}\n\n.muigui-range input[type=range] {\n -webkit-appearance: none;\n appearance: none;\n background-color: var(--range-right-color);\n margin: 0;\n}\n.muigui-range input[type=range]:hover {\n background-color: var(--range-right-hover-color);\n}\n\n.muigui-range input[type=range]::-webkit-slider-runnable-track {\n -webkit-appearance: none;\n appearance: none;\n height: max-content;\n color: var(--range-left-color);\n margin-top: -1px;\n}\n\n.muigui-range input[type=range]::-webkit-slider-thumb {\n -webkit-appearance: none;\n appearance: none;\n width: 0px;\n height: max-content;\n box-shadow: -1000px 0 0 1000px var(--range-left-color);\n}\n*/\n\n/* FF */\n/*\n.muigui-range input[type=range]::-moz-slider-progress {\n background-color: var(--range-left-color); \n}\n.muigui-range input[type=range]::-moz-slider-thumb {\n height: max-content;\n width: 0;\n border: none;\n box-shadow: -1000px 0 0 1000px var(--range-left-color);\n box-sizing: border-box;\n}\n*/\n\n.muigui-checkered-background {\n background-color: #404040;\n background-image:\n linear-gradient(45deg, #808080 25%, transparent 25%),\n linear-gradient(-45deg, #808080 25%, transparent 25%),\n linear-gradient(45deg, transparent 75%, #808080 75%),\n linear-gradient(-45deg, transparent 75%, #808080 75%);\n background-size: 16px 16px;\n background-position: 0 0, 0 8px, 8px -8px, -8px 0px;\n}\n\n/* ---------------------------------------------------------- */\n\n/* needs to be at bottom to take precedence */\n.muigui-auto-place {\n max-height: 100%;\n position: fixed;\n top: 0;\n right: 15px;\n z-index: 100001;\n}\n\n',themes:{default:"",float:"\n :root {\n color-scheme: light dark,\n }\n\n .muigui {\n --width: 400px;\n --bg-color: initial;\n --label-width: 25%;\n --number-width: 20%;\n }\n\n input,\n .muigui-label-controller>label {\n text-shadow:\n -1px -1px 0 var(--contrast-color),\n 1px -1px 0 var(--contrast-color),\n -1px 1px 0 var(--contrast-color),\n 1px 1px 0 var(--contrast-color);\n }\n\n .muigui-controller > label:nth-child(1) {\n place-content: center end;\n margin-right: 1em;\n }\n\n .muigui-value > :nth-child(2) {\n margin-left: 1em;\n }\n\n .muigui-root>*:nth-child(1) {\n display: none;\n }\n\n .muigui-range input[type=range]::-webkit-slider-thumb {\n border-radius: 1em;\n }\n\n .muigui-range input[type=range]::-webkit-slider-runnable-track {\n -webkit-appearance: initial;\n appearance: none;\n border: 1px solid rgba(0, 0, 0, 0.25);\n height: 2px;\n }\n\n .muigui-colors {\n --value-color: var(--color );\n --value-bg-color: rgba(0, 0, 0, 0.1);\n --disabled-color: #cccccc;\n --menu-bg-color: rgba(0, 0, 0, 0.1);\n --menu-sep-color: #bbbbbb;\n --hover-bg-color: rgba(0, 0, 0, 0);\n --invalid-color: #FF0000;\n --selected-color: rgba(0, 0, 0, 0.3);\n --range-color: rgba(0, 0, 0, 0.125);\n }\n"}};function e(t,e={},n=[]){const i=document.createElement(t);return function(t,e,n){for(const[n,i]of Object.entries(e))if("function"==typeof i&&n.startsWith("on")){const e=n.substring(2).toLowerCase();t.addEventListener(e,i,{passive:!1})}else if("object"==typeof i)for(const[e,o]of Object.entries(i))t[n][e]=o;else void 0===t[n]?t.setAttribute(n,i):t[n]=i;for(const e of n)t.appendChild(e)}(i,e,n),i}let n=0;function i(t,e){const n=t.indexOf(e);return n&&t.splice(n,1),t}function o(t,e,n){return Math.max(e,Math.min(n,t))}const r="undefined"!=typeof SharedArrayBuffer?function(t){return t&&t.buffer&&(t.buffer instanceof ArrayBuffer||t.buffer instanceof SharedArrayBuffer)}:function(t){return t&&t.buffer&&t.buffer instanceof ArrayBuffer},s=(t,e,n)=>Math.round(e(t)/n)/(1/n),a=(t,e)=>(t%e+e)%e;function l(t,e){for(const n in e)n in t&&(t[n]=e[n]);return t}const u=(t,e,n,i,o)=>(t-e)*(o-i)/(n-e)+i,c=({from:t,to:e})=>({to:n=>u(n,...t,...e),from:n=>[!0,u(n,...e,...t)]}),h=({from:t,to:e,step:n})=>({min:e[0],max:e[1],...n&&{step:n},converters:c({from:t,to:e})}),d={to:t=>t,from:t=>[!0,t]};function p(t,e,n,i,o){const{converters:{from:r}=d}=o,{min:s,max:a}=o,l=o.minRange||0,u=r(l)[1],c=t.add(e,n,{...o,min:s,max:a-l}).onChange((t=>{h.setValue(Math.min(a,Math.max(t+u,e[i])))})),h=t.add(e,i,{...o,min:s+l,max:a}).onChange((t=>{c.setValue(Math.max(s,Math.min(t-u,e[n])))}));return[c,h]}class m{domElement;#t;#e=[];constructor(t){this.domElement=t,this.#t=t}addElem(t){return this.#t.appendChild(t),t}removeElem(t){return this.#t.removeChild(t),t}pushSubElem(t){this.#t.appendChild(t),this.#t=t}popSubElem(){this.#t=this.#t.parentElement}add(t){return this.#e.push(t),this.addElem(t.domElement),t}remove(t){return this.removeElem(t.domElement),i(this.#e,t),t}pushSubView(t){this.pushSubElem(t.domElement)}popSubView(){this.popSubElem()}setOptions(t){for(const e of this.#e)e.setOptions(t)}updateDisplayIfNeeded(t,e){for(const n of this.#e)n.updateDisplayIfNeeded(t,e);return this}$(t){return this.domElement.querySelector(t)}}class g extends m{#n;#i;#o;constructor(t){super(e("div",{className:"muigui-controller"})),this.#n=[],this.#i=[],t&&this.domElement.classList.add(t)}get parent(){return this.#o}setParent(t){this.#o=t,this.enable(!this.disabled())}show(t=!0){return this.domElement.classList.toggle("muigui-hide",!t),this.domElement.classList.toggle("muigui-show",t),this}hide(){return this.show(!1)}disabled(){return!!this.domElement.closest(".muigui-disabled")}enable(t=!0){return this.domElement.classList.toggle("muigui-disabled",!t),["input","button","select","textarea"].forEach((t=>{this.domElement.querySelectorAll(t).forEach((t=>{const e=!!t.closest(".muigui-disabled");t.disabled=e}))})),this}disable(t=!0){return this.enable(!t)}onChange(t){return this.removeChange(t),this.#n.push(t),this}removeChange(t){return i(this.#n,t),this}onFinishChange(t){return this.removeFinishChange(t),this.#i.push(t),this}removeFinishChange(t){return i(this.#i,t),this}#r(t,e){for(const n of t)n.call(this,e)}emitChange(t,e,n){this.#r(this.#n,t),this.#o&&(void 0===e?this.#o.emitChange(t):this.#o.emitChange({object:e,property:n,value:t,controller:this}))}emitFinalChange(t,e,n){this.#r(this.#i,t),this.#o&&(void 0===e?this.#o.emitChange(t):this.#o.emitFinalChange({object:e,property:n,value:t,controller:this}))}updateDisplay(){}getColors(){const t=t=>t.replace(/-([a-z])/g,((t,e)=>e.toUpperCase())),n=e("div");this.domElement.appendChild(n);const i=Object.fromEntries(["color","bg-color","value-color","value-bg-color","hover-bg-color","menu-bg-color","menu-sep-color","disabled-color"].map((e=>{n.style.color=`var(--${e})`;const i=getComputedStyle(n);return[t(e),i.color]})));return n.remove(),i}}class f extends g{#s;#a;#l;#u={name:""};constructor(t,n,i={}){super("muigui-button",""),this.#s=t,this.#a=n,this.#l=this.addElem(e("button",{type:"button",onClick:()=>{this.#s[this.#a](this)}})),this.setOptions({name:n,...i})}setOptions(t){l(this.#u,t);const{name:e}=this.#u;this.#l.textContent=e}}function b(t,e){if(t.length!==e.length)return!1;for(let n=0;n{t.setValue(i.checked)},onChange:()=>{t.setFinalValue(i.checked)}});super(e("label",{},[i])),this.#b=i}updateDisplay(t){this.#b.checked=t}}const w=[],y=new Set;let k,E;function $(){k=void 0,E=!0;for(const t of w)y.has(t)||t();E=!1,y.size&&(E?C():(y.forEach((t=>{i(w,t)})),y.clear())),C()}function C(){!k&&w.length&&(k=requestAnimationFrame($))}let V=0;function I(){return"muigui-"+ ++V}class M extends m{constructor(t=""){super(e("div",{className:"muigui-value"})),t&&this.domElement.classList.add(t)}}class S extends g{#v;#x;constructor(t="",n=""){super("muigui-label-controller"),this.#v=I(),this.#x=e("label",{for:this.#v}),this.domElement.appendChild(this.#x),this.pushSubView(new M(t)),this.name(n)}get id(){return this.#v}name(t){return this.#x.title===this.#x.textContent&&(this.#x.title=t),this.#x.textContent=t,this}tooltip(t){this.#x.title=t}}class D extends S{#s;#a;#w;#y;#e;#k;constructor(t,e,n=""){super(n,e),this.#s=t,this.#a=e,this.#w=this.getValue(),this.#y=!1,this.#e=[]}get initialValue(){return this.#w}get object(){return this.#s}get property(){return this.#a}add(t){return this.#e.push(t),super.add(t),this.updateDisplay(),t}#E(t,e){let n=!1;if("object"==typeof t){const e=this.#s[this.#a];if(Array.isArray(t)||r(t))for(let i=0;i=0&&w.splice(e,1)}(this.#k)),this}}class N extends D{constructor(t,e){super(t,e,"muigui-checkbox");const n=this.id;this.add(new x(this,n)),this.updateDisplay()}}const F={to:t=>t,from:t=>[!0,t]},A={to:t=>t.toString(),from:t=>{const e=parseFloat(t);return[!Number.isNaN(e),e]}},U={radToDeg:c({to:[0,180],from:[0,Math.PI]})};function L(){let t=0;return function(e,n,i=5){t-=e.deltaY*n/i;const o=Math.floor(Math.abs(t)/n)*Math.sign(t)*n;return t-=o,o}}class O extends v{#$;#C;#V;#I;#u={step:.01,converters:A,min:Number.NEGATIVE_INFINITY,max:Number.POSITIVE_INFINITY};constructor(t,n){const i=t.setValue.bind(t),r=t.setFinalValue.bind(t),a=L();super(e("input",{type:"number",onInput:()=>this.#M(i,!0),onChange:()=>this.#M(r,!1),onWheel:e=>{e.preventDefault();const{min:n,max:i,step:r}=this.#u,l=a(e,r),u=parseFloat(this.domElement.value),c=o(s(u+l,(t=>t),r),n,i);t.setValue(c)}})),this.setOptions(n)}#M(t,e){const n=parseFloat(this.domElement.value),[i,r]=this.#C(n);let s;if(i&&!Number.isNaN(n)){const{min:n,max:i}=this.#u;s=r>=n&&r<=i,this.#I=e,t(o(r,n,i))}this.domElement.classList.toggle("muigui-invalid-value",!i||!s)}updateDisplay(t){this.#I||(this.domElement.value=s(t,this.#$,this.#V)),this.#I=!1}setOptions(t){l(this.#u,t);const{step:e,converters:{to:n,from:i}}=this.#u;return this.#$=n,this.#C=i,this.#V=e,this}}class j extends D{#S;#V;constructor(t,e,n={}){super(t,e,"muigui-checkbox"),this.#S=this.add(new O(this,n)),this.updateDisplay()}}class T extends v{#D;constructor(t,n){const i=[];super(e("select",{onChange:()=>{t.setFinalValue(this.#D[this.domElement.selectedIndex])}},n.map((([t,n])=>(i.push(n),e("option",{textContent:t})))))),this.#D=i}updateDisplay(t){const e=this.#D.indexOf(t);this.domElement.selectedIndex=e}}function H(t,e){return Array.isArray(t)?Array.isArray(t[0])?t:e?t.map(((t,e)=>[t,e])):t.map((t=>[t,t])):[...Object.entries(t)]}class z extends D{constructor(t,e,n){super(t,e,"muigui-select");const i="number"==typeof this.getValue(),{keyValues:o}=n,r=H(o,i);this.add(new T(this,r)),this.updateDisplay()}}class P extends v{#$;#C;#V;#I;#u={step:.01,min:0,max:1,converters:F};constructor(t,n){const i=L();super(e("input",{type:"range",onInput:()=>{this.#I=!0;const{min:e,max:n,step:i}=this.#u,r=parseFloat(this.domElement.value),a=o(s(r,(t=>t),i),e,n),[l,u]=this.#C(a);l&&t.setValue(u)},onChange:()=>{this.#I=!0;const{min:e,max:n,step:i}=this.#u,r=parseFloat(this.domElement.value),a=o(s(r,(t=>t),i),e,n),[l,u]=this.#C(a);l&&t.setFinalValue(u)},onWheel:e=>{e.preventDefault();const[n,r]=this.#C(parseFloat(this.domElement.value));if(!n)return;const{min:a,max:l,step:u}=this.#u,c=i(e,u),h=o(s(r+c,(t=>t),u),a,l);t.setValue(h)}})),this.setOptions(n)}updateDisplay(t){this.#I||(this.domElement.value=s(t,this.#$,this.#V)),this.#I=!1}setOptions(t){l(this.#u,t);const{step:e,min:n,max:i,converters:{to:o,from:r}}=this.#u;return this.#$=o,this.#C=r,this.#V=e,this.domElement.step=e,this.domElement.min=n,this.domElement.max=i,this}}class B extends D{constructor(t,e,n){super(t,e,"muigui-range"),this.add(new P(this,n)),this.add(new O(this,n))}}class G extends v{#$;#C;#I;#u={converters:F};constructor(t,n){const i=t.setValue.bind(t),o=t.setFinalValue.bind(t);super(e("input",{type:"text",onInput:()=>this.#M(i,!0),onChange:()=>this.#M(o,!1)})),this.setOptions(n)}#M(t,e){const[n,i]=this.#C(this.domElement.value);n&&(this.#I=e,t(i)),this.domElement.style.color=n?"":"var(--invalid-color)"}updateDisplay(t){this.#I||(this.domElement.value=this.#$(t),this.domElement.style.color=""),this.#I=!1}setOptions(t){l(this.#u,t);const{converters:{to:e,from:n}}=this.#u;return this.#$=e,this.#C=n,this}}class R extends D{constructor(t,e){super(t,e,"muigui-checkbox"),this.add(new G(this)),this.updateDisplay()}}const Y=(t,e,n)=>Math.max(e,Math.min(n,t)),K=(t,e,n)=>t+(e-t)*n,W=t=>t>=0?t%1:1-t%1,q=t=>+t.toFixed(0),J=t=>+t.toFixed(3),_=t=>parseInt(t.substring(1,3),16)<<16|parseInt(t.substring(3,5),16)<<8|parseInt(t.substring(5,7),16),X=t=>parseInt(t.substring(1,3),16)*2**24+65536*parseInt(t.substring(3,5),16)+256*parseInt(t.substring(5,7),16)+parseInt(t.substring(7,9),16),Z=t=>[parseInt(t.substring(1,3),16),parseInt(t.substring(3,5),16),parseInt(t.substring(5,7),16)],Q=t=>`#${Array.from(t).map((t=>t.toString(16).padStart(2,"0"))).join("")}`,tt=t=>[parseInt(t.substring(1,3),16),parseInt(t.substring(3,5),16),parseInt(t.substring(5,7),16),parseInt(t.substring(7,9),16)],et=t=>`#${Array.from(t).map((t=>t.toString(16).padStart(2,"0"))).join("")}`,nt=t=>Z(t).map((t=>J(t/255))),it=t=>Q(Array.from(t).map((t=>Math.round(Y(255*t,0,255))))),ot=t=>tt(t).map((t=>J(t/255))),rt=t=>et(Array.from(t).map((t=>Math.round(Y(255*t,0,255))))),st=t=>Y(Math.round(255*t),0,255).toString(16).padStart(2,"0"),at=t=>({r:parseInt(t.substring(1,3),16)/255,g:parseInt(t.substring(3,5),16)/255,b:parseInt(t.substring(5,7),16)/255}),lt=t=>({r:parseInt(t.substring(1,3),16)/255,g:parseInt(t.substring(3,5),16)/255,b:parseInt(t.substring(5,7),16)/255,a:parseInt(t.substring(7,9),16)/255}),ut=t=>`rgb(${Z(t).join(", ")})`,ct=/^\s*rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)\s*$/,ht=t=>`rgba(${tt(t).map(((t,e)=>3===e?t/255:t)).join(", ")})`,dt=/^\s*rgba\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+\.\d+|\d+)\s*\)\s*$/,pt=t=>{const e=yt(Z(t)).map((t=>q(t)));return`hsl(${e[0]}, ${e[1]}%, ${e[2]}%)`},mt=t=>{const e=kt(tt(t)).map(((t,e)=>3===e?J(t):q(t)));return`hsl(${e[0]} ${e[1]}% ${e[2]}% / ${e[3]})`},gt=/^\s*hsl\(\s*(\d+)(?:deg|)\s*(?:,|)\s*(\d+)%\s*(?:,|)\s*(\d+)%\s*\)\s*$/,ft=/^\s*hsl\(\s*(\d+)(?:deg|)\s*(?:,|)\s*(\d+)%\s*(?:,|)\s*(\d+)%\s*\/\s*(\d+\.\d+|\d+)\s*\)\s*$/,bt=(t,e)=>(t%e+e)%e;function vt([t,e,n]){t=bt(t,360),e=Y(e/100,0,1),n=Y(n/100,0,1);const i=e*Math.min(n,1-n);function o(e){const o=(e+t/30)%12;return n-i*Math.max(-1,Math.min(o-3,9-o,1))}return[o(0),o(8),o(4)].map((t=>Math.round(255*t)))}function xt([t,e,n]){const i=Math.max(t,e,n),o=Math.min(t,e,n),r=.5*(o+i),s=i-o;let a=0,l=0;if(0!==s)switch(l=0===r||1===r?0:(i-r)/Math.min(r,1-r),i){case t:a=(e-n)/s+(e{const[e,n,i]=xt(t.map((t=>t/255)));return[360*e,100*n,100*i]},kt=t=>{const[e,n,i,o]=wt(t.map((t=>t/255)));return[360*e,100*n,100*i,o]};function Et([t,e,n]){return e=Y(e,0,1),n=Y(n,0,1),[t,t+2/3,t+1/3].map((t=>K(1,Y(Math.abs(6*W(t)-3)-1,0,1),e)*n))}function $t([t,e,n,i]){return[...Et([t,e,n]),i]}const Ct=t=>Math.round(1e3*t)/1e3;function Vt([t,e,n]){const i=n>e?[n,e,-1,2/3]:[e,n,0,-1/3],o=i[0]>t?[i[0],i[1],i[3],t]:[t,i[1],i[2],i[0]],r=o[0]-Math.min(o[3],o[1]);return[Math.abs(o[2]+(o[3]-o[1])/(6*r+Number.EPSILON)),r/(o[0]+Number.EPSILON),o[0]].map(Ct)}const It=t=>t.endsWith("a")||t.startsWith("hex8"),Mt=[{re:/^#(?:[0-9a-f]){6}$/i,format:"hex6"},{re:/^(?:[0-9a-f]){6}$/i,format:"hex6-no-hash"},{re:/^#(?:[0-9a-f]){8}$/i,format:"hex8"},{re:/^(?:[0-9a-f]){8}$/i,format:"hex8-no-hash"},{re:/^#(?:[0-9a-f]){3}$/i,format:"hex3"},{re:/^(?:[0-9a-f]){3}$/i,format:"hex3-no-hash"},{re:ct,format:"css-rgb"},{re:gt,format:"css-hsl"},{re:dt,format:"css-rgba"},{re:ft,format:"css-hsla"}];function St(t){switch(typeof t){case"number":return console.warn('can not reliably guess format based on a number. You should pass in a format like {format: "uint32-rgb"} or {format: "uint32-rgb"}'),t<=16777215?"uint32-rgb":"uint32-rgba";case"string":{const e=function(t){for(const e of Mt)if(e.re.test(t))return e}(t.trim());if(e)return e.format;break}case"object":if(t instanceof Uint8Array||t instanceof Uint8ClampedArray){if(3===t.length)return"uint8-rgb";if(4===t.length)return"uint8-rgba"}else if(t instanceof Float32Array){if(3===t.length)return"float-rgb";if(4===t.length)return"float-rgba"}else if(Array.isArray(t)){if(3===t.length)return"float-rgb";if(4===t.length)return"float-rgba"}else if("r"in t&&"g"in t&&"b"in t)return"a"in t?"object-rgba":"object-rgb"}throw new Error(`unknown color format: ${t}`)}function Dt(t){return t.trim(t)}function Nt(t){return t.trim(t)}function Ft(t){return t[1]===t[2]&&t[3]===t[4]&&t[5]===t[6]?`#${t[1]}${t[3]}${t[5]}`:t}const At=/^(#|)([0-9a-f]{3})$/i;function Ut(t){const e=At.exec(t);if(e){const[,,t]=e;return"#"+`${(n=t)[0]}${n[0]}${n[1]}${n[1]}${n[2]}${n[2]}`}var n;return t}function Lt(t){return Ft(Dt(t))}const Ot=t=>{const e=ct.exec(t);if(!e)return[!1];const n=[e[1],e[2],e[3]].map((t=>parseInt(t)));return[!n.find((t=>t>255)),`rgb(${n.join(", ")})`]},jt=t=>{const e=dt.exec(t);if(!e)return[!1];const n=[e[1],e[2],e[3],e[4]].map(((t,e)=>3===e?parseFloat(t):parseInt(t)));return[!n.find((t=>t>255)),`rgba(${n.join(", ")})`]},Tt=t=>{const e=gt.exec(t);if(!e)return[!1];const n=[e[1],e[2],e[3]].map((t=>parseFloat(t)));return[!n.find((t=>Number.isNaN(t))),`hsl(${n[0]}, ${n[1]}%, ${n[2]}%)`]},Ht=t=>{const e=ft.exec(t);if(!e)return[!1];const n=[e[1],e[2],e[3],e[4]].map((t=>parseFloat(t)));return[!n.find((t=>Number.isNaN(t))),`hsl(${n[0]} ${n[1]}% ${n[2]}% / ${n[3]})`]},zt=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*$/,Pt=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*$/,Bt=/^\s*(?:0x){0,1}([0-9a-z]{1,6})\s*$/i,Gt=/^\s*(?:0x){0,1}([0-9a-z]{1,8})\s*$/i,Rt=/^\s*#[a-f0-9]{6}\s*$|^\s*#[a-f0-9]{3}\s*$/i,Yt=/^\s*[a-f0-9]{6}\s*$/i,Kt=/^\s*#[a-f0-9]{8}\s*$/i,Wt=/^\s*[a-f0-9]{8}\s*$/i,qt={hex6:{color:{from:t=>[!0,t],to:Dt},text:{from:t=>[Rt.test(t),t.trim()],to:t=>t}},hex8:{color:{from:t=>[!0,t],to:Nt},text:{from:t=>[Kt.test(t),t.trim()],to:t=>t}},hex3:{color:{from:t=>[!0,Lt(t)],to:Ut},text:{from:t=>[Rt.test(t),Ft(t.trim())],to:t=>t}},"hex6-no-hash":{color:{from:t=>[!0,t.substring(1)],to:t=>`#${Dt(t)}`},text:{from:t=>[Yt.test(t),t.trim()],to:t=>t}},"hex8-no-hash":{color:{from:t=>[!0,t.substring(1)],to:t=>`#${Nt(t)}`},text:{from:t=>[Wt.test(t),t.trim()],to:t=>t}},"hex3-no-hash":{color:{from:t=>[!0,Lt(t).substring(1)],to:Ut},text:{from:t=>[Yt.test(t),Ft(t.trim())],to:t=>t}},"uint32-rgb":{color:{from:t=>[!0,_(t)],to:t=>`#${Math.round(t).toString(16).padStart(6,"0")}`},text:{from:t=>(t=>{const e=Bt.exec(t);return e?[!0,parseInt(e[1],16)]:[!1]})(t),to:t=>`0x${t.toString(16).padStart(6,"0")}`}},"uint32-rgba":{color:{from:t=>[!0,X(t)],to:t=>`#${Math.round(t).toString(16).padStart(8,"0")}`},text:{from:t=>(t=>{const e=Gt.exec(t);return e?[!0,parseInt(e[1],16)]:[!1]})(t),to:t=>`0x${t.toString(16).padStart(8,"0")}`}},"uint8-rgb":{color:{from:t=>[!0,Z(t)],to:Q},text:{from:t=>{const e=zt.exec(t);if(!e)return[!1];const n=[e[1],e[2],e[3]].map((t=>parseInt(t)));return[!n.find((t=>t>255)),n]},to:t=>t.join(", ")}},"uint8-rgba":{color:{from:t=>[!0,tt(t)],to:et},text:{from:t=>{const e=Pt.exec(t);if(!e)return[!1];const n=[e[1],e[2],e[3],e[4]].map((t=>parseInt(t)));return[!n.find((t=>t>255)),n]},to:t=>t.join(", ")}},"float-rgb":{color:{from:t=>[!0,nt(t)],to:it},text:{from:t=>{const e=t.split(",").map((t=>t.trim())),n=e.map((t=>parseFloat(t)));if(3!==n.length)return[!1];const i=e.findIndex((t=>isNaN(t)));return[i<0,n.map((t=>J(t)))]},to:t=>Array.from(t).map((t=>J(t))).join(", ")}},"float-rgba":{color:{from:t=>[!0,ot(t)],to:rt},text:{from:t=>{const e=t.split(",").map((t=>t.trim())),n=e.map((t=>parseFloat(t)));if(4!==n.length)return[!1];const i=e.findIndex((t=>isNaN(t)));return[i<0,n.map((t=>J(t)))]},to:t=>Array.from(t).map((t=>J(t))).join(", ")}},"object-rgb":{color:{from:t=>[!0,at(t)],to:t=>`#${st(t.r)}${st(t.g)}${st(t.b)}`},text:{from:t=>{try{const e=t.replace(/([a-z])/g,'"$1"'),n=JSON.parse(e);if(Number.isNaN(n.r)||Number.isNaN(n.g)||Number.isNaN(n.b))throw new Error("not {r, g, b}");return[!0,n]}catch(t){return[!1]}},to:t=>`{r:${J(t.r)}, g:${J(t.g)}, b:${J(t.b)}}`}},"object-rgba":{color:{from:t=>[!0,lt(t)],to:t=>`#${st(t.r)}${st(t.g)}${st(t.b)}${st(t.a)}`},text:{from:t=>{try{const e=t.replace(/([a-z])/g,'"$1"'),n=JSON.parse(e);if(Number.isNaN(n.r)||Number.isNaN(n.g)||Number.isNaN(n.b)||Number.isNaN(n.a))throw new Error("not {r, g, b, a}");return[!0,n]}catch(t){return[!1]}},to:t=>`{r:${J(t.r)}, g:${J(t.g)}, b:${J(t.b)}}, a:${J(t.a)}}`}},"css-rgb":{color:{from:t=>[!0,ut(t)],to:t=>{const e=ct.exec(t);return Q([e[1],e[2],e[3]].map((t=>parseInt(t))))}},text:{from:Ot,to:t=>Ot(t)[1]}},"css-rgba":{color:{from:t=>[!0,ht(t)],to:t=>{const e=dt.exec(t);return et([e[1],e[2],e[3],e[4]].map(((t,e)=>3===e?255*parseFloat(t)|0:parseInt(t))))}},text:{from:jt,to:t=>jt(t)[1]}},"css-hsl":{color:{from:t=>[!0,pt(t)],to:t=>{const e=gt.exec(t),n=vt([e[1],e[2],e[3]].map((t=>parseFloat(t))));return Q(n)}},text:{from:Tt,to:t=>Tt(t)[1]}},"css-hsla":{color:{from:t=>[!0,mt(t)],to:t=>{const e=ft.exec(t),n=function([t,e,n,i]){return[...vt([t,e,n]),255*i|0]}([e[1],e[2],e[3],e[4]].map((t=>parseFloat(t))));return et(n)}},text:{from:Ht,to:t=>Ht(t)[1]}}};class Jt extends m{constructor(t,n){super(e(t,{className:n}))}}class _t extends S{#N;constructor(){super("muigui-canvas"),this.#N=this.add(new Jt("canvas","muigui-canvas")).domElement}get canvas(){return this.#N}}class Xt extends v{#$;#C;#F;#I;#u={converters:F};constructor(t,n){const i=e("input",{type:"color",onInput:()=>{const[e,n]=this.#C(i.value);e&&(this.#I=!0,t.setValue(n))},onChange:()=>{const[e,n]=this.#C(i.value);e&&(this.#I=!0,t.setFinalValue(n))}});super(e("div",{},[i])),this.setOptions(n),this.#F=i}updateDisplay(t){this.#I||(this.#F.value=this.#$(t)),this.#I=!1}setOptions(t){l(this.#u,t);const{converters:{to:e,from:n}}=this.#u;return this.#$=e,this.#C=n,this}}class Zt extends D{#A;#S;constructor(t,e,n={}){super(t,e,"muigui-color");const i=n.format||St(this.getValue()),{color:o,text:r}=qt[i];this.#A=this.add(new Xt(this,{converters:o})),this.#S=this.add(new G(this,{converters:r})),this.updateDisplay()}setOptions(t){const{format:e}=t;if(e){const{color:t,text:n}=qt[e];this.#A.setOptions({converters:t}),this.#S.setOptions({converters:n})}return super.setOptions(t),this}}class Qt extends g{constructor(){super("muigui-divider")}}class te extends g{#U;#L;constructor(t){super(t),this.#U=[],this.#L=this}get children(){return this.#U}get controllers(){return this.#U.filter((t=>!(t instanceof te)))}get folders(){return this.#U.filter((t=>t instanceof te))}reset(t=!0){for(const e of this.#U)e instanceof te&&!t||e.reset(t);return this}updateDisplay(){for(const t of this.#U)t.updateDisplay();return this}remove(t){const e=this.#U.indexOf(t);if(e>=0){const t=this.#U.splice(e,1)[0];t.domElement.remove(),t.setParent(null)}return this}#O(t){return this.domElement.appendChild(t.domElement),this.#U.push(t),t.setParent(this),t}addController(t){return this.#L.#O(t)}pushContainer(t){return this.addController(t),this.#L=t,t}popContainer(){return this.#L=this.#L.parent,this}}class ee extends te{#j;constructor(t="Controls",n="muigui-menu"){super(n),this.#j=e("label"),this.addElem(e("button",{type:"button",onClick:()=>this.toggleOpen()},[this.#j])),this.pushContainer(new te),this.name(t),this.open()}open(t=!0){return this.domElement.classList.toggle("muigui-closed",!t),this.domElement.classList.toggle("muigui-open",t),this}close(){return this.open(!1)}name(t){return this.#j.textContent=t,this}title(t){return this.name(t)}toggleOpen(){return this.open(!this.domElement.classList.contains("muigui-open")),this}}class ne extends g{constructor(t){super("muigui-label"),this.text(t)}text(t){return this.domElement.textContent=t,this}}function ie(){}function oe(t,e,n){const i=t.getBoundingClientRect(),o=e.clientX-i.left,r=e.clientY-i.top,s=o/i.width,a=r/i.height,l=o-(n=n||[o,r])[0],u=r-n[1];return{x:o,y:r,nx:s,ny:a,dx:l,dy:u,ndx:l/i.width,ndy:u/i.width}}function re(t,{onDown:e=ie,onMove:n=ie,onUp:i=ie}){let o;const r=function(e){const i={type:"move",...oe(t,e,o)};n(i)},s=function(e){t.releasePointerCapture(e.pointerId),t.removeEventListener("pointermove",r),t.removeEventListener("pointerup",s),document.body.style.backgroundColor="",i("up")},a=function(n){t.addEventListener("pointermove",r),t.addEventListener("pointerup",s),t.setPointerCapture(n.pointerId);const i=oe(t,n);o=[i.x,i.y],e({type:"down",...i})};return t.addEventListener("pointerdown",a),function(){t.removeEventListener("pointerdown",a)}}function se(t){return t.querySelectorAll("[data-src]").forEach((e=>{const i="muigui-id-"+n++;e.id=i,t.querySelectorAll(`[data-target=${e.dataset.src}]`).forEach((t=>{t.setAttribute("fill",`url(#${i})`)}))})),t}class ae extends v{#$;#C;#T;#H;#z;#P;#B;#G;#R;#Y;#K;#W;#q;#J;#u={converters:F,alpha:!1};#_;#X;constructor(t,n){super(e("div",{innerHTML:'\n\n\n\n',className:"muigui-no-scroll"})),this.#T=this.domElement.children[0],this.#z=this.domElement.children[1],this.#G=this.domElement.children[2],se(this.#T),se(this.#z),se(this.#G),this.#H=this.$(".muigui-color-chooser-circle"),this.#P=this.$("[data-src=muigui-color-chooser-hue]"),this.#B=this.$(".muigui-color-chooser-hue-cursor"),this.#R=this.$("[data-src=muigui-color-chooser-alpha]"),this.#Y=this.$(".muigui-color-chooser-alpha-cursor");const i=e=>{const n=o(e.nx,0,1),i=o(e.ny,0,1);this.#K[1]=n,this.#K[2]=1-i,this.#W=!0,this.#J=!0;const[r,s]=this.#C(this.#_(this.#K));r&&t.setValue(s)},r=e=>{const n=o(e.nx,0,1);this.#K[0]=n,this.#q=!0,this.#J=!0;const[i,r]=this.#C(this.#_(this.#K));i&&t.setValue(r)},s=e=>{const n=o(e.nx,0,1);this.#K[3]=n,this.#W=!0,this.#q=!0;const[i,r]=this.#C(this.#_(this.#K));i&&t.setValue(r)};re(this.#T,{onDown:i,onMove:i}),re(this.#z,{onDown:r,onMove:r}),re(this.#G,{onDown:s,onMove:s}),this.setOptions(n)}updateDisplay(t){this.#K||(this.#K=this.#X(this.#$(t)));{const[e,n,i,o=1]=this.#X(this.#$(t));this.#W||(this.#K[0]=n>.001&&i>.001?e:this.#K[0]),this.#q||(this.#K[1]=n,this.#K[2]=i),this.#J||(this.#K[3]=o)}{const[t,e,n,i]=this.#K,[o,r,s]=wt($t(this.#K));this.#W||this.#B.setAttribute("transform",`translate(${64*t}, 0)`),this.#P.children[0].setAttribute("stop-color",`hsl(${360*o} 0% 100% / ${i})`),this.#P.children[1].setAttribute("stop-color",`hsl(${360*o} 100% 50% / ${i})`),this.#J||this.#Y.setAttribute("transform",`translate(${64*i}, 0)`),this.#R.children[0].setAttribute("stop-color",`hsl(${360*o} ${100*r}% ${100*s}% / 0)`),this.#R.children[1].setAttribute("stop-color",`hsl(${360*o} ${100*r}% ${100*s}% / 1)`),this.#q||(this.#H.setAttribute("cx",""+64*e),this.#H.setAttribute("cy",""+48*(1-n)))}this.#W=!1,this.#q=!1,this.#J=!1}setOptions(t){l(this.#u,t);const{converters:{to:e,from:n},alpha:i}=this.#u;return this.#G.style.display=i?"":"none",this.#_=i?t=>rt($t(t)):t=>it(Et(t)),this.#X=i?t=>function([t,e,n,i]){return[...Vt([t,e,n]),i]}(ot(t)):t=>Vt(nt(t)),this.#$=e,this.#C=n,this}}class le extends D{#Z;#Q;#b;#tt;#u={open:!1};constructor(t,n,i={}){super(t,n,"muigui-pop-down-controller"),this.#Z=this.add(new Jt("div","muigui-pop-down-top"));const o=this.#Z.addElem(e("input",{type:"checkbox",onChange:()=>{this.#u.open=o.checked,this.updateDisplay()}}));this.#b=o,this.#Q=this.#Z.add(new Jt("div","muigui-pop-down-values")),this.#tt=this.add(new Jt("div","muigui-pop-down-bottom")),this.setOptions(i)}setKnobColor(t){this.#b&&(this.#b.style=`\n --range-color: ${t};\n --value-bg-color: ${t};\n `)}updateDisplay(){super.updateDisplay();const{open:t}=this.#u;this.domElement.children[1].classList.toggle("muigui-open",t),this.domElement.children[1].classList.toggle("muigui-closed",!t)}setOptions(t){l(this.#u,t),super.setOptions(t),this.updateDisplay()}addTop(t){return this.#Q.add(t)}addBottom(t){return this.#tt.add(t)}}class ue extends le{#A;#S;#$;#et;constructor(t,e,n={}){super(t,e,"muigui-color-chooser");const i=n.format||St(this.getValue()),{color:o,text:r}=qt[i];this.#$=o.to,this.#S=new G(this,{converters:r,alpha:It(i)}),this.#A=new ae(this,{converters:o,alpha:It(i)}),this.addTop(this.#S),this.addBottom(this.#A),this.#et=()=>{if(this.#$){const t=this.#$(this.getValue()),e=yt(Z(t));e[2]=(e[2]+50)%100;const n=Q(vt(e));this.setKnobColor(`${t.substring(0,7)}FF`,n)}},this.updateDisplay()}updateDisplay(){super.updateDisplay(),this.#et&&this.#et()}setOptions(t){return super.setOptions(t),this}}class ce extends ee{add(t,e,...n){const i=t instanceof g?t:function(t,e,...n){const[i]=n;if(Array.isArray(i))return new z(t,e,{keyValues:i});const o=typeof t[e];switch(o){case"number":if("number"==typeof n[0]&&"number"==typeof n[1]){const i=n[0],o=n[1],r=n[2];return new B(t,e,{min:i,max:o,...r&&{step:r}})}return 0===n.length?new j(t,e,...n):new B(t,e,...n);case"boolean":return new N(t,e,...n);case"function":return new f(t,e,...n);case"string":return new R(t,e,...n);case"undefined":throw new Error(`no property named ${e}`);default:throw new Error(`unhandled type ${o} for property ${e}`)}}(t,e,...n);return this.addController(i)}addCanvas(t){return this.addController(new _t(t))}addColor(t,e,n={}){const i=t[e];return It(n.format||St(i))?this.addController(new ue(t,e,n)):this.addController(new Zt(t,e,n))}addDivider(){return this.addController(new Qt)}addFolder(t){return this.addController(new ce(t))}addLabel(t){return this.addController(new ne(t))}}class he extends HTMLElement{constructor(){super(),this.shadow=this.attachShadow({mode:"open"})}}customElements.define("muigui-element",he);const de=new CSSStyleSheet;de.replaceSync(t.default);const pe=new CSSStyleSheet;function me(t){let e,n;function i(){if(e&&!n){const o=e;e=void 0,n=t.replace(o).then((()=>{n=void 0,i()}))}}return function(t){e=t,i()}}const ge=me(de),fe=me(pe);class be extends ce{static converters=U;static mapRange=u;static makeRangeConverters=c;static makeRangeOptions=h;static makeMinMaxPair=p;#nt=new CSSStyleSheet;constructor(t={}){super("Controls","muigui-root"),t instanceof HTMLElement&&(t={parent:t});const{autoPlace:n=!0,width:i,title:o="Controls"}=t;let{parent:r}=t;if(i&&(this.domElement.style.width=/^\d+$/.test(i)?`${i}px`:i),void 0===r&&n&&(r=document.body,this.domElement.classList.add("muigui-auto-place")),r){const t=e("muigui-element");t.shadowRoot.adoptedStyleSheets=[de,pe,this.#nt],t.shadow.appendChild(this.domElement),r.appendChild(t)}o&&this.title(o),this.domElement.classList.add("muigui","muigui-colors")}setStyle(t){this.#nt.replace(t)}static setBaseStyles(t){ge(t)}static getBaseStyleSheet(){return de}static setUserStyles(t){fe(t)}static getUserStyleSheet(){return pe}static setTheme(e){be.setBaseStyles(`${t.default}\n${t.themes[e]||""}`)}}function ve(){}const xe={ArrowLeft:[-1,0],ArrowRight:[1,0],ArrowUp:[0,-1],ArrowDown:[0,1]};function we(t,{onDown:e=ve,onUp:n=ve}){const i=function(t){const i=t.shiftKey?10:1,[o,r]=(xe[t.key]||[0,0]).map((t=>t*i));("keydown"===t.type?e:n)({type:t.type.substring(3),dx:o,dy:r,event:t})};return t.addEventListener("keydown",i),t.addEventListener("keyup",i),function(){t.removeEventListener("keydown",i),t.removeEventListener("keyup",i)}}function ye(t,e=""){if(!t)throw new Error(e)}function ke(t,e,n,i,o,r){const s=Math.abs(n)*Math.cos(r),a=Math.abs(i)*Math.sin(r);return[t+Math.cos(o)*s-Math.sin(o)*a,e+Math.sin(o)*s+Math.cos(o)*a]}function Ee(t,e,n,i,o){ye(Math.abs(i-o)<=2*Math.PI),ye(i>=-Math.PI&&i<=2*Math.PI),ye(i<=o),ye(o>=-Math.PI&&o<=4*Math.PI);const{x1:r,y1:s,x2:a,y2:l,fa:u,fs:c}=function(t,e,n,i,o,r,s){const[a,l]=ke(t,e,n,i,o,r),[u,c]=ke(t,e,n,i,o,r+s);return{x1:a,y1:l,x2:u,y2:c,fa:Math.abs(s)>Math.PI?1:0,fs:s>0?1:0}}(t,e,n,n,0,i,o-i);return Math.abs(Math.abs(i-o)-2*Math.PI)>Number.EPSILON?`M${t} ${e} L${r} ${s} A ${n} ${n} 0 ${u} ${c} ${a} ${l} L${t} ${e}`:`M${r} ${s} L${r} ${s} A ${n} ${n} 0 ${u} ${c} ${a} ${l}`}const $e=t=>a(t+Math.PI,2*Math.PI)-Math.PI;class Ce extends v{#it;#ot;#rt;#st;#u={step:1,min:-180,max:180,dirMin:-Math.PI,dirMax:Math.PI,wrap:void 0,converters:F};constructor(t,n={}){const i=L();super(e("div",{className:"muigui-direction muigui-no-scroll",innerHTML:'\n\n',onWheel:e=>{e.preventDefault();const{min:n,max:r,step:l}=this.#u,u=i(e,l);let c=this.#rt+u;this.#st&&(c=a(c-n,r-n)+n);const h=o(s(c,(t=>t),l),n,r);t.setValue(h)}}));const r=e=>{const{min:n,max:i,step:r,dirMin:a,dirMax:l}=this.#u,u=2*e.nx-1,c=2*e.ny-1,h=Math.atan2(c,u),d=(a+l)/2,p=o(($e(h-d)-$e(a-d))/(l-a),0,1),m=s(n+(i-n)*p,(t=>t),r);t.setValue(m)};re(this.domElement,{onDown:r,onMove:r}),we(this.domElement,{onDown:e=>{const{min:n,max:i,step:r}=this.#u,a=o(s(this.#rt+e.dx*r,(t=>t),r),n,i);t.setValue(a)}}),this.#it=this.$("#muigui-arrow"),this.#ot=this.$("#muigui-range"),this.setOptions(n)}updateDisplay(t){this.#rt=t;const{min:e,max:n}=this.#u,i=(t-e)/(n-e),o=(r=this.#u.dirMin,s=this.#u.dirMax,r+(s-r)*i);var r,s;this.#it.style.transform=`rotate(${o}rad)`}setOptions(t){l(this.#u,t);const{dirMin:e,dirMax:n,wrap:i}=this.#u;this.#st=void 0!==i?i:Math.abs(e-n)>=2*Math.PI-Number.EPSILON;const[o,r]=e(o.push(i),e("label",{},[e("input",{type:"radio",name:r,value:a,onChange:function(){this.checked&&t.setFinalValue(s.#D[this.value])}}),e("button",{type:"button",textContent:n,onClick:function(){this.previousElementSibling.click()}})]))))));const s=this;this.#D=o,this.cols(i)}updateDisplay(t){const e=this.#D.indexOf(t);for(let t=0;t{e({rect:t.getBoundingClientRect(),elem:t})})).observe(t)}function Me(t,e,n,i){Ie(t,(({rect:o})=>{const{width:r,height:s}=o;t.setAttribute("viewBox",`-${r*e} -${s*n} ${r} ${s}`),i({elem:t,rect:o})}))}function Se(t,e,n,i,o,r){const a=[];tt),n)),e=Math.min(e,o);for(let i=t;i<=e;i+=n)a.push(`M${i} 0 l0 ${r}`);return a.join(" ")}class De extends v{#at;#lt;#ut;#ct;#ht;#dt;#pt;#mt;#gt;#rt;#ft;#u={min:-100,max:100,step:1,unit:10,unitSize:10,ticksPerUnit:5,labelFn:t=>t,tickHeight:1,limits:!0,thicksColor:void 0,orientation:void 0};constructor(t,n){const i=L();let r;super(e("div",{innerHTML:'\n\n',className:"muigui-no-v-scroll",onWheel:e=>{e.preventDefault();const{min:n,max:r,step:a}=this.#u,l=i(e,a),u=o(s(this.#rt+l,(t=>t),a),n,r);t.setValue(u)}})),this.#at=this.$("svg"),this.#lt=this.$("#muigui-origin"),this.#ut=this.$("#muigui-ticks"),this.#ct=this.$("#muigui-thicks"),this.#ht=this.$("#muigui-numbers"),this.#dt=this.$("#muigui-left-grad"),this.#pt=this.$("#muigui-right-grad"),this.setOptions(n),re(this.domElement,{onDown:()=>{r=this.#rt},onMove:e=>{const{min:n,max:i,unitSize:a,unit:l,step:u}=this.#u,c=o(s(r-e.dx/a*l,(t=>t),u),n,i);t.setValue(c)}}),we(this.domElement,{onDown:e=>{const{min:n,max:i,step:r}=this.#u,a=o(s(this.#rt+e.dx*r,(t=>t),r),n,i);t.setValue(a)}}),Me(this.#at,.5,0,(({rect:{width:t}})=>{this.#dt.setAttribute("x",-t/2),this.#pt.setAttribute("x",t/2-20),this.#ft=function(t){const e=t.innerHTML;t.innerHTML="- ";const n=t.querySelector("text").getComputedTextLength();return t.innerHTML=e,n}(this.#ht),this.#mt=t,this.#bt()}))}#bt(){if(!this.#mt||void 0===this.#rt)return;const{labelFn:t,limits:e,min:n,max:i,orientation:o,tickHeight:r,ticksPerUnit:a,unit:l,unitSize:u,thicksColor:c}=this.#u,h=Math.ceil(this.#mt/u),d=this.#rt/l,p=Math.round(d-h),m=p*u,g=(p+2*h)*u,f=e?n*u/l:m,b=e?i*u/l:g,v=""===t(1)?10:5;a>1&&this.#ut.setAttribute("d",Se(m,g,u/a,f,b,v*r)),this.#ct.style.stroke=c,this.#ct.setAttribute("d",Se(m,g,u,f,b,v)),this.#ht.innerHTML=function(t,e,n,i,o,r,a,l){const u=[];tt),n)),e=Math.min(e,a);const c=Math.max(0,-Math.log10(i));for(let r=t;r<=e;r+=n)u.push(`${h=r/n*i,l(h.toFixed(c))}`);var h;return u.join("\n")}(m,g,u,l,this.#ft,f,b,t),this.#lt.setAttribute("transform",`translate(${-this.#rt*u/l} 0)`),this.#at.classList.toggle("muigui-slider-up","up"===o)}updateDisplay(t){this.#rt=t,this.#bt()}setOptions(t){return l(this.#u,t),this}}class Ne extends v{#at;#it;#H;#rt=[];constructor(t){super(e("div",{innerHTML:'\n\n',className:"muigui-no-scroll"}));const n=e=>{const{width:n,height:i}=this.#at.getBoundingClientRect(),o=2*e.nx-1,r=2*e.ny-1;t.setValue([o*n*.5,r*i*.5])};re(this.domElement,{onDown:n,onMove:n}),this.#at=this.$("svg"),this.#it=this.$("#muigui-arrow"),this.#H=this.$("#muigui-circle"),Me(this.#at,.5,.5,(()=>this.#vt))}#vt(){const[t,e]=this.#rt;this.#it.setAttribute("d",`M0,0L${t},${e}`),this.#H.setAttribute("transform",`translate(${t}, ${e})`)}updateDisplay(t){this.#rt[0]=t[0],this.#rt[1]=t[1],this.#vt()}}return be.ColorChooser=ue,be.Direction=class extends le{#u;constructor(t,e,n){super(t,e,"muigui-direction"),this.#u=n,this.addTop(new O(this,F)),this.addBottom(new Ce(this,n)),this.updateDisplay()}},be.RadioGrid=class extends D{constructor(t,e,n){super(t,e,"muigui-radio-grid");const i="number"==typeof this.getValue(),{keyValues:o,cols:r=3}=n,s=H(o,i);this.add(new Ve(this,s,r)),this.updateDisplay()}},be.Range=B,be.Select=z,be.Slider=class extends D{constructor(t,e,n={}){super(t,e,"muigui-slider"),this.add(new De(this,n)),this.add(new O(this,n)),this.updateDisplay()}},be.TextNumber=j,be.Vec2=class extends le{constructor(t,e){super(t,e,"muigui-vec2");const n=t=>({setValue:e=>{const n=this.getValue();n[t]=e,this.setValue(n)},setFinalValue:e=>{const n=this.getValue();n[t]=e,this.setFinalValue(n)}});this.addTop(new O(n(0),{converters:{to:t=>t[0],from:A.from}})),this.addTop(new O(n(1),{converters:{to:t=>t[1],from:A.from}})),this.addBottom(new Ne(this)),this.updateDisplay()}},be}));
+!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).GUI=e()}(this,(function(){"use strict";var t={default:'\n.muigui {\n --bg-color: #ddd;\n --color: #222;\n --contrast-color: #eee;\n --value-color: #145 ;\n --value-bg-color: #eeee;\n --disabled-color: #999;\n --menu-bg-color: #f8f8f8;\n --menu-sep-color: #bbb;\n --hover-bg-color: #999;\n --focus-color: #8BF;\n --range-color: #AAA;\n --invalid-color: #FF0000;\n --selected-color: rgb(255, 255, 255, 0.9);\n\n --button-bg-color: var(--value-bg-color);\n\n --image-open: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPgogIDxyZWN0IHN0eWxlPSJmaWxsOiAjNDQ0OyIgeD0iMjAlIiB5PSI0NSUiIHdpZHRoPSI2MCUiIGhlaWdodD0iMTAlIj48L3JlY3Q+Cjwvc3ZnPg==);\n --image-closed: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPgogIDxyZWN0IHN0eWxlPSJmaWxsOiAjNDQ0OyIgeD0iNDUlIiB5PSIyMCUiIHdpZHRoPSIxMCUiIGhlaWdodD0iNjAlIj48L3JlY3Q+CiAgPHJlY3Qgc3R5bGU9ImZpbGw6ICM0NDQ7IiB4PSIyMCUiIHk9IjQ1JSIgd2lkdGg9IjYwJSIgaGVpZ2h0PSIxMCUiPjwvcmVjdD4KPC9zdmc+);\n --image-checkerboard: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPgogIDxyZWN0IHN0eWxlPSJmaWxsOiAjNDA0MDQwOyIgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSI+PC9yZWN0PgogIDxyZWN0IHN0eWxlPSJmaWxsOiAjODA4MDgwOyIgeD0iMCIgeT0iMCIgd2lkdGg9IjUwJSIgaGVpZ2h0PSI1MCUiPjwvcmVjdD4KICA8cmVjdCBzdHlsZT0iZmlsbDogIzgwODA4MDsiIHg9IjUwJSIgeT0iNTAlIiB3aWR0aD0iNTAlIiBoZWlnaHQ9IjUwJSI+PC9yZWN0Pgo8L3N2Zz4=);\n\n --range-left-color: var(--value-color);\n --range-right-color: var(--value-bg-color); \n --range-right-hover-color: var(--hover-bg-color);\n --button-image: \n linear-gradient(\n rgba(255, 255, 255, 1), rgba(0, 0, 0, 0.2)\n );\n\n color: var(--color);\n background-color: var(--bg-color);\n}\n\n@media (prefers-color-scheme: dark) {\n .muigui {\n --bg-color: #222222;\n --color: #dddddd;\n --contrast-color: #000;\n --value-color: #43e5f7;\n --value-bg-color: #444444;\n --disabled-color: #666666;\n --menu-bg-color: #080808;\n --menu-sep-color: #444444;\n --hover-bg-color: #666666;\n --focus-color: #458; /*#88AAFF*/;\n --range-color: #888888;\n --invalid-color: #FF6666;\n --selected-color: rgba(255, 255, 255, 0.3);\n\n --button-bg-color: var(--value-bg-color);\n\n --range-left-color: var(--value-color);\n --range-right-color: var(--value-bg-color); \n --range-right-hover-color: var(--hover-bg-color);\n --button-image: linear-gradient(\n rgba(0, 0, 0, 0.1), rgba(0, 0, 0, 0.4)\n );\n\n color: var(--color);\n background-color: var(--bg-color);\n\n --image-closed: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPgogIDxyZWN0IHN0eWxlPSJmaWxsOiAjREREOyIgeD0iMjAlIiB5PSI0NSUiIHdpZHRoPSI2MCUiIGhlaWdodD0iMTAlIj48L3JlY3Q+Cjwvc3ZnPg==);\n --image-open: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPgogIDxyZWN0IHN0eWxlPSJmaWxsOiAjREREOyIgeD0iNDUlIiB5PSIyMCUiIHdpZHRoPSIxMCUiIGhlaWdodD0iNjAlIj48L3JlY3Q+CiAgPHJlY3Qgc3R5bGU9ImZpbGw6ICNEREQ7IiB4PSIyMCUiIHk9IjQ1JSIgd2lkdGg9IjYwJSIgaGVpZ2h0PSIxMCUiPjwvcmVjdD4KPC9zdmc+);\n }\n}\n\n.muigui {\n --width: 250px;\n --label-width: 45%;\n --number-width: 40%;\n\n --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;\n --font-size: 11px;\n --font-family-mono: Menlo, Monaco, Consolas, "Droid Sans Mono", monospace;\n --font-size-mono: 11px;\n\n --line-height: 1.7em;\n --border-radius: 0px;\n\n width: var(--width);\n font-family: var(--font-family);\n font-size: var(--font-size);\n box-sizing: border-box;\n line-height: 100%;\n}\n.muigui * {\n box-sizing: inherit;\n}\n\n.muigui-no-scroll {\n touch-action: none;\n}\n.muigui-no-h-scroll {\n touch-action: pan-y;\n}\n.muigui-no-v-scroll {\n touch-action: pan-x;\n}\n\n.muigui-invalid-value {\n background-color: red !important;\n color: white !important;\n}\n\n.muigui-grid {\n display: grid;\n}\n.muigui-rows {\n display: flex;\n flex-direction: column;\n\n min-height: 20px;\n border: 2px solid red;\n}\n.muigui-columns {\n display: flex;\n flex-direction: row;\n\n height: 20px;\n border: 2px solid green;\n}\n.muigui-rows>*,\n.muigui-columns>* {\n flex: 1 1 auto;\n align-items: stretch;\n min-height: 0;\n min-width: 0;\n}\n\n.muigui-row {\n border: 2px solid yellow;\n min-height: 10px\n}\n.muigui-column {\n border: 2px solid lightgreen;\n}\n\n/* -------- */\n\n.muigui-show { /* */ }\n.muigui-hide { \n display: none !important;\n}\n.muigui-disabled {\n pointer-events: none;\n --color: var(--disabled-color) !important;\n --value-color: var(--disabled-color) !important;\n --range-left-color: var(--disabled-color) !important;\n}\n\n.muigui canvas,\n.muigui svg {\n display: block;\n border-radius: var(--border-radius);\n}\n.muigui canvas {\n background-color: var(--value-bg-color);\n}\n\n.muigui-controller {\n min-width: 0;\n min-height: var(--line-height);\n}\n.muigui-root {\n z-index: 1;\n}\n.muigui-root,\n.muigui-menu {\n display: flex;\n flex-direction: column;\n position: relative;\n user-select: none;\n height: fit-content;\n margin: 0;\n padding-bottom: 0.1em;\n border-radius: var(--border-radius);\n}\n.muigui-menu {\n border-bottom: 1px solid var(--menu-sep-color);\n}\n\n.muigui-root>button:nth-child(1),\n.muigui-menu>button:nth-child(1) {\n border-top: 1px solid var(--menu-sep-color);\n border-bottom: 1px solid var(--menu-sep-color);\n position: relative;\n text-align: left;\n color: var(--color);\n background-color: var(--menu-bg-color);\n min-height: var(--line-height);\n padding: 0.2em;\n cursor: pointer;\n border-radius: var(--border-radius);\n}\n.muigui-root>div:nth-child(2),\n.muigui-menu>div:nth-child(2) {\n flex: 1 1 auto;\n}\n\n.muigui-controller {\n margin-left: 0.2em;\n margin-right: 0.2em;\n}\n.muigui-root.muigui-controller,\n.muigui-menu.muigui-controller {\n margin-left: 0;\n margin-right: 0;\n}\n.muigui-controller>*:nth-child(1) {\n flex: 1 0 var(--label-width);\n min-width: 0;\n /* white-space: pre; why?? */\n}\n.muigui-controller>label:nth-child(1) {\n place-content: center start;\n display: inline-grid;\n overflow: hidden;\n}\n.muigui-controller>*:nth-child(2) {\n flex: 1 1 75%;\n min-width: 0;\n}\n\n/* -----------------------------------------\n a label controller is [[label][value]]\n*/\n\n.muigui-label-controller {\n display: flex;\n margin: 0.4em 0 0.4em 0;\n word-wrap: initial;\n align-items: stretch;\n}\n\n.muigui-value {\n display: flex;\n align-items: stretch;\n}\n.muigui-value>* {\n flex: 1 1 auto;\n min-width: 0;\n}\n.muigui-value>*:nth-child(1) {\n flex: 1 1 calc(100% - var(--number-width));\n}\n.muigui-value>*:nth-child(2) {\n flex: 1 1 var(--number-width);\n margin-left: 0.2em;\n}\n\n/* fix! */\n.muigui-open>button>label::before,\n.muigui-closed>button>label::before {\n content: "X";\n color: rgba(0, 0, 0, 0);\n background-color: var(--range-color);\n border-radius: 0.2em;\n width: 1.25em;\n margin-right: 0.25em;\n height: 1.25em; /*var(--line-height);*/\n display: inline-grid;\n place-content: center start;\n pointer-events: none;\n}\n.muigui-open>button>label::before {\n background-image: var(--image-open);\n}\n.muigui-closed>button>label::before {\n background-image: var(--image-closed);\n}\n\n.muigui-open>.muigui-open-container {\n transition: all 0.1s ease-out;\n overflow: auto;\n height: 100%;\n}\n.muigui-closed>.muigui-open-container {\n transition: all 0.1s ease-out;\n overflow: hidden;\n min-height: 0;\n}\n.muigui-open>.muigui-open-container>* {\n transition: all 0.1s ease-out;\n margin-top: 0px;\n}\n.muigui-closed>.muigui-open-container>* {\n transition: all 0.1s ease-out;\n margin-top: -100%;\n}\n\n/* ---- popdown ---- */\n\n.muigui-pop-down-top {\n display: flex;\n}\n/* fix? */\n.muigui-value>*:nth-child(1).muigui-pop-down-top {\n flex: 0;\n}\n.muigui-closed .muigui-pop-down-bottom {\n max-height: 0;\n}\n\n.muigui-value .muigui-pop-down-bottom {\n margin: 0;\n}\n\n.muigui-pop-down-values {\n min-width: 0;\n display: flex;\n}\n.muigui-pop-down-values>* {\n flex: 1 1 auto;\n min-width: 0;\n}\n\n.muigui-value.muigui-pop-down-controller {\n flex-direction: column;\n}\n\n.muigui-pop-down-top input[type=checkbox] {\n -webkit-appearance: none;\n appearance: none;\n width: auto;\n color: var(--value-color);\n background-color: var(--value-bg-color);\n background-image: var(--image-checkerboard);\n background-size: 10px 10px;\n background-position: 0 0, 0 5px, 5px -5px, -5px 0px;\n\n cursor: pointer;\n\n display: grid;\n place-content: center;\n margin: 0;\n font: inherit;\n color: currentColor;\n width: 1.7em;\n height: 1.7em;\n transform: translateY(-0.075em);\n}\n\n.muigui-pop-down-top input[type=checkbox]::before {\n content: "+";\n display: grid;\n place-content: center;\n border-radius: calc(var(--border-radius) + 2px);\n border-left: 1px solid rgba(255,255,255,0.3);\n border-top: 1px solid rgba(255,255,255,0.3);\n border-bottom: 1px solid rgba(0,0,0,0.2);\n border-right: 1px solid rgba(0,0,0,0.2);\n background-color: var(--range-color);\n color: var(--value-bg-color);\n width: calc(var(--line-height) - 4px);\n height: calc(var(--line-height) - 4px);\n}\n\n.muigui-pop-down-top input[type=checkbox]:checked::before {\n content: "X";\n}\n\n\n/* ---- select ---- */\n\n.muigui select,\n.muigui option,\n.muigui input,\n.muigui button {\n color: var(--value-color);\n background-color: var(--value-bg-color);\n font-family: var(--font-family);\n font-size: var(--font-size);\n border: none;\n margin: 0;\n border-radius: var(--border-radius);\n}\n.muigui select {\n appearance: none;\n margin: 0;\n margin-left: 0; /*?*/\n overflow: hidden; /* Safari */\n}\n\n.muigui select:focus,\n.muigui input:focus,\n.muigui button:focus {\n outline: 1px solid var(--focus-color);\n}\n\n.muigui select:hover,\n.muigui option:hover,\n.muigui input:hover,\n.muigui button:hover {\n background-color: var(--hover-bg-color); \n}\n\n/* ------ [ label ] ------ */\n\n.muigui-label {\n border-top: 1px solid var(--menu-sep-color);\n border-bottom: 1px solid var(--menu-sep-color);\n padding-top: 0.4em;\n padding-bottom: 0.3em;\n place-content: center start;\n background-color: var(--menu-bg-color);\n white-space: pre;\n border-radius: var(--border-radius);\n}\n\n/* ------ [ divider] ------ */\n\n.muigui-divider {\n min-height: 6px;\n border-top: 2px solid var(--menu-sep-color);\n margin-top: 6px;\n}\n\n/* ------ [ button ] ------ */\n\n.muigui-button {\n display: grid;\n padding: 2px 0 2px 0;\n}\n.muigui-button button {\n border: none;\n color: var(--value-color);\n background-color: var(--button-bg-color);\n background-image: var(--button-image);\n cursor: pointer;\n place-content: center center;\n height: var(--line-height);\n}\n\n/* ------ [ color ] ------ */\n\n.muigui-color>div {\n overflow: hidden;\n position: relative;\n margin-left: 0;\n margin-right: 0; /* why? */\n max-width: var(--line-height);\n border-radius: var(--border-radius);\n}\n\n.muigui-color>div:focus-within {\n outline: 1px solid var(--focus-color);\n}\n\n.muigui-color input[type=color] {\n border: none;\n padding: 0;\n background: inherit;\n cursor: pointer;\n position: absolute;\n width: 200%;\n left: -10px;\n top: -10px;\n height: 200%;\n}\n.muigui-disabled canvas,\n.muigui-disabled svg,\n.muigui-disabled img,\n.muigui-disabled .muigui-color input[type=color] {\n opacity: 0.2;\n}\n\n/* ------ [ checkbox ] ------ */\n\n.muigui-checkbox>label:nth-child(2) {\n display: grid;\n place-content: center start;\n margin: 0;\n}\n\n.muigui-checkbox input[type=checkbox] {\n -webkit-appearance: none;\n appearance: none;\n width: auto;\n color: var(--value-color);\n background-color: var(--value-bg-color);\n cursor: pointer;\n\n display: grid;\n place-content: center;\n margin: 0;\n font: inherit;\n color: currentColor;\n width: 1.7em;\n height: 1.7em;\n transform: translateY(-0.075em);\n}\n\n.muigui-checkbox input[type=checkbox]::before {\n content: "";\n color: var(--value-color);\n display: grid;\n place-content: center;\n}\n\n.muigui-checkbox input[type=checkbox]:checked::before {\n content: "✔";\n}\n\n.muigui input[type=number]::-webkit-inner-spin-button, \n.muigui input[type=number]::-webkit-outer-spin-button { \n -webkit-appearance: none;\n appearance: none;\n margin: 0; \n}\n.muigui input[type=number] {\n -moz-appearance: textfield;\n}\n\n/* ------ [ radio grid ] ------ */\n\n.muigui-radio-grid>div {\n display: grid;\n gap: 2px;\n}\n\n.muigui-radio-grid input {\n appearance: none;\n display: none;\n}\n\n.muigui-radio-grid button {\n color: var(--color);\n width: 100%;\n text-align: left;\n}\n\n.muigui-radio-grid input:checked + button {\n color: var(--value-color);\n background-color: var(--selected-color);\n}\n\n/* ------ [ color-chooser ] ------ */\n\n.muigui-color-chooser-cursor {\n stroke-width: 1px;\n stroke: white;\n fill: none;\n}\n.muigui-color-chooser-circle {\n stroke-width: 1px;\n stroke: white;\n fill: none;\n}\n\n\n/* ------ [ vec2 ] ------ */\n\n.muigui-vec2 svg {\n background-color: var(--value-bg-color);\n}\n\n.muigui-vec2-axis {\n stroke: 1px;\n stroke: var(--focus-color);\n}\n\n.muigui-vec2-line {\n stroke-width: 1px;\n stroke: var(--value-color);\n fill: var(--value-color);\n}\n\n/* ------ [ direction ] ------ */\n\n.muigui-direction svg {\n background-color: rgba(0,0,0,0.2);\n}\n\n.muigui-direction:focus-within svg {\n outline: none;\n}\n.muigui-direction-range {\n fill: var(--value-bg-color);\n}\n.muigui-direction svg:focus {\n outline: none;\n}\n.muigui-direction svg:focus .muigui-direction-range {\n stroke-width: 0.5px;\n stroke: var(--focus-color);\n}\n\n.muigui-direction-arrow {\n fill: var(--value-color);\n}\n\n/* ------ [ slider ] ------ */\n\n.muigui-slider>div {\n display: flex;\n align-items: stretch;\n height: var(--line-height);\n}\n.muigui-slider svg {\n flex: 1 1 auto;\n}\n.muigui-slider .muigui-slider-up #muigui-orientation {\n transform: scale(1, -1) translateY(-100%);\n}\n\n.muigui-slider .muigui-slider-up #muigui-number-orientation {\n transform: scale(1,-1);\n}\n\n.muigui-ticks {\n stroke: var(--range-color);\n}\n.muigui-thicks {\n stroke: var(--color);\n stroke-width: 2px;\n}\n.muigui-svg-text {\n fill: var(--color);\n font-size: 7px;\n}\n.muigui-mark {\n fill: var(--value-color);\n}\n\n/* ------ [ range ] ------ */\n\n\n.muigui-range input[type=range] {\n -webkit-appearance: none;\n appearance: none;\n background-color: transparent;\n}\n\n.muigui-range input[type=range]::-webkit-slider-thumb {\n -webkit-appearance: none;\n appearance: none;\n border-radius: calc(var(--border-radius) + 2px);\n border-left: 1px solid rgba(255,255,255,0.3);\n border-top: 1px solid rgba(255,255,255,0.3);\n border-bottom: 1px solid rgba(0,0,0,0.2);\n border-right: 1px solid rgba(0,0,0,0.2);\n background-color: var(--range-color);\n margin-top: calc((var(--line-height) - 6px) / -2);\n width: calc(var(--line-height) - 6px);\n height: calc(var(--line-height) - 6px);\n}\n\n.muigui-range input[type=range]::-webkit-slider-runnable-track {\n -webkit-appearance: none;\n appearance: none;\n border: 1px solid var(--menu-sep-color);\n height: 2px;\n}\n\n\n/* dat.gui style - doesn\'t work on Safari iOS */\n\n/*\n.muigui-range input[type=range] {\n cursor: ew-resize;\n overflow: hidden;\n}\n\n.muigui-range input[type=range] {\n -webkit-appearance: none;\n appearance: none;\n background-color: var(--range-right-color);\n margin: 0;\n}\n.muigui-range input[type=range]:hover {\n background-color: var(--range-right-hover-color);\n}\n\n.muigui-range input[type=range]::-webkit-slider-runnable-track {\n -webkit-appearance: none;\n appearance: none;\n height: max-content;\n color: var(--range-left-color);\n margin-top: -1px;\n}\n\n.muigui-range input[type=range]::-webkit-slider-thumb {\n -webkit-appearance: none;\n appearance: none;\n width: 0px;\n height: max-content;\n box-shadow: -1000px 0 0 1000px var(--range-left-color);\n}\n*/\n\n/* FF */\n/*\n.muigui-range input[type=range]::-moz-slider-progress {\n background-color: var(--range-left-color); \n}\n.muigui-range input[type=range]::-moz-slider-thumb {\n height: max-content;\n width: 0;\n border: none;\n box-shadow: -1000px 0 0 1000px var(--range-left-color);\n box-sizing: border-box;\n}\n*/\n\n.muigui-checkered-background {\n background-color: #404040;\n background-image:\n linear-gradient(45deg, #808080 25%, transparent 25%),\n linear-gradient(-45deg, #808080 25%, transparent 25%),\n linear-gradient(45deg, transparent 75%, #808080 75%),\n linear-gradient(-45deg, transparent 75%, #808080 75%);\n background-size: 16px 16px;\n background-position: 0 0, 0 8px, 8px -8px, -8px 0px;\n}\n\n/* ---------------------------------------------------------- */\n\n/* needs to be at bottom to take precedence */\n.muigui-auto-place {\n max-height: 100%;\n position: fixed;\n top: 0;\n right: 15px;\n z-index: 100001;\n}\n\n',themes:{default:{include:["default"],css:"\n "},float:{include:["default"],css:"\n :root {\n color-scheme: light dark,\n }\n\n .muigui {\n --width: 400px;\n --bg-color: initial;\n --label-width: 25%;\n --number-width: 20%;\n }\n\n input,\n .muigui-label-controller>label {\n text-shadow:\n -1px -1px 0 var(--contrast-color),\n 1px -1px 0 var(--contrast-color),\n -1px 1px 0 var(--contrast-color),\n 1px 1px 0 var(--contrast-color);\n }\n\n .muigui-controller > label:nth-child(1) {\n place-content: center end;\n margin-right: 1em;\n }\n\n .muigui-value > :nth-child(2) {\n margin-left: 1em;\n }\n\n .muigui-root>*:nth-child(1) {\n display: none;\n }\n\n .muigui-range input[type=range]::-webkit-slider-thumb {\n border-radius: 1em;\n }\n\n .muigui-range input[type=range]::-webkit-slider-runnable-track {\n -webkit-appearance: initial;\n appearance: none;\n border: 1px solid rgba(0, 0, 0, 0.25);\n height: 2px;\n }\n\n .muigui-colors {\n --value-color: var(--color );\n --value-bg-color: rgba(0, 0, 0, 0.1);\n --disabled-color: #cccccc;\n --menu-bg-color: rgba(0, 0, 0, 0.1);\n --menu-sep-color: #bbbbbb;\n --hover-bg-color: rgba(0, 0, 0, 0);\n --invalid-color: #FF0000;\n --selected-color: rgba(0, 0, 0, 0.3);\n --range-color: rgba(0, 0, 0, 0.125);\n }\n"},form:{include:[],css:"\n .muigui {\n --width: 100%;\n --label-width: 45%;\n --number-width: 40%;\n }\n .muigui-root>button {\n display: none;\n }\n .muigui-controller {\n margin-top: 1em;\n }\n .muigui-label-controller {\n display: flex;\n flex-direction: column;\n align-items: stretch;\n margin-top: 1em;\n }\n .muigui-label-controller:has(.muigui-checkbox) {\n flex-direction: row;\n }\n .muigui-value {\n display: flex;\n align-items: stretch;\n }\n .muigui-value>* {\n flex: 1 1 auto;\n min-width: 0;\n }\n .muigui-controller>*:nth-child(1) {\n flex: 1 0 var(--label-width);\n min-width: 0;\n white-space: pre;\n }\n .muigui-controller>label:nth-child(1) {\n place-content: center start;\n display: inline-grid;\n overflow: hidden;\n }\n .muigui-controller>*:nth-child(2) {\n flex: 1 1 75%;\n min-width: 0;\n }\n "},none:{include:[],css:""}}};function e(t,e={},n=[]){const i=document.createElement(t);return function(t,e,n){for(const[n,i]of Object.entries(e))if("function"==typeof i&&n.startsWith("on")){const e=n.substring(2).toLowerCase();t.addEventListener(e,i,{passive:!1})}else if("object"==typeof i)for(const[e,o]of Object.entries(i))t[n][e]=o;else void 0===t[n]?t.setAttribute(n,i):t[n]=i;for(const e of n)t.appendChild(e)}(i,e,n),i}let n=0;function i(t,e){const n=t.indexOf(e);return n&&t.splice(n,1),t}function o(t,e,n){return Math.max(e,Math.min(n,t))}const r="undefined"!=typeof SharedArrayBuffer?function(t){return t&&t.buffer&&(t.buffer instanceof ArrayBuffer||t.buffer instanceof SharedArrayBuffer)}:function(t){return t&&t.buffer&&t.buffer instanceof ArrayBuffer},s=(t,e,n)=>Math.round(e(t)/n)/(1/n),a=(t,e)=>(t%e+e)%e;function l(t,e){for(const n in e)n in t&&(t[n]=e[n]);return t}const u=(t,e,n,i,o)=>(t-e)*(o-i)/(n-e)+i,c=({from:t,to:e})=>({to:n=>u(n,...t,...e),from:n=>[!0,u(n,...e,...t)]}),h=({from:t,to:e,step:n})=>({min:e[0],max:e[1],...n&&{step:n},converters:c({from:t,to:e})}),d={to:t=>t,from:t=>[!0,t]};function m(t,e,n,i,o){const{converters:{from:r}=d}=o,{min:s,max:a}=o,l=o.minRange||0,u=r(l)[1],c=t.add(e,n,{...o,min:s,max:a-l}).onChange((t=>{h.setValue(Math.min(a,Math.max(t+u,e[i])))})),h=t.add(e,i,{...o,min:s+l,max:a}).onChange((t=>{c.setValue(Math.max(s,Math.min(t-u,e[n])))}));return[c,h]}class p{domElement;#t;#e=[];constructor(t){this.domElement=t,this.#t=t}addElem(t){return this.#t.appendChild(t),t}removeElem(t){return this.#t.removeChild(t),t}pushSubElem(t){this.#t.appendChild(t),this.#t=t}popSubElem(){this.#t=this.#t.parentElement}add(t){return this.#e.push(t),this.addElem(t.domElement),t}remove(t){return this.removeElem(t.domElement),i(this.#e,t),t}pushSubView(t){this.pushSubElem(t.domElement)}popSubView(){this.popSubElem()}setOptions(t){for(const e of this.#e)e.setOptions(t)}updateDisplayIfNeeded(t,e){for(const n of this.#e)n.updateDisplayIfNeeded(t,e);return this}$(t){return this.domElement.querySelector(t)}}class g extends p{#n;#i;#o;constructor(t){super(e("div",{className:"muigui-controller"})),this.#n=[],this.#i=[],t&&this.domElement.classList.add(t)}get parent(){return this.#o}setParent(t){this.#o=t,this.enable(!this.disabled())}show(t=!0){return this.domElement.classList.toggle("muigui-hide",!t),this.domElement.classList.toggle("muigui-show",t),this}hide(){return this.show(!1)}disabled(){return!!this.domElement.closest(".muigui-disabled")}enable(t=!0){return this.domElement.classList.toggle("muigui-disabled",!t),["input","button","select","textarea"].forEach((t=>{this.domElement.querySelectorAll(t).forEach((t=>{const e=!!t.closest(".muigui-disabled");t.disabled=e}))})),this}disable(t=!0){return this.enable(!t)}onChange(t){return this.removeChange(t),this.#n.push(t),this}removeChange(t){return i(this.#n,t),this}onFinishChange(t){return this.removeFinishChange(t),this.#i.push(t),this}removeFinishChange(t){return i(this.#i,t),this}#r(t,e){for(const n of t)n.call(this,e)}emitChange(t,e,n){this.#r(this.#n,t),this.#o&&(void 0===e?this.#o.emitChange(t):this.#o.emitChange({object:e,property:n,value:t,controller:this}))}emitFinalChange(t,e,n){this.#r(this.#i,t),this.#o&&(void 0===e?this.#o.emitChange(t):this.#o.emitFinalChange({object:e,property:n,value:t,controller:this}))}updateDisplay(){}getColors(){const t=t=>t.replace(/-([a-z])/g,((t,e)=>e.toUpperCase())),n=e("div");this.domElement.appendChild(n);const i=Object.fromEntries(["color","bg-color","value-color","value-bg-color","hover-bg-color","menu-bg-color","menu-sep-color","disabled-color"].map((e=>{n.style.color=`var(--${e})`;const i=getComputedStyle(n);return[t(e),i.color]})));return n.remove(),i}}class b extends g{#s;#a;#l;#u={name:""};constructor(t,n,i={}){super("muigui-button",""),this.#s=t,this.#a=n,this.#l=this.addElem(e("button",{type:"button",onClick:()=>{this.#s[this.#a](this)}})),this.setOptions({name:n,...i})}name(t){this.#l.textContent=t}setOptions(t){l(this.#u,t);const{name:e}=this.#u;this.#l.textContent=e}}function f(t,e){if(t.length!==e.length)return!1;for(let n=0;n{t.setValue(i.checked)},onChange:()=>{t.setFinalValue(i.checked)}});super(e("label",{},[i])),this.#f=i}updateDisplay(t){this.#f.checked=t}}const w=[],y=new Set;let k,E;function I(){k=void 0,E=!0;for(const t of w)y.has(t)||t();E=!1,y.size&&(E?$():(y.forEach((t=>{i(w,t)})),y.clear())),$()}function $(){!k&&w.length&&(k=requestAnimationFrame(I))}let C=0;function M(){return"muigui-"+ ++C}class S extends p{constructor(t=""){super(e("div",{className:"muigui-value"})),t&&this.domElement.classList.add(t)}}class V extends g{#v;#x;constructor(t="",n=""){super("muigui-label-controller"),this.#v=M(),this.#x=e("label",{for:this.#v}),this.domElement.appendChild(this.#x),this.pushSubView(new S(t)),this.name(n)}get id(){return this.#v}name(t){return this.#x.title===this.#x.textContent&&(this.#x.title=t),this.#x.textContent=t,this}tooltip(t){this.#x.title=t}}class D extends V{#s;#a;#w;#y;#e;#k;constructor(t,e,n=""){super(n,e),this.#s=t,this.#a=e,this.#w=this.getValue(),this.#y=!1,this.#e=[]}get initialValue(){return this.#w}get object(){return this.#s}get property(){return this.#a}add(t){return this.#e.push(t),super.add(t),this.updateDisplay(),t}#E(t,e){let n=!1;if("object"==typeof t){const e=this.#s[this.#a];if(Array.isArray(t)||r(t))for(let i=0;i=0&&w.splice(e,1)}(this.#k)),this}}class N extends D{constructor(t,e){super(t,e,"muigui-checkbox");const n=this.id;this.add(new x(this,n)),this.updateDisplay()}}const A={to:t=>t,from:t=>[!0,t]},j={to:t=>t.toString(),from:t=>{const e=parseFloat(t);return[!Number.isNaN(e),e]}},U={radToDeg:c({to:[0,180],from:[0,Math.PI]})};function L(){let t=0;return function(e,n,i=5){t-=e.deltaY*n/i;const o=Math.floor(Math.abs(t)/n)*Math.sign(t)*n;return t-=o,o}}class F extends v{#I;#$;#C;#M;#u={step:.01,converters:j,min:Number.NEGATIVE_INFINITY,max:Number.POSITIVE_INFINITY};constructor(t,n){const i=t.setValue.bind(t),r=t.setFinalValue.bind(t),a=L();super(e("input",{type:"number",onInput:()=>{this.#S(i,!0)},onChange:()=>{this.#S(r,!1)},onWheel:e=>{e.preventDefault();const{min:n,max:i,step:r}=this.#u,l=a(e,r),u=parseFloat(this.domElement.value),c=o(s(u+l,(t=>t),r),n,i),[h,d]=this.#$(c);h&&t.setValue(d)}})),this.setOptions(n)}#S(t,e){const n=parseFloat(this.domElement.value),[i,r]=this.#$(n);let s;if(i&&!Number.isNaN(n)){const{min:n,max:i}=this.#u;s=r>=n&&r<=i,this.#M=e,t(o(r,n,i))}this.domElement.classList.toggle("muigui-invalid-value",!i||!s)}updateDisplay(t){this.#M||(this.domElement.value=s(t,this.#I,this.#C)),this.#M=!1}setOptions(t){l(this.#u,t);const{step:e,converters:{to:n,from:i}}=this.#u;return this.#I=n,this.#$=i,this.#C=e,this}}class P extends D{#V;#C;constructor(t,e,n={}){super(t,e,"muigui-text-number"),this.#V=this.add(new F(this,n)),this.updateDisplay()}}class O extends v{#D;constructor(t,n){const i=[];super(e("select",{onChange:()=>{t.setFinalValue(this.#D[this.domElement.selectedIndex])}},n.map((([t,n])=>(i.push(n),e("option",{textContent:t})))))),this.#D=i}updateDisplay(t){const e=this.#D.indexOf(t);this.domElement.selectedIndex=e}}function H(t,e){return Array.isArray(t)?Array.isArray(t[0])?t:e?t.map(((t,e)=>[t,e])):t.map((t=>[t,t])):[...Object.entries(t)]}class T extends D{constructor(t,e,n){super(t,e,"muigui-select");const i="number"==typeof this.getValue(),{keyValues:o}=n,r=H(o,i);this.add(new O(this,r)),this.updateDisplay()}}class z extends v{#I;#$;#C;#M;#u={step:.01,min:0,max:1,converters:A};constructor(t,n){const i=L();super(e("input",{type:"range",onInput:()=>{this.#M=!0;const{min:e,max:n,step:i}=this.#u,r=parseFloat(this.domElement.value),a=o(s(r,(t=>t),i),e,n),[l,u]=this.#$(a);l&&t.setValue(u)},onChange:()=>{this.#M=!0;const{min:e,max:n,step:i}=this.#u,r=parseFloat(this.domElement.value),a=o(s(r,(t=>t),i),e,n),[l,u]=this.#$(a);l&&t.setFinalValue(u)},onWheel:e=>{e.preventDefault();const[n,r]=this.#$(parseFloat(this.domElement.value));if(!n)return;const{min:a,max:l,step:u}=this.#u,c=i(e,u),h=o(s(r+c,(t=>t),u),a,l);t.setValue(h)}})),this.setOptions(n)}updateDisplay(t){this.#M||(this.domElement.value=s(t,this.#I,this.#C)),this.#M=!1}setOptions(t){l(this.#u,t);const{step:e,min:n,max:i,converters:{to:o,from:r}}=this.#u;return this.#I=o,this.#$=r,this.#C=e,this.domElement.step=e,this.domElement.min=n,this.domElement.max=i,this}}class W extends D{constructor(t,e,n){super(t,e,"muigui-range"),this.add(new z(this,n)),this.add(new F(this,n))}}class B extends v{#I;#$;#M;#u={converters:A};constructor(t,n){const i=t.setValue.bind(t),o=t.setFinalValue.bind(t);super(e("input",{type:"text",onInput:()=>{this.#S(i,!0)},onChange:()=>{this.#S(o,!1)}})),this.setOptions(n)}#S(t,e){const[n,i]=this.#$(this.domElement.value);n&&(this.#M=e,t(i)),this.domElement.style.color=n?"":"var(--invalid-color)"}updateDisplay(t){this.#M||(this.domElement.value=this.#I(t),this.domElement.style.color=""),this.#M=!1}setOptions(t){l(this.#u,t);const{converters:{to:e,from:n}}=this.#u;return this.#I=e,this.#$=n,this}}class G extends D{constructor(t,e){super(t,e,"muigui-text"),this.add(new B(this)),this.updateDisplay()}}const R=(t,e,n)=>Math.max(e,Math.min(n,t)),Z=(t,e,n)=>t+(e-t)*n,J=t=>t>=0?t%1:1-t%1,Y=t=>+t.toFixed(0),Q=t=>+t.toFixed(3),K=t=>parseInt(t.substring(1,3),16)<<16|parseInt(t.substring(3,5),16)<<8|parseInt(t.substring(5,7),16),_=t=>parseInt(t.substring(1,3),16)*2**24+65536*parseInt(t.substring(3,5),16)+256*parseInt(t.substring(5,7),16)+parseInt(t.substring(7,9),16),q=t=>[parseInt(t.substring(1,3),16),parseInt(t.substring(3,5),16),parseInt(t.substring(5,7),16)],X=t=>`#${Array.from(t).map((t=>t.toString(16).padStart(2,"0"))).join("")}`,tt=t=>[parseInt(t.substring(1,3),16),parseInt(t.substring(3,5),16),parseInt(t.substring(5,7),16),parseInt(t.substring(7,9),16)],et=t=>`#${Array.from(t).map((t=>t.toString(16).padStart(2,"0"))).join("")}`,nt=t=>q(t).map((t=>Q(t/255))),it=t=>X(Array.from(t).map((t=>Math.round(R(255*t,0,255))))),ot=t=>tt(t).map((t=>Q(t/255))),rt=t=>et(Array.from(t).map((t=>Math.round(R(255*t,0,255))))),st=t=>R(Math.round(255*t),0,255).toString(16).padStart(2,"0"),at=t=>({r:parseInt(t.substring(1,3),16)/255,g:parseInt(t.substring(3,5),16)/255,b:parseInt(t.substring(5,7),16)/255}),lt=t=>({r:parseInt(t.substring(1,3),16)/255,g:parseInt(t.substring(3,5),16)/255,b:parseInt(t.substring(5,7),16)/255,a:parseInt(t.substring(7,9),16)/255}),ut=t=>`rgb(${q(t).join(", ")})`,ct=/^\s*rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)\s*$/,ht=t=>`rgba(${tt(t).map(((t,e)=>3===e?t/255:t)).join(", ")})`,dt=/^\s*rgba\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+\.\d+|\d+)\s*\)\s*$/,mt=t=>{const e=yt(q(t)).map((t=>Y(t)));return`hsl(${e[0]}, ${e[1]}%, ${e[2]}%)`},pt=t=>{const e=kt(tt(t)).map(((t,e)=>3===e?Q(t):Y(t)));return`hsl(${e[0]} ${e[1]}% ${e[2]}% / ${e[3]})`},gt=/^\s*hsl\(\s*(\d+)(?:deg|)\s*(?:,|)\s*(\d+)%\s*(?:,|)\s*(\d+)%\s*\)\s*$/,bt=/^\s*hsl\(\s*(\d+)(?:deg|)\s*(?:,|)\s*(\d+)%\s*(?:,|)\s*(\d+)%\s*\/\s*(\d+\.\d+|\d+)\s*\)\s*$/,ft=(t,e)=>(t%e+e)%e;function vt([t,e,n]){t=ft(t,360),e=R(e/100,0,1),n=R(n/100,0,1);const i=e*Math.min(n,1-n);function o(e){const o=(e+t/30)%12;return n-i*Math.max(-1,Math.min(o-3,9-o,1))}return[o(0),o(8),o(4)].map((t=>Math.round(255*t)))}function xt([t,e,n]){const i=Math.max(t,e,n),o=Math.min(t,e,n),r=.5*(o+i),s=i-o;let a=0,l=0;if(0!==s)switch(l=0===r||1===r?0:(i-r)/Math.min(r,1-r),i){case t:a=(e-n)/s+(e{const[e,n,i]=xt(t.map((t=>t/255)));return[360*e,100*n,100*i]},kt=t=>{const[e,n,i,o]=wt(t.map((t=>t/255)));return[360*e,100*n,100*i,o]};function Et([t,e,n]){return e=R(e,0,1),n=R(n,0,1),[t,t+2/3,t+1/3].map((t=>Z(1,R(Math.abs(6*J(t)-3)-1,0,1),e)*n))}function It([t,e,n,i]){return[...Et([t,e,n]),i]}const $t=t=>Math.round(1e3*t)/1e3;function Ct([t,e,n]){const i=n>e?[n,e,-1,2/3]:[e,n,0,-1/3],o=i[0]>t?[i[0],i[1],i[3],t]:[t,i[1],i[2],i[0]],r=o[0]-Math.min(o[3],o[1]);return[Math.abs(o[2]+(o[3]-o[1])/(6*r+Number.EPSILON)),r/(o[0]+Number.EPSILON),o[0]].map($t)}function Mt([t,e,n,i]){return[...Ct([t,e,n]),i]}const St=t=>t.endsWith("a")||t.startsWith("hex8"),Vt=[{re:/^#(?:[0-9a-f]){6}$/i,format:"hex6"},{re:/^(?:[0-9a-f]){6}$/i,format:"hex6-no-hash"},{re:/^#(?:[0-9a-f]){8}$/i,format:"hex8"},{re:/^(?:[0-9a-f]){8}$/i,format:"hex8-no-hash"},{re:/^#(?:[0-9a-f]){3}$/i,format:"hex3"},{re:/^(?:[0-9a-f]){3}$/i,format:"hex3-no-hash"},{re:ct,format:"css-rgb"},{re:gt,format:"css-hsl"},{re:dt,format:"css-rgba"},{re:bt,format:"css-hsla"}];function Dt(t){switch(typeof t){case"number":return console.warn('can not reliably guess format based on a number. You should pass in a format like {format: "uint32-rgb"} or {format: "uint32-rgb"}'),t<=16777215?"uint32-rgb":"uint32-rgba";case"string":{const e=function(t){for(const e of Vt)if(e.re.test(t))return e}(t.trim());if(e)return e.format;break}case"object":if(t instanceof Uint8Array||t instanceof Uint8ClampedArray){if(3===t.length)return"uint8-rgb";if(4===t.length)return"uint8-rgba"}else if(t instanceof Float32Array){if(3===t.length)return"float-rgb";if(4===t.length)return"float-rgba"}else if(Array.isArray(t)){if(3===t.length)return"float-rgb";if(4===t.length)return"float-rgba"}else if("r"in t&&"g"in t&&"b"in t)return"a"in t?"object-rgba":"object-rgb"}throw new Error(`unknown color format: ${t}`)}function Nt(t){return t.trim(t)}function At(t){return t.trim(t)}function jt(t){return t[1]===t[2]&&t[3]===t[4]&&t[5]===t[6]?`#${t[1]}${t[3]}${t[5]}`:t}const Ut=/^(#|)([0-9a-f]{3})$/i;function Lt(t){const e=Ut.exec(t);if(e){const[,,t]=e;return"#"+`${(n=t)[0]}${n[0]}${n[1]}${n[1]}${n[2]}${n[2]}`}var n;return t}function Ft(t){return jt(Nt(t))}const Pt=t=>{const e=ct.exec(t);if(!e)return[!1];const n=[e[1],e[2],e[3]].map((t=>parseInt(t)));return[!n.find((t=>t>255)),`rgb(${n.join(", ")})`]},Ot=t=>{const e=dt.exec(t);if(!e)return[!1];const n=[e[1],e[2],e[3],e[4]].map(((t,e)=>3===e?parseFloat(t):parseInt(t)));return[!n.find((t=>t>255)),`rgba(${n.join(", ")})`]},Ht=t=>{const e=gt.exec(t);if(!e)return[!1];const n=[e[1],e[2],e[3]].map((t=>parseFloat(t)));return[!n.find((t=>Number.isNaN(t))),`hsl(${n[0]}, ${n[1]}%, ${n[2]}%)`]},Tt=t=>{const e=bt.exec(t);if(!e)return[!1];const n=[e[1],e[2],e[3],e[4]].map((t=>parseFloat(t)));return[!n.find((t=>Number.isNaN(t))),`hsl(${n[0]} ${n[1]}% ${n[2]}% / ${n[3]})`]},zt=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*$/,Wt=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*$/,Bt=t=>{const e=t.split(",").map((t=>t.trim())),n=e.map((t=>parseFloat(t)));if(3!==n.length)return[!1];const i=e.findIndex((t=>isNaN(t)));return[i<0,n.map((t=>Q(t)))]},Gt=t=>{const e=t.split(",").map((t=>t.trim())),n=e.map((t=>parseFloat(t)));if(4!==n.length)return[!1];const i=e.findIndex((t=>isNaN(t)));return[i<0,n.map((t=>Q(t)))]},Rt=/^\s*(?:0x){0,1}([0-9a-z]{1,6})\s*$/i,Zt=/^\s*(?:0x){0,1}([0-9a-z]{1,8})\s*$/i,Jt=/^\s*#[a-f0-9]{6}\s*$|^\s*#[a-f0-9]{3}\s*$/i,Yt=/^\s*[a-f0-9]{6}\s*$/i,Qt=/^\s*#[a-f0-9]{8}\s*$/i,Kt=/^\s*[a-f0-9]{8}\s*$/i,_t={hex6:{color:{from:t=>[!0,t],to:Nt},text:{from:t=>[Jt.test(t),t.trim()],to:t=>t}},hex8:{color:{from:t=>[!0,t],to:At},text:{from:t=>[Qt.test(t),t.trim()],to:t=>t}},hex3:{color:{from:t=>[!0,Ft(t)],to:Lt},text:{from:t=>[Jt.test(t),jt(t.trim())],to:t=>t}},"hex6-no-hash":{color:{from:t=>[!0,t.substring(1)],to:t=>`#${Nt(t)}`},text:{from:t=>[Yt.test(t),t.trim()],to:t=>t}},"hex8-no-hash":{color:{from:t=>[!0,t.substring(1)],to:t=>`#${At(t)}`},text:{from:t=>[Kt.test(t),t.trim()],to:t=>t}},"hex3-no-hash":{color:{from:t=>[!0,Ft(t).substring(1)],to:Lt},text:{from:t=>[Yt.test(t),jt(t.trim())],to:t=>t}},"uint32-rgb":{color:{from:t=>[!0,K(t)],to:t=>`#${Math.round(t).toString(16).padStart(6,"0")}`},text:{from:t=>(t=>{const e=Rt.exec(t);return e?[!0,parseInt(e[1],16)]:[!1]})(t),to:t=>`0x${t.toString(16).padStart(6,"0")}`}},"uint32-rgba":{color:{from:t=>[!0,_(t)],to:t=>`#${Math.round(t).toString(16).padStart(8,"0")}`},text:{from:t=>(t=>{const e=Zt.exec(t);return e?[!0,parseInt(e[1],16)]:[!1]})(t),to:t=>`0x${t.toString(16).padStart(8,"0")}`}},"uint8-rgb":{color:{from:t=>[!0,q(t)],to:X},text:{from:t=>{const e=zt.exec(t);if(!e)return[!1];const n=[e[1],e[2],e[3]].map((t=>parseInt(t)));return[!n.find((t=>t>255)),n]},to:t=>t.join(", ")}},"uint8-rgba":{color:{from:t=>[!0,tt(t)],to:et},text:{from:t=>{const e=Wt.exec(t);if(!e)return[!1];const n=[e[1],e[2],e[3],e[4]].map((t=>parseInt(t)));return[!n.find((t=>t>255)),n]},to:t=>t.join(", ")}},"float-rgb":{color:{from:t=>[!0,nt(t)],to:it},text:{from:Bt,to:t=>Array.from(t).map((t=>Q(t))).join(", ")}},"float-rgba":{color:{from:t=>[!0,ot(t)],to:rt},text:{from:Gt,to:t=>Array.from(t).map((t=>Q(t))).join(", ")}},"float-hsv":{color:{from:t=>[!0,Ct(nt(t))],to:t=>Et(it(t))},text:{from:Bt,to:t=>Array.from(t).map((t=>Q(t))).join(", ")}},"float-hsva":{color:{from:t=>[!0,Mt(nt(t))],to:t=>It(it(t))},text:{from:Gt,to:t=>Array.from(t).map((t=>Q(t))).join(", ")}},"object-rgb":{color:{from:t=>[!0,at(t)],to:t=>`#${st(t.r)}${st(t.g)}${st(t.b)}`},text:{from:t=>{try{const e=t.replace(/([a-z])/g,'"$1"'),n=JSON.parse(e);if(Number.isNaN(n.r)||Number.isNaN(n.g)||Number.isNaN(n.b))throw new Error("not {r, g, b}");return[!0,n]}catch(t){return[!1]}},to:t=>`{r:${Q(t.r)}, g:${Q(t.g)}, b:${Q(t.b)}}`}},"object-rgba":{color:{from:t=>[!0,lt(t)],to:t=>`#${st(t.r)}${st(t.g)}${st(t.b)}${st(t.a)}`},text:{from:t=>{try{const e=t.replace(/([a-z])/g,'"$1"'),n=JSON.parse(e);if(Number.isNaN(n.r)||Number.isNaN(n.g)||Number.isNaN(n.b)||Number.isNaN(n.a))throw new Error("not {r, g, b, a}");return[!0,n]}catch(t){return[!1]}},to:t=>`{r:${Q(t.r)}, g:${Q(t.g)}, b:${Q(t.b)}}, a:${Q(t.a)}}`}},"css-rgb":{color:{from:t=>[!0,ut(t)],to:t=>{const e=ct.exec(t);return X([e[1],e[2],e[3]].map((t=>parseInt(t))))}},text:{from:Pt,to:t=>Pt(t)[1]}},"css-rgba":{color:{from:t=>[!0,ht(t)],to:t=>{const e=dt.exec(t);return et([e[1],e[2],e[3],e[4]].map(((t,e)=>3===e?255*parseFloat(t)|0:parseInt(t))))}},text:{from:Ot,to:t=>Ot(t)[1]}},"css-hsl":{color:{from:t=>[!0,mt(t)],to:t=>{const e=gt.exec(t),n=vt([e[1],e[2],e[3]].map((t=>parseFloat(t))));return X(n)}},text:{from:Ht,to:t=>Ht(t)[1]}},"css-hsla":{color:{from:t=>[!0,pt(t)],to:t=>{const e=bt.exec(t),n=function([t,e,n,i]){return[...vt([t,e,n]),255*i|0]}([e[1],e[2],e[3],e[4]].map((t=>parseFloat(t))));return et(n)}},text:{from:Tt,to:t=>Tt(t)[1]}}};class qt extends p{constructor(t,n){super(e(t,{className:n}))}}class Xt extends V{#N;constructor(t){super("muigui-canvas",t),this.#N=this.add(new qt("canvas","muigui-canvas")).domElement}get canvas(){return this.#N}}class te extends v{#I;#$;#A;#M;#u={converters:A};constructor(t,n){const i=e("input",{type:"color",onInput:()=>{const[e,n]=this.#$(i.value);e&&(this.#M=!0,t.setValue(n))},onChange:()=>{const[e,n]=this.#$(i.value);e&&(this.#M=!0,t.setFinalValue(n))}});super(e("div",{},[i])),this.setOptions(n),this.#A=i}updateDisplay(t){this.#M||(this.#A.value=this.#I(t)),this.#M=!1}setOptions(t){l(this.#u,t);const{converters:{to:e,from:n}}=this.#u;return this.#I=e,this.#$=n,this}}class ee extends D{#j;#V;constructor(t,e,n={}){super(t,e,"muigui-color");const i=n.format||Dt(this.getValue()),{color:o,text:r}=_t[i];this.#j=this.add(new te(this,{converters:o})),this.#V=this.add(new B(this,{converters:r})),this.updateDisplay()}setOptions(t){const{format:e}=t;if(e){const{color:t,text:n}=_t[e];this.#j.setOptions({converters:t}),this.#V.setOptions({converters:n})}return super.setOptions(t),this}}class ne extends g{constructor(){super("muigui-divider")}}class ie extends g{#U;#L;constructor(t){super(t),this.#U=[],this.#L=this}get children(){return this.#U}get controllers(){return this.#U.filter((t=>!(t instanceof ie)))}get folders(){return this.#U.filter((t=>t instanceof ie))}reset(t=!0){for(const e of this.#U)e instanceof ie&&!t||e.reset(t);return this}updateDisplay(){for(const t of this.#U)t.updateDisplay();return this}remove(t){const e=this.#U.indexOf(t);if(e>=0){const t=this.#U.splice(e,1)[0];t.domElement.remove(),t.setParent(null)}return this}#F(t){return this.domElement.appendChild(t.domElement),this.#U.push(t),t.setParent(this),t}addController(t){return this.#L.#F(t)}pushContainer(t){return this.addController(t),this.#L=t,t}popContainer(){return this.#L=this.#L.parent,this}}class oe extends ie{#P;constructor(t="Controls",n="muigui-menu"){super(n),this.#P=e("label"),this.addElem(e("button",{type:"button",onClick:()=>this.toggleOpen()},[this.#P])),this.pushContainer(new ie("muigui-open-container")),this.pushContainer(new ie),this.name(t),this.open()}open(t=!0){return this.domElement.classList.toggle("muigui-closed",!t),this.domElement.classList.toggle("muigui-open",t),this}close(){return this.open(!1)}name(t){return this.#P.textContent=t,this}title(t){return this.name(t)}toggleOpen(){return this.open(!this.domElement.classList.contains("muigui-open")),this}}class re extends g{constructor(t){super("muigui-label"),this.text(t)}text(t){return this.domElement.textContent=t,this}}function se(){}function ae(t,e,n){const i=t.getBoundingClientRect(),o=e.clientX-i.left,r=e.clientY-i.top,s=o/i.width,a=r/i.height,l=o-(n=n||[o,r])[0],u=r-n[1];return{x:o,y:r,nx:s,ny:a,dx:l,dy:u,ndx:l/i.width,ndy:u/i.width}}function le(t,{onDown:e=se,onMove:n=se,onUp:i=se}){let o;const r=function(e){const i={type:"move",...ae(t,e,o)};n(i)},s=function(e){t.releasePointerCapture(e.pointerId),t.removeEventListener("pointermove",r),t.removeEventListener("pointerup",s),document.body.style.backgroundColor="",i("up")},a=function(n){t.addEventListener("pointermove",r),t.addEventListener("pointerup",s),t.setPointerCapture(n.pointerId);const i=ae(t,n);o=[i.x,i.y],e({type:"down",...i})};return t.addEventListener("pointerdown",a),function(){t.removeEventListener("pointerdown",a)}}function ue(t){return t.querySelectorAll("[data-src]").forEach((e=>{const i="muigui-id-"+n++;e.id=i,t.querySelectorAll(`[data-target=${e.dataset.src}]`).forEach((t=>{t.setAttribute("fill",`url(#${i})`)}))})),t}class ce extends v{#I;#$;#O;#H;#T;#z;#W;#B;#G;#R;#Z;#J;#Y;#Q;#u={converters:A,alpha:!1};#K;#_;constructor(t,n){super(e("div",{innerHTML:'\n\n\n\n',className:"muigui-no-scroll"})),this.#O=this.domElement.children[0],this.#T=this.domElement.children[1],this.#B=this.domElement.children[2],ue(this.#O),ue(this.#T),ue(this.#B),this.#H=this.$(".muigui-color-chooser-circle"),this.#z=this.$("[data-src=muigui-color-chooser-hue]"),this.#W=this.$(".muigui-color-chooser-hue-cursor"),this.#G=this.$("[data-src=muigui-color-chooser-alpha]"),this.#R=this.$(".muigui-color-chooser-alpha-cursor");const i=e=>{const n=o(e.nx,0,1),i=o(e.ny,0,1);this.#Z[1]=n,this.#Z[2]=1-i,this.#J=!0,this.#Q=!0;const[r,s]=this.#$(this.#K(this.#Z));r&&t.setValue(s)},r=e=>{const n=o(e.nx,0,1);this.#Z[0]=n,this.#Y=!0,this.#Q=!0;const[i,r]=this.#$(this.#K(this.#Z));i&&t.setValue(r)},s=e=>{const n=o(e.nx,0,1);this.#Z[3]=n,this.#J=!0,this.#Y=!0;const[i,r]=this.#$(this.#K(this.#Z));i&&t.setValue(r)};le(this.#O,{onDown:i,onMove:i}),le(this.#T,{onDown:r,onMove:r}),le(this.#B,{onDown:s,onMove:s}),this.setOptions(n)}updateDisplay(t){this.#Z||(this.#Z=this.#_(this.#I(t)));{const[e,n,i,o=1]=this.#_(this.#I(t));this.#J||(this.#Z[0]=n>.001&&i>.001?e:this.#Z[0]),this.#Y||(this.#Z[1]=n,this.#Z[2]=i),this.#Q||(this.#Z[3]=o)}{const[t,e,n,i]=this.#Z,[o,r,s]=wt(It(this.#Z));this.#J||this.#W.setAttribute("transform",`translate(${64*t}, 0)`),this.#z.children[0].setAttribute("stop-color",`hsl(${360*o} 0% 100% / ${i})`),this.#z.children[1].setAttribute("stop-color",`hsl(${360*o} 100% 50% / ${i})`),this.#Q||this.#R.setAttribute("transform",`translate(${64*i}, 0)`),this.#G.children[0].setAttribute("stop-color",`hsl(${360*o} ${100*r}% ${100*s}% / 0)`),this.#G.children[1].setAttribute("stop-color",`hsl(${360*o} ${100*r}% ${100*s}% / 1)`),this.#Y||(this.#H.setAttribute("cx",""+64*e),this.#H.setAttribute("cy",""+48*(1-n)))}this.#J=!1,this.#Y=!1,this.#Q=!1}setOptions(t){l(this.#u,t);const{converters:{to:e,from:n},alpha:i}=this.#u;return this.#B.style.display=i?"":"none",this.#K=i?t=>rt(It(t)):t=>it(Et(t)),this.#_=i?t=>Mt(ot(t)):t=>Ct(nt(t)),this.#I=e,this.#$=n,this}}class he extends D{#q;#X;#f;#tt;#u={open:!1};constructor(t,n,i={}){super(t,n,"muigui-pop-down-controller"),this.#q=this.add(new qt("div","muigui-pop-down-top"));const o=this.#q.addElem(e("input",{type:"checkbox",onChange:()=>{this.#u.open=o.checked,this.updateDisplay()}}));this.#f=o,this.#X=this.#q.add(new qt("div","muigui-pop-down-values"));const r=new qt("div","muigui-pop-down-bottom muigui-open-container");this.#tt=new qt("div"),r.add(this.#tt),this.add(r),this.setOptions(i)}setKnobColor(t){this.#f&&(this.#f.style=`\n --range-color: ${t};\n --value-bg-color: ${t};\n `)}updateDisplay(){super.updateDisplay();const{open:t}=this.#u;this.domElement.children[1].classList.toggle("muigui-open",t),this.domElement.children[1].classList.toggle("muigui-closed",!t)}setOptions(t){l(this.#u,t),super.setOptions(t),this.updateDisplay()}addTop(t){return this.#X.add(t)}addBottom(t){return this.#tt.add(t)}}class de extends he{#j;#V;#I;constructor(t,e,n={}){super(t,e,"muigui-color-chooser");const i=n.format||Dt(this.getValue()),{color:o,text:r}=_t[i];this.#I=o.to,this.#V=new B(this,{converters:r,alpha:St(i)}),this.#j=new ce(this,{converters:o,alpha:St(i)}),this.addTop(this.#V),this.addBottom(this.#j),this.___setKnobHelper=!0,this.updateDisplay()}#et(){if(this.#I){const t=this.#I(this.getValue()),e=9===t.length?t.substring(7,9):"FF",n=yt(q(t));n[2]=(n[2]+50)%100;const i=X(vt(n));this.setKnobColor(`${t.substring(0,7)}${e}`,i)}}updateDisplay(){super.updateDisplay(),this.___setKnobHelper&&this.#et()}setOptions(t){return super.setOptions(t),this}}class me extends oe{add(t,e,...n){const i=t instanceof g?t:function(t,e,...n){const[i]=n;if(Array.isArray(i))return new T(t,e,{keyValues:i});if(i&&i.keyValues)return new T(t,e,{keyValues:i.keyValues});const o=typeof t[e];switch(o){case"number":if("number"==typeof n[0]&&"number"==typeof n[1]){const i=n[0],o=n[1],r=n[2];return new W(t,e,{min:i,max:o,...r&&{step:r}})}return 0===n.length?new P(t,e,...n):new W(t,e,...n);case"boolean":return new N(t,e,...n);case"function":return new b(t,e,...n);case"string":return new G(t,e,...n);case"undefined":throw new Error(`no property named ${e}`);default:throw new Error(`unhandled type ${o} for property ${e}`)}}(t,e,...n);return this.addController(i)}addCanvas(t){return this.addController(new Xt(t))}addColor(t,e,n={}){const i=t[e];return St(n.format||Dt(i))?this.addController(new de(t,e,n)):this.addController(new ee(t,e,n))}addDivider(){return this.addController(new ne)}addFolder(t){return this.addController(new me(t))}addLabel(t){return this.addController(new re(t))}addButton(t,e){const n={fn:e};return this.add(n,"fn").name(t)}}class pe extends HTMLElement{constructor(){super(),this.shadow=this.attachShadow({mode:"open"})}}customElements.define("muigui-element",pe);const ge=new CSSStyleSheet,be=new CSSStyleSheet;function fe(t){let e,n;function i(){if(e&&!n){const o=e;e=void 0,n=t.replace(o).then((()=>{n=void 0,i()}))}}return function(t){e=t,i()}}const ve=fe(ge),xe=fe(be);function we(e){const{include:n,css:i}=t.themes[e];return`${n.map((e=>t[e])).join("\n")} : css.default}\n${i||""}`}class ye extends me{static converters=U;static mapRange=u;static makeRangeConverters=c;static makeRangeOptions=h;static makeMinMaxPair=m;#nt=new CSSStyleSheet;constructor(n={}){super("Controls","muigui-root"),n instanceof HTMLElement&&(n={parent:n});const{autoPlace:i=!0,width:o,title:r="Controls"}=n;let{parent:s}=n;if(o&&(this.domElement.style.width=/^\d+$/.test(o)?`${o}px`:o),void 0===s&&i&&(s=document.body,this.domElement.classList.add("muigui-auto-place")),s){const t=e("muigui-element");t.shadowRoot.adoptedStyleSheets=[this.#nt,ge,be],t.shadow.appendChild(this.domElement),s.appendChild(t)}r&&this.title(r),this.#nt.replaceSync(t.default),this.domElement.classList.add("muigui","muigui-colors")}setStyle(t){this.#nt.replace(t)}static setBaseStyles(t){ve(t)}static getBaseStyleSheet(){return ge}static setUserStyles(t){xe(t)}static getUserStyleSheet(){return be}setTheme(t){this.setStyle(we(t))}static setTheme(t){ye.setBaseStyles(we(t))}}function ke(){}const Ee={ArrowLeft:[-1,0],ArrowRight:[1,0],ArrowUp:[0,-1],ArrowDown:[0,1]};function Ie(t,{onDown:e=ke,onUp:n=ke}){const i=function(t){const i=t.shiftKey?10:1,[o,r]=(Ee[t.key]||[0,0]).map((t=>t*i));("keydown"===t.type?e:n)({type:t.type.substring(3),dx:o,dy:r,event:t})};return t.addEventListener("keydown",i),t.addEventListener("keyup",i),function(){t.removeEventListener("keydown",i),t.removeEventListener("keyup",i)}}function $e(t,e=""){if(!t)throw new Error(e)}function Ce(t,e,n,i,o,r){const s=Math.abs(n)*Math.cos(r),a=Math.abs(i)*Math.sin(r);return[t+Math.cos(o)*s-Math.sin(o)*a,e+Math.sin(o)*s+Math.cos(o)*a]}function Me(t,e,n,i,o){$e(Math.abs(i-o)<=2*Math.PI),$e(i>=-Math.PI&&i<=2*Math.PI),$e(i<=o),$e(o>=-Math.PI&&o<=4*Math.PI);const{x1:r,y1:s,x2:a,y2:l,fa:u,fs:c}=function(t,e,n,i,o,r,s){const[a,l]=Ce(t,e,n,i,o,r),[u,c]=Ce(t,e,n,i,o,r+s);return{x1:a,y1:l,x2:u,y2:c,fa:Math.abs(s)>Math.PI?1:0,fs:s>0?1:0}}(t,e,n,n,0,i,o-i);return Math.abs(Math.abs(i-o)-2*Math.PI)>Number.EPSILON?`M${t} ${e} L${r} ${s} A ${n} ${n} 0 ${u} ${c} ${a} ${l} L${t} ${e}`:`M${r} ${s} L${r} ${s} A ${n} ${n} 0 ${u} ${c} ${a} ${l}`}const Se=t=>a(t+Math.PI,2*Math.PI)-Math.PI;class Ve extends v{#it;#ot;#rt;#st;#u={step:1,min:-180,max:180,dirMin:-Math.PI,dirMax:Math.PI,wrap:void 0,converters:A};constructor(t,n={}){const i=L();super(e("div",{className:"muigui-direction muigui-no-scroll",innerHTML:'\n\n',onWheel:e=>{e.preventDefault();const{min:n,max:r,step:l}=this.#u,u=i(e,l);let c=this.#rt+u;this.#st&&(c=a(c-n,r-n)+n);const h=o(s(c,(t=>t),l),n,r);t.setValue(h)}}));const r=e=>{const{min:n,max:i,step:r,dirMin:a,dirMax:l}=this.#u,u=2*e.nx-1,c=2*e.ny-1,h=Math.atan2(c,u),d=(a+l)/2,m=o((Se(h-d)-Se(a-d))/(l-a),0,1),p=s(n+(i-n)*m,(t=>t),r);t.setValue(p)};le(this.domElement,{onDown:r,onMove:r}),Ie(this.domElement,{onDown:e=>{const{min:n,max:i,step:r}=this.#u,a=o(s(this.#rt+e.dx*r,(t=>t),r),n,i);t.setValue(a)}}),this.#it=this.$("#muigui-arrow"),this.#ot=this.$("#muigui-range"),this.setOptions(n)}updateDisplay(t){this.#rt=t;const{min:e,max:n}=this.#u,i=(t-e)/(n-e),o=(r=this.#u.dirMin,s=this.#u.dirMax,r+(s-r)*i);var r,s;this.#it.style.transform=`rotate(${o}rad)`}setOptions(t){l(this.#u,t);const{dirMin:e,dirMax:n,wrap:i}=this.#u;this.#st=void 0!==i?i:Math.abs(e-n)>=2*Math.PI-Number.EPSILON;const[o,r]=e(o.push(i),e("label",{},[e("input",{type:"radio",name:r,value:a,onChange:function(){this.checked&&t.setFinalValue(s.#D[this.value])}}),e("button",{type:"button",textContent:n,onClick:function(){this.previousElementSibling.click()}})]))))));const s=this;this.#D=o,this.cols(i)}updateDisplay(t){const e=this.#D.indexOf(t);for(let t=0;t{e({rect:t.getBoundingClientRect(),elem:t})})).observe(t)}function Ae(t,e,n,i){Ne(t,(({rect:o})=>{const{width:r,height:s}=o;t.setAttribute("viewBox",`-${r*e} -${s*n} ${r} ${s}`),i({elem:t,rect:o})}))}function je(t,e,n,i,o,r){const a=[];tt),n)),e=Math.min(e,o);for(let i=t;i<=e;i+=n)a.push(`M${i} 0 l0 ${r}`);return a.join(" ")}class Ue extends v{#at;#lt;#ut;#ct;#ht;#dt;#mt;#pt;#gt;#rt;#bt;#u={min:-100,max:100,step:1,unit:10,unitSize:10,ticksPerUnit:5,labelFn:t=>t,tickHeight:1,limits:!0,thicksColor:void 0,orientation:void 0};constructor(t,n){const i=L();let r;super(e("div",{innerHTML:'\n\n',className:"muigui-no-v-scroll",onWheel:e=>{e.preventDefault();const{min:n,max:r,step:a}=this.#u,l=i(e,a),u=o(s(this.#rt+l,(t=>t),a),n,r);t.setValue(u)}})),this.#at=this.$("svg"),this.#lt=this.$("#muigui-origin"),this.#ut=this.$("#muigui-ticks"),this.#ct=this.$("#muigui-thicks"),this.#ht=this.$("#muigui-numbers"),this.#dt=this.$("#muigui-left-grad"),this.#mt=this.$("#muigui-right-grad"),this.setOptions(n),le(this.domElement,{onDown:()=>{r=this.#rt},onMove:e=>{const{min:n,max:i,unitSize:a,unit:l,step:u}=this.#u,c=o(s(r-e.dx/a*l,(t=>t),u),n,i);t.setValue(c)}}),Ie(this.domElement,{onDown:e=>{const{min:n,max:i,step:r}=this.#u,a=o(s(this.#rt+e.dx*r,(t=>t),r),n,i);t.setValue(a)}}),Ae(this.#at,.5,0,(({rect:{width:t}})=>{this.#dt.setAttribute("x",-t/2),this.#mt.setAttribute("x",t/2-20),this.#bt=function(t){const e=t.innerHTML;t.innerHTML="- ";const n=t.querySelector("text").getComputedTextLength();return t.innerHTML=e,n}(this.#ht),this.#pt=t,this.#ft()}))}#ft(){if(!this.#pt||void 0===this.#rt)return;const{labelFn:t,limits:e,min:n,max:i,orientation:o,tickHeight:r,ticksPerUnit:a,unit:l,unitSize:u,thicksColor:c}=this.#u,h=Math.ceil(this.#pt/u),d=this.#rt/l,m=Math.round(d-h),p=m*u,g=(m+2*h)*u,b=e?n*u/l:p,f=e?i*u/l:g,v=""===t(1)?10:5;a>1&&this.#ut.setAttribute("d",je(p,g,u/a,b,f,v*r)),this.#ct.style.stroke=c,this.#ct.setAttribute("d",je(p,g,u,b,f,v)),this.#ht.innerHTML=function(t,e,n,i,o,r,a,l){const u=[];tt),n)),e=Math.min(e,a);const c=Math.max(0,-Math.log10(i));for(let r=t;r<=e;r+=n)u.push(`${h=r/n*i,l(h.toFixed(c))}`);var h;return u.join("\n")}(p,g,u,l,this.#bt,b,f,t),this.#lt.setAttribute("transform",`translate(${-this.#rt*u/l} 0)`),this.#at.classList.toggle("muigui-slider-up","up"===o)}updateDisplay(t){this.#rt=t,this.#ft()}setOptions(t){return l(this.#u,t),this}}class Le extends v{#at;#it;#H;#rt=[];constructor(t){super(e("div",{innerHTML:'\n\n',className:"muigui-no-scroll"}));const n=e=>{const{width:n,height:i}=this.#at.getBoundingClientRect(),o=2*e.nx-1,r=2*e.ny-1;t.setValue([o*n*.5,r*i*.5])};le(this.domElement,{onDown:n,onMove:n}),this.#at=this.$("svg"),this.#it=this.$("#muigui-arrow"),this.#H=this.$("#muigui-circle"),Ae(this.#at,.5,.5,(()=>this.#vt))}#vt(){const[t,e]=this.#rt;this.#it.setAttribute("d",`M0,0L${t},${e}`),this.#H.setAttribute("transform",`translate(${t}, ${e})`)}updateDisplay(t){this.#rt[0]=t[0],this.#rt[1]=t[1],this.#vt()}}return ye.ColorChooser=de,ye.Direction=class extends he{#u;constructor(t,e,n){super(t,e,"muigui-direction"),this.#u=n,this.addTop(new F(this,A)),this.addBottom(new Ve(this,n)),this.updateDisplay()}},ye.RadioGrid=class extends D{constructor(t,e,n){super(t,e,"muigui-radio-grid");const i="number"==typeof this.getValue(),{keyValues:o,cols:r=3}=n,s=H(o,i);this.add(new De(this,s,r)),this.updateDisplay()}},ye.Range=W,ye.Select=T,ye.Slider=class extends D{constructor(t,e,n={}){super(t,e,"muigui-slider"),this.add(new Ue(this,n)),this.add(new F(this,n)),this.updateDisplay()}},ye.TextNumber=P,ye.Vec2=class extends he{constructor(t,e){super(t,e,"muigui-vec2");const n=t=>({setValue:e=>{const n=this.getValue();n[t]=e,this.setValue(n)},setFinalValue:e=>{const n=this.getValue();n[t]=e,this.setFinalValue(n)}});this.addTop(new F(n(0),{converters:{to:t=>t[0],from:j.from}})),this.addTop(new F(n(1),{converters:{to:t=>t[1],from:j.from}})),this.addBottom(new Le(this)),this.updateDisplay()}},ye}));
//# sourceMappingURL=muigui.min.js.map
diff --git a/dist/0.x/muigui.min.js.map b/dist/0.x/muigui.min.js.map
index 37cc366..2f8a95a 100644
--- a/dist/0.x/muigui.min.js.map
+++ b/dist/0.x/muigui.min.js.map
@@ -1 +1 @@
-{"version":3,"file":"muigui.min.js","sources":["../../src/styles/muigui.css.js","../../src/libs/elem.js","../../src/libs/utils.js","../../../src/views/View.ts","../../src/controllers/Controller.js","../../src/controllers/Button.js","../../src/views/EditView.js","../../src/views/CheckboxView.js","../../src/libs/taskrunner.js","../../src/libs/ids.js","../../src/views/ValueView.js","../../src/controllers/LabelController.js","../../src/controllers/ValueController.js","../../src/controllers/Checkbox.js","../../src/libs/conversions.js","../../src/libs/wheel.js","../../src/views/NumberView.js","../../src/controllers/TextNumber.js","../../src/views/SelectView.js","../../src/libs/key-values.js","../../src/controllers/Select.js","../../src/views/RangeView.js","../../src/controllers/Range.js","../../src/views/TextView.js","../../src/controllers/Text.js","../../src/libs/color-utils.js","../../src/views/ElementView.js","../../src/controllers/Canvas.js","../../src/views/ColorView.js","../../src/controllers/Color.js","../../src/controllers/Divider.js","../../src/controllers/Container.js","../../src/controllers/Folder.js","../../src/controllers/Label.js","../../src/libs/touch.js","../../src/views/ColorChooserView.js","../../src/controllers/PopDownController.js","../../src/controllers/ColorChooser.js","../../src/muigui.js","../../src/controllers/create-controller.js","../../src/libs/keyboard.js","../../src/libs/assert.js","../../src/libs/svg.js","../../src/views/DirectionView.js","../../src/views/RadioGridView.js","../../src/libs/resize-helpers.js","../../src/views/SliderView.js","../../src/views/Vec2View.js","../../src/umd.js","../../src/controllers/Direction.js","../../src/controllers/RadioGrid.js","../../src/controllers/Slider.js","../../src/controllers/Vec2.js"],"sourcesContent":["export default {\n default: `\n.muigui {\n --bg-color: #ddd;\n --color: #222;\n --contrast-color: #eee;\n --value-color: #145 ;\n --value-bg-color: #eeee;\n --disabled-color: #999;\n --menu-bg-color: #f8f8f8;\n --menu-sep-color: #bbb;\n --hover-bg-color: #999;\n --focus-color: #68C;\n --range-color: #888888;\n --invalid-color: #FF0000;\n --selected-color: rgb(255, 255, 255, 0.9);\n\n --button-bg-color: var(--value-bg-color);\n\n --range-left-color: var(--value-color);\n --range-right-color: var(--value-bg-color); \n --range-right-hover-color: var(--hover-bg-color);\n\n color: var(--color);\n background-color: var(--bg-color);\n}\n\n@media (prefers-color-scheme: dark) {\n .muigui {\n --bg-color: #222222;\n --color: #dddddd;\n --contrast-color: #000;\n --value-color: #43e5f7;\n --value-bg-color: #444444;\n --disabled-color: #666666;\n --menu-bg-color: #080808;\n --menu-sep-color: #444444;\n --hover-bg-color: #666666;\n --focus-color: #88AAFF;\n --range-color: #888888;\n --invalid-color: #FF6666;\n --selected-color: rgba(255, 255, 255, 0.3);\n\n --button-bg-color: var(--value-bg-color);\n\n --range-left-color: var(--value-color);\n --range-right-color: var(--value-bg-color); \n --range-right-hover-color: var(--hover-bg-color);\n\n color: var(--color);\n background-color: var(--bg-color);\n }\n}\n\n.muigui {\n --width: 250px;\n --label-width: 45%;\n --number-width: 40%;\n\n\n --font-family: -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, Arial, sans-serif;\n --font-size: 11px;\n --font-family-mono: Menlo, Monaco, Consolas, \"Droid Sans Mono\", monospace;\n --font-size-mono: 11px;\n\n --line-height: 1.7em;\n --border-radius: 0px;\n\n width: var(--width);\n font-family: var(--font-family);\n font-size: var(--font-size);\n box-sizing: border-box;\n line-height: 100%;\n}\n.muigui * {\n box-sizing: inherit;\n}\n\n.muigui-no-scroll {\n touch-action: none;\n}\n.muigui-no-h-scroll {\n touch-action: pan-y;\n}\n.muigui-no-v-scroll {\n touch-action: pan-x;\n}\n\n.muigui-invalid-value {\n background-color: red !important;\n color: white !important;\n}\n\n.muigui-grid {\n display: grid;\n}\n.muigui-rows {\n display: flex;\n flex-direction: column;\n\n min-height: 20px;\n border: 2px solid red;\n}\n.muigui-columns {\n display: flex;\n flex-direction: row;\n\n height: 20px;\n border: 2px solid green;\n}\n.muigui-rows>*,\n.muigui-columns>* {\n flex: 1 1 auto;\n align-items: stretch;\n min-height: 0;\n min-width: 0;\n}\n\n.muigui-row {\n border: 2px solid yellow;\n min-height: 10px\n}\n.muigui-column {\n border: 2px solid lightgreen;\n}\n\n/* -------- */\n\n.muigui-show { /* */ }\n.muigui-hide { \n display: none !important;\n}\n.muigui-disabled {\n pointer-events: none;\n --color: var(--disabled-color) !important;\n --value-color: var(--disabled-color) !important;\n --range-left-color: var(--disabled-color) !important;\n}\n\n.muigui canvas,\n.muigui svg {\n display: block;\n border-radius: var(--border-radius);\n}\n.muigui canvas {\n background-color: var(--value-bg-color);\n}\n\n.muigui-controller {\n min-width: 0;\n min-height: var(--line-height);\n}\n.muigui-root,\n.muigui-menu {\n display: flex;\n flex-direction: column;\n position: relative;\n user-select: none;\n height: fit-content;\n margin: 0;\n padding-bottom: 0.1em;\n border-radius: var(--border-radius);\n}\n.muigui-menu {\n border-bottom: 1px solid var(--menu-sep-color);\n}\n\n.muigui-root>button:nth-child(1),\n.muigui-menu>button:nth-child(1) {\n border-top: 1px solid var(--menu-sep-color);\n border-bottom: 1px solid var(--menu-sep-color);\n position: relative;\n text-align: left;\n color: var(--color);\n background-color: var(--menu-bg-color);\n min-height: var(--line-height);\n padding-top: 0.2em;\n padding-bottom: 0.2em;\n cursor: pointer;\n border-radius: var(--border-radius);\n}\n.muigui-root>div:nth-child(2),\n.muigui-menu>div:nth-child(2) {\n flex: 1 1 auto;\n}\n\n.muigui-controller {\n margin-left: 0.2em;\n margin-right: 0.2em;\n}\n.muigui-root.muigui-controller,\n.muigui-menu.muigui-controller {\n margin-left: 0;\n margin-right: 0;\n}\n.muigui-controller>*:nth-child(1) {\n flex: 1 0 var(--label-width);\n min-width: 0;\n white-space: pre;\n}\n.muigui-controller>label:nth-child(1) {\n place-content: center start;\n display: inline-grid;\n overflow: hidden;\n}\n.muigui-controller>*:nth-child(2) {\n flex: 1 1 75%;\n min-width: 0;\n}\n\n/* -----------------------------------------\n a label controller is [[label][value]]\n*/\n\n.muigui-label-controller {\n display: flex;\n margin: 0.4em 0 0.4em 0;\n word-wrap: initial;\n align-items: stretch;\n}\n\n.muigui-value {\n display: flex;\n align-items: stretch;\n}\n.muigui-value>* {\n flex: 1 1 auto;\n min-width: 0;\n}\n.muigui-value>*:nth-child(1) {\n flex: 1 1 calc(100% - var(--number-width));\n}\n.muigui-value>*:nth-child(2) {\n flex: 1 1 var(--number-width);\n margin-left: 0.2em;\n}\n\n/* fix! */\n.muigui-open>button>label::before,\n.muigui-closed>button>label::before {\n width: 1.25em;\n height: var(--line-height);\n display: inline-grid;\n place-content: center start;\n pointer-events: none;\n}\n.muigui-open>button>label::before {\n content: \"ⓧ\"; /*\"▼\";*/\n}\n.muigui-closed>button>label::before {\n content: \"⨁\"; /*\"▶\";*/\n}\n.muigui-open>*:nth-child(2) {\n transition: max-height 0.2s ease-out,\n opacity 0.5s ease-out;\n max-height: 100vh;\n overflow: auto;\n opacity: 1;\n}\n\n.muigui-closed>*:nth-child(2) {\n transition: max-height 0.2s ease-out,\n opacity 1s;\n max-height: 0;\n opacity: 0;\n overflow: hidden;\n}\n\n/* ---- popdown ---- */\n\n.muigui-pop-down-top {\n display: flex;\n}\n/* fix? */\n.muigui-value>*:nth-child(1).muigui-pop-down-top {\n flex: 0;\n}\n.muigui-pop-down-bottom {\n\n}\n\n.muigui-pop-down-values {\n min-width: 0;\n display: flex;\n}\n.muigui-pop-down-values>* {\n flex: 1 1 auto;\n min-width: 0;\n}\n\n.muigui-value.muigui-pop-down-controller {\n flex-direction: column;\n}\n\n.muigui-pop-down-top input[type=checkbox] {\n -webkit-appearance: none;\n appearance: none;\n width: auto;\n color: var(--value-color);\n background-color: var(--value-bg-color);\n cursor: pointer;\n\n display: grid;\n place-content: center;\n margin: 0;\n font: inherit;\n color: currentColor;\n width: 1.7em;\n height: 1.7em;\n transform: translateY(-0.075em);\n}\n\n.muigui-pop-down-top input[type=checkbox]::before {\n content: \"+\";\n display: grid;\n place-content: center;\n border-radius: calc(var(--border-radius) + 2px);\n border-left: 1px solid rgba(255,255,255,0.3);\n border-top: 1px solid rgba(255,255,255,0.3);\n border-bottom: 1px solid rgba(0,0,0,0.2);\n border-right: 1px solid rgba(0,0,0,0.2);\n background-color: var(--range-color);\n color: var(--value-bg-color);\n width: calc(var(--line-height) - 4px);\n height: calc(var(--line-height) - 4px);\n}\n\n.muigui-pop-down-top input[type=checkbox]:checked::before {\n content: \"X\";\n}\n\n\n/* ---- select ---- */\n\n.muigui select,\n.muigui option,\n.muigui input,\n.muigui button {\n color: var(--value-color);\n background-color: var(--value-bg-color);\n font-family: var(--font-family);\n font-size: var(--font-size);\n border: none;\n margin: 0;\n border-radius: var(--border-radius);\n}\n.muigui select {\n appearance: none;\n margin: 0;\n margin-left: 0; /*?*/\n overflow: hidden; /* Safari */\n}\n\n.muigui select:focus,\n.muigui input:focus,\n.muigui button:focus {\n outline: 1px solid var(--focus-color);\n}\n\n.muigui select:hover,\n.muigui option:hover,\n.muigui input:hover,\n.muigui button:hover {\n background-color: var(--hover-bg-color); \n}\n\n/* ------ [ label ] ------ */\n\n.muigui-label {\n border-top: 1px solid var(--menu-sep-color);\n border-bottom: 1px solid var(--menu-sep-color);\n padding-top: 0.4em;\n padding-bottom: 0.3em;\n place-content: center start;\n background-color: var(--menu-bg-color);\n white-space: pre;\n border-radius: var(--border-radius);\n}\n\n/* ------ [ divider] ------ */\n\n.muigui-divider {\n min-height: 6px;\n border-top: 2px solid var(--menu-sep-color);\n margin-top: 6px;\n}\n\n/* ------ [ button ] ------ */\n\n.muigui-button {\n display: grid;\n\n}\n.muigui-button button {\n border: none;\n color: var(--value-color);\n background-color: var(--button-bg-color);\n cursor: pointer;\n place-content: center center;\n}\n\n/* ------ [ color ] ------ */\n\n.muigui-color>div {\n overflow: hidden;\n position: relative;\n margin-left: 0;\n margin-right: 0; /* why? */\n max-width: var(--line-height);\n border-radius: var(--border-radius);\n}\n\n.muigui-color>div:focus-within {\n outline: 1px solid var(--focus-color);\n}\n\n.muigui-color input[type=color] {\n border: none;\n padding: 0;\n background: inherit;\n cursor: pointer;\n position: absolute;\n width: 200%;\n left: -10px;\n top: -10px;\n height: 200%;\n}\n.muigui-disabled canvas,\n.muigui-disabled svg,\n.muigui-disabled img,\n.muigui-disabled .muigui-color input[type=color] {\n opacity: 0.2;\n}\n\n/* ------ [ checkbox ] ------ */\n\n.muigui-checkbox>label:nth-child(2) {\n display: grid;\n place-content: center start;\n margin: 0;\n}\n\n.muigui-checkbox input[type=checkbox] {\n -webkit-appearance: none;\n appearance: none;\n width: auto;\n color: var(--value-color);\n background-color: var(--value-bg-color);\n cursor: pointer;\n\n display: grid;\n place-content: center;\n margin: 0;\n font: inherit;\n color: currentColor;\n width: 1.7em;\n height: 1.7em;\n transform: translateY(-0.075em);\n}\n\n.muigui-checkbox input[type=checkbox]::before {\n content: \"\";\n color: var(--value-color);\n display: grid;\n place-content: center;\n}\n\n.muigui-checkbox input[type=checkbox]:checked::before {\n content: \"✔\";\n}\n\n.muigui input[type=number]::-webkit-inner-spin-button, \n.muigui input[type=number]::-webkit-outer-spin-button { \n -webkit-appearance: none;\n appearance: none;\n margin: 0; \n}\n.muigui input[type=number] {\n -moz-appearance: textfield;\n}\n\n/* ------ [ radio grid ] ------ */\n\n.muigui-radio-grid>div {\n display: grid;\n gap: 2px;\n}\n\n.muigui-radio-grid input {\n appearance: none;\n display: none;\n}\n\n.muigui-radio-grid button {\n color: var(--color);\n width: 100%;\n text-align: left;\n}\n\n.muigui-radio-grid input:checked + button {\n color: var(--value-color);\n background-color: var(--selected-color);\n}\n\n/* ------ [ color-chooser ] ------ */\n\n.muigui-color-chooser-cursor {\n stroke-width: 1px;\n stroke: white;\n fill: none;\n}\n.muigui-color-chooser-circle {\n stroke-width: 1px;\n stroke: white;\n fill: none;\n}\n\n\n/* ------ [ vec2 ] ------ */\n\n.muigui-vec2 svg {\n background-color: var(--value-bg-color);\n}\n\n.muigui-vec2-axis {\n stroke: 1px;\n stroke: var(--focus-color);\n}\n\n.muigui-vec2-line {\n stroke-width: 1px;\n stroke: var(--value-color);\n fill: var(--value-color);\n}\n\n/* ------ [ direction ] ------ */\n\n.muigui-direction svg {\n background-color: rgba(0,0,0,0.2);\n}\n\n.muigui-direction:focus-within svg {\n outline: none;\n}\n.muigui-direction-range {\n fill: var(--value-bg-color);\n}\n.muigui-direction svg:focus {\n outline: none;\n}\n.muigui-direction svg:focus .muigui-direction-range {\n stroke-width: 0.5px;\n stroke: var(--focus-color);\n}\n\n.muigui-direction-arrow {\n fill: var(--value-color);\n}\n\n/* ------ [ slider ] ------ */\n\n.muigui-slider>div {\n display: flex;\n align-items: stretch;\n height: var(--line-height);\n}\n.muigui-slider svg {\n flex: 1 1 auto;\n}\n.muigui-slider .muigui-slider-up #muigui-orientation {\n transform: scale(1, -1) translateY(-100%);\n}\n\n.muigui-slider .muigui-slider-up #muigui-number-orientation {\n transform: scale(1,-1);\n}\n\n.muigui-ticks {\n stroke: var(--range-color);\n}\n.muigui-thicks {\n stroke: var(--color);\n stroke-width: 2px;\n}\n.muigui-svg-text {\n fill: var(--color);\n font-size: 7px;\n}\n.muigui-mark {\n fill: var(--value-color);\n}\n\n/* ------ [ range ] ------ */\n\n\n.muigui-range input[type=range] {\n -webkit-appearance: none;\n appearance: none;\n background-color: transparent;\n}\n\n.muigui-range input[type=range]::-webkit-slider-thumb {\n -webkit-appearance: none;\n appearance: none;\n border-radius: calc(var(--border-radius) + 2px);\n border-left: 1px solid rgba(255,255,255,0.3);\n border-top: 1px solid rgba(255,255,255,0.3);\n border-bottom: 1px solid rgba(0,0,0,0.2);\n border-right: 1px solid rgba(0,0,0,0.2);\n background-color: var(--range-color);\n margin-top: calc((var(--line-height) - 2px) / -2);\n width: calc(var(--line-height) - 2px);\n height: calc(var(--line-height) - 2px);\n}\n\n.muigui-range input[type=range]::-webkit-slider-runnable-track {\n -webkit-appearance: none;\n appearance: none;\n border: 1px solid var(--menu-sep-color);\n height: 2px;\n}\n\n\n/* dat.gui style - doesn't work on Safari iOS */\n\n/*\n.muigui-range input[type=range] {\n cursor: ew-resize;\n overflow: hidden;\n}\n\n.muigui-range input[type=range] {\n -webkit-appearance: none;\n appearance: none;\n background-color: var(--range-right-color);\n margin: 0;\n}\n.muigui-range input[type=range]:hover {\n background-color: var(--range-right-hover-color);\n}\n\n.muigui-range input[type=range]::-webkit-slider-runnable-track {\n -webkit-appearance: none;\n appearance: none;\n height: max-content;\n color: var(--range-left-color);\n margin-top: -1px;\n}\n\n.muigui-range input[type=range]::-webkit-slider-thumb {\n -webkit-appearance: none;\n appearance: none;\n width: 0px;\n height: max-content;\n box-shadow: -1000px 0 0 1000px var(--range-left-color);\n}\n*/\n\n/* FF */\n/*\n.muigui-range input[type=range]::-moz-slider-progress {\n background-color: var(--range-left-color); \n}\n.muigui-range input[type=range]::-moz-slider-thumb {\n height: max-content;\n width: 0;\n border: none;\n box-shadow: -1000px 0 0 1000px var(--range-left-color);\n box-sizing: border-box;\n}\n*/\n\n.muigui-checkered-background {\n background-color: #404040;\n background-image:\n linear-gradient(45deg, #808080 25%, transparent 25%),\n linear-gradient(-45deg, #808080 25%, transparent 25%),\n linear-gradient(45deg, transparent 75%, #808080 75%),\n linear-gradient(-45deg, transparent 75%, #808080 75%);\n background-size: 16px 16px;\n background-position: 0 0, 0 8px, 8px -8px, -8px 0px;\n}\n\n/* ---------------------------------------------------------- */\n\n/* needs to be at bottom to take precedence */\n.muigui-auto-place {\n max-height: 100%;\n position: fixed;\n top: 0;\n right: 15px;\n z-index: 100001;\n}\n\n`,\nthemes: {\n default: '',\n float: `\n :root {\n color-scheme: light dark,\n }\n\n .muigui {\n --width: 400px;\n --bg-color: initial;\n --label-width: 25%;\n --number-width: 20%;\n }\n\n input,\n .muigui-label-controller>label {\n text-shadow:\n -1px -1px 0 var(--contrast-color),\n 1px -1px 0 var(--contrast-color),\n -1px 1px 0 var(--contrast-color),\n 1px 1px 0 var(--contrast-color);\n }\n\n .muigui-controller > label:nth-child(1) {\n place-content: center end;\n margin-right: 1em;\n }\n\n .muigui-value > :nth-child(2) {\n margin-left: 1em;\n }\n\n .muigui-root>*:nth-child(1) {\n display: none;\n }\n\n .muigui-range input[type=range]::-webkit-slider-thumb {\n border-radius: 1em;\n }\n\n .muigui-range input[type=range]::-webkit-slider-runnable-track {\n -webkit-appearance: initial;\n appearance: none;\n border: 1px solid rgba(0, 0, 0, 0.25);\n height: 2px;\n }\n\n .muigui-colors {\n --value-color: var(--color );\n --value-bg-color: rgba(0, 0, 0, 0.1);\n --disabled-color: #cccccc;\n --menu-bg-color: rgba(0, 0, 0, 0.1);\n --menu-sep-color: #bbbbbb;\n --hover-bg-color: rgba(0, 0, 0, 0);\n --invalid-color: #FF0000;\n --selected-color: rgba(0, 0, 0, 0.3);\n --range-color: rgba(0, 0, 0, 0.125);\n }\n`,\n},\n};\n","export function setElemProps(elem, attrs, children) {\n for (const [key, value] of Object.entries(attrs)) {\n if (typeof value === 'function' && key.startsWith('on')) {\n const eventName = key.substring(2).toLowerCase();\n elem.addEventListener(eventName, value, {passive: false});\n } else if (typeof value === 'object') {\n for (const [k, v] of Object.entries(value)) {\n elem[key][k] = v;\n }\n } else if (elem[key] === undefined) {\n elem.setAttribute(key, value);\n } else {\n elem[key] = value;\n }\n }\n for (const child of children) {\n elem.appendChild(child);\n }\n return elem;\n}\n\nexport function createElem(tag, attrs = {}, children = []) {\n const elem = document.createElement(tag);\n setElemProps(elem, attrs, children);\n return elem;\n}\n\nexport function addElem(tag, parent, attrs = {}, children = []) {\n const elem = createElem(tag, attrs, children);\n parent.appendChild(elem);\n return elem;\n}\n\nlet nextId = 0;\nexport function getNewId() {\n return `muigui-id-${nextId++}`;\n}\n","export function removeArrayElem(array, value) {\n const ndx = array.indexOf(value);\n if (ndx) {\n array.splice(ndx, 1);\n }\n return array;\n}\n\n/**\n * Converts an camelCase or snake_case id to \"camel case\" or \"snake case\"\n * @param {string} id\n */\nconst underscoreRE = /_/g;\nconst upperLowerRE = /([A-Z])([a-z])/g;\nexport function idToLabel(id) {\n return id.replace(underscoreRE, ' ')\n .replace(upperLowerRE, (m, m1, m2) => `${m1.toLowerCase()} ${m2}`);\n}\n\nexport function clamp(v, min, max) {\n return Math.max(min, Math.min(max, v));\n}\n\nexport const isTypedArray = typeof SharedArrayBuffer !== 'undefined'\n ? function isArrayBufferOrSharedArrayBuffer(a) {\n return a && a.buffer && (a.buffer instanceof ArrayBuffer || a.buffer instanceof SharedArrayBuffer);\n }\n : function isArrayBuffer(a) {\n return a && a.buffer && a.buffer instanceof ArrayBuffer;\n };\n\nexport const isArrayOrTypedArray = v => Array.isArray(v) || isTypedArray(v);\n\n// Yea, I know this should be `Math.round(v / step) * step\n// but try step = 0.1, newV = 19.95\n//\n// I get\n// Math.round(19.95 / 0.1) * 0.1\n// 19.900000000000002\n// vs\n// Math.round(19.95 / 0.1) / (1 / 0.1)\n// 19.9\n//\nexport const stepify = (v, from, step) => Math.round(from(v) / step) / (1 / step);\n\nexport const euclideanModulo = (v, n) => ((v % n) + n) % n;\nexport const lerp = (a, b, t) => a + (b - a) * t;\nexport function copyExistingProperties(dst, src) {\n for (const key in src) {\n if (key in dst) {\n dst[key] = src[key];\n }\n }\n return dst;\n}\n\nexport const mapRange = (v, inMin, inMax, outMin, outMax) => (v - inMin) * (outMax - outMin) / (inMax - inMin) + outMin;\n\nexport const makeRangeConverters = ({from, to}) => {\n return {\n to: v => mapRange(v, ...from, ...to),\n from: v => [true, mapRange(v, ...to, ...from)],\n };\n};\n\nexport const makeRangeOptions = ({from, to, step}) => {\n return {\n min: to[0],\n max: to[1],\n ...(step && {step}),\n converters: makeRangeConverters({from, to}),\n };\n};\n\n// TODO: remove an use one in conversions. Move makeRangeConverters there?\nexport const identity = {\n to: v => v,\n from: v => [true, v],\n};\nexport function makeMinMaxPair(gui, properties, minPropName, maxPropName, options) {\n const { converters: { from } = identity } = options;\n const { min, max } = options;\n const guiMinRange = options.minRange || 0;\n const valueMinRange = from(guiMinRange)[1];\n const minGui = gui\n .add(properties, minPropName, {\n ...options,\n min,\n max: max - guiMinRange,\n })\n .onChange(v => {\n maxGui.setValue(Math.min(max, Math.max(v + valueMinRange, properties[maxPropName])));\n });\n const maxGui = gui\n .add(properties, maxPropName, {\n ...options,\n min: min + guiMinRange,\n max,\n })\n .onChange(v => {\n minGui.setValue(Math.max(min, Math.min(v - valueMinRange, properties[minPropName])));\n });\n return [ minGui, maxGui ];\n}\n\n","import { removeArrayElem } from '../libs/utils.js';\n\nexport default class View {\n domElement: HTMLElement;\n\n #childDestElem: HTMLElement;\n #views: View[] = [];\n\n constructor(elem: HTMLElement) {\n this.domElement = elem;\n this.#childDestElem = elem;\n }\n addElem(elem: HTMLElement) {\n this.#childDestElem.appendChild(elem);\n return elem;\n }\n removeElem(elem: HTMLElement) {\n this.#childDestElem.removeChild(elem);\n return elem;\n }\n pushSubElem(elem: HTMLElement) {\n this.#childDestElem.appendChild(elem);\n this.#childDestElem = elem;\n }\n popSubElem() {\n this.#childDestElem = this.#childDestElem.parentElement!;\n }\n add(view: View) {\n this.#views.push(view);\n this.addElem(view.domElement);\n return view;\n }\n remove(view: View) {\n this.removeElem(view.domElement);\n removeArrayElem(this.#views, view);\n return view;\n }\n pushSubView(view: View) {\n this.pushSubElem(view.domElement);\n }\n popSubView() {\n this.popSubElem();\n }\n setOptions(options: any) {\n for (const view of this.#views) {\n view.setOptions(options);\n }\n }\n updateDisplayIfNeeded(newV: any, ignoreCache?: boolean) {\n for (const view of this.#views) {\n view.updateDisplayIfNeeded(newV, ignoreCache);\n }\n return this;\n }\n $(selector: string) {\n return this.domElement.querySelector(selector);\n }\n}","import { createElem } from '../libs/elem.js';\nimport { removeArrayElem } from '../libs/utils.js';\nimport View from '../views/View.js';\n\nexport default class Controller extends View {\n #changeFns;\n #finishChangeFns;\n #parent;\n\n constructor(className) {\n super(createElem('div', {className: 'muigui-controller'}));\n this.#changeFns = [];\n this.#finishChangeFns = [];\n // we need the specialization to come last so it takes precedence.\n if (className) {\n this.domElement.classList.add(className);\n }\n }\n get parent() {\n return this.#parent;\n }\n setParent(parent) {\n this.#parent = parent;\n this.enable(!this.disabled());\n }\n show(show = true) {\n this.domElement.classList.toggle('muigui-hide', !show);\n this.domElement.classList.toggle('muigui-show', show);\n return this;\n }\n hide() {\n return this.show(false);\n }\n disabled() {\n return !!this.domElement.closest('.muigui-disabled');\n }\n\n enable(enable = true) {\n this.domElement.classList.toggle('muigui-disabled', !enable);\n\n // If disabled we need to set the attribute 'disabled=true' to all\n // input/select/button/textarea's below\n //\n // If enabled we need to set the attribute 'disabled=false' to all below\n // until we hit a disabled controller.\n //\n // ATM the problem is we can find the input/select/button/textarea elements\n // but we can't easily find which controller they belong do.\n // But we don't need to? We can just check up if it or parent has\n // '.muigui-disabled'\n ['input', 'button', 'select', 'textarea'].forEach(tag => {\n this.domElement.querySelectorAll(tag).forEach(elem => {\n const disabled = !!elem.closest('.muigui-disabled');\n elem.disabled = disabled;\n });\n });\n\n return this;\n }\n disable(disable = true) {\n return this.enable(!disable);\n }\n onChange(fn) {\n this.removeChange(fn);\n this.#changeFns.push(fn);\n return this;\n }\n removeChange(fn) {\n removeArrayElem(this.#changeFns, fn);\n return this;\n }\n onFinishChange(fn) {\n this.removeFinishChange(fn);\n this.#finishChangeFns.push(fn);\n return this;\n }\n removeFinishChange(fn) {\n removeArrayElem(this.#finishChangeFns, fn);\n return this;\n }\n #callListeners(fns, newV) {\n for (const fn of fns) {\n fn.call(this, newV);\n }\n }\n emitChange(value, object, property) {\n this.#callListeners(this.#changeFns, value);\n if (this.#parent) {\n if (object === undefined) {\n this.#parent.emitChange(value);\n } else {\n this.#parent.emitChange({\n object,\n property,\n value,\n controller: this,\n });\n }\n }\n }\n emitFinalChange(value, object, property) {\n this.#callListeners(this.#finishChangeFns, value);\n if (this.#parent) {\n if (object === undefined) {\n this.#parent.emitChange(value);\n } else {\n this.#parent.emitFinalChange({\n object,\n property,\n value,\n controller: this,\n });\n }\n }\n }\n updateDisplay() {\n // placeholder. override\n }\n getColors() {\n const toCamelCase = s => s.replace(/-([a-z])/g, (m, m1) => m1.toUpperCase());\n const keys = [\n 'color',\n 'bg-color',\n 'value-color',\n 'value-bg-color',\n 'hover-bg-color',\n 'menu-bg-color',\n 'menu-sep-color',\n 'disabled-color',\n ];\n const div = createElem('div');\n this.domElement.appendChild(div);\n const colors = Object.fromEntries(keys.map(key => {\n div.style.color = `var(--${key})`;\n const s = getComputedStyle(div);\n return [toCamelCase(key), s.color];\n }));\n div.remove();\n return colors;\n }\n}\n","import {\n createElem,\n} from '../libs/elem.js';\nimport { copyExistingProperties } from '../libs/utils.js';\nimport Controller from './Controller.js';\n\nexport default class Button extends Controller {\n #object;\n #property;\n #buttonElem;\n #options = {\n name: '',\n };\n\n constructor(object, property, options = {}) {\n super('muigui-button', '');\n this.#object = object;\n this.#property = property;\n\n this.#buttonElem = this.addElem(\n createElem('button', {\n type: 'button',\n onClick: () => {\n this.#object[this.#property](this);\n },\n }));\n this.setOptions({name: property, ...options});\n }\n setOptions(options) {\n copyExistingProperties(this.#options, options);\n const {name} = this.#options;\n this.#buttonElem.textContent = name;\n }\n}","import { isTypedArray } from '../libs/utils.js';\nimport View from './View.js';\n\nfunction arraysEqual(a, b) {\n if (a.length !== b.length) {\n return false;\n }\n for (let i = 0; i < a.length; ++i) {\n if (a[i] !== b[i]) {\n return false;\n }\n }\n return true;\n}\n\nfunction copyArrayElementsFromTo(src, dst) {\n dst.length = src.length;\n for (let i = 0; i < src.length; ++i) {\n dst[i] = src[i];\n }\n}\n\nexport default class EditView extends View {\n #oldV;\n #updateCheck;\n\n #checkArrayNeedsUpdate(newV) {\n // It's an array, we need to compare all elements\n // Example, vec2, [r,g,b], ...\n const needUpdate = !arraysEqual(newV, this.#oldV);\n if (needUpdate) {\n copyArrayElementsFromTo(newV, this.#oldV);\n }\n return needUpdate;\n }\n\n #checkTypedArrayNeedsUpdate() {\n let once = true;\n return function checkTypedArrayNeedsUpdateImpl(newV) {\n // It's a typedarray, we need to compare all elements\n // Example: Float32Array([r, g, b])\n let needUpdate = once;\n once = false;\n if (!needUpdate) {\n needUpdate = !arraysEqual(newV, this.#oldV);\n }\n return needUpdate;\n };\n }\n\n #checkObjectNeedsUpdate(newV) {\n let needUpdate = false;\n for (const key in newV) {\n if (newV[key] !== this.#oldV[key]) {\n needUpdate = true;\n this.#oldV[key] = newV[key];\n }\n }\n return needUpdate;\n }\n\n #checkValueNeedsUpdate(newV) {\n const needUpdate = newV !== this.#oldV;\n this.#oldV = newV;\n return needUpdate;\n }\n\n #getUpdateCheckForType(newV) {\n if (Array.isArray(newV)) {\n this.#oldV = [];\n return this.#checkArrayNeedsUpdate.bind(this);\n } else if (isTypedArray(newV)) {\n this.#oldV = new newV.constructor(newV);\n return this.#checkTypedArrayNeedsUpdate(this);\n } else if (typeof newV === 'object') {\n this.#oldV = {};\n return this.#checkObjectNeedsUpdate.bind(this);\n } else {\n return this.#checkValueNeedsUpdate.bind(this);\n }\n }\n\n // The point of this is updating DOM elements\n // is slow but if we've called `listen` then\n // every frame we're going to try to update\n // things with the current value so if nothing\n // has changed then skip it.\n updateDisplayIfNeeded(newV, ignoreCache) {\n this.#updateCheck = this.#updateCheck || this.#getUpdateCheckForType(newV);\n // Note: We call #updateCheck first because it updates\n // the cache\n if (this.#updateCheck(newV) || ignoreCache) {\n this.updateDisplay(newV);\n }\n }\n setOptions(/*options*/) {\n // override this\n return this;\n }\n}\n","import { createElem } from '../libs/elem.js';\nimport EditView from './EditView.js';\n\nexport default class CheckboxView extends EditView {\n #checkboxElem;\n constructor(setter, id) {\n const checkboxElem = createElem('input', {\n type: 'checkbox',\n id,\n onInput: () => {\n setter.setValue(checkboxElem.checked);\n },\n onChange: () => {\n setter.setFinalValue(checkboxElem.checked);\n },\n });\n super(createElem('label', {}, [checkboxElem]));\n this.#checkboxElem = checkboxElem;\n }\n updateDisplay(v) {\n this.#checkboxElem.checked = v;\n }\n}\n","import { removeArrayElem } from './utils.js';\n\nconst tasks = [];\nconst tasksToRemove = new Set();\n\nlet requestId;\nlet processing;\n\nfunction removeTasks() {\n if (!tasksToRemove.size) {\n return;\n }\n\n if (processing) {\n queueProcessing();\n return;\n }\n\n tasksToRemove.forEach(task => {\n removeArrayElem(tasks, task);\n });\n tasksToRemove.clear();\n}\n\nfunction processTasks() {\n requestId = undefined;\n processing = true;\n for (const task of tasks) {\n if (!tasksToRemove.has(task)) {\n task();\n }\n }\n processing = false;\n removeTasks();\n queueProcessing();\n}\n\nfunction queueProcessing() {\n if (!requestId && tasks.length) {\n requestId = requestAnimationFrame(processTasks);\n }\n}\n\nexport function addTask(fn) {\n tasks.push(fn);\n queueProcessing();\n}\n\nexport function removeTask(fn) {\n tasksToRemove.set(fn);\n\n const ndx = tasks.indexOf(fn);\n if (ndx >= 0) {\n tasks.splice(ndx, 1);\n }\n}","let id = 0;\n\nexport function makeId() {\n return `muigui-${++id}`;\n}\n","import { createElem } from '../libs/elem.js';\nimport View from './View.js';\n\nexport default class ValueView extends View {\n constructor(className = '') {\n super(createElem('div', {className: 'muigui-value'}));\n if (className) {\n this.domElement.classList.add(className);\n }\n }\n}","import { createElem } from '../libs/elem.js';\nimport { makeId } from '../libs/ids.js';\nimport ValueView from '../views/ValueView.js';\nimport Controller from './Controller.js';\n\nexport default class LabelController extends Controller {\n #id;\n #nameElem;\n\n constructor(className = '', name = '') {\n super('muigui-label-controller');\n this.#id = makeId();\n this.#nameElem = createElem('label', {for: this.#id});\n this.domElement.appendChild(this.#nameElem);\n this.pushSubView(new ValueView(className));\n this.name(name);\n }\n get id() {\n return this.#id;\n }\n name(name) {\n if (this.#nameElem.title === this.#nameElem.textContent) {\n this.#nameElem.title = name;\n }\n this.#nameElem.textContent = name;\n return this;\n }\n tooltip(tip) {\n this.#nameElem.title = tip;\n }\n}\n\n","import {addTask, removeTask} from '../libs/taskrunner.js';\nimport { isTypedArray } from '../libs/utils.js';\nimport LabelController from './LabelController.js';\n\nexport default class ValueController extends LabelController {\n #object;\n #property;\n #initialValue;\n #listening;\n #views;\n #updateFn;\n\n constructor(object, property, className = '') {\n super(className, property);\n this.#object = object;\n this.#property = property;\n this.#initialValue = this.getValue();\n this.#listening = false;\n this.#views = [];\n }\n get initialValue() {\n return this.#initialValue;\n }\n get object() {\n return this.#object;\n }\n get property() {\n return this.#property;\n }\n add(view) {\n this.#views.push(view);\n super.add(view);\n this.updateDisplay();\n return view;\n }\n #setValueImpl(v, ignoreCache) {\n let isDifferent = false;\n if (typeof v === 'object') {\n const dst = this.#object[this.#property];\n // don't replace objects, just their values.\n if (Array.isArray(v) || isTypedArray(v)) {\n for (let i = 0; i < v.length; ++i) {\n isDifferent ||= dst[i] !== v[i];\n dst[i] = v[i];\n }\n } else {\n for (const key of Object.keys(v)) {\n isDifferent ||= dst[key] !== v[key];\n }\n Object.assign(dst, v);\n }\n } else {\n isDifferent = this.#object[this.#property] !== v;\n this.#object[this.#property] = v;\n }\n this.updateDisplay(ignoreCache);\n if (isDifferent) {\n this.emitChange(this.getValue(), this.#object, this.#property);\n }\n return isDifferent;\n }\n setValue(v) {\n this.#setValueImpl(v);\n }\n setFinalValue(v) {\n const isDifferent = this.#setValueImpl(v, true);\n if (isDifferent) {\n this.emitFinalChange(this.getValue(), this.#object, this.#property);\n }\n return this;\n }\n updateDisplay(ignoreCache) {\n const newV = this.getValue();\n for (const view of this.#views) {\n view.updateDisplayIfNeeded(newV, ignoreCache);\n }\n return this;\n }\n setOptions(options) {\n for (const view of this.#views) {\n view.setOptions(options);\n }\n this.updateDisplay();\n return this;\n }\n getValue() {\n return this.#object[this.#property];\n }\n value(v) {\n this.setValue(v);\n return this;\n }\n reset() {\n this.setValue(this.#initialValue);\n return this;\n }\n listen(listen = true) {\n if (!this.#updateFn) {\n this.#updateFn = this.updateDisplay.bind(this);\n }\n if (listen) {\n if (!this.#listening) {\n this.#listening = true;\n addTask(this.#updateFn);\n }\n } else {\n if (this.#listening) {\n this.#listening = false;\n removeTask(this.#updateFn);\n }\n }\n return this;\n }\n}\n\n","import CheckboxView from '../views/CheckboxView.js';\nimport ValueController from './ValueController.js';\n\nexport default class Checkbox extends ValueController {\n constructor(object, property) {\n super(object, property, 'muigui-checkbox');\n const id = this.id;\n this.add(new CheckboxView(this, id));\n this.updateDisplay();\n }\n}","import {\n makeRangeConverters,\n} from './utils.js';\n\nexport const identity = {\n to: v => v,\n from: v => [true, v],\n};\n\n// from: from string to value\n// to: from value to string\nexport const strToNumber = {\n to: v => v.toString(),\n from: v => {\n const newV = parseFloat(v);\n return [!Number.isNaN(newV), newV];\n },\n};\n\nexport const converters = {\n radToDeg: makeRangeConverters({to: [0, 180], from: [0, Math.PI]}),\n};\n","export function createWheelHelper() {\n let wheelAccum = 0;\n return function (e, step, wheelScale = 5) {\n wheelAccum -= e.deltaY * step / wheelScale;\n const wheelSteps = Math.floor(Math.abs(wheelAccum) / step) * Math.sign(wheelAccum);\n const delta = wheelSteps * step;\n wheelAccum -= delta;\n return delta;\n };\n}\n","import { createElem } from '../libs/elem.js';\nimport { strToNumber } from '../libs/conversions.js';\nimport { createWheelHelper } from '../libs/wheel.js';\nimport { clamp, copyExistingProperties, stepify } from '../libs/utils.js';\nimport EditView from './EditView.js';\n\nexport default class NumberView extends EditView {\n #to;\n #from;\n #step;\n #skipUpdate;\n #options = {\n step: 0.01,\n converters: strToNumber,\n min: Number.NEGATIVE_INFINITY,\n max: Number.POSITIVE_INFINITY,\n };\n\n constructor(setter, options) {\n const setValue = setter.setValue.bind(setter);\n const setFinalValue = setter.setFinalValue.bind(setter);\n const wheelHelper = createWheelHelper();\n super(createElem('input', {\n type: 'number',\n onInput: () => this.#handleInput(setValue, true),\n onChange: () => this.#handleInput(setFinalValue, false),\n onWheel: e => {\n e.preventDefault();\n const {min, max, step} = this.#options;\n const delta = wheelHelper(e, step);\n const v = parseFloat(this.domElement.value);\n const newV = clamp(stepify(v + delta, v => v, step), min, max);\n setter.setValue(newV);\n },\n }));\n this.setOptions(options);\n }\n #handleInput(setFn, skipUpdate) {\n const v = parseFloat(this.domElement.value);\n const [valid, newV] = this.#from(v);\n let inRange;\n if (valid && !Number.isNaN(v)) {\n const {min, max} = this.#options;\n inRange = newV >= min && newV <= max;\n this.#skipUpdate = skipUpdate;\n setFn(clamp(newV, min, max));\n }\n this.domElement.classList.toggle('muigui-invalid-value', !valid || !inRange);\n }\n updateDisplay(v) {\n if (!this.#skipUpdate) {\n this.domElement.value = stepify(v, this.#to, this.#step);\n }\n this.#skipUpdate = false;\n }\n setOptions(options) {\n copyExistingProperties(this.#options, options);\n const {\n step,\n converters: {to, from},\n } = this.#options;\n this.#to = to;\n this.#from = from;\n this.#step = step;\n return this;\n }\n}\n","\nimport NumberView from '../views/NumberView.js';\nimport ValueController from './ValueController.js';\n\n// Wanted to name this `Number` but it conflicts with\n// JavaScript `Number`. It most likely wouldn't be\n// an issue? But users might `import {Number} ...` and\n// things would break.\nexport default class TextNumber extends ValueController {\n #textView;\n #step;\n\n constructor(object, property, options = {}) {\n super(object, property, 'muigui-checkbox');\n this.#textView = this.add(new NumberView(this, options));\n this.updateDisplay();\n }\n}","import { createElem } from '../libs/elem.js';\nimport EditView from './EditView.js';\n\nexport default class SelectView extends EditView {\n #values;\n\n constructor(setter, keyValues) {\n const values = [];\n super(createElem('select', {\n onChange: () => {\n setter.setFinalValue(this.#values[this.domElement.selectedIndex]);\n },\n }, keyValues.map(([key, value]) => {\n values.push(value);\n return createElem('option', {textContent: key});\n })));\n this.#values = values;\n }\n updateDisplay(v) {\n const ndx = this.#values.indexOf(v);\n this.domElement.selectedIndex = ndx;\n }\n}\n","\n// 4 cases\n// (a) keyValues is array of arrays, each sub array is key value\n// (b) keyValues is array and value is number then keys = array contents, value = index\n// (c) keyValues is array and value is not number, key = array contents, value = array contents\n// (d) keyValues is object then key->value\nexport function convertToKeyValues(keyValues, valueIsNumber) {\n if (Array.isArray(keyValues)) {\n if (Array.isArray(keyValues[0])) {\n // (a) keyValues is array of arrays, each sub array is key value\n return keyValues;\n } else {\n if (valueIsNumber) {\n // (b) keyValues is array and value is number then keys = array contents, value = index\n return keyValues.map((v, ndx) => [v, ndx]);\n } else {\n // (c) keyValues is array and value is not number, key = array contents, value = array contents\n return keyValues.map(v => [v, v]);\n }\n }\n } else {\n // (d)\n return [...Object.entries(keyValues)];\n }\n}\n","import SelectView from '../views/SelectView.js';\nimport ValueController from './ValueController.js';\nimport { convertToKeyValues } from '../libs/key-values.js';\n\nexport default class Select extends ValueController {\n constructor(object, property, options) {\n super(object, property, 'muigui-select');\n const valueIsNumber = typeof this.getValue() === 'number';\n const {keyValues: keyValuesInput} = options;\n const keyValues = convertToKeyValues(keyValuesInput, valueIsNumber);\n this.add(new SelectView(this, keyValues));\n this.updateDisplay();\n }\n}","import { createElem } from '../libs/elem.js';\nimport { identity } from '../libs/conversions.js';\nimport { clamp, copyExistingProperties, stepify } from '../libs/utils.js';\nimport { createWheelHelper } from '../libs/wheel.js';\nimport EditView from './EditView.js';\n\nexport default class RangeView extends EditView {\n #to;\n #from;\n #step;\n #skipUpdate;\n #options = {\n step: 0.01,\n min: 0,\n max: 1,\n converters: identity,\n };\n\n constructor(setter, options) {\n const wheelHelper = createWheelHelper();\n super(createElem('input', {\n type: 'range',\n onInput: () => {\n this.#skipUpdate = true;\n const {min, max, step} = this.#options;\n const v = parseFloat(this.domElement.value);\n const newV = clamp(stepify(v, v => v, step), min, max);\n const [valid, validV] = this.#from(newV);\n if (valid) {\n setter.setValue(validV);\n }\n },\n onChange: () => {\n this.#skipUpdate = true;\n const {min, max, step} = this.#options;\n const v = parseFloat(this.domElement.value);\n const newV = clamp(stepify(v, v => v, step), min, max);\n const [valid, validV] = this.#from(newV);\n if (valid) {\n setter.setFinalValue(validV);\n }\n },\n onWheel: e => {\n e.preventDefault();\n const [valid, v] = this.#from(parseFloat(this.domElement.value));\n if (!valid) {\n return;\n }\n const {min, max, step} = this.#options;\n const delta = wheelHelper(e, step);\n const newV = clamp(stepify(v + delta, v => v, step), min, max);\n setter.setValue(newV);\n },\n }));\n this.setOptions(options);\n }\n updateDisplay(v) {\n if (!this.#skipUpdate) {\n this.domElement.value = stepify(v, this.#to, this.#step);\n }\n this.#skipUpdate = false;\n }\n setOptions(options) {\n copyExistingProperties(this.#options, options);\n const {\n step,\n min,\n max,\n converters: {to, from},\n } = this.#options;\n this.#to = to;\n this.#from = from;\n this.#step = step;\n this.domElement.step = step;\n this.domElement.min = min;\n this.domElement.max = max;\n return this;\n }\n}","import ValueController from './ValueController.js';\nimport NumberView from '../views/NumberView.js';\nimport RangeView from '../views/RangeView.js';\n\nexport default class Range extends ValueController {\n constructor(object, property, options) {\n super(object, property, 'muigui-range');\n this.add(new RangeView(this, options));\n this.add(new NumberView(this, options));\n }\n}\n","import { createElem } from '../libs/elem.js';\nimport { identity } from '../libs/conversions.js';\nimport EditView from './EditView.js';\nimport { copyExistingProperties } from '../libs/utils.js';\n\nexport default class TextView extends EditView {\n #to;\n #from;\n #skipUpdate;\n #options = {\n converters: identity,\n };\n\n constructor(setter, options) {\n const setValue = setter.setValue.bind(setter);\n const setFinalValue = setter.setFinalValue.bind(setter);\n super(createElem('input', {\n type: 'text',\n onInput: () => this.#handleInput(setValue, true),\n onChange: () => this.#handleInput(setFinalValue, false),\n }));\n this.setOptions(options);\n }\n #handleInput(setFn, skipUpdate) {\n const [valid, newV] = this.#from(this.domElement.value);\n if (valid) {\n this.#skipUpdate = skipUpdate;\n setFn(newV);\n }\n this.domElement.style.color = valid ? '' : 'var(--invalid-color)';\n\n }\n updateDisplay(v) {\n if (!this.#skipUpdate) {\n this.domElement.value = this.#to(v);\n this.domElement.style.color = '';\n }\n this.#skipUpdate = false;\n }\n setOptions(options) {\n copyExistingProperties(this.#options, options);\n const {\n converters: {to, from},\n } = this.#options;\n this.#to = to;\n this.#from = from;\n return this;\n }\n}\n","import TextView from '../views/TextView.js';\nimport ValueController from './ValueController.js';\n\nexport default class Text extends ValueController {\n constructor(object, property) {\n super(object, property, 'muigui-checkbox');\n this.add(new TextView(this));\n this.updateDisplay();\n }\n}","const clamp = (v, min, max) => Math.max(min, Math.min(max, v));\nconst lerp = (a, b, t) => a + (b - a) * t;\nconst fract = v => v >= 0 ? v % 1 : 1 - (v % 1);\n\nconst f0 = v => +v.toFixed(0); // converts to string (eg 1.2 => \"1\"), then converts back to number (eg, \"1.200\" => 1.2)\nconst f3 = v => +v.toFixed(3); // converts to string (eg 1.2 => \"1.200\"), then converts back to number (eg, \"1.200\" => 1.2)\n\nconst hexToUint32RGB = v => (parseInt(v.substring(1, 3), 16) << 16) |\n (parseInt(v.substring(3, 5), 16) << 8 ) |\n (parseInt(v.substring(5, 7), 16) );\nconst uint32RGBToHex = v => `#${(Math.round(v)).toString(16).padStart(6, '0')}`;\nconst hexToUint32RGBA = v => (parseInt(v.substring(1, 3), 16) * 2 ** 24) +\n (parseInt(v.substring(3, 5), 16) * 2 ** 16) +\n (parseInt(v.substring(5, 7), 16) * 2 ** 8) +\n (parseInt(v.substring(7, 9), 16) );\nconst uint32RGBAToHex = v => `#${(Math.round(v)).toString(16).padStart(8, '0')}`;\n\nexport const hexToUint8RGB = v => [\n parseInt(v.substring(1, 3), 16),\n parseInt(v.substring(3, 5), 16),\n parseInt(v.substring(5, 7), 16),\n];\nexport const uint8RGBToHex = v => `#${Array.from(v).map(v => v.toString(16).padStart(2, '0')).join('')}`;\n\nexport const hexToUint8RGBA = v => [\n parseInt(v.substring(1, 3), 16),\n parseInt(v.substring(3, 5), 16),\n parseInt(v.substring(5, 7), 16),\n parseInt(v.substring(7, 9), 16),\n];\nexport const uint8RGBAToHex = v => `#${Array.from(v).map(v => v.toString(16).padStart(2, '0')).join('')}`;\n\nexport const hexToFloatRGB = v => hexToUint8RGB(v).map(v => f3(v / 255));\nexport const floatRGBToHex = v => uint8RGBToHex(Array.from(v).map(v => Math.round(clamp(v * 255, 0, 255))));\n\nexport const hexToFloatRGBA = v => hexToUint8RGBA(v).map(v => f3(v / 255));\nexport const floatRGBAToHex = v => uint8RGBAToHex(Array.from(v).map(v => Math.round(clamp(v * 255, 0, 255))));\n\nconst scaleAndClamp = v => clamp(Math.round(v * 255), 0, 255).toString(16).padStart(2, '0');\n\nconst hexToObjectRGB = v => ({\n r: parseInt(v.substring(1, 3), 16) / 255,\n g: parseInt(v.substring(3, 5), 16) / 255,\n b: parseInt(v.substring(5, 7), 16) / 255,\n});\nconst objectRGBToHex = v => `#${scaleAndClamp(v.r)}${scaleAndClamp(v.g)}${scaleAndClamp(v.b)}`;\nconst hexToObjectRGBA = v => ({\n r: parseInt(v.substring(1, 3), 16) / 255,\n g: parseInt(v.substring(3, 5), 16) / 255,\n b: parseInt(v.substring(5, 7), 16) / 255,\n a: parseInt(v.substring(7, 9), 16) / 255,\n});\nconst objectRGBAToHex = v => `#${scaleAndClamp(v.r)}${scaleAndClamp(v.g)}${scaleAndClamp(v.b)}${scaleAndClamp(v.a)}`;\n\nconst hexToCssRGB = v => `rgb(${hexToUint8RGB(v).join(', ')})`;\nconst cssRGBRegex = /^\\s*rgb\\(\\s*(\\d+)\\s*,\\s*(\\d+)\\s*,\\s*(\\d+)\\s*\\)\\s*$/;\nconst cssRGBToHex = v => {\n const m = cssRGBRegex.exec(v);\n return uint8RGBToHex([m[1], m[2], m[3]].map(v => parseInt(v)));\n};\nconst hexToCssRGBA = v => `rgba(${hexToUint8RGBA(v).map((v, i) => i === 3 ? v / 255 : v).join(', ')})`;\nconst cssRGBARegex = /^\\s*rgba\\(\\s*(\\d+)\\s*,\\s*(\\d+)\\s*,\\s*(\\d+)\\s*,\\s*(\\d+\\.\\d+|\\d+)\\s*\\)\\s*$/;\nconst cssRGBAToHex = v => {\n const m = cssRGBARegex.exec(v);\n return uint8RGBAToHex([m[1], m[2], m[3], m[4]].map((v, i) => i === 3 ? (parseFloat(v) * 255 | 0) : parseInt(v)));\n};\n\nconst hexToCssHSL = v => {\n const hsl = rgbUint8ToHsl(hexToUint8RGB(v)).map(v => f0(v));\n return `hsl(${hsl[0]}, ${hsl[1]}%, ${hsl[2]}%)`;\n};\nconst hexToCssHSLA = v => {\n const hsla = rgbaUint8ToHsla(hexToUint8RGBA(v)).map((v, i) => i === 3 ? f3(v) : f0(v));\n return `hsl(${hsla[0]} ${hsla[1]}% ${hsla[2]}% / ${hsla[3]})`;\n};\nconst cssHSLRegex = /^\\s*hsl\\(\\s*(\\d+)(?:deg|)\\s*(?:,|)\\s*(\\d+)%\\s*(?:,|)\\s*(\\d+)%\\s*\\)\\s*$/;\nconst cssHSLARegex = /^\\s*hsl\\(\\s*(\\d+)(?:deg|)\\s*(?:,|)\\s*(\\d+)%\\s*(?:,|)\\s*(\\d+)%\\s*\\/\\s*(\\d+\\.\\d+|\\d+)\\s*\\)\\s*$/;\n\nconst hex3DigitTo6Digit = v => `${v[0]}${v[0]}${v[1]}${v[1]}${v[2]}${v[2]}`;\nconst cssHSLToHex = v => {\n const m = cssHSLRegex.exec(v);\n const rgb = hslToRgbUint8([m[1], m[2], m[3]].map(v => parseFloat(v)));\n return uint8RGBToHex(rgb);\n};\nconst cssHSLAToHex = v => {\n const m = cssHSLARegex.exec(v);\n const rgba = hslaToRgbaUint8([m[1], m[2], m[3], m[4]].map(v => parseFloat(v)));\n return uint8RGBAToHex(rgba);\n};\n\nconst euclideanModulo = (v, n) => ((v % n) + n) % n;\n\nexport function hslToRgbUint8([h, s, l]) {\n h = euclideanModulo(h, 360);\n s = clamp(s / 100, 0, 1);\n l = clamp(l / 100, 0, 1);\n\n const a = s * Math.min(l, 1 - l);\n\n function f(n) {\n const k = (n + h / 30) % 12;\n return l - a * Math.max(-1, Math.min(k - 3, 9 - k, 1));\n }\n\n return [f(0), f(8), f(4)].map(v => Math.round(v * 255));\n}\n\nexport function hslaToRgbaUint8([h, s, l, a]) {\n const rgb = hslToRgbUint8([h, s, l]);\n return [...rgb, a * 255 | 0];\n}\n\nexport function rgbFloatToHsl01([r, g, b]) {\n const max = Math.max(r, g, b);\n const min = Math.min(r, g, b);\n const l = (min + max) * 0.5;\n const d = max - min;\n let h = 0;\n let s = 0;\n\n if (d !== 0) {\n s = (l === 0 || l === 1)\n ? 0\n : (max - l) / Math.min(l, 1 - l);\n\n switch (max) {\n case r: h = (g - b) / d + (g < b ? 6 : 0); break;\n case g: h = (b - r) / d + 2; break;\n case b: h = (r - g) / d + 4;\n }\n }\n\n return [h / 6, s, l];\n}\n\nexport function rgbaFloatToHsla01([r, g, b, a]) {\n const hsl = rgbFloatToHsl01([r, g, b]);\n return [...hsl, a];\n}\n\nexport const rgbUint8ToHsl = (rgb) => {\n const [h, s, l] = rgbFloatToHsl01(rgb.map(v => v / 255));\n return [h * 360, s * 100, l * 100];\n};\n\nexport const rgbaUint8ToHsla = (rgba) => {\n const [h, s, l, a] = rgbaFloatToHsla01(rgba.map(v => v / 255));\n return [h * 360, s * 100, l * 100, a];\n};\n\nexport function hsv01ToRGBFloat([hue, sat, val]) {\n sat = clamp(sat, 0, 1);\n val = clamp(val, 0, 1);\n return [hue, hue + 2 / 3, hue + 1 / 3].map(\n v => lerp(1, clamp(Math.abs(fract(v) * 6 - 3.0) - 1, 0, 1), sat) * val\n );\n}\n\nexport function hsva01ToRGBAFloat([hue, sat, val, alpha]) {\n const rgb = hsv01ToRGBFloat([hue, sat, val]);\n return [...rgb, alpha];\n}\n\nconst round3 = v => Math.round(v * 1000) / 1000;\n\nexport function rgbFloatToHSV01([r, g, b]) {\n const p = b > g\n ? [b, g, -1, 2 / 3]\n : [g, b, 0, -1 / 3];\n const q = p[0] > r\n ? [p[0], p[1], p[3], r]\n : [r, p[1], p[2], p[0]];\n const d = q[0] - Math.min(q[3], q[1]);\n return [\n Math.abs(q[2] + (q[3] - q[1]) / (6 * d + Number.EPSILON)),\n d / (q[0] + Number.EPSILON),\n q[0],\n ].map(round3);\n}\n\nexport function rgbaFloatToHSVA01([r, g, b, a]) {\n const hsv = rgbFloatToHSV01([r, g, b]);\n return [...hsv, a];\n}\n\n// window.hsv01ToRGBFloat = hsv01ToRGBFloat;\n// window.rgbFloatToHSV01 = rgbFloatToHSV01;\n\n// Yea, meh!\nexport const hasAlpha = format => format.endsWith('a') || format.startsWith('hex8');\n\nconst cssStringFormats = [\n { re: /^#(?:[0-9a-f]){6}$/i, format: 'hex6' },\n { re: /^(?:[0-9a-f]){6}$/i, format: 'hex6-no-hash' },\n { re: /^#(?:[0-9a-f]){8}$/i, format: 'hex8' },\n { re: /^(?:[0-9a-f]){8}$/i, format: 'hex8-no-hash' },\n { re: /^#(?:[0-9a-f]){3}$/i, format: 'hex3' },\n { re: /^(?:[0-9a-f]){3}$/i, format: 'hex3-no-hash' },\n { re: cssRGBRegex, format: 'css-rgb' },\n { re: cssHSLRegex, format: 'css-hsl' },\n { re: cssRGBARegex, format: 'css-rgba' },\n { re: cssHSLARegex, format: 'css-hsla' },\n];\n\nfunction guessStringColorFormat(v) {\n for (const formatInfo of cssStringFormats) {\n if (formatInfo.re.test(v)) {\n return formatInfo;\n }\n }\n return undefined;\n}\n\nexport function guessFormat(v) {\n switch (typeof v) {\n case 'number':\n console.warn('can not reliably guess format based on a number. You should pass in a format like {format: \"uint32-rgb\"} or {format: \"uint32-rgb\"}');\n return v <= 0xFFFFFF ? 'uint32-rgb' : 'uint32-rgba';\n case 'string': {\n const formatInfo = guessStringColorFormat(v.trim());\n if (formatInfo) {\n return formatInfo.format;\n }\n break;\n }\n case 'object':\n if (v instanceof Uint8Array || v instanceof Uint8ClampedArray) {\n if (v.length === 3) {\n return 'uint8-rgb';\n } else if (v.length === 4) {\n return 'uint8-rgba';\n }\n } else if (v instanceof Float32Array) {\n if (v.length === 3) {\n return 'float-rgb';\n } else if (v.length === 4) {\n return 'float-rgba';\n }\n } else if (Array.isArray(v)) {\n if (v.length === 3) {\n return 'float-rgb';\n } else if (v.length === 4) {\n return 'float-rgba';\n }\n } else {\n if ('r' in v && 'g' in v && 'b' in v) {\n if ('a' in v) {\n return 'object-rgba';\n } else {\n return 'object-rgb';\n }\n }\n }\n }\n throw new Error(`unknown color format: ${v}`);\n}\n\nfunction fixHex6(v) {\n return v.trim(v);\n //const formatInfo = guessStringColorFormat(v.trim());\n //const fix = formatInfo ? formatInfo.fix : v => v;\n //return fix(v.trim());\n}\n\nfunction fixHex8(v) {\n return v.trim(v);\n //const formatInfo = guessStringColorFormat(v.trim());\n //const fix = formatInfo ? formatInfo.fix : v => v;\n //return fix(v.trim());\n}\n\nfunction hex6ToHex3(hex6) {\n return (hex6[1] === hex6[2] &&\n hex6[3] === hex6[4] &&\n hex6[5] === hex6[6])\n ? `#${hex6[1]}${hex6[3]}${hex6[5]}`\n : hex6;\n}\n\nconst hex3RE = /^(#|)([0-9a-f]{3})$/i;\nfunction hex3ToHex6(hex3) {\n const m = hex3RE.exec(hex3);\n if (m) {\n const [, , m2] = m;\n return `#${hex3DigitTo6Digit(m2)}`;\n }\n return hex3;\n}\n\nfunction fixHex3(v) {\n return hex6ToHex3(fixHex6(v));\n}\n\nconst strToRGBObject = (s) => {\n try {\n const json = s.replace(/([a-z])/g, '\"$1\"');\n const rgb = JSON.parse(json);\n if (Number.isNaN(rgb.r) || Number.isNaN(rgb.g) || Number.isNaN(rgb.b)) {\n throw new Error('not {r, g, b}');\n }\n return [true, rgb];\n } catch (e) {\n return [false];\n }\n};\n\nconst strToRGBAObject = (s) => {\n try {\n const json = s.replace(/([a-z])/g, '\"$1\"');\n const rgba = JSON.parse(json);\n if (Number.isNaN(rgba.r) || Number.isNaN(rgba.g) || Number.isNaN(rgba.b) || Number.isNaN(rgba.a)) {\n throw new Error('not {r, g, b, a}');\n }\n return [true, rgba];\n } catch (e) {\n return [false];\n }\n};\n\nconst strToCssRGB = s => {\n const m = cssRGBRegex.exec(s);\n if (!m) {\n return [false];\n }\n const v = [m[1], m[2], m[3]].map(v => parseInt(v));\n const outOfRange = v.find(v => v > 255);\n return [!outOfRange, `rgb(${v.join(', ')})`];\n};\n\nconst strToCssRGBA = s => {\n const m = cssRGBARegex.exec(s);\n if (!m) {\n return [false];\n }\n const v = [m[1], m[2], m[3], m[4]].map((v, i) => i === 3 ? parseFloat(v) : parseInt(v));\n const outOfRange = v.find(v => v > 255);\n return [!outOfRange, `rgba(${v.join(', ')})`];\n};\n\nconst strToCssHSL = s => {\n const m = cssHSLRegex.exec(s);\n if (!m) {\n return [false];\n }\n const v = [m[1], m[2], m[3]].map(v => parseFloat(v));\n const outOfRange = v.find(v => Number.isNaN(v));\n return [!outOfRange, `hsl(${v[0]}, ${v[1]}%, ${v[2]}%)`];\n};\n\nconst strToCssHSLA = s => {\n const m = cssHSLARegex.exec(s);\n if (!m) {\n return [false];\n }\n const v = [m[1], m[2], m[3], m[4]].map(v => parseFloat(v));\n const outOfRange = v.find(v => Number.isNaN(v));\n return [!outOfRange, `hsl(${v[0]} ${v[1]}% ${v[2]}% / ${v[3]})`];\n};\n\nconst rgbObjectToStr = rgb => {\n return `{r:${f3(rgb.r)}, g:${f3(rgb.g)}, b:${f3(rgb.b)}}`;\n};\nconst rgbaObjectToStr = rgba => {\n return `{r:${f3(rgba.r)}, g:${f3(rgba.g)}, b:${f3(rgba.b)}}, a:${f3(rgba.a)}}`;\n};\n\nconst strTo3IntsRE = /^\\s*(\\d+)\\s*,\\s*(\\d+)\\s*,\\s*(\\d+)\\s*$/;\nconst strTo3Ints = s => {\n const m = strTo3IntsRE.exec(s);\n if (!m) {\n return [false];\n }\n const v = [m[1], m[2], m[3]].map(v => parseInt(v));\n const outOfRange = v.find(v => v > 255);\n return [!outOfRange, v];\n};\n\nconst strTo4IntsRE = /^\\s*(\\d+)\\s*,\\s*(\\d+)\\s*,\\s*(\\d+)\\s*$/;\nconst strTo4Ints = s => {\n const m = strTo4IntsRE.exec(s);\n if (!m) {\n return [false];\n }\n const v = [m[1], m[2], m[3], m[4]].map(v => parseInt(v));\n const outOfRange = v.find(v => v > 255);\n return [!outOfRange, v];\n};\n\nconst strTo3Floats = s => {\n const numbers = s.split(',').map(s => s.trim());\n const v = numbers.map(v => parseFloat(v));\n if (v.length !== 3) {\n return [false];\n }\n // Note: using isNaN not Number.isNaN\n const badNdx = numbers.findIndex(v => isNaN(v));\n return [badNdx < 0, v.map(v => f3(v))];\n};\n\nconst strTo4Floats = s => {\n const numbers = s.split(',').map(s => s.trim());\n const v = numbers.map(v => parseFloat(v));\n if (v.length !== 4) {\n return [false];\n }\n // Note: using isNaN not Number.isNaN\n const badNdx = numbers.findIndex(v => isNaN(v));\n return [badNdx < 0, v.map(v => f3(v))];\n};\n\nconst strToUint32RGBRegex = /^\\s*(?:0x){0,1}([0-9a-z]{1,6})\\s*$/i;\nconst strToUint32RGB = s => {\n const m = strToUint32RGBRegex.exec(s);\n if (!m) {\n return [false];\n }\n return [true, parseInt(m[1], 16)];\n};\n\nconst strToUint32RGBARegex = /^\\s*(?:0x){0,1}([0-9a-z]{1,8})\\s*$/i;\nconst strToUint32RGBA = s => {\n const m = strToUint32RGBARegex.exec(s);\n if (!m) {\n return [false];\n }\n return [true, parseInt(m[1], 16)];\n};\n\nconst hex6RE = /^\\s*#[a-f0-9]{6}\\s*$|^\\s*#[a-f0-9]{3}\\s*$/i;\nconst hexNoHash6RE = /^\\s*[a-f0-9]{6}\\s*$/i;\nconst hex8RE = /^\\s*#[a-f0-9]{8}\\s*$/i;\nconst hexNoHash8RE = /^\\s*[a-f0-9]{8}\\s*$/i;\n\n// For each format converter\n//\n// fromHex/toHex convert from/to '#RRGGBB'\n//\n// fromHex converts from the string '#RRBBGG' to the format\n// (eg: for uint32-rgb, '#123456' becomes 0x123456)\n//\n// toHex converts from the format to '#RRGGBB'\n// (eg: for uint8-rgb, [16, 33, 50] becomes '#102132')\n//\n//\n// fromStr/toStr convert from/to what's in the input[type=text] element\n//\n// toStr converts from the format to its string representation\n// (eg, for object-rgb, {r: 1, g: 0.5, b:0} becomes \"{r: 1, g: 0.5, b:0}\")\n// ^object ^string\n//\n// fromStr converts its string representation to its format\n// (eg, for object-rgb) \"{r: 1, g: 0.5, b:0}\" becomes {r: 1, g: 0.5, b:0})\n// ^string ^object\n// fromString returns an array which is [valid, v]\n// where valid is true if the string was a valid and v is the converted\n// format if v is true.\n//\n// Note: toStr should convert to \"ideal\" form (whatever that is).\n// (eg, for css-rgb\n// \"{ r: 0.10000, g: 001, b: 0}\" becomes \"{r: 0.1, g: 1, b: 0}\"\n// notice that css-rgb is a string to a string\n// )\nexport const colorFormatConverters = {\n 'hex6': {\n color: {\n from: v => [true, v],\n to: fixHex6,\n },\n text: {\n from: v => [hex6RE.test(v), v.trim()],\n to: v => v,\n },\n },\n 'hex8': {\n color: {\n from: v => [true, v],\n to: fixHex8,\n },\n text: {\n from: v => [hex8RE.test(v), v.trim()],\n to: v => v,\n },\n },\n 'hex3': {\n color: {\n from: v => [true, fixHex3(v)],\n to: hex3ToHex6,\n },\n text: {\n from: v => [hex6RE.test(v), hex6ToHex3(v.trim())],\n to: v => v,\n },\n },\n 'hex6-no-hash': {\n color: {\n from: v => [true, v.substring(1)],\n to: v => `#${fixHex6(v)}`,\n },\n text: {\n from: v => [hexNoHash6RE.test(v), v.trim()],\n to: v => v,\n },\n },\n 'hex8-no-hash': {\n color: {\n from: v => [true, v.substring(1)],\n to: v => `#${fixHex8(v)}`,\n },\n text: {\n from: v => [hexNoHash8RE.test(v), v.trim()],\n to: v => v,\n },\n },\n 'hex3-no-hash': {\n color: {\n from: v => [true, fixHex3(v).substring(1)],\n to: hex3ToHex6,\n },\n text: {\n from: v => [hexNoHash6RE.test(v), hex6ToHex3(v.trim())],\n to: v => v,\n },\n },\n 'uint32-rgb': {\n color: {\n from: v => [true, hexToUint32RGB(v)],\n to: uint32RGBToHex,\n },\n text: {\n from: v => strToUint32RGB(v),\n to: v => `0x${v.toString(16).padStart(6, '0')}`,\n },\n },\n 'uint32-rgba': {\n color: {\n from: v => [true, hexToUint32RGBA(v)],\n to: uint32RGBAToHex,\n },\n text: {\n from: v => strToUint32RGBA(v),\n to: v => `0x${v.toString(16).padStart(8, '0')}`,\n },\n },\n 'uint8-rgb': {\n color: {\n from: v => [true, hexToUint8RGB(v)],\n to: uint8RGBToHex,\n },\n text: {\n from: strTo3Ints,\n to: v => v.join(', '),\n },\n },\n 'uint8-rgba': {\n color: {\n from: v => [true, hexToUint8RGBA(v)],\n to: uint8RGBAToHex,\n },\n text: {\n from: strTo4Ints,\n to: v => v.join(', '),\n },\n },\n 'float-rgb': {\n color: {\n from: v => [true, hexToFloatRGB(v)],\n to: floatRGBToHex,\n },\n text: {\n from: strTo3Floats,\n // need Array.from because map of Float32Array makes a Float32Array\n to: v => Array.from(v).map(v => f3(v)).join(', '),\n },\n },\n 'float-rgba': {\n color: {\n from: v => [true, hexToFloatRGBA(v)],\n to: floatRGBAToHex,\n },\n text: {\n from: strTo4Floats,\n // need Array.from because map of Float32Array makes a Float32Array\n to: v => Array.from(v).map(v => f3(v)).join(', '),\n },\n },\n 'object-rgb': {\n color: {\n from: v => [true, hexToObjectRGB(v)],\n to: objectRGBToHex,\n },\n text: {\n from: strToRGBObject,\n to: rgbObjectToStr,\n },\n },\n 'object-rgba': {\n color: {\n from: v => [true, hexToObjectRGBA(v)],\n to: objectRGBAToHex,\n },\n text: {\n from: strToRGBAObject,\n to: rgbaObjectToStr,\n },\n },\n 'css-rgb': {\n color: {\n from: v => [true, hexToCssRGB(v)],\n to: cssRGBToHex,\n },\n text: {\n from: strToCssRGB,\n to: v => strToCssRGB(v)[1],\n },\n },\n 'css-rgba': {\n color: {\n from: v => [true, hexToCssRGBA(v)],\n to: cssRGBAToHex,\n },\n text: {\n from: strToCssRGBA,\n to: v => strToCssRGBA(v)[1],\n },\n },\n 'css-hsl': {\n color: {\n from: v => [true, hexToCssHSL(v)],\n to: cssHSLToHex,\n },\n text: {\n from: strToCssHSL,\n to: v => strToCssHSL(v)[1],\n },\n },\n 'css-hsla': {\n color: {\n from: v => [true, hexToCssHSLA(v)],\n to: cssHSLAToHex,\n },\n text: {\n from: strToCssHSLA,\n to: v => strToCssHSLA(v)[1],\n },\n },\n};","import { createElem } from '../libs/elem.js';\nimport View from './View.js';\n\nexport default class ElementView extends View {\n constructor(tag, className) {\n super(createElem(tag, {className}));\n }\n}","import ElementView from '../views/ElementView.js';\nimport LabelController from './LabelController.js';\n\n// TODO: remove this? Should just be user side\nexport default class Canvas extends LabelController {\n #canvasElem;\n\n constructor() {\n super('muigui-canvas');\n this.#canvasElem = this.add(\n new ElementView('canvas', 'muigui-canvas'),\n ).domElement;\n }\n get canvas() {\n return this.#canvasElem;\n }\n}","import { createElem } from '../libs/elem.js';\nimport { identity } from '../libs/conversions.js';\nimport EditView from './EditView.js';\nimport { copyExistingProperties } from '../libs/utils.js';\n\nexport default class ColorView extends EditView {\n #to;\n #from;\n #colorElem;\n #skipUpdate;\n #options = {\n converters: identity,\n };\n\n constructor(setter, options) {\n const colorElem = createElem('input', {\n type: 'color',\n onInput: () => {\n const [valid, newV] = this.#from(colorElem.value);\n if (valid) {\n this.#skipUpdate = true;\n setter.setValue(newV);\n }\n },\n onChange: () => {\n const [valid, newV] = this.#from(colorElem.value);\n if (valid) {\n this.#skipUpdate = true;\n setter.setFinalValue(newV);\n }\n },\n });\n super(createElem('div', {}, [colorElem]));\n this.setOptions(options);\n this.#colorElem = colorElem;\n }\n updateDisplay(v) {\n if (!this.#skipUpdate) {\n this.#colorElem.value = this.#to(v);\n }\n this.#skipUpdate = false;\n }\n setOptions(options) {\n copyExistingProperties(this.#options, options);\n const {converters: {to, from}} = this.#options;\n this.#to = to;\n this.#from = from;\n return this;\n }\n}\n","import {\n colorFormatConverters,\n guessFormat,\n} from '../libs/color-utils.js';\nimport ValueController from './ValueController.js';\nimport TextView from '../views/TextView.js';\nimport ColorView from '../views/ColorView.js';\n\nexport default class Color extends ValueController {\n #colorView;\n #textView;\n\n constructor(object, property, options = {}) {\n super(object, property, 'muigui-color');\n const format = options.format || guessFormat(this.getValue());\n const {color, text} = colorFormatConverters[format];\n this.#colorView = this.add(new ColorView(this, {converters: color}));\n this.#textView = this.add(new TextView(this, {converters: text}));\n this.updateDisplay();\n }\n setOptions(options) {\n const {format} = options;\n if (format) {\n const {color, text} = colorFormatConverters[format];\n this.#colorView.setOptions({converters: color});\n this.#textView.setOptions({converters: text});\n }\n super.setOptions(options);\n return this;\n }\n}","import Controller from './Controller.js';\n\n// This feels like it should be something else like\n// gui.addController({className: 'muigui-divider')};\nexport default class Divider extends Controller {\n constructor() {\n super('muigui-divider');\n }\n}","import Controller from './Controller.js';\n\nexport default class Container extends Controller {\n #controllers;\n #childDestController;\n\n constructor(className) {\n super(className);\n this.#controllers = [];\n this.#childDestController = this;\n }\n get children() {\n return this.#controllers; // should we return a copy?\n }\n get controllers() {\n return this.#controllers.filter(c => !(c instanceof Container));\n }\n get folders() {\n return this.#controllers.filter(c => c instanceof Container);\n }\n reset(recursive = true) {\n for (const controller of this.#controllers) {\n if (!(controller instanceof Container) || recursive) {\n controller.reset(recursive);\n }\n }\n return this;\n }\n updateDisplay() {\n for (const controller of this.#controllers) {\n controller.updateDisplay();\n }\n return this;\n }\n remove(controller) {\n const ndx = this.#controllers.indexOf(controller);\n if (ndx >= 0) {\n const c = this.#controllers.splice(ndx, 1);\n const c0 = c[0];\n const elem = c0.domElement;\n elem.remove();\n c0.setParent(null);\n }\n return this;\n }\n #addControllerImpl(controller) {\n this.domElement.appendChild(controller.domElement);\n this.#controllers.push(controller);\n controller.setParent(this);\n return controller;\n }\n addController(controller) {\n return this.#childDestController.#addControllerImpl(controller);\n }\n pushContainer(container) {\n this.addController(container);\n this.#childDestController = container;\n return container;\n }\n popContainer() {\n this.#childDestController = this.#childDestController.parent;\n return this;\n }\n}\n","import { createElem } from '../libs/elem.js';\nimport Container from './Container.js';\n\nexport default class Folder extends Container {\n #labelElem;\n\n constructor(name = 'Controls', className = 'muigui-menu') {\n super(className);\n this.#labelElem = createElem('label');\n this.addElem(createElem('button', {\n type: 'button',\n onClick: () => this.toggleOpen(),\n }, [this.#labelElem]));\n this.pushContainer(new Container());\n this.name(name);\n this.open();\n }\n open(open = true) {\n this.domElement.classList.toggle('muigui-closed', !open);\n this.domElement.classList.toggle('muigui-open', open);\n return this;\n }\n close() {\n return this.open(false);\n }\n name(name) {\n this.#labelElem.textContent = name;\n return this;\n }\n title(title) {\n return this.name(title);\n }\n toggleOpen() {\n this.open(!this.domElement.classList.contains('muigui-open'));\n return this;\n }\n}\n","import Controller from './Controller.js';\n\n// This feels like it should be something else like\n// gui.addDividing = new Controller()\nexport default class Label extends Controller {\n constructor(text) {\n super('muigui-label');\n this.text(text);\n }\n text(text) {\n this.domElement.textContent = text;\n return this;\n }\n}","function noop() {\n}\n\nexport function computeRelativePosition(elem, event, start) {\n const rect = elem.getBoundingClientRect();\n const x = event.clientX - rect.left;\n const y = event.clientY - rect.top;\n const nx = x / rect.width;\n const ny = y / rect.height;\n start = start || [x, y];\n const dx = x - start[0];\n const dy = y - start[1];\n const ndx = dx / rect.width;\n const ndy = dy / rect.width;\n return {x, y, nx, ny, dx, dy, ndx, ndy};\n}\n\nexport function addTouchEvents(elem, {onDown = noop, onMove = noop, onUp = noop}) {\n let start;\n const pointerMove = function (event) {\n const e = {\n type: 'move',\n ...computeRelativePosition(elem, event, start),\n };\n onMove(e);\n };\n\n const pointerUp = function (event) {\n elem.releasePointerCapture(event.pointerId);\n elem.removeEventListener('pointermove', pointerMove);\n elem.removeEventListener('pointerup', pointerUp);\n\n document.body.style.backgroundColor = '';\n\n onUp('up');\n };\n\n const pointerDown = function (event) {\n elem.addEventListener('pointermove', pointerMove);\n elem.addEventListener('pointerup', pointerUp);\n elem.setPointerCapture(event.pointerId);\n\n const rel = computeRelativePosition(elem, event);\n start = [rel.x, rel.y];\n onDown({\n type: 'down',\n ...rel,\n });\n };\n\n elem.addEventListener('pointerdown', pointerDown);\n\n return function () {\n elem.removeEventListener('pointerdown', pointerDown);\n };\n}","import { createElem, getNewId } from '../libs/elem.js';\nimport { addTouchEvents } from '../libs/touch.js';\nimport { identity } from '../libs/conversions.js';\nimport { clamp } from '../libs/utils.js';\nimport EditView from './EditView.js';\nimport {\n hexToFloatRGB,\n hexToFloatRGBA,\n hsv01ToRGBFloat,\n hsva01ToRGBAFloat,\n rgbFloatToHSV01,\n rgbaFloatToHSVA01,\n floatRGBToHex,\n floatRGBAToHex,\n rgbaFloatToHsla01,\n} from '../libs/color-utils.js';\nimport { copyExistingProperties } from '../libs/utils.js';\n\nconst svg = `\n\n\n\n`;\n\nfunction connectFillTargets(elem) {\n elem.querySelectorAll('[data-src]').forEach(srcElem => {\n const id = getNewId();\n srcElem.id = id;\n elem.querySelectorAll(`[data-target=${srcElem.dataset.src}]`).forEach(targetElem => {\n targetElem.setAttribute('fill', `url(#${id})`);\n });\n });\n return elem;\n}\n\n// Was originally going to make alpha an option. Issue is\n// hard coded conversions?\nexport default class ColorChooserView extends EditView {\n #to;\n #from;\n #satLevelElem;\n #circleElem;\n #hueUIElem;\n #hueElem;\n #hueCursorElem;\n #alphaUIElem;\n #alphaElem;\n #alphaCursorElem;\n #hsva;\n #skipHueUpdate;\n #skipSatLevelUpdate;\n #skipAlphaUpdate;\n #options = {\n converters: identity,\n alpha: false,\n };\n #convertInternalToHex;\n #convertHexToInternal;\n\n constructor(setter, options) {\n super(createElem('div', {\n innerHTML: svg,\n className: 'muigui-no-scroll',\n }));\n this.#satLevelElem = this.domElement.children[0];\n this.#hueUIElem = this.domElement.children[1];\n this.#alphaUIElem = this.domElement.children[2];\n connectFillTargets(this.#satLevelElem);\n connectFillTargets(this.#hueUIElem);\n connectFillTargets(this.#alphaUIElem);\n this.#circleElem = this.$('.muigui-color-chooser-circle');\n this.#hueElem = this.$('[data-src=muigui-color-chooser-hue]');\n this.#hueCursorElem = this.$('.muigui-color-chooser-hue-cursor');\n this.#alphaElem = this.$('[data-src=muigui-color-chooser-alpha]');\n this.#alphaCursorElem = this.$('.muigui-color-chooser-alpha-cursor');\n\n const handleSatLevelChange = (e) => {\n const s = clamp(e.nx, 0, 1);\n const v = clamp(e.ny, 0, 1);\n this.#hsva[1] = s;\n this.#hsva[2] = (1 - v);\n this.#skipHueUpdate = true;\n this.#skipAlphaUpdate = true;\n const [valid, newV] = this.#from(this.#convertInternalToHex(this.#hsva));\n if (valid) {\n setter.setValue(newV);\n }\n };\n\n const handleHueChange = (e) => {\n const h = clamp(e.nx, 0, 1);\n this.#hsva[0] = h;\n this.#skipSatLevelUpdate = true;\n this.#skipAlphaUpdate = true;\n const [valid, newV] = this.#from(this.#convertInternalToHex(this.#hsva));\n if (valid) {\n setter.setValue(newV);\n }\n };\n\n const handleAlphaChange = (e) => {\n const a = clamp(e.nx, 0, 1);\n this.#hsva[3] = a;\n this.#skipHueUpdate = true;\n this.#skipSatLevelUpdate = true;\n const [valid, newV] = this.#from(this.#convertInternalToHex(this.#hsva));\n if (valid) {\n setter.setValue(newV);\n }\n };\n\n addTouchEvents(this.#satLevelElem, {\n onDown: handleSatLevelChange,\n onMove: handleSatLevelChange,\n });\n addTouchEvents(this.#hueUIElem, {\n onDown: handleHueChange,\n onMove: handleHueChange,\n });\n addTouchEvents(this.#alphaUIElem, {\n onDown: handleAlphaChange,\n onMove: handleAlphaChange,\n });\n this.setOptions(options);\n }\n updateDisplay(newV) {\n if (!this.#hsva) {\n this.#hsva = this.#convertHexToInternal(this.#to(newV));\n }\n {\n const [h, s, v, a = 1] = this.#convertHexToInternal(this.#to(newV));\n // Don't copy the hue if it was un-computable.\n if (!this.#skipHueUpdate) {\n this.#hsva[0] = s > 0.001 && v > 0.001 ? h : this.#hsva[0];\n }\n if (!this.#skipSatLevelUpdate) {\n this.#hsva[1] = s;\n this.#hsva[2] = v;\n }\n if (!this.#skipAlphaUpdate) {\n this.#hsva[3] = a;\n }\n }\n {\n const [h, s, v, a] = this.#hsva;\n const [hue, sat, lum] = rgbaFloatToHsla01(hsva01ToRGBAFloat(this.#hsva));\n\n if (!this.#skipHueUpdate) {\n this.#hueCursorElem.setAttribute('transform', `translate(${h * 64}, 0)`);\n }\n this.#hueElem.children[0].setAttribute('stop-color', `hsl(${hue * 360} 0% 100% / ${a})`);\n this.#hueElem.children[1].setAttribute('stop-color', `hsl(${hue * 360} 100% 50% / ${a})`);\n if (!this.#skipAlphaUpdate) {\n this.#alphaCursorElem.setAttribute('transform', `translate(${a * 64}, 0)`);\n }\n this.#alphaElem.children[0].setAttribute('stop-color', `hsl(${hue * 360} ${sat * 100}% ${lum * 100}% / 0)`);\n this.#alphaElem.children[1].setAttribute('stop-color', `hsl(${hue * 360} ${sat * 100}% ${lum * 100}% / 1)`);\n\n if (!this.#skipSatLevelUpdate) {\n this.#circleElem.setAttribute('cx', `${s * 64}`);\n this.#circleElem.setAttribute('cy', `${(1 - v) * 48}`);\n }\n }\n this.#skipHueUpdate = false;\n this.#skipSatLevelUpdate = false;\n this.#skipAlphaUpdate = false;\n }\n setOptions(options) {\n copyExistingProperties(this.#options, options);\n const {converters: {to, from}, alpha} = this.#options;\n this.#alphaUIElem.style.display = alpha ? '' : 'none';\n this.#convertInternalToHex = alpha\n ? v => floatRGBAToHex(hsva01ToRGBAFloat(v))\n : v => floatRGBToHex(hsv01ToRGBFloat(v));\n this.#convertHexToInternal = alpha\n ? v => rgbaFloatToHSVA01(hexToFloatRGBA(v))\n : v => rgbFloatToHSV01(hexToFloatRGB(v));\n this.#to = to;\n this.#from = from;\n return this;\n }\n}\n","import ElementView from '../views/ElementView.js';\nimport ValueController from './ValueController.js';\nimport { copyExistingProperties } from '../libs/utils.js';\nimport { createElem } from '../libs/elem.js';\n/*\n\nholder = new TabHolder\ntab = holder.add(new Tab(\"name\"))\ntab.add(...)\n\n\npc = new PopdownController\ntop = pc.add(new Row())\ntop.add(new Button());\nvalues = topRow.add(new Div())\nbottom = pc.add(new Row());\n\n\n\npc = new PopdownController\npc.addTop\npc.addTop\n\npc.addBottom\n\n\n*/\n\nexport default class PopDownController extends ValueController {\n #top;\n #valuesView;\n #checkboxElem;\n #bottom;\n #options = {\n open: false,\n };\n\n constructor(object, property, options = {}) {\n super(object, property, 'muigui-pop-down-controller');\n /*\n [ValueView\n [[B][values]] upper row\n [[ visual ]] lower row\n ]\n */\n this.#top = this.add(new ElementView('div', 'muigui-pop-down-top'));\n// this.#top.add(new CheckboxView(makeSetter(this.#options, 'open')));\n const checkboxElem = this.#top.addElem(createElem('input', {\n type: 'checkbox',\n onChange: () => {\n this.#options.open = checkboxElem.checked;\n this.updateDisplay();\n },\n }));\n this.#checkboxElem = checkboxElem;\n this.#valuesView = this.#top.add(new ElementView('div', 'muigui-pop-down-values'));\n this.#bottom = this.add(new ElementView('div', 'muigui-pop-down-bottom'));\n this.setOptions(options);\n }\n setKnobColor(bgCssColor/*, fgCssColor*/) {\n if (this.#checkboxElem) {\n this.#checkboxElem.style = `\n --range-color: ${bgCssColor};\n --value-bg-color: ${bgCssColor};\n `;\n }\n }\n updateDisplay() {\n super.updateDisplay();\n const {open} = this.#options;\n this.domElement.children[1].classList.toggle('muigui-open', open);\n this.domElement.children[1].classList.toggle('muigui-closed', !open);\n }\n setOptions(options) {\n copyExistingProperties(this.#options, options);\n super.setOptions(options);\n this.updateDisplay();\n }\n addTop(view) {\n return this.#valuesView.add(view);\n }\n addBottom(view) {\n return this.#bottom.add(view);\n }\n}","/* eslint-disable no-underscore-dangle */\nimport {\n colorFormatConverters,\n guessFormat,\n hasAlpha,\n hexToUint8RGB,\n hslToRgbUint8,\n rgbUint8ToHsl,\n uint8RGBToHex,\n} from '../libs/color-utils.js';\nimport ColorChooserView from '../views/ColorChooserView.js';\nimport TextView from '../views/TextView.js';\nimport PopDownController from './PopDownController.js';\n\nexport default class ColorChooser extends PopDownController {\n #colorView;\n #textView;\n #to;\n #setKnobHelper;\n\n constructor(object, property, options = {}) {\n super(object, property, 'muigui-color-chooser');\n const format = options.format || guessFormat(this.getValue());\n const {color, text} = colorFormatConverters[format];\n this.#to = color.to;\n this.#textView = new TextView(this, {converters: text, alpha: hasAlpha(format)});\n this.#colorView = new ColorChooserView(this, {converters: color, alpha: hasAlpha(format)});\n this.addTop(this.#textView);\n this.addBottom(this.#colorView);\n // WTF! FIX!\n this.#setKnobHelper = () => {\n if (this.#to) {\n const hex6Or8 = this.#to(this.getValue());\n const hsl = rgbUint8ToHsl(hexToUint8RGB(hex6Or8));\n hsl[2] = (hsl[2] + 50) % 100;\n const hex = uint8RGBToHex(hslToRgbUint8(hsl));\n this.setKnobColor(`${hex6Or8.substring(0, 7)}FF`, hex);\n }\n };\n this.updateDisplay();\n }\n updateDisplay() {\n super.updateDisplay();\n if (this.#setKnobHelper) {\n this.#setKnobHelper();\n }\n }\n setOptions(options) {\n super.setOptions(options);\n return this;\n }\n}\n","import css from './styles/muigui.css.js';\nimport {createElem} from './libs/elem.js';\nimport {createController} from './controllers/create-controller.js';\nimport {\n mapRange,\n makeRangeConverters,\n makeRangeOptions,\n makeMinMaxPair,\n} from './libs/utils.js';\nimport {\n converters\n} from './libs/conversions.js';\nimport {\n hasAlpha,\n guessFormat,\n} from './libs/color-utils.js';\nimport Canvas from './controllers/Canvas.js';\nimport Color from './controllers/Color.js';\nimport Divider from './controllers/Divider.js';\nimport Folder from './controllers/Folder.js';\nimport Label from './controllers/Label.js';\nimport Controller from './controllers/Controller.js';\nimport ColorChooser from './controllers/ColorChooser.js';\n\nimport Column from './layout/Column.js';\nimport Frame from './layout/Frame.js';\nimport Grid from './layout/Grid.js';\nimport Row from './layout/Row.js';\n\nexport {\n Column,\n Frame,\n Grid,\n Row,\n};\n\nexport class GUIFolder extends Folder {\n add(object, property, ...args) {\n const controller = object instanceof Controller\n ? object\n : createController(object, property, ...args);\n return this.addController(controller);\n }\n addCanvas(name) {\n return this.addController(new Canvas(name));\n }\n addColor(object, property, options = {}) {\n const value = object[property];\n if (hasAlpha(options.format || guessFormat(value))) {\n return this.addController(new ColorChooser(object, property, options));\n } else {\n return this.addController(new Color(object, property, options));\n }\n }\n addDivider() {\n return this.addController(new Divider());\n }\n addFolder(name) {\n return this.addController(new GUIFolder(name));\n }\n addLabel(text) {\n return this.addController(new Label(text));\n }\n}\n\nclass MuiguiElement extends HTMLElement {\n constructor() {\n super();\n this.shadow = this.attachShadow({mode: 'open'});\n }\n}\n\ncustomElements.define('muigui-element', MuiguiElement);\n\nconst baseStyleSheet = new CSSStyleSheet();\nbaseStyleSheet.replaceSync(css.default);\nconst userStyleSheet = new CSSStyleSheet();\n\nfunction makeStyleSheetUpdater(styleSheet) {\n let newCss;\n let newCssPromise;\n\n function updateStyle() {\n if (newCss && !newCssPromise) {\n const s = newCss;\n newCss = undefined;\n newCssPromise = styleSheet.replace(s).then(() => {\n newCssPromise = undefined;\n updateStyle();\n });\n }\n }\n\n return function updateStyleSheet(css) {\n newCss = css;\n updateStyle();\n };\n}\n\nconst updateBaseStyle = makeStyleSheetUpdater(baseStyleSheet);\nconst updateUserStyle = makeStyleSheetUpdater(userStyleSheet);\n\nexport class GUI extends GUIFolder {\n static converters = converters;\n static mapRange = mapRange;\n static makeRangeConverters = makeRangeConverters;\n static makeRangeOptions = makeRangeOptions;\n static makeMinMaxPair = makeMinMaxPair;\n #localStyleSheet = new CSSStyleSheet();\n\n constructor(options = {}) {\n super('Controls', 'muigui-root');\n if (options instanceof HTMLElement) {\n options = {parent: options};\n }\n const {\n autoPlace = true,\n width,\n title = 'Controls',\n } = options;\n let {\n parent,\n } = options;\n\n if (width) {\n this.domElement.style.width = /^\\d+$/.test(width) ? `${width}px` : width;\n }\n if (parent === undefined && autoPlace) {\n parent = document.body;\n this.domElement.classList.add('muigui-auto-place');\n }\n if (parent) {\n const muiguiElement = createElem('muigui-element');\n muiguiElement.shadowRoot.adoptedStyleSheets = [baseStyleSheet, userStyleSheet, this.#localStyleSheet];\n muiguiElement.shadow.appendChild(this.domElement);\n parent.appendChild(muiguiElement);\n }\n if (title) {\n this.title(title);\n }\n this.domElement.classList.add('muigui', 'muigui-colors');\n }\n setStyle(css) {\n this.#localStyleSheet.replace(css);\n }\n static setBaseStyles(css) {\n updateBaseStyle(css);\n }\n static getBaseStyleSheet() {\n return baseStyleSheet;\n }\n static setUserStyles(css) {\n updateUserStyle(css);\n }\n static getUserStyleSheet() {\n return userStyleSheet;\n }\n static setTheme(name) {\n GUI.setBaseStyles(`${css.default}\\n${css.themes[name] || ''}`);\n }\n}\n\nexport default GUI;\n","import Button from './Button.js';\nimport Checkbox from './Checkbox.js';\nimport TextNumber from './TextNumber.js';\nimport Select from './Select.js';\nimport Range from './Range.js';\nimport Text from './Text.js';\n\n// const isConversion = o => typeof o.to === 'function' && typeof o.from === 'function';\n\n/**\n * possible inputs\n * add(o, p, min: number, max: number)\n * add(o, p, min: number, max: number, step: number)\n * add(o, p, array: [value])\n * add(o, p, array: [[key, value]])\n *\n * @param {*} object\n * @param {string} property\n * @param {...any} args\n * @returns {Controller}\n */\nexport function createController(object, property, ...args) {\n const [arg1] = args;\n if (Array.isArray(arg1)) {\n return new Select(object, property, {keyValues: arg1});\n }\n\n const t = typeof object[property];\n switch (t) {\n case 'number':\n if (typeof args[0] === 'number' && typeof args[1] === 'number') {\n const min = args[0];\n const max = args[1];\n const step = args[2];\n return new Range(object, property, {min, max, ...(step && {step})});\n }\n return args.length === 0\n ? new TextNumber(object, property, ...args)\n : new Range(object, property, ...args);\n case 'boolean':\n return new Checkbox(object, property, ...args);\n case 'function':\n return new Button(object, property, ...args);\n case 'string':\n return new Text(object, property, ...args);\n case 'undefined':\n throw new Error(`no property named ${property}`);\n default:\n throw new Error(`unhandled type ${t} for property ${property}`);\n }\n}","function noop() {\n}\n\nconst keyDirections = {\n ArrowLeft: [-1, 0],\n ArrowRight: [1, 0],\n ArrowUp: [0, -1],\n ArrowDown: [0, 1],\n};\n\n// This probably needs to be global\nexport function addKeyboardEvents(elem, {onDown = noop, onUp = noop}) {\n const keyDown = function (event) {\n const mult = event.shiftKey ? 10 : 1;\n const [dx, dy] = (keyDirections[event.key] || [0, 0]).map(v => v * mult);\n const fn = event.type === 'keydown' ? onDown : onUp;\n fn({\n type: event.type.substring(3),\n dx,\n dy,\n event,\n });\n };\n\n elem.addEventListener('keydown', keyDown);\n elem.addEventListener('keyup', keyDown);\n\n return function () {\n elem.removeEventListener('keydown', keyDown);\n elem.removeEventListener('keyup', keyDown);\n };\n}","export function assert(truthy, msg = '') {\n if (!truthy) {\n throw new Error(msg);\n }\n}","import { assert } from '../libs/assert.js';\n\nfunction getEllipsePointForAngle(cx, cy, rx, ry, phi, theta) {\n const m = Math.abs(rx) * Math.cos(theta);\n const n = Math.abs(ry) * Math.sin(theta);\n\n return [\n cx + Math.cos(phi) * m - Math.sin(phi) * n,\n cy + Math.sin(phi) * m + Math.cos(phi) * n,\n ];\n}\n\nfunction getEndpointParameters(cx, cy, rx, ry, phi, theta, dTheta) {\n const [x1, y1] = getEllipsePointForAngle(cx, cy, rx, ry, phi, theta);\n const [x2, y2] = getEllipsePointForAngle(cx, cy, rx, ry, phi, theta + dTheta);\n\n const fa = Math.abs(dTheta) > Math.PI ? 1 : 0;\n const fs = dTheta > 0 ? 1 : 0;\n\n return { x1, y1, x2, y2, fa, fs };\n}\n\nexport function arc(cx, cy, r, start, end) {\n assert(Math.abs(start - end) <= Math.PI * 2);\n assert(start >= -Math.PI && start <= Math.PI * 2);\n assert(start <= end);\n assert(end >= -Math.PI && end <= Math.PI * 4);\n\n const { x1, y1, x2, y2, fa, fs } = getEndpointParameters(cx, cy, r, r, 0, start, end - start);\n return Math.abs(Math.abs(start - end) - Math.PI * 2) > Number.EPSILON\n ? `M${cx} ${cy} L${x1} ${y1} A ${r} ${r} 0 ${fa} ${fs} ${x2} ${y2} L${cx} ${cy}`\n : `M${x1} ${y1} L${x1} ${y1} A ${r} ${r} 0 ${fa} ${fs} ${x2} ${y2}`;\n}\n","import { identity } from '../libs/conversions.js';\nimport { createElem } from '../libs/elem.js';\nimport { addKeyboardEvents } from '../libs/keyboard.js';\nimport { arc } from '../libs/svg.js';\nimport { addTouchEvents } from '../libs/touch.js';\nimport { createWheelHelper } from '../libs/wheel.js';\nimport { clamp, copyExistingProperties, euclideanModulo, lerp, stepify } from '../libs/utils.js';\nimport EditView from './EditView.js';\n\nconst svg = `\n\n`;\n\nconst twoPiMod = v => euclideanModulo(v + Math.PI, Math.PI * 2) - Math.PI;\n\nexport default class DirectionView extends EditView {\n #arrowElem;\n #rangeElem;\n #lastV;\n #wrap;\n #options = {\n step: 1,\n min: -180,\n max: 180,\n\n /*\n --------\n / -π/2 \\\n / | \\\n |<- -π * |\n | * 0 ->| zero is down the positive X axis\n |<- +π * |\n \\ | /\n \\ π/2 /\n --------\n */\n dirMin: -Math.PI,\n dirMax: Math.PI,\n //dirMin: Math.PI * 0.5,\n //dirMax: Math.PI * 2.5,\n //dirMin: -Math.PI * 0.75, // test 10:30 to 7:30\n //dirMax: Math.PI * 0.75,\n //dirMin: Math.PI * 0.75, // test 7:30 to 10:30\n //dirMax: -Math.PI * 0.75,\n //dirMin: -Math.PI * 0.75, // test 10:30 to 1:30\n //dirMax: -Math.PI * 0.25,\n //dirMin: Math.PI * 0.25, // test 4:30 to 7:30\n //dirMax: Math.PI * 0.75,\n //dirMin: Math.PI * 0.75, // test 4:30 to 7:30\n //dirMax: Math.PI * 0.25,\n wrap: undefined,\n converters: identity,\n };\n\n constructor(setter, options = {}) {\n const wheelHelper = createWheelHelper();\n super(createElem('div', {\n className: 'muigui-direction muigui-no-scroll',\n innerHTML: svg,\n onWheel: e => {\n e.preventDefault();\n const {min, max, step} = this.#options;\n const delta = wheelHelper(e, step);\n let tempV = this.#lastV + delta;\n if (this.#wrap) {\n tempV = euclideanModulo(tempV - min, max - min) + min;\n }\n const newV = clamp(stepify(tempV, v => v, step), min, max);\n setter.setValue(newV);\n },\n }));\n const handleTouch = (e) => {\n const {min, max, step, dirMin, dirMax} = this.#options;\n const nx = e.nx * 2 - 1;\n const ny = e.ny * 2 - 1;\n const a = Math.atan2(ny, nx);\n\n const center = (dirMin + dirMax) / 2;\n\n const centeredAngle = twoPiMod(a - center);\n const centeredStart = twoPiMod(dirMin - center);\n const diff = dirMax - dirMin;\n\n const n = clamp((centeredAngle - centeredStart) / (diff), 0, 1);\n const newV = stepify(min + (max - min) * n, v => v, step);\n setter.setValue(newV);\n };\n addTouchEvents(this.domElement, {\n onDown: handleTouch,\n onMove: handleTouch,\n });\n addKeyboardEvents(this.domElement, {\n onDown: (e) => {\n const {min, max, step} = this.#options;\n const newV = clamp(stepify(this.#lastV + e.dx * step, v => v, step), min, max);\n setter.setValue(newV);\n },\n });\n this.#arrowElem = this.$('#muigui-arrow');\n this.#rangeElem = this.$('#muigui-range');\n this.setOptions(options);\n }\n updateDisplay(v) {\n this.#lastV = v;\n const {min, max} = this.#options;\n const n = (v - min) / (max - min);\n const angle = lerp(this.#options.dirMin, this.#options.dirMax, n);\n this.#arrowElem.style.transform = `rotate(${angle}rad)`;\n }\n setOptions(options) {\n copyExistingProperties(this.#options, options);\n const {dirMin, dirMax, wrap} = this.#options;\n this.#wrap = wrap !== undefined\n ? wrap\n : Math.abs(dirMin - dirMax) >= Math.PI * 2 - Number.EPSILON;\n const [min, max] = dirMin < dirMax ? [dirMin, dirMax] : [dirMax , dirMin];\n this.#rangeElem.setAttribute('d', arc(0, 0, 28.87, min, max));\n }\n}\n","import { createElem } from '../libs/elem.js';\nimport { makeId } from '../libs/ids.js';\nimport EditView from './EditView.js';\n\nexport default class RadioGridView extends EditView {\n #values;\n\n constructor(setter, keyValues, cols = 3) {\n const values = [];\n const name = makeId();\n super(createElem('div', {}, keyValues.map(([key, value], ndx) => {\n values.push(value);\n return createElem('label', {}, [\n createElem('input', {\n type: 'radio',\n name,\n value: ndx,\n onChange: function () {\n if (this.checked) {\n setter.setFinalValue(that.#values[this.value]);\n }\n },\n }),\n createElem('button', {\n type: 'button',\n textContent: key,\n onClick: function () {\n this.previousElementSibling.click();\n },\n }),\n ]);\n })));\n // eslint-disable-next-line @typescript-eslint/no-this-alias\n const that = this;\n this.#values = values;\n this.cols(cols);\n }\n updateDisplay(v) {\n const ndx = this.#values.indexOf(v);\n for (let i = 0; i < this.domElement.children.length; ++i) {\n this.domElement.children[i].children[0].checked = i === ndx;\n }\n }\n cols(cols) {\n this.domElement.style.gridTemplateColumns = `repeat(${cols}, 1fr)`;\n }\n}\n","export function onResize(elem, callback) {\n new ResizeObserver(() => {\n callback({rect: elem.getBoundingClientRect(), elem});\n }).observe(elem);\n}\n\nexport function onResizeSVGNoScale(elem, hAnchor, vAnchor, callback) {\n onResize(elem, ({rect}) => {\n const {width, height} = rect;\n elem.setAttribute('viewBox', `-${width * hAnchor} -${height * vAnchor} ${width} ${height}`);\n callback({elem, rect});\n });\n}\n\nexport function onResizeCanvas(elem, callback) {\n onResize(elem, ({rect}) => {\n const {width, height} = rect;\n elem.width = width;\n elem.height = height;\n callback({elem, rect});\n });\n}\n","import { createElem } from '../libs/elem.js';\nimport { addKeyboardEvents } from '../libs/keyboard.js';\nimport { addTouchEvents } from '../libs/touch.js';\nimport { createWheelHelper } from '../libs/wheel.js';\nimport { onResizeSVGNoScale } from '../libs/resize-helpers.js';\nimport { clamp, copyExistingProperties, stepify } from '../libs/utils.js';\nimport EditView from './EditView.js';\n\nconst svg = `\n\n`;\n\nfunction createSVGTicks(start, end, step, min, max, height) {\n const p = [];\n if (start < min) {\n start += stepify(min - start, v => v, step);\n }\n end = Math.min(end, max);\n for (let i = start; i <= end; i += step) {\n p.push(`M${i} 0 l0 ${height}`);\n }\n return p.join(' ');\n}\n\nfunction createSVGNumbers(start, end, unitSize, unit, minusSize, min, max, labelFn) {\n const texts = [];\n if (start < min) {\n start += stepify(min - start, v => v, unitSize);\n }\n end = Math.min(end, max);\n const digits = Math.max(0, -Math.log10(unit));\n const f = v => labelFn(v.toFixed(digits));\n for (let i = start; i <= end; i += unitSize) {\n texts.push(`= 0 ? i : (i - minusSize / 2) }\" y=\"0\">${f(i / unitSize * unit)}`);\n }\n return texts.join('\\n');\n}\n\nfunction computeSizeOfMinus(elem) {\n const oldHTML = elem.innerHTML;\n elem.innerHTML = '- ';\n const text = elem.querySelector('text');\n const size = text.getComputedTextLength();\n elem.innerHTML = oldHTML;\n return size;\n}\n\nexport default class SliderView extends EditView {\n #svgElem;\n #originElem;\n #ticksElem;\n #thicksElem;\n #numbersElem;\n #leftGradElem;\n #rightGradElem;\n #width;\n #height;\n #lastV;\n #minusSize;\n #options = {\n min: -100,\n max: 100,\n step: 1,\n unit: 10,\n unitSize: 10,\n ticksPerUnit: 5,\n labelFn: v => v,\n tickHeight: 1,\n limits: true,\n thicksColor: undefined,\n orientation: undefined,\n };\n\n constructor(setter, options) {\n const wheelHelper = createWheelHelper();\n super(createElem('div', {\n innerHTML: svg,\n className: 'muigui-no-v-scroll',\n onWheel: e => {\n e.preventDefault();\n const {min, max, step} = this.#options;\n const delta = wheelHelper(e, step);\n const newV = clamp(stepify(this.#lastV + delta, v => v, step), min, max);\n setter.setValue(newV);\n },\n }));\n this.#svgElem = this.$('svg');\n this.#originElem = this.$('#muigui-origin');\n this.#ticksElem = this.$('#muigui-ticks');\n this.#thicksElem = this.$('#muigui-thicks');\n this.#numbersElem = this.$('#muigui-numbers');\n this.#leftGradElem = this.$('#muigui-left-grad');\n this.#rightGradElem = this.$('#muigui-right-grad');\n this.setOptions(options);\n let startV;\n addTouchEvents(this.domElement, {\n onDown: () => {\n startV = this.#lastV;\n },\n onMove: (e) => {\n const {min, max, unitSize, unit, step} = this.#options;\n const newV = clamp(stepify(startV - e.dx / unitSize * unit, v => v, step), min, max);\n setter.setValue(newV);\n },\n });\n addKeyboardEvents(this.domElement, {\n onDown: (e) => {\n const {min, max, step} = this.#options;\n const newV = clamp(stepify(this.#lastV + e.dx * step, v => v, step), min, max);\n setter.setValue(newV);\n },\n });\n onResizeSVGNoScale(this.#svgElem, 0.5, 0, ({rect: {width}}) => {\n this.#leftGradElem.setAttribute('x', -width / 2);\n this.#rightGradElem.setAttribute('x', width / 2 - 20);\n this.#minusSize = computeSizeOfMinus(this.#numbersElem);\n this.#width = width;\n this.#updateSlider();\n });\n }\n // |--------V--------|\n // . . | . . . | . . . |\n //\n #updateSlider() {\n // There's no size if ResizeObserver has not fired yet.\n if (!this.#width || this.#lastV === undefined) {\n return;\n }\n const {\n labelFn,\n limits,\n min,\n max,\n orientation,\n tickHeight,\n ticksPerUnit,\n unit,\n unitSize,\n thicksColor,\n } = this.#options;\n const unitsAcross = Math.ceil(this.#width / unitSize);\n const center = this.#lastV;\n const centerUnitSpace = center / unit;\n const startUnitSpace = Math.round(centerUnitSpace - unitsAcross);\n const endUnitSpace = startUnitSpace + unitsAcross * 2;\n const start = startUnitSpace * unitSize;\n const end = endUnitSpace * unitSize;\n const minUnitSpace = limits ? min * unitSize / unit : start;\n const maxUnitSpace = limits ? max * unitSize / unit : end;\n const height = labelFn(1) === '' ? 10 : 5;\n if (ticksPerUnit > 1) {\n this.#ticksElem.setAttribute('d', createSVGTicks(start, end, unitSize / ticksPerUnit, minUnitSpace, maxUnitSpace, height * tickHeight));\n }\n this.#thicksElem.style.stroke = thicksColor; //setAttribute('stroke', thicksColor);\n this.#thicksElem.setAttribute('d', createSVGTicks(start, end, unitSize, minUnitSpace, maxUnitSpace, height));\n this.#numbersElem.innerHTML = createSVGNumbers(start, end, unitSize, unit, this.#minusSize, minUnitSpace, maxUnitSpace, labelFn);\n this.#originElem.setAttribute('transform', `translate(${-this.#lastV * unitSize / unit} 0)`);\n this.#svgElem.classList.toggle('muigui-slider-up', orientation === 'up');\n }\n updateDisplay(v) {\n this.#lastV = v;\n this.#updateSlider();\n }\n setOptions(options) {\n copyExistingProperties(this.#options, options);\n return this;\n }\n}\n","import { createElem } from '../libs/elem.js';\nimport { addTouchEvents } from '../libs/touch.js';\nimport { onResizeSVGNoScale } from '../libs/resize-helpers.js';\nimport EditView from './EditView.js';\n\nconst svg = `\n\n`;\n\nexport default class Vec2View extends EditView {\n #svgElem;\n #arrowElem;\n #circleElem;\n #lastV = [];\n\n constructor(setter) {\n super(createElem('div', {\n innerHTML: svg,\n className: 'muigui-no-scroll',\n }));\n const onTouch = (e) => {\n const {width, height} = this.#svgElem.getBoundingClientRect();\n const nx = e.nx * 2 - 1;\n const ny = e.ny * 2 - 1;\n setter.setValue([nx * width * 0.5, ny * height * 0.5]);\n };\n addTouchEvents(this.domElement, {\n onDown: onTouch,\n onMove: onTouch,\n });\n this.#svgElem = this.$('svg');\n this.#arrowElem = this.$('#muigui-arrow');\n this.#circleElem = this.$('#muigui-circle');\n onResizeSVGNoScale(this.#svgElem, 0.5, 0.5, () => this.#updateDisplayImpl);\n }\n #updateDisplayImpl() {\n const [x, y] = this.#lastV;\n this.#arrowElem.setAttribute('d', `M0,0L${x},${y}`);\n this.#circleElem.setAttribute('transform', `translate(${x}, ${y})`);\n }\n updateDisplay(v) {\n this.#lastV[0] = v[0];\n this.#lastV[1] = v[1];\n this.#updateDisplayImpl();\n }\n}\n","import GUI from './muigui.js';\n\nimport ColorChooser from './controllers/ColorChooser.js';\nimport Direction from './controllers/Direction.js';\nimport RadioGrid from './controllers/RadioGrid.js';\nimport Range from './controllers/Range.js';\nimport Select from './controllers/Select.js';\nimport Slider from './controllers/Slider.js';\nimport TextNumber from './controllers/TextNumber.js';\nimport Vec2 from './controllers/Vec2.js';\n\nGUI.ColorChooser = ColorChooser;\nGUI.Direction = Direction;\nGUI.RadioGrid = RadioGrid;\nGUI.Range = Range;\nGUI.Select = Select;\nGUI.Slider = Slider;\nGUI.TextNumber = TextNumber;\nGUI.Vec2 = Vec2;\n\nexport default GUI;","import { identity } from '../libs/conversions.js';\nimport DirectionView from '../views/DirectionView.js';\nimport NumberView from '../views/NumberView.js';\n// import ValueController from './ValueController.js';\nimport PopDownController from './PopDownController.js';\n\n\n// deg2rad\n// where is 0\n// range (0, 360), (-180, +180), (0,0) Really this is a range\n\nexport default class Direction extends PopDownController {\n #options;\n constructor(object, property, options) {\n super(object, property, 'muigui-direction');\nthis.#options = options; // FIX\n this.addTop(new NumberView(this,\nidentity));\n this.addBottom(new DirectionView(this, options));\n this.updateDisplay();\n }\n}\n\n","import RadioGridView from '../views/RadioGridView.js';\nimport ValueController from './ValueController.js';\nimport { convertToKeyValues } from '../libs/key-values.js';\n\nexport default class RadioGrid extends ValueController {\n constructor(object, property, options) {\n super(object, property, 'muigui-radio-grid');\n const valueIsNumber = typeof this.getValue() === 'number';\n const {\n keyValues: keyValuesInput,\n cols = 3,\n } = options;\n const keyValues = convertToKeyValues(keyValuesInput, valueIsNumber);\n this.add(new RadioGridView(this, keyValues, cols));\n this.updateDisplay();\n }\n}","import ValueController from './ValueController.js';\nimport NumberView from '../views/NumberView.js';\nimport SliderView from '../views/SliderView.js';\n\nexport default class Slider extends ValueController {\n constructor(object, property, options = {}) {\n super(object, property, 'muigui-slider');\n this.add(new SliderView(this, options));\n this.add(new NumberView(this, options));\n this.updateDisplay();\n }\n}\n","import NumberView from '../views/NumberView.js';\nimport Vec2View from '../views/Vec2View.js';\nimport PopDownController from './PopDownController.js';\nimport { strToNumber } from '../libs/conversions.js';\n\n// TODO: zoom with wheel and pinch?\n// TODO: grid?\n// // options\n// scale:\n// range: number (both x and y + /)\n// range: array (min, max)\n// xRange:\n// deg/rad/turn\n\nexport default class Vec2 extends PopDownController {\n constructor(object, property) {\n super(object, property, 'muigui-vec2');\n\n const makeSetter = (ndx) => {\n return {\n setValue: (v) => {\n const newV = this.getValue();\n newV[ndx] = v;\n this.setValue(newV);\n },\n setFinalValue: (v) => {\n const newV = this.getValue();\n newV[ndx] = v;\n this.setFinalValue(newV);\n },\n };\n };\n\n this.addTop(new NumberView(makeSetter(0), {\n converters: {\n to: v => v[0],\n from: strToNumber.from,\n },\n }));\n this.addTop(new NumberView(makeSetter(1), {\n converters: {\n to: v => v[1],\n from: strToNumber.from,\n },\n }));\n this.addBottom(new Vec2View(this));\n this.updateDisplay();\n }\n}\n"],"names":["css","default","themes","float","createElem","tag","attrs","children","elem","document","createElement","key","value","Object","entries","startsWith","eventName","substring","toLowerCase","addEventListener","passive","k","v","undefined","setAttribute","child","appendChild","setElemProps","nextId","removeArrayElem","array","ndx","indexOf","splice","clamp","min","max","Math","isTypedArray","SharedArrayBuffer","a","buffer","ArrayBuffer","stepify","from","step","round","euclideanModulo","n","copyExistingProperties","dst","src","mapRange","inMin","inMax","outMin","outMax","makeRangeConverters","to","makeRangeOptions","converters","identity","makeMinMaxPair","gui","properties","minPropName","maxPropName","options","guiMinRange","minRange","valueMinRange","minGui","add","onChange","maxGui","setValue","View","domElement","childDestElem","views","constructor","this","addElem","removeElem","removeChild","pushSubElem","popSubElem","parentElement","view","push","remove","pushSubView","popSubView","setOptions","updateDisplayIfNeeded","newV","ignoreCache","$","selector","querySelector","Controller","changeFns","finishChangeFns","parent","className","super","classList","setParent","enable","disabled","show","toggle","hide","closest","forEach","querySelectorAll","disable","fn","removeChange","onFinishChange","removeFinishChange","callListeners","fns","call","emitChange","object","property","controller","emitFinalChange","updateDisplay","getColors","toCamelCase","s","replace","m","m1","toUpperCase","div","colors","fromEntries","map","style","color","getComputedStyle","Button","buttonElem","name","type","onClick","textContent","arraysEqual","b","length","i","EditView","oldV","updateCheck","checkArrayNeedsUpdate","needUpdate","copyArrayElementsFromTo","checkTypedArrayNeedsUpdate","once","checkObjectNeedsUpdate","checkValueNeedsUpdate","getUpdateCheckForType","Array","isArray","bind","CheckboxView","checkboxElem","setter","id","onInput","checked","setFinalValue","tasks","tasksToRemove","Set","requestId","processing","processTasks","task","has","size","queueProcessing","clear","requestAnimationFrame","makeId","ValueView","LabelController","nameElem","for","title","tooltip","tip","ValueController","initialValue","listening","updateFn","getValue","setValueImpl","isDifferent","keys","assign","reset","listen","set","removeTask","Checkbox","strToNumber","toString","parseFloat","Number","isNaN","radToDeg","PI","createWheelHelper","wheelAccum","e","wheelScale","deltaY","delta","floor","abs","sign","NumberView","skipUpdate","NEGATIVE_INFINITY","POSITIVE_INFINITY","wheelHelper","handleInput","onWheel","preventDefault","setFn","valid","inRange","TextNumber","textView","SelectView","values","keyValues","selectedIndex","convertToKeyValues","valueIsNumber","Select","keyValuesInput","RangeView","validV","Range","TextView","Text","lerp","t","fract","f0","toFixed","f3","hexToUint32RGB","parseInt","hexToUint32RGBA","hexToUint8RGB","uint8RGBToHex","padStart","join","hexToUint8RGBA","uint8RGBAToHex","hexToFloatRGB","floatRGBToHex","hexToFloatRGBA","floatRGBAToHex","scaleAndClamp","hexToObjectRGB","r","g","hexToObjectRGBA","hexToCssRGB","cssRGBRegex","hexToCssRGBA","cssRGBARegex","hexToCssHSL","hsl","rgbUint8ToHsl","hexToCssHSLA","hsla","rgbaUint8ToHsla","cssHSLRegex","cssHSLARegex","hslToRgbUint8","h","l","f","rgbFloatToHsl01","d","rgbaFloatToHsla01","rgb","rgba","hsv01ToRGBFloat","hue","sat","val","hsva01ToRGBAFloat","alpha","round3","rgbFloatToHSV01","p","q","EPSILON","hasAlpha","format","endsWith","cssStringFormats","re","guessFormat","console","warn","formatInfo","test","guessStringColorFormat","trim","Uint8Array","Uint8ClampedArray","Float32Array","Error","fixHex6","fixHex8","hex6ToHex3","hex6","hex3RE","hex3ToHex6","hex3","exec","m2","fixHex3","strToCssRGB","find","strToCssRGBA","strToCssHSL","strToCssHSLA","strTo3IntsRE","strTo4IntsRE","strToUint32RGBRegex","strToUint32RGBARegex","hex6RE","hexNoHash6RE","hex8RE","hexNoHash8RE","colorFormatConverters","text","hex8","strToUint32RGB","strToUint32RGBA","numbers","split","badNdx","findIndex","json","JSON","parse","hslaToRgbaUint8","ElementView","Canvas","canvasElem","canvas","ColorView","colorElem","Color","colorView","Divider","Container","controllers","childDestController","filter","c","folders","recursive","c0","addControllerImpl","addController","pushContainer","container","popContainer","Folder","labelElem","toggleOpen","open","close","contains","Label","noop","computeRelativePosition","event","start","rect","getBoundingClientRect","x","clientX","left","y","clientY","top","nx","width","ny","height","dx","dy","ndy","addTouchEvents","onDown","onMove","onUp","pointerMove","pointerUp","releasePointerCapture","pointerId","removeEventListener","body","backgroundColor","pointerDown","setPointerCapture","rel","connectFillTargets","srcElem","dataset","targetElem","ColorChooserView","satLevelElem","circleElem","hueUIElem","hueElem","hueCursorElem","alphaUIElem","alphaElem","alphaCursorElem","hsva","skipHueUpdate","skipSatLevelUpdate","skipAlphaUpdate","convertInternalToHex","convertHexToInternal","innerHTML","handleSatLevelChange","handleHueChange","handleAlphaChange","lum","display","rgbaFloatToHSVA01","PopDownController","valuesView","bottom","setKnobColor","bgCssColor","addTop","addBottom","ColorChooser","setKnobHelper","hex6Or8","hex","GUIFolder","args","arg1","createController","addCanvas","addColor","addDivider","addFolder","addLabel","MuiguiElement","HTMLElement","shadow","attachShadow","mode","customElements","define","baseStyleSheet","CSSStyleSheet","replaceSync","userStyleSheet","makeStyleSheetUpdater","styleSheet","newCss","newCssPromise","updateStyle","then","updateBaseStyle","updateUserStyle","GUI","static","localStyleSheet","autoPlace","muiguiElement","shadowRoot","adoptedStyleSheets","setStyle","setBaseStyles","keyDirections","ArrowLeft","ArrowRight","ArrowUp","ArrowDown","addKeyboardEvents","keyDown","mult","shiftKey","assert","truthy","msg","getEllipsePointForAngle","cx","cy","rx","ry","phi","theta","cos","sin","arc","end","x1","y1","x2","y2","fa","fs","dTheta","getEndpointParameters","twoPiMod","DirectionView","arrowElem","rangeElem","lastV","wrap","dirMin","dirMax","tempV","handleTouch","atan2","center","angle","transform","RadioGridView","cols","that","previousElementSibling","click","gridTemplateColumns","onResize","callback","ResizeObserver","observe","onResizeSVGNoScale","hAnchor","vAnchor","createSVGTicks","SliderView","svgElem","originElem","ticksElem","thicksElem","numbersElem","leftGradElem","rightGradElem","minusSize","unit","unitSize","ticksPerUnit","labelFn","tickHeight","limits","thicksColor","orientation","startV","oldHTML","getComputedTextLength","computeSizeOfMinus","updateSlider","unitsAcross","ceil","centerUnitSpace","startUnitSpace","minUnitSpace","maxUnitSpace","stroke","texts","digits","log10","createSVGNumbers","Vec2View","onTouch","updateDisplayImpl","Direction","RadioGrid","Slider","Vec2","makeSetter"],"mappings":"oOAAe,IAAAA,EAAA,CACbC,QAAS,s7cAsrBXC,OAAQ,CACND,QAAS,GACTE,MAAO,gyCCpqBF,SAASC,EAAWC,EAAKC,EAAQ,CAAA,EAAIC,EAAW,IACrD,MAAMC,EAAOC,SAASC,cAAcL,GAEpC,OAxBK,SAAsBG,EAAMF,EAAOC,GACxC,IAAK,MAAOI,EAAKC,KAAUC,OAAOC,QAAQR,GACxC,GAAqB,mBAAVM,GAAwBD,EAAII,WAAW,MAAO,CACvD,MAAMC,EAAYL,EAAIM,UAAU,GAAGC,cACnCV,EAAKW,iBAAiBH,EAAWJ,EAAO,CAACQ,SAAS,GACxD,MAAW,GAAqB,iBAAVR,EAChB,IAAK,MAAOS,EAAGC,KAAMT,OAAOC,QAAQF,GAClCJ,EAAKG,GAAKU,GAAKC,YAEMC,IAAdf,EAAKG,GACdH,EAAKgB,aAAab,EAAKC,GAEvBJ,EAAKG,GAAOC,EAGhB,IAAK,MAAMa,KAASlB,EAClBC,EAAKkB,YAAYD,EAGrB,CAIEE,CAAanB,EAAMF,EAAOC,GACnBC,CACT,CAQA,IAAIoB,EAAS,ECjCN,SAASC,EAAgBC,EAAOlB,GACrC,MAAMmB,EAAMD,EAAME,QAAQpB,GAI1B,OAHImB,GACFD,EAAMG,OAAOF,EAAK,GAEbD,CACT,CAaO,SAASI,EAAMZ,EAAGa,EAAKC,GAC5B,OAAOC,KAAKD,IAAID,EAAKE,KAAKF,IAAIC,EAAKd,GACrC,CAEO,MAAMgB,EAA4C,oBAAtBC,kBAC/B,SAA0CC,GAC1C,OAAOA,GAAKA,EAAEC,SAAWD,EAAEC,kBAAkBC,aAAeF,EAAEC,kBAAkBF,kBACjF,EACC,SAAuBC,GACvB,OAAOA,GAAKA,EAAEC,QAAUD,EAAEC,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C5BsC,MAAMoB,EAAQC,EAAU,qBACxB,MAAMqH,EAA2C,iBAApBlK,KAAKsH,YAEhCyC,UAAWK,EAAcwS,KACzBA,EAAO,GACL1d,EACE6K,EAAYE,EAAmBG,EAAgBF,GACrDlK,KAAKT,IAAI,IAAIod,GAAc3c,KAAM+J,EAAW6S,IAC5C5c,KAAKgD,eACN,GFDHqW,GAAI9O,MAAQA,EACZ8O,GAAIlP,OAASA,EACbkP,GAAI0G,OGZW,cAAqB7Y,EAClCnH,YAAY6C,EAAQC,EAAU3D,EAAU,CAAA,GACtCsC,MAAMoB,EAAQC,EAAU,iBACxB7C,KAAKT,IAAI,IAAIke,GAAWzd,KAAMd,IAC9Bc,KAAKT,IAAI,IAAIyJ,EAAWhJ,KAAMd,IAC9Bc,KAAKgD,eACN,GHOHqW,GAAI1P,WAAaA,EACjB0P,GAAI2G,KIJW,cAAmBlJ,GAChC/W,YAAY6C,EAAQC,GAClBrB,MAAMoB,EAAQC,EAAU,eAExB,MAAMod,EAAcnjB,IACX,CACL4C,SAAWrD,IACT,MAAMyE,EAAOd,KAAKsH,WAClBxG,EAAKhE,GAAOT,EACZ2D,KAAKN,SAASoB,EAAK,EAErB+E,cAAgBxJ,IACd,MAAMyE,EAAOd,KAAKsH,WAClBxG,EAAKhE,GAAOT,EACZ2D,KAAK6F,cAAc/E,EAAK,IAK9Bd,KAAKmX,OAAO,IAAInO,EAAWiX,EAAW,GAAI,CACxCthB,WAAY,CACVF,GAAIpC,GAAKA,EAAE,GACXsB,KAAMqK,EAAYrK,SAGtBqC,KAAKmX,OAAO,IAAInO,EAAWiX,EAAW,GAAI,CACxCthB,WAAY,CACVF,GAAIpC,GAAKA,EAAE,GACXsB,KAAMqK,EAAYrK,SAGtBqC,KAAKoX,UAAU,IAAIsI,GAAS1f,OAC5BA,KAAKgD,eACN"}
\ No newline at end of file
+{"version":3,"file":"muigui.min.js","sources":["../../src/styles/muigui.css.js","../../src/libs/elem.js","../../src/libs/utils.js","../../../src/views/View.ts","../../src/controllers/Controller.js","../../src/controllers/Button.js","../../src/views/EditView.js","../../src/views/CheckboxView.js","../../src/libs/taskrunner.js","../../src/libs/ids.js","../../src/views/ValueView.js","../../src/controllers/LabelController.js","../../src/controllers/ValueController.js","../../src/controllers/Checkbox.js","../../src/libs/conversions.js","../../src/libs/wheel.js","../../src/views/NumberView.js","../../src/controllers/TextNumber.js","../../src/views/SelectView.js","../../src/libs/key-values.js","../../src/controllers/Select.js","../../src/views/RangeView.js","../../src/controllers/Range.js","../../src/views/TextView.js","../../src/controllers/Text.js","../../src/libs/color-utils.js","../../src/views/ElementView.js","../../src/controllers/Canvas.js","../../src/views/ColorView.js","../../src/controllers/Color.js","../../src/controllers/Divider.js","../../src/controllers/Container.js","../../src/controllers/Folder.js","../../src/controllers/Label.js","../../src/libs/touch.js","../../src/views/ColorChooserView.js","../../src/controllers/PopDownController.js","../../src/controllers/ColorChooser.js","../../src/muigui.js","../../src/controllers/create-controller.js","../../src/libs/keyboard.js","../../src/libs/assert.js","../../src/libs/svg.js","../../src/views/DirectionView.js","../../src/views/RadioGridView.js","../../src/libs/resize-helpers.js","../../src/views/SliderView.js","../../src/views/Vec2View.js","../../src/umd.js","../../src/controllers/Direction.js","../../src/controllers/RadioGrid.js","../../src/controllers/Slider.js","../../src/controllers/Vec2.js"],"sourcesContent":["export default {\n default: `\n.muigui {\n --bg-color: #ddd;\n --color: #222;\n --contrast-color: #eee;\n --value-color: #145 ;\n --value-bg-color: #eeee;\n --disabled-color: #999;\n --menu-bg-color: #f8f8f8;\n --menu-sep-color: #bbb;\n --hover-bg-color: #999;\n --focus-color: #8BF;\n --range-color: #AAA;\n --invalid-color: #FF0000;\n --selected-color: rgb(255, 255, 255, 0.9);\n\n --button-bg-color: var(--value-bg-color);\n\n --image-open: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPgogIDxyZWN0IHN0eWxlPSJmaWxsOiAjNDQ0OyIgeD0iMjAlIiB5PSI0NSUiIHdpZHRoPSI2MCUiIGhlaWdodD0iMTAlIj48L3JlY3Q+Cjwvc3ZnPg==);\n --image-closed: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPgogIDxyZWN0IHN0eWxlPSJmaWxsOiAjNDQ0OyIgeD0iNDUlIiB5PSIyMCUiIHdpZHRoPSIxMCUiIGhlaWdodD0iNjAlIj48L3JlY3Q+CiAgPHJlY3Qgc3R5bGU9ImZpbGw6ICM0NDQ7IiB4PSIyMCUiIHk9IjQ1JSIgd2lkdGg9IjYwJSIgaGVpZ2h0PSIxMCUiPjwvcmVjdD4KPC9zdmc+);\n --image-checkerboard: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPgogIDxyZWN0IHN0eWxlPSJmaWxsOiAjNDA0MDQwOyIgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSI+PC9yZWN0PgogIDxyZWN0IHN0eWxlPSJmaWxsOiAjODA4MDgwOyIgeD0iMCIgeT0iMCIgd2lkdGg9IjUwJSIgaGVpZ2h0PSI1MCUiPjwvcmVjdD4KICA8cmVjdCBzdHlsZT0iZmlsbDogIzgwODA4MDsiIHg9IjUwJSIgeT0iNTAlIiB3aWR0aD0iNTAlIiBoZWlnaHQ9IjUwJSI+PC9yZWN0Pgo8L3N2Zz4=);\n\n --range-left-color: var(--value-color);\n --range-right-color: var(--value-bg-color); \n --range-right-hover-color: var(--hover-bg-color);\n --button-image: \n linear-gradient(\n rgba(255, 255, 255, 1), rgba(0, 0, 0, 0.2)\n );\n\n color: var(--color);\n background-color: var(--bg-color);\n}\n\n@media (prefers-color-scheme: dark) {\n .muigui {\n --bg-color: #222222;\n --color: #dddddd;\n --contrast-color: #000;\n --value-color: #43e5f7;\n --value-bg-color: #444444;\n --disabled-color: #666666;\n --menu-bg-color: #080808;\n --menu-sep-color: #444444;\n --hover-bg-color: #666666;\n --focus-color: #458; /*#88AAFF*/;\n --range-color: #888888;\n --invalid-color: #FF6666;\n --selected-color: rgba(255, 255, 255, 0.3);\n\n --button-bg-color: var(--value-bg-color);\n\n --range-left-color: var(--value-color);\n --range-right-color: var(--value-bg-color); \n --range-right-hover-color: var(--hover-bg-color);\n --button-image: linear-gradient(\n rgba(0, 0, 0, 0.1), rgba(0, 0, 0, 0.4)\n );\n\n color: var(--color);\n background-color: var(--bg-color);\n\n --image-closed: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPgogIDxyZWN0IHN0eWxlPSJmaWxsOiAjREREOyIgeD0iMjAlIiB5PSI0NSUiIHdpZHRoPSI2MCUiIGhlaWdodD0iMTAlIj48L3JlY3Q+Cjwvc3ZnPg==);\n --image-open: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPgogIDxyZWN0IHN0eWxlPSJmaWxsOiAjREREOyIgeD0iNDUlIiB5PSIyMCUiIHdpZHRoPSIxMCUiIGhlaWdodD0iNjAlIj48L3JlY3Q+CiAgPHJlY3Qgc3R5bGU9ImZpbGw6ICNEREQ7IiB4PSIyMCUiIHk9IjQ1JSIgd2lkdGg9IjYwJSIgaGVpZ2h0PSIxMCUiPjwvcmVjdD4KPC9zdmc+);\n }\n}\n\n.muigui {\n --width: 250px;\n --label-width: 45%;\n --number-width: 40%;\n\n --font-family: -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, Arial, sans-serif;\n --font-size: 11px;\n --font-family-mono: Menlo, Monaco, Consolas, \"Droid Sans Mono\", monospace;\n --font-size-mono: 11px;\n\n --line-height: 1.7em;\n --border-radius: 0px;\n\n width: var(--width);\n font-family: var(--font-family);\n font-size: var(--font-size);\n box-sizing: border-box;\n line-height: 100%;\n}\n.muigui * {\n box-sizing: inherit;\n}\n\n.muigui-no-scroll {\n touch-action: none;\n}\n.muigui-no-h-scroll {\n touch-action: pan-y;\n}\n.muigui-no-v-scroll {\n touch-action: pan-x;\n}\n\n.muigui-invalid-value {\n background-color: red !important;\n color: white !important;\n}\n\n.muigui-grid {\n display: grid;\n}\n.muigui-rows {\n display: flex;\n flex-direction: column;\n\n min-height: 20px;\n border: 2px solid red;\n}\n.muigui-columns {\n display: flex;\n flex-direction: row;\n\n height: 20px;\n border: 2px solid green;\n}\n.muigui-rows>*,\n.muigui-columns>* {\n flex: 1 1 auto;\n align-items: stretch;\n min-height: 0;\n min-width: 0;\n}\n\n.muigui-row {\n border: 2px solid yellow;\n min-height: 10px\n}\n.muigui-column {\n border: 2px solid lightgreen;\n}\n\n/* -------- */\n\n.muigui-show { /* */ }\n.muigui-hide { \n display: none !important;\n}\n.muigui-disabled {\n pointer-events: none;\n --color: var(--disabled-color) !important;\n --value-color: var(--disabled-color) !important;\n --range-left-color: var(--disabled-color) !important;\n}\n\n.muigui canvas,\n.muigui svg {\n display: block;\n border-radius: var(--border-radius);\n}\n.muigui canvas {\n background-color: var(--value-bg-color);\n}\n\n.muigui-controller {\n min-width: 0;\n min-height: var(--line-height);\n}\n.muigui-root {\n z-index: 1;\n}\n.muigui-root,\n.muigui-menu {\n display: flex;\n flex-direction: column;\n position: relative;\n user-select: none;\n height: fit-content;\n margin: 0;\n padding-bottom: 0.1em;\n border-radius: var(--border-radius);\n}\n.muigui-menu {\n border-bottom: 1px solid var(--menu-sep-color);\n}\n\n.muigui-root>button:nth-child(1),\n.muigui-menu>button:nth-child(1) {\n border-top: 1px solid var(--menu-sep-color);\n border-bottom: 1px solid var(--menu-sep-color);\n position: relative;\n text-align: left;\n color: var(--color);\n background-color: var(--menu-bg-color);\n min-height: var(--line-height);\n padding: 0.2em;\n cursor: pointer;\n border-radius: var(--border-radius);\n}\n.muigui-root>div:nth-child(2),\n.muigui-menu>div:nth-child(2) {\n flex: 1 1 auto;\n}\n\n.muigui-controller {\n margin-left: 0.2em;\n margin-right: 0.2em;\n}\n.muigui-root.muigui-controller,\n.muigui-menu.muigui-controller {\n margin-left: 0;\n margin-right: 0;\n}\n.muigui-controller>*:nth-child(1) {\n flex: 1 0 var(--label-width);\n min-width: 0;\n /* white-space: pre; why?? */\n}\n.muigui-controller>label:nth-child(1) {\n place-content: center start;\n display: inline-grid;\n overflow: hidden;\n}\n.muigui-controller>*:nth-child(2) {\n flex: 1 1 75%;\n min-width: 0;\n}\n\n/* -----------------------------------------\n a label controller is [[label][value]]\n*/\n\n.muigui-label-controller {\n display: flex;\n margin: 0.4em 0 0.4em 0;\n word-wrap: initial;\n align-items: stretch;\n}\n\n.muigui-value {\n display: flex;\n align-items: stretch;\n}\n.muigui-value>* {\n flex: 1 1 auto;\n min-width: 0;\n}\n.muigui-value>*:nth-child(1) {\n flex: 1 1 calc(100% - var(--number-width));\n}\n.muigui-value>*:nth-child(2) {\n flex: 1 1 var(--number-width);\n margin-left: 0.2em;\n}\n\n/* fix! */\n.muigui-open>button>label::before,\n.muigui-closed>button>label::before {\n content: \"X\";\n color: rgba(0, 0, 0, 0);\n background-color: var(--range-color);\n border-radius: 0.2em;\n width: 1.25em;\n margin-right: 0.25em;\n height: 1.25em; /*var(--line-height);*/\n display: inline-grid;\n place-content: center start;\n pointer-events: none;\n}\n.muigui-open>button>label::before {\n background-image: var(--image-open);\n}\n.muigui-closed>button>label::before {\n background-image: var(--image-closed);\n}\n\n.muigui-open>.muigui-open-container {\n transition: all 0.1s ease-out;\n overflow: auto;\n height: 100%;\n}\n.muigui-closed>.muigui-open-container {\n transition: all 0.1s ease-out;\n overflow: hidden;\n min-height: 0;\n}\n.muigui-open>.muigui-open-container>* {\n transition: all 0.1s ease-out;\n margin-top: 0px;\n}\n.muigui-closed>.muigui-open-container>* {\n transition: all 0.1s ease-out;\n margin-top: -100%;\n}\n\n/* ---- popdown ---- */\n\n.muigui-pop-down-top {\n display: flex;\n}\n/* fix? */\n.muigui-value>*:nth-child(1).muigui-pop-down-top {\n flex: 0;\n}\n.muigui-closed .muigui-pop-down-bottom {\n max-height: 0;\n}\n\n.muigui-value .muigui-pop-down-bottom {\n margin: 0;\n}\n\n.muigui-pop-down-values {\n min-width: 0;\n display: flex;\n}\n.muigui-pop-down-values>* {\n flex: 1 1 auto;\n min-width: 0;\n}\n\n.muigui-value.muigui-pop-down-controller {\n flex-direction: column;\n}\n\n.muigui-pop-down-top input[type=checkbox] {\n -webkit-appearance: none;\n appearance: none;\n width: auto;\n color: var(--value-color);\n background-color: var(--value-bg-color);\n background-image: var(--image-checkerboard);\n background-size: 10px 10px;\n background-position: 0 0, 0 5px, 5px -5px, -5px 0px;\n\n cursor: pointer;\n\n display: grid;\n place-content: center;\n margin: 0;\n font: inherit;\n color: currentColor;\n width: 1.7em;\n height: 1.7em;\n transform: translateY(-0.075em);\n}\n\n.muigui-pop-down-top input[type=checkbox]::before {\n content: \"+\";\n display: grid;\n place-content: center;\n border-radius: calc(var(--border-radius) + 2px);\n border-left: 1px solid rgba(255,255,255,0.3);\n border-top: 1px solid rgba(255,255,255,0.3);\n border-bottom: 1px solid rgba(0,0,0,0.2);\n border-right: 1px solid rgba(0,0,0,0.2);\n background-color: var(--range-color);\n color: var(--value-bg-color);\n width: calc(var(--line-height) - 4px);\n height: calc(var(--line-height) - 4px);\n}\n\n.muigui-pop-down-top input[type=checkbox]:checked::before {\n content: \"X\";\n}\n\n\n/* ---- select ---- */\n\n.muigui select,\n.muigui option,\n.muigui input,\n.muigui button {\n color: var(--value-color);\n background-color: var(--value-bg-color);\n font-family: var(--font-family);\n font-size: var(--font-size);\n border: none;\n margin: 0;\n border-radius: var(--border-radius);\n}\n.muigui select {\n appearance: none;\n margin: 0;\n margin-left: 0; /*?*/\n overflow: hidden; /* Safari */\n}\n\n.muigui select:focus,\n.muigui input:focus,\n.muigui button:focus {\n outline: 1px solid var(--focus-color);\n}\n\n.muigui select:hover,\n.muigui option:hover,\n.muigui input:hover,\n.muigui button:hover {\n background-color: var(--hover-bg-color); \n}\n\n/* ------ [ label ] ------ */\n\n.muigui-label {\n border-top: 1px solid var(--menu-sep-color);\n border-bottom: 1px solid var(--menu-sep-color);\n padding-top: 0.4em;\n padding-bottom: 0.3em;\n place-content: center start;\n background-color: var(--menu-bg-color);\n white-space: pre;\n border-radius: var(--border-radius);\n}\n\n/* ------ [ divider] ------ */\n\n.muigui-divider {\n min-height: 6px;\n border-top: 2px solid var(--menu-sep-color);\n margin-top: 6px;\n}\n\n/* ------ [ button ] ------ */\n\n.muigui-button {\n display: grid;\n padding: 2px 0 2px 0;\n}\n.muigui-button button {\n border: none;\n color: var(--value-color);\n background-color: var(--button-bg-color);\n background-image: var(--button-image);\n cursor: pointer;\n place-content: center center;\n height: var(--line-height);\n}\n\n/* ------ [ color ] ------ */\n\n.muigui-color>div {\n overflow: hidden;\n position: relative;\n margin-left: 0;\n margin-right: 0; /* why? */\n max-width: var(--line-height);\n border-radius: var(--border-radius);\n}\n\n.muigui-color>div:focus-within {\n outline: 1px solid var(--focus-color);\n}\n\n.muigui-color input[type=color] {\n border: none;\n padding: 0;\n background: inherit;\n cursor: pointer;\n position: absolute;\n width: 200%;\n left: -10px;\n top: -10px;\n height: 200%;\n}\n.muigui-disabled canvas,\n.muigui-disabled svg,\n.muigui-disabled img,\n.muigui-disabled .muigui-color input[type=color] {\n opacity: 0.2;\n}\n\n/* ------ [ checkbox ] ------ */\n\n.muigui-checkbox>label:nth-child(2) {\n display: grid;\n place-content: center start;\n margin: 0;\n}\n\n.muigui-checkbox input[type=checkbox] {\n -webkit-appearance: none;\n appearance: none;\n width: auto;\n color: var(--value-color);\n background-color: var(--value-bg-color);\n cursor: pointer;\n\n display: grid;\n place-content: center;\n margin: 0;\n font: inherit;\n color: currentColor;\n width: 1.7em;\n height: 1.7em;\n transform: translateY(-0.075em);\n}\n\n.muigui-checkbox input[type=checkbox]::before {\n content: \"\";\n color: var(--value-color);\n display: grid;\n place-content: center;\n}\n\n.muigui-checkbox input[type=checkbox]:checked::before {\n content: \"✔\";\n}\n\n.muigui input[type=number]::-webkit-inner-spin-button, \n.muigui input[type=number]::-webkit-outer-spin-button { \n -webkit-appearance: none;\n appearance: none;\n margin: 0; \n}\n.muigui input[type=number] {\n -moz-appearance: textfield;\n}\n\n/* ------ [ radio grid ] ------ */\n\n.muigui-radio-grid>div {\n display: grid;\n gap: 2px;\n}\n\n.muigui-radio-grid input {\n appearance: none;\n display: none;\n}\n\n.muigui-radio-grid button {\n color: var(--color);\n width: 100%;\n text-align: left;\n}\n\n.muigui-radio-grid input:checked + button {\n color: var(--value-color);\n background-color: var(--selected-color);\n}\n\n/* ------ [ color-chooser ] ------ */\n\n.muigui-color-chooser-cursor {\n stroke-width: 1px;\n stroke: white;\n fill: none;\n}\n.muigui-color-chooser-circle {\n stroke-width: 1px;\n stroke: white;\n fill: none;\n}\n\n\n/* ------ [ vec2 ] ------ */\n\n.muigui-vec2 svg {\n background-color: var(--value-bg-color);\n}\n\n.muigui-vec2-axis {\n stroke: 1px;\n stroke: var(--focus-color);\n}\n\n.muigui-vec2-line {\n stroke-width: 1px;\n stroke: var(--value-color);\n fill: var(--value-color);\n}\n\n/* ------ [ direction ] ------ */\n\n.muigui-direction svg {\n background-color: rgba(0,0,0,0.2);\n}\n\n.muigui-direction:focus-within svg {\n outline: none;\n}\n.muigui-direction-range {\n fill: var(--value-bg-color);\n}\n.muigui-direction svg:focus {\n outline: none;\n}\n.muigui-direction svg:focus .muigui-direction-range {\n stroke-width: 0.5px;\n stroke: var(--focus-color);\n}\n\n.muigui-direction-arrow {\n fill: var(--value-color);\n}\n\n/* ------ [ slider ] ------ */\n\n.muigui-slider>div {\n display: flex;\n align-items: stretch;\n height: var(--line-height);\n}\n.muigui-slider svg {\n flex: 1 1 auto;\n}\n.muigui-slider .muigui-slider-up #muigui-orientation {\n transform: scale(1, -1) translateY(-100%);\n}\n\n.muigui-slider .muigui-slider-up #muigui-number-orientation {\n transform: scale(1,-1);\n}\n\n.muigui-ticks {\n stroke: var(--range-color);\n}\n.muigui-thicks {\n stroke: var(--color);\n stroke-width: 2px;\n}\n.muigui-svg-text {\n fill: var(--color);\n font-size: 7px;\n}\n.muigui-mark {\n fill: var(--value-color);\n}\n\n/* ------ [ range ] ------ */\n\n\n.muigui-range input[type=range] {\n -webkit-appearance: none;\n appearance: none;\n background-color: transparent;\n}\n\n.muigui-range input[type=range]::-webkit-slider-thumb {\n -webkit-appearance: none;\n appearance: none;\n border-radius: calc(var(--border-radius) + 2px);\n border-left: 1px solid rgba(255,255,255,0.3);\n border-top: 1px solid rgba(255,255,255,0.3);\n border-bottom: 1px solid rgba(0,0,0,0.2);\n border-right: 1px solid rgba(0,0,0,0.2);\n background-color: var(--range-color);\n margin-top: calc((var(--line-height) - 6px) / -2);\n width: calc(var(--line-height) - 6px);\n height: calc(var(--line-height) - 6px);\n}\n\n.muigui-range input[type=range]::-webkit-slider-runnable-track {\n -webkit-appearance: none;\n appearance: none;\n border: 1px solid var(--menu-sep-color);\n height: 2px;\n}\n\n\n/* dat.gui style - doesn't work on Safari iOS */\n\n/*\n.muigui-range input[type=range] {\n cursor: ew-resize;\n overflow: hidden;\n}\n\n.muigui-range input[type=range] {\n -webkit-appearance: none;\n appearance: none;\n background-color: var(--range-right-color);\n margin: 0;\n}\n.muigui-range input[type=range]:hover {\n background-color: var(--range-right-hover-color);\n}\n\n.muigui-range input[type=range]::-webkit-slider-runnable-track {\n -webkit-appearance: none;\n appearance: none;\n height: max-content;\n color: var(--range-left-color);\n margin-top: -1px;\n}\n\n.muigui-range input[type=range]::-webkit-slider-thumb {\n -webkit-appearance: none;\n appearance: none;\n width: 0px;\n height: max-content;\n box-shadow: -1000px 0 0 1000px var(--range-left-color);\n}\n*/\n\n/* FF */\n/*\n.muigui-range input[type=range]::-moz-slider-progress {\n background-color: var(--range-left-color); \n}\n.muigui-range input[type=range]::-moz-slider-thumb {\n height: max-content;\n width: 0;\n border: none;\n box-shadow: -1000px 0 0 1000px var(--range-left-color);\n box-sizing: border-box;\n}\n*/\n\n.muigui-checkered-background {\n background-color: #404040;\n background-image:\n linear-gradient(45deg, #808080 25%, transparent 25%),\n linear-gradient(-45deg, #808080 25%, transparent 25%),\n linear-gradient(45deg, transparent 75%, #808080 75%),\n linear-gradient(-45deg, transparent 75%, #808080 75%);\n background-size: 16px 16px;\n background-position: 0 0, 0 8px, 8px -8px, -8px 0px;\n}\n\n/* ---------------------------------------------------------- */\n\n/* needs to be at bottom to take precedence */\n.muigui-auto-place {\n max-height: 100%;\n position: fixed;\n top: 0;\n right: 15px;\n z-index: 100001;\n}\n\n`,\nthemes: {\n default: {\n include: ['default'],\n css: `\n `,\n },\n float: {\n include: ['default'],\n css: `\n :root {\n color-scheme: light dark,\n }\n\n .muigui {\n --width: 400px;\n --bg-color: initial;\n --label-width: 25%;\n --number-width: 20%;\n }\n\n input,\n .muigui-label-controller>label {\n text-shadow:\n -1px -1px 0 var(--contrast-color),\n 1px -1px 0 var(--contrast-color),\n -1px 1px 0 var(--contrast-color),\n 1px 1px 0 var(--contrast-color);\n }\n\n .muigui-controller > label:nth-child(1) {\n place-content: center end;\n margin-right: 1em;\n }\n\n .muigui-value > :nth-child(2) {\n margin-left: 1em;\n }\n\n .muigui-root>*:nth-child(1) {\n display: none;\n }\n\n .muigui-range input[type=range]::-webkit-slider-thumb {\n border-radius: 1em;\n }\n\n .muigui-range input[type=range]::-webkit-slider-runnable-track {\n -webkit-appearance: initial;\n appearance: none;\n border: 1px solid rgba(0, 0, 0, 0.25);\n height: 2px;\n }\n\n .muigui-colors {\n --value-color: var(--color );\n --value-bg-color: rgba(0, 0, 0, 0.1);\n --disabled-color: #cccccc;\n --menu-bg-color: rgba(0, 0, 0, 0.1);\n --menu-sep-color: #bbbbbb;\n --hover-bg-color: rgba(0, 0, 0, 0);\n --invalid-color: #FF0000;\n --selected-color: rgba(0, 0, 0, 0.3);\n --range-color: rgba(0, 0, 0, 0.125);\n }\n`,\n },\n form: {\n include: [],\n css: `\n .muigui {\n --width: 100%;\n --label-width: 45%;\n --number-width: 40%;\n }\n .muigui-root>button {\n display: none;\n }\n .muigui-controller {\n margin-top: 1em;\n }\n .muigui-label-controller {\n display: flex;\n flex-direction: column;\n align-items: stretch;\n margin-top: 1em;\n }\n .muigui-label-controller:has(.muigui-checkbox) {\n flex-direction: row;\n }\n .muigui-value {\n display: flex;\n align-items: stretch;\n }\n .muigui-value>* {\n flex: 1 1 auto;\n min-width: 0;\n }\n .muigui-controller>*:nth-child(1) {\n flex: 1 0 var(--label-width);\n min-width: 0;\n white-space: pre;\n }\n .muigui-controller>label:nth-child(1) {\n place-content: center start;\n display: inline-grid;\n overflow: hidden;\n }\n .muigui-controller>*:nth-child(2) {\n flex: 1 1 75%;\n min-width: 0;\n }\n `,\n },\n none: {\n include: [],\n css: '',\n },\n},\n};\n","export function setElemProps(elem, attrs, children) {\n for (const [key, value] of Object.entries(attrs)) {\n if (typeof value === 'function' && key.startsWith('on')) {\n const eventName = key.substring(2).toLowerCase();\n elem.addEventListener(eventName, value, {passive: false});\n } else if (typeof value === 'object') {\n for (const [k, v] of Object.entries(value)) {\n elem[key][k] = v;\n }\n } else if (elem[key] === undefined) {\n elem.setAttribute(key, value);\n } else {\n elem[key] = value;\n }\n }\n for (const child of children) {\n elem.appendChild(child);\n }\n return elem;\n}\n\nexport function createElem(tag, attrs = {}, children = []) {\n const elem = document.createElement(tag);\n setElemProps(elem, attrs, children);\n return elem;\n}\n\nexport function addElem(tag, parent, attrs = {}, children = []) {\n const elem = createElem(tag, attrs, children);\n parent.appendChild(elem);\n return elem;\n}\n\nlet nextId = 0;\nexport function getNewId() {\n return `muigui-id-${nextId++}`;\n}\n","export function removeArrayElem(array, value) {\n const ndx = array.indexOf(value);\n if (ndx) {\n array.splice(ndx, 1);\n }\n return array;\n}\n\n/**\n * Converts an camelCase or snake_case id to \"camel case\" or \"snake case\"\n * @param {string} id\n */\nconst underscoreRE = /_/g;\nconst upperLowerRE = /([A-Z])([a-z])/g;\nexport function idToLabel(id) {\n return id.replace(underscoreRE, ' ')\n .replace(upperLowerRE, (m, m1, m2) => `${m1.toLowerCase()} ${m2}`);\n}\n\nexport function clamp(v, min, max) {\n return Math.max(min, Math.min(max, v));\n}\n\nexport const isTypedArray = typeof SharedArrayBuffer !== 'undefined'\n ? function isArrayBufferOrSharedArrayBuffer(a) {\n return a && a.buffer && (a.buffer instanceof ArrayBuffer || a.buffer instanceof SharedArrayBuffer);\n }\n : function isArrayBuffer(a) {\n return a && a.buffer && a.buffer instanceof ArrayBuffer;\n };\n\nexport const isArrayOrTypedArray = v => Array.isArray(v) || isTypedArray(v);\n\n// Yea, I know this should be `Math.round(v / step) * step\n// but try step = 0.1, newV = 19.95\n//\n// I get\n// Math.round(19.95 / 0.1) * 0.1\n// 19.900000000000002\n// vs\n// Math.round(19.95 / 0.1) / (1 / 0.1)\n// 19.9\n//\nexport const stepify = (v, from, step) => Math.round(from(v) / step) / (1 / step);\n\nexport const euclideanModulo = (v, n) => ((v % n) + n) % n;\nexport const lerp = (a, b, t) => a + (b - a) * t;\nexport function copyExistingProperties(dst, src) {\n for (const key in src) {\n if (key in dst) {\n dst[key] = src[key];\n }\n }\n return dst;\n}\n\nexport const mapRange = (v, inMin, inMax, outMin, outMax) => (v - inMin) * (outMax - outMin) / (inMax - inMin) + outMin;\n\nexport const makeRangeConverters = ({from, to}) => {\n return {\n to: v => mapRange(v, ...from, ...to),\n from: v => [true, mapRange(v, ...to, ...from)],\n };\n};\n\nexport const makeRangeOptions = ({from, to, step}) => {\n return {\n min: to[0],\n max: to[1],\n ...(step && {step}),\n converters: makeRangeConverters({from, to}),\n };\n};\n\n// TODO: remove an use one in conversions. Move makeRangeConverters there?\nexport const identity = {\n to: v => v,\n from: v => [true, v],\n};\nexport function makeMinMaxPair(gui, properties, minPropName, maxPropName, options) {\n const { converters: { from } = identity } = options;\n const { min, max } = options;\n const guiMinRange = options.minRange || 0;\n const valueMinRange = from(guiMinRange)[1];\n const minGui = gui\n .add(properties, minPropName, {\n ...options,\n min,\n max: max - guiMinRange,\n })\n .onChange(v => {\n maxGui.setValue(Math.min(max, Math.max(v + valueMinRange, properties[maxPropName])));\n });\n const maxGui = gui\n .add(properties, maxPropName, {\n ...options,\n min: min + guiMinRange,\n max,\n })\n .onChange(v => {\n minGui.setValue(Math.max(min, Math.min(v - valueMinRange, properties[minPropName])));\n });\n return [ minGui, maxGui ];\n}\n\n","import { removeArrayElem } from '../libs/utils.js';\n\nexport default class View {\n domElement: HTMLElement;\n\n #childDestElem: HTMLElement;\n #views: View[] = [];\n\n constructor(elem: HTMLElement) {\n this.domElement = elem;\n this.#childDestElem = elem;\n }\n addElem(elem: HTMLElement) {\n this.#childDestElem.appendChild(elem);\n return elem;\n }\n removeElem(elem: HTMLElement) {\n this.#childDestElem.removeChild(elem);\n return elem;\n }\n pushSubElem(elem: HTMLElement) {\n this.#childDestElem.appendChild(elem);\n this.#childDestElem = elem;\n }\n popSubElem() {\n this.#childDestElem = this.#childDestElem.parentElement!;\n }\n add(view: View) {\n this.#views.push(view);\n this.addElem(view.domElement);\n return view;\n }\n remove(view: View) {\n this.removeElem(view.domElement);\n removeArrayElem(this.#views, view);\n return view;\n }\n pushSubView(view: View) {\n this.pushSubElem(view.domElement);\n }\n popSubView() {\n this.popSubElem();\n }\n setOptions(options: any) {\n for (const view of this.#views) {\n view.setOptions(options);\n }\n }\n updateDisplayIfNeeded(newV: any, ignoreCache?: boolean) {\n for (const view of this.#views) {\n view.updateDisplayIfNeeded(newV, ignoreCache);\n }\n return this;\n }\n $(selector: string) {\n return this.domElement.querySelector(selector);\n }\n}","import { createElem } from '../libs/elem.js';\nimport { removeArrayElem } from '../libs/utils.js';\nimport View from '../views/View.js';\n\nexport default class Controller extends View {\n #changeFns;\n #finishChangeFns;\n #parent;\n\n constructor(className) {\n super(createElem('div', {className: 'muigui-controller'}));\n this.#changeFns = [];\n this.#finishChangeFns = [];\n // we need the specialization to come last so it takes precedence.\n if (className) {\n this.domElement.classList.add(className);\n }\n }\n get parent() {\n return this.#parent;\n }\n setParent(parent) {\n this.#parent = parent;\n this.enable(!this.disabled());\n }\n show(show = true) {\n this.domElement.classList.toggle('muigui-hide', !show);\n this.domElement.classList.toggle('muigui-show', show);\n return this;\n }\n hide() {\n return this.show(false);\n }\n disabled() {\n return !!this.domElement.closest('.muigui-disabled');\n }\n\n enable(enable = true) {\n this.domElement.classList.toggle('muigui-disabled', !enable);\n\n // If disabled we need to set the attribute 'disabled=true' to all\n // input/select/button/textarea's below\n //\n // If enabled we need to set the attribute 'disabled=false' to all below\n // until we hit a disabled controller.\n //\n // ATM the problem is we can find the input/select/button/textarea elements\n // but we can't easily find which controller they belong do.\n // But we don't need to? We can just check up if it or parent has\n // '.muigui-disabled'\n ['input', 'button', 'select', 'textarea'].forEach(tag => {\n this.domElement.querySelectorAll(tag).forEach(elem => {\n const disabled = !!elem.closest('.muigui-disabled');\n elem.disabled = disabled;\n });\n });\n\n return this;\n }\n disable(disable = true) {\n return this.enable(!disable);\n }\n onChange(fn) {\n this.removeChange(fn);\n this.#changeFns.push(fn);\n return this;\n }\n removeChange(fn) {\n removeArrayElem(this.#changeFns, fn);\n return this;\n }\n onFinishChange(fn) {\n this.removeFinishChange(fn);\n this.#finishChangeFns.push(fn);\n return this;\n }\n removeFinishChange(fn) {\n removeArrayElem(this.#finishChangeFns, fn);\n return this;\n }\n #callListeners(fns, newV) {\n for (const fn of fns) {\n fn.call(this, newV);\n }\n }\n emitChange(value, object, property) {\n this.#callListeners(this.#changeFns, value);\n if (this.#parent) {\n if (object === undefined) {\n this.#parent.emitChange(value);\n } else {\n this.#parent.emitChange({\n object,\n property,\n value,\n controller: this,\n });\n }\n }\n }\n emitFinalChange(value, object, property) {\n this.#callListeners(this.#finishChangeFns, value);\n if (this.#parent) {\n if (object === undefined) {\n this.#parent.emitChange(value);\n } else {\n this.#parent.emitFinalChange({\n object,\n property,\n value,\n controller: this,\n });\n }\n }\n }\n updateDisplay() {\n // placeholder. override\n }\n getColors() {\n const toCamelCase = s => s.replace(/-([a-z])/g, (m, m1) => m1.toUpperCase());\n const keys = [\n 'color',\n 'bg-color',\n 'value-color',\n 'value-bg-color',\n 'hover-bg-color',\n 'menu-bg-color',\n 'menu-sep-color',\n 'disabled-color',\n ];\n const div = createElem('div');\n this.domElement.appendChild(div);\n const colors = Object.fromEntries(keys.map(key => {\n div.style.color = `var(--${key})`;\n const s = getComputedStyle(div);\n return [toCamelCase(key), s.color];\n }));\n div.remove();\n return colors;\n }\n}\n","import {\n createElem,\n} from '../libs/elem.js';\nimport { copyExistingProperties } from '../libs/utils.js';\nimport Controller from './Controller.js';\n\nexport default class Button extends Controller {\n #object;\n #property;\n #buttonElem;\n #options = {\n name: '',\n };\n\n constructor(object, property, options = {}) {\n super('muigui-button', '');\n this.#object = object;\n this.#property = property;\n\n this.#buttonElem = this.addElem(\n createElem('button', {\n type: 'button',\n onClick: () => {\n this.#object[this.#property](this);\n },\n }));\n this.setOptions({name: property, ...options});\n }\n name(name) {\n this.#buttonElem.textContent = name;\n }\n setOptions(options) {\n copyExistingProperties(this.#options, options);\n const {name} = this.#options;\n this.#buttonElem.textContent = name;\n }\n}","import { isTypedArray } from '../libs/utils.js';\nimport View from './View.js';\n\nfunction arraysEqual(a, b) {\n if (a.length !== b.length) {\n return false;\n }\n for (let i = 0; i < a.length; ++i) {\n if (a[i] !== b[i]) {\n return false;\n }\n }\n return true;\n}\n\nfunction copyArrayElementsFromTo(src, dst) {\n dst.length = src.length;\n for (let i = 0; i < src.length; ++i) {\n dst[i] = src[i];\n }\n}\n\nexport default class EditView extends View {\n #oldV;\n #updateCheck;\n\n #checkArrayNeedsUpdate(newV) {\n // It's an array, we need to compare all elements\n // Example, vec2, [r,g,b], ...\n const needUpdate = !arraysEqual(newV, this.#oldV);\n if (needUpdate) {\n copyArrayElementsFromTo(newV, this.#oldV);\n }\n return needUpdate;\n }\n\n #checkTypedArrayNeedsUpdate() {\n let once = true;\n return function checkTypedArrayNeedsUpdateImpl(newV) {\n // It's a typedarray, we need to compare all elements\n // Example: Float32Array([r, g, b])\n let needUpdate = once;\n once = false;\n if (!needUpdate) {\n needUpdate = !arraysEqual(newV, this.#oldV);\n }\n return needUpdate;\n };\n }\n\n #checkObjectNeedsUpdate(newV) {\n let needUpdate = false;\n for (const key in newV) {\n if (newV[key] !== this.#oldV[key]) {\n needUpdate = true;\n this.#oldV[key] = newV[key];\n }\n }\n return needUpdate;\n }\n\n #checkValueNeedsUpdate(newV) {\n const needUpdate = newV !== this.#oldV;\n this.#oldV = newV;\n return needUpdate;\n }\n\n #getUpdateCheckForType(newV) {\n if (Array.isArray(newV)) {\n this.#oldV = [];\n return this.#checkArrayNeedsUpdate.bind(this);\n } else if (isTypedArray(newV)) {\n this.#oldV = new newV.constructor(newV);\n return this.#checkTypedArrayNeedsUpdate(this);\n } else if (typeof newV === 'object') {\n this.#oldV = {};\n return this.#checkObjectNeedsUpdate.bind(this);\n } else {\n return this.#checkValueNeedsUpdate.bind(this);\n }\n }\n\n // The point of this is updating DOM elements\n // is slow but if we've called `listen` then\n // every frame we're going to try to update\n // things with the current value so if nothing\n // has changed then skip it.\n updateDisplayIfNeeded(newV, ignoreCache) {\n this.#updateCheck = this.#updateCheck || this.#getUpdateCheckForType(newV);\n // Note: We call #updateCheck first because it updates\n // the cache\n if (this.#updateCheck(newV) || ignoreCache) {\n this.updateDisplay(newV);\n }\n }\n setOptions(/*options*/) {\n // override this\n return this;\n }\n}\n","import { createElem } from '../libs/elem.js';\nimport EditView from './EditView.js';\n\nexport default class CheckboxView extends EditView {\n #checkboxElem;\n constructor(setter, id) {\n const checkboxElem = createElem('input', {\n type: 'checkbox',\n id,\n onInput: () => {\n setter.setValue(checkboxElem.checked);\n },\n onChange: () => {\n setter.setFinalValue(checkboxElem.checked);\n },\n });\n super(createElem('label', {}, [checkboxElem]));\n this.#checkboxElem = checkboxElem;\n }\n updateDisplay(v) {\n this.#checkboxElem.checked = v;\n }\n}\n","import { removeArrayElem } from './utils.js';\n\nconst tasks = [];\nconst tasksToRemove = new Set();\n\nlet requestId;\nlet processing;\n\nfunction removeTasks() {\n if (!tasksToRemove.size) {\n return;\n }\n\n if (processing) {\n queueProcessing();\n return;\n }\n\n tasksToRemove.forEach(task => {\n removeArrayElem(tasks, task);\n });\n tasksToRemove.clear();\n}\n\nfunction processTasks() {\n requestId = undefined;\n processing = true;\n for (const task of tasks) {\n if (!tasksToRemove.has(task)) {\n task();\n }\n }\n processing = false;\n removeTasks();\n queueProcessing();\n}\n\nfunction queueProcessing() {\n if (!requestId && tasks.length) {\n requestId = requestAnimationFrame(processTasks);\n }\n}\n\nexport function addTask(fn) {\n tasks.push(fn);\n queueProcessing();\n}\n\nexport function removeTask(fn) {\n tasksToRemove.set(fn);\n\n const ndx = tasks.indexOf(fn);\n if (ndx >= 0) {\n tasks.splice(ndx, 1);\n }\n}","let id = 0;\n\nexport function makeId() {\n return `muigui-${++id}`;\n}\n","import { createElem } from '../libs/elem.js';\nimport View from './View.js';\n\nexport default class ValueView extends View {\n constructor(className = '') {\n super(createElem('div', {className: 'muigui-value'}));\n if (className) {\n this.domElement.classList.add(className);\n }\n }\n}","import { createElem } from '../libs/elem.js';\nimport { makeId } from '../libs/ids.js';\nimport ValueView from '../views/ValueView.js';\nimport Controller from './Controller.js';\n\nexport default class LabelController extends Controller {\n #id;\n #nameElem;\n\n constructor(className = '', name = '') {\n super('muigui-label-controller');\n this.#id = makeId();\n this.#nameElem = createElem('label', {for: this.#id});\n this.domElement.appendChild(this.#nameElem);\n this.pushSubView(new ValueView(className));\n this.name(name);\n }\n get id() {\n return this.#id;\n }\n name(name) {\n if (this.#nameElem.title === this.#nameElem.textContent) {\n this.#nameElem.title = name;\n }\n this.#nameElem.textContent = name;\n return this;\n }\n tooltip(tip) {\n this.#nameElem.title = tip;\n }\n}\n\n","import {addTask, removeTask} from '../libs/taskrunner.js';\nimport { isTypedArray } from '../libs/utils.js';\nimport LabelController from './LabelController.js';\n\nexport default class ValueController extends LabelController {\n #object;\n #property;\n #initialValue;\n #listening;\n #views;\n #updateFn;\n\n constructor(object, property, className = '') {\n super(className, property);\n this.#object = object;\n this.#property = property;\n this.#initialValue = this.getValue();\n this.#listening = false;\n this.#views = [];\n }\n get initialValue() {\n return this.#initialValue;\n }\n get object() {\n return this.#object;\n }\n get property() {\n return this.#property;\n }\n add(view) {\n this.#views.push(view);\n super.add(view);\n this.updateDisplay();\n return view;\n }\n #setValueImpl(v, ignoreCache) {\n let isDifferent = false;\n if (typeof v === 'object') {\n const dst = this.#object[this.#property];\n // don't replace objects, just their values.\n if (Array.isArray(v) || isTypedArray(v)) {\n for (let i = 0; i < v.length; ++i) {\n isDifferent ||= dst[i] !== v[i];\n dst[i] = v[i];\n }\n } else {\n for (const key of Object.keys(v)) {\n isDifferent ||= dst[key] !== v[key];\n }\n Object.assign(dst, v);\n }\n } else {\n isDifferent = this.#object[this.#property] !== v;\n this.#object[this.#property] = v;\n }\n this.updateDisplay(ignoreCache);\n if (isDifferent) {\n this.emitChange(this.getValue(), this.#object, this.#property);\n }\n return isDifferent;\n }\n setValue(v) {\n this.#setValueImpl(v);\n }\n setFinalValue(v) {\n const isDifferent = this.#setValueImpl(v, true);\n if (isDifferent) {\n this.emitFinalChange(this.getValue(), this.#object, this.#property);\n }\n return this;\n }\n updateDisplay(ignoreCache) {\n const newV = this.getValue();\n for (const view of this.#views) {\n view.updateDisplayIfNeeded(newV, ignoreCache);\n }\n return this;\n }\n setOptions(options) {\n for (const view of this.#views) {\n view.setOptions(options);\n }\n this.updateDisplay();\n return this;\n }\n getValue() {\n return this.#object[this.#property];\n }\n value(v) {\n this.setValue(v);\n return this;\n }\n reset() {\n this.setValue(this.#initialValue);\n return this;\n }\n listen(listen = true) {\n if (!this.#updateFn) {\n this.#updateFn = this.updateDisplay.bind(this);\n }\n if (listen) {\n if (!this.#listening) {\n this.#listening = true;\n addTask(this.#updateFn);\n }\n } else {\n if (this.#listening) {\n this.#listening = false;\n removeTask(this.#updateFn);\n }\n }\n return this;\n }\n}\n\n","import CheckboxView from '../views/CheckboxView.js';\nimport ValueController from './ValueController.js';\n\nexport default class Checkbox extends ValueController {\n constructor(object, property) {\n super(object, property, 'muigui-checkbox');\n const id = this.id;\n this.add(new CheckboxView(this, id));\n this.updateDisplay();\n }\n}","import {\n makeRangeConverters,\n} from './utils.js';\n\nexport const identity = {\n to: v => v,\n from: v => [true, v],\n};\n\n// from: from string to value\n// to: from value to string\nexport const strToNumber = {\n to: v => v.toString(),\n from: v => {\n const newV = parseFloat(v);\n return [!Number.isNaN(newV), newV];\n },\n};\n\nexport const converters = {\n radToDeg: makeRangeConverters({to: [0, 180], from: [0, Math.PI]}),\n};\n","export function createWheelHelper() {\n let wheelAccum = 0;\n return function (e, step, wheelScale = 5) {\n wheelAccum -= e.deltaY * step / wheelScale;\n const wheelSteps = Math.floor(Math.abs(wheelAccum) / step) * Math.sign(wheelAccum);\n const delta = wheelSteps * step;\n wheelAccum -= delta;\n return delta;\n };\n}\n","import { createElem } from '../libs/elem.js';\nimport { strToNumber } from '../libs/conversions.js';\nimport { createWheelHelper } from '../libs/wheel.js';\nimport { clamp, copyExistingProperties, stepify } from '../libs/utils.js';\nimport EditView from './EditView.js';\n\nexport default class NumberView extends EditView {\n #to;\n #from;\n #step;\n #skipUpdate;\n #options = {\n step: 0.01,\n converters: strToNumber,\n min: Number.NEGATIVE_INFINITY,\n max: Number.POSITIVE_INFINITY,\n };\n\n constructor(setter, options) {\n const setValue = setter.setValue.bind(setter);\n const setFinalValue = setter.setFinalValue.bind(setter);\n const wheelHelper = createWheelHelper();\n super(createElem('input', {\n type: 'number',\n onInput: () => {\n this.#handleInput(setValue, true);\n },\n onChange: () => {\n this.#handleInput(setFinalValue, false);\n },\n onWheel: e => {\n e.preventDefault();\n const {min, max, step} = this.#options;\n const delta = wheelHelper(e, step);\n const v = parseFloat(this.domElement.value);\n const newV = clamp(stepify(v + delta, v => v, step), min, max);\n const [valid, outV] = this.#from(newV);\n if (valid) {\n setter.setValue(outV);\n }\n },\n }));\n this.setOptions(options);\n }\n #handleInput(setFn, skipUpdate) {\n const v = parseFloat(this.domElement.value);\n const [valid, newV] = this.#from(v);\n let inRange;\n if (valid && !Number.isNaN(v)) {\n const {min, max} = this.#options;\n inRange = newV >= min && newV <= max;\n this.#skipUpdate = skipUpdate;\n setFn(clamp(newV, min, max));\n }\n this.domElement.classList.toggle('muigui-invalid-value', !valid || !inRange);\n }\n updateDisplay(v) {\n if (!this.#skipUpdate) {\n this.domElement.value = stepify(v, this.#to, this.#step);\n }\n this.#skipUpdate = false;\n }\n setOptions(options) {\n copyExistingProperties(this.#options, options);\n const {\n step,\n converters: {to, from},\n } = this.#options;\n this.#to = to;\n this.#from = from;\n this.#step = step;\n return this;\n }\n}\n","\nimport NumberView from '../views/NumberView.js';\nimport ValueController from './ValueController.js';\n\n// Wanted to name this `Number` but it conflicts with\n// JavaScript `Number`. It most likely wouldn't be\n// an issue? But users might `import {Number} ...` and\n// things would break.\nexport default class TextNumber extends ValueController {\n #textView;\n #step;\n\n constructor(object, property, options = {}) {\n super(object, property, 'muigui-text-number');\n this.#textView = this.add(new NumberView(this, options));\n this.updateDisplay();\n }\n}","import { createElem } from '../libs/elem.js';\nimport EditView from './EditView.js';\n\nexport default class SelectView extends EditView {\n #values;\n\n constructor(setter, keyValues) {\n const values = [];\n super(createElem('select', {\n onChange: () => {\n setter.setFinalValue(this.#values[this.domElement.selectedIndex]);\n },\n }, keyValues.map(([key, value]) => {\n values.push(value);\n return createElem('option', {textContent: key});\n })));\n this.#values = values;\n }\n updateDisplay(v) {\n const ndx = this.#values.indexOf(v);\n this.domElement.selectedIndex = ndx;\n }\n}\n","\n// 4 cases\n// (a) keyValues is array of arrays, each sub array is key value\n// (b) keyValues is array and value is number then keys = array contents, value = index\n// (c) keyValues is array and value is not number, key = array contents, value = array contents\n// (d) keyValues is object then key->value\nexport function convertToKeyValues(keyValues, valueIsNumber) {\n if (Array.isArray(keyValues)) {\n if (Array.isArray(keyValues[0])) {\n // (a) keyValues is array of arrays, each sub array is key value\n return keyValues;\n } else {\n if (valueIsNumber) {\n // (b) keyValues is array and value is number then keys = array contents, value = index\n return keyValues.map((v, ndx) => [v, ndx]);\n } else {\n // (c) keyValues is array and value is not number, key = array contents, value = array contents\n return keyValues.map(v => [v, v]);\n }\n }\n } else {\n // (d)\n return [...Object.entries(keyValues)];\n }\n}\n","import SelectView from '../views/SelectView.js';\nimport ValueController from './ValueController.js';\nimport { convertToKeyValues } from '../libs/key-values.js';\n\nexport default class Select extends ValueController {\n constructor(object, property, options) {\n super(object, property, 'muigui-select');\n const valueIsNumber = typeof this.getValue() === 'number';\n const {keyValues: keyValuesInput} = options;\n const keyValues = convertToKeyValues(keyValuesInput, valueIsNumber);\n this.add(new SelectView(this, keyValues));\n this.updateDisplay();\n }\n}","import { createElem } from '../libs/elem.js';\nimport { identity } from '../libs/conversions.js';\nimport { clamp, copyExistingProperties, stepify } from '../libs/utils.js';\nimport { createWheelHelper } from '../libs/wheel.js';\nimport EditView from './EditView.js';\n\nexport default class RangeView extends EditView {\n #to;\n #from;\n #step;\n #skipUpdate;\n #options = {\n step: 0.01,\n min: 0,\n max: 1,\n converters: identity,\n };\n\n constructor(setter, options) {\n const wheelHelper = createWheelHelper();\n super(createElem('input', {\n type: 'range',\n onInput: () => {\n this.#skipUpdate = true;\n const {min, max, step} = this.#options;\n const v = parseFloat(this.domElement.value);\n const newV = clamp(stepify(v, v => v, step), min, max);\n const [valid, validV] = this.#from(newV);\n if (valid) {\n setter.setValue(validV);\n }\n },\n onChange: () => {\n this.#skipUpdate = true;\n const {min, max, step} = this.#options;\n const v = parseFloat(this.domElement.value);\n const newV = clamp(stepify(v, v => v, step), min, max);\n const [valid, validV] = this.#from(newV);\n if (valid) {\n setter.setFinalValue(validV);\n }\n },\n onWheel: e => {\n e.preventDefault();\n const [valid, v] = this.#from(parseFloat(this.domElement.value));\n if (!valid) {\n return;\n }\n const {min, max, step} = this.#options;\n const delta = wheelHelper(e, step);\n const newV = clamp(stepify(v + delta, v => v, step), min, max);\n setter.setValue(newV);\n },\n }));\n this.setOptions(options);\n }\n updateDisplay(v) {\n if (!this.#skipUpdate) {\n this.domElement.value = stepify(v, this.#to, this.#step);\n }\n this.#skipUpdate = false;\n }\n setOptions(options) {\n copyExistingProperties(this.#options, options);\n const {\n step,\n min,\n max,\n converters: {to, from},\n } = this.#options;\n this.#to = to;\n this.#from = from;\n this.#step = step;\n this.domElement.step = step;\n this.domElement.min = min;\n this.domElement.max = max;\n return this;\n }\n}","import ValueController from './ValueController.js';\nimport NumberView from '../views/NumberView.js';\nimport RangeView from '../views/RangeView.js';\n\nexport default class Range extends ValueController {\n constructor(object, property, options) {\n super(object, property, 'muigui-range');\n this.add(new RangeView(this, options));\n this.add(new NumberView(this, options));\n }\n}\n","import { createElem } from '../libs/elem.js';\nimport { identity } from '../libs/conversions.js';\nimport EditView from './EditView.js';\nimport { copyExistingProperties } from '../libs/utils.js';\n\nexport default class TextView extends EditView {\n #to;\n #from;\n #skipUpdate;\n #options = {\n converters: identity,\n };\n\n constructor(setter, options) {\n const setValue = setter.setValue.bind(setter);\n const setFinalValue = setter.setFinalValue.bind(setter);\n super(createElem('input', {\n type: 'text',\n onInput: () => {\n this.#handleInput(setValue, true);\n },\n onChange: () => {\n this.#handleInput(setFinalValue, false);\n },\n }));\n this.setOptions(options);\n }\n #handleInput(setFn, skipUpdate) {\n const [valid, newV] = this.#from(this.domElement.value);\n if (valid) {\n this.#skipUpdate = skipUpdate;\n setFn(newV);\n }\n this.domElement.style.color = valid ? '' : 'var(--invalid-color)';\n\n }\n updateDisplay(v) {\n if (!this.#skipUpdate) {\n this.domElement.value = this.#to(v);\n this.domElement.style.color = '';\n }\n this.#skipUpdate = false;\n }\n setOptions(options) {\n copyExistingProperties(this.#options, options);\n const {\n converters: {to, from},\n } = this.#options;\n this.#to = to;\n this.#from = from;\n return this;\n }\n}\n","import TextView from '../views/TextView.js';\nimport ValueController from './ValueController.js';\n\nexport default class Text extends ValueController {\n constructor(object, property) {\n super(object, property, 'muigui-text');\n this.add(new TextView(this));\n this.updateDisplay();\n }\n}","const clamp = (v, min, max) => Math.max(min, Math.min(max, v));\nconst lerp = (a, b, t) => a + (b - a) * t;\nconst fract = v => v >= 0 ? v % 1 : 1 - (v % 1);\n\nconst f0 = v => +v.toFixed(0); // converts to string (eg 1.2 => \"1\"), then converts back to number (eg, \"1.200\" => 1.2)\nconst f3 = v => +v.toFixed(3); // converts to string (eg 1.2 => \"1.200\"), then converts back to number (eg, \"1.200\" => 1.2)\n\nconst hexToUint32RGB = v => (parseInt(v.substring(1, 3), 16) << 16) |\n (parseInt(v.substring(3, 5), 16) << 8 ) |\n (parseInt(v.substring(5, 7), 16) );\nconst uint32RGBToHex = v => `#${(Math.round(v)).toString(16).padStart(6, '0')}`;\nconst hexToUint32RGBA = v => (parseInt(v.substring(1, 3), 16) * 2 ** 24) +\n (parseInt(v.substring(3, 5), 16) * 2 ** 16) +\n (parseInt(v.substring(5, 7), 16) * 2 ** 8) +\n (parseInt(v.substring(7, 9), 16) );\nconst uint32RGBAToHex = v => `#${(Math.round(v)).toString(16).padStart(8, '0')}`;\n\nexport const hexToUint8RGB = v => [\n parseInt(v.substring(1, 3), 16),\n parseInt(v.substring(3, 5), 16),\n parseInt(v.substring(5, 7), 16),\n];\nexport const uint8RGBToHex = v => `#${Array.from(v).map(v => v.toString(16).padStart(2, '0')).join('')}`;\n\nexport const hexToUint8RGBA = v => [\n parseInt(v.substring(1, 3), 16),\n parseInt(v.substring(3, 5), 16),\n parseInt(v.substring(5, 7), 16),\n parseInt(v.substring(7, 9), 16),\n];\nexport const uint8RGBAToHex = v => `#${Array.from(v).map(v => v.toString(16).padStart(2, '0')).join('')}`;\n\nexport const hexToFloatRGB = v => hexToUint8RGB(v).map(v => f3(v / 255));\nexport const floatRGBToHex = v => uint8RGBToHex(Array.from(v).map(v => Math.round(clamp(v * 255, 0, 255))));\n\nexport const hexToFloatRGBA = v => hexToUint8RGBA(v).map(v => f3(v / 255));\nexport const floatRGBAToHex = v => uint8RGBAToHex(Array.from(v).map(v => Math.round(clamp(v * 255, 0, 255))));\n\nconst scaleAndClamp = v => clamp(Math.round(v * 255), 0, 255).toString(16).padStart(2, '0');\n\nconst hexToObjectRGB = v => ({\n r: parseInt(v.substring(1, 3), 16) / 255,\n g: parseInt(v.substring(3, 5), 16) / 255,\n b: parseInt(v.substring(5, 7), 16) / 255,\n});\nconst objectRGBToHex = v => `#${scaleAndClamp(v.r)}${scaleAndClamp(v.g)}${scaleAndClamp(v.b)}`;\nconst hexToObjectRGBA = v => ({\n r: parseInt(v.substring(1, 3), 16) / 255,\n g: parseInt(v.substring(3, 5), 16) / 255,\n b: parseInt(v.substring(5, 7), 16) / 255,\n a: parseInt(v.substring(7, 9), 16) / 255,\n});\nconst objectRGBAToHex = v => `#${scaleAndClamp(v.r)}${scaleAndClamp(v.g)}${scaleAndClamp(v.b)}${scaleAndClamp(v.a)}`;\n\nconst hexToCssRGB = v => `rgb(${hexToUint8RGB(v).join(', ')})`;\nconst cssRGBRegex = /^\\s*rgb\\(\\s*(\\d+)\\s*,\\s*(\\d+)\\s*,\\s*(\\d+)\\s*\\)\\s*$/;\nconst cssRGBToHex = v => {\n const m = cssRGBRegex.exec(v);\n return uint8RGBToHex([m[1], m[2], m[3]].map(v => parseInt(v)));\n};\nconst hexToCssRGBA = v => `rgba(${hexToUint8RGBA(v).map((v, i) => i === 3 ? v / 255 : v).join(', ')})`;\nconst cssRGBARegex = /^\\s*rgba\\(\\s*(\\d+)\\s*,\\s*(\\d+)\\s*,\\s*(\\d+)\\s*,\\s*(\\d+\\.\\d+|\\d+)\\s*\\)\\s*$/;\nconst cssRGBAToHex = v => {\n const m = cssRGBARegex.exec(v);\n return uint8RGBAToHex([m[1], m[2], m[3], m[4]].map((v, i) => i === 3 ? (parseFloat(v) * 255 | 0) : parseInt(v)));\n};\n\nconst hexToCssHSL = v => {\n const hsl = rgbUint8ToHsl(hexToUint8RGB(v)).map(v => f0(v));\n return `hsl(${hsl[0]}, ${hsl[1]}%, ${hsl[2]}%)`;\n};\nconst hexToCssHSLA = v => {\n const hsla = rgbaUint8ToHsla(hexToUint8RGBA(v)).map((v, i) => i === 3 ? f3(v) : f0(v));\n return `hsl(${hsla[0]} ${hsla[1]}% ${hsla[2]}% / ${hsla[3]})`;\n};\nconst cssHSLRegex = /^\\s*hsl\\(\\s*(\\d+)(?:deg|)\\s*(?:,|)\\s*(\\d+)%\\s*(?:,|)\\s*(\\d+)%\\s*\\)\\s*$/;\nconst cssHSLARegex = /^\\s*hsl\\(\\s*(\\d+)(?:deg|)\\s*(?:,|)\\s*(\\d+)%\\s*(?:,|)\\s*(\\d+)%\\s*\\/\\s*(\\d+\\.\\d+|\\d+)\\s*\\)\\s*$/;\n\nconst hex3DigitTo6Digit = v => `${v[0]}${v[0]}${v[1]}${v[1]}${v[2]}${v[2]}`;\nconst cssHSLToHex = v => {\n const m = cssHSLRegex.exec(v);\n const rgb = hslToRgbUint8([m[1], m[2], m[3]].map(v => parseFloat(v)));\n return uint8RGBToHex(rgb);\n};\nconst cssHSLAToHex = v => {\n const m = cssHSLARegex.exec(v);\n const rgba = hslaToRgbaUint8([m[1], m[2], m[3], m[4]].map(v => parseFloat(v)));\n return uint8RGBAToHex(rgba);\n};\n\nconst euclideanModulo = (v, n) => ((v % n) + n) % n;\n\nexport function hslToRgbUint8([h, s, l]) {\n h = euclideanModulo(h, 360);\n s = clamp(s / 100, 0, 1);\n l = clamp(l / 100, 0, 1);\n\n const a = s * Math.min(l, 1 - l);\n\n function f(n) {\n const k = (n + h / 30) % 12;\n return l - a * Math.max(-1, Math.min(k - 3, 9 - k, 1));\n }\n\n return [f(0), f(8), f(4)].map(v => Math.round(v * 255));\n}\n\nexport function hslaToRgbaUint8([h, s, l, a]) {\n const rgb = hslToRgbUint8([h, s, l]);\n return [...rgb, a * 255 | 0];\n}\n\nexport function rgbFloatToHsl01([r, g, b]) {\n const max = Math.max(r, g, b);\n const min = Math.min(r, g, b);\n const l = (min + max) * 0.5;\n const d = max - min;\n let h = 0;\n let s = 0;\n\n if (d !== 0) {\n s = (l === 0 || l === 1)\n ? 0\n : (max - l) / Math.min(l, 1 - l);\n\n switch (max) {\n case r: h = (g - b) / d + (g < b ? 6 : 0); break;\n case g: h = (b - r) / d + 2; break;\n case b: h = (r - g) / d + 4;\n }\n }\n\n return [h / 6, s, l];\n}\n\nexport function rgbaFloatToHsla01([r, g, b, a]) {\n const hsl = rgbFloatToHsl01([r, g, b]);\n return [...hsl, a];\n}\n\nexport const rgbUint8ToHsl = (rgb) => {\n const [h, s, l] = rgbFloatToHsl01(rgb.map(v => v / 255));\n return [h * 360, s * 100, l * 100];\n};\n\nexport const rgbaUint8ToHsla = (rgba) => {\n const [h, s, l, a] = rgbaFloatToHsla01(rgba.map(v => v / 255));\n return [h * 360, s * 100, l * 100, a];\n};\n\nexport function hsv01ToRGBFloat([hue, sat, val]) {\n sat = clamp(sat, 0, 1);\n val = clamp(val, 0, 1);\n return [hue, hue + 2 / 3, hue + 1 / 3].map(\n v => lerp(1, clamp(Math.abs(fract(v) * 6 - 3.0) - 1, 0, 1), sat) * val\n );\n}\n\nexport function hsva01ToRGBAFloat([hue, sat, val, alpha]) {\n const rgb = hsv01ToRGBFloat([hue, sat, val]);\n return [...rgb, alpha];\n}\n\nconst round3 = v => Math.round(v * 1000) / 1000;\n\nexport function rgbFloatToHSV01([r, g, b]) {\n const p = b > g\n ? [b, g, -1, 2 / 3]\n : [g, b, 0, -1 / 3];\n const q = p[0] > r\n ? [p[0], p[1], p[3], r]\n : [r, p[1], p[2], p[0]];\n const d = q[0] - Math.min(q[3], q[1]);\n return [\n Math.abs(q[2] + (q[3] - q[1]) / (6 * d + Number.EPSILON)),\n d / (q[0] + Number.EPSILON),\n q[0],\n ].map(round3);\n}\n\nexport function rgbaFloatToHSVA01([r, g, b, a]) {\n const hsv = rgbFloatToHSV01([r, g, b]);\n return [...hsv, a];\n}\n\n// window.hsv01ToRGBFloat = hsv01ToRGBFloat;\n// window.rgbFloatToHSV01 = rgbFloatToHSV01;\n\n// Yea, meh!\nexport const hasAlpha = format => format.endsWith('a') || format.startsWith('hex8');\n\nconst cssStringFormats = [\n { re: /^#(?:[0-9a-f]){6}$/i, format: 'hex6' },\n { re: /^(?:[0-9a-f]){6}$/i, format: 'hex6-no-hash' },\n { re: /^#(?:[0-9a-f]){8}$/i, format: 'hex8' },\n { re: /^(?:[0-9a-f]){8}$/i, format: 'hex8-no-hash' },\n { re: /^#(?:[0-9a-f]){3}$/i, format: 'hex3' },\n { re: /^(?:[0-9a-f]){3}$/i, format: 'hex3-no-hash' },\n { re: cssRGBRegex, format: 'css-rgb' },\n { re: cssHSLRegex, format: 'css-hsl' },\n { re: cssRGBARegex, format: 'css-rgba' },\n { re: cssHSLARegex, format: 'css-hsla' },\n];\n\nfunction guessStringColorFormat(v) {\n for (const formatInfo of cssStringFormats) {\n if (formatInfo.re.test(v)) {\n return formatInfo;\n }\n }\n return undefined;\n}\n\nexport function guessFormat(v) {\n switch (typeof v) {\n case 'number':\n console.warn('can not reliably guess format based on a number. You should pass in a format like {format: \"uint32-rgb\"} or {format: \"uint32-rgb\"}');\n return v <= 0xFFFFFF ? 'uint32-rgb' : 'uint32-rgba';\n case 'string': {\n const formatInfo = guessStringColorFormat(v.trim());\n if (formatInfo) {\n return formatInfo.format;\n }\n break;\n }\n case 'object':\n if (v instanceof Uint8Array || v instanceof Uint8ClampedArray) {\n if (v.length === 3) {\n return 'uint8-rgb';\n } else if (v.length === 4) {\n return 'uint8-rgba';\n }\n } else if (v instanceof Float32Array) {\n if (v.length === 3) {\n return 'float-rgb';\n } else if (v.length === 4) {\n return 'float-rgba';\n }\n } else if (Array.isArray(v)) {\n if (v.length === 3) {\n return 'float-rgb';\n } else if (v.length === 4) {\n return 'float-rgba';\n }\n } else {\n if ('r' in v && 'g' in v && 'b' in v) {\n if ('a' in v) {\n return 'object-rgba';\n } else {\n return 'object-rgb';\n }\n }\n }\n }\n throw new Error(`unknown color format: ${v}`);\n}\n\nfunction fixHex6(v) {\n return v.trim(v);\n //const formatInfo = guessStringColorFormat(v.trim());\n //const fix = formatInfo ? formatInfo.fix : v => v;\n //return fix(v.trim());\n}\n\nfunction fixHex8(v) {\n return v.trim(v);\n //const formatInfo = guessStringColorFormat(v.trim());\n //const fix = formatInfo ? formatInfo.fix : v => v;\n //return fix(v.trim());\n}\n\nfunction hex6ToHex3(hex6) {\n return (hex6[1] === hex6[2] &&\n hex6[3] === hex6[4] &&\n hex6[5] === hex6[6])\n ? `#${hex6[1]}${hex6[3]}${hex6[5]}`\n : hex6;\n}\n\nconst hex3RE = /^(#|)([0-9a-f]{3})$/i;\nfunction hex3ToHex6(hex3) {\n const m = hex3RE.exec(hex3);\n if (m) {\n const [, , m2] = m;\n return `#${hex3DigitTo6Digit(m2)}`;\n }\n return hex3;\n}\n\nfunction fixHex3(v) {\n return hex6ToHex3(fixHex6(v));\n}\n\nconst strToRGBObject = (s) => {\n try {\n const json = s.replace(/([a-z])/g, '\"$1\"');\n const rgb = JSON.parse(json);\n if (Number.isNaN(rgb.r) || Number.isNaN(rgb.g) || Number.isNaN(rgb.b)) {\n throw new Error('not {r, g, b}');\n }\n return [true, rgb];\n } catch (e) {\n return [false];\n }\n};\n\nconst strToRGBAObject = (s) => {\n try {\n const json = s.replace(/([a-z])/g, '\"$1\"');\n const rgba = JSON.parse(json);\n if (Number.isNaN(rgba.r) || Number.isNaN(rgba.g) || Number.isNaN(rgba.b) || Number.isNaN(rgba.a)) {\n throw new Error('not {r, g, b, a}');\n }\n return [true, rgba];\n } catch (e) {\n return [false];\n }\n};\n\nconst strToCssRGB = s => {\n const m = cssRGBRegex.exec(s);\n if (!m) {\n return [false];\n }\n const v = [m[1], m[2], m[3]].map(v => parseInt(v));\n const outOfRange = v.find(v => v > 255);\n return [!outOfRange, `rgb(${v.join(', ')})`];\n};\n\nconst strToCssRGBA = s => {\n const m = cssRGBARegex.exec(s);\n if (!m) {\n return [false];\n }\n const v = [m[1], m[2], m[3], m[4]].map((v, i) => i === 3 ? parseFloat(v) : parseInt(v));\n const outOfRange = v.find(v => v > 255);\n return [!outOfRange, `rgba(${v.join(', ')})`];\n};\n\nconst strToCssHSL = s => {\n const m = cssHSLRegex.exec(s);\n if (!m) {\n return [false];\n }\n const v = [m[1], m[2], m[3]].map(v => parseFloat(v));\n const outOfRange = v.find(v => Number.isNaN(v));\n return [!outOfRange, `hsl(${v[0]}, ${v[1]}%, ${v[2]}%)`];\n};\n\nconst strToCssHSLA = s => {\n const m = cssHSLARegex.exec(s);\n if (!m) {\n return [false];\n }\n const v = [m[1], m[2], m[3], m[4]].map(v => parseFloat(v));\n const outOfRange = v.find(v => Number.isNaN(v));\n return [!outOfRange, `hsl(${v[0]} ${v[1]}% ${v[2]}% / ${v[3]})`];\n};\n\nconst rgbObjectToStr = rgb => {\n return `{r:${f3(rgb.r)}, g:${f3(rgb.g)}, b:${f3(rgb.b)}}`;\n};\nconst rgbaObjectToStr = rgba => {\n return `{r:${f3(rgba.r)}, g:${f3(rgba.g)}, b:${f3(rgba.b)}}, a:${f3(rgba.a)}}`;\n};\n\nconst strTo3IntsRE = /^\\s*(\\d+)\\s*,\\s*(\\d+)\\s*,\\s*(\\d+)\\s*$/;\nconst strTo3Ints = s => {\n const m = strTo3IntsRE.exec(s);\n if (!m) {\n return [false];\n }\n const v = [m[1], m[2], m[3]].map(v => parseInt(v));\n const outOfRange = v.find(v => v > 255);\n return [!outOfRange, v];\n};\n\nconst strTo4IntsRE = /^\\s*(\\d+)\\s*,\\s*(\\d+)\\s*,\\s*(\\d+)\\s*$/;\nconst strTo4Ints = s => {\n const m = strTo4IntsRE.exec(s);\n if (!m) {\n return [false];\n }\n const v = [m[1], m[2], m[3], m[4]].map(v => parseInt(v));\n const outOfRange = v.find(v => v > 255);\n return [!outOfRange, v];\n};\n\nconst strTo3Floats = s => {\n const numbers = s.split(',').map(s => s.trim());\n const v = numbers.map(v => parseFloat(v));\n if (v.length !== 3) {\n return [false];\n }\n // Note: using isNaN not Number.isNaN\n const badNdx = numbers.findIndex(v => isNaN(v));\n return [badNdx < 0, v.map(v => f3(v))];\n};\n\nconst strTo4Floats = s => {\n const numbers = s.split(',').map(s => s.trim());\n const v = numbers.map(v => parseFloat(v));\n if (v.length !== 4) {\n return [false];\n }\n // Note: using isNaN not Number.isNaN\n const badNdx = numbers.findIndex(v => isNaN(v));\n return [badNdx < 0, v.map(v => f3(v))];\n};\n\nconst strToUint32RGBRegex = /^\\s*(?:0x){0,1}([0-9a-z]{1,6})\\s*$/i;\nconst strToUint32RGB = s => {\n const m = strToUint32RGBRegex.exec(s);\n if (!m) {\n return [false];\n }\n return [true, parseInt(m[1], 16)];\n};\n\nconst strToUint32RGBARegex = /^\\s*(?:0x){0,1}([0-9a-z]{1,8})\\s*$/i;\nconst strToUint32RGBA = s => {\n const m = strToUint32RGBARegex.exec(s);\n if (!m) {\n return [false];\n }\n return [true, parseInt(m[1], 16)];\n};\n\nconst hex6RE = /^\\s*#[a-f0-9]{6}\\s*$|^\\s*#[a-f0-9]{3}\\s*$/i;\nconst hexNoHash6RE = /^\\s*[a-f0-9]{6}\\s*$/i;\nconst hex8RE = /^\\s*#[a-f0-9]{8}\\s*$/i;\nconst hexNoHash8RE = /^\\s*[a-f0-9]{8}\\s*$/i;\n\n// For each format converter\n//\n// fromHex/toHex convert from/to '#RRGGBB'\n//\n// fromHex converts from the string '#RRBBGG' to the format\n// (eg: for uint32-rgb, '#123456' becomes 0x123456)\n//\n// toHex converts from the format to '#RRGGBB'\n// (eg: for uint8-rgb, [16, 33, 50] becomes '#102132')\n//\n//\n// fromStr/toStr convert from/to what's in the input[type=text] element\n//\n// toStr converts from the format to its string representation\n// (eg, for object-rgb, {r: 1, g: 0.5, b:0} becomes \"{r: 1, g: 0.5, b:0}\")\n// ^object ^string\n//\n// fromStr converts its string representation to its format\n// (eg, for object-rgb) \"{r: 1, g: 0.5, b:0}\" becomes {r: 1, g: 0.5, b:0})\n// ^string ^object\n// fromString returns an array which is [valid, v]\n// where valid is true if the string was a valid and v is the converted\n// format if v is true.\n//\n// Note: toStr should convert to \"ideal\" form (whatever that is).\n// (eg, for css-rgb\n// \"{ r: 0.10000, g: 001, b: 0}\" becomes \"{r: 0.1, g: 1, b: 0}\"\n// notice that css-rgb is a string to a string\n// )\nexport const colorFormatConverters = {\n 'hex6': {\n color: {\n from: v => [true, v],\n to: fixHex6,\n },\n text: {\n from: v => [hex6RE.test(v), v.trim()],\n to: v => v,\n },\n },\n 'hex8': {\n color: {\n from: v => [true, v],\n to: fixHex8,\n },\n text: {\n from: v => [hex8RE.test(v), v.trim()],\n to: v => v,\n },\n },\n 'hex3': {\n color: {\n from: v => [true, fixHex3(v)],\n to: hex3ToHex6,\n },\n text: {\n from: v => [hex6RE.test(v), hex6ToHex3(v.trim())],\n to: v => v,\n },\n },\n 'hex6-no-hash': {\n color: {\n from: v => [true, v.substring(1)],\n to: v => `#${fixHex6(v)}`,\n },\n text: {\n from: v => [hexNoHash6RE.test(v), v.trim()],\n to: v => v,\n },\n },\n 'hex8-no-hash': {\n color: {\n from: v => [true, v.substring(1)],\n to: v => `#${fixHex8(v)}`,\n },\n text: {\n from: v => [hexNoHash8RE.test(v), v.trim()],\n to: v => v,\n },\n },\n 'hex3-no-hash': {\n color: {\n from: v => [true, fixHex3(v).substring(1)],\n to: hex3ToHex6,\n },\n text: {\n from: v => [hexNoHash6RE.test(v), hex6ToHex3(v.trim())],\n to: v => v,\n },\n },\n 'uint32-rgb': {\n color: {\n from: v => [true, hexToUint32RGB(v)],\n to: uint32RGBToHex,\n },\n text: {\n from: v => strToUint32RGB(v),\n to: v => `0x${v.toString(16).padStart(6, '0')}`,\n },\n },\n 'uint32-rgba': {\n color: {\n from: v => [true, hexToUint32RGBA(v)],\n to: uint32RGBAToHex,\n },\n text: {\n from: v => strToUint32RGBA(v),\n to: v => `0x${v.toString(16).padStart(8, '0')}`,\n },\n },\n 'uint8-rgb': {\n color: {\n from: v => [true, hexToUint8RGB(v)],\n to: uint8RGBToHex,\n },\n text: {\n from: strTo3Ints,\n to: v => v.join(', '),\n },\n },\n 'uint8-rgba': {\n color: {\n from: v => [true, hexToUint8RGBA(v)],\n to: uint8RGBAToHex,\n },\n text: {\n from: strTo4Ints,\n to: v => v.join(', '),\n },\n },\n 'float-rgb': {\n color: {\n from: v => [true, hexToFloatRGB(v)],\n to: floatRGBToHex,\n },\n text: {\n from: strTo3Floats,\n // need Array.from because map of Float32Array makes a Float32Array\n to: v => Array.from(v).map(v => f3(v)).join(', '),\n },\n },\n 'float-rgba': {\n color: {\n from: v => [true, hexToFloatRGBA(v)],\n to: floatRGBAToHex,\n },\n text: {\n from: strTo4Floats,\n // need Array.from because map of Float32Array makes a Float32Array\n to: v => Array.from(v).map(v => f3(v)).join(', '),\n },\n },\n 'float-hsv': {\n color: {\n from: v => [true, rgbFloatToHSV01(hexToFloatRGB(v))],\n to: v => hsv01ToRGBFloat(floatRGBToHex(v)),\n },\n text: {\n from: strTo3Floats,\n // need Array.from because map of Float32Array makes a Float32Array\n to: v => Array.from(v).map(v => f3(v)).join(', '),\n },\n },\n 'float-hsva': {\n color: {\n from: v => [true, rgbaFloatToHSVA01(hexToFloatRGB(v))],\n to: v => hsva01ToRGBAFloat(floatRGBToHex(v)),\n },\n text: {\n from: strTo4Floats,\n // need Array.from because map of Float32Array makes a Float32Array\n to: v => Array.from(v).map(v => f3(v)).join(', '),\n },\n },\n //'float-hsl': {\n // color: {\n // from: v => [true, rgbFloatToHsl01(hexToFloatRGB(v))],\n // to: v => hsl01ToRGBFloat(floatRGBToHex(v)),\n // },\n // text: {\n // from: strTo3Floats,\n // // need Array.from because map of Float32Array makes a Float32Array\n // to: v => Array.from(v).map(v => f3(v)).join(', '),\n // },\n //},\n //'float-hsla': {\n // color: {\n // from: v => [true, hexToFloatRGBA(v)],\n // to: floatRGBAToHex,\n // },\n // text: {\n // from: strTo4Floats,\n // // need Array.from because map of Float32Array makes a Float32Array\n // to: v => Array.from(v).map(v => f3(v)).join(', '),\n // },\n //},\n 'object-rgb': {\n color: {\n from: v => [true, hexToObjectRGB(v)],\n to: objectRGBToHex,\n },\n text: {\n from: strToRGBObject,\n to: rgbObjectToStr,\n },\n },\n 'object-rgba': {\n color: {\n from: v => [true, hexToObjectRGBA(v)],\n to: objectRGBAToHex,\n },\n text: {\n from: strToRGBAObject,\n to: rgbaObjectToStr,\n },\n },\n 'css-rgb': {\n color: {\n from: v => [true, hexToCssRGB(v)],\n to: cssRGBToHex,\n },\n text: {\n from: strToCssRGB,\n to: v => strToCssRGB(v)[1],\n },\n },\n 'css-rgba': {\n color: {\n from: v => [true, hexToCssRGBA(v)],\n to: cssRGBAToHex,\n },\n text: {\n from: strToCssRGBA,\n to: v => strToCssRGBA(v)[1],\n },\n },\n 'css-hsl': {\n color: {\n from: v => [true, hexToCssHSL(v)],\n to: cssHSLToHex,\n },\n text: {\n from: strToCssHSL,\n to: v => strToCssHSL(v)[1],\n },\n },\n 'css-hsla': {\n color: {\n from: v => [true, hexToCssHSLA(v)],\n to: cssHSLAToHex,\n },\n text: {\n from: strToCssHSLA,\n to: v => strToCssHSLA(v)[1],\n },\n },\n};","import { createElem } from '../libs/elem.js';\nimport View from './View.js';\n\nexport default class ElementView extends View {\n constructor(tag, className) {\n super(createElem(tag, {className}));\n }\n}","import ElementView from '../views/ElementView.js';\nimport LabelController from './LabelController.js';\n\n// TODO: remove this? Should just be user side\nexport default class Canvas extends LabelController {\n #canvasElem;\n\n constructor(name) {\n super('muigui-canvas', name);\n this.#canvasElem = this.add(\n new ElementView('canvas', 'muigui-canvas'),\n ).domElement;\n }\n get canvas() {\n return this.#canvasElem;\n }\n}","import { createElem } from '../libs/elem.js';\nimport { identity } from '../libs/conversions.js';\nimport EditView from './EditView.js';\nimport { copyExistingProperties } from '../libs/utils.js';\n\nexport default class ColorView extends EditView {\n #to;\n #from;\n #colorElem;\n #skipUpdate;\n #options = {\n converters: identity,\n };\n\n constructor(setter, options) {\n const colorElem = createElem('input', {\n type: 'color',\n onInput: () => {\n const [valid, newV] = this.#from(colorElem.value);\n if (valid) {\n this.#skipUpdate = true;\n setter.setValue(newV);\n }\n },\n onChange: () => {\n const [valid, newV] = this.#from(colorElem.value);\n if (valid) {\n this.#skipUpdate = true;\n setter.setFinalValue(newV);\n }\n },\n });\n super(createElem('div', {}, [colorElem]));\n this.setOptions(options);\n this.#colorElem = colorElem;\n }\n updateDisplay(v) {\n if (!this.#skipUpdate) {\n this.#colorElem.value = this.#to(v);\n }\n this.#skipUpdate = false;\n }\n setOptions(options) {\n copyExistingProperties(this.#options, options);\n const {converters: {to, from}} = this.#options;\n this.#to = to;\n this.#from = from;\n return this;\n }\n}\n","import {\n colorFormatConverters,\n guessFormat,\n} from '../libs/color-utils.js';\nimport ValueController from './ValueController.js';\nimport TextView from '../views/TextView.js';\nimport ColorView from '../views/ColorView.js';\n\nexport default class Color extends ValueController {\n #colorView;\n #textView;\n\n constructor(object, property, options = {}) {\n super(object, property, 'muigui-color');\n const format = options.format || guessFormat(this.getValue());\n const {color, text} = colorFormatConverters[format];\n this.#colorView = this.add(new ColorView(this, {converters: color}));\n this.#textView = this.add(new TextView(this, {converters: text}));\n this.updateDisplay();\n }\n setOptions(options) {\n const {format} = options;\n if (format) {\n const {color, text} = colorFormatConverters[format];\n this.#colorView.setOptions({converters: color});\n this.#textView.setOptions({converters: text});\n }\n super.setOptions(options);\n return this;\n }\n}","import Controller from './Controller.js';\n\n// This feels like it should be something else like\n// gui.addController({className: 'muigui-divider')};\nexport default class Divider extends Controller {\n constructor() {\n super('muigui-divider');\n }\n}","import Controller from './Controller.js';\n\nexport default class Container extends Controller {\n #controllers;\n #childDestController;\n\n constructor(className) {\n super(className);\n this.#controllers = [];\n this.#childDestController = this;\n }\n get children() {\n return this.#controllers; // should we return a copy?\n }\n get controllers() {\n return this.#controllers.filter(c => !(c instanceof Container));\n }\n get folders() {\n return this.#controllers.filter(c => c instanceof Container);\n }\n reset(recursive = true) {\n for (const controller of this.#controllers) {\n if (!(controller instanceof Container) || recursive) {\n controller.reset(recursive);\n }\n }\n return this;\n }\n updateDisplay() {\n for (const controller of this.#controllers) {\n controller.updateDisplay();\n }\n return this;\n }\n remove(controller) {\n const ndx = this.#controllers.indexOf(controller);\n if (ndx >= 0) {\n const c = this.#controllers.splice(ndx, 1);\n const c0 = c[0];\n const elem = c0.domElement;\n elem.remove();\n c0.setParent(null);\n }\n return this;\n }\n #addControllerImpl(controller) {\n this.domElement.appendChild(controller.domElement);\n this.#controllers.push(controller);\n controller.setParent(this);\n return controller;\n }\n addController(controller) {\n return this.#childDestController.#addControllerImpl(controller);\n }\n pushContainer(container) {\n this.addController(container);\n this.#childDestController = container;\n return container;\n }\n popContainer() {\n this.#childDestController = this.#childDestController.parent;\n return this;\n }\n}\n","import { createElem } from '../libs/elem.js';\nimport Container from './Container.js';\n\nexport default class Folder extends Container {\n #labelElem;\n\n constructor(name = 'Controls', className = 'muigui-menu') {\n super(className);\n this.#labelElem = createElem('label');\n this.addElem(createElem('button', {\n type: 'button',\n onClick: () => this.toggleOpen(),\n }, [this.#labelElem]));\n this.pushContainer(new Container('muigui-open-container'));\n this.pushContainer(new Container());\n this.name(name);\n this.open();\n }\n open(open = true) {\n this.domElement.classList.toggle('muigui-closed', !open);\n this.domElement.classList.toggle('muigui-open', open);\n return this;\n }\n close() {\n return this.open(false);\n }\n name(name) {\n this.#labelElem.textContent = name;\n return this;\n }\n title(title) {\n return this.name(title);\n }\n toggleOpen() {\n this.open(!this.domElement.classList.contains('muigui-open'));\n return this;\n }\n}\n","import Controller from './Controller.js';\n\n// This feels like it should be something else like\n// gui.addDividing = new Controller()\nexport default class Label extends Controller {\n constructor(text) {\n super('muigui-label');\n this.text(text);\n }\n text(text) {\n this.domElement.textContent = text;\n return this;\n }\n}","function noop() {\n}\n\nexport function computeRelativePosition(elem, event, start) {\n const rect = elem.getBoundingClientRect();\n const x = event.clientX - rect.left;\n const y = event.clientY - rect.top;\n const nx = x / rect.width;\n const ny = y / rect.height;\n start = start || [x, y];\n const dx = x - start[0];\n const dy = y - start[1];\n const ndx = dx / rect.width;\n const ndy = dy / rect.width;\n return {x, y, nx, ny, dx, dy, ndx, ndy};\n}\n\nexport function addTouchEvents(elem, {onDown = noop, onMove = noop, onUp = noop}) {\n let start;\n const pointerMove = function (event) {\n const e = {\n type: 'move',\n ...computeRelativePosition(elem, event, start),\n };\n onMove(e);\n };\n\n const pointerUp = function (event) {\n elem.releasePointerCapture(event.pointerId);\n elem.removeEventListener('pointermove', pointerMove);\n elem.removeEventListener('pointerup', pointerUp);\n\n document.body.style.backgroundColor = '';\n\n onUp('up');\n };\n\n const pointerDown = function (event) {\n elem.addEventListener('pointermove', pointerMove);\n elem.addEventListener('pointerup', pointerUp);\n elem.setPointerCapture(event.pointerId);\n\n const rel = computeRelativePosition(elem, event);\n start = [rel.x, rel.y];\n onDown({\n type: 'down',\n ...rel,\n });\n };\n\n elem.addEventListener('pointerdown', pointerDown);\n\n return function () {\n elem.removeEventListener('pointerdown', pointerDown);\n };\n}","import { createElem, getNewId } from '../libs/elem.js';\nimport { addTouchEvents } from '../libs/touch.js';\nimport { identity } from '../libs/conversions.js';\nimport { clamp } from '../libs/utils.js';\nimport EditView from './EditView.js';\nimport {\n hexToFloatRGB,\n hexToFloatRGBA,\n hsv01ToRGBFloat,\n hsva01ToRGBAFloat,\n rgbFloatToHSV01,\n rgbaFloatToHSVA01,\n floatRGBToHex,\n floatRGBAToHex,\n rgbaFloatToHsla01,\n} from '../libs/color-utils.js';\nimport { copyExistingProperties } from '../libs/utils.js';\n\nconst svg = `\n\n\n\n`;\n\nfunction connectFillTargets(elem) {\n elem.querySelectorAll('[data-src]').forEach(srcElem => {\n const id = getNewId();\n srcElem.id = id;\n elem.querySelectorAll(`[data-target=${srcElem.dataset.src}]`).forEach(targetElem => {\n targetElem.setAttribute('fill', `url(#${id})`);\n });\n });\n return elem;\n}\n\n// Was originally going to make alpha an option. Issue is\n// hard coded conversions?\nexport default class ColorChooserView extends EditView {\n #to;\n #from;\n #satLevelElem;\n #circleElem;\n #hueUIElem;\n #hueElem;\n #hueCursorElem;\n #alphaUIElem;\n #alphaElem;\n #alphaCursorElem;\n #hsva;\n #skipHueUpdate;\n #skipSatLevelUpdate;\n #skipAlphaUpdate;\n #options = {\n converters: identity,\n alpha: false,\n };\n #convertInternalToHex;\n #convertHexToInternal;\n\n constructor(setter, options) {\n super(createElem('div', {\n innerHTML: svg,\n className: 'muigui-no-scroll',\n }));\n this.#satLevelElem = this.domElement.children[0];\n this.#hueUIElem = this.domElement.children[1];\n this.#alphaUIElem = this.domElement.children[2];\n connectFillTargets(this.#satLevelElem);\n connectFillTargets(this.#hueUIElem);\n connectFillTargets(this.#alphaUIElem);\n this.#circleElem = this.$('.muigui-color-chooser-circle');\n this.#hueElem = this.$('[data-src=muigui-color-chooser-hue]');\n this.#hueCursorElem = this.$('.muigui-color-chooser-hue-cursor');\n this.#alphaElem = this.$('[data-src=muigui-color-chooser-alpha]');\n this.#alphaCursorElem = this.$('.muigui-color-chooser-alpha-cursor');\n\n const handleSatLevelChange = (e) => {\n const s = clamp(e.nx, 0, 1);\n const v = clamp(e.ny, 0, 1);\n this.#hsva[1] = s;\n this.#hsva[2] = (1 - v);\n this.#skipHueUpdate = true;\n this.#skipAlphaUpdate = true;\n const [valid, newV] = this.#from(this.#convertInternalToHex(this.#hsva));\n if (valid) {\n setter.setValue(newV);\n }\n };\n\n const handleHueChange = (e) => {\n const h = clamp(e.nx, 0, 1);\n this.#hsva[0] = h;\n this.#skipSatLevelUpdate = true;\n this.#skipAlphaUpdate = true;\n const [valid, newV] = this.#from(this.#convertInternalToHex(this.#hsva));\n if (valid) {\n setter.setValue(newV);\n }\n };\n\n const handleAlphaChange = (e) => {\n const a = clamp(e.nx, 0, 1);\n this.#hsva[3] = a;\n this.#skipHueUpdate = true;\n this.#skipSatLevelUpdate = true;\n const [valid, newV] = this.#from(this.#convertInternalToHex(this.#hsva));\n if (valid) {\n setter.setValue(newV);\n }\n };\n\n addTouchEvents(this.#satLevelElem, {\n onDown: handleSatLevelChange,\n onMove: handleSatLevelChange,\n });\n addTouchEvents(this.#hueUIElem, {\n onDown: handleHueChange,\n onMove: handleHueChange,\n });\n addTouchEvents(this.#alphaUIElem, {\n onDown: handleAlphaChange,\n onMove: handleAlphaChange,\n });\n this.setOptions(options);\n }\n updateDisplay(newV) {\n if (!this.#hsva) {\n this.#hsva = this.#convertHexToInternal(this.#to(newV));\n }\n {\n const [h, s, v, a = 1] = this.#convertHexToInternal(this.#to(newV));\n // Don't copy the hue if it was un-computable.\n if (!this.#skipHueUpdate) {\n this.#hsva[0] = s > 0.001 && v > 0.001 ? h : this.#hsva[0];\n }\n if (!this.#skipSatLevelUpdate) {\n this.#hsva[1] = s;\n this.#hsva[2] = v;\n }\n if (!this.#skipAlphaUpdate) {\n this.#hsva[3] = a;\n }\n }\n {\n const [h, s, v, a] = this.#hsva;\n const [hue, sat, lum] = rgbaFloatToHsla01(hsva01ToRGBAFloat(this.#hsva));\n\n if (!this.#skipHueUpdate) {\n this.#hueCursorElem.setAttribute('transform', `translate(${h * 64}, 0)`);\n }\n this.#hueElem.children[0].setAttribute('stop-color', `hsl(${hue * 360} 0% 100% / ${a})`);\n this.#hueElem.children[1].setAttribute('stop-color', `hsl(${hue * 360} 100% 50% / ${a})`);\n if (!this.#skipAlphaUpdate) {\n this.#alphaCursorElem.setAttribute('transform', `translate(${a * 64}, 0)`);\n }\n this.#alphaElem.children[0].setAttribute('stop-color', `hsl(${hue * 360} ${sat * 100}% ${lum * 100}% / 0)`);\n this.#alphaElem.children[1].setAttribute('stop-color', `hsl(${hue * 360} ${sat * 100}% ${lum * 100}% / 1)`);\n\n if (!this.#skipSatLevelUpdate) {\n this.#circleElem.setAttribute('cx', `${s * 64}`);\n this.#circleElem.setAttribute('cy', `${(1 - v) * 48}`);\n }\n }\n this.#skipHueUpdate = false;\n this.#skipSatLevelUpdate = false;\n this.#skipAlphaUpdate = false;\n }\n setOptions(options) {\n copyExistingProperties(this.#options, options);\n const {converters: {to, from}, alpha} = this.#options;\n this.#alphaUIElem.style.display = alpha ? '' : 'none';\n this.#convertInternalToHex = alpha\n ? v => floatRGBAToHex(hsva01ToRGBAFloat(v))\n : v => floatRGBToHex(hsv01ToRGBFloat(v));\n this.#convertHexToInternal = alpha\n ? v => rgbaFloatToHSVA01(hexToFloatRGBA(v))\n : v => rgbFloatToHSV01(hexToFloatRGB(v));\n this.#to = to;\n this.#from = from;\n return this;\n }\n}\n","import ElementView from '../views/ElementView.js';\nimport ValueController from './ValueController.js';\nimport { copyExistingProperties } from '../libs/utils.js';\nimport { createElem } from '../libs/elem.js';\n/*\n\nholder = new TabHolder\ntab = holder.add(new Tab(\"name\"))\ntab.add(...)\n\n\npc = new PopdownController\ntop = pc.add(new Row())\ntop.add(new Button());\nvalues = topRow.add(new Div())\nbottom = pc.add(new Row());\n\n\n\npc = new PopdownController\npc.addTop\npc.addTop\n\npc.addBottom\n\n\n*/\n\nexport default class PopDownController extends ValueController {\n #top;\n #valuesView;\n #checkboxElem;\n #bottom;\n #options = {\n open: false,\n };\n\n constructor(object, property, options = {}) {\n super(object, property, 'muigui-pop-down-controller');\n /*\n [ValueView\n [[B][values]] upper row\n [[ visual ]] lower row\n ]\n */\n this.#top = this.add(new ElementView('div', 'muigui-pop-down-top'));\n// this.#top.add(new CheckboxView(makeSetter(this.#options, 'open')));\n const checkboxElem = this.#top.addElem(createElem('input', {\n type: 'checkbox',\n onChange: () => {\n this.#options.open = checkboxElem.checked;\n this.updateDisplay();\n },\n }));\n this.#checkboxElem = checkboxElem;\n this.#valuesView = this.#top.add(new ElementView('div', 'muigui-pop-down-values'));\n const container = new ElementView('div', 'muigui-pop-down-bottom muigui-open-container');\n this.#bottom = new ElementView('div');\n container.add(this.#bottom);\n this.add(container);\n this.setOptions(options);\n }\n setKnobColor(bgCssColor/*, fgCssColor*/) {\n if (this.#checkboxElem) {\n this.#checkboxElem.style = `\n --range-color: ${bgCssColor};\n --value-bg-color: ${bgCssColor};\n `;\n }\n }\n updateDisplay() {\n super.updateDisplay();\n const {open} = this.#options;\n this.domElement.children[1].classList.toggle('muigui-open', open);\n this.domElement.children[1].classList.toggle('muigui-closed', !open);\n }\n setOptions(options) {\n copyExistingProperties(this.#options, options);\n super.setOptions(options);\n this.updateDisplay();\n }\n addTop(view) {\n return this.#valuesView.add(view);\n }\n addBottom(view) {\n return this.#bottom.add(view);\n }\n}","/* eslint-disable no-underscore-dangle */\nimport {\n colorFormatConverters,\n guessFormat,\n hasAlpha,\n hexToUint8RGB,\n hslToRgbUint8,\n rgbUint8ToHsl,\n uint8RGBToHex,\n} from '../libs/color-utils.js';\nimport ColorChooserView from '../views/ColorChooserView.js';\nimport TextView from '../views/TextView.js';\nimport PopDownController from './PopDownController.js';\n\nexport default class ColorChooser extends PopDownController {\n #colorView;\n #textView;\n #to;\n\n constructor(object, property, options = {}) {\n super(object, property, 'muigui-color-chooser');\n const format = options.format || guessFormat(this.getValue());\n const {color, text} = colorFormatConverters[format];\n this.#to = color.to;\n this.#textView = new TextView(this, {converters: text, alpha: hasAlpha(format)});\n this.#colorView = new ColorChooserView(this, {converters: color, alpha: hasAlpha(format)});\n this.addTop(this.#textView);\n this.addBottom(this.#colorView);\n // WTF! FIX!\n this.___setKnobHelper = true;\n this.updateDisplay();\n }\n #setKnobHelper() {\n if (this.#to) {\n const hex6Or8 = this.#to(this.getValue());\n const alpha = hex6Or8.length === 9 ? hex6Or8.substring(7, 9) : 'FF';\n const hsl = rgbUint8ToHsl(hexToUint8RGB(hex6Or8));\n hsl[2] = (hsl[2] + 50) % 100;\n const hex = uint8RGBToHex(hslToRgbUint8(hsl));\n this.setKnobColor(`${hex6Or8.substring(0, 7)}${alpha}`, hex);\n }\n }\n updateDisplay() {\n super.updateDisplay();\n if (this.___setKnobHelper) {\n this.#setKnobHelper();\n }\n }\n setOptions(options) {\n super.setOptions(options);\n return this;\n }\n}\n","import css from './styles/muigui.css.js';\nimport {createElem} from './libs/elem.js';\nimport {createController} from './controllers/create-controller.js';\nimport {\n mapRange,\n makeRangeConverters,\n makeRangeOptions,\n makeMinMaxPair,\n} from './libs/utils.js';\nimport {\n converters\n} from './libs/conversions.js';\nimport {\n hasAlpha,\n guessFormat,\n} from './libs/color-utils.js';\nimport Canvas from './controllers/Canvas.js';\nimport Color from './controllers/Color.js';\nimport Divider from './controllers/Divider.js';\nimport Folder from './controllers/Folder.js';\nimport Label from './controllers/Label.js';\nimport Controller from './controllers/Controller.js';\nimport ColorChooser from './controllers/ColorChooser.js';\n\nimport Column from './layout/Column.js';\nimport Frame from './layout/Frame.js';\nimport Grid from './layout/Grid.js';\nimport Row from './layout/Row.js';\n\nexport {\n Column,\n Frame,\n Grid,\n Row,\n};\n\nexport class GUIFolder extends Folder {\n add(object, property, ...args) {\n const controller = object instanceof Controller\n ? object\n : createController(object, property, ...args);\n return this.addController(controller);\n }\n addCanvas(name) {\n return this.addController(new Canvas(name));\n }\n addColor(object, property, options = {}) {\n const value = object[property];\n if (hasAlpha(options.format || guessFormat(value))) {\n return this.addController(new ColorChooser(object, property, options));\n } else {\n return this.addController(new Color(object, property, options));\n }\n }\n addDivider() {\n return this.addController(new Divider());\n }\n addFolder(name) {\n return this.addController(new GUIFolder(name));\n }\n addLabel(text) {\n return this.addController(new Label(text));\n }\n addButton(name, fn) {\n const o = {fn};\n return this.add(o, 'fn').name(name);\n }\n}\n\nclass MuiguiElement extends HTMLElement {\n constructor() {\n super();\n this.shadow = this.attachShadow({mode: 'open'});\n }\n}\n\ncustomElements.define('muigui-element', MuiguiElement);\n\nconst baseStyleSheet = new CSSStyleSheet();\n//baseStyleSheet.replaceSync(css.default);\nconst userStyleSheet = new CSSStyleSheet();\n\nfunction makeStyleSheetUpdater(styleSheet) {\n let newCss;\n let newCssPromise;\n\n function updateStyle() {\n if (newCss && !newCssPromise) {\n const s = newCss;\n newCss = undefined;\n newCssPromise = styleSheet.replace(s).then(() => {\n newCssPromise = undefined;\n updateStyle();\n });\n }\n }\n\n return function updateStyleSheet(css) {\n newCss = css;\n updateStyle();\n };\n}\n\nconst updateBaseStyle = makeStyleSheetUpdater(baseStyleSheet);\nconst updateUserStyle = makeStyleSheetUpdater(userStyleSheet);\n\nfunction getTheme(name) {\n const { include, css: cssStr } = css.themes[name];\n return `${include.map(m => css[m]).join('\\n')} : css.default}\\n${cssStr || ''}`;\n}\n\nexport class GUI extends GUIFolder {\n static converters = converters;\n static mapRange = mapRange;\n static makeRangeConverters = makeRangeConverters;\n static makeRangeOptions = makeRangeOptions;\n static makeMinMaxPair = makeMinMaxPair;\n #localStyleSheet = new CSSStyleSheet();\n\n constructor(options = {}) {\n super('Controls', 'muigui-root');\n if (options instanceof HTMLElement) {\n options = {parent: options};\n }\n const {\n autoPlace = true,\n width,\n title = 'Controls',\n } = options;\n let {\n parent,\n } = options;\n\n if (width) {\n this.domElement.style.width = /^\\d+$/.test(width) ? `${width}px` : width;\n }\n if (parent === undefined && autoPlace) {\n parent = document.body;\n this.domElement.classList.add('muigui-auto-place');\n }\n if (parent) {\n const muiguiElement = createElem('muigui-element');\n muiguiElement.shadowRoot.adoptedStyleSheets = [this.#localStyleSheet, baseStyleSheet, userStyleSheet];\n muiguiElement.shadow.appendChild(this.domElement);\n parent.appendChild(muiguiElement);\n }\n if (title) {\n this.title(title);\n }\n this.#localStyleSheet.replaceSync(css.default);\n this.domElement.classList.add('muigui', 'muigui-colors');\n }\n setStyle(css) {\n this.#localStyleSheet.replace(css);\n }\n static setBaseStyles(css) {\n updateBaseStyle(css);\n }\n static getBaseStyleSheet() {\n return baseStyleSheet;\n }\n static setUserStyles(css) {\n updateUserStyle(css);\n }\n static getUserStyleSheet() {\n return userStyleSheet;\n }\n setTheme(name) {\n this.setStyle(getTheme(name));\n }\n static setTheme(name) {\n GUI.setBaseStyles(getTheme(name));\n }\n}\n\nexport default GUI;\n","import Button from './Button.js';\nimport Checkbox from './Checkbox.js';\nimport TextNumber from './TextNumber.js';\nimport Select from './Select.js';\nimport Range from './Range.js';\nimport Text from './Text.js';\n\n// const isConversion = o => typeof o.to === 'function' && typeof o.from === 'function';\n\n/**\n * possible inputs\n * add(o, p, min: number, max: number)\n * add(o, p, min: number, max: number, step: number)\n * add(o, p, array: [value])\n * add(o, p, array: [[key, value]])\n *\n * @param {*} object\n * @param {string} property\n * @param {...any} args\n * @returns {Controller}\n */\nexport function createController(object, property, ...args) {\n const [arg1] = args;\n if (Array.isArray(arg1)) {\n return new Select(object, property, {keyValues: arg1});\n }\n if (arg1 && arg1.keyValues) {\n return new Select(object, property, {keyValues: arg1.keyValues});\n }\n\n const t = typeof object[property];\n switch (t) {\n case 'number':\n if (typeof args[0] === 'number' && typeof args[1] === 'number') {\n const min = args[0];\n const max = args[1];\n const step = args[2];\n return new Range(object, property, {min, max, ...(step && {step})});\n }\n return args.length === 0\n ? new TextNumber(object, property, ...args)\n : new Range(object, property, ...args);\n case 'boolean':\n return new Checkbox(object, property, ...args);\n case 'function':\n return new Button(object, property, ...args);\n case 'string':\n return new Text(object, property, ...args);\n case 'undefined':\n throw new Error(`no property named ${property}`);\n default:\n throw new Error(`unhandled type ${t} for property ${property}`);\n }\n}","function noop() {\n}\n\nconst keyDirections = {\n ArrowLeft: [-1, 0],\n ArrowRight: [1, 0],\n ArrowUp: [0, -1],\n ArrowDown: [0, 1],\n};\n\n// This probably needs to be global\nexport function addKeyboardEvents(elem, {onDown = noop, onUp = noop}) {\n const keyDown = function (event) {\n const mult = event.shiftKey ? 10 : 1;\n const [dx, dy] = (keyDirections[event.key] || [0, 0]).map(v => v * mult);\n const fn = event.type === 'keydown' ? onDown : onUp;\n fn({\n type: event.type.substring(3),\n dx,\n dy,\n event,\n });\n };\n\n elem.addEventListener('keydown', keyDown);\n elem.addEventListener('keyup', keyDown);\n\n return function () {\n elem.removeEventListener('keydown', keyDown);\n elem.removeEventListener('keyup', keyDown);\n };\n}","export function assert(truthy, msg = '') {\n if (!truthy) {\n throw new Error(msg);\n }\n}","import { assert } from '../libs/assert.js';\n\nfunction getEllipsePointForAngle(cx, cy, rx, ry, phi, theta) {\n const m = Math.abs(rx) * Math.cos(theta);\n const n = Math.abs(ry) * Math.sin(theta);\n\n return [\n cx + Math.cos(phi) * m - Math.sin(phi) * n,\n cy + Math.sin(phi) * m + Math.cos(phi) * n,\n ];\n}\n\nfunction getEndpointParameters(cx, cy, rx, ry, phi, theta, dTheta) {\n const [x1, y1] = getEllipsePointForAngle(cx, cy, rx, ry, phi, theta);\n const [x2, y2] = getEllipsePointForAngle(cx, cy, rx, ry, phi, theta + dTheta);\n\n const fa = Math.abs(dTheta) > Math.PI ? 1 : 0;\n const fs = dTheta > 0 ? 1 : 0;\n\n return { x1, y1, x2, y2, fa, fs };\n}\n\nexport function arc(cx, cy, r, start, end) {\n assert(Math.abs(start - end) <= Math.PI * 2);\n assert(start >= -Math.PI && start <= Math.PI * 2);\n assert(start <= end);\n assert(end >= -Math.PI && end <= Math.PI * 4);\n\n const { x1, y1, x2, y2, fa, fs } = getEndpointParameters(cx, cy, r, r, 0, start, end - start);\n return Math.abs(Math.abs(start - end) - Math.PI * 2) > Number.EPSILON\n ? `M${cx} ${cy} L${x1} ${y1} A ${r} ${r} 0 ${fa} ${fs} ${x2} ${y2} L${cx} ${cy}`\n : `M${x1} ${y1} L${x1} ${y1} A ${r} ${r} 0 ${fa} ${fs} ${x2} ${y2}`;\n}\n","import { identity } from '../libs/conversions.js';\nimport { createElem } from '../libs/elem.js';\nimport { addKeyboardEvents } from '../libs/keyboard.js';\nimport { arc } from '../libs/svg.js';\nimport { addTouchEvents } from '../libs/touch.js';\nimport { createWheelHelper } from '../libs/wheel.js';\nimport { clamp, copyExistingProperties, euclideanModulo, lerp, stepify } from '../libs/utils.js';\nimport EditView from './EditView.js';\n\nconst svg = `\n\n`;\n\nconst twoPiMod = v => euclideanModulo(v + Math.PI, Math.PI * 2) - Math.PI;\n\nexport default class DirectionView extends EditView {\n #arrowElem;\n #rangeElem;\n #lastV;\n #wrap;\n #options = {\n step: 1,\n min: -180,\n max: 180,\n\n /*\n --------\n / -π/2 \\\n / | \\\n |<- -π * |\n | * 0 ->| zero is down the positive X axis\n |<- +π * |\n \\ | /\n \\ π/2 /\n --------\n */\n dirMin: -Math.PI,\n dirMax: Math.PI,\n //dirMin: Math.PI * 0.5,\n //dirMax: Math.PI * 2.5,\n //dirMin: -Math.PI * 0.75, // test 10:30 to 7:30\n //dirMax: Math.PI * 0.75,\n //dirMin: Math.PI * 0.75, // test 7:30 to 10:30\n //dirMax: -Math.PI * 0.75,\n //dirMin: -Math.PI * 0.75, // test 10:30 to 1:30\n //dirMax: -Math.PI * 0.25,\n //dirMin: Math.PI * 0.25, // test 4:30 to 7:30\n //dirMax: Math.PI * 0.75,\n //dirMin: Math.PI * 0.75, // test 4:30 to 7:30\n //dirMax: Math.PI * 0.25,\n wrap: undefined,\n converters: identity,\n };\n\n constructor(setter, options = {}) {\n const wheelHelper = createWheelHelper();\n super(createElem('div', {\n className: 'muigui-direction muigui-no-scroll',\n innerHTML: svg,\n onWheel: e => {\n e.preventDefault();\n const {min, max, step} = this.#options;\n const delta = wheelHelper(e, step);\n let tempV = this.#lastV + delta;\n if (this.#wrap) {\n tempV = euclideanModulo(tempV - min, max - min) + min;\n }\n const newV = clamp(stepify(tempV, v => v, step), min, max);\n setter.setValue(newV);\n },\n }));\n const handleTouch = (e) => {\n const {min, max, step, dirMin, dirMax} = this.#options;\n const nx = e.nx * 2 - 1;\n const ny = e.ny * 2 - 1;\n const a = Math.atan2(ny, nx);\n\n const center = (dirMin + dirMax) / 2;\n\n const centeredAngle = twoPiMod(a - center);\n const centeredStart = twoPiMod(dirMin - center);\n const diff = dirMax - dirMin;\n\n const n = clamp((centeredAngle - centeredStart) / (diff), 0, 1);\n const newV = stepify(min + (max - min) * n, v => v, step);\n setter.setValue(newV);\n };\n addTouchEvents(this.domElement, {\n onDown: handleTouch,\n onMove: handleTouch,\n });\n addKeyboardEvents(this.domElement, {\n onDown: (e) => {\n const {min, max, step} = this.#options;\n const newV = clamp(stepify(this.#lastV + e.dx * step, v => v, step), min, max);\n setter.setValue(newV);\n },\n });\n this.#arrowElem = this.$('#muigui-arrow');\n this.#rangeElem = this.$('#muigui-range');\n this.setOptions(options);\n }\n updateDisplay(v) {\n this.#lastV = v;\n const {min, max} = this.#options;\n const n = (v - min) / (max - min);\n const angle = lerp(this.#options.dirMin, this.#options.dirMax, n);\n this.#arrowElem.style.transform = `rotate(${angle}rad)`;\n }\n setOptions(options) {\n copyExistingProperties(this.#options, options);\n const {dirMin, dirMax, wrap} = this.#options;\n this.#wrap = wrap !== undefined\n ? wrap\n : Math.abs(dirMin - dirMax) >= Math.PI * 2 - Number.EPSILON;\n const [min, max] = dirMin < dirMax ? [dirMin, dirMax] : [dirMax , dirMin];\n this.#rangeElem.setAttribute('d', arc(0, 0, 28.87, min, max));\n }\n}\n","import { createElem } from '../libs/elem.js';\nimport { makeId } from '../libs/ids.js';\nimport EditView from './EditView.js';\n\nexport default class RadioGridView extends EditView {\n #values;\n\n constructor(setter, keyValues, cols = 3) {\n const values = [];\n const name = makeId();\n super(createElem('div', {}, keyValues.map(([key, value], ndx) => {\n values.push(value);\n return createElem('label', {}, [\n createElem('input', {\n type: 'radio',\n name,\n value: ndx,\n onChange: function () {\n if (this.checked) {\n setter.setFinalValue(that.#values[this.value]);\n }\n },\n }),\n createElem('button', {\n type: 'button',\n textContent: key,\n onClick: function () {\n this.previousElementSibling.click();\n },\n }),\n ]);\n })));\n // eslint-disable-next-line @typescript-eslint/no-this-alias\n const that = this;\n this.#values = values;\n this.cols(cols);\n }\n updateDisplay(v) {\n const ndx = this.#values.indexOf(v);\n for (let i = 0; i < this.domElement.children.length; ++i) {\n this.domElement.children[i].children[0].checked = i === ndx;\n }\n }\n cols(cols) {\n this.domElement.style.gridTemplateColumns = `repeat(${cols}, 1fr)`;\n }\n}\n","export function onResize(elem, callback) {\n new ResizeObserver(() => {\n callback({rect: elem.getBoundingClientRect(), elem});\n }).observe(elem);\n}\n\nexport function onResizeSVGNoScale(elem, hAnchor, vAnchor, callback) {\n onResize(elem, ({rect}) => {\n const {width, height} = rect;\n elem.setAttribute('viewBox', `-${width * hAnchor} -${height * vAnchor} ${width} ${height}`);\n callback({elem, rect});\n });\n}\n\nexport function onResizeCanvas(elem, callback) {\n onResize(elem, ({rect}) => {\n const {width, height} = rect;\n elem.width = width;\n elem.height = height;\n callback({elem, rect});\n });\n}\n","import { createElem } from '../libs/elem.js';\nimport { addKeyboardEvents } from '../libs/keyboard.js';\nimport { addTouchEvents } from '../libs/touch.js';\nimport { createWheelHelper } from '../libs/wheel.js';\nimport { onResizeSVGNoScale } from '../libs/resize-helpers.js';\nimport { clamp, copyExistingProperties, stepify } from '../libs/utils.js';\nimport EditView from './EditView.js';\n\nconst svg = `\n\n`;\n\nfunction createSVGTicks(start, end, step, min, max, height) {\n const p = [];\n if (start < min) {\n start += stepify(min - start, v => v, step);\n }\n end = Math.min(end, max);\n for (let i = start; i <= end; i += step) {\n p.push(`M${i} 0 l0 ${height}`);\n }\n return p.join(' ');\n}\n\nfunction createSVGNumbers(start, end, unitSize, unit, minusSize, min, max, labelFn) {\n const texts = [];\n if (start < min) {\n start += stepify(min - start, v => v, unitSize);\n }\n end = Math.min(end, max);\n const digits = Math.max(0, -Math.log10(unit));\n const f = v => labelFn(v.toFixed(digits));\n for (let i = start; i <= end; i += unitSize) {\n texts.push(`= 0 ? i : (i - minusSize / 2) }\" y=\"0\">${f(i / unitSize * unit)}`);\n }\n return texts.join('\\n');\n}\n\nfunction computeSizeOfMinus(elem) {\n const oldHTML = elem.innerHTML;\n elem.innerHTML = '- ';\n const text = elem.querySelector('text');\n const size = text.getComputedTextLength();\n elem.innerHTML = oldHTML;\n return size;\n}\n\nexport default class SliderView extends EditView {\n #svgElem;\n #originElem;\n #ticksElem;\n #thicksElem;\n #numbersElem;\n #leftGradElem;\n #rightGradElem;\n #width;\n #height;\n #lastV;\n #minusSize;\n #options = {\n min: -100,\n max: 100,\n step: 1,\n unit: 10,\n unitSize: 10,\n ticksPerUnit: 5,\n labelFn: v => v,\n tickHeight: 1,\n limits: true,\n thicksColor: undefined,\n orientation: undefined,\n };\n\n constructor(setter, options) {\n const wheelHelper = createWheelHelper();\n super(createElem('div', {\n innerHTML: svg,\n className: 'muigui-no-v-scroll',\n onWheel: e => {\n e.preventDefault();\n const {min, max, step} = this.#options;\n const delta = wheelHelper(e, step);\n const newV = clamp(stepify(this.#lastV + delta, v => v, step), min, max);\n setter.setValue(newV);\n },\n }));\n this.#svgElem = this.$('svg');\n this.#originElem = this.$('#muigui-origin');\n this.#ticksElem = this.$('#muigui-ticks');\n this.#thicksElem = this.$('#muigui-thicks');\n this.#numbersElem = this.$('#muigui-numbers');\n this.#leftGradElem = this.$('#muigui-left-grad');\n this.#rightGradElem = this.$('#muigui-right-grad');\n this.setOptions(options);\n let startV;\n addTouchEvents(this.domElement, {\n onDown: () => {\n startV = this.#lastV;\n },\n onMove: (e) => {\n const {min, max, unitSize, unit, step} = this.#options;\n const newV = clamp(stepify(startV - e.dx / unitSize * unit, v => v, step), min, max);\n setter.setValue(newV);\n },\n });\n addKeyboardEvents(this.domElement, {\n onDown: (e) => {\n const {min, max, step} = this.#options;\n const newV = clamp(stepify(this.#lastV + e.dx * step, v => v, step), min, max);\n setter.setValue(newV);\n },\n });\n onResizeSVGNoScale(this.#svgElem, 0.5, 0, ({rect: {width}}) => {\n this.#leftGradElem.setAttribute('x', -width / 2);\n this.#rightGradElem.setAttribute('x', width / 2 - 20);\n this.#minusSize = computeSizeOfMinus(this.#numbersElem);\n this.#width = width;\n this.#updateSlider();\n });\n }\n // |--------V--------|\n // . . | . . . | . . . |\n //\n #updateSlider() {\n // There's no size if ResizeObserver has not fired yet.\n if (!this.#width || this.#lastV === undefined) {\n return;\n }\n const {\n labelFn,\n limits,\n min,\n max,\n orientation,\n tickHeight,\n ticksPerUnit,\n unit,\n unitSize,\n thicksColor,\n } = this.#options;\n const unitsAcross = Math.ceil(this.#width / unitSize);\n const center = this.#lastV;\n const centerUnitSpace = center / unit;\n const startUnitSpace = Math.round(centerUnitSpace - unitsAcross);\n const endUnitSpace = startUnitSpace + unitsAcross * 2;\n const start = startUnitSpace * unitSize;\n const end = endUnitSpace * unitSize;\n const minUnitSpace = limits ? min * unitSize / unit : start;\n const maxUnitSpace = limits ? max * unitSize / unit : end;\n const height = labelFn(1) === '' ? 10 : 5;\n if (ticksPerUnit > 1) {\n this.#ticksElem.setAttribute('d', createSVGTicks(start, end, unitSize / ticksPerUnit, minUnitSpace, maxUnitSpace, height * tickHeight));\n }\n this.#thicksElem.style.stroke = thicksColor; //setAttribute('stroke', thicksColor);\n this.#thicksElem.setAttribute('d', createSVGTicks(start, end, unitSize, minUnitSpace, maxUnitSpace, height));\n this.#numbersElem.innerHTML = createSVGNumbers(start, end, unitSize, unit, this.#minusSize, minUnitSpace, maxUnitSpace, labelFn);\n this.#originElem.setAttribute('transform', `translate(${-this.#lastV * unitSize / unit} 0)`);\n this.#svgElem.classList.toggle('muigui-slider-up', orientation === 'up');\n }\n updateDisplay(v) {\n this.#lastV = v;\n this.#updateSlider();\n }\n setOptions(options) {\n copyExistingProperties(this.#options, options);\n return this;\n }\n}\n","import { createElem } from '../libs/elem.js';\nimport { addTouchEvents } from '../libs/touch.js';\nimport { onResizeSVGNoScale } from '../libs/resize-helpers.js';\nimport EditView from './EditView.js';\n\nconst svg = `\n\n`;\n\nexport default class Vec2View extends EditView {\n #svgElem;\n #arrowElem;\n #circleElem;\n #lastV = [];\n\n constructor(setter) {\n super(createElem('div', {\n innerHTML: svg,\n className: 'muigui-no-scroll',\n }));\n const onTouch = (e) => {\n const {width, height} = this.#svgElem.getBoundingClientRect();\n const nx = e.nx * 2 - 1;\n const ny = e.ny * 2 - 1;\n setter.setValue([nx * width * 0.5, ny * height * 0.5]);\n };\n addTouchEvents(this.domElement, {\n onDown: onTouch,\n onMove: onTouch,\n });\n this.#svgElem = this.$('svg');\n this.#arrowElem = this.$('#muigui-arrow');\n this.#circleElem = this.$('#muigui-circle');\n onResizeSVGNoScale(this.#svgElem, 0.5, 0.5, () => this.#updateDisplayImpl);\n }\n #updateDisplayImpl() {\n const [x, y] = this.#lastV;\n this.#arrowElem.setAttribute('d', `M0,0L${x},${y}`);\n this.#circleElem.setAttribute('transform', `translate(${x}, ${y})`);\n }\n updateDisplay(v) {\n this.#lastV[0] = v[0];\n this.#lastV[1] = v[1];\n this.#updateDisplayImpl();\n }\n}\n","import GUI from './muigui.js';\n\nimport ColorChooser from './controllers/ColorChooser.js';\nimport Direction from './controllers/Direction.js';\nimport RadioGrid from './controllers/RadioGrid.js';\nimport Range from './controllers/Range.js';\nimport Select from './controllers/Select.js';\nimport Slider from './controllers/Slider.js';\nimport TextNumber from './controllers/TextNumber.js';\nimport Vec2 from './controllers/Vec2.js';\n\nGUI.ColorChooser = ColorChooser;\nGUI.Direction = Direction;\nGUI.RadioGrid = RadioGrid;\nGUI.Range = Range;\nGUI.Select = Select;\nGUI.Slider = Slider;\nGUI.TextNumber = TextNumber;\nGUI.Vec2 = Vec2;\n\nexport default GUI;","import { identity } from '../libs/conversions.js';\nimport DirectionView from '../views/DirectionView.js';\nimport NumberView from '../views/NumberView.js';\n// import ValueController from './ValueController.js';\nimport PopDownController from './PopDownController.js';\n\n\n// deg2rad\n// where is 0\n// range (0, 360), (-180, +180), (0,0) Really this is a range\n\nexport default class Direction extends PopDownController {\n #options;\n constructor(object, property, options) {\n super(object, property, 'muigui-direction');\nthis.#options = options; // FIX\n this.addTop(new NumberView(this,\nidentity));\n this.addBottom(new DirectionView(this, options));\n this.updateDisplay();\n }\n}\n\n","import RadioGridView from '../views/RadioGridView.js';\nimport ValueController from './ValueController.js';\nimport { convertToKeyValues } from '../libs/key-values.js';\n\nexport default class RadioGrid extends ValueController {\n constructor(object, property, options) {\n super(object, property, 'muigui-radio-grid');\n const valueIsNumber = typeof this.getValue() === 'number';\n const {\n keyValues: keyValuesInput,\n cols = 3,\n } = options;\n const keyValues = convertToKeyValues(keyValuesInput, valueIsNumber);\n this.add(new RadioGridView(this, keyValues, cols));\n this.updateDisplay();\n }\n}","import ValueController from './ValueController.js';\nimport NumberView from '../views/NumberView.js';\nimport SliderView from '../views/SliderView.js';\n\nexport default class Slider extends ValueController {\n constructor(object, property, options = {}) {\n super(object, property, 'muigui-slider');\n this.add(new SliderView(this, options));\n this.add(new NumberView(this, options));\n this.updateDisplay();\n }\n}\n","import NumberView from '../views/NumberView.js';\nimport Vec2View from '../views/Vec2View.js';\nimport PopDownController from './PopDownController.js';\nimport { strToNumber } from '../libs/conversions.js';\n\n// TODO: zoom with wheel and pinch?\n// TODO: grid?\n// // options\n// scale:\n// range: number (both x and y + /)\n// range: array (min, max)\n// xRange:\n// deg/rad/turn\n\nexport default class Vec2 extends PopDownController {\n constructor(object, property) {\n super(object, property, 'muigui-vec2');\n\n const makeSetter = (ndx) => {\n return {\n setValue: (v) => {\n const newV = this.getValue();\n newV[ndx] = v;\n this.setValue(newV);\n },\n setFinalValue: (v) => {\n const newV = this.getValue();\n newV[ndx] = v;\n this.setFinalValue(newV);\n },\n };\n };\n\n this.addTop(new NumberView(makeSetter(0), {\n converters: {\n to: v => v[0],\n from: strToNumber.from,\n },\n }));\n this.addTop(new NumberView(makeSetter(1), {\n converters: {\n to: v => v[1],\n from: strToNumber.from,\n },\n }));\n this.addBottom(new Vec2View(this));\n this.updateDisplay();\n }\n}\n"],"names":["css","default","themes","include","float","form","none","createElem","tag","attrs","children","elem","document","createElement","key","value","Object","entries","startsWith","eventName","substring","toLowerCase","addEventListener","passive","k","v","undefined","setAttribute","child","appendChild","setElemProps","nextId","removeArrayElem","array","ndx","indexOf","splice","clamp","min","max","Math","isTypedArray","SharedArrayBuffer","a","buffer","ArrayBuffer","stepify","from","step","round","euclideanModulo","n","copyExistingProperties","dst","src","mapRange","inMin","inMax","outMin","outMax","makeRangeConverters","to","makeRangeOptions","converters","identity","makeMinMaxPair","gui","properties","minPropName","maxPropName","options","guiMinRange","minRange","valueMinRange","minGui","add","onChange","maxGui","setValue","View","domElement","childDestElem","views","constructor","this","addElem","removeElem","removeChild","pushSubElem","popSubElem","parentElement","view","push","remove","pushSubView","popSubView","setOptions","updateDisplayIfNeeded","newV","ignoreCache","$","selector","querySelector","Controller","changeFns","finishChangeFns","parent","className","super","classList","setParent","enable","disabled","show","toggle","hide","closest","forEach","querySelectorAll","disable","fn","removeChange","onFinishChange","removeFinishChange","callListeners","fns","call","emitChange","object","property","controller","emitFinalChange","updateDisplay","getColors","toCamelCase","s","replace","m","m1","toUpperCase","div","colors","fromEntries","map","style","color","getComputedStyle","Button","buttonElem","name","type","onClick","textContent","arraysEqual","b","length","i","EditView","oldV","updateCheck","checkArrayNeedsUpdate","needUpdate","copyArrayElementsFromTo","checkTypedArrayNeedsUpdate","once","checkObjectNeedsUpdate","checkValueNeedsUpdate","getUpdateCheckForType","Array","isArray","bind","CheckboxView","checkboxElem","setter","id","onInput","checked","setFinalValue","tasks","tasksToRemove","Set","requestId","processing","processTasks","task","has","size","queueProcessing","clear","requestAnimationFrame","makeId","ValueView","LabelController","nameElem","for","title","tooltip","tip","ValueController","initialValue","listening","updateFn","getValue","setValueImpl","isDifferent","keys","assign","reset","listen","set","removeTask","Checkbox","strToNumber","toString","parseFloat","Number","isNaN","radToDeg","PI","createWheelHelper","wheelAccum","e","wheelScale","deltaY","delta","floor","abs","sign","NumberView","skipUpdate","NEGATIVE_INFINITY","POSITIVE_INFINITY","wheelHelper","handleInput","onWheel","preventDefault","valid","outV","setFn","inRange","TextNumber","textView","SelectView","values","keyValues","selectedIndex","convertToKeyValues","valueIsNumber","Select","keyValuesInput","RangeView","validV","Range","TextView","Text","lerp","t","fract","f0","toFixed","f3","hexToUint32RGB","parseInt","hexToUint32RGBA","hexToUint8RGB","uint8RGBToHex","padStart","join","hexToUint8RGBA","uint8RGBAToHex","hexToFloatRGB","floatRGBToHex","hexToFloatRGBA","floatRGBAToHex","scaleAndClamp","hexToObjectRGB","r","g","hexToObjectRGBA","hexToCssRGB","cssRGBRegex","hexToCssRGBA","cssRGBARegex","hexToCssHSL","hsl","rgbUint8ToHsl","hexToCssHSLA","hsla","rgbaUint8ToHsla","cssHSLRegex","cssHSLARegex","hslToRgbUint8","h","l","f","rgbFloatToHsl01","d","rgbaFloatToHsla01","rgb","rgba","hsv01ToRGBFloat","hue","sat","val","hsva01ToRGBAFloat","alpha","round3","rgbFloatToHSV01","p","q","EPSILON","rgbaFloatToHSVA01","hasAlpha","format","endsWith","cssStringFormats","re","guessFormat","console","warn","formatInfo","test","guessStringColorFormat","trim","Uint8Array","Uint8ClampedArray","Float32Array","Error","fixHex6","fixHex8","hex6ToHex3","hex6","hex3RE","hex3ToHex6","hex3","exec","m2","fixHex3","strToCssRGB","find","strToCssRGBA","strToCssHSL","strToCssHSLA","strTo3IntsRE","strTo4IntsRE","strTo3Floats","numbers","split","badNdx","findIndex","strTo4Floats","strToUint32RGBRegex","strToUint32RGBARegex","hex6RE","hexNoHash6RE","hex8RE","hexNoHash8RE","colorFormatConverters","text","hex8","strToUint32RGB","strToUint32RGBA","json","JSON","parse","hslaToRgbaUint8","ElementView","Canvas","canvasElem","canvas","ColorView","colorElem","Color","colorView","Divider","Container","controllers","childDestController","filter","c","folders","recursive","c0","addControllerImpl","addController","pushContainer","container","popContainer","Folder","labelElem","toggleOpen","open","close","contains","Label","noop","computeRelativePosition","event","start","rect","getBoundingClientRect","x","clientX","left","y","clientY","top","nx","width","ny","height","dx","dy","ndy","addTouchEvents","onDown","onMove","onUp","pointerMove","pointerUp","releasePointerCapture","pointerId","removeEventListener","body","backgroundColor","pointerDown","setPointerCapture","rel","connectFillTargets","srcElem","dataset","targetElem","ColorChooserView","satLevelElem","circleElem","hueUIElem","hueElem","hueCursorElem","alphaUIElem","alphaElem","alphaCursorElem","hsva","skipHueUpdate","skipSatLevelUpdate","skipAlphaUpdate","convertInternalToHex","convertHexToInternal","innerHTML","handleSatLevelChange","handleHueChange","handleAlphaChange","lum","display","PopDownController","valuesView","bottom","setKnobColor","bgCssColor","addTop","addBottom","ColorChooser","___setKnobHelper","setKnobHelper","hex6Or8","hex","GUIFolder","args","arg1","createController","addCanvas","addColor","addDivider","addFolder","addLabel","addButton","o","MuiguiElement","HTMLElement","shadow","attachShadow","mode","customElements","define","baseStyleSheet","CSSStyleSheet","userStyleSheet","makeStyleSheetUpdater","styleSheet","newCss","newCssPromise","updateStyle","then","updateBaseStyle","updateUserStyle","getTheme","cssStr","GUI","static","localStyleSheet","autoPlace","muiguiElement","shadowRoot","adoptedStyleSheets","replaceSync","setStyle","setTheme","setBaseStyles","keyDirections","ArrowLeft","ArrowRight","ArrowUp","ArrowDown","addKeyboardEvents","keyDown","mult","shiftKey","assert","truthy","msg","getEllipsePointForAngle","cx","cy","rx","ry","phi","theta","cos","sin","arc","end","x1","y1","x2","y2","fa","fs","dTheta","getEndpointParameters","twoPiMod","DirectionView","arrowElem","rangeElem","lastV","wrap","dirMin","dirMax","tempV","handleTouch","atan2","center","angle","transform","RadioGridView","cols","that","previousElementSibling","click","gridTemplateColumns","onResize","callback","ResizeObserver","observe","onResizeSVGNoScale","hAnchor","vAnchor","createSVGTicks","SliderView","svgElem","originElem","ticksElem","thicksElem","numbersElem","leftGradElem","rightGradElem","minusSize","unit","unitSize","ticksPerUnit","labelFn","tickHeight","limits","thicksColor","orientation","startV","oldHTML","getComputedTextLength","computeSizeOfMinus","updateSlider","unitsAcross","ceil","centerUnitSpace","startUnitSpace","minUnitSpace","maxUnitSpace","stroke","texts","digits","log10","createSVGNumbers","Vec2View","onTouch","updateDisplayImpl","Direction","RadioGrid","Slider","Vec2","makeSetter"],"mappings":"oOAAe,IAAAA,EAAA,CACbC,QAAS,yshBAwtBXC,OAAQ,CACND,QAAS,CACPE,QAAS,CAAC,WACVH,IAAK,UAGPI,MAAO,CACLD,QAAS,CAAC,WACVH,IAAK,+xCA0DPK,KAAM,CACJF,QAAS,GACTH,IAAK,28BA6CPM,KAAM,CACJH,QAAS,GACTH,IAAK,MCvzBF,SAASO,EAAWC,EAAKC,EAAQ,C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,EACZoP,GAAIxP,OAASA,EACbwP,GAAI4G,OGZW,cAAqBtZ,EAClCnH,YAAY6C,EAAQC,EAAU3D,EAAU,CAAA,GACtCsC,MAAMoB,EAAQC,EAAU,iBACxB7C,KAAKT,IAAI,IAAI2e,GAAWle,KAAMd,IAC9Bc,KAAKT,IAAI,IAAIyJ,EAAWhJ,KAAMd,IAC9Bc,KAAKgD,eACN,GHOH4W,GAAIhQ,WAAaA,EACjBgQ,GAAI6G,KIJW,cAAmBxJ,GAChClX,YAAY6C,EAAQC,GAClBrB,MAAMoB,EAAQC,EAAU,eAExB,MAAM6d,EAAc5jB,IACX,CACL4C,SAAWrD,IACT,MAAMyE,EAAOd,KAAKsH,WAClBxG,EAAKhE,GAAOT,EACZ2D,KAAKN,SAASoB,EAAK,EAErB+E,cAAgBxJ,IACd,MAAMyE,EAAOd,KAAKsH,WAClBxG,EAAKhE,GAAOT,EACZ2D,KAAK6F,cAAc/E,EAAK,IAK9Bd,KAAKsX,OAAO,IAAItO,EAAW0X,EAAW,GAAI,CACxC/hB,WAAY,CACVF,GAAIpC,GAAKA,EAAE,GACXsB,KAAMqK,EAAYrK,SAGtBqC,KAAKsX,OAAO,IAAItO,EAAW0X,EAAW,GAAI,CACxC/hB,WAAY,CACVF,GAAIpC,GAAKA,EAAE,GACXsB,KAAMqK,EAAYrK,SAGtBqC,KAAKuX,UAAU,IAAI4I,GAASngB,OAC5BA,KAAKgD,eACN"}
\ No newline at end of file
diff --git a/dist/0.x/muigui.module.js b/dist/0.x/muigui.module.js
index db65852..0a72b8c 100644
--- a/dist/0.x/muigui.module.js
+++ b/dist/0.x/muigui.module.js
@@ -1,4 +1,4 @@
-/* muigui@0.0.12, license MIT */
+/* muigui@0.0.13, license MIT */
var css = {
default: `
.muigui {
@@ -11,16 +11,24 @@ var css = {
--menu-bg-color: #f8f8f8;
--menu-sep-color: #bbb;
--hover-bg-color: #999;
- --focus-color: #68C;
- --range-color: #888888;
+ --focus-color: #8BF;
+ --range-color: #AAA;
--invalid-color: #FF0000;
--selected-color: rgb(255, 255, 255, 0.9);
--button-bg-color: var(--value-bg-color);
+ --image-open: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPgogIDxyZWN0IHN0eWxlPSJmaWxsOiAjNDQ0OyIgeD0iMjAlIiB5PSI0NSUiIHdpZHRoPSI2MCUiIGhlaWdodD0iMTAlIj48L3JlY3Q+Cjwvc3ZnPg==);
+ --image-closed: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPgogIDxyZWN0IHN0eWxlPSJmaWxsOiAjNDQ0OyIgeD0iNDUlIiB5PSIyMCUiIHdpZHRoPSIxMCUiIGhlaWdodD0iNjAlIj48L3JlY3Q+CiAgPHJlY3Qgc3R5bGU9ImZpbGw6ICM0NDQ7IiB4PSIyMCUiIHk9IjQ1JSIgd2lkdGg9IjYwJSIgaGVpZ2h0PSIxMCUiPjwvcmVjdD4KPC9zdmc+);
+ --image-checkerboard: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPgogIDxyZWN0IHN0eWxlPSJmaWxsOiAjNDA0MDQwOyIgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSI+PC9yZWN0PgogIDxyZWN0IHN0eWxlPSJmaWxsOiAjODA4MDgwOyIgeD0iMCIgeT0iMCIgd2lkdGg9IjUwJSIgaGVpZ2h0PSI1MCUiPjwvcmVjdD4KICA8cmVjdCBzdHlsZT0iZmlsbDogIzgwODA4MDsiIHg9IjUwJSIgeT0iNTAlIiB3aWR0aD0iNTAlIiBoZWlnaHQ9IjUwJSI+PC9yZWN0Pgo8L3N2Zz4=);
+
--range-left-color: var(--value-color);
--range-right-color: var(--value-bg-color);
--range-right-hover-color: var(--hover-bg-color);
+ --button-image:
+ linear-gradient(
+ rgba(255, 255, 255, 1), rgba(0, 0, 0, 0.2)
+ );
color: var(--color);
background-color: var(--bg-color);
@@ -37,7 +45,7 @@ var css = {
--menu-bg-color: #080808;
--menu-sep-color: #444444;
--hover-bg-color: #666666;
- --focus-color: #88AAFF;
+ --focus-color: #458; /*#88AAFF*/;
--range-color: #888888;
--invalid-color: #FF6666;
--selected-color: rgba(255, 255, 255, 0.3);
@@ -47,9 +55,15 @@ var css = {
--range-left-color: var(--value-color);
--range-right-color: var(--value-bg-color);
--range-right-hover-color: var(--hover-bg-color);
+ --button-image: linear-gradient(
+ rgba(0, 0, 0, 0.1), rgba(0, 0, 0, 0.4)
+ );
color: var(--color);
background-color: var(--bg-color);
+
+ --image-closed: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPgogIDxyZWN0IHN0eWxlPSJmaWxsOiAjREREOyIgeD0iMjAlIiB5PSI0NSUiIHdpZHRoPSI2MCUiIGhlaWdodD0iMTAlIj48L3JlY3Q+Cjwvc3ZnPg==);
+ --image-open: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPgogIDxyZWN0IHN0eWxlPSJmaWxsOiAjREREOyIgeD0iNDUlIiB5PSIyMCUiIHdpZHRoPSIxMCUiIGhlaWdodD0iNjAlIj48L3JlY3Q+CiAgPHJlY3Qgc3R5bGU9ImZpbGw6ICNEREQ7IiB4PSIyMCUiIHk9IjQ1JSIgd2lkdGg9IjYwJSIgaGVpZ2h0PSIxMCUiPjwvcmVjdD4KPC9zdmc+);
}
}
@@ -58,7 +72,6 @@ var css = {
--label-width: 45%;
--number-width: 40%;
-
--font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
--font-size: 11px;
--font-family-mono: Menlo, Monaco, Consolas, "Droid Sans Mono", monospace;
@@ -151,6 +164,9 @@ var css = {
min-width: 0;
min-height: var(--line-height);
}
+.muigui-root {
+ z-index: 1;
+}
.muigui-root,
.muigui-menu {
display: flex;
@@ -175,8 +191,7 @@ var css = {
color: var(--color);
background-color: var(--menu-bg-color);
min-height: var(--line-height);
- padding-top: 0.2em;
- padding-bottom: 0.2em;
+ padding: 0.2em;
cursor: pointer;
border-radius: var(--border-radius);
}
@@ -197,7 +212,7 @@ var css = {
.muigui-controller>*:nth-child(1) {
flex: 1 0 var(--label-width);
min-width: 0;
- white-space: pre;
+ /* white-space: pre; why?? */
}
.muigui-controller>label:nth-child(1) {
place-content: center start;
@@ -239,32 +254,41 @@ var css = {
/* fix! */
.muigui-open>button>label::before,
.muigui-closed>button>label::before {
+ content: "X";
+ color: rgba(0, 0, 0, 0);
+ background-color: var(--range-color);
+ border-radius: 0.2em;
width: 1.25em;
- height: var(--line-height);
+ margin-right: 0.25em;
+ height: 1.25em; /*var(--line-height);*/
display: inline-grid;
place-content: center start;
pointer-events: none;
}
.muigui-open>button>label::before {
- content: "ⓧ"; /*"▼";*/
+ background-image: var(--image-open);
}
.muigui-closed>button>label::before {
- content: "⨁"; /*"▶";*/
+ background-image: var(--image-closed);
}
-.muigui-open>*:nth-child(2) {
- transition: max-height 0.2s ease-out,
- opacity 0.5s ease-out;
- max-height: 100vh;
+
+.muigui-open>.muigui-open-container {
+ transition: all 0.1s ease-out;
overflow: auto;
- opacity: 1;
+ height: 100%;
}
-
-.muigui-closed>*:nth-child(2) {
- transition: max-height 0.2s ease-out,
- opacity 1s;
- max-height: 0;
- opacity: 0;
+.muigui-closed>.muigui-open-container {
+ transition: all 0.1s ease-out;
overflow: hidden;
+ min-height: 0;
+}
+.muigui-open>.muigui-open-container>* {
+ transition: all 0.1s ease-out;
+ margin-top: 0px;
+}
+.muigui-closed>.muigui-open-container>* {
+ transition: all 0.1s ease-out;
+ margin-top: -100%;
}
/* ---- popdown ---- */
@@ -276,8 +300,12 @@ var css = {
.muigui-value>*:nth-child(1).muigui-pop-down-top {
flex: 0;
}
-.muigui-pop-down-bottom {
+.muigui-closed .muigui-pop-down-bottom {
+ max-height: 0;
+}
+.muigui-value .muigui-pop-down-bottom {
+ margin: 0;
}
.muigui-pop-down-values {
@@ -299,6 +327,10 @@ var css = {
width: auto;
color: var(--value-color);
background-color: var(--value-bg-color);
+ background-image: var(--image-checkerboard);
+ background-size: 10px 10px;
+ background-position: 0 0, 0 5px, 5px -5px, -5px 0px;
+
cursor: pointer;
display: grid;
@@ -390,14 +422,16 @@ var css = {
.muigui-button {
display: grid;
-
+ padding: 2px 0 2px 0;
}
.muigui-button button {
border: none;
color: var(--value-color);
background-color: var(--button-bg-color);
+ background-image: var(--button-image);
cursor: pointer;
place-content: center center;
+ height: var(--line-height);
}
/* ------ [ color ] ------ */
@@ -609,9 +643,9 @@ var css = {
border-bottom: 1px solid rgba(0,0,0,0.2);
border-right: 1px solid rgba(0,0,0,0.2);
background-color: var(--range-color);
- margin-top: calc((var(--line-height) - 2px) / -2);
- width: calc(var(--line-height) - 2px);
- height: calc(var(--line-height) - 2px);
+ margin-top: calc((var(--line-height) - 6px) / -2);
+ width: calc(var(--line-height) - 6px);
+ height: calc(var(--line-height) - 6px);
}
.muigui-range input[type=range]::-webkit-slider-runnable-track {
@@ -695,8 +729,14 @@ var css = {
`,
themes: {
- default: '',
- float: `
+ default: {
+ include: ['default'],
+ css: `
+ `,
+ },
+ float: {
+ include: ['default'],
+ css: `
:root {
color-scheme: light dark,
}
@@ -753,6 +793,58 @@ themes: {
--range-color: rgba(0, 0, 0, 0.125);
}
`,
+ },
+ form: {
+ include: [],
+ css: `
+ .muigui {
+ --width: 100%;
+ --label-width: 45%;
+ --number-width: 40%;
+ }
+ .muigui-root>button {
+ display: none;
+ }
+ .muigui-controller {
+ margin-top: 1em;
+ }
+ .muigui-label-controller {
+ display: flex;
+ flex-direction: column;
+ align-items: stretch;
+ margin-top: 1em;
+ }
+ .muigui-label-controller:has(.muigui-checkbox) {
+ flex-direction: row;
+ }
+ .muigui-value {
+ display: flex;
+ align-items: stretch;
+ }
+ .muigui-value>* {
+ flex: 1 1 auto;
+ min-width: 0;
+ }
+ .muigui-controller>*:nth-child(1) {
+ flex: 1 0 var(--label-width);
+ min-width: 0;
+ white-space: pre;
+ }
+ .muigui-controller>label:nth-child(1) {
+ place-content: center start;
+ display: inline-grid;
+ overflow: hidden;
+ }
+ .muigui-controller>*:nth-child(2) {
+ flex: 1 1 75%;
+ min-width: 0;
+ }
+ `,
+ },
+ none: {
+ include: [],
+ css: '',
+ },
},
};
@@ -1114,6 +1206,9 @@ class Button extends Controller {
}));
this.setOptions({name: property, ...options});
}
+ name(name) {
+ this.#buttonElem.textContent = name;
+ }
setOptions(options) {
copyExistingProperties(this.#options, options);
const {name} = this.#options;
@@ -1505,15 +1600,22 @@ class NumberView extends EditView {
const wheelHelper = createWheelHelper();
super(createElem('input', {
type: 'number',
- onInput: () => this.#handleInput(setValue, true),
- onChange: () => this.#handleInput(setFinalValue, false),
+ onInput: () => {
+ this.#handleInput(setValue, true);
+ },
+ onChange: () => {
+ this.#handleInput(setFinalValue, false);
+ },
onWheel: e => {
e.preventDefault();
const {min, max, step} = this.#options;
const delta = wheelHelper(e, step);
const v = parseFloat(this.domElement.value);
const newV = clamp$1(stepify(v + delta, v => v, step), min, max);
- setter.setValue(newV);
+ const [valid, outV] = this.#from(newV);
+ if (valid) {
+ setter.setValue(outV);
+ }
},
}));
this.setOptions(options);
@@ -1558,7 +1660,7 @@ class TextNumber extends ValueController {
#step;
constructor(object, property, options = {}) {
- super(object, property, 'muigui-checkbox');
+ super(object, property, 'muigui-text-number');
this.#textView = this.add(new NumberView(this, options));
this.updateDisplay();
}
@@ -1716,8 +1818,12 @@ class TextView extends EditView {
const setFinalValue = setter.setFinalValue.bind(setter);
super(createElem('input', {
type: 'text',
- onInput: () => this.#handleInput(setValue, true),
- onChange: () => this.#handleInput(setFinalValue, false),
+ onInput: () => {
+ this.#handleInput(setValue, true);
+ },
+ onChange: () => {
+ this.#handleInput(setFinalValue, false);
+ },
}));
this.setOptions(options);
}
@@ -1750,7 +1856,7 @@ class TextView extends EditView {
class Text extends ValueController {
constructor(object, property) {
- super(object, property, 'muigui-checkbox');
+ super(object, property, 'muigui-text');
this.add(new TextView(this));
this.updateDisplay();
}
@@ -1775,6 +1881,9 @@ function createController(object, property, ...args) {
if (Array.isArray(arg1)) {
return new Select(object, property, {keyValues: arg1});
}
+ if (arg1 && arg1.keyValues) {
+ return new Select(object, property, {keyValues: arg1.keyValues});
+ }
const t = typeof object[property];
switch (t) {
@@ -2386,6 +2495,50 @@ const colorFormatConverters = {
to: v => Array.from(v).map(v => f3(v)).join(', '),
},
},
+ 'float-hsv': {
+ color: {
+ from: v => [true, rgbFloatToHSV01(hexToFloatRGB(v))],
+ to: v => hsv01ToRGBFloat(floatRGBToHex(v)),
+ },
+ text: {
+ from: strTo3Floats,
+ // need Array.from because map of Float32Array makes a Float32Array
+ to: v => Array.from(v).map(v => f3(v)).join(', '),
+ },
+ },
+ 'float-hsva': {
+ color: {
+ from: v => [true, rgbaFloatToHSVA01(hexToFloatRGB(v))],
+ to: v => hsva01ToRGBAFloat(floatRGBToHex(v)),
+ },
+ text: {
+ from: strTo4Floats,
+ // need Array.from because map of Float32Array makes a Float32Array
+ to: v => Array.from(v).map(v => f3(v)).join(', '),
+ },
+ },
+ //'float-hsl': {
+ // color: {
+ // from: v => [true, rgbFloatToHsl01(hexToFloatRGB(v))],
+ // to: v => hsl01ToRGBFloat(floatRGBToHex(v)),
+ // },
+ // text: {
+ // from: strTo3Floats,
+ // // need Array.from because map of Float32Array makes a Float32Array
+ // to: v => Array.from(v).map(v => f3(v)).join(', '),
+ // },
+ //},
+ //'float-hsla': {
+ // color: {
+ // from: v => [true, hexToFloatRGBA(v)],
+ // to: floatRGBAToHex,
+ // },
+ // text: {
+ // from: strTo4Floats,
+ // // need Array.from because map of Float32Array makes a Float32Array
+ // to: v => Array.from(v).map(v => f3(v)).join(', '),
+ // },
+ //},
'object-rgb': {
color: {
from: v => [true, hexToObjectRGB(v)],
@@ -2458,8 +2611,8 @@ class ElementView extends View {
class Canvas extends LabelController {
#canvasElem;
- constructor() {
- super('muigui-canvas');
+ constructor(name) {
+ super('muigui-canvas', name);
this.#canvasElem = this.add(
new ElementView('canvas', 'muigui-canvas'),
).domElement;
@@ -2620,6 +2773,7 @@ class Folder extends Container {
type: 'button',
onClick: () => this.toggleOpen(),
}, [this.#labelElem]));
+ this.pushContainer(new Container('muigui-open-container'));
this.pushContainer(new Container());
this.name(name);
this.open();
@@ -2968,7 +3122,10 @@ class PopDownController extends ValueController {
}));
this.#checkboxElem = checkboxElem;
this.#valuesView = this.#top.add(new ElementView('div', 'muigui-pop-down-values'));
- this.#bottom = this.add(new ElementView('div', 'muigui-pop-down-bottom'));
+ const container = new ElementView('div', 'muigui-pop-down-bottom muigui-open-container');
+ this.#bottom = new ElementView('div');
+ container.add(this.#bottom);
+ this.add(container);
this.setOptions(options);
}
setKnobColor(bgCssColor/*, fgCssColor*/) {
@@ -3004,7 +3161,6 @@ class ColorChooser extends PopDownController {
#colorView;
#textView;
#to;
- #setKnobHelper;
constructor(object, property, options = {}) {
super(object, property, 'muigui-color-chooser');
@@ -3016,20 +3172,22 @@ class ColorChooser extends PopDownController {
this.addTop(this.#textView);
this.addBottom(this.#colorView);
// WTF! FIX!
- this.#setKnobHelper = () => {
- if (this.#to) {
- const hex6Or8 = this.#to(this.getValue());
- const hsl = rgbUint8ToHsl(hexToUint8RGB(hex6Or8));
- hsl[2] = (hsl[2] + 50) % 100;
- const hex = uint8RGBToHex(hslToRgbUint8(hsl));
- this.setKnobColor(`${hex6Or8.substring(0, 7)}FF`, hex);
- }
- };
+ this.___setKnobHelper = true;
this.updateDisplay();
}
+ #setKnobHelper() {
+ if (this.#to) {
+ const hex6Or8 = this.#to(this.getValue());
+ const alpha = hex6Or8.length === 9 ? hex6Or8.substring(7, 9) : 'FF';
+ const hsl = rgbUint8ToHsl(hexToUint8RGB(hex6Or8));
+ hsl[2] = (hsl[2] + 50) % 100;
+ const hex = uint8RGBToHex(hslToRgbUint8(hsl));
+ this.setKnobColor(`${hex6Or8.substring(0, 7)}${alpha}`, hex);
+ }
+ }
updateDisplay() {
super.updateDisplay();
- if (this.#setKnobHelper) {
+ if (this.___setKnobHelper) {
this.#setKnobHelper();
}
}
@@ -3138,6 +3296,10 @@ class GUIFolder extends Folder {
addLabel(text) {
return this.addController(new Label(text));
}
+ addButton(name, fn) {
+ const o = {fn};
+ return this.add(o, 'fn').name(name);
+ }
}
class MuiguiElement extends HTMLElement {
@@ -3150,7 +3312,7 @@ class MuiguiElement extends HTMLElement {
customElements.define('muigui-element', MuiguiElement);
const baseStyleSheet = new CSSStyleSheet();
-baseStyleSheet.replaceSync(css.default);
+//baseStyleSheet.replaceSync(css.default);
const userStyleSheet = new CSSStyleSheet();
function makeStyleSheetUpdater(styleSheet) {
@@ -3177,6 +3339,11 @@ function makeStyleSheetUpdater(styleSheet) {
const updateBaseStyle = makeStyleSheetUpdater(baseStyleSheet);
const updateUserStyle = makeStyleSheetUpdater(userStyleSheet);
+function getTheme(name) {
+ const { include, css: cssStr } = css.themes[name];
+ return `${include.map(m => css[m]).join('\n')} : css.default}\n${cssStr || ''}`;
+}
+
class GUI extends GUIFolder {
static converters = converters;
static mapRange = mapRange;
@@ -3208,13 +3375,14 @@ class GUI extends GUIFolder {
}
if (parent) {
const muiguiElement = createElem('muigui-element');
- muiguiElement.shadowRoot.adoptedStyleSheets = [baseStyleSheet, userStyleSheet, this.#localStyleSheet];
+ muiguiElement.shadowRoot.adoptedStyleSheets = [this.#localStyleSheet, baseStyleSheet, userStyleSheet];
muiguiElement.shadow.appendChild(this.domElement);
parent.appendChild(muiguiElement);
}
if (title) {
this.title(title);
}
+ this.#localStyleSheet.replaceSync(css.default);
this.domElement.classList.add('muigui', 'muigui-colors');
}
setStyle(css) {
@@ -3232,8 +3400,11 @@ class GUI extends GUIFolder {
static getUserStyleSheet() {
return userStyleSheet;
}
+ setTheme(name) {
+ this.setStyle(getTheme(name));
+ }
static setTheme(name) {
- GUI.setBaseStyles(`${css.default}\n${css.themes[name] || ''}`);
+ GUI.setBaseStyles(getTheme(name));
}
}
@@ -3814,5 +3985,59 @@ class Vec2 extends PopDownController {
}
}
-export { ColorChooser, Direction, RadioGrid, Range, Select, Slider, TextNumber, Vec2, GUI as default };
+const darkColors = {
+ main: '#ddd',
+};
+const lightColors = {
+ main: '#333',
+};
+
+const darkMatcher = window.matchMedia('(prefers-color-scheme: dark)');
+
+let colors;
+let isDarkMode;
+
+function update() {
+ isDarkMode = darkMatcher.matches;
+ colors = isDarkMode ? darkColors : lightColors;
+}
+darkMatcher.addEventListener('change', update);
+update();
+
+function graph(canvas, data, {
+ min = -1,
+ max = 1,
+ interval = 16,
+ color,
+ }) {
+ const ctx = canvas.getContext('2d');
+
+ function render() {
+ const {width, height} = canvas;
+ ctx.clearRect(0, 0, width, height);
+ ctx.beginPath();
+ const range = max - min;
+ for (let i = 0; i < data.length; ++i) {
+ const x = i * width / data.length;
+ const y = (data[i] - min) * height / range;
+ ctx.lineTo(x, y);
+ }
+ ctx.strokeStyle = color || colors.main;
+ ctx.stroke();
+ }
+ setInterval(render, interval);
+}
+
+function monitor(label, object, property, {interval = 200} = {}) {
+ setInterval(() => {
+ label.text(JSON.stringify(object[property], null, 2));
+ }, interval);
+}
+
+const helpers = {
+ graph,
+ monitor,
+};
+
+export { ColorChooser, Direction, RadioGrid, Range, Select, Slider, TextNumber, Vec2, GUI as default, helpers };
//# sourceMappingURL=muigui.module.js.map
diff --git a/dist/0.x/muigui.module.js.map b/dist/0.x/muigui.module.js.map
index 339fac6..175f67b 100644
--- a/dist/0.x/muigui.module.js.map
+++ b/dist/0.x/muigui.module.js.map
@@ -1 +1 @@
-{"version":3,"file":"muigui.module.js","sources":["../../src/styles/muigui.css.js","../../src/libs/elem.js","../../src/libs/utils.js","../../../src/views/View.ts","../../src/controllers/Controller.js","../../src/controllers/Button.js","../../src/views/EditView.js","../../src/views/CheckboxView.js","../../src/libs/taskrunner.js","../../src/libs/ids.js","../../src/views/ValueView.js","../../src/controllers/LabelController.js","../../src/controllers/ValueController.js","../../src/controllers/Checkbox.js","../../src/libs/conversions.js","../../src/libs/wheel.js","../../src/views/NumberView.js","../../src/controllers/TextNumber.js","../../src/views/SelectView.js","../../src/libs/key-values.js","../../src/controllers/Select.js","../../src/views/RangeView.js","../../src/controllers/Range.js","../../src/views/TextView.js","../../src/controllers/Text.js","../../src/controllers/create-controller.js","../../src/libs/color-utils.js","../../src/views/ElementView.js","../../src/controllers/Canvas.js","../../src/views/ColorView.js","../../src/controllers/Color.js","../../src/controllers/Divider.js","../../src/controllers/Container.js","../../src/controllers/Folder.js","../../src/controllers/Label.js","../../src/libs/touch.js","../../src/views/ColorChooserView.js","../../src/controllers/PopDownController.js","../../src/controllers/ColorChooser.js","../../src/layout/Layout.js","../../src/layout/Column.js","../../src/layout/Frame.js","../../src/layout/Grid.js","../../src/layout/Row.js","../../src/muigui.js","../../src/libs/keyboard.js","../../src/libs/assert.js","../../src/libs/svg.js","../../src/views/DirectionView.js","../../src/controllers/Direction.js","../../src/views/RadioGridView.js","../../src/controllers/RadioGrid.js","../../src/libs/resize-helpers.js","../../src/views/SliderView.js","../../src/controllers/Slider.js","../../src/views/Vec2View.js","../../src/controllers/Vec2.js"],"sourcesContent":["export default {\n default: `\n.muigui {\n --bg-color: #ddd;\n --color: #222;\n --contrast-color: #eee;\n --value-color: #145 ;\n --value-bg-color: #eeee;\n --disabled-color: #999;\n --menu-bg-color: #f8f8f8;\n --menu-sep-color: #bbb;\n --hover-bg-color: #999;\n --focus-color: #68C;\n --range-color: #888888;\n --invalid-color: #FF0000;\n --selected-color: rgb(255, 255, 255, 0.9);\n\n --button-bg-color: var(--value-bg-color);\n\n --range-left-color: var(--value-color);\n --range-right-color: var(--value-bg-color); \n --range-right-hover-color: var(--hover-bg-color);\n\n color: var(--color);\n background-color: var(--bg-color);\n}\n\n@media (prefers-color-scheme: dark) {\n .muigui {\n --bg-color: #222222;\n --color: #dddddd;\n --contrast-color: #000;\n --value-color: #43e5f7;\n --value-bg-color: #444444;\n --disabled-color: #666666;\n --menu-bg-color: #080808;\n --menu-sep-color: #444444;\n --hover-bg-color: #666666;\n --focus-color: #88AAFF;\n --range-color: #888888;\n --invalid-color: #FF6666;\n --selected-color: rgba(255, 255, 255, 0.3);\n\n --button-bg-color: var(--value-bg-color);\n\n --range-left-color: var(--value-color);\n --range-right-color: var(--value-bg-color); \n --range-right-hover-color: var(--hover-bg-color);\n\n color: var(--color);\n background-color: var(--bg-color);\n }\n}\n\n.muigui {\n --width: 250px;\n --label-width: 45%;\n --number-width: 40%;\n\n\n --font-family: -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, Arial, sans-serif;\n --font-size: 11px;\n --font-family-mono: Menlo, Monaco, Consolas, \"Droid Sans Mono\", monospace;\n --font-size-mono: 11px;\n\n --line-height: 1.7em;\n --border-radius: 0px;\n\n width: var(--width);\n font-family: var(--font-family);\n font-size: var(--font-size);\n box-sizing: border-box;\n line-height: 100%;\n}\n.muigui * {\n box-sizing: inherit;\n}\n\n.muigui-no-scroll {\n touch-action: none;\n}\n.muigui-no-h-scroll {\n touch-action: pan-y;\n}\n.muigui-no-v-scroll {\n touch-action: pan-x;\n}\n\n.muigui-invalid-value {\n background-color: red !important;\n color: white !important;\n}\n\n.muigui-grid {\n display: grid;\n}\n.muigui-rows {\n display: flex;\n flex-direction: column;\n\n min-height: 20px;\n border: 2px solid red;\n}\n.muigui-columns {\n display: flex;\n flex-direction: row;\n\n height: 20px;\n border: 2px solid green;\n}\n.muigui-rows>*,\n.muigui-columns>* {\n flex: 1 1 auto;\n align-items: stretch;\n min-height: 0;\n min-width: 0;\n}\n\n.muigui-row {\n border: 2px solid yellow;\n min-height: 10px\n}\n.muigui-column {\n border: 2px solid lightgreen;\n}\n\n/* -------- */\n\n.muigui-show { /* */ }\n.muigui-hide { \n display: none !important;\n}\n.muigui-disabled {\n pointer-events: none;\n --color: var(--disabled-color) !important;\n --value-color: var(--disabled-color) !important;\n --range-left-color: var(--disabled-color) !important;\n}\n\n.muigui canvas,\n.muigui svg {\n display: block;\n border-radius: var(--border-radius);\n}\n.muigui canvas {\n background-color: var(--value-bg-color);\n}\n\n.muigui-controller {\n min-width: 0;\n min-height: var(--line-height);\n}\n.muigui-root,\n.muigui-menu {\n display: flex;\n flex-direction: column;\n position: relative;\n user-select: none;\n height: fit-content;\n margin: 0;\n padding-bottom: 0.1em;\n border-radius: var(--border-radius);\n}\n.muigui-menu {\n border-bottom: 1px solid var(--menu-sep-color);\n}\n\n.muigui-root>button:nth-child(1),\n.muigui-menu>button:nth-child(1) {\n border-top: 1px solid var(--menu-sep-color);\n border-bottom: 1px solid var(--menu-sep-color);\n position: relative;\n text-align: left;\n color: var(--color);\n background-color: var(--menu-bg-color);\n min-height: var(--line-height);\n padding-top: 0.2em;\n padding-bottom: 0.2em;\n cursor: pointer;\n border-radius: var(--border-radius);\n}\n.muigui-root>div:nth-child(2),\n.muigui-menu>div:nth-child(2) {\n flex: 1 1 auto;\n}\n\n.muigui-controller {\n margin-left: 0.2em;\n margin-right: 0.2em;\n}\n.muigui-root.muigui-controller,\n.muigui-menu.muigui-controller {\n margin-left: 0;\n margin-right: 0;\n}\n.muigui-controller>*:nth-child(1) {\n flex: 1 0 var(--label-width);\n min-width: 0;\n white-space: pre;\n}\n.muigui-controller>label:nth-child(1) {\n place-content: center start;\n display: inline-grid;\n overflow: hidden;\n}\n.muigui-controller>*:nth-child(2) {\n flex: 1 1 75%;\n min-width: 0;\n}\n\n/* -----------------------------------------\n a label controller is [[label][value]]\n*/\n\n.muigui-label-controller {\n display: flex;\n margin: 0.4em 0 0.4em 0;\n word-wrap: initial;\n align-items: stretch;\n}\n\n.muigui-value {\n display: flex;\n align-items: stretch;\n}\n.muigui-value>* {\n flex: 1 1 auto;\n min-width: 0;\n}\n.muigui-value>*:nth-child(1) {\n flex: 1 1 calc(100% - var(--number-width));\n}\n.muigui-value>*:nth-child(2) {\n flex: 1 1 var(--number-width);\n margin-left: 0.2em;\n}\n\n/* fix! */\n.muigui-open>button>label::before,\n.muigui-closed>button>label::before {\n width: 1.25em;\n height: var(--line-height);\n display: inline-grid;\n place-content: center start;\n pointer-events: none;\n}\n.muigui-open>button>label::before {\n content: \"ⓧ\"; /*\"▼\";*/\n}\n.muigui-closed>button>label::before {\n content: \"⨁\"; /*\"▶\";*/\n}\n.muigui-open>*:nth-child(2) {\n transition: max-height 0.2s ease-out,\n opacity 0.5s ease-out;\n max-height: 100vh;\n overflow: auto;\n opacity: 1;\n}\n\n.muigui-closed>*:nth-child(2) {\n transition: max-height 0.2s ease-out,\n opacity 1s;\n max-height: 0;\n opacity: 0;\n overflow: hidden;\n}\n\n/* ---- popdown ---- */\n\n.muigui-pop-down-top {\n display: flex;\n}\n/* fix? */\n.muigui-value>*:nth-child(1).muigui-pop-down-top {\n flex: 0;\n}\n.muigui-pop-down-bottom {\n\n}\n\n.muigui-pop-down-values {\n min-width: 0;\n display: flex;\n}\n.muigui-pop-down-values>* {\n flex: 1 1 auto;\n min-width: 0;\n}\n\n.muigui-value.muigui-pop-down-controller {\n flex-direction: column;\n}\n\n.muigui-pop-down-top input[type=checkbox] {\n -webkit-appearance: none;\n appearance: none;\n width: auto;\n color: var(--value-color);\n background-color: var(--value-bg-color);\n cursor: pointer;\n\n display: grid;\n place-content: center;\n margin: 0;\n font: inherit;\n color: currentColor;\n width: 1.7em;\n height: 1.7em;\n transform: translateY(-0.075em);\n}\n\n.muigui-pop-down-top input[type=checkbox]::before {\n content: \"+\";\n display: grid;\n place-content: center;\n border-radius: calc(var(--border-radius) + 2px);\n border-left: 1px solid rgba(255,255,255,0.3);\n border-top: 1px solid rgba(255,255,255,0.3);\n border-bottom: 1px solid rgba(0,0,0,0.2);\n border-right: 1px solid rgba(0,0,0,0.2);\n background-color: var(--range-color);\n color: var(--value-bg-color);\n width: calc(var(--line-height) - 4px);\n height: calc(var(--line-height) - 4px);\n}\n\n.muigui-pop-down-top input[type=checkbox]:checked::before {\n content: \"X\";\n}\n\n\n/* ---- select ---- */\n\n.muigui select,\n.muigui option,\n.muigui input,\n.muigui button {\n color: var(--value-color);\n background-color: var(--value-bg-color);\n font-family: var(--font-family);\n font-size: var(--font-size);\n border: none;\n margin: 0;\n border-radius: var(--border-radius);\n}\n.muigui select {\n appearance: none;\n margin: 0;\n margin-left: 0; /*?*/\n overflow: hidden; /* Safari */\n}\n\n.muigui select:focus,\n.muigui input:focus,\n.muigui button:focus {\n outline: 1px solid var(--focus-color);\n}\n\n.muigui select:hover,\n.muigui option:hover,\n.muigui input:hover,\n.muigui button:hover {\n background-color: var(--hover-bg-color); \n}\n\n/* ------ [ label ] ------ */\n\n.muigui-label {\n border-top: 1px solid var(--menu-sep-color);\n border-bottom: 1px solid var(--menu-sep-color);\n padding-top: 0.4em;\n padding-bottom: 0.3em;\n place-content: center start;\n background-color: var(--menu-bg-color);\n white-space: pre;\n border-radius: var(--border-radius);\n}\n\n/* ------ [ divider] ------ */\n\n.muigui-divider {\n min-height: 6px;\n border-top: 2px solid var(--menu-sep-color);\n margin-top: 6px;\n}\n\n/* ------ [ button ] ------ */\n\n.muigui-button {\n display: grid;\n\n}\n.muigui-button button {\n border: none;\n color: var(--value-color);\n background-color: var(--button-bg-color);\n cursor: pointer;\n place-content: center center;\n}\n\n/* ------ [ color ] ------ */\n\n.muigui-color>div {\n overflow: hidden;\n position: relative;\n margin-left: 0;\n margin-right: 0; /* why? */\n max-width: var(--line-height);\n border-radius: var(--border-radius);\n}\n\n.muigui-color>div:focus-within {\n outline: 1px solid var(--focus-color);\n}\n\n.muigui-color input[type=color] {\n border: none;\n padding: 0;\n background: inherit;\n cursor: pointer;\n position: absolute;\n width: 200%;\n left: -10px;\n top: -10px;\n height: 200%;\n}\n.muigui-disabled canvas,\n.muigui-disabled svg,\n.muigui-disabled img,\n.muigui-disabled .muigui-color input[type=color] {\n opacity: 0.2;\n}\n\n/* ------ [ checkbox ] ------ */\n\n.muigui-checkbox>label:nth-child(2) {\n display: grid;\n place-content: center start;\n margin: 0;\n}\n\n.muigui-checkbox input[type=checkbox] {\n -webkit-appearance: none;\n appearance: none;\n width: auto;\n color: var(--value-color);\n background-color: var(--value-bg-color);\n cursor: pointer;\n\n display: grid;\n place-content: center;\n margin: 0;\n font: inherit;\n color: currentColor;\n width: 1.7em;\n height: 1.7em;\n transform: translateY(-0.075em);\n}\n\n.muigui-checkbox input[type=checkbox]::before {\n content: \"\";\n color: var(--value-color);\n display: grid;\n place-content: center;\n}\n\n.muigui-checkbox input[type=checkbox]:checked::before {\n content: \"✔\";\n}\n\n.muigui input[type=number]::-webkit-inner-spin-button, \n.muigui input[type=number]::-webkit-outer-spin-button { \n -webkit-appearance: none;\n appearance: none;\n margin: 0; \n}\n.muigui input[type=number] {\n -moz-appearance: textfield;\n}\n\n/* ------ [ radio grid ] ------ */\n\n.muigui-radio-grid>div {\n display: grid;\n gap: 2px;\n}\n\n.muigui-radio-grid input {\n appearance: none;\n display: none;\n}\n\n.muigui-radio-grid button {\n color: var(--color);\n width: 100%;\n text-align: left;\n}\n\n.muigui-radio-grid input:checked + button {\n color: var(--value-color);\n background-color: var(--selected-color);\n}\n\n/* ------ [ color-chooser ] ------ */\n\n.muigui-color-chooser-cursor {\n stroke-width: 1px;\n stroke: white;\n fill: none;\n}\n.muigui-color-chooser-circle {\n stroke-width: 1px;\n stroke: white;\n fill: none;\n}\n\n\n/* ------ [ vec2 ] ------ */\n\n.muigui-vec2 svg {\n background-color: var(--value-bg-color);\n}\n\n.muigui-vec2-axis {\n stroke: 1px;\n stroke: var(--focus-color);\n}\n\n.muigui-vec2-line {\n stroke-width: 1px;\n stroke: var(--value-color);\n fill: var(--value-color);\n}\n\n/* ------ [ direction ] ------ */\n\n.muigui-direction svg {\n background-color: rgba(0,0,0,0.2);\n}\n\n.muigui-direction:focus-within svg {\n outline: none;\n}\n.muigui-direction-range {\n fill: var(--value-bg-color);\n}\n.muigui-direction svg:focus {\n outline: none;\n}\n.muigui-direction svg:focus .muigui-direction-range {\n stroke-width: 0.5px;\n stroke: var(--focus-color);\n}\n\n.muigui-direction-arrow {\n fill: var(--value-color);\n}\n\n/* ------ [ slider ] ------ */\n\n.muigui-slider>div {\n display: flex;\n align-items: stretch;\n height: var(--line-height);\n}\n.muigui-slider svg {\n flex: 1 1 auto;\n}\n.muigui-slider .muigui-slider-up #muigui-orientation {\n transform: scale(1, -1) translateY(-100%);\n}\n\n.muigui-slider .muigui-slider-up #muigui-number-orientation {\n transform: scale(1,-1);\n}\n\n.muigui-ticks {\n stroke: var(--range-color);\n}\n.muigui-thicks {\n stroke: var(--color);\n stroke-width: 2px;\n}\n.muigui-svg-text {\n fill: var(--color);\n font-size: 7px;\n}\n.muigui-mark {\n fill: var(--value-color);\n}\n\n/* ------ [ range ] ------ */\n\n\n.muigui-range input[type=range] {\n -webkit-appearance: none;\n appearance: none;\n background-color: transparent;\n}\n\n.muigui-range input[type=range]::-webkit-slider-thumb {\n -webkit-appearance: none;\n appearance: none;\n border-radius: calc(var(--border-radius) + 2px);\n border-left: 1px solid rgba(255,255,255,0.3);\n border-top: 1px solid rgba(255,255,255,0.3);\n border-bottom: 1px solid rgba(0,0,0,0.2);\n border-right: 1px solid rgba(0,0,0,0.2);\n background-color: var(--range-color);\n margin-top: calc((var(--line-height) - 2px) / -2);\n width: calc(var(--line-height) - 2px);\n height: calc(var(--line-height) - 2px);\n}\n\n.muigui-range input[type=range]::-webkit-slider-runnable-track {\n -webkit-appearance: none;\n appearance: none;\n border: 1px solid var(--menu-sep-color);\n height: 2px;\n}\n\n\n/* dat.gui style - doesn't work on Safari iOS */\n\n/*\n.muigui-range input[type=range] {\n cursor: ew-resize;\n overflow: hidden;\n}\n\n.muigui-range input[type=range] {\n -webkit-appearance: none;\n appearance: none;\n background-color: var(--range-right-color);\n margin: 0;\n}\n.muigui-range input[type=range]:hover {\n background-color: var(--range-right-hover-color);\n}\n\n.muigui-range input[type=range]::-webkit-slider-runnable-track {\n -webkit-appearance: none;\n appearance: none;\n height: max-content;\n color: var(--range-left-color);\n margin-top: -1px;\n}\n\n.muigui-range input[type=range]::-webkit-slider-thumb {\n -webkit-appearance: none;\n appearance: none;\n width: 0px;\n height: max-content;\n box-shadow: -1000px 0 0 1000px var(--range-left-color);\n}\n*/\n\n/* FF */\n/*\n.muigui-range input[type=range]::-moz-slider-progress {\n background-color: var(--range-left-color); \n}\n.muigui-range input[type=range]::-moz-slider-thumb {\n height: max-content;\n width: 0;\n border: none;\n box-shadow: -1000px 0 0 1000px var(--range-left-color);\n box-sizing: border-box;\n}\n*/\n\n.muigui-checkered-background {\n background-color: #404040;\n background-image:\n linear-gradient(45deg, #808080 25%, transparent 25%),\n linear-gradient(-45deg, #808080 25%, transparent 25%),\n linear-gradient(45deg, transparent 75%, #808080 75%),\n linear-gradient(-45deg, transparent 75%, #808080 75%);\n background-size: 16px 16px;\n background-position: 0 0, 0 8px, 8px -8px, -8px 0px;\n}\n\n/* ---------------------------------------------------------- */\n\n/* needs to be at bottom to take precedence */\n.muigui-auto-place {\n max-height: 100%;\n position: fixed;\n top: 0;\n right: 15px;\n z-index: 100001;\n}\n\n`,\nthemes: {\n default: '',\n float: `\n :root {\n color-scheme: light dark,\n }\n\n .muigui {\n --width: 400px;\n --bg-color: initial;\n --label-width: 25%;\n --number-width: 20%;\n }\n\n input,\n .muigui-label-controller>label {\n text-shadow:\n -1px -1px 0 var(--contrast-color),\n 1px -1px 0 var(--contrast-color),\n -1px 1px 0 var(--contrast-color),\n 1px 1px 0 var(--contrast-color);\n }\n\n .muigui-controller > label:nth-child(1) {\n place-content: center end;\n margin-right: 1em;\n }\n\n .muigui-value > :nth-child(2) {\n margin-left: 1em;\n }\n\n .muigui-root>*:nth-child(1) {\n display: none;\n }\n\n .muigui-range input[type=range]::-webkit-slider-thumb {\n border-radius: 1em;\n }\n\n .muigui-range input[type=range]::-webkit-slider-runnable-track {\n -webkit-appearance: initial;\n appearance: none;\n border: 1px solid rgba(0, 0, 0, 0.25);\n height: 2px;\n }\n\n .muigui-colors {\n --value-color: var(--color );\n --value-bg-color: rgba(0, 0, 0, 0.1);\n --disabled-color: #cccccc;\n --menu-bg-color: rgba(0, 0, 0, 0.1);\n --menu-sep-color: #bbbbbb;\n --hover-bg-color: rgba(0, 0, 0, 0);\n --invalid-color: #FF0000;\n --selected-color: rgba(0, 0, 0, 0.3);\n --range-color: rgba(0, 0, 0, 0.125);\n }\n`,\n},\n};\n","export function setElemProps(elem, attrs, children) {\n for (const [key, value] of Object.entries(attrs)) {\n if (typeof value === 'function' && key.startsWith('on')) {\n const eventName = key.substring(2).toLowerCase();\n elem.addEventListener(eventName, value, {passive: false});\n } else if (typeof value === 'object') {\n for (const [k, v] of Object.entries(value)) {\n elem[key][k] = v;\n }\n } else if (elem[key] === undefined) {\n elem.setAttribute(key, value);\n } else {\n elem[key] = value;\n }\n }\n for (const child of children) {\n elem.appendChild(child);\n }\n return elem;\n}\n\nexport function createElem(tag, attrs = {}, children = []) {\n const elem = document.createElement(tag);\n setElemProps(elem, attrs, children);\n return elem;\n}\n\nexport function addElem(tag, parent, attrs = {}, children = []) {\n const elem = createElem(tag, attrs, children);\n parent.appendChild(elem);\n return elem;\n}\n\nlet nextId = 0;\nexport function getNewId() {\n return `muigui-id-${nextId++}`;\n}\n","export function removeArrayElem(array, value) {\n const ndx = array.indexOf(value);\n if (ndx) {\n array.splice(ndx, 1);\n }\n return array;\n}\n\n/**\n * Converts an camelCase or snake_case id to \"camel case\" or \"snake case\"\n * @param {string} id\n */\nconst underscoreRE = /_/g;\nconst upperLowerRE = /([A-Z])([a-z])/g;\nexport function idToLabel(id) {\n return id.replace(underscoreRE, ' ')\n .replace(upperLowerRE, (m, m1, m2) => `${m1.toLowerCase()} ${m2}`);\n}\n\nexport function clamp(v, min, max) {\n return Math.max(min, Math.min(max, v));\n}\n\nexport const isTypedArray = typeof SharedArrayBuffer !== 'undefined'\n ? function isArrayBufferOrSharedArrayBuffer(a) {\n return a && a.buffer && (a.buffer instanceof ArrayBuffer || a.buffer instanceof SharedArrayBuffer);\n }\n : function isArrayBuffer(a) {\n return a && a.buffer && a.buffer instanceof ArrayBuffer;\n };\n\nexport const isArrayOrTypedArray = v => Array.isArray(v) || isTypedArray(v);\n\n// Yea, I know this should be `Math.round(v / step) * step\n// but try step = 0.1, newV = 19.95\n//\n// I get\n// Math.round(19.95 / 0.1) * 0.1\n// 19.900000000000002\n// vs\n// Math.round(19.95 / 0.1) / (1 / 0.1)\n// 19.9\n//\nexport const stepify = (v, from, step) => Math.round(from(v) / step) / (1 / step);\n\nexport const euclideanModulo = (v, n) => ((v % n) + n) % n;\nexport const lerp = (a, b, t) => a + (b - a) * t;\nexport function copyExistingProperties(dst, src) {\n for (const key in src) {\n if (key in dst) {\n dst[key] = src[key];\n }\n }\n return dst;\n}\n\nexport const mapRange = (v, inMin, inMax, outMin, outMax) => (v - inMin) * (outMax - outMin) / (inMax - inMin) + outMin;\n\nexport const makeRangeConverters = ({from, to}) => {\n return {\n to: v => mapRange(v, ...from, ...to),\n from: v => [true, mapRange(v, ...to, ...from)],\n };\n};\n\nexport const makeRangeOptions = ({from, to, step}) => {\n return {\n min: to[0],\n max: to[1],\n ...(step && {step}),\n converters: makeRangeConverters({from, to}),\n };\n};\n\n// TODO: remove an use one in conversions. Move makeRangeConverters there?\nexport const identity = {\n to: v => v,\n from: v => [true, v],\n};\nexport function makeMinMaxPair(gui, properties, minPropName, maxPropName, options) {\n const { converters: { from } = identity } = options;\n const { min, max } = options;\n const guiMinRange = options.minRange || 0;\n const valueMinRange = from(guiMinRange)[1];\n const minGui = gui\n .add(properties, minPropName, {\n ...options,\n min,\n max: max - guiMinRange,\n })\n .onChange(v => {\n maxGui.setValue(Math.min(max, Math.max(v + valueMinRange, properties[maxPropName])));\n });\n const maxGui = gui\n .add(properties, maxPropName, {\n ...options,\n min: min + guiMinRange,\n max,\n })\n .onChange(v => {\n minGui.setValue(Math.max(min, Math.min(v - valueMinRange, properties[minPropName])));\n });\n return [ minGui, maxGui ];\n}\n\n","import { removeArrayElem } from '../libs/utils.js';\n\nexport default class View {\n domElement: HTMLElement;\n\n #childDestElem: HTMLElement;\n #views: View[] = [];\n\n constructor(elem: HTMLElement) {\n this.domElement = elem;\n this.#childDestElem = elem;\n }\n addElem(elem: HTMLElement) {\n this.#childDestElem.appendChild(elem);\n return elem;\n }\n removeElem(elem: HTMLElement) {\n this.#childDestElem.removeChild(elem);\n return elem;\n }\n pushSubElem(elem: HTMLElement) {\n this.#childDestElem.appendChild(elem);\n this.#childDestElem = elem;\n }\n popSubElem() {\n this.#childDestElem = this.#childDestElem.parentElement!;\n }\n add(view: View) {\n this.#views.push(view);\n this.addElem(view.domElement);\n return view;\n }\n remove(view: View) {\n this.removeElem(view.domElement);\n removeArrayElem(this.#views, view);\n return view;\n }\n pushSubView(view: View) {\n this.pushSubElem(view.domElement);\n }\n popSubView() {\n this.popSubElem();\n }\n setOptions(options: any) {\n for (const view of this.#views) {\n view.setOptions(options);\n }\n }\n updateDisplayIfNeeded(newV: any, ignoreCache?: boolean) {\n for (const view of this.#views) {\n view.updateDisplayIfNeeded(newV, ignoreCache);\n }\n return this;\n }\n $(selector: string) {\n return this.domElement.querySelector(selector);\n }\n}","import { createElem } from '../libs/elem.js';\nimport { removeArrayElem } from '../libs/utils.js';\nimport View from '../views/View.js';\n\nexport default class Controller extends View {\n #changeFns;\n #finishChangeFns;\n #parent;\n\n constructor(className) {\n super(createElem('div', {className: 'muigui-controller'}));\n this.#changeFns = [];\n this.#finishChangeFns = [];\n // we need the specialization to come last so it takes precedence.\n if (className) {\n this.domElement.classList.add(className);\n }\n }\n get parent() {\n return this.#parent;\n }\n setParent(parent) {\n this.#parent = parent;\n this.enable(!this.disabled());\n }\n show(show = true) {\n this.domElement.classList.toggle('muigui-hide', !show);\n this.domElement.classList.toggle('muigui-show', show);\n return this;\n }\n hide() {\n return this.show(false);\n }\n disabled() {\n return !!this.domElement.closest('.muigui-disabled');\n }\n\n enable(enable = true) {\n this.domElement.classList.toggle('muigui-disabled', !enable);\n\n // If disabled we need to set the attribute 'disabled=true' to all\n // input/select/button/textarea's below\n //\n // If enabled we need to set the attribute 'disabled=false' to all below\n // until we hit a disabled controller.\n //\n // ATM the problem is we can find the input/select/button/textarea elements\n // but we can't easily find which controller they belong do.\n // But we don't need to? We can just check up if it or parent has\n // '.muigui-disabled'\n ['input', 'button', 'select', 'textarea'].forEach(tag => {\n this.domElement.querySelectorAll(tag).forEach(elem => {\n const disabled = !!elem.closest('.muigui-disabled');\n elem.disabled = disabled;\n });\n });\n\n return this;\n }\n disable(disable = true) {\n return this.enable(!disable);\n }\n onChange(fn) {\n this.removeChange(fn);\n this.#changeFns.push(fn);\n return this;\n }\n removeChange(fn) {\n removeArrayElem(this.#changeFns, fn);\n return this;\n }\n onFinishChange(fn) {\n this.removeFinishChange(fn);\n this.#finishChangeFns.push(fn);\n return this;\n }\n removeFinishChange(fn) {\n removeArrayElem(this.#finishChangeFns, fn);\n return this;\n }\n #callListeners(fns, newV) {\n for (const fn of fns) {\n fn.call(this, newV);\n }\n }\n emitChange(value, object, property) {\n this.#callListeners(this.#changeFns, value);\n if (this.#parent) {\n if (object === undefined) {\n this.#parent.emitChange(value);\n } else {\n this.#parent.emitChange({\n object,\n property,\n value,\n controller: this,\n });\n }\n }\n }\n emitFinalChange(value, object, property) {\n this.#callListeners(this.#finishChangeFns, value);\n if (this.#parent) {\n if (object === undefined) {\n this.#parent.emitChange(value);\n } else {\n this.#parent.emitFinalChange({\n object,\n property,\n value,\n controller: this,\n });\n }\n }\n }\n updateDisplay() {\n // placeholder. override\n }\n getColors() {\n const toCamelCase = s => s.replace(/-([a-z])/g, (m, m1) => m1.toUpperCase());\n const keys = [\n 'color',\n 'bg-color',\n 'value-color',\n 'value-bg-color',\n 'hover-bg-color',\n 'menu-bg-color',\n 'menu-sep-color',\n 'disabled-color',\n ];\n const div = createElem('div');\n this.domElement.appendChild(div);\n const colors = Object.fromEntries(keys.map(key => {\n div.style.color = `var(--${key})`;\n const s = getComputedStyle(div);\n return [toCamelCase(key), s.color];\n }));\n div.remove();\n return colors;\n }\n}\n","import {\n createElem,\n} from '../libs/elem.js';\nimport { copyExistingProperties } from '../libs/utils.js';\nimport Controller from './Controller.js';\n\nexport default class Button extends Controller {\n #object;\n #property;\n #buttonElem;\n #options = {\n name: '',\n };\n\n constructor(object, property, options = {}) {\n super('muigui-button', '');\n this.#object = object;\n this.#property = property;\n\n this.#buttonElem = this.addElem(\n createElem('button', {\n type: 'button',\n onClick: () => {\n this.#object[this.#property](this);\n },\n }));\n this.setOptions({name: property, ...options});\n }\n setOptions(options) {\n copyExistingProperties(this.#options, options);\n const {name} = this.#options;\n this.#buttonElem.textContent = name;\n }\n}","import { isTypedArray } from '../libs/utils.js';\nimport View from './View.js';\n\nfunction arraysEqual(a, b) {\n if (a.length !== b.length) {\n return false;\n }\n for (let i = 0; i < a.length; ++i) {\n if (a[i] !== b[i]) {\n return false;\n }\n }\n return true;\n}\n\nfunction copyArrayElementsFromTo(src, dst) {\n dst.length = src.length;\n for (let i = 0; i < src.length; ++i) {\n dst[i] = src[i];\n }\n}\n\nexport default class EditView extends View {\n #oldV;\n #updateCheck;\n\n #checkArrayNeedsUpdate(newV) {\n // It's an array, we need to compare all elements\n // Example, vec2, [r,g,b], ...\n const needUpdate = !arraysEqual(newV, this.#oldV);\n if (needUpdate) {\n copyArrayElementsFromTo(newV, this.#oldV);\n }\n return needUpdate;\n }\n\n #checkTypedArrayNeedsUpdate() {\n let once = true;\n return function checkTypedArrayNeedsUpdateImpl(newV) {\n // It's a typedarray, we need to compare all elements\n // Example: Float32Array([r, g, b])\n let needUpdate = once;\n once = false;\n if (!needUpdate) {\n needUpdate = !arraysEqual(newV, this.#oldV);\n }\n return needUpdate;\n };\n }\n\n #checkObjectNeedsUpdate(newV) {\n let needUpdate = false;\n for (const key in newV) {\n if (newV[key] !== this.#oldV[key]) {\n needUpdate = true;\n this.#oldV[key] = newV[key];\n }\n }\n return needUpdate;\n }\n\n #checkValueNeedsUpdate(newV) {\n const needUpdate = newV !== this.#oldV;\n this.#oldV = newV;\n return needUpdate;\n }\n\n #getUpdateCheckForType(newV) {\n if (Array.isArray(newV)) {\n this.#oldV = [];\n return this.#checkArrayNeedsUpdate.bind(this);\n } else if (isTypedArray(newV)) {\n this.#oldV = new newV.constructor(newV);\n return this.#checkTypedArrayNeedsUpdate(this);\n } else if (typeof newV === 'object') {\n this.#oldV = {};\n return this.#checkObjectNeedsUpdate.bind(this);\n } else {\n return this.#checkValueNeedsUpdate.bind(this);\n }\n }\n\n // The point of this is updating DOM elements\n // is slow but if we've called `listen` then\n // every frame we're going to try to update\n // things with the current value so if nothing\n // has changed then skip it.\n updateDisplayIfNeeded(newV, ignoreCache) {\n this.#updateCheck = this.#updateCheck || this.#getUpdateCheckForType(newV);\n // Note: We call #updateCheck first because it updates\n // the cache\n if (this.#updateCheck(newV) || ignoreCache) {\n this.updateDisplay(newV);\n }\n }\n setOptions(/*options*/) {\n // override this\n return this;\n }\n}\n","import { createElem } from '../libs/elem.js';\nimport EditView from './EditView.js';\n\nexport default class CheckboxView extends EditView {\n #checkboxElem;\n constructor(setter, id) {\n const checkboxElem = createElem('input', {\n type: 'checkbox',\n id,\n onInput: () => {\n setter.setValue(checkboxElem.checked);\n },\n onChange: () => {\n setter.setFinalValue(checkboxElem.checked);\n },\n });\n super(createElem('label', {}, [checkboxElem]));\n this.#checkboxElem = checkboxElem;\n }\n updateDisplay(v) {\n this.#checkboxElem.checked = v;\n }\n}\n","import { removeArrayElem } from './utils.js';\n\nconst tasks = [];\nconst tasksToRemove = new Set();\n\nlet requestId;\nlet processing;\n\nfunction removeTasks() {\n if (!tasksToRemove.size) {\n return;\n }\n\n if (processing) {\n queueProcessing();\n return;\n }\n\n tasksToRemove.forEach(task => {\n removeArrayElem(tasks, task);\n });\n tasksToRemove.clear();\n}\n\nfunction processTasks() {\n requestId = undefined;\n processing = true;\n for (const task of tasks) {\n if (!tasksToRemove.has(task)) {\n task();\n }\n }\n processing = false;\n removeTasks();\n queueProcessing();\n}\n\nfunction queueProcessing() {\n if (!requestId && tasks.length) {\n requestId = requestAnimationFrame(processTasks);\n }\n}\n\nexport function addTask(fn) {\n tasks.push(fn);\n queueProcessing();\n}\n\nexport function removeTask(fn) {\n tasksToRemove.set(fn);\n\n const ndx = tasks.indexOf(fn);\n if (ndx >= 0) {\n tasks.splice(ndx, 1);\n }\n}","let id = 0;\n\nexport function makeId() {\n return `muigui-${++id}`;\n}\n","import { createElem } from '../libs/elem.js';\nimport View from './View.js';\n\nexport default class ValueView extends View {\n constructor(className = '') {\n super(createElem('div', {className: 'muigui-value'}));\n if (className) {\n this.domElement.classList.add(className);\n }\n }\n}","import { createElem } from '../libs/elem.js';\nimport { makeId } from '../libs/ids.js';\nimport ValueView from '../views/ValueView.js';\nimport Controller from './Controller.js';\n\nexport default class LabelController extends Controller {\n #id;\n #nameElem;\n\n constructor(className = '', name = '') {\n super('muigui-label-controller');\n this.#id = makeId();\n this.#nameElem = createElem('label', {for: this.#id});\n this.domElement.appendChild(this.#nameElem);\n this.pushSubView(new ValueView(className));\n this.name(name);\n }\n get id() {\n return this.#id;\n }\n name(name) {\n if (this.#nameElem.title === this.#nameElem.textContent) {\n this.#nameElem.title = name;\n }\n this.#nameElem.textContent = name;\n return this;\n }\n tooltip(tip) {\n this.#nameElem.title = tip;\n }\n}\n\n","import {addTask, removeTask} from '../libs/taskrunner.js';\nimport { isTypedArray } from '../libs/utils.js';\nimport LabelController from './LabelController.js';\n\nexport default class ValueController extends LabelController {\n #object;\n #property;\n #initialValue;\n #listening;\n #views;\n #updateFn;\n\n constructor(object, property, className = '') {\n super(className, property);\n this.#object = object;\n this.#property = property;\n this.#initialValue = this.getValue();\n this.#listening = false;\n this.#views = [];\n }\n get initialValue() {\n return this.#initialValue;\n }\n get object() {\n return this.#object;\n }\n get property() {\n return this.#property;\n }\n add(view) {\n this.#views.push(view);\n super.add(view);\n this.updateDisplay();\n return view;\n }\n #setValueImpl(v, ignoreCache) {\n let isDifferent = false;\n if (typeof v === 'object') {\n const dst = this.#object[this.#property];\n // don't replace objects, just their values.\n if (Array.isArray(v) || isTypedArray(v)) {\n for (let i = 0; i < v.length; ++i) {\n isDifferent ||= dst[i] !== v[i];\n dst[i] = v[i];\n }\n } else {\n for (const key of Object.keys(v)) {\n isDifferent ||= dst[key] !== v[key];\n }\n Object.assign(dst, v);\n }\n } else {\n isDifferent = this.#object[this.#property] !== v;\n this.#object[this.#property] = v;\n }\n this.updateDisplay(ignoreCache);\n if (isDifferent) {\n this.emitChange(this.getValue(), this.#object, this.#property);\n }\n return isDifferent;\n }\n setValue(v) {\n this.#setValueImpl(v);\n }\n setFinalValue(v) {\n const isDifferent = this.#setValueImpl(v, true);\n if (isDifferent) {\n this.emitFinalChange(this.getValue(), this.#object, this.#property);\n }\n return this;\n }\n updateDisplay(ignoreCache) {\n const newV = this.getValue();\n for (const view of this.#views) {\n view.updateDisplayIfNeeded(newV, ignoreCache);\n }\n return this;\n }\n setOptions(options) {\n for (const view of this.#views) {\n view.setOptions(options);\n }\n this.updateDisplay();\n return this;\n }\n getValue() {\n return this.#object[this.#property];\n }\n value(v) {\n this.setValue(v);\n return this;\n }\n reset() {\n this.setValue(this.#initialValue);\n return this;\n }\n listen(listen = true) {\n if (!this.#updateFn) {\n this.#updateFn = this.updateDisplay.bind(this);\n }\n if (listen) {\n if (!this.#listening) {\n this.#listening = true;\n addTask(this.#updateFn);\n }\n } else {\n if (this.#listening) {\n this.#listening = false;\n removeTask(this.#updateFn);\n }\n }\n return this;\n }\n}\n\n","import CheckboxView from '../views/CheckboxView.js';\nimport ValueController from './ValueController.js';\n\nexport default class Checkbox extends ValueController {\n constructor(object, property) {\n super(object, property, 'muigui-checkbox');\n const id = this.id;\n this.add(new CheckboxView(this, id));\n this.updateDisplay();\n }\n}","import {\n makeRangeConverters,\n} from './utils.js';\n\nexport const identity = {\n to: v => v,\n from: v => [true, v],\n};\n\n// from: from string to value\n// to: from value to string\nexport const strToNumber = {\n to: v => v.toString(),\n from: v => {\n const newV = parseFloat(v);\n return [!Number.isNaN(newV), newV];\n },\n};\n\nexport const converters = {\n radToDeg: makeRangeConverters({to: [0, 180], from: [0, Math.PI]}),\n};\n","export function createWheelHelper() {\n let wheelAccum = 0;\n return function (e, step, wheelScale = 5) {\n wheelAccum -= e.deltaY * step / wheelScale;\n const wheelSteps = Math.floor(Math.abs(wheelAccum) / step) * Math.sign(wheelAccum);\n const delta = wheelSteps * step;\n wheelAccum -= delta;\n return delta;\n };\n}\n","import { createElem } from '../libs/elem.js';\nimport { strToNumber } from '../libs/conversions.js';\nimport { createWheelHelper } from '../libs/wheel.js';\nimport { clamp, copyExistingProperties, stepify } from '../libs/utils.js';\nimport EditView from './EditView.js';\n\nexport default class NumberView extends EditView {\n #to;\n #from;\n #step;\n #skipUpdate;\n #options = {\n step: 0.01,\n converters: strToNumber,\n min: Number.NEGATIVE_INFINITY,\n max: Number.POSITIVE_INFINITY,\n };\n\n constructor(setter, options) {\n const setValue = setter.setValue.bind(setter);\n const setFinalValue = setter.setFinalValue.bind(setter);\n const wheelHelper = createWheelHelper();\n super(createElem('input', {\n type: 'number',\n onInput: () => this.#handleInput(setValue, true),\n onChange: () => this.#handleInput(setFinalValue, false),\n onWheel: e => {\n e.preventDefault();\n const {min, max, step} = this.#options;\n const delta = wheelHelper(e, step);\n const v = parseFloat(this.domElement.value);\n const newV = clamp(stepify(v + delta, v => v, step), min, max);\n setter.setValue(newV);\n },\n }));\n this.setOptions(options);\n }\n #handleInput(setFn, skipUpdate) {\n const v = parseFloat(this.domElement.value);\n const [valid, newV] = this.#from(v);\n let inRange;\n if (valid && !Number.isNaN(v)) {\n const {min, max} = this.#options;\n inRange = newV >= min && newV <= max;\n this.#skipUpdate = skipUpdate;\n setFn(clamp(newV, min, max));\n }\n this.domElement.classList.toggle('muigui-invalid-value', !valid || !inRange);\n }\n updateDisplay(v) {\n if (!this.#skipUpdate) {\n this.domElement.value = stepify(v, this.#to, this.#step);\n }\n this.#skipUpdate = false;\n }\n setOptions(options) {\n copyExistingProperties(this.#options, options);\n const {\n step,\n converters: {to, from},\n } = this.#options;\n this.#to = to;\n this.#from = from;\n this.#step = step;\n return this;\n }\n}\n","\nimport NumberView from '../views/NumberView.js';\nimport ValueController from './ValueController.js';\n\n// Wanted to name this `Number` but it conflicts with\n// JavaScript `Number`. It most likely wouldn't be\n// an issue? But users might `import {Number} ...` and\n// things would break.\nexport default class TextNumber extends ValueController {\n #textView;\n #step;\n\n constructor(object, property, options = {}) {\n super(object, property, 'muigui-checkbox');\n this.#textView = this.add(new NumberView(this, options));\n this.updateDisplay();\n }\n}","import { createElem } from '../libs/elem.js';\nimport EditView from './EditView.js';\n\nexport default class SelectView extends EditView {\n #values;\n\n constructor(setter, keyValues) {\n const values = [];\n super(createElem('select', {\n onChange: () => {\n setter.setFinalValue(this.#values[this.domElement.selectedIndex]);\n },\n }, keyValues.map(([key, value]) => {\n values.push(value);\n return createElem('option', {textContent: key});\n })));\n this.#values = values;\n }\n updateDisplay(v) {\n const ndx = this.#values.indexOf(v);\n this.domElement.selectedIndex = ndx;\n }\n}\n","\n// 4 cases\n// (a) keyValues is array of arrays, each sub array is key value\n// (b) keyValues is array and value is number then keys = array contents, value = index\n// (c) keyValues is array and value is not number, key = array contents, value = array contents\n// (d) keyValues is object then key->value\nexport function convertToKeyValues(keyValues, valueIsNumber) {\n if (Array.isArray(keyValues)) {\n if (Array.isArray(keyValues[0])) {\n // (a) keyValues is array of arrays, each sub array is key value\n return keyValues;\n } else {\n if (valueIsNumber) {\n // (b) keyValues is array and value is number then keys = array contents, value = index\n return keyValues.map((v, ndx) => [v, ndx]);\n } else {\n // (c) keyValues is array and value is not number, key = array contents, value = array contents\n return keyValues.map(v => [v, v]);\n }\n }\n } else {\n // (d)\n return [...Object.entries(keyValues)];\n }\n}\n","import SelectView from '../views/SelectView.js';\nimport ValueController from './ValueController.js';\nimport { convertToKeyValues } from '../libs/key-values.js';\n\nexport default class Select extends ValueController {\n constructor(object, property, options) {\n super(object, property, 'muigui-select');\n const valueIsNumber = typeof this.getValue() === 'number';\n const {keyValues: keyValuesInput} = options;\n const keyValues = convertToKeyValues(keyValuesInput, valueIsNumber);\n this.add(new SelectView(this, keyValues));\n this.updateDisplay();\n }\n}","import { createElem } from '../libs/elem.js';\nimport { identity } from '../libs/conversions.js';\nimport { clamp, copyExistingProperties, stepify } from '../libs/utils.js';\nimport { createWheelHelper } from '../libs/wheel.js';\nimport EditView from './EditView.js';\n\nexport default class RangeView extends EditView {\n #to;\n #from;\n #step;\n #skipUpdate;\n #options = {\n step: 0.01,\n min: 0,\n max: 1,\n converters: identity,\n };\n\n constructor(setter, options) {\n const wheelHelper = createWheelHelper();\n super(createElem('input', {\n type: 'range',\n onInput: () => {\n this.#skipUpdate = true;\n const {min, max, step} = this.#options;\n const v = parseFloat(this.domElement.value);\n const newV = clamp(stepify(v, v => v, step), min, max);\n const [valid, validV] = this.#from(newV);\n if (valid) {\n setter.setValue(validV);\n }\n },\n onChange: () => {\n this.#skipUpdate = true;\n const {min, max, step} = this.#options;\n const v = parseFloat(this.domElement.value);\n const newV = clamp(stepify(v, v => v, step), min, max);\n const [valid, validV] = this.#from(newV);\n if (valid) {\n setter.setFinalValue(validV);\n }\n },\n onWheel: e => {\n e.preventDefault();\n const [valid, v] = this.#from(parseFloat(this.domElement.value));\n if (!valid) {\n return;\n }\n const {min, max, step} = this.#options;\n const delta = wheelHelper(e, step);\n const newV = clamp(stepify(v + delta, v => v, step), min, max);\n setter.setValue(newV);\n },\n }));\n this.setOptions(options);\n }\n updateDisplay(v) {\n if (!this.#skipUpdate) {\n this.domElement.value = stepify(v, this.#to, this.#step);\n }\n this.#skipUpdate = false;\n }\n setOptions(options) {\n copyExistingProperties(this.#options, options);\n const {\n step,\n min,\n max,\n converters: {to, from},\n } = this.#options;\n this.#to = to;\n this.#from = from;\n this.#step = step;\n this.domElement.step = step;\n this.domElement.min = min;\n this.domElement.max = max;\n return this;\n }\n}","import ValueController from './ValueController.js';\nimport NumberView from '../views/NumberView.js';\nimport RangeView from '../views/RangeView.js';\n\nexport default class Range extends ValueController {\n constructor(object, property, options) {\n super(object, property, 'muigui-range');\n this.add(new RangeView(this, options));\n this.add(new NumberView(this, options));\n }\n}\n","import { createElem } from '../libs/elem.js';\nimport { identity } from '../libs/conversions.js';\nimport EditView from './EditView.js';\nimport { copyExistingProperties } from '../libs/utils.js';\n\nexport default class TextView extends EditView {\n #to;\n #from;\n #skipUpdate;\n #options = {\n converters: identity,\n };\n\n constructor(setter, options) {\n const setValue = setter.setValue.bind(setter);\n const setFinalValue = setter.setFinalValue.bind(setter);\n super(createElem('input', {\n type: 'text',\n onInput: () => this.#handleInput(setValue, true),\n onChange: () => this.#handleInput(setFinalValue, false),\n }));\n this.setOptions(options);\n }\n #handleInput(setFn, skipUpdate) {\n const [valid, newV] = this.#from(this.domElement.value);\n if (valid) {\n this.#skipUpdate = skipUpdate;\n setFn(newV);\n }\n this.domElement.style.color = valid ? '' : 'var(--invalid-color)';\n\n }\n updateDisplay(v) {\n if (!this.#skipUpdate) {\n this.domElement.value = this.#to(v);\n this.domElement.style.color = '';\n }\n this.#skipUpdate = false;\n }\n setOptions(options) {\n copyExistingProperties(this.#options, options);\n const {\n converters: {to, from},\n } = this.#options;\n this.#to = to;\n this.#from = from;\n return this;\n }\n}\n","import TextView from '../views/TextView.js';\nimport ValueController from './ValueController.js';\n\nexport default class Text extends ValueController {\n constructor(object, property) {\n super(object, property, 'muigui-checkbox');\n this.add(new TextView(this));\n this.updateDisplay();\n }\n}","import Button from './Button.js';\nimport Checkbox from './Checkbox.js';\nimport TextNumber from './TextNumber.js';\nimport Select from './Select.js';\nimport Range from './Range.js';\nimport Text from './Text.js';\n\n// const isConversion = o => typeof o.to === 'function' && typeof o.from === 'function';\n\n/**\n * possible inputs\n * add(o, p, min: number, max: number)\n * add(o, p, min: number, max: number, step: number)\n * add(o, p, array: [value])\n * add(o, p, array: [[key, value]])\n *\n * @param {*} object\n * @param {string} property\n * @param {...any} args\n * @returns {Controller}\n */\nexport function createController(object, property, ...args) {\n const [arg1] = args;\n if (Array.isArray(arg1)) {\n return new Select(object, property, {keyValues: arg1});\n }\n\n const t = typeof object[property];\n switch (t) {\n case 'number':\n if (typeof args[0] === 'number' && typeof args[1] === 'number') {\n const min = args[0];\n const max = args[1];\n const step = args[2];\n return new Range(object, property, {min, max, ...(step && {step})});\n }\n return args.length === 0\n ? new TextNumber(object, property, ...args)\n : new Range(object, property, ...args);\n case 'boolean':\n return new Checkbox(object, property, ...args);\n case 'function':\n return new Button(object, property, ...args);\n case 'string':\n return new Text(object, property, ...args);\n case 'undefined':\n throw new Error(`no property named ${property}`);\n default:\n throw new Error(`unhandled type ${t} for property ${property}`);\n }\n}","const clamp = (v, min, max) => Math.max(min, Math.min(max, v));\nconst lerp = (a, b, t) => a + (b - a) * t;\nconst fract = v => v >= 0 ? v % 1 : 1 - (v % 1);\n\nconst f0 = v => +v.toFixed(0); // converts to string (eg 1.2 => \"1\"), then converts back to number (eg, \"1.200\" => 1.2)\nconst f3 = v => +v.toFixed(3); // converts to string (eg 1.2 => \"1.200\"), then converts back to number (eg, \"1.200\" => 1.2)\n\nconst hexToUint32RGB = v => (parseInt(v.substring(1, 3), 16) << 16) |\n (parseInt(v.substring(3, 5), 16) << 8 ) |\n (parseInt(v.substring(5, 7), 16) );\nconst uint32RGBToHex = v => `#${(Math.round(v)).toString(16).padStart(6, '0')}`;\nconst hexToUint32RGBA = v => (parseInt(v.substring(1, 3), 16) * 2 ** 24) +\n (parseInt(v.substring(3, 5), 16) * 2 ** 16) +\n (parseInt(v.substring(5, 7), 16) * 2 ** 8) +\n (parseInt(v.substring(7, 9), 16) );\nconst uint32RGBAToHex = v => `#${(Math.round(v)).toString(16).padStart(8, '0')}`;\n\nexport const hexToUint8RGB = v => [\n parseInt(v.substring(1, 3), 16),\n parseInt(v.substring(3, 5), 16),\n parseInt(v.substring(5, 7), 16),\n];\nexport const uint8RGBToHex = v => `#${Array.from(v).map(v => v.toString(16).padStart(2, '0')).join('')}`;\n\nexport const hexToUint8RGBA = v => [\n parseInt(v.substring(1, 3), 16),\n parseInt(v.substring(3, 5), 16),\n parseInt(v.substring(5, 7), 16),\n parseInt(v.substring(7, 9), 16),\n];\nexport const uint8RGBAToHex = v => `#${Array.from(v).map(v => v.toString(16).padStart(2, '0')).join('')}`;\n\nexport const hexToFloatRGB = v => hexToUint8RGB(v).map(v => f3(v / 255));\nexport const floatRGBToHex = v => uint8RGBToHex(Array.from(v).map(v => Math.round(clamp(v * 255, 0, 255))));\n\nexport const hexToFloatRGBA = v => hexToUint8RGBA(v).map(v => f3(v / 255));\nexport const floatRGBAToHex = v => uint8RGBAToHex(Array.from(v).map(v => Math.round(clamp(v * 255, 0, 255))));\n\nconst scaleAndClamp = v => clamp(Math.round(v * 255), 0, 255).toString(16).padStart(2, '0');\n\nconst hexToObjectRGB = v => ({\n r: parseInt(v.substring(1, 3), 16) / 255,\n g: parseInt(v.substring(3, 5), 16) / 255,\n b: parseInt(v.substring(5, 7), 16) / 255,\n});\nconst objectRGBToHex = v => `#${scaleAndClamp(v.r)}${scaleAndClamp(v.g)}${scaleAndClamp(v.b)}`;\nconst hexToObjectRGBA = v => ({\n r: parseInt(v.substring(1, 3), 16) / 255,\n g: parseInt(v.substring(3, 5), 16) / 255,\n b: parseInt(v.substring(5, 7), 16) / 255,\n a: parseInt(v.substring(7, 9), 16) / 255,\n});\nconst objectRGBAToHex = v => `#${scaleAndClamp(v.r)}${scaleAndClamp(v.g)}${scaleAndClamp(v.b)}${scaleAndClamp(v.a)}`;\n\nconst hexToCssRGB = v => `rgb(${hexToUint8RGB(v).join(', ')})`;\nconst cssRGBRegex = /^\\s*rgb\\(\\s*(\\d+)\\s*,\\s*(\\d+)\\s*,\\s*(\\d+)\\s*\\)\\s*$/;\nconst cssRGBToHex = v => {\n const m = cssRGBRegex.exec(v);\n return uint8RGBToHex([m[1], m[2], m[3]].map(v => parseInt(v)));\n};\nconst hexToCssRGBA = v => `rgba(${hexToUint8RGBA(v).map((v, i) => i === 3 ? v / 255 : v).join(', ')})`;\nconst cssRGBARegex = /^\\s*rgba\\(\\s*(\\d+)\\s*,\\s*(\\d+)\\s*,\\s*(\\d+)\\s*,\\s*(\\d+\\.\\d+|\\d+)\\s*\\)\\s*$/;\nconst cssRGBAToHex = v => {\n const m = cssRGBARegex.exec(v);\n return uint8RGBAToHex([m[1], m[2], m[3], m[4]].map((v, i) => i === 3 ? (parseFloat(v) * 255 | 0) : parseInt(v)));\n};\n\nconst hexToCssHSL = v => {\n const hsl = rgbUint8ToHsl(hexToUint8RGB(v)).map(v => f0(v));\n return `hsl(${hsl[0]}, ${hsl[1]}%, ${hsl[2]}%)`;\n};\nconst hexToCssHSLA = v => {\n const hsla = rgbaUint8ToHsla(hexToUint8RGBA(v)).map((v, i) => i === 3 ? f3(v) : f0(v));\n return `hsl(${hsla[0]} ${hsla[1]}% ${hsla[2]}% / ${hsla[3]})`;\n};\nconst cssHSLRegex = /^\\s*hsl\\(\\s*(\\d+)(?:deg|)\\s*(?:,|)\\s*(\\d+)%\\s*(?:,|)\\s*(\\d+)%\\s*\\)\\s*$/;\nconst cssHSLARegex = /^\\s*hsl\\(\\s*(\\d+)(?:deg|)\\s*(?:,|)\\s*(\\d+)%\\s*(?:,|)\\s*(\\d+)%\\s*\\/\\s*(\\d+\\.\\d+|\\d+)\\s*\\)\\s*$/;\n\nconst hex3DigitTo6Digit = v => `${v[0]}${v[0]}${v[1]}${v[1]}${v[2]}${v[2]}`;\nconst cssHSLToHex = v => {\n const m = cssHSLRegex.exec(v);\n const rgb = hslToRgbUint8([m[1], m[2], m[3]].map(v => parseFloat(v)));\n return uint8RGBToHex(rgb);\n};\nconst cssHSLAToHex = v => {\n const m = cssHSLARegex.exec(v);\n const rgba = hslaToRgbaUint8([m[1], m[2], m[3], m[4]].map(v => parseFloat(v)));\n return uint8RGBAToHex(rgba);\n};\n\nconst euclideanModulo = (v, n) => ((v % n) + n) % n;\n\nexport function hslToRgbUint8([h, s, l]) {\n h = euclideanModulo(h, 360);\n s = clamp(s / 100, 0, 1);\n l = clamp(l / 100, 0, 1);\n\n const a = s * Math.min(l, 1 - l);\n\n function f(n) {\n const k = (n + h / 30) % 12;\n return l - a * Math.max(-1, Math.min(k - 3, 9 - k, 1));\n }\n\n return [f(0), f(8), f(4)].map(v => Math.round(v * 255));\n}\n\nexport function hslaToRgbaUint8([h, s, l, a]) {\n const rgb = hslToRgbUint8([h, s, l]);\n return [...rgb, a * 255 | 0];\n}\n\nexport function rgbFloatToHsl01([r, g, b]) {\n const max = Math.max(r, g, b);\n const min = Math.min(r, g, b);\n const l = (min + max) * 0.5;\n const d = max - min;\n let h = 0;\n let s = 0;\n\n if (d !== 0) {\n s = (l === 0 || l === 1)\n ? 0\n : (max - l) / Math.min(l, 1 - l);\n\n switch (max) {\n case r: h = (g - b) / d + (g < b ? 6 : 0); break;\n case g: h = (b - r) / d + 2; break;\n case b: h = (r - g) / d + 4;\n }\n }\n\n return [h / 6, s, l];\n}\n\nexport function rgbaFloatToHsla01([r, g, b, a]) {\n const hsl = rgbFloatToHsl01([r, g, b]);\n return [...hsl, a];\n}\n\nexport const rgbUint8ToHsl = (rgb) => {\n const [h, s, l] = rgbFloatToHsl01(rgb.map(v => v / 255));\n return [h * 360, s * 100, l * 100];\n};\n\nexport const rgbaUint8ToHsla = (rgba) => {\n const [h, s, l, a] = rgbaFloatToHsla01(rgba.map(v => v / 255));\n return [h * 360, s * 100, l * 100, a];\n};\n\nexport function hsv01ToRGBFloat([hue, sat, val]) {\n sat = clamp(sat, 0, 1);\n val = clamp(val, 0, 1);\n return [hue, hue + 2 / 3, hue + 1 / 3].map(\n v => lerp(1, clamp(Math.abs(fract(v) * 6 - 3.0) - 1, 0, 1), sat) * val\n );\n}\n\nexport function hsva01ToRGBAFloat([hue, sat, val, alpha]) {\n const rgb = hsv01ToRGBFloat([hue, sat, val]);\n return [...rgb, alpha];\n}\n\nconst round3 = v => Math.round(v * 1000) / 1000;\n\nexport function rgbFloatToHSV01([r, g, b]) {\n const p = b > g\n ? [b, g, -1, 2 / 3]\n : [g, b, 0, -1 / 3];\n const q = p[0] > r\n ? [p[0], p[1], p[3], r]\n : [r, p[1], p[2], p[0]];\n const d = q[0] - Math.min(q[3], q[1]);\n return [\n Math.abs(q[2] + (q[3] - q[1]) / (6 * d + Number.EPSILON)),\n d / (q[0] + Number.EPSILON),\n q[0],\n ].map(round3);\n}\n\nexport function rgbaFloatToHSVA01([r, g, b, a]) {\n const hsv = rgbFloatToHSV01([r, g, b]);\n return [...hsv, a];\n}\n\n// window.hsv01ToRGBFloat = hsv01ToRGBFloat;\n// window.rgbFloatToHSV01 = rgbFloatToHSV01;\n\n// Yea, meh!\nexport const hasAlpha = format => format.endsWith('a') || format.startsWith('hex8');\n\nconst cssStringFormats = [\n { re: /^#(?:[0-9a-f]){6}$/i, format: 'hex6' },\n { re: /^(?:[0-9a-f]){6}$/i, format: 'hex6-no-hash' },\n { re: /^#(?:[0-9a-f]){8}$/i, format: 'hex8' },\n { re: /^(?:[0-9a-f]){8}$/i, format: 'hex8-no-hash' },\n { re: /^#(?:[0-9a-f]){3}$/i, format: 'hex3' },\n { re: /^(?:[0-9a-f]){3}$/i, format: 'hex3-no-hash' },\n { re: cssRGBRegex, format: 'css-rgb' },\n { re: cssHSLRegex, format: 'css-hsl' },\n { re: cssRGBARegex, format: 'css-rgba' },\n { re: cssHSLARegex, format: 'css-hsla' },\n];\n\nfunction guessStringColorFormat(v) {\n for (const formatInfo of cssStringFormats) {\n if (formatInfo.re.test(v)) {\n return formatInfo;\n }\n }\n return undefined;\n}\n\nexport function guessFormat(v) {\n switch (typeof v) {\n case 'number':\n console.warn('can not reliably guess format based on a number. You should pass in a format like {format: \"uint32-rgb\"} or {format: \"uint32-rgb\"}');\n return v <= 0xFFFFFF ? 'uint32-rgb' : 'uint32-rgba';\n case 'string': {\n const formatInfo = guessStringColorFormat(v.trim());\n if (formatInfo) {\n return formatInfo.format;\n }\n break;\n }\n case 'object':\n if (v instanceof Uint8Array || v instanceof Uint8ClampedArray) {\n if (v.length === 3) {\n return 'uint8-rgb';\n } else if (v.length === 4) {\n return 'uint8-rgba';\n }\n } else if (v instanceof Float32Array) {\n if (v.length === 3) {\n return 'float-rgb';\n } else if (v.length === 4) {\n return 'float-rgba';\n }\n } else if (Array.isArray(v)) {\n if (v.length === 3) {\n return 'float-rgb';\n } else if (v.length === 4) {\n return 'float-rgba';\n }\n } else {\n if ('r' in v && 'g' in v && 'b' in v) {\n if ('a' in v) {\n return 'object-rgba';\n } else {\n return 'object-rgb';\n }\n }\n }\n }\n throw new Error(`unknown color format: ${v}`);\n}\n\nfunction fixHex6(v) {\n return v.trim(v);\n //const formatInfo = guessStringColorFormat(v.trim());\n //const fix = formatInfo ? formatInfo.fix : v => v;\n //return fix(v.trim());\n}\n\nfunction fixHex8(v) {\n return v.trim(v);\n //const formatInfo = guessStringColorFormat(v.trim());\n //const fix = formatInfo ? formatInfo.fix : v => v;\n //return fix(v.trim());\n}\n\nfunction hex6ToHex3(hex6) {\n return (hex6[1] === hex6[2] &&\n hex6[3] === hex6[4] &&\n hex6[5] === hex6[6])\n ? `#${hex6[1]}${hex6[3]}${hex6[5]}`\n : hex6;\n}\n\nconst hex3RE = /^(#|)([0-9a-f]{3})$/i;\nfunction hex3ToHex6(hex3) {\n const m = hex3RE.exec(hex3);\n if (m) {\n const [, , m2] = m;\n return `#${hex3DigitTo6Digit(m2)}`;\n }\n return hex3;\n}\n\nfunction fixHex3(v) {\n return hex6ToHex3(fixHex6(v));\n}\n\nconst strToRGBObject = (s) => {\n try {\n const json = s.replace(/([a-z])/g, '\"$1\"');\n const rgb = JSON.parse(json);\n if (Number.isNaN(rgb.r) || Number.isNaN(rgb.g) || Number.isNaN(rgb.b)) {\n throw new Error('not {r, g, b}');\n }\n return [true, rgb];\n } catch (e) {\n return [false];\n }\n};\n\nconst strToRGBAObject = (s) => {\n try {\n const json = s.replace(/([a-z])/g, '\"$1\"');\n const rgba = JSON.parse(json);\n if (Number.isNaN(rgba.r) || Number.isNaN(rgba.g) || Number.isNaN(rgba.b) || Number.isNaN(rgba.a)) {\n throw new Error('not {r, g, b, a}');\n }\n return [true, rgba];\n } catch (e) {\n return [false];\n }\n};\n\nconst strToCssRGB = s => {\n const m = cssRGBRegex.exec(s);\n if (!m) {\n return [false];\n }\n const v = [m[1], m[2], m[3]].map(v => parseInt(v));\n const outOfRange = v.find(v => v > 255);\n return [!outOfRange, `rgb(${v.join(', ')})`];\n};\n\nconst strToCssRGBA = s => {\n const m = cssRGBARegex.exec(s);\n if (!m) {\n return [false];\n }\n const v = [m[1], m[2], m[3], m[4]].map((v, i) => i === 3 ? parseFloat(v) : parseInt(v));\n const outOfRange = v.find(v => v > 255);\n return [!outOfRange, `rgba(${v.join(', ')})`];\n};\n\nconst strToCssHSL = s => {\n const m = cssHSLRegex.exec(s);\n if (!m) {\n return [false];\n }\n const v = [m[1], m[2], m[3]].map(v => parseFloat(v));\n const outOfRange = v.find(v => Number.isNaN(v));\n return [!outOfRange, `hsl(${v[0]}, ${v[1]}%, ${v[2]}%)`];\n};\n\nconst strToCssHSLA = s => {\n const m = cssHSLARegex.exec(s);\n if (!m) {\n return [false];\n }\n const v = [m[1], m[2], m[3], m[4]].map(v => parseFloat(v));\n const outOfRange = v.find(v => Number.isNaN(v));\n return [!outOfRange, `hsl(${v[0]} ${v[1]}% ${v[2]}% / ${v[3]})`];\n};\n\nconst rgbObjectToStr = rgb => {\n return `{r:${f3(rgb.r)}, g:${f3(rgb.g)}, b:${f3(rgb.b)}}`;\n};\nconst rgbaObjectToStr = rgba => {\n return `{r:${f3(rgba.r)}, g:${f3(rgba.g)}, b:${f3(rgba.b)}}, a:${f3(rgba.a)}}`;\n};\n\nconst strTo3IntsRE = /^\\s*(\\d+)\\s*,\\s*(\\d+)\\s*,\\s*(\\d+)\\s*$/;\nconst strTo3Ints = s => {\n const m = strTo3IntsRE.exec(s);\n if (!m) {\n return [false];\n }\n const v = [m[1], m[2], m[3]].map(v => parseInt(v));\n const outOfRange = v.find(v => v > 255);\n return [!outOfRange, v];\n};\n\nconst strTo4IntsRE = /^\\s*(\\d+)\\s*,\\s*(\\d+)\\s*,\\s*(\\d+)\\s*$/;\nconst strTo4Ints = s => {\n const m = strTo4IntsRE.exec(s);\n if (!m) {\n return [false];\n }\n const v = [m[1], m[2], m[3], m[4]].map(v => parseInt(v));\n const outOfRange = v.find(v => v > 255);\n return [!outOfRange, v];\n};\n\nconst strTo3Floats = s => {\n const numbers = s.split(',').map(s => s.trim());\n const v = numbers.map(v => parseFloat(v));\n if (v.length !== 3) {\n return [false];\n }\n // Note: using isNaN not Number.isNaN\n const badNdx = numbers.findIndex(v => isNaN(v));\n return [badNdx < 0, v.map(v => f3(v))];\n};\n\nconst strTo4Floats = s => {\n const numbers = s.split(',').map(s => s.trim());\n const v = numbers.map(v => parseFloat(v));\n if (v.length !== 4) {\n return [false];\n }\n // Note: using isNaN not Number.isNaN\n const badNdx = numbers.findIndex(v => isNaN(v));\n return [badNdx < 0, v.map(v => f3(v))];\n};\n\nconst strToUint32RGBRegex = /^\\s*(?:0x){0,1}([0-9a-z]{1,6})\\s*$/i;\nconst strToUint32RGB = s => {\n const m = strToUint32RGBRegex.exec(s);\n if (!m) {\n return [false];\n }\n return [true, parseInt(m[1], 16)];\n};\n\nconst strToUint32RGBARegex = /^\\s*(?:0x){0,1}([0-9a-z]{1,8})\\s*$/i;\nconst strToUint32RGBA = s => {\n const m = strToUint32RGBARegex.exec(s);\n if (!m) {\n return [false];\n }\n return [true, parseInt(m[1], 16)];\n};\n\nconst hex6RE = /^\\s*#[a-f0-9]{6}\\s*$|^\\s*#[a-f0-9]{3}\\s*$/i;\nconst hexNoHash6RE = /^\\s*[a-f0-9]{6}\\s*$/i;\nconst hex8RE = /^\\s*#[a-f0-9]{8}\\s*$/i;\nconst hexNoHash8RE = /^\\s*[a-f0-9]{8}\\s*$/i;\n\n// For each format converter\n//\n// fromHex/toHex convert from/to '#RRGGBB'\n//\n// fromHex converts from the string '#RRBBGG' to the format\n// (eg: for uint32-rgb, '#123456' becomes 0x123456)\n//\n// toHex converts from the format to '#RRGGBB'\n// (eg: for uint8-rgb, [16, 33, 50] becomes '#102132')\n//\n//\n// fromStr/toStr convert from/to what's in the input[type=text] element\n//\n// toStr converts from the format to its string representation\n// (eg, for object-rgb, {r: 1, g: 0.5, b:0} becomes \"{r: 1, g: 0.5, b:0}\")\n// ^object ^string\n//\n// fromStr converts its string representation to its format\n// (eg, for object-rgb) \"{r: 1, g: 0.5, b:0}\" becomes {r: 1, g: 0.5, b:0})\n// ^string ^object\n// fromString returns an array which is [valid, v]\n// where valid is true if the string was a valid and v is the converted\n// format if v is true.\n//\n// Note: toStr should convert to \"ideal\" form (whatever that is).\n// (eg, for css-rgb\n// \"{ r: 0.10000, g: 001, b: 0}\" becomes \"{r: 0.1, g: 1, b: 0}\"\n// notice that css-rgb is a string to a string\n// )\nexport const colorFormatConverters = {\n 'hex6': {\n color: {\n from: v => [true, v],\n to: fixHex6,\n },\n text: {\n from: v => [hex6RE.test(v), v.trim()],\n to: v => v,\n },\n },\n 'hex8': {\n color: {\n from: v => [true, v],\n to: fixHex8,\n },\n text: {\n from: v => [hex8RE.test(v), v.trim()],\n to: v => v,\n },\n },\n 'hex3': {\n color: {\n from: v => [true, fixHex3(v)],\n to: hex3ToHex6,\n },\n text: {\n from: v => [hex6RE.test(v), hex6ToHex3(v.trim())],\n to: v => v,\n },\n },\n 'hex6-no-hash': {\n color: {\n from: v => [true, v.substring(1)],\n to: v => `#${fixHex6(v)}`,\n },\n text: {\n from: v => [hexNoHash6RE.test(v), v.trim()],\n to: v => v,\n },\n },\n 'hex8-no-hash': {\n color: {\n from: v => [true, v.substring(1)],\n to: v => `#${fixHex8(v)}`,\n },\n text: {\n from: v => [hexNoHash8RE.test(v), v.trim()],\n to: v => v,\n },\n },\n 'hex3-no-hash': {\n color: {\n from: v => [true, fixHex3(v).substring(1)],\n to: hex3ToHex6,\n },\n text: {\n from: v => [hexNoHash6RE.test(v), hex6ToHex3(v.trim())],\n to: v => v,\n },\n },\n 'uint32-rgb': {\n color: {\n from: v => [true, hexToUint32RGB(v)],\n to: uint32RGBToHex,\n },\n text: {\n from: v => strToUint32RGB(v),\n to: v => `0x${v.toString(16).padStart(6, '0')}`,\n },\n },\n 'uint32-rgba': {\n color: {\n from: v => [true, hexToUint32RGBA(v)],\n to: uint32RGBAToHex,\n },\n text: {\n from: v => strToUint32RGBA(v),\n to: v => `0x${v.toString(16).padStart(8, '0')}`,\n },\n },\n 'uint8-rgb': {\n color: {\n from: v => [true, hexToUint8RGB(v)],\n to: uint8RGBToHex,\n },\n text: {\n from: strTo3Ints,\n to: v => v.join(', '),\n },\n },\n 'uint8-rgba': {\n color: {\n from: v => [true, hexToUint8RGBA(v)],\n to: uint8RGBAToHex,\n },\n text: {\n from: strTo4Ints,\n to: v => v.join(', '),\n },\n },\n 'float-rgb': {\n color: {\n from: v => [true, hexToFloatRGB(v)],\n to: floatRGBToHex,\n },\n text: {\n from: strTo3Floats,\n // need Array.from because map of Float32Array makes a Float32Array\n to: v => Array.from(v).map(v => f3(v)).join(', '),\n },\n },\n 'float-rgba': {\n color: {\n from: v => [true, hexToFloatRGBA(v)],\n to: floatRGBAToHex,\n },\n text: {\n from: strTo4Floats,\n // need Array.from because map of Float32Array makes a Float32Array\n to: v => Array.from(v).map(v => f3(v)).join(', '),\n },\n },\n 'object-rgb': {\n color: {\n from: v => [true, hexToObjectRGB(v)],\n to: objectRGBToHex,\n },\n text: {\n from: strToRGBObject,\n to: rgbObjectToStr,\n },\n },\n 'object-rgba': {\n color: {\n from: v => [true, hexToObjectRGBA(v)],\n to: objectRGBAToHex,\n },\n text: {\n from: strToRGBAObject,\n to: rgbaObjectToStr,\n },\n },\n 'css-rgb': {\n color: {\n from: v => [true, hexToCssRGB(v)],\n to: cssRGBToHex,\n },\n text: {\n from: strToCssRGB,\n to: v => strToCssRGB(v)[1],\n },\n },\n 'css-rgba': {\n color: {\n from: v => [true, hexToCssRGBA(v)],\n to: cssRGBAToHex,\n },\n text: {\n from: strToCssRGBA,\n to: v => strToCssRGBA(v)[1],\n },\n },\n 'css-hsl': {\n color: {\n from: v => [true, hexToCssHSL(v)],\n to: cssHSLToHex,\n },\n text: {\n from: strToCssHSL,\n to: v => strToCssHSL(v)[1],\n },\n },\n 'css-hsla': {\n color: {\n from: v => [true, hexToCssHSLA(v)],\n to: cssHSLAToHex,\n },\n text: {\n from: strToCssHSLA,\n to: v => strToCssHSLA(v)[1],\n },\n },\n};","import { createElem } from '../libs/elem.js';\nimport View from './View.js';\n\nexport default class ElementView extends View {\n constructor(tag, className) {\n super(createElem(tag, {className}));\n }\n}","import ElementView from '../views/ElementView.js';\nimport LabelController from './LabelController.js';\n\n// TODO: remove this? Should just be user side\nexport default class Canvas extends LabelController {\n #canvasElem;\n\n constructor() {\n super('muigui-canvas');\n this.#canvasElem = this.add(\n new ElementView('canvas', 'muigui-canvas'),\n ).domElement;\n }\n get canvas() {\n return this.#canvasElem;\n }\n}","import { createElem } from '../libs/elem.js';\nimport { identity } from '../libs/conversions.js';\nimport EditView from './EditView.js';\nimport { copyExistingProperties } from '../libs/utils.js';\n\nexport default class ColorView extends EditView {\n #to;\n #from;\n #colorElem;\n #skipUpdate;\n #options = {\n converters: identity,\n };\n\n constructor(setter, options) {\n const colorElem = createElem('input', {\n type: 'color',\n onInput: () => {\n const [valid, newV] = this.#from(colorElem.value);\n if (valid) {\n this.#skipUpdate = true;\n setter.setValue(newV);\n }\n },\n onChange: () => {\n const [valid, newV] = this.#from(colorElem.value);\n if (valid) {\n this.#skipUpdate = true;\n setter.setFinalValue(newV);\n }\n },\n });\n super(createElem('div', {}, [colorElem]));\n this.setOptions(options);\n this.#colorElem = colorElem;\n }\n updateDisplay(v) {\n if (!this.#skipUpdate) {\n this.#colorElem.value = this.#to(v);\n }\n this.#skipUpdate = false;\n }\n setOptions(options) {\n copyExistingProperties(this.#options, options);\n const {converters: {to, from}} = this.#options;\n this.#to = to;\n this.#from = from;\n return this;\n }\n}\n","import {\n colorFormatConverters,\n guessFormat,\n} from '../libs/color-utils.js';\nimport ValueController from './ValueController.js';\nimport TextView from '../views/TextView.js';\nimport ColorView from '../views/ColorView.js';\n\nexport default class Color extends ValueController {\n #colorView;\n #textView;\n\n constructor(object, property, options = {}) {\n super(object, property, 'muigui-color');\n const format = options.format || guessFormat(this.getValue());\n const {color, text} = colorFormatConverters[format];\n this.#colorView = this.add(new ColorView(this, {converters: color}));\n this.#textView = this.add(new TextView(this, {converters: text}));\n this.updateDisplay();\n }\n setOptions(options) {\n const {format} = options;\n if (format) {\n const {color, text} = colorFormatConverters[format];\n this.#colorView.setOptions({converters: color});\n this.#textView.setOptions({converters: text});\n }\n super.setOptions(options);\n return this;\n }\n}","import Controller from './Controller.js';\n\n// This feels like it should be something else like\n// gui.addController({className: 'muigui-divider')};\nexport default class Divider extends Controller {\n constructor() {\n super('muigui-divider');\n }\n}","import Controller from './Controller.js';\n\nexport default class Container extends Controller {\n #controllers;\n #childDestController;\n\n constructor(className) {\n super(className);\n this.#controllers = [];\n this.#childDestController = this;\n }\n get children() {\n return this.#controllers; // should we return a copy?\n }\n get controllers() {\n return this.#controllers.filter(c => !(c instanceof Container));\n }\n get folders() {\n return this.#controllers.filter(c => c instanceof Container);\n }\n reset(recursive = true) {\n for (const controller of this.#controllers) {\n if (!(controller instanceof Container) || recursive) {\n controller.reset(recursive);\n }\n }\n return this;\n }\n updateDisplay() {\n for (const controller of this.#controllers) {\n controller.updateDisplay();\n }\n return this;\n }\n remove(controller) {\n const ndx = this.#controllers.indexOf(controller);\n if (ndx >= 0) {\n const c = this.#controllers.splice(ndx, 1);\n const c0 = c[0];\n const elem = c0.domElement;\n elem.remove();\n c0.setParent(null);\n }\n return this;\n }\n #addControllerImpl(controller) {\n this.domElement.appendChild(controller.domElement);\n this.#controllers.push(controller);\n controller.setParent(this);\n return controller;\n }\n addController(controller) {\n return this.#childDestController.#addControllerImpl(controller);\n }\n pushContainer(container) {\n this.addController(container);\n this.#childDestController = container;\n return container;\n }\n popContainer() {\n this.#childDestController = this.#childDestController.parent;\n return this;\n }\n}\n","import { createElem } from '../libs/elem.js';\nimport Container from './Container.js';\n\nexport default class Folder extends Container {\n #labelElem;\n\n constructor(name = 'Controls', className = 'muigui-menu') {\n super(className);\n this.#labelElem = createElem('label');\n this.addElem(createElem('button', {\n type: 'button',\n onClick: () => this.toggleOpen(),\n }, [this.#labelElem]));\n this.pushContainer(new Container());\n this.name(name);\n this.open();\n }\n open(open = true) {\n this.domElement.classList.toggle('muigui-closed', !open);\n this.domElement.classList.toggle('muigui-open', open);\n return this;\n }\n close() {\n return this.open(false);\n }\n name(name) {\n this.#labelElem.textContent = name;\n return this;\n }\n title(title) {\n return this.name(title);\n }\n toggleOpen() {\n this.open(!this.domElement.classList.contains('muigui-open'));\n return this;\n }\n}\n","import Controller from './Controller.js';\n\n// This feels like it should be something else like\n// gui.addDividing = new Controller()\nexport default class Label extends Controller {\n constructor(text) {\n super('muigui-label');\n this.text(text);\n }\n text(text) {\n this.domElement.textContent = text;\n return this;\n }\n}","function noop() {\n}\n\nexport function computeRelativePosition(elem, event, start) {\n const rect = elem.getBoundingClientRect();\n const x = event.clientX - rect.left;\n const y = event.clientY - rect.top;\n const nx = x / rect.width;\n const ny = y / rect.height;\n start = start || [x, y];\n const dx = x - start[0];\n const dy = y - start[1];\n const ndx = dx / rect.width;\n const ndy = dy / rect.width;\n return {x, y, nx, ny, dx, dy, ndx, ndy};\n}\n\nexport function addTouchEvents(elem, {onDown = noop, onMove = noop, onUp = noop}) {\n let start;\n const pointerMove = function (event) {\n const e = {\n type: 'move',\n ...computeRelativePosition(elem, event, start),\n };\n onMove(e);\n };\n\n const pointerUp = function (event) {\n elem.releasePointerCapture(event.pointerId);\n elem.removeEventListener('pointermove', pointerMove);\n elem.removeEventListener('pointerup', pointerUp);\n\n document.body.style.backgroundColor = '';\n\n onUp('up');\n };\n\n const pointerDown = function (event) {\n elem.addEventListener('pointermove', pointerMove);\n elem.addEventListener('pointerup', pointerUp);\n elem.setPointerCapture(event.pointerId);\n\n const rel = computeRelativePosition(elem, event);\n start = [rel.x, rel.y];\n onDown({\n type: 'down',\n ...rel,\n });\n };\n\n elem.addEventListener('pointerdown', pointerDown);\n\n return function () {\n elem.removeEventListener('pointerdown', pointerDown);\n };\n}","import { createElem, getNewId } from '../libs/elem.js';\nimport { addTouchEvents } from '../libs/touch.js';\nimport { identity } from '../libs/conversions.js';\nimport { clamp } from '../libs/utils.js';\nimport EditView from './EditView.js';\nimport {\n hexToFloatRGB,\n hexToFloatRGBA,\n hsv01ToRGBFloat,\n hsva01ToRGBAFloat,\n rgbFloatToHSV01,\n rgbaFloatToHSVA01,\n floatRGBToHex,\n floatRGBAToHex,\n rgbaFloatToHsla01,\n} from '../libs/color-utils.js';\nimport { copyExistingProperties } from '../libs/utils.js';\n\nconst svg = `\n\n\n\n`;\n\nfunction connectFillTargets(elem) {\n elem.querySelectorAll('[data-src]').forEach(srcElem => {\n const id = getNewId();\n srcElem.id = id;\n elem.querySelectorAll(`[data-target=${srcElem.dataset.src}]`).forEach(targetElem => {\n targetElem.setAttribute('fill', `url(#${id})`);\n });\n });\n return elem;\n}\n\n// Was originally going to make alpha an option. Issue is\n// hard coded conversions?\nexport default class ColorChooserView extends EditView {\n #to;\n #from;\n #satLevelElem;\n #circleElem;\n #hueUIElem;\n #hueElem;\n #hueCursorElem;\n #alphaUIElem;\n #alphaElem;\n #alphaCursorElem;\n #hsva;\n #skipHueUpdate;\n #skipSatLevelUpdate;\n #skipAlphaUpdate;\n #options = {\n converters: identity,\n alpha: false,\n };\n #convertInternalToHex;\n #convertHexToInternal;\n\n constructor(setter, options) {\n super(createElem('div', {\n innerHTML: svg,\n className: 'muigui-no-scroll',\n }));\n this.#satLevelElem = this.domElement.children[0];\n this.#hueUIElem = this.domElement.children[1];\n this.#alphaUIElem = this.domElement.children[2];\n connectFillTargets(this.#satLevelElem);\n connectFillTargets(this.#hueUIElem);\n connectFillTargets(this.#alphaUIElem);\n this.#circleElem = this.$('.muigui-color-chooser-circle');\n this.#hueElem = this.$('[data-src=muigui-color-chooser-hue]');\n this.#hueCursorElem = this.$('.muigui-color-chooser-hue-cursor');\n this.#alphaElem = this.$('[data-src=muigui-color-chooser-alpha]');\n this.#alphaCursorElem = this.$('.muigui-color-chooser-alpha-cursor');\n\n const handleSatLevelChange = (e) => {\n const s = clamp(e.nx, 0, 1);\n const v = clamp(e.ny, 0, 1);\n this.#hsva[1] = s;\n this.#hsva[2] = (1 - v);\n this.#skipHueUpdate = true;\n this.#skipAlphaUpdate = true;\n const [valid, newV] = this.#from(this.#convertInternalToHex(this.#hsva));\n if (valid) {\n setter.setValue(newV);\n }\n };\n\n const handleHueChange = (e) => {\n const h = clamp(e.nx, 0, 1);\n this.#hsva[0] = h;\n this.#skipSatLevelUpdate = true;\n this.#skipAlphaUpdate = true;\n const [valid, newV] = this.#from(this.#convertInternalToHex(this.#hsva));\n if (valid) {\n setter.setValue(newV);\n }\n };\n\n const handleAlphaChange = (e) => {\n const a = clamp(e.nx, 0, 1);\n this.#hsva[3] = a;\n this.#skipHueUpdate = true;\n this.#skipSatLevelUpdate = true;\n const [valid, newV] = this.#from(this.#convertInternalToHex(this.#hsva));\n if (valid) {\n setter.setValue(newV);\n }\n };\n\n addTouchEvents(this.#satLevelElem, {\n onDown: handleSatLevelChange,\n onMove: handleSatLevelChange,\n });\n addTouchEvents(this.#hueUIElem, {\n onDown: handleHueChange,\n onMove: handleHueChange,\n });\n addTouchEvents(this.#alphaUIElem, {\n onDown: handleAlphaChange,\n onMove: handleAlphaChange,\n });\n this.setOptions(options);\n }\n updateDisplay(newV) {\n if (!this.#hsva) {\n this.#hsva = this.#convertHexToInternal(this.#to(newV));\n }\n {\n const [h, s, v, a = 1] = this.#convertHexToInternal(this.#to(newV));\n // Don't copy the hue if it was un-computable.\n if (!this.#skipHueUpdate) {\n this.#hsva[0] = s > 0.001 && v > 0.001 ? h : this.#hsva[0];\n }\n if (!this.#skipSatLevelUpdate) {\n this.#hsva[1] = s;\n this.#hsva[2] = v;\n }\n if (!this.#skipAlphaUpdate) {\n this.#hsva[3] = a;\n }\n }\n {\n const [h, s, v, a] = this.#hsva;\n const [hue, sat, lum] = rgbaFloatToHsla01(hsva01ToRGBAFloat(this.#hsva));\n\n if (!this.#skipHueUpdate) {\n this.#hueCursorElem.setAttribute('transform', `translate(${h * 64}, 0)`);\n }\n this.#hueElem.children[0].setAttribute('stop-color', `hsl(${hue * 360} 0% 100% / ${a})`);\n this.#hueElem.children[1].setAttribute('stop-color', `hsl(${hue * 360} 100% 50% / ${a})`);\n if (!this.#skipAlphaUpdate) {\n this.#alphaCursorElem.setAttribute('transform', `translate(${a * 64}, 0)`);\n }\n this.#alphaElem.children[0].setAttribute('stop-color', `hsl(${hue * 360} ${sat * 100}% ${lum * 100}% / 0)`);\n this.#alphaElem.children[1].setAttribute('stop-color', `hsl(${hue * 360} ${sat * 100}% ${lum * 100}% / 1)`);\n\n if (!this.#skipSatLevelUpdate) {\n this.#circleElem.setAttribute('cx', `${s * 64}`);\n this.#circleElem.setAttribute('cy', `${(1 - v) * 48}`);\n }\n }\n this.#skipHueUpdate = false;\n this.#skipSatLevelUpdate = false;\n this.#skipAlphaUpdate = false;\n }\n setOptions(options) {\n copyExistingProperties(this.#options, options);\n const {converters: {to, from}, alpha} = this.#options;\n this.#alphaUIElem.style.display = alpha ? '' : 'none';\n this.#convertInternalToHex = alpha\n ? v => floatRGBAToHex(hsva01ToRGBAFloat(v))\n : v => floatRGBToHex(hsv01ToRGBFloat(v));\n this.#convertHexToInternal = alpha\n ? v => rgbaFloatToHSVA01(hexToFloatRGBA(v))\n : v => rgbFloatToHSV01(hexToFloatRGB(v));\n this.#to = to;\n this.#from = from;\n return this;\n }\n}\n","import ElementView from '../views/ElementView.js';\nimport ValueController from './ValueController.js';\nimport { copyExistingProperties } from '../libs/utils.js';\nimport { createElem } from '../libs/elem.js';\n/*\n\nholder = new TabHolder\ntab = holder.add(new Tab(\"name\"))\ntab.add(...)\n\n\npc = new PopdownController\ntop = pc.add(new Row())\ntop.add(new Button());\nvalues = topRow.add(new Div())\nbottom = pc.add(new Row());\n\n\n\npc = new PopdownController\npc.addTop\npc.addTop\n\npc.addBottom\n\n\n*/\n\nexport default class PopDownController extends ValueController {\n #top;\n #valuesView;\n #checkboxElem;\n #bottom;\n #options = {\n open: false,\n };\n\n constructor(object, property, options = {}) {\n super(object, property, 'muigui-pop-down-controller');\n /*\n [ValueView\n [[B][values]] upper row\n [[ visual ]] lower row\n ]\n */\n this.#top = this.add(new ElementView('div', 'muigui-pop-down-top'));\n// this.#top.add(new CheckboxView(makeSetter(this.#options, 'open')));\n const checkboxElem = this.#top.addElem(createElem('input', {\n type: 'checkbox',\n onChange: () => {\n this.#options.open = checkboxElem.checked;\n this.updateDisplay();\n },\n }));\n this.#checkboxElem = checkboxElem;\n this.#valuesView = this.#top.add(new ElementView('div', 'muigui-pop-down-values'));\n this.#bottom = this.add(new ElementView('div', 'muigui-pop-down-bottom'));\n this.setOptions(options);\n }\n setKnobColor(bgCssColor/*, fgCssColor*/) {\n if (this.#checkboxElem) {\n this.#checkboxElem.style = `\n --range-color: ${bgCssColor};\n --value-bg-color: ${bgCssColor};\n `;\n }\n }\n updateDisplay() {\n super.updateDisplay();\n const {open} = this.#options;\n this.domElement.children[1].classList.toggle('muigui-open', open);\n this.domElement.children[1].classList.toggle('muigui-closed', !open);\n }\n setOptions(options) {\n copyExistingProperties(this.#options, options);\n super.setOptions(options);\n this.updateDisplay();\n }\n addTop(view) {\n return this.#valuesView.add(view);\n }\n addBottom(view) {\n return this.#bottom.add(view);\n }\n}","/* eslint-disable no-underscore-dangle */\nimport {\n colorFormatConverters,\n guessFormat,\n hasAlpha,\n hexToUint8RGB,\n hslToRgbUint8,\n rgbUint8ToHsl,\n uint8RGBToHex,\n} from '../libs/color-utils.js';\nimport ColorChooserView from '../views/ColorChooserView.js';\nimport TextView from '../views/TextView.js';\nimport PopDownController from './PopDownController.js';\n\nexport default class ColorChooser extends PopDownController {\n #colorView;\n #textView;\n #to;\n #setKnobHelper;\n\n constructor(object, property, options = {}) {\n super(object, property, 'muigui-color-chooser');\n const format = options.format || guessFormat(this.getValue());\n const {color, text} = colorFormatConverters[format];\n this.#to = color.to;\n this.#textView = new TextView(this, {converters: text, alpha: hasAlpha(format)});\n this.#colorView = new ColorChooserView(this, {converters: color, alpha: hasAlpha(format)});\n this.addTop(this.#textView);\n this.addBottom(this.#colorView);\n // WTF! FIX!\n this.#setKnobHelper = () => {\n if (this.#to) {\n const hex6Or8 = this.#to(this.getValue());\n const hsl = rgbUint8ToHsl(hexToUint8RGB(hex6Or8));\n hsl[2] = (hsl[2] + 50) % 100;\n const hex = uint8RGBToHex(hslToRgbUint8(hsl));\n this.setKnobColor(`${hex6Or8.substring(0, 7)}FF`, hex);\n }\n };\n this.updateDisplay();\n }\n updateDisplay() {\n super.updateDisplay();\n if (this.#setKnobHelper) {\n this.#setKnobHelper();\n }\n }\n setOptions(options) {\n super.setOptions(options);\n return this;\n }\n}\n","import { createElem } from '../libs/elem.js';\nimport View from '../views/View.js';\n\nfunction showCSS(ob) {\n if (ob.prototype.css) {\n showCSS(ob.prototype);\n }\n}\n\nexport default class Layout extends View {\n static css = 'bar';\n constructor(tag, className) {\n super(createElem(tag, {className}));\n\n showCSS(this);\n }\n}\n\n/*\nclass ValueController ?? {\n const row = this.add(new Row());\n const label = row.add(new Label());\n const div = row.add(new Div());\n const row = div.add(new Row());\n}\n*/\n\n/*\nclass MyCustomThing extends ValueController {\n constructor(object, property, options) {\n const topRow = this.add(new Row());\n const bottomRow = this.add(new Row());\n topRow.add(new NumberView());\n topRow.add(new NumberView());\n topRow.add(new NumberView());\n topRow.add(new NumberView());\n bottomRow.add(new DirectionView());\n bottomRow.add(new DirectionView());\n bottomRow.add(new DirectionView());\n bottomRow.add(new DirectionView());\n }\n}\n new Grid([\n [new\n ]\n */","import Layout from './Layout.js';\n\nexport default class Column extends Layout {\n constructor() {\n super('div', 'muigui-row');\n }\n}\n","import Layout from './Layout.js';\n\nexport default class Frame extends Layout {\n static css = 'foo';\n constructor() {\n super('div', 'muigui-frame');\n }\n static get foo() {\n return 'boo';\n }\n}\n","import Layout from './Layout.js';\n\nexport default class Grid extends Layout {\n constructor() {\n super('div', 'muigui-grid');\n }\n}\n","import Layout from './Layout.js';\n\nexport default class Row extends Layout {\n constructor() {\n super('div', 'muigui-row');\n }\n}\n","import css from './styles/muigui.css.js';\nimport {createElem} from './libs/elem.js';\nimport {createController} from './controllers/create-controller.js';\nimport {\n mapRange,\n makeRangeConverters,\n makeRangeOptions,\n makeMinMaxPair,\n} from './libs/utils.js';\nimport {\n converters\n} from './libs/conversions.js';\nimport {\n hasAlpha,\n guessFormat,\n} from './libs/color-utils.js';\nimport Canvas from './controllers/Canvas.js';\nimport Color from './controllers/Color.js';\nimport Divider from './controllers/Divider.js';\nimport Folder from './controllers/Folder.js';\nimport Label from './controllers/Label.js';\nimport Controller from './controllers/Controller.js';\nimport ColorChooser from './controllers/ColorChooser.js';\n\nimport Column from './layout/Column.js';\nimport Frame from './layout/Frame.js';\nimport Grid from './layout/Grid.js';\nimport Row from './layout/Row.js';\n\nexport {\n Column,\n Frame,\n Grid,\n Row,\n};\n\nexport class GUIFolder extends Folder {\n add(object, property, ...args) {\n const controller = object instanceof Controller\n ? object\n : createController(object, property, ...args);\n return this.addController(controller);\n }\n addCanvas(name) {\n return this.addController(new Canvas(name));\n }\n addColor(object, property, options = {}) {\n const value = object[property];\n if (hasAlpha(options.format || guessFormat(value))) {\n return this.addController(new ColorChooser(object, property, options));\n } else {\n return this.addController(new Color(object, property, options));\n }\n }\n addDivider() {\n return this.addController(new Divider());\n }\n addFolder(name) {\n return this.addController(new GUIFolder(name));\n }\n addLabel(text) {\n return this.addController(new Label(text));\n }\n}\n\nclass MuiguiElement extends HTMLElement {\n constructor() {\n super();\n this.shadow = this.attachShadow({mode: 'open'});\n }\n}\n\ncustomElements.define('muigui-element', MuiguiElement);\n\nconst baseStyleSheet = new CSSStyleSheet();\nbaseStyleSheet.replaceSync(css.default);\nconst userStyleSheet = new CSSStyleSheet();\n\nfunction makeStyleSheetUpdater(styleSheet) {\n let newCss;\n let newCssPromise;\n\n function updateStyle() {\n if (newCss && !newCssPromise) {\n const s = newCss;\n newCss = undefined;\n newCssPromise = styleSheet.replace(s).then(() => {\n newCssPromise = undefined;\n updateStyle();\n });\n }\n }\n\n return function updateStyleSheet(css) {\n newCss = css;\n updateStyle();\n };\n}\n\nconst updateBaseStyle = makeStyleSheetUpdater(baseStyleSheet);\nconst updateUserStyle = makeStyleSheetUpdater(userStyleSheet);\n\nexport class GUI extends GUIFolder {\n static converters = converters;\n static mapRange = mapRange;\n static makeRangeConverters = makeRangeConverters;\n static makeRangeOptions = makeRangeOptions;\n static makeMinMaxPair = makeMinMaxPair;\n #localStyleSheet = new CSSStyleSheet();\n\n constructor(options = {}) {\n super('Controls', 'muigui-root');\n if (options instanceof HTMLElement) {\n options = {parent: options};\n }\n const {\n autoPlace = true,\n width,\n title = 'Controls',\n } = options;\n let {\n parent,\n } = options;\n\n if (width) {\n this.domElement.style.width = /^\\d+$/.test(width) ? `${width}px` : width;\n }\n if (parent === undefined && autoPlace) {\n parent = document.body;\n this.domElement.classList.add('muigui-auto-place');\n }\n if (parent) {\n const muiguiElement = createElem('muigui-element');\n muiguiElement.shadowRoot.adoptedStyleSheets = [baseStyleSheet, userStyleSheet, this.#localStyleSheet];\n muiguiElement.shadow.appendChild(this.domElement);\n parent.appendChild(muiguiElement);\n }\n if (title) {\n this.title(title);\n }\n this.domElement.classList.add('muigui', 'muigui-colors');\n }\n setStyle(css) {\n this.#localStyleSheet.replace(css);\n }\n static setBaseStyles(css) {\n updateBaseStyle(css);\n }\n static getBaseStyleSheet() {\n return baseStyleSheet;\n }\n static setUserStyles(css) {\n updateUserStyle(css);\n }\n static getUserStyleSheet() {\n return userStyleSheet;\n }\n static setTheme(name) {\n GUI.setBaseStyles(`${css.default}\\n${css.themes[name] || ''}`);\n }\n}\n\nexport default GUI;\n","function noop() {\n}\n\nconst keyDirections = {\n ArrowLeft: [-1, 0],\n ArrowRight: [1, 0],\n ArrowUp: [0, -1],\n ArrowDown: [0, 1],\n};\n\n// This probably needs to be global\nexport function addKeyboardEvents(elem, {onDown = noop, onUp = noop}) {\n const keyDown = function (event) {\n const mult = event.shiftKey ? 10 : 1;\n const [dx, dy] = (keyDirections[event.key] || [0, 0]).map(v => v * mult);\n const fn = event.type === 'keydown' ? onDown : onUp;\n fn({\n type: event.type.substring(3),\n dx,\n dy,\n event,\n });\n };\n\n elem.addEventListener('keydown', keyDown);\n elem.addEventListener('keyup', keyDown);\n\n return function () {\n elem.removeEventListener('keydown', keyDown);\n elem.removeEventListener('keyup', keyDown);\n };\n}","export function assert(truthy, msg = '') {\n if (!truthy) {\n throw new Error(msg);\n }\n}","import { assert } from '../libs/assert.js';\n\nfunction getEllipsePointForAngle(cx, cy, rx, ry, phi, theta) {\n const m = Math.abs(rx) * Math.cos(theta);\n const n = Math.abs(ry) * Math.sin(theta);\n\n return [\n cx + Math.cos(phi) * m - Math.sin(phi) * n,\n cy + Math.sin(phi) * m + Math.cos(phi) * n,\n ];\n}\n\nfunction getEndpointParameters(cx, cy, rx, ry, phi, theta, dTheta) {\n const [x1, y1] = getEllipsePointForAngle(cx, cy, rx, ry, phi, theta);\n const [x2, y2] = getEllipsePointForAngle(cx, cy, rx, ry, phi, theta + dTheta);\n\n const fa = Math.abs(dTheta) > Math.PI ? 1 : 0;\n const fs = dTheta > 0 ? 1 : 0;\n\n return { x1, y1, x2, y2, fa, fs };\n}\n\nexport function arc(cx, cy, r, start, end) {\n assert(Math.abs(start - end) <= Math.PI * 2);\n assert(start >= -Math.PI && start <= Math.PI * 2);\n assert(start <= end);\n assert(end >= -Math.PI && end <= Math.PI * 4);\n\n const { x1, y1, x2, y2, fa, fs } = getEndpointParameters(cx, cy, r, r, 0, start, end - start);\n return Math.abs(Math.abs(start - end) - Math.PI * 2) > Number.EPSILON\n ? `M${cx} ${cy} L${x1} ${y1} A ${r} ${r} 0 ${fa} ${fs} ${x2} ${y2} L${cx} ${cy}`\n : `M${x1} ${y1} L${x1} ${y1} A ${r} ${r} 0 ${fa} ${fs} ${x2} ${y2}`;\n}\n","import { identity } from '../libs/conversions.js';\nimport { createElem } from '../libs/elem.js';\nimport { addKeyboardEvents } from '../libs/keyboard.js';\nimport { arc } from '../libs/svg.js';\nimport { addTouchEvents } from '../libs/touch.js';\nimport { createWheelHelper } from '../libs/wheel.js';\nimport { clamp, copyExistingProperties, euclideanModulo, lerp, stepify } from '../libs/utils.js';\nimport EditView from './EditView.js';\n\nconst svg = `\n\n`;\n\nconst twoPiMod = v => euclideanModulo(v + Math.PI, Math.PI * 2) - Math.PI;\n\nexport default class DirectionView extends EditView {\n #arrowElem;\n #rangeElem;\n #lastV;\n #wrap;\n #options = {\n step: 1,\n min: -180,\n max: 180,\n\n /*\n --------\n / -π/2 \\\n / | \\\n |<- -π * |\n | * 0 ->| zero is down the positive X axis\n |<- +π * |\n \\ | /\n \\ π/2 /\n --------\n */\n dirMin: -Math.PI,\n dirMax: Math.PI,\n //dirMin: Math.PI * 0.5,\n //dirMax: Math.PI * 2.5,\n //dirMin: -Math.PI * 0.75, // test 10:30 to 7:30\n //dirMax: Math.PI * 0.75,\n //dirMin: Math.PI * 0.75, // test 7:30 to 10:30\n //dirMax: -Math.PI * 0.75,\n //dirMin: -Math.PI * 0.75, // test 10:30 to 1:30\n //dirMax: -Math.PI * 0.25,\n //dirMin: Math.PI * 0.25, // test 4:30 to 7:30\n //dirMax: Math.PI * 0.75,\n //dirMin: Math.PI * 0.75, // test 4:30 to 7:30\n //dirMax: Math.PI * 0.25,\n wrap: undefined,\n converters: identity,\n };\n\n constructor(setter, options = {}) {\n const wheelHelper = createWheelHelper();\n super(createElem('div', {\n className: 'muigui-direction muigui-no-scroll',\n innerHTML: svg,\n onWheel: e => {\n e.preventDefault();\n const {min, max, step} = this.#options;\n const delta = wheelHelper(e, step);\n let tempV = this.#lastV + delta;\n if (this.#wrap) {\n tempV = euclideanModulo(tempV - min, max - min) + min;\n }\n const newV = clamp(stepify(tempV, v => v, step), min, max);\n setter.setValue(newV);\n },\n }));\n const handleTouch = (e) => {\n const {min, max, step, dirMin, dirMax} = this.#options;\n const nx = e.nx * 2 - 1;\n const ny = e.ny * 2 - 1;\n const a = Math.atan2(ny, nx);\n\n const center = (dirMin + dirMax) / 2;\n\n const centeredAngle = twoPiMod(a - center);\n const centeredStart = twoPiMod(dirMin - center);\n const diff = dirMax - dirMin;\n\n const n = clamp((centeredAngle - centeredStart) / (diff), 0, 1);\n const newV = stepify(min + (max - min) * n, v => v, step);\n setter.setValue(newV);\n };\n addTouchEvents(this.domElement, {\n onDown: handleTouch,\n onMove: handleTouch,\n });\n addKeyboardEvents(this.domElement, {\n onDown: (e) => {\n const {min, max, step} = this.#options;\n const newV = clamp(stepify(this.#lastV + e.dx * step, v => v, step), min, max);\n setter.setValue(newV);\n },\n });\n this.#arrowElem = this.$('#muigui-arrow');\n this.#rangeElem = this.$('#muigui-range');\n this.setOptions(options);\n }\n updateDisplay(v) {\n this.#lastV = v;\n const {min, max} = this.#options;\n const n = (v - min) / (max - min);\n const angle = lerp(this.#options.dirMin, this.#options.dirMax, n);\n this.#arrowElem.style.transform = `rotate(${angle}rad)`;\n }\n setOptions(options) {\n copyExistingProperties(this.#options, options);\n const {dirMin, dirMax, wrap} = this.#options;\n this.#wrap = wrap !== undefined\n ? wrap\n : Math.abs(dirMin - dirMax) >= Math.PI * 2 - Number.EPSILON;\n const [min, max] = dirMin < dirMax ? [dirMin, dirMax] : [dirMax , dirMin];\n this.#rangeElem.setAttribute('d', arc(0, 0, 28.87, min, max));\n }\n}\n","import { identity } from '../libs/conversions.js';\nimport DirectionView from '../views/DirectionView.js';\nimport NumberView from '../views/NumberView.js';\n// import ValueController from './ValueController.js';\nimport PopDownController from './PopDownController.js';\n\n\n// deg2rad\n// where is 0\n// range (0, 360), (-180, +180), (0,0) Really this is a range\n\nexport default class Direction extends PopDownController {\n #options;\n constructor(object, property, options) {\n super(object, property, 'muigui-direction');\nthis.#options = options; // FIX\n this.addTop(new NumberView(this,\nidentity));\n this.addBottom(new DirectionView(this, options));\n this.updateDisplay();\n }\n}\n\n","import { createElem } from '../libs/elem.js';\nimport { makeId } from '../libs/ids.js';\nimport EditView from './EditView.js';\n\nexport default class RadioGridView extends EditView {\n #values;\n\n constructor(setter, keyValues, cols = 3) {\n const values = [];\n const name = makeId();\n super(createElem('div', {}, keyValues.map(([key, value], ndx) => {\n values.push(value);\n return createElem('label', {}, [\n createElem('input', {\n type: 'radio',\n name,\n value: ndx,\n onChange: function () {\n if (this.checked) {\n setter.setFinalValue(that.#values[this.value]);\n }\n },\n }),\n createElem('button', {\n type: 'button',\n textContent: key,\n onClick: function () {\n this.previousElementSibling.click();\n },\n }),\n ]);\n })));\n // eslint-disable-next-line @typescript-eslint/no-this-alias\n const that = this;\n this.#values = values;\n this.cols(cols);\n }\n updateDisplay(v) {\n const ndx = this.#values.indexOf(v);\n for (let i = 0; i < this.domElement.children.length; ++i) {\n this.domElement.children[i].children[0].checked = i === ndx;\n }\n }\n cols(cols) {\n this.domElement.style.gridTemplateColumns = `repeat(${cols}, 1fr)`;\n }\n}\n","import RadioGridView from '../views/RadioGridView.js';\nimport ValueController from './ValueController.js';\nimport { convertToKeyValues } from '../libs/key-values.js';\n\nexport default class RadioGrid extends ValueController {\n constructor(object, property, options) {\n super(object, property, 'muigui-radio-grid');\n const valueIsNumber = typeof this.getValue() === 'number';\n const {\n keyValues: keyValuesInput,\n cols = 3,\n } = options;\n const keyValues = convertToKeyValues(keyValuesInput, valueIsNumber);\n this.add(new RadioGridView(this, keyValues, cols));\n this.updateDisplay();\n }\n}","export function onResize(elem, callback) {\n new ResizeObserver(() => {\n callback({rect: elem.getBoundingClientRect(), elem});\n }).observe(elem);\n}\n\nexport function onResizeSVGNoScale(elem, hAnchor, vAnchor, callback) {\n onResize(elem, ({rect}) => {\n const {width, height} = rect;\n elem.setAttribute('viewBox', `-${width * hAnchor} -${height * vAnchor} ${width} ${height}`);\n callback({elem, rect});\n });\n}\n\nexport function onResizeCanvas(elem, callback) {\n onResize(elem, ({rect}) => {\n const {width, height} = rect;\n elem.width = width;\n elem.height = height;\n callback({elem, rect});\n });\n}\n","import { createElem } from '../libs/elem.js';\nimport { addKeyboardEvents } from '../libs/keyboard.js';\nimport { addTouchEvents } from '../libs/touch.js';\nimport { createWheelHelper } from '../libs/wheel.js';\nimport { onResizeSVGNoScale } from '../libs/resize-helpers.js';\nimport { clamp, copyExistingProperties, stepify } from '../libs/utils.js';\nimport EditView from './EditView.js';\n\nconst svg = `\n\n`;\n\nfunction createSVGTicks(start, end, step, min, max, height) {\n const p = [];\n if (start < min) {\n start += stepify(min - start, v => v, step);\n }\n end = Math.min(end, max);\n for (let i = start; i <= end; i += step) {\n p.push(`M${i} 0 l0 ${height}`);\n }\n return p.join(' ');\n}\n\nfunction createSVGNumbers(start, end, unitSize, unit, minusSize, min, max, labelFn) {\n const texts = [];\n if (start < min) {\n start += stepify(min - start, v => v, unitSize);\n }\n end = Math.min(end, max);\n const digits = Math.max(0, -Math.log10(unit));\n const f = v => labelFn(v.toFixed(digits));\n for (let i = start; i <= end; i += unitSize) {\n texts.push(`= 0 ? i : (i - minusSize / 2) }\" y=\"0\">${f(i / unitSize * unit)}`);\n }\n return texts.join('\\n');\n}\n\nfunction computeSizeOfMinus(elem) {\n const oldHTML = elem.innerHTML;\n elem.innerHTML = '- ';\n const text = elem.querySelector('text');\n const size = text.getComputedTextLength();\n elem.innerHTML = oldHTML;\n return size;\n}\n\nexport default class SliderView extends EditView {\n #svgElem;\n #originElem;\n #ticksElem;\n #thicksElem;\n #numbersElem;\n #leftGradElem;\n #rightGradElem;\n #width;\n #height;\n #lastV;\n #minusSize;\n #options = {\n min: -100,\n max: 100,\n step: 1,\n unit: 10,\n unitSize: 10,\n ticksPerUnit: 5,\n labelFn: v => v,\n tickHeight: 1,\n limits: true,\n thicksColor: undefined,\n orientation: undefined,\n };\n\n constructor(setter, options) {\n const wheelHelper = createWheelHelper();\n super(createElem('div', {\n innerHTML: svg,\n className: 'muigui-no-v-scroll',\n onWheel: e => {\n e.preventDefault();\n const {min, max, step} = this.#options;\n const delta = wheelHelper(e, step);\n const newV = clamp(stepify(this.#lastV + delta, v => v, step), min, max);\n setter.setValue(newV);\n },\n }));\n this.#svgElem = this.$('svg');\n this.#originElem = this.$('#muigui-origin');\n this.#ticksElem = this.$('#muigui-ticks');\n this.#thicksElem = this.$('#muigui-thicks');\n this.#numbersElem = this.$('#muigui-numbers');\n this.#leftGradElem = this.$('#muigui-left-grad');\n this.#rightGradElem = this.$('#muigui-right-grad');\n this.setOptions(options);\n let startV;\n addTouchEvents(this.domElement, {\n onDown: () => {\n startV = this.#lastV;\n },\n onMove: (e) => {\n const {min, max, unitSize, unit, step} = this.#options;\n const newV = clamp(stepify(startV - e.dx / unitSize * unit, v => v, step), min, max);\n setter.setValue(newV);\n },\n });\n addKeyboardEvents(this.domElement, {\n onDown: (e) => {\n const {min, max, step} = this.#options;\n const newV = clamp(stepify(this.#lastV + e.dx * step, v => v, step), min, max);\n setter.setValue(newV);\n },\n });\n onResizeSVGNoScale(this.#svgElem, 0.5, 0, ({rect: {width}}) => {\n this.#leftGradElem.setAttribute('x', -width / 2);\n this.#rightGradElem.setAttribute('x', width / 2 - 20);\n this.#minusSize = computeSizeOfMinus(this.#numbersElem);\n this.#width = width;\n this.#updateSlider();\n });\n }\n // |--------V--------|\n // . . | . . . | . . . |\n //\n #updateSlider() {\n // There's no size if ResizeObserver has not fired yet.\n if (!this.#width || this.#lastV === undefined) {\n return;\n }\n const {\n labelFn,\n limits,\n min,\n max,\n orientation,\n tickHeight,\n ticksPerUnit,\n unit,\n unitSize,\n thicksColor,\n } = this.#options;\n const unitsAcross = Math.ceil(this.#width / unitSize);\n const center = this.#lastV;\n const centerUnitSpace = center / unit;\n const startUnitSpace = Math.round(centerUnitSpace - unitsAcross);\n const endUnitSpace = startUnitSpace + unitsAcross * 2;\n const start = startUnitSpace * unitSize;\n const end = endUnitSpace * unitSize;\n const minUnitSpace = limits ? min * unitSize / unit : start;\n const maxUnitSpace = limits ? max * unitSize / unit : end;\n const height = labelFn(1) === '' ? 10 : 5;\n if (ticksPerUnit > 1) {\n this.#ticksElem.setAttribute('d', createSVGTicks(start, end, unitSize / ticksPerUnit, minUnitSpace, maxUnitSpace, height * tickHeight));\n }\n this.#thicksElem.style.stroke = thicksColor; //setAttribute('stroke', thicksColor);\n this.#thicksElem.setAttribute('d', createSVGTicks(start, end, unitSize, minUnitSpace, maxUnitSpace, height));\n this.#numbersElem.innerHTML = createSVGNumbers(start, end, unitSize, unit, this.#minusSize, minUnitSpace, maxUnitSpace, labelFn);\n this.#originElem.setAttribute('transform', `translate(${-this.#lastV * unitSize / unit} 0)`);\n this.#svgElem.classList.toggle('muigui-slider-up', orientation === 'up');\n }\n updateDisplay(v) {\n this.#lastV = v;\n this.#updateSlider();\n }\n setOptions(options) {\n copyExistingProperties(this.#options, options);\n return this;\n }\n}\n","import ValueController from './ValueController.js';\nimport NumberView from '../views/NumberView.js';\nimport SliderView from '../views/SliderView.js';\n\nexport default class Slider extends ValueController {\n constructor(object, property, options = {}) {\n super(object, property, 'muigui-slider');\n this.add(new SliderView(this, options));\n this.add(new NumberView(this, options));\n this.updateDisplay();\n }\n}\n","import { createElem } from '../libs/elem.js';\nimport { addTouchEvents } from '../libs/touch.js';\nimport { onResizeSVGNoScale } from '../libs/resize-helpers.js';\nimport EditView from './EditView.js';\n\nconst svg = `\n\n`;\n\nexport default class Vec2View extends EditView {\n #svgElem;\n #arrowElem;\n #circleElem;\n #lastV = [];\n\n constructor(setter) {\n super(createElem('div', {\n innerHTML: svg,\n className: 'muigui-no-scroll',\n }));\n const onTouch = (e) => {\n const {width, height} = this.#svgElem.getBoundingClientRect();\n const nx = e.nx * 2 - 1;\n const ny = e.ny * 2 - 1;\n setter.setValue([nx * width * 0.5, ny * height * 0.5]);\n };\n addTouchEvents(this.domElement, {\n onDown: onTouch,\n onMove: onTouch,\n });\n this.#svgElem = this.$('svg');\n this.#arrowElem = this.$('#muigui-arrow');\n this.#circleElem = this.$('#muigui-circle');\n onResizeSVGNoScale(this.#svgElem, 0.5, 0.5, () => this.#updateDisplayImpl);\n }\n #updateDisplayImpl() {\n const [x, y] = this.#lastV;\n this.#arrowElem.setAttribute('d', `M0,0L${x},${y}`);\n this.#circleElem.setAttribute('transform', `translate(${x}, ${y})`);\n }\n updateDisplay(v) {\n this.#lastV[0] = v[0];\n this.#lastV[1] = v[1];\n this.#updateDisplayImpl();\n }\n}\n","import NumberView from '../views/NumberView.js';\nimport Vec2View from '../views/Vec2View.js';\nimport PopDownController from './PopDownController.js';\nimport { strToNumber } from '../libs/conversions.js';\n\n// TODO: zoom with wheel and pinch?\n// TODO: grid?\n// // options\n// scale:\n// range: number (both x and y + /)\n// range: array (min, max)\n// xRange:\n// deg/rad/turn\n\nexport default class Vec2 extends PopDownController {\n constructor(object, property) {\n super(object, property, 'muigui-vec2');\n\n const makeSetter = (ndx) => {\n return {\n setValue: (v) => {\n const newV = this.getValue();\n newV[ndx] = v;\n this.setValue(newV);\n },\n setFinalValue: (v) => {\n const newV = this.getValue();\n newV[ndx] = v;\n this.setFinalValue(newV);\n },\n };\n };\n\n this.addTop(new NumberView(makeSetter(0), {\n converters: {\n to: v => v[0],\n from: strToNumber.from,\n },\n }));\n this.addTop(new NumberView(makeSetter(1), {\n converters: {\n to: v => v[1],\n from: strToNumber.from,\n },\n }));\n this.addBottom(new Vec2View(this));\n this.updateDisplay();\n }\n}\n"],"names":["clamp","euclideanModulo","lerp","identity","noop","svg"],"mappings":";AAAA,UAAe;AACf,EAAE,OAAO,EAAE,CAAC;AACZ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD,MAAM,EAAE;AACR,EAAE,OAAO,EAAE,EAAE;AACb,EAAE,KAAK,EAAE,CAAC;AACV;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD,CAAC;AACD,CAAC;;ACnvBM,SAAS,YAAY,CAAC,IAAI,EAAE,KAAK,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C,CAAC,CAAC;AACvC,IAAI,IAAI,CAAC,aAAa,EAAE,CAAC;AACzB,GAAG;AACH;;;;"}
\ No newline at end of file
+{"version":3,"file":"muigui.module.js","sources":["../../src/styles/muigui.css.js","../../src/libs/elem.js","../../src/libs/utils.js","../../../src/views/View.ts","../../src/controllers/Controller.js","../../src/controllers/Button.js","../../src/views/EditView.js","../../src/views/CheckboxView.js","../../src/libs/taskrunner.js","../../src/libs/ids.js","../../src/views/ValueView.js","../../src/controllers/LabelController.js","../../src/controllers/ValueController.js","../../src/controllers/Checkbox.js","../../src/libs/conversions.js","../../src/libs/wheel.js","../../src/views/NumberView.js","../../src/controllers/TextNumber.js","../../src/views/SelectView.js","../../src/libs/key-values.js","../../src/controllers/Select.js","../../src/views/RangeView.js","../../src/controllers/Range.js","../../src/views/TextView.js","../../src/controllers/Text.js","../../src/controllers/create-controller.js","../../src/libs/color-utils.js","../../src/views/ElementView.js","../../src/controllers/Canvas.js","../../src/views/ColorView.js","../../src/controllers/Color.js","../../src/controllers/Divider.js","../../src/controllers/Container.js","../../src/controllers/Folder.js","../../src/controllers/Label.js","../../src/libs/touch.js","../../src/views/ColorChooserView.js","../../src/controllers/PopDownController.js","../../src/controllers/ColorChooser.js","../../src/layout/Layout.js","../../src/layout/Column.js","../../src/layout/Frame.js","../../src/layout/Grid.js","../../src/layout/Row.js","../../src/muigui.js","../../src/libs/keyboard.js","../../src/libs/assert.js","../../src/libs/svg.js","../../src/views/DirectionView.js","../../src/controllers/Direction.js","../../src/views/RadioGridView.js","../../src/controllers/RadioGrid.js","../../src/libs/resize-helpers.js","../../src/views/SliderView.js","../../src/controllers/Slider.js","../../src/views/Vec2View.js","../../src/controllers/Vec2.js","../../src/libs/graph.js","../../src/libs/monitor.js","../../../src/esm.ts"],"sourcesContent":["export default {\n default: `\n.muigui {\n --bg-color: #ddd;\n --color: #222;\n --contrast-color: #eee;\n --value-color: #145 ;\n --value-bg-color: #eeee;\n --disabled-color: #999;\n --menu-bg-color: #f8f8f8;\n --menu-sep-color: #bbb;\n --hover-bg-color: #999;\n --focus-color: #8BF;\n --range-color: #AAA;\n --invalid-color: #FF0000;\n --selected-color: rgb(255, 255, 255, 0.9);\n\n --button-bg-color: var(--value-bg-color);\n\n --image-open: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPgogIDxyZWN0IHN0eWxlPSJmaWxsOiAjNDQ0OyIgeD0iMjAlIiB5PSI0NSUiIHdpZHRoPSI2MCUiIGhlaWdodD0iMTAlIj48L3JlY3Q+Cjwvc3ZnPg==);\n --image-closed: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPgogIDxyZWN0IHN0eWxlPSJmaWxsOiAjNDQ0OyIgeD0iNDUlIiB5PSIyMCUiIHdpZHRoPSIxMCUiIGhlaWdodD0iNjAlIj48L3JlY3Q+CiAgPHJlY3Qgc3R5bGU9ImZpbGw6ICM0NDQ7IiB4PSIyMCUiIHk9IjQ1JSIgd2lkdGg9IjYwJSIgaGVpZ2h0PSIxMCUiPjwvcmVjdD4KPC9zdmc+);\n --image-checkerboard: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPgogIDxyZWN0IHN0eWxlPSJmaWxsOiAjNDA0MDQwOyIgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSI+PC9yZWN0PgogIDxyZWN0IHN0eWxlPSJmaWxsOiAjODA4MDgwOyIgeD0iMCIgeT0iMCIgd2lkdGg9IjUwJSIgaGVpZ2h0PSI1MCUiPjwvcmVjdD4KICA8cmVjdCBzdHlsZT0iZmlsbDogIzgwODA4MDsiIHg9IjUwJSIgeT0iNTAlIiB3aWR0aD0iNTAlIiBoZWlnaHQ9IjUwJSI+PC9yZWN0Pgo8L3N2Zz4=);\n\n --range-left-color: var(--value-color);\n --range-right-color: var(--value-bg-color); \n --range-right-hover-color: var(--hover-bg-color);\n --button-image: \n linear-gradient(\n rgba(255, 255, 255, 1), rgba(0, 0, 0, 0.2)\n );\n\n color: var(--color);\n background-color: var(--bg-color);\n}\n\n@media (prefers-color-scheme: dark) {\n .muigui {\n --bg-color: #222222;\n --color: #dddddd;\n --contrast-color: #000;\n --value-color: #43e5f7;\n --value-bg-color: #444444;\n --disabled-color: #666666;\n --menu-bg-color: #080808;\n --menu-sep-color: #444444;\n --hover-bg-color: #666666;\n --focus-color: #458; /*#88AAFF*/;\n --range-color: #888888;\n --invalid-color: #FF6666;\n --selected-color: rgba(255, 255, 255, 0.3);\n\n --button-bg-color: var(--value-bg-color);\n\n --range-left-color: var(--value-color);\n --range-right-color: var(--value-bg-color); \n --range-right-hover-color: var(--hover-bg-color);\n --button-image: linear-gradient(\n rgba(0, 0, 0, 0.1), rgba(0, 0, 0, 0.4)\n );\n\n color: var(--color);\n background-color: var(--bg-color);\n\n --image-closed: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPgogIDxyZWN0IHN0eWxlPSJmaWxsOiAjREREOyIgeD0iMjAlIiB5PSI0NSUiIHdpZHRoPSI2MCUiIGhlaWdodD0iMTAlIj48L3JlY3Q+Cjwvc3ZnPg==);\n --image-open: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPgogIDxyZWN0IHN0eWxlPSJmaWxsOiAjREREOyIgeD0iNDUlIiB5PSIyMCUiIHdpZHRoPSIxMCUiIGhlaWdodD0iNjAlIj48L3JlY3Q+CiAgPHJlY3Qgc3R5bGU9ImZpbGw6ICNEREQ7IiB4PSIyMCUiIHk9IjQ1JSIgd2lkdGg9IjYwJSIgaGVpZ2h0PSIxMCUiPjwvcmVjdD4KPC9zdmc+);\n }\n}\n\n.muigui {\n --width: 250px;\n --label-width: 45%;\n --number-width: 40%;\n\n --font-family: -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, Arial, sans-serif;\n --font-size: 11px;\n --font-family-mono: Menlo, Monaco, Consolas, \"Droid Sans Mono\", monospace;\n --font-size-mono: 11px;\n\n --line-height: 1.7em;\n --border-radius: 0px;\n\n width: var(--width);\n font-family: var(--font-family);\n font-size: var(--font-size);\n box-sizing: border-box;\n line-height: 100%;\n}\n.muigui * {\n box-sizing: inherit;\n}\n\n.muigui-no-scroll {\n touch-action: none;\n}\n.muigui-no-h-scroll {\n touch-action: pan-y;\n}\n.muigui-no-v-scroll {\n touch-action: pan-x;\n}\n\n.muigui-invalid-value {\n background-color: red !important;\n color: white !important;\n}\n\n.muigui-grid {\n display: grid;\n}\n.muigui-rows {\n display: flex;\n flex-direction: column;\n\n min-height: 20px;\n border: 2px solid red;\n}\n.muigui-columns {\n display: flex;\n flex-direction: row;\n\n height: 20px;\n border: 2px solid green;\n}\n.muigui-rows>*,\n.muigui-columns>* {\n flex: 1 1 auto;\n align-items: stretch;\n min-height: 0;\n min-width: 0;\n}\n\n.muigui-row {\n border: 2px solid yellow;\n min-height: 10px\n}\n.muigui-column {\n border: 2px solid lightgreen;\n}\n\n/* -------- */\n\n.muigui-show { /* */ }\n.muigui-hide { \n display: none !important;\n}\n.muigui-disabled {\n pointer-events: none;\n --color: var(--disabled-color) !important;\n --value-color: var(--disabled-color) !important;\n --range-left-color: var(--disabled-color) !important;\n}\n\n.muigui canvas,\n.muigui svg {\n display: block;\n border-radius: var(--border-radius);\n}\n.muigui canvas {\n background-color: var(--value-bg-color);\n}\n\n.muigui-controller {\n min-width: 0;\n min-height: var(--line-height);\n}\n.muigui-root {\n z-index: 1;\n}\n.muigui-root,\n.muigui-menu {\n display: flex;\n flex-direction: column;\n position: relative;\n user-select: none;\n height: fit-content;\n margin: 0;\n padding-bottom: 0.1em;\n border-radius: var(--border-radius);\n}\n.muigui-menu {\n border-bottom: 1px solid var(--menu-sep-color);\n}\n\n.muigui-root>button:nth-child(1),\n.muigui-menu>button:nth-child(1) {\n border-top: 1px solid var(--menu-sep-color);\n border-bottom: 1px solid var(--menu-sep-color);\n position: relative;\n text-align: left;\n color: var(--color);\n background-color: var(--menu-bg-color);\n min-height: var(--line-height);\n padding: 0.2em;\n cursor: pointer;\n border-radius: var(--border-radius);\n}\n.muigui-root>div:nth-child(2),\n.muigui-menu>div:nth-child(2) {\n flex: 1 1 auto;\n}\n\n.muigui-controller {\n margin-left: 0.2em;\n margin-right: 0.2em;\n}\n.muigui-root.muigui-controller,\n.muigui-menu.muigui-controller {\n margin-left: 0;\n margin-right: 0;\n}\n.muigui-controller>*:nth-child(1) {\n flex: 1 0 var(--label-width);\n min-width: 0;\n /* white-space: pre; why?? */\n}\n.muigui-controller>label:nth-child(1) {\n place-content: center start;\n display: inline-grid;\n overflow: hidden;\n}\n.muigui-controller>*:nth-child(2) {\n flex: 1 1 75%;\n min-width: 0;\n}\n\n/* -----------------------------------------\n a label controller is [[label][value]]\n*/\n\n.muigui-label-controller {\n display: flex;\n margin: 0.4em 0 0.4em 0;\n word-wrap: initial;\n align-items: stretch;\n}\n\n.muigui-value {\n display: flex;\n align-items: stretch;\n}\n.muigui-value>* {\n flex: 1 1 auto;\n min-width: 0;\n}\n.muigui-value>*:nth-child(1) {\n flex: 1 1 calc(100% - var(--number-width));\n}\n.muigui-value>*:nth-child(2) {\n flex: 1 1 var(--number-width);\n margin-left: 0.2em;\n}\n\n/* fix! */\n.muigui-open>button>label::before,\n.muigui-closed>button>label::before {\n content: \"X\";\n color: rgba(0, 0, 0, 0);\n background-color: var(--range-color);\n border-radius: 0.2em;\n width: 1.25em;\n margin-right: 0.25em;\n height: 1.25em; /*var(--line-height);*/\n display: inline-grid;\n place-content: center start;\n pointer-events: none;\n}\n.muigui-open>button>label::before {\n background-image: var(--image-open);\n}\n.muigui-closed>button>label::before {\n background-image: var(--image-closed);\n}\n\n.muigui-open>.muigui-open-container {\n transition: all 0.1s ease-out;\n overflow: auto;\n height: 100%;\n}\n.muigui-closed>.muigui-open-container {\n transition: all 0.1s ease-out;\n overflow: hidden;\n min-height: 0;\n}\n.muigui-open>.muigui-open-container>* {\n transition: all 0.1s ease-out;\n margin-top: 0px;\n}\n.muigui-closed>.muigui-open-container>* {\n transition: all 0.1s ease-out;\n margin-top: -100%;\n}\n\n/* ---- popdown ---- */\n\n.muigui-pop-down-top {\n display: flex;\n}\n/* fix? */\n.muigui-value>*:nth-child(1).muigui-pop-down-top {\n flex: 0;\n}\n.muigui-closed .muigui-pop-down-bottom {\n max-height: 0;\n}\n\n.muigui-value .muigui-pop-down-bottom {\n margin: 0;\n}\n\n.muigui-pop-down-values {\n min-width: 0;\n display: flex;\n}\n.muigui-pop-down-values>* {\n flex: 1 1 auto;\n min-width: 0;\n}\n\n.muigui-value.muigui-pop-down-controller {\n flex-direction: column;\n}\n\n.muigui-pop-down-top input[type=checkbox] {\n -webkit-appearance: none;\n appearance: none;\n width: auto;\n color: var(--value-color);\n background-color: var(--value-bg-color);\n background-image: var(--image-checkerboard);\n background-size: 10px 10px;\n background-position: 0 0, 0 5px, 5px -5px, -5px 0px;\n\n cursor: pointer;\n\n display: grid;\n place-content: center;\n margin: 0;\n font: inherit;\n color: currentColor;\n width: 1.7em;\n height: 1.7em;\n transform: translateY(-0.075em);\n}\n\n.muigui-pop-down-top input[type=checkbox]::before {\n content: \"+\";\n display: grid;\n place-content: center;\n border-radius: calc(var(--border-radius) + 2px);\n border-left: 1px solid rgba(255,255,255,0.3);\n border-top: 1px solid rgba(255,255,255,0.3);\n border-bottom: 1px solid rgba(0,0,0,0.2);\n border-right: 1px solid rgba(0,0,0,0.2);\n background-color: var(--range-color);\n color: var(--value-bg-color);\n width: calc(var(--line-height) - 4px);\n height: calc(var(--line-height) - 4px);\n}\n\n.muigui-pop-down-top input[type=checkbox]:checked::before {\n content: \"X\";\n}\n\n\n/* ---- select ---- */\n\n.muigui select,\n.muigui option,\n.muigui input,\n.muigui button {\n color: var(--value-color);\n background-color: var(--value-bg-color);\n font-family: var(--font-family);\n font-size: var(--font-size);\n border: none;\n margin: 0;\n border-radius: var(--border-radius);\n}\n.muigui select {\n appearance: none;\n margin: 0;\n margin-left: 0; /*?*/\n overflow: hidden; /* Safari */\n}\n\n.muigui select:focus,\n.muigui input:focus,\n.muigui button:focus {\n outline: 1px solid var(--focus-color);\n}\n\n.muigui select:hover,\n.muigui option:hover,\n.muigui input:hover,\n.muigui button:hover {\n background-color: var(--hover-bg-color); \n}\n\n/* ------ [ label ] ------ */\n\n.muigui-label {\n border-top: 1px solid var(--menu-sep-color);\n border-bottom: 1px solid var(--menu-sep-color);\n padding-top: 0.4em;\n padding-bottom: 0.3em;\n place-content: center start;\n background-color: var(--menu-bg-color);\n white-space: pre;\n border-radius: var(--border-radius);\n}\n\n/* ------ [ divider] ------ */\n\n.muigui-divider {\n min-height: 6px;\n border-top: 2px solid var(--menu-sep-color);\n margin-top: 6px;\n}\n\n/* ------ [ button ] ------ */\n\n.muigui-button {\n display: grid;\n padding: 2px 0 2px 0;\n}\n.muigui-button button {\n border: none;\n color: var(--value-color);\n background-color: var(--button-bg-color);\n background-image: var(--button-image);\n cursor: pointer;\n place-content: center center;\n height: var(--line-height);\n}\n\n/* ------ [ color ] ------ */\n\n.muigui-color>div {\n overflow: hidden;\n position: relative;\n margin-left: 0;\n margin-right: 0; /* why? */\n max-width: var(--line-height);\n border-radius: var(--border-radius);\n}\n\n.muigui-color>div:focus-within {\n outline: 1px solid var(--focus-color);\n}\n\n.muigui-color input[type=color] {\n border: none;\n padding: 0;\n background: inherit;\n cursor: pointer;\n position: absolute;\n width: 200%;\n left: -10px;\n top: -10px;\n height: 200%;\n}\n.muigui-disabled canvas,\n.muigui-disabled svg,\n.muigui-disabled img,\n.muigui-disabled .muigui-color input[type=color] {\n opacity: 0.2;\n}\n\n/* ------ [ checkbox ] ------ */\n\n.muigui-checkbox>label:nth-child(2) {\n display: grid;\n place-content: center start;\n margin: 0;\n}\n\n.muigui-checkbox input[type=checkbox] {\n -webkit-appearance: none;\n appearance: none;\n width: auto;\n color: var(--value-color);\n background-color: var(--value-bg-color);\n cursor: pointer;\n\n display: grid;\n place-content: center;\n margin: 0;\n font: inherit;\n color: currentColor;\n width: 1.7em;\n height: 1.7em;\n transform: translateY(-0.075em);\n}\n\n.muigui-checkbox input[type=checkbox]::before {\n content: \"\";\n color: var(--value-color);\n display: grid;\n place-content: center;\n}\n\n.muigui-checkbox input[type=checkbox]:checked::before {\n content: \"✔\";\n}\n\n.muigui input[type=number]::-webkit-inner-spin-button, \n.muigui input[type=number]::-webkit-outer-spin-button { \n -webkit-appearance: none;\n appearance: none;\n margin: 0; \n}\n.muigui input[type=number] {\n -moz-appearance: textfield;\n}\n\n/* ------ [ radio grid ] ------ */\n\n.muigui-radio-grid>div {\n display: grid;\n gap: 2px;\n}\n\n.muigui-radio-grid input {\n appearance: none;\n display: none;\n}\n\n.muigui-radio-grid button {\n color: var(--color);\n width: 100%;\n text-align: left;\n}\n\n.muigui-radio-grid input:checked + button {\n color: var(--value-color);\n background-color: var(--selected-color);\n}\n\n/* ------ [ color-chooser ] ------ */\n\n.muigui-color-chooser-cursor {\n stroke-width: 1px;\n stroke: white;\n fill: none;\n}\n.muigui-color-chooser-circle {\n stroke-width: 1px;\n stroke: white;\n fill: none;\n}\n\n\n/* ------ [ vec2 ] ------ */\n\n.muigui-vec2 svg {\n background-color: var(--value-bg-color);\n}\n\n.muigui-vec2-axis {\n stroke: 1px;\n stroke: var(--focus-color);\n}\n\n.muigui-vec2-line {\n stroke-width: 1px;\n stroke: var(--value-color);\n fill: var(--value-color);\n}\n\n/* ------ [ direction ] ------ */\n\n.muigui-direction svg {\n background-color: rgba(0,0,0,0.2);\n}\n\n.muigui-direction:focus-within svg {\n outline: none;\n}\n.muigui-direction-range {\n fill: var(--value-bg-color);\n}\n.muigui-direction svg:focus {\n outline: none;\n}\n.muigui-direction svg:focus .muigui-direction-range {\n stroke-width: 0.5px;\n stroke: var(--focus-color);\n}\n\n.muigui-direction-arrow {\n fill: var(--value-color);\n}\n\n/* ------ [ slider ] ------ */\n\n.muigui-slider>div {\n display: flex;\n align-items: stretch;\n height: var(--line-height);\n}\n.muigui-slider svg {\n flex: 1 1 auto;\n}\n.muigui-slider .muigui-slider-up #muigui-orientation {\n transform: scale(1, -1) translateY(-100%);\n}\n\n.muigui-slider .muigui-slider-up #muigui-number-orientation {\n transform: scale(1,-1);\n}\n\n.muigui-ticks {\n stroke: var(--range-color);\n}\n.muigui-thicks {\n stroke: var(--color);\n stroke-width: 2px;\n}\n.muigui-svg-text {\n fill: var(--color);\n font-size: 7px;\n}\n.muigui-mark {\n fill: var(--value-color);\n}\n\n/* ------ [ range ] ------ */\n\n\n.muigui-range input[type=range] {\n -webkit-appearance: none;\n appearance: none;\n background-color: transparent;\n}\n\n.muigui-range input[type=range]::-webkit-slider-thumb {\n -webkit-appearance: none;\n appearance: none;\n border-radius: calc(var(--border-radius) + 2px);\n border-left: 1px solid rgba(255,255,255,0.3);\n border-top: 1px solid rgba(255,255,255,0.3);\n border-bottom: 1px solid rgba(0,0,0,0.2);\n border-right: 1px solid rgba(0,0,0,0.2);\n background-color: var(--range-color);\n margin-top: calc((var(--line-height) - 6px) / -2);\n width: calc(var(--line-height) - 6px);\n height: calc(var(--line-height) - 6px);\n}\n\n.muigui-range input[type=range]::-webkit-slider-runnable-track {\n -webkit-appearance: none;\n appearance: none;\n border: 1px solid var(--menu-sep-color);\n height: 2px;\n}\n\n\n/* dat.gui style - doesn't work on Safari iOS */\n\n/*\n.muigui-range input[type=range] {\n cursor: ew-resize;\n overflow: hidden;\n}\n\n.muigui-range input[type=range] {\n -webkit-appearance: none;\n appearance: none;\n background-color: var(--range-right-color);\n margin: 0;\n}\n.muigui-range input[type=range]:hover {\n background-color: var(--range-right-hover-color);\n}\n\n.muigui-range input[type=range]::-webkit-slider-runnable-track {\n -webkit-appearance: none;\n appearance: none;\n height: max-content;\n color: var(--range-left-color);\n margin-top: -1px;\n}\n\n.muigui-range input[type=range]::-webkit-slider-thumb {\n -webkit-appearance: none;\n appearance: none;\n width: 0px;\n height: max-content;\n box-shadow: -1000px 0 0 1000px var(--range-left-color);\n}\n*/\n\n/* FF */\n/*\n.muigui-range input[type=range]::-moz-slider-progress {\n background-color: var(--range-left-color); \n}\n.muigui-range input[type=range]::-moz-slider-thumb {\n height: max-content;\n width: 0;\n border: none;\n box-shadow: -1000px 0 0 1000px var(--range-left-color);\n box-sizing: border-box;\n}\n*/\n\n.muigui-checkered-background {\n background-color: #404040;\n background-image:\n linear-gradient(45deg, #808080 25%, transparent 25%),\n linear-gradient(-45deg, #808080 25%, transparent 25%),\n linear-gradient(45deg, transparent 75%, #808080 75%),\n linear-gradient(-45deg, transparent 75%, #808080 75%);\n background-size: 16px 16px;\n background-position: 0 0, 0 8px, 8px -8px, -8px 0px;\n}\n\n/* ---------------------------------------------------------- */\n\n/* needs to be at bottom to take precedence */\n.muigui-auto-place {\n max-height: 100%;\n position: fixed;\n top: 0;\n right: 15px;\n z-index: 100001;\n}\n\n`,\nthemes: {\n default: {\n include: ['default'],\n css: `\n `,\n },\n float: {\n include: ['default'],\n css: `\n :root {\n color-scheme: light dark,\n }\n\n .muigui {\n --width: 400px;\n --bg-color: initial;\n --label-width: 25%;\n --number-width: 20%;\n }\n\n input,\n .muigui-label-controller>label {\n text-shadow:\n -1px -1px 0 var(--contrast-color),\n 1px -1px 0 var(--contrast-color),\n -1px 1px 0 var(--contrast-color),\n 1px 1px 0 var(--contrast-color);\n }\n\n .muigui-controller > label:nth-child(1) {\n place-content: center end;\n margin-right: 1em;\n }\n\n .muigui-value > :nth-child(2) {\n margin-left: 1em;\n }\n\n .muigui-root>*:nth-child(1) {\n display: none;\n }\n\n .muigui-range input[type=range]::-webkit-slider-thumb {\n border-radius: 1em;\n }\n\n .muigui-range input[type=range]::-webkit-slider-runnable-track {\n -webkit-appearance: initial;\n appearance: none;\n border: 1px solid rgba(0, 0, 0, 0.25);\n height: 2px;\n }\n\n .muigui-colors {\n --value-color: var(--color );\n --value-bg-color: rgba(0, 0, 0, 0.1);\n --disabled-color: #cccccc;\n --menu-bg-color: rgba(0, 0, 0, 0.1);\n --menu-sep-color: #bbbbbb;\n --hover-bg-color: rgba(0, 0, 0, 0);\n --invalid-color: #FF0000;\n --selected-color: rgba(0, 0, 0, 0.3);\n --range-color: rgba(0, 0, 0, 0.125);\n }\n`,\n },\n form: {\n include: [],\n css: `\n .muigui {\n --width: 100%;\n --label-width: 45%;\n --number-width: 40%;\n }\n .muigui-root>button {\n display: none;\n }\n .muigui-controller {\n margin-top: 1em;\n }\n .muigui-label-controller {\n display: flex;\n flex-direction: column;\n align-items: stretch;\n margin-top: 1em;\n }\n .muigui-label-controller:has(.muigui-checkbox) {\n flex-direction: row;\n }\n .muigui-value {\n display: flex;\n align-items: stretch;\n }\n .muigui-value>* {\n flex: 1 1 auto;\n min-width: 0;\n }\n .muigui-controller>*:nth-child(1) {\n flex: 1 0 var(--label-width);\n min-width: 0;\n white-space: pre;\n }\n .muigui-controller>label:nth-child(1) {\n place-content: center start;\n display: inline-grid;\n overflow: hidden;\n }\n .muigui-controller>*:nth-child(2) {\n flex: 1 1 75%;\n min-width: 0;\n }\n `,\n },\n none: {\n include: [],\n css: '',\n },\n},\n};\n","export function setElemProps(elem, attrs, children) {\n for (const [key, value] of Object.entries(attrs)) {\n if (typeof value === 'function' && key.startsWith('on')) {\n const eventName = key.substring(2).toLowerCase();\n elem.addEventListener(eventName, value, {passive: false});\n } else if (typeof value === 'object') {\n for (const [k, v] of Object.entries(value)) {\n elem[key][k] = v;\n }\n } else if (elem[key] === undefined) {\n elem.setAttribute(key, value);\n } else {\n elem[key] = value;\n }\n }\n for (const child of children) {\n elem.appendChild(child);\n }\n return elem;\n}\n\nexport function createElem(tag, attrs = {}, children = []) {\n const elem = document.createElement(tag);\n setElemProps(elem, attrs, children);\n return elem;\n}\n\nexport function addElem(tag, parent, attrs = {}, children = []) {\n const elem = createElem(tag, attrs, children);\n parent.appendChild(elem);\n return elem;\n}\n\nlet nextId = 0;\nexport function getNewId() {\n return `muigui-id-${nextId++}`;\n}\n","export function removeArrayElem(array, value) {\n const ndx = array.indexOf(value);\n if (ndx) {\n array.splice(ndx, 1);\n }\n return array;\n}\n\n/**\n * Converts an camelCase or snake_case id to \"camel case\" or \"snake case\"\n * @param {string} id\n */\nconst underscoreRE = /_/g;\nconst upperLowerRE = /([A-Z])([a-z])/g;\nexport function idToLabel(id) {\n return id.replace(underscoreRE, ' ')\n .replace(upperLowerRE, (m, m1, m2) => `${m1.toLowerCase()} ${m2}`);\n}\n\nexport function clamp(v, min, max) {\n return Math.max(min, Math.min(max, v));\n}\n\nexport const isTypedArray = typeof SharedArrayBuffer !== 'undefined'\n ? function isArrayBufferOrSharedArrayBuffer(a) {\n return a && a.buffer && (a.buffer instanceof ArrayBuffer || a.buffer instanceof SharedArrayBuffer);\n }\n : function isArrayBuffer(a) {\n return a && a.buffer && a.buffer instanceof ArrayBuffer;\n };\n\nexport const isArrayOrTypedArray = v => Array.isArray(v) || isTypedArray(v);\n\n// Yea, I know this should be `Math.round(v / step) * step\n// but try step = 0.1, newV = 19.95\n//\n// I get\n// Math.round(19.95 / 0.1) * 0.1\n// 19.900000000000002\n// vs\n// Math.round(19.95 / 0.1) / (1 / 0.1)\n// 19.9\n//\nexport const stepify = (v, from, step) => Math.round(from(v) / step) / (1 / step);\n\nexport const euclideanModulo = (v, n) => ((v % n) + n) % n;\nexport const lerp = (a, b, t) => a + (b - a) * t;\nexport function copyExistingProperties(dst, src) {\n for (const key in src) {\n if (key in dst) {\n dst[key] = src[key];\n }\n }\n return dst;\n}\n\nexport const mapRange = (v, inMin, inMax, outMin, outMax) => (v - inMin) * (outMax - outMin) / (inMax - inMin) + outMin;\n\nexport const makeRangeConverters = ({from, to}) => {\n return {\n to: v => mapRange(v, ...from, ...to),\n from: v => [true, mapRange(v, ...to, ...from)],\n };\n};\n\nexport const makeRangeOptions = ({from, to, step}) => {\n return {\n min: to[0],\n max: to[1],\n ...(step && {step}),\n converters: makeRangeConverters({from, to}),\n };\n};\n\n// TODO: remove an use one in conversions. Move makeRangeConverters there?\nexport const identity = {\n to: v => v,\n from: v => [true, v],\n};\nexport function makeMinMaxPair(gui, properties, minPropName, maxPropName, options) {\n const { converters: { from } = identity } = options;\n const { min, max } = options;\n const guiMinRange = options.minRange || 0;\n const valueMinRange = from(guiMinRange)[1];\n const minGui = gui\n .add(properties, minPropName, {\n ...options,\n min,\n max: max - guiMinRange,\n })\n .onChange(v => {\n maxGui.setValue(Math.min(max, Math.max(v + valueMinRange, properties[maxPropName])));\n });\n const maxGui = gui\n .add(properties, maxPropName, {\n ...options,\n min: min + guiMinRange,\n max,\n })\n .onChange(v => {\n minGui.setValue(Math.max(min, Math.min(v - valueMinRange, properties[minPropName])));\n });\n return [ minGui, maxGui ];\n}\n\n","import { removeArrayElem } from '../libs/utils.js';\n\nexport default class View {\n domElement: HTMLElement;\n\n #childDestElem: HTMLElement;\n #views: View[] = [];\n\n constructor(elem: HTMLElement) {\n this.domElement = elem;\n this.#childDestElem = elem;\n }\n addElem(elem: HTMLElement) {\n this.#childDestElem.appendChild(elem);\n return elem;\n }\n removeElem(elem: HTMLElement) {\n this.#childDestElem.removeChild(elem);\n return elem;\n }\n pushSubElem(elem: HTMLElement) {\n this.#childDestElem.appendChild(elem);\n this.#childDestElem = elem;\n }\n popSubElem() {\n this.#childDestElem = this.#childDestElem.parentElement!;\n }\n add(view: View) {\n this.#views.push(view);\n this.addElem(view.domElement);\n return view;\n }\n remove(view: View) {\n this.removeElem(view.domElement);\n removeArrayElem(this.#views, view);\n return view;\n }\n pushSubView(view: View) {\n this.pushSubElem(view.domElement);\n }\n popSubView() {\n this.popSubElem();\n }\n setOptions(options: any) {\n for (const view of this.#views) {\n view.setOptions(options);\n }\n }\n updateDisplayIfNeeded(newV: any, ignoreCache?: boolean) {\n for (const view of this.#views) {\n view.updateDisplayIfNeeded(newV, ignoreCache);\n }\n return this;\n }\n $(selector: string) {\n return this.domElement.querySelector(selector);\n }\n}","import { createElem } from '../libs/elem.js';\nimport { removeArrayElem } from '../libs/utils.js';\nimport View from '../views/View.js';\n\nexport default class Controller extends View {\n #changeFns;\n #finishChangeFns;\n #parent;\n\n constructor(className) {\n super(createElem('div', {className: 'muigui-controller'}));\n this.#changeFns = [];\n this.#finishChangeFns = [];\n // we need the specialization to come last so it takes precedence.\n if (className) {\n this.domElement.classList.add(className);\n }\n }\n get parent() {\n return this.#parent;\n }\n setParent(parent) {\n this.#parent = parent;\n this.enable(!this.disabled());\n }\n show(show = true) {\n this.domElement.classList.toggle('muigui-hide', !show);\n this.domElement.classList.toggle('muigui-show', show);\n return this;\n }\n hide() {\n return this.show(false);\n }\n disabled() {\n return !!this.domElement.closest('.muigui-disabled');\n }\n\n enable(enable = true) {\n this.domElement.classList.toggle('muigui-disabled', !enable);\n\n // If disabled we need to set the attribute 'disabled=true' to all\n // input/select/button/textarea's below\n //\n // If enabled we need to set the attribute 'disabled=false' to all below\n // until we hit a disabled controller.\n //\n // ATM the problem is we can find the input/select/button/textarea elements\n // but we can't easily find which controller they belong do.\n // But we don't need to? We can just check up if it or parent has\n // '.muigui-disabled'\n ['input', 'button', 'select', 'textarea'].forEach(tag => {\n this.domElement.querySelectorAll(tag).forEach(elem => {\n const disabled = !!elem.closest('.muigui-disabled');\n elem.disabled = disabled;\n });\n });\n\n return this;\n }\n disable(disable = true) {\n return this.enable(!disable);\n }\n onChange(fn) {\n this.removeChange(fn);\n this.#changeFns.push(fn);\n return this;\n }\n removeChange(fn) {\n removeArrayElem(this.#changeFns, fn);\n return this;\n }\n onFinishChange(fn) {\n this.removeFinishChange(fn);\n this.#finishChangeFns.push(fn);\n return this;\n }\n removeFinishChange(fn) {\n removeArrayElem(this.#finishChangeFns, fn);\n return this;\n }\n #callListeners(fns, newV) {\n for (const fn of fns) {\n fn.call(this, newV);\n }\n }\n emitChange(value, object, property) {\n this.#callListeners(this.#changeFns, value);\n if (this.#parent) {\n if (object === undefined) {\n this.#parent.emitChange(value);\n } else {\n this.#parent.emitChange({\n object,\n property,\n value,\n controller: this,\n });\n }\n }\n }\n emitFinalChange(value, object, property) {\n this.#callListeners(this.#finishChangeFns, value);\n if (this.#parent) {\n if (object === undefined) {\n this.#parent.emitChange(value);\n } else {\n this.#parent.emitFinalChange({\n object,\n property,\n value,\n controller: this,\n });\n }\n }\n }\n updateDisplay() {\n // placeholder. override\n }\n getColors() {\n const toCamelCase = s => s.replace(/-([a-z])/g, (m, m1) => m1.toUpperCase());\n const keys = [\n 'color',\n 'bg-color',\n 'value-color',\n 'value-bg-color',\n 'hover-bg-color',\n 'menu-bg-color',\n 'menu-sep-color',\n 'disabled-color',\n ];\n const div = createElem('div');\n this.domElement.appendChild(div);\n const colors = Object.fromEntries(keys.map(key => {\n div.style.color = `var(--${key})`;\n const s = getComputedStyle(div);\n return [toCamelCase(key), s.color];\n }));\n div.remove();\n return colors;\n }\n}\n","import {\n createElem,\n} from '../libs/elem.js';\nimport { copyExistingProperties } from '../libs/utils.js';\nimport Controller from './Controller.js';\n\nexport default class Button extends Controller {\n #object;\n #property;\n #buttonElem;\n #options = {\n name: '',\n };\n\n constructor(object, property, options = {}) {\n super('muigui-button', '');\n this.#object = object;\n this.#property = property;\n\n this.#buttonElem = this.addElem(\n createElem('button', {\n type: 'button',\n onClick: () => {\n this.#object[this.#property](this);\n },\n }));\n this.setOptions({name: property, ...options});\n }\n name(name) {\n this.#buttonElem.textContent = name;\n }\n setOptions(options) {\n copyExistingProperties(this.#options, options);\n const {name} = this.#options;\n this.#buttonElem.textContent = name;\n }\n}","import { isTypedArray } from '../libs/utils.js';\nimport View from './View.js';\n\nfunction arraysEqual(a, b) {\n if (a.length !== b.length) {\n return false;\n }\n for (let i = 0; i < a.length; ++i) {\n if (a[i] !== b[i]) {\n return false;\n }\n }\n return true;\n}\n\nfunction copyArrayElementsFromTo(src, dst) {\n dst.length = src.length;\n for (let i = 0; i < src.length; ++i) {\n dst[i] = src[i];\n }\n}\n\nexport default class EditView extends View {\n #oldV;\n #updateCheck;\n\n #checkArrayNeedsUpdate(newV) {\n // It's an array, we need to compare all elements\n // Example, vec2, [r,g,b], ...\n const needUpdate = !arraysEqual(newV, this.#oldV);\n if (needUpdate) {\n copyArrayElementsFromTo(newV, this.#oldV);\n }\n return needUpdate;\n }\n\n #checkTypedArrayNeedsUpdate() {\n let once = true;\n return function checkTypedArrayNeedsUpdateImpl(newV) {\n // It's a typedarray, we need to compare all elements\n // Example: Float32Array([r, g, b])\n let needUpdate = once;\n once = false;\n if (!needUpdate) {\n needUpdate = !arraysEqual(newV, this.#oldV);\n }\n return needUpdate;\n };\n }\n\n #checkObjectNeedsUpdate(newV) {\n let needUpdate = false;\n for (const key in newV) {\n if (newV[key] !== this.#oldV[key]) {\n needUpdate = true;\n this.#oldV[key] = newV[key];\n }\n }\n return needUpdate;\n }\n\n #checkValueNeedsUpdate(newV) {\n const needUpdate = newV !== this.#oldV;\n this.#oldV = newV;\n return needUpdate;\n }\n\n #getUpdateCheckForType(newV) {\n if (Array.isArray(newV)) {\n this.#oldV = [];\n return this.#checkArrayNeedsUpdate.bind(this);\n } else if (isTypedArray(newV)) {\n this.#oldV = new newV.constructor(newV);\n return this.#checkTypedArrayNeedsUpdate(this);\n } else if (typeof newV === 'object') {\n this.#oldV = {};\n return this.#checkObjectNeedsUpdate.bind(this);\n } else {\n return this.#checkValueNeedsUpdate.bind(this);\n }\n }\n\n // The point of this is updating DOM elements\n // is slow but if we've called `listen` then\n // every frame we're going to try to update\n // things with the current value so if nothing\n // has changed then skip it.\n updateDisplayIfNeeded(newV, ignoreCache) {\n this.#updateCheck = this.#updateCheck || this.#getUpdateCheckForType(newV);\n // Note: We call #updateCheck first because it updates\n // the cache\n if (this.#updateCheck(newV) || ignoreCache) {\n this.updateDisplay(newV);\n }\n }\n setOptions(/*options*/) {\n // override this\n return this;\n }\n}\n","import { createElem } from '../libs/elem.js';\nimport EditView from './EditView.js';\n\nexport default class CheckboxView extends EditView {\n #checkboxElem;\n constructor(setter, id) {\n const checkboxElem = createElem('input', {\n type: 'checkbox',\n id,\n onInput: () => {\n setter.setValue(checkboxElem.checked);\n },\n onChange: () => {\n setter.setFinalValue(checkboxElem.checked);\n },\n });\n super(createElem('label', {}, [checkboxElem]));\n this.#checkboxElem = checkboxElem;\n }\n updateDisplay(v) {\n this.#checkboxElem.checked = v;\n }\n}\n","import { removeArrayElem } from './utils.js';\n\nconst tasks = [];\nconst tasksToRemove = new Set();\n\nlet requestId;\nlet processing;\n\nfunction removeTasks() {\n if (!tasksToRemove.size) {\n return;\n }\n\n if (processing) {\n queueProcessing();\n return;\n }\n\n tasksToRemove.forEach(task => {\n removeArrayElem(tasks, task);\n });\n tasksToRemove.clear();\n}\n\nfunction processTasks() {\n requestId = undefined;\n processing = true;\n for (const task of tasks) {\n if (!tasksToRemove.has(task)) {\n task();\n }\n }\n processing = false;\n removeTasks();\n queueProcessing();\n}\n\nfunction queueProcessing() {\n if (!requestId && tasks.length) {\n requestId = requestAnimationFrame(processTasks);\n }\n}\n\nexport function addTask(fn) {\n tasks.push(fn);\n queueProcessing();\n}\n\nexport function removeTask(fn) {\n tasksToRemove.set(fn);\n\n const ndx = tasks.indexOf(fn);\n if (ndx >= 0) {\n tasks.splice(ndx, 1);\n }\n}","let id = 0;\n\nexport function makeId() {\n return `muigui-${++id}`;\n}\n","import { createElem } from '../libs/elem.js';\nimport View from './View.js';\n\nexport default class ValueView extends View {\n constructor(className = '') {\n super(createElem('div', {className: 'muigui-value'}));\n if (className) {\n this.domElement.classList.add(className);\n }\n }\n}","import { createElem } from '../libs/elem.js';\nimport { makeId } from '../libs/ids.js';\nimport ValueView from '../views/ValueView.js';\nimport Controller from './Controller.js';\n\nexport default class LabelController extends Controller {\n #id;\n #nameElem;\n\n constructor(className = '', name = '') {\n super('muigui-label-controller');\n this.#id = makeId();\n this.#nameElem = createElem('label', {for: this.#id});\n this.domElement.appendChild(this.#nameElem);\n this.pushSubView(new ValueView(className));\n this.name(name);\n }\n get id() {\n return this.#id;\n }\n name(name) {\n if (this.#nameElem.title === this.#nameElem.textContent) {\n this.#nameElem.title = name;\n }\n this.#nameElem.textContent = name;\n return this;\n }\n tooltip(tip) {\n this.#nameElem.title = tip;\n }\n}\n\n","import {addTask, removeTask} from '../libs/taskrunner.js';\nimport { isTypedArray } from '../libs/utils.js';\nimport LabelController from './LabelController.js';\n\nexport default class ValueController extends LabelController {\n #object;\n #property;\n #initialValue;\n #listening;\n #views;\n #updateFn;\n\n constructor(object, property, className = '') {\n super(className, property);\n this.#object = object;\n this.#property = property;\n this.#initialValue = this.getValue();\n this.#listening = false;\n this.#views = [];\n }\n get initialValue() {\n return this.#initialValue;\n }\n get object() {\n return this.#object;\n }\n get property() {\n return this.#property;\n }\n add(view) {\n this.#views.push(view);\n super.add(view);\n this.updateDisplay();\n return view;\n }\n #setValueImpl(v, ignoreCache) {\n let isDifferent = false;\n if (typeof v === 'object') {\n const dst = this.#object[this.#property];\n // don't replace objects, just their values.\n if (Array.isArray(v) || isTypedArray(v)) {\n for (let i = 0; i < v.length; ++i) {\n isDifferent ||= dst[i] !== v[i];\n dst[i] = v[i];\n }\n } else {\n for (const key of Object.keys(v)) {\n isDifferent ||= dst[key] !== v[key];\n }\n Object.assign(dst, v);\n }\n } else {\n isDifferent = this.#object[this.#property] !== v;\n this.#object[this.#property] = v;\n }\n this.updateDisplay(ignoreCache);\n if (isDifferent) {\n this.emitChange(this.getValue(), this.#object, this.#property);\n }\n return isDifferent;\n }\n setValue(v) {\n this.#setValueImpl(v);\n }\n setFinalValue(v) {\n const isDifferent = this.#setValueImpl(v, true);\n if (isDifferent) {\n this.emitFinalChange(this.getValue(), this.#object, this.#property);\n }\n return this;\n }\n updateDisplay(ignoreCache) {\n const newV = this.getValue();\n for (const view of this.#views) {\n view.updateDisplayIfNeeded(newV, ignoreCache);\n }\n return this;\n }\n setOptions(options) {\n for (const view of this.#views) {\n view.setOptions(options);\n }\n this.updateDisplay();\n return this;\n }\n getValue() {\n return this.#object[this.#property];\n }\n value(v) {\n this.setValue(v);\n return this;\n }\n reset() {\n this.setValue(this.#initialValue);\n return this;\n }\n listen(listen = true) {\n if (!this.#updateFn) {\n this.#updateFn = this.updateDisplay.bind(this);\n }\n if (listen) {\n if (!this.#listening) {\n this.#listening = true;\n addTask(this.#updateFn);\n }\n } else {\n if (this.#listening) {\n this.#listening = false;\n removeTask(this.#updateFn);\n }\n }\n return this;\n }\n}\n\n","import CheckboxView from '../views/CheckboxView.js';\nimport ValueController from './ValueController.js';\n\nexport default class Checkbox extends ValueController {\n constructor(object, property) {\n super(object, property, 'muigui-checkbox');\n const id = this.id;\n this.add(new CheckboxView(this, id));\n this.updateDisplay();\n }\n}","import {\n makeRangeConverters,\n} from './utils.js';\n\nexport const identity = {\n to: v => v,\n from: v => [true, v],\n};\n\n// from: from string to value\n// to: from value to string\nexport const strToNumber = {\n to: v => v.toString(),\n from: v => {\n const newV = parseFloat(v);\n return [!Number.isNaN(newV), newV];\n },\n};\n\nexport const converters = {\n radToDeg: makeRangeConverters({to: [0, 180], from: [0, Math.PI]}),\n};\n","export function createWheelHelper() {\n let wheelAccum = 0;\n return function (e, step, wheelScale = 5) {\n wheelAccum -= e.deltaY * step / wheelScale;\n const wheelSteps = Math.floor(Math.abs(wheelAccum) / step) * Math.sign(wheelAccum);\n const delta = wheelSteps * step;\n wheelAccum -= delta;\n return delta;\n };\n}\n","import { createElem } from '../libs/elem.js';\nimport { strToNumber } from '../libs/conversions.js';\nimport { createWheelHelper } from '../libs/wheel.js';\nimport { clamp, copyExistingProperties, stepify } from '../libs/utils.js';\nimport EditView from './EditView.js';\n\nexport default class NumberView extends EditView {\n #to;\n #from;\n #step;\n #skipUpdate;\n #options = {\n step: 0.01,\n converters: strToNumber,\n min: Number.NEGATIVE_INFINITY,\n max: Number.POSITIVE_INFINITY,\n };\n\n constructor(setter, options) {\n const setValue = setter.setValue.bind(setter);\n const setFinalValue = setter.setFinalValue.bind(setter);\n const wheelHelper = createWheelHelper();\n super(createElem('input', {\n type: 'number',\n onInput: () => {\n this.#handleInput(setValue, true);\n },\n onChange: () => {\n this.#handleInput(setFinalValue, false);\n },\n onWheel: e => {\n e.preventDefault();\n const {min, max, step} = this.#options;\n const delta = wheelHelper(e, step);\n const v = parseFloat(this.domElement.value);\n const newV = clamp(stepify(v + delta, v => v, step), min, max);\n const [valid, outV] = this.#from(newV);\n if (valid) {\n setter.setValue(outV);\n }\n },\n }));\n this.setOptions(options);\n }\n #handleInput(setFn, skipUpdate) {\n const v = parseFloat(this.domElement.value);\n const [valid, newV] = this.#from(v);\n let inRange;\n if (valid && !Number.isNaN(v)) {\n const {min, max} = this.#options;\n inRange = newV >= min && newV <= max;\n this.#skipUpdate = skipUpdate;\n setFn(clamp(newV, min, max));\n }\n this.domElement.classList.toggle('muigui-invalid-value', !valid || !inRange);\n }\n updateDisplay(v) {\n if (!this.#skipUpdate) {\n this.domElement.value = stepify(v, this.#to, this.#step);\n }\n this.#skipUpdate = false;\n }\n setOptions(options) {\n copyExistingProperties(this.#options, options);\n const {\n step,\n converters: {to, from},\n } = this.#options;\n this.#to = to;\n this.#from = from;\n this.#step = step;\n return this;\n }\n}\n","\nimport NumberView from '../views/NumberView.js';\nimport ValueController from './ValueController.js';\n\n// Wanted to name this `Number` but it conflicts with\n// JavaScript `Number`. It most likely wouldn't be\n// an issue? But users might `import {Number} ...` and\n// things would break.\nexport default class TextNumber extends ValueController {\n #textView;\n #step;\n\n constructor(object, property, options = {}) {\n super(object, property, 'muigui-text-number');\n this.#textView = this.add(new NumberView(this, options));\n this.updateDisplay();\n }\n}","import { createElem } from '../libs/elem.js';\nimport EditView from './EditView.js';\n\nexport default class SelectView extends EditView {\n #values;\n\n constructor(setter, keyValues) {\n const values = [];\n super(createElem('select', {\n onChange: () => {\n setter.setFinalValue(this.#values[this.domElement.selectedIndex]);\n },\n }, keyValues.map(([key, value]) => {\n values.push(value);\n return createElem('option', {textContent: key});\n })));\n this.#values = values;\n }\n updateDisplay(v) {\n const ndx = this.#values.indexOf(v);\n this.domElement.selectedIndex = ndx;\n }\n}\n","\n// 4 cases\n// (a) keyValues is array of arrays, each sub array is key value\n// (b) keyValues is array and value is number then keys = array contents, value = index\n// (c) keyValues is array and value is not number, key = array contents, value = array contents\n// (d) keyValues is object then key->value\nexport function convertToKeyValues(keyValues, valueIsNumber) {\n if (Array.isArray(keyValues)) {\n if (Array.isArray(keyValues[0])) {\n // (a) keyValues is array of arrays, each sub array is key value\n return keyValues;\n } else {\n if (valueIsNumber) {\n // (b) keyValues is array and value is number then keys = array contents, value = index\n return keyValues.map((v, ndx) => [v, ndx]);\n } else {\n // (c) keyValues is array and value is not number, key = array contents, value = array contents\n return keyValues.map(v => [v, v]);\n }\n }\n } else {\n // (d)\n return [...Object.entries(keyValues)];\n }\n}\n","import SelectView from '../views/SelectView.js';\nimport ValueController from './ValueController.js';\nimport { convertToKeyValues } from '../libs/key-values.js';\n\nexport default class Select extends ValueController {\n constructor(object, property, options) {\n super(object, property, 'muigui-select');\n const valueIsNumber = typeof this.getValue() === 'number';\n const {keyValues: keyValuesInput} = options;\n const keyValues = convertToKeyValues(keyValuesInput, valueIsNumber);\n this.add(new SelectView(this, keyValues));\n this.updateDisplay();\n }\n}","import { createElem } from '../libs/elem.js';\nimport { identity } from '../libs/conversions.js';\nimport { clamp, copyExistingProperties, stepify } from '../libs/utils.js';\nimport { createWheelHelper } from '../libs/wheel.js';\nimport EditView from './EditView.js';\n\nexport default class RangeView extends EditView {\n #to;\n #from;\n #step;\n #skipUpdate;\n #options = {\n step: 0.01,\n min: 0,\n max: 1,\n converters: identity,\n };\n\n constructor(setter, options) {\n const wheelHelper = createWheelHelper();\n super(createElem('input', {\n type: 'range',\n onInput: () => {\n this.#skipUpdate = true;\n const {min, max, step} = this.#options;\n const v = parseFloat(this.domElement.value);\n const newV = clamp(stepify(v, v => v, step), min, max);\n const [valid, validV] = this.#from(newV);\n if (valid) {\n setter.setValue(validV);\n }\n },\n onChange: () => {\n this.#skipUpdate = true;\n const {min, max, step} = this.#options;\n const v = parseFloat(this.domElement.value);\n const newV = clamp(stepify(v, v => v, step), min, max);\n const [valid, validV] = this.#from(newV);\n if (valid) {\n setter.setFinalValue(validV);\n }\n },\n onWheel: e => {\n e.preventDefault();\n const [valid, v] = this.#from(parseFloat(this.domElement.value));\n if (!valid) {\n return;\n }\n const {min, max, step} = this.#options;\n const delta = wheelHelper(e, step);\n const newV = clamp(stepify(v + delta, v => v, step), min, max);\n setter.setValue(newV);\n },\n }));\n this.setOptions(options);\n }\n updateDisplay(v) {\n if (!this.#skipUpdate) {\n this.domElement.value = stepify(v, this.#to, this.#step);\n }\n this.#skipUpdate = false;\n }\n setOptions(options) {\n copyExistingProperties(this.#options, options);\n const {\n step,\n min,\n max,\n converters: {to, from},\n } = this.#options;\n this.#to = to;\n this.#from = from;\n this.#step = step;\n this.domElement.step = step;\n this.domElement.min = min;\n this.domElement.max = max;\n return this;\n }\n}","import ValueController from './ValueController.js';\nimport NumberView from '../views/NumberView.js';\nimport RangeView from '../views/RangeView.js';\n\nexport default class Range extends ValueController {\n constructor(object, property, options) {\n super(object, property, 'muigui-range');\n this.add(new RangeView(this, options));\n this.add(new NumberView(this, options));\n }\n}\n","import { createElem } from '../libs/elem.js';\nimport { identity } from '../libs/conversions.js';\nimport EditView from './EditView.js';\nimport { copyExistingProperties } from '../libs/utils.js';\n\nexport default class TextView extends EditView {\n #to;\n #from;\n #skipUpdate;\n #options = {\n converters: identity,\n };\n\n constructor(setter, options) {\n const setValue = setter.setValue.bind(setter);\n const setFinalValue = setter.setFinalValue.bind(setter);\n super(createElem('input', {\n type: 'text',\n onInput: () => {\n this.#handleInput(setValue, true);\n },\n onChange: () => {\n this.#handleInput(setFinalValue, false);\n },\n }));\n this.setOptions(options);\n }\n #handleInput(setFn, skipUpdate) {\n const [valid, newV] = this.#from(this.domElement.value);\n if (valid) {\n this.#skipUpdate = skipUpdate;\n setFn(newV);\n }\n this.domElement.style.color = valid ? '' : 'var(--invalid-color)';\n\n }\n updateDisplay(v) {\n if (!this.#skipUpdate) {\n this.domElement.value = this.#to(v);\n this.domElement.style.color = '';\n }\n this.#skipUpdate = false;\n }\n setOptions(options) {\n copyExistingProperties(this.#options, options);\n const {\n converters: {to, from},\n } = this.#options;\n this.#to = to;\n this.#from = from;\n return this;\n }\n}\n","import TextView from '../views/TextView.js';\nimport ValueController from './ValueController.js';\n\nexport default class Text extends ValueController {\n constructor(object, property) {\n super(object, property, 'muigui-text');\n this.add(new TextView(this));\n this.updateDisplay();\n }\n}","import Button from './Button.js';\nimport Checkbox from './Checkbox.js';\nimport TextNumber from './TextNumber.js';\nimport Select from './Select.js';\nimport Range from './Range.js';\nimport Text from './Text.js';\n\n// const isConversion = o => typeof o.to === 'function' && typeof o.from === 'function';\n\n/**\n * possible inputs\n * add(o, p, min: number, max: number)\n * add(o, p, min: number, max: number, step: number)\n * add(o, p, array: [value])\n * add(o, p, array: [[key, value]])\n *\n * @param {*} object\n * @param {string} property\n * @param {...any} args\n * @returns {Controller}\n */\nexport function createController(object, property, ...args) {\n const [arg1] = args;\n if (Array.isArray(arg1)) {\n return new Select(object, property, {keyValues: arg1});\n }\n if (arg1 && arg1.keyValues) {\n return new Select(object, property, {keyValues: arg1.keyValues});\n }\n\n const t = typeof object[property];\n switch (t) {\n case 'number':\n if (typeof args[0] === 'number' && typeof args[1] === 'number') {\n const min = args[0];\n const max = args[1];\n const step = args[2];\n return new Range(object, property, {min, max, ...(step && {step})});\n }\n return args.length === 0\n ? new TextNumber(object, property, ...args)\n : new Range(object, property, ...args);\n case 'boolean':\n return new Checkbox(object, property, ...args);\n case 'function':\n return new Button(object, property, ...args);\n case 'string':\n return new Text(object, property, ...args);\n case 'undefined':\n throw new Error(`no property named ${property}`);\n default:\n throw new Error(`unhandled type ${t} for property ${property}`);\n }\n}","const clamp = (v, min, max) => Math.max(min, Math.min(max, v));\nconst lerp = (a, b, t) => a + (b - a) * t;\nconst fract = v => v >= 0 ? v % 1 : 1 - (v % 1);\n\nconst f0 = v => +v.toFixed(0); // converts to string (eg 1.2 => \"1\"), then converts back to number (eg, \"1.200\" => 1.2)\nconst f3 = v => +v.toFixed(3); // converts to string (eg 1.2 => \"1.200\"), then converts back to number (eg, \"1.200\" => 1.2)\n\nconst hexToUint32RGB = v => (parseInt(v.substring(1, 3), 16) << 16) |\n (parseInt(v.substring(3, 5), 16) << 8 ) |\n (parseInt(v.substring(5, 7), 16) );\nconst uint32RGBToHex = v => `#${(Math.round(v)).toString(16).padStart(6, '0')}`;\nconst hexToUint32RGBA = v => (parseInt(v.substring(1, 3), 16) * 2 ** 24) +\n (parseInt(v.substring(3, 5), 16) * 2 ** 16) +\n (parseInt(v.substring(5, 7), 16) * 2 ** 8) +\n (parseInt(v.substring(7, 9), 16) );\nconst uint32RGBAToHex = v => `#${(Math.round(v)).toString(16).padStart(8, '0')}`;\n\nexport const hexToUint8RGB = v => [\n parseInt(v.substring(1, 3), 16),\n parseInt(v.substring(3, 5), 16),\n parseInt(v.substring(5, 7), 16),\n];\nexport const uint8RGBToHex = v => `#${Array.from(v).map(v => v.toString(16).padStart(2, '0')).join('')}`;\n\nexport const hexToUint8RGBA = v => [\n parseInt(v.substring(1, 3), 16),\n parseInt(v.substring(3, 5), 16),\n parseInt(v.substring(5, 7), 16),\n parseInt(v.substring(7, 9), 16),\n];\nexport const uint8RGBAToHex = v => `#${Array.from(v).map(v => v.toString(16).padStart(2, '0')).join('')}`;\n\nexport const hexToFloatRGB = v => hexToUint8RGB(v).map(v => f3(v / 255));\nexport const floatRGBToHex = v => uint8RGBToHex(Array.from(v).map(v => Math.round(clamp(v * 255, 0, 255))));\n\nexport const hexToFloatRGBA = v => hexToUint8RGBA(v).map(v => f3(v / 255));\nexport const floatRGBAToHex = v => uint8RGBAToHex(Array.from(v).map(v => Math.round(clamp(v * 255, 0, 255))));\n\nconst scaleAndClamp = v => clamp(Math.round(v * 255), 0, 255).toString(16).padStart(2, '0');\n\nconst hexToObjectRGB = v => ({\n r: parseInt(v.substring(1, 3), 16) / 255,\n g: parseInt(v.substring(3, 5), 16) / 255,\n b: parseInt(v.substring(5, 7), 16) / 255,\n});\nconst objectRGBToHex = v => `#${scaleAndClamp(v.r)}${scaleAndClamp(v.g)}${scaleAndClamp(v.b)}`;\nconst hexToObjectRGBA = v => ({\n r: parseInt(v.substring(1, 3), 16) / 255,\n g: parseInt(v.substring(3, 5), 16) / 255,\n b: parseInt(v.substring(5, 7), 16) / 255,\n a: parseInt(v.substring(7, 9), 16) / 255,\n});\nconst objectRGBAToHex = v => `#${scaleAndClamp(v.r)}${scaleAndClamp(v.g)}${scaleAndClamp(v.b)}${scaleAndClamp(v.a)}`;\n\nconst hexToCssRGB = v => `rgb(${hexToUint8RGB(v).join(', ')})`;\nconst cssRGBRegex = /^\\s*rgb\\(\\s*(\\d+)\\s*,\\s*(\\d+)\\s*,\\s*(\\d+)\\s*\\)\\s*$/;\nconst cssRGBToHex = v => {\n const m = cssRGBRegex.exec(v);\n return uint8RGBToHex([m[1], m[2], m[3]].map(v => parseInt(v)));\n};\nconst hexToCssRGBA = v => `rgba(${hexToUint8RGBA(v).map((v, i) => i === 3 ? v / 255 : v).join(', ')})`;\nconst cssRGBARegex = /^\\s*rgba\\(\\s*(\\d+)\\s*,\\s*(\\d+)\\s*,\\s*(\\d+)\\s*,\\s*(\\d+\\.\\d+|\\d+)\\s*\\)\\s*$/;\nconst cssRGBAToHex = v => {\n const m = cssRGBARegex.exec(v);\n return uint8RGBAToHex([m[1], m[2], m[3], m[4]].map((v, i) => i === 3 ? (parseFloat(v) * 255 | 0) : parseInt(v)));\n};\n\nconst hexToCssHSL = v => {\n const hsl = rgbUint8ToHsl(hexToUint8RGB(v)).map(v => f0(v));\n return `hsl(${hsl[0]}, ${hsl[1]}%, ${hsl[2]}%)`;\n};\nconst hexToCssHSLA = v => {\n const hsla = rgbaUint8ToHsla(hexToUint8RGBA(v)).map((v, i) => i === 3 ? f3(v) : f0(v));\n return `hsl(${hsla[0]} ${hsla[1]}% ${hsla[2]}% / ${hsla[3]})`;\n};\nconst cssHSLRegex = /^\\s*hsl\\(\\s*(\\d+)(?:deg|)\\s*(?:,|)\\s*(\\d+)%\\s*(?:,|)\\s*(\\d+)%\\s*\\)\\s*$/;\nconst cssHSLARegex = /^\\s*hsl\\(\\s*(\\d+)(?:deg|)\\s*(?:,|)\\s*(\\d+)%\\s*(?:,|)\\s*(\\d+)%\\s*\\/\\s*(\\d+\\.\\d+|\\d+)\\s*\\)\\s*$/;\n\nconst hex3DigitTo6Digit = v => `${v[0]}${v[0]}${v[1]}${v[1]}${v[2]}${v[2]}`;\nconst cssHSLToHex = v => {\n const m = cssHSLRegex.exec(v);\n const rgb = hslToRgbUint8([m[1], m[2], m[3]].map(v => parseFloat(v)));\n return uint8RGBToHex(rgb);\n};\nconst cssHSLAToHex = v => {\n const m = cssHSLARegex.exec(v);\n const rgba = hslaToRgbaUint8([m[1], m[2], m[3], m[4]].map(v => parseFloat(v)));\n return uint8RGBAToHex(rgba);\n};\n\nconst euclideanModulo = (v, n) => ((v % n) + n) % n;\n\nexport function hslToRgbUint8([h, s, l]) {\n h = euclideanModulo(h, 360);\n s = clamp(s / 100, 0, 1);\n l = clamp(l / 100, 0, 1);\n\n const a = s * Math.min(l, 1 - l);\n\n function f(n) {\n const k = (n + h / 30) % 12;\n return l - a * Math.max(-1, Math.min(k - 3, 9 - k, 1));\n }\n\n return [f(0), f(8), f(4)].map(v => Math.round(v * 255));\n}\n\nexport function hslaToRgbaUint8([h, s, l, a]) {\n const rgb = hslToRgbUint8([h, s, l]);\n return [...rgb, a * 255 | 0];\n}\n\nexport function rgbFloatToHsl01([r, g, b]) {\n const max = Math.max(r, g, b);\n const min = Math.min(r, g, b);\n const l = (min + max) * 0.5;\n const d = max - min;\n let h = 0;\n let s = 0;\n\n if (d !== 0) {\n s = (l === 0 || l === 1)\n ? 0\n : (max - l) / Math.min(l, 1 - l);\n\n switch (max) {\n case r: h = (g - b) / d + (g < b ? 6 : 0); break;\n case g: h = (b - r) / d + 2; break;\n case b: h = (r - g) / d + 4;\n }\n }\n\n return [h / 6, s, l];\n}\n\nexport function rgbaFloatToHsla01([r, g, b, a]) {\n const hsl = rgbFloatToHsl01([r, g, b]);\n return [...hsl, a];\n}\n\nexport const rgbUint8ToHsl = (rgb) => {\n const [h, s, l] = rgbFloatToHsl01(rgb.map(v => v / 255));\n return [h * 360, s * 100, l * 100];\n};\n\nexport const rgbaUint8ToHsla = (rgba) => {\n const [h, s, l, a] = rgbaFloatToHsla01(rgba.map(v => v / 255));\n return [h * 360, s * 100, l * 100, a];\n};\n\nexport function hsv01ToRGBFloat([hue, sat, val]) {\n sat = clamp(sat, 0, 1);\n val = clamp(val, 0, 1);\n return [hue, hue + 2 / 3, hue + 1 / 3].map(\n v => lerp(1, clamp(Math.abs(fract(v) * 6 - 3.0) - 1, 0, 1), sat) * val\n );\n}\n\nexport function hsva01ToRGBAFloat([hue, sat, val, alpha]) {\n const rgb = hsv01ToRGBFloat([hue, sat, val]);\n return [...rgb, alpha];\n}\n\nconst round3 = v => Math.round(v * 1000) / 1000;\n\nexport function rgbFloatToHSV01([r, g, b]) {\n const p = b > g\n ? [b, g, -1, 2 / 3]\n : [g, b, 0, -1 / 3];\n const q = p[0] > r\n ? [p[0], p[1], p[3], r]\n : [r, p[1], p[2], p[0]];\n const d = q[0] - Math.min(q[3], q[1]);\n return [\n Math.abs(q[2] + (q[3] - q[1]) / (6 * d + Number.EPSILON)),\n d / (q[0] + Number.EPSILON),\n q[0],\n ].map(round3);\n}\n\nexport function rgbaFloatToHSVA01([r, g, b, a]) {\n const hsv = rgbFloatToHSV01([r, g, b]);\n return [...hsv, a];\n}\n\n// window.hsv01ToRGBFloat = hsv01ToRGBFloat;\n// window.rgbFloatToHSV01 = rgbFloatToHSV01;\n\n// Yea, meh!\nexport const hasAlpha = format => format.endsWith('a') || format.startsWith('hex8');\n\nconst cssStringFormats = [\n { re: /^#(?:[0-9a-f]){6}$/i, format: 'hex6' },\n { re: /^(?:[0-9a-f]){6}$/i, format: 'hex6-no-hash' },\n { re: /^#(?:[0-9a-f]){8}$/i, format: 'hex8' },\n { re: /^(?:[0-9a-f]){8}$/i, format: 'hex8-no-hash' },\n { re: /^#(?:[0-9a-f]){3}$/i, format: 'hex3' },\n { re: /^(?:[0-9a-f]){3}$/i, format: 'hex3-no-hash' },\n { re: cssRGBRegex, format: 'css-rgb' },\n { re: cssHSLRegex, format: 'css-hsl' },\n { re: cssRGBARegex, format: 'css-rgba' },\n { re: cssHSLARegex, format: 'css-hsla' },\n];\n\nfunction guessStringColorFormat(v) {\n for (const formatInfo of cssStringFormats) {\n if (formatInfo.re.test(v)) {\n return formatInfo;\n }\n }\n return undefined;\n}\n\nexport function guessFormat(v) {\n switch (typeof v) {\n case 'number':\n console.warn('can not reliably guess format based on a number. You should pass in a format like {format: \"uint32-rgb\"} or {format: \"uint32-rgb\"}');\n return v <= 0xFFFFFF ? 'uint32-rgb' : 'uint32-rgba';\n case 'string': {\n const formatInfo = guessStringColorFormat(v.trim());\n if (formatInfo) {\n return formatInfo.format;\n }\n break;\n }\n case 'object':\n if (v instanceof Uint8Array || v instanceof Uint8ClampedArray) {\n if (v.length === 3) {\n return 'uint8-rgb';\n } else if (v.length === 4) {\n return 'uint8-rgba';\n }\n } else if (v instanceof Float32Array) {\n if (v.length === 3) {\n return 'float-rgb';\n } else if (v.length === 4) {\n return 'float-rgba';\n }\n } else if (Array.isArray(v)) {\n if (v.length === 3) {\n return 'float-rgb';\n } else if (v.length === 4) {\n return 'float-rgba';\n }\n } else {\n if ('r' in v && 'g' in v && 'b' in v) {\n if ('a' in v) {\n return 'object-rgba';\n } else {\n return 'object-rgb';\n }\n }\n }\n }\n throw new Error(`unknown color format: ${v}`);\n}\n\nfunction fixHex6(v) {\n return v.trim(v);\n //const formatInfo = guessStringColorFormat(v.trim());\n //const fix = formatInfo ? formatInfo.fix : v => v;\n //return fix(v.trim());\n}\n\nfunction fixHex8(v) {\n return v.trim(v);\n //const formatInfo = guessStringColorFormat(v.trim());\n //const fix = formatInfo ? formatInfo.fix : v => v;\n //return fix(v.trim());\n}\n\nfunction hex6ToHex3(hex6) {\n return (hex6[1] === hex6[2] &&\n hex6[3] === hex6[4] &&\n hex6[5] === hex6[6])\n ? `#${hex6[1]}${hex6[3]}${hex6[5]}`\n : hex6;\n}\n\nconst hex3RE = /^(#|)([0-9a-f]{3})$/i;\nfunction hex3ToHex6(hex3) {\n const m = hex3RE.exec(hex3);\n if (m) {\n const [, , m2] = m;\n return `#${hex3DigitTo6Digit(m2)}`;\n }\n return hex3;\n}\n\nfunction fixHex3(v) {\n return hex6ToHex3(fixHex6(v));\n}\n\nconst strToRGBObject = (s) => {\n try {\n const json = s.replace(/([a-z])/g, '\"$1\"');\n const rgb = JSON.parse(json);\n if (Number.isNaN(rgb.r) || Number.isNaN(rgb.g) || Number.isNaN(rgb.b)) {\n throw new Error('not {r, g, b}');\n }\n return [true, rgb];\n } catch (e) {\n return [false];\n }\n};\n\nconst strToRGBAObject = (s) => {\n try {\n const json = s.replace(/([a-z])/g, '\"$1\"');\n const rgba = JSON.parse(json);\n if (Number.isNaN(rgba.r) || Number.isNaN(rgba.g) || Number.isNaN(rgba.b) || Number.isNaN(rgba.a)) {\n throw new Error('not {r, g, b, a}');\n }\n return [true, rgba];\n } catch (e) {\n return [false];\n }\n};\n\nconst strToCssRGB = s => {\n const m = cssRGBRegex.exec(s);\n if (!m) {\n return [false];\n }\n const v = [m[1], m[2], m[3]].map(v => parseInt(v));\n const outOfRange = v.find(v => v > 255);\n return [!outOfRange, `rgb(${v.join(', ')})`];\n};\n\nconst strToCssRGBA = s => {\n const m = cssRGBARegex.exec(s);\n if (!m) {\n return [false];\n }\n const v = [m[1], m[2], m[3], m[4]].map((v, i) => i === 3 ? parseFloat(v) : parseInt(v));\n const outOfRange = v.find(v => v > 255);\n return [!outOfRange, `rgba(${v.join(', ')})`];\n};\n\nconst strToCssHSL = s => {\n const m = cssHSLRegex.exec(s);\n if (!m) {\n return [false];\n }\n const v = [m[1], m[2], m[3]].map(v => parseFloat(v));\n const outOfRange = v.find(v => Number.isNaN(v));\n return [!outOfRange, `hsl(${v[0]}, ${v[1]}%, ${v[2]}%)`];\n};\n\nconst strToCssHSLA = s => {\n const m = cssHSLARegex.exec(s);\n if (!m) {\n return [false];\n }\n const v = [m[1], m[2], m[3], m[4]].map(v => parseFloat(v));\n const outOfRange = v.find(v => Number.isNaN(v));\n return [!outOfRange, `hsl(${v[0]} ${v[1]}% ${v[2]}% / ${v[3]})`];\n};\n\nconst rgbObjectToStr = rgb => {\n return `{r:${f3(rgb.r)}, g:${f3(rgb.g)}, b:${f3(rgb.b)}}`;\n};\nconst rgbaObjectToStr = rgba => {\n return `{r:${f3(rgba.r)}, g:${f3(rgba.g)}, b:${f3(rgba.b)}}, a:${f3(rgba.a)}}`;\n};\n\nconst strTo3IntsRE = /^\\s*(\\d+)\\s*,\\s*(\\d+)\\s*,\\s*(\\d+)\\s*$/;\nconst strTo3Ints = s => {\n const m = strTo3IntsRE.exec(s);\n if (!m) {\n return [false];\n }\n const v = [m[1], m[2], m[3]].map(v => parseInt(v));\n const outOfRange = v.find(v => v > 255);\n return [!outOfRange, v];\n};\n\nconst strTo4IntsRE = /^\\s*(\\d+)\\s*,\\s*(\\d+)\\s*,\\s*(\\d+)\\s*$/;\nconst strTo4Ints = s => {\n const m = strTo4IntsRE.exec(s);\n if (!m) {\n return [false];\n }\n const v = [m[1], m[2], m[3], m[4]].map(v => parseInt(v));\n const outOfRange = v.find(v => v > 255);\n return [!outOfRange, v];\n};\n\nconst strTo3Floats = s => {\n const numbers = s.split(',').map(s => s.trim());\n const v = numbers.map(v => parseFloat(v));\n if (v.length !== 3) {\n return [false];\n }\n // Note: using isNaN not Number.isNaN\n const badNdx = numbers.findIndex(v => isNaN(v));\n return [badNdx < 0, v.map(v => f3(v))];\n};\n\nconst strTo4Floats = s => {\n const numbers = s.split(',').map(s => s.trim());\n const v = numbers.map(v => parseFloat(v));\n if (v.length !== 4) {\n return [false];\n }\n // Note: using isNaN not Number.isNaN\n const badNdx = numbers.findIndex(v => isNaN(v));\n return [badNdx < 0, v.map(v => f3(v))];\n};\n\nconst strToUint32RGBRegex = /^\\s*(?:0x){0,1}([0-9a-z]{1,6})\\s*$/i;\nconst strToUint32RGB = s => {\n const m = strToUint32RGBRegex.exec(s);\n if (!m) {\n return [false];\n }\n return [true, parseInt(m[1], 16)];\n};\n\nconst strToUint32RGBARegex = /^\\s*(?:0x){0,1}([0-9a-z]{1,8})\\s*$/i;\nconst strToUint32RGBA = s => {\n const m = strToUint32RGBARegex.exec(s);\n if (!m) {\n return [false];\n }\n return [true, parseInt(m[1], 16)];\n};\n\nconst hex6RE = /^\\s*#[a-f0-9]{6}\\s*$|^\\s*#[a-f0-9]{3}\\s*$/i;\nconst hexNoHash6RE = /^\\s*[a-f0-9]{6}\\s*$/i;\nconst hex8RE = /^\\s*#[a-f0-9]{8}\\s*$/i;\nconst hexNoHash8RE = /^\\s*[a-f0-9]{8}\\s*$/i;\n\n// For each format converter\n//\n// fromHex/toHex convert from/to '#RRGGBB'\n//\n// fromHex converts from the string '#RRBBGG' to the format\n// (eg: for uint32-rgb, '#123456' becomes 0x123456)\n//\n// toHex converts from the format to '#RRGGBB'\n// (eg: for uint8-rgb, [16, 33, 50] becomes '#102132')\n//\n//\n// fromStr/toStr convert from/to what's in the input[type=text] element\n//\n// toStr converts from the format to its string representation\n// (eg, for object-rgb, {r: 1, g: 0.5, b:0} becomes \"{r: 1, g: 0.5, b:0}\")\n// ^object ^string\n//\n// fromStr converts its string representation to its format\n// (eg, for object-rgb) \"{r: 1, g: 0.5, b:0}\" becomes {r: 1, g: 0.5, b:0})\n// ^string ^object\n// fromString returns an array which is [valid, v]\n// where valid is true if the string was a valid and v is the converted\n// format if v is true.\n//\n// Note: toStr should convert to \"ideal\" form (whatever that is).\n// (eg, for css-rgb\n// \"{ r: 0.10000, g: 001, b: 0}\" becomes \"{r: 0.1, g: 1, b: 0}\"\n// notice that css-rgb is a string to a string\n// )\nexport const colorFormatConverters = {\n 'hex6': {\n color: {\n from: v => [true, v],\n to: fixHex6,\n },\n text: {\n from: v => [hex6RE.test(v), v.trim()],\n to: v => v,\n },\n },\n 'hex8': {\n color: {\n from: v => [true, v],\n to: fixHex8,\n },\n text: {\n from: v => [hex8RE.test(v), v.trim()],\n to: v => v,\n },\n },\n 'hex3': {\n color: {\n from: v => [true, fixHex3(v)],\n to: hex3ToHex6,\n },\n text: {\n from: v => [hex6RE.test(v), hex6ToHex3(v.trim())],\n to: v => v,\n },\n },\n 'hex6-no-hash': {\n color: {\n from: v => [true, v.substring(1)],\n to: v => `#${fixHex6(v)}`,\n },\n text: {\n from: v => [hexNoHash6RE.test(v), v.trim()],\n to: v => v,\n },\n },\n 'hex8-no-hash': {\n color: {\n from: v => [true, v.substring(1)],\n to: v => `#${fixHex8(v)}`,\n },\n text: {\n from: v => [hexNoHash8RE.test(v), v.trim()],\n to: v => v,\n },\n },\n 'hex3-no-hash': {\n color: {\n from: v => [true, fixHex3(v).substring(1)],\n to: hex3ToHex6,\n },\n text: {\n from: v => [hexNoHash6RE.test(v), hex6ToHex3(v.trim())],\n to: v => v,\n },\n },\n 'uint32-rgb': {\n color: {\n from: v => [true, hexToUint32RGB(v)],\n to: uint32RGBToHex,\n },\n text: {\n from: v => strToUint32RGB(v),\n to: v => `0x${v.toString(16).padStart(6, '0')}`,\n },\n },\n 'uint32-rgba': {\n color: {\n from: v => [true, hexToUint32RGBA(v)],\n to: uint32RGBAToHex,\n },\n text: {\n from: v => strToUint32RGBA(v),\n to: v => `0x${v.toString(16).padStart(8, '0')}`,\n },\n },\n 'uint8-rgb': {\n color: {\n from: v => [true, hexToUint8RGB(v)],\n to: uint8RGBToHex,\n },\n text: {\n from: strTo3Ints,\n to: v => v.join(', '),\n },\n },\n 'uint8-rgba': {\n color: {\n from: v => [true, hexToUint8RGBA(v)],\n to: uint8RGBAToHex,\n },\n text: {\n from: strTo4Ints,\n to: v => v.join(', '),\n },\n },\n 'float-rgb': {\n color: {\n from: v => [true, hexToFloatRGB(v)],\n to: floatRGBToHex,\n },\n text: {\n from: strTo3Floats,\n // need Array.from because map of Float32Array makes a Float32Array\n to: v => Array.from(v).map(v => f3(v)).join(', '),\n },\n },\n 'float-rgba': {\n color: {\n from: v => [true, hexToFloatRGBA(v)],\n to: floatRGBAToHex,\n },\n text: {\n from: strTo4Floats,\n // need Array.from because map of Float32Array makes a Float32Array\n to: v => Array.from(v).map(v => f3(v)).join(', '),\n },\n },\n 'float-hsv': {\n color: {\n from: v => [true, rgbFloatToHSV01(hexToFloatRGB(v))],\n to: v => hsv01ToRGBFloat(floatRGBToHex(v)),\n },\n text: {\n from: strTo3Floats,\n // need Array.from because map of Float32Array makes a Float32Array\n to: v => Array.from(v).map(v => f3(v)).join(', '),\n },\n },\n 'float-hsva': {\n color: {\n from: v => [true, rgbaFloatToHSVA01(hexToFloatRGB(v))],\n to: v => hsva01ToRGBAFloat(floatRGBToHex(v)),\n },\n text: {\n from: strTo4Floats,\n // need Array.from because map of Float32Array makes a Float32Array\n to: v => Array.from(v).map(v => f3(v)).join(', '),\n },\n },\n //'float-hsl': {\n // color: {\n // from: v => [true, rgbFloatToHsl01(hexToFloatRGB(v))],\n // to: v => hsl01ToRGBFloat(floatRGBToHex(v)),\n // },\n // text: {\n // from: strTo3Floats,\n // // need Array.from because map of Float32Array makes a Float32Array\n // to: v => Array.from(v).map(v => f3(v)).join(', '),\n // },\n //},\n //'float-hsla': {\n // color: {\n // from: v => [true, hexToFloatRGBA(v)],\n // to: floatRGBAToHex,\n // },\n // text: {\n // from: strTo4Floats,\n // // need Array.from because map of Float32Array makes a Float32Array\n // to: v => Array.from(v).map(v => f3(v)).join(', '),\n // },\n //},\n 'object-rgb': {\n color: {\n from: v => [true, hexToObjectRGB(v)],\n to: objectRGBToHex,\n },\n text: {\n from: strToRGBObject,\n to: rgbObjectToStr,\n },\n },\n 'object-rgba': {\n color: {\n from: v => [true, hexToObjectRGBA(v)],\n to: objectRGBAToHex,\n },\n text: {\n from: strToRGBAObject,\n to: rgbaObjectToStr,\n },\n },\n 'css-rgb': {\n color: {\n from: v => [true, hexToCssRGB(v)],\n to: cssRGBToHex,\n },\n text: {\n from: strToCssRGB,\n to: v => strToCssRGB(v)[1],\n },\n },\n 'css-rgba': {\n color: {\n from: v => [true, hexToCssRGBA(v)],\n to: cssRGBAToHex,\n },\n text: {\n from: strToCssRGBA,\n to: v => strToCssRGBA(v)[1],\n },\n },\n 'css-hsl': {\n color: {\n from: v => [true, hexToCssHSL(v)],\n to: cssHSLToHex,\n },\n text: {\n from: strToCssHSL,\n to: v => strToCssHSL(v)[1],\n },\n },\n 'css-hsla': {\n color: {\n from: v => [true, hexToCssHSLA(v)],\n to: cssHSLAToHex,\n },\n text: {\n from: strToCssHSLA,\n to: v => strToCssHSLA(v)[1],\n },\n },\n};","import { createElem } from '../libs/elem.js';\nimport View from './View.js';\n\nexport default class ElementView extends View {\n constructor(tag, className) {\n super(createElem(tag, {className}));\n }\n}","import ElementView from '../views/ElementView.js';\nimport LabelController from './LabelController.js';\n\n// TODO: remove this? Should just be user side\nexport default class Canvas extends LabelController {\n #canvasElem;\n\n constructor(name) {\n super('muigui-canvas', name);\n this.#canvasElem = this.add(\n new ElementView('canvas', 'muigui-canvas'),\n ).domElement;\n }\n get canvas() {\n return this.#canvasElem;\n }\n}","import { createElem } from '../libs/elem.js';\nimport { identity } from '../libs/conversions.js';\nimport EditView from './EditView.js';\nimport { copyExistingProperties } from '../libs/utils.js';\n\nexport default class ColorView extends EditView {\n #to;\n #from;\n #colorElem;\n #skipUpdate;\n #options = {\n converters: identity,\n };\n\n constructor(setter, options) {\n const colorElem = createElem('input', {\n type: 'color',\n onInput: () => {\n const [valid, newV] = this.#from(colorElem.value);\n if (valid) {\n this.#skipUpdate = true;\n setter.setValue(newV);\n }\n },\n onChange: () => {\n const [valid, newV] = this.#from(colorElem.value);\n if (valid) {\n this.#skipUpdate = true;\n setter.setFinalValue(newV);\n }\n },\n });\n super(createElem('div', {}, [colorElem]));\n this.setOptions(options);\n this.#colorElem = colorElem;\n }\n updateDisplay(v) {\n if (!this.#skipUpdate) {\n this.#colorElem.value = this.#to(v);\n }\n this.#skipUpdate = false;\n }\n setOptions(options) {\n copyExistingProperties(this.#options, options);\n const {converters: {to, from}} = this.#options;\n this.#to = to;\n this.#from = from;\n return this;\n }\n}\n","import {\n colorFormatConverters,\n guessFormat,\n} from '../libs/color-utils.js';\nimport ValueController from './ValueController.js';\nimport TextView from '../views/TextView.js';\nimport ColorView from '../views/ColorView.js';\n\nexport default class Color extends ValueController {\n #colorView;\n #textView;\n\n constructor(object, property, options = {}) {\n super(object, property, 'muigui-color');\n const format = options.format || guessFormat(this.getValue());\n const {color, text} = colorFormatConverters[format];\n this.#colorView = this.add(new ColorView(this, {converters: color}));\n this.#textView = this.add(new TextView(this, {converters: text}));\n this.updateDisplay();\n }\n setOptions(options) {\n const {format} = options;\n if (format) {\n const {color, text} = colorFormatConverters[format];\n this.#colorView.setOptions({converters: color});\n this.#textView.setOptions({converters: text});\n }\n super.setOptions(options);\n return this;\n }\n}","import Controller from './Controller.js';\n\n// This feels like it should be something else like\n// gui.addController({className: 'muigui-divider')};\nexport default class Divider extends Controller {\n constructor() {\n super('muigui-divider');\n }\n}","import Controller from './Controller.js';\n\nexport default class Container extends Controller {\n #controllers;\n #childDestController;\n\n constructor(className) {\n super(className);\n this.#controllers = [];\n this.#childDestController = this;\n }\n get children() {\n return this.#controllers; // should we return a copy?\n }\n get controllers() {\n return this.#controllers.filter(c => !(c instanceof Container));\n }\n get folders() {\n return this.#controllers.filter(c => c instanceof Container);\n }\n reset(recursive = true) {\n for (const controller of this.#controllers) {\n if (!(controller instanceof Container) || recursive) {\n controller.reset(recursive);\n }\n }\n return this;\n }\n updateDisplay() {\n for (const controller of this.#controllers) {\n controller.updateDisplay();\n }\n return this;\n }\n remove(controller) {\n const ndx = this.#controllers.indexOf(controller);\n if (ndx >= 0) {\n const c = this.#controllers.splice(ndx, 1);\n const c0 = c[0];\n const elem = c0.domElement;\n elem.remove();\n c0.setParent(null);\n }\n return this;\n }\n #addControllerImpl(controller) {\n this.domElement.appendChild(controller.domElement);\n this.#controllers.push(controller);\n controller.setParent(this);\n return controller;\n }\n addController(controller) {\n return this.#childDestController.#addControllerImpl(controller);\n }\n pushContainer(container) {\n this.addController(container);\n this.#childDestController = container;\n return container;\n }\n popContainer() {\n this.#childDestController = this.#childDestController.parent;\n return this;\n }\n}\n","import { createElem } from '../libs/elem.js';\nimport Container from './Container.js';\n\nexport default class Folder extends Container {\n #labelElem;\n\n constructor(name = 'Controls', className = 'muigui-menu') {\n super(className);\n this.#labelElem = createElem('label');\n this.addElem(createElem('button', {\n type: 'button',\n onClick: () => this.toggleOpen(),\n }, [this.#labelElem]));\n this.pushContainer(new Container('muigui-open-container'));\n this.pushContainer(new Container());\n this.name(name);\n this.open();\n }\n open(open = true) {\n this.domElement.classList.toggle('muigui-closed', !open);\n this.domElement.classList.toggle('muigui-open', open);\n return this;\n }\n close() {\n return this.open(false);\n }\n name(name) {\n this.#labelElem.textContent = name;\n return this;\n }\n title(title) {\n return this.name(title);\n }\n toggleOpen() {\n this.open(!this.domElement.classList.contains('muigui-open'));\n return this;\n }\n}\n","import Controller from './Controller.js';\n\n// This feels like it should be something else like\n// gui.addDividing = new Controller()\nexport default class Label extends Controller {\n constructor(text) {\n super('muigui-label');\n this.text(text);\n }\n text(text) {\n this.domElement.textContent = text;\n return this;\n }\n}","function noop() {\n}\n\nexport function computeRelativePosition(elem, event, start) {\n const rect = elem.getBoundingClientRect();\n const x = event.clientX - rect.left;\n const y = event.clientY - rect.top;\n const nx = x / rect.width;\n const ny = y / rect.height;\n start = start || [x, y];\n const dx = x - start[0];\n const dy = y - start[1];\n const ndx = dx / rect.width;\n const ndy = dy / rect.width;\n return {x, y, nx, ny, dx, dy, ndx, ndy};\n}\n\nexport function addTouchEvents(elem, {onDown = noop, onMove = noop, onUp = noop}) {\n let start;\n const pointerMove = function (event) {\n const e = {\n type: 'move',\n ...computeRelativePosition(elem, event, start),\n };\n onMove(e);\n };\n\n const pointerUp = function (event) {\n elem.releasePointerCapture(event.pointerId);\n elem.removeEventListener('pointermove', pointerMove);\n elem.removeEventListener('pointerup', pointerUp);\n\n document.body.style.backgroundColor = '';\n\n onUp('up');\n };\n\n const pointerDown = function (event) {\n elem.addEventListener('pointermove', pointerMove);\n elem.addEventListener('pointerup', pointerUp);\n elem.setPointerCapture(event.pointerId);\n\n const rel = computeRelativePosition(elem, event);\n start = [rel.x, rel.y];\n onDown({\n type: 'down',\n ...rel,\n });\n };\n\n elem.addEventListener('pointerdown', pointerDown);\n\n return function () {\n elem.removeEventListener('pointerdown', pointerDown);\n };\n}","import { createElem, getNewId } from '../libs/elem.js';\nimport { addTouchEvents } from '../libs/touch.js';\nimport { identity } from '../libs/conversions.js';\nimport { clamp } from '../libs/utils.js';\nimport EditView from './EditView.js';\nimport {\n hexToFloatRGB,\n hexToFloatRGBA,\n hsv01ToRGBFloat,\n hsva01ToRGBAFloat,\n rgbFloatToHSV01,\n rgbaFloatToHSVA01,\n floatRGBToHex,\n floatRGBAToHex,\n rgbaFloatToHsla01,\n} from '../libs/color-utils.js';\nimport { copyExistingProperties } from '../libs/utils.js';\n\nconst svg = `\n\n\n\n`;\n\nfunction connectFillTargets(elem) {\n elem.querySelectorAll('[data-src]').forEach(srcElem => {\n const id = getNewId();\n srcElem.id = id;\n elem.querySelectorAll(`[data-target=${srcElem.dataset.src}]`).forEach(targetElem => {\n targetElem.setAttribute('fill', `url(#${id})`);\n });\n });\n return elem;\n}\n\n// Was originally going to make alpha an option. Issue is\n// hard coded conversions?\nexport default class ColorChooserView extends EditView {\n #to;\n #from;\n #satLevelElem;\n #circleElem;\n #hueUIElem;\n #hueElem;\n #hueCursorElem;\n #alphaUIElem;\n #alphaElem;\n #alphaCursorElem;\n #hsva;\n #skipHueUpdate;\n #skipSatLevelUpdate;\n #skipAlphaUpdate;\n #options = {\n converters: identity,\n alpha: false,\n };\n #convertInternalToHex;\n #convertHexToInternal;\n\n constructor(setter, options) {\n super(createElem('div', {\n innerHTML: svg,\n className: 'muigui-no-scroll',\n }));\n this.#satLevelElem = this.domElement.children[0];\n this.#hueUIElem = this.domElement.children[1];\n this.#alphaUIElem = this.domElement.children[2];\n connectFillTargets(this.#satLevelElem);\n connectFillTargets(this.#hueUIElem);\n connectFillTargets(this.#alphaUIElem);\n this.#circleElem = this.$('.muigui-color-chooser-circle');\n this.#hueElem = this.$('[data-src=muigui-color-chooser-hue]');\n this.#hueCursorElem = this.$('.muigui-color-chooser-hue-cursor');\n this.#alphaElem = this.$('[data-src=muigui-color-chooser-alpha]');\n this.#alphaCursorElem = this.$('.muigui-color-chooser-alpha-cursor');\n\n const handleSatLevelChange = (e) => {\n const s = clamp(e.nx, 0, 1);\n const v = clamp(e.ny, 0, 1);\n this.#hsva[1] = s;\n this.#hsva[2] = (1 - v);\n this.#skipHueUpdate = true;\n this.#skipAlphaUpdate = true;\n const [valid, newV] = this.#from(this.#convertInternalToHex(this.#hsva));\n if (valid) {\n setter.setValue(newV);\n }\n };\n\n const handleHueChange = (e) => {\n const h = clamp(e.nx, 0, 1);\n this.#hsva[0] = h;\n this.#skipSatLevelUpdate = true;\n this.#skipAlphaUpdate = true;\n const [valid, newV] = this.#from(this.#convertInternalToHex(this.#hsva));\n if (valid) {\n setter.setValue(newV);\n }\n };\n\n const handleAlphaChange = (e) => {\n const a = clamp(e.nx, 0, 1);\n this.#hsva[3] = a;\n this.#skipHueUpdate = true;\n this.#skipSatLevelUpdate = true;\n const [valid, newV] = this.#from(this.#convertInternalToHex(this.#hsva));\n if (valid) {\n setter.setValue(newV);\n }\n };\n\n addTouchEvents(this.#satLevelElem, {\n onDown: handleSatLevelChange,\n onMove: handleSatLevelChange,\n });\n addTouchEvents(this.#hueUIElem, {\n onDown: handleHueChange,\n onMove: handleHueChange,\n });\n addTouchEvents(this.#alphaUIElem, {\n onDown: handleAlphaChange,\n onMove: handleAlphaChange,\n });\n this.setOptions(options);\n }\n updateDisplay(newV) {\n if (!this.#hsva) {\n this.#hsva = this.#convertHexToInternal(this.#to(newV));\n }\n {\n const [h, s, v, a = 1] = this.#convertHexToInternal(this.#to(newV));\n // Don't copy the hue if it was un-computable.\n if (!this.#skipHueUpdate) {\n this.#hsva[0] = s > 0.001 && v > 0.001 ? h : this.#hsva[0];\n }\n if (!this.#skipSatLevelUpdate) {\n this.#hsva[1] = s;\n this.#hsva[2] = v;\n }\n if (!this.#skipAlphaUpdate) {\n this.#hsva[3] = a;\n }\n }\n {\n const [h, s, v, a] = this.#hsva;\n const [hue, sat, lum] = rgbaFloatToHsla01(hsva01ToRGBAFloat(this.#hsva));\n\n if (!this.#skipHueUpdate) {\n this.#hueCursorElem.setAttribute('transform', `translate(${h * 64}, 0)`);\n }\n this.#hueElem.children[0].setAttribute('stop-color', `hsl(${hue * 360} 0% 100% / ${a})`);\n this.#hueElem.children[1].setAttribute('stop-color', `hsl(${hue * 360} 100% 50% / ${a})`);\n if (!this.#skipAlphaUpdate) {\n this.#alphaCursorElem.setAttribute('transform', `translate(${a * 64}, 0)`);\n }\n this.#alphaElem.children[0].setAttribute('stop-color', `hsl(${hue * 360} ${sat * 100}% ${lum * 100}% / 0)`);\n this.#alphaElem.children[1].setAttribute('stop-color', `hsl(${hue * 360} ${sat * 100}% ${lum * 100}% / 1)`);\n\n if (!this.#skipSatLevelUpdate) {\n this.#circleElem.setAttribute('cx', `${s * 64}`);\n this.#circleElem.setAttribute('cy', `${(1 - v) * 48}`);\n }\n }\n this.#skipHueUpdate = false;\n this.#skipSatLevelUpdate = false;\n this.#skipAlphaUpdate = false;\n }\n setOptions(options) {\n copyExistingProperties(this.#options, options);\n const {converters: {to, from}, alpha} = this.#options;\n this.#alphaUIElem.style.display = alpha ? '' : 'none';\n this.#convertInternalToHex = alpha\n ? v => floatRGBAToHex(hsva01ToRGBAFloat(v))\n : v => floatRGBToHex(hsv01ToRGBFloat(v));\n this.#convertHexToInternal = alpha\n ? v => rgbaFloatToHSVA01(hexToFloatRGBA(v))\n : v => rgbFloatToHSV01(hexToFloatRGB(v));\n this.#to = to;\n this.#from = from;\n return this;\n }\n}\n","import ElementView from '../views/ElementView.js';\nimport ValueController from './ValueController.js';\nimport { copyExistingProperties } from '../libs/utils.js';\nimport { createElem } from '../libs/elem.js';\n/*\n\nholder = new TabHolder\ntab = holder.add(new Tab(\"name\"))\ntab.add(...)\n\n\npc = new PopdownController\ntop = pc.add(new Row())\ntop.add(new Button());\nvalues = topRow.add(new Div())\nbottom = pc.add(new Row());\n\n\n\npc = new PopdownController\npc.addTop\npc.addTop\n\npc.addBottom\n\n\n*/\n\nexport default class PopDownController extends ValueController {\n #top;\n #valuesView;\n #checkboxElem;\n #bottom;\n #options = {\n open: false,\n };\n\n constructor(object, property, options = {}) {\n super(object, property, 'muigui-pop-down-controller');\n /*\n [ValueView\n [[B][values]] upper row\n [[ visual ]] lower row\n ]\n */\n this.#top = this.add(new ElementView('div', 'muigui-pop-down-top'));\n// this.#top.add(new CheckboxView(makeSetter(this.#options, 'open')));\n const checkboxElem = this.#top.addElem(createElem('input', {\n type: 'checkbox',\n onChange: () => {\n this.#options.open = checkboxElem.checked;\n this.updateDisplay();\n },\n }));\n this.#checkboxElem = checkboxElem;\n this.#valuesView = this.#top.add(new ElementView('div', 'muigui-pop-down-values'));\n const container = new ElementView('div', 'muigui-pop-down-bottom muigui-open-container');\n this.#bottom = new ElementView('div');\n container.add(this.#bottom);\n this.add(container);\n this.setOptions(options);\n }\n setKnobColor(bgCssColor/*, fgCssColor*/) {\n if (this.#checkboxElem) {\n this.#checkboxElem.style = `\n --range-color: ${bgCssColor};\n --value-bg-color: ${bgCssColor};\n `;\n }\n }\n updateDisplay() {\n super.updateDisplay();\n const {open} = this.#options;\n this.domElement.children[1].classList.toggle('muigui-open', open);\n this.domElement.children[1].classList.toggle('muigui-closed', !open);\n }\n setOptions(options) {\n copyExistingProperties(this.#options, options);\n super.setOptions(options);\n this.updateDisplay();\n }\n addTop(view) {\n return this.#valuesView.add(view);\n }\n addBottom(view) {\n return this.#bottom.add(view);\n }\n}","/* eslint-disable no-underscore-dangle */\nimport {\n colorFormatConverters,\n guessFormat,\n hasAlpha,\n hexToUint8RGB,\n hslToRgbUint8,\n rgbUint8ToHsl,\n uint8RGBToHex,\n} from '../libs/color-utils.js';\nimport ColorChooserView from '../views/ColorChooserView.js';\nimport TextView from '../views/TextView.js';\nimport PopDownController from './PopDownController.js';\n\nexport default class ColorChooser extends PopDownController {\n #colorView;\n #textView;\n #to;\n\n constructor(object, property, options = {}) {\n super(object, property, 'muigui-color-chooser');\n const format = options.format || guessFormat(this.getValue());\n const {color, text} = colorFormatConverters[format];\n this.#to = color.to;\n this.#textView = new TextView(this, {converters: text, alpha: hasAlpha(format)});\n this.#colorView = new ColorChooserView(this, {converters: color, alpha: hasAlpha(format)});\n this.addTop(this.#textView);\n this.addBottom(this.#colorView);\n // WTF! FIX!\n this.___setKnobHelper = true;\n this.updateDisplay();\n }\n #setKnobHelper() {\n if (this.#to) {\n const hex6Or8 = this.#to(this.getValue());\n const alpha = hex6Or8.length === 9 ? hex6Or8.substring(7, 9) : 'FF';\n const hsl = rgbUint8ToHsl(hexToUint8RGB(hex6Or8));\n hsl[2] = (hsl[2] + 50) % 100;\n const hex = uint8RGBToHex(hslToRgbUint8(hsl));\n this.setKnobColor(`${hex6Or8.substring(0, 7)}${alpha}`, hex);\n }\n }\n updateDisplay() {\n super.updateDisplay();\n if (this.___setKnobHelper) {\n this.#setKnobHelper();\n }\n }\n setOptions(options) {\n super.setOptions(options);\n return this;\n }\n}\n","import { createElem } from '../libs/elem.js';\nimport View from '../views/View.js';\n\nfunction showCSS(ob) {\n if (ob.prototype.css) {\n showCSS(ob.prototype);\n }\n}\n\nexport default class Layout extends View {\n static css = 'bar';\n constructor(tag, className) {\n super(createElem(tag, {className}));\n\n showCSS(this);\n }\n}\n\n/*\nclass ValueController ?? {\n const row = this.add(new Row());\n const label = row.add(new Label());\n const div = row.add(new Div());\n const row = div.add(new Row());\n}\n*/\n\n/*\nclass MyCustomThing extends ValueController {\n constructor(object, property, options) {\n const topRow = this.add(new Row());\n const bottomRow = this.add(new Row());\n topRow.add(new NumberView());\n topRow.add(new NumberView());\n topRow.add(new NumberView());\n topRow.add(new NumberView());\n bottomRow.add(new DirectionView());\n bottomRow.add(new DirectionView());\n bottomRow.add(new DirectionView());\n bottomRow.add(new DirectionView());\n }\n}\n new Grid([\n [new\n ]\n */","import Layout from './Layout.js';\n\nexport default class Column extends Layout {\n constructor() {\n super('div', 'muigui-row');\n }\n}\n","import Layout from './Layout.js';\n\nexport default class Frame extends Layout {\n static css = 'foo';\n constructor() {\n super('div', 'muigui-frame');\n }\n static get foo() {\n return 'boo';\n }\n}\n","import Layout from './Layout.js';\n\nexport default class Grid extends Layout {\n constructor() {\n super('div', 'muigui-grid');\n }\n}\n","import Layout from './Layout.js';\n\nexport default class Row extends Layout {\n constructor() {\n super('div', 'muigui-row');\n }\n}\n","import css from './styles/muigui.css.js';\nimport {createElem} from './libs/elem.js';\nimport {createController} from './controllers/create-controller.js';\nimport {\n mapRange,\n makeRangeConverters,\n makeRangeOptions,\n makeMinMaxPair,\n} from './libs/utils.js';\nimport {\n converters\n} from './libs/conversions.js';\nimport {\n hasAlpha,\n guessFormat,\n} from './libs/color-utils.js';\nimport Canvas from './controllers/Canvas.js';\nimport Color from './controllers/Color.js';\nimport Divider from './controllers/Divider.js';\nimport Folder from './controllers/Folder.js';\nimport Label from './controllers/Label.js';\nimport Controller from './controllers/Controller.js';\nimport ColorChooser from './controllers/ColorChooser.js';\n\nimport Column from './layout/Column.js';\nimport Frame from './layout/Frame.js';\nimport Grid from './layout/Grid.js';\nimport Row from './layout/Row.js';\n\nexport {\n Column,\n Frame,\n Grid,\n Row,\n};\n\nexport class GUIFolder extends Folder {\n add(object, property, ...args) {\n const controller = object instanceof Controller\n ? object\n : createController(object, property, ...args);\n return this.addController(controller);\n }\n addCanvas(name) {\n return this.addController(new Canvas(name));\n }\n addColor(object, property, options = {}) {\n const value = object[property];\n if (hasAlpha(options.format || guessFormat(value))) {\n return this.addController(new ColorChooser(object, property, options));\n } else {\n return this.addController(new Color(object, property, options));\n }\n }\n addDivider() {\n return this.addController(new Divider());\n }\n addFolder(name) {\n return this.addController(new GUIFolder(name));\n }\n addLabel(text) {\n return this.addController(new Label(text));\n }\n addButton(name, fn) {\n const o = {fn};\n return this.add(o, 'fn').name(name);\n }\n}\n\nclass MuiguiElement extends HTMLElement {\n constructor() {\n super();\n this.shadow = this.attachShadow({mode: 'open'});\n }\n}\n\ncustomElements.define('muigui-element', MuiguiElement);\n\nconst baseStyleSheet = new CSSStyleSheet();\n//baseStyleSheet.replaceSync(css.default);\nconst userStyleSheet = new CSSStyleSheet();\n\nfunction makeStyleSheetUpdater(styleSheet) {\n let newCss;\n let newCssPromise;\n\n function updateStyle() {\n if (newCss && !newCssPromise) {\n const s = newCss;\n newCss = undefined;\n newCssPromise = styleSheet.replace(s).then(() => {\n newCssPromise = undefined;\n updateStyle();\n });\n }\n }\n\n return function updateStyleSheet(css) {\n newCss = css;\n updateStyle();\n };\n}\n\nconst updateBaseStyle = makeStyleSheetUpdater(baseStyleSheet);\nconst updateUserStyle = makeStyleSheetUpdater(userStyleSheet);\n\nfunction getTheme(name) {\n const { include, css: cssStr } = css.themes[name];\n return `${include.map(m => css[m]).join('\\n')} : css.default}\\n${cssStr || ''}`;\n}\n\nexport class GUI extends GUIFolder {\n static converters = converters;\n static mapRange = mapRange;\n static makeRangeConverters = makeRangeConverters;\n static makeRangeOptions = makeRangeOptions;\n static makeMinMaxPair = makeMinMaxPair;\n #localStyleSheet = new CSSStyleSheet();\n\n constructor(options = {}) {\n super('Controls', 'muigui-root');\n if (options instanceof HTMLElement) {\n options = {parent: options};\n }\n const {\n autoPlace = true,\n width,\n title = 'Controls',\n } = options;\n let {\n parent,\n } = options;\n\n if (width) {\n this.domElement.style.width = /^\\d+$/.test(width) ? `${width}px` : width;\n }\n if (parent === undefined && autoPlace) {\n parent = document.body;\n this.domElement.classList.add('muigui-auto-place');\n }\n if (parent) {\n const muiguiElement = createElem('muigui-element');\n muiguiElement.shadowRoot.adoptedStyleSheets = [this.#localStyleSheet, baseStyleSheet, userStyleSheet];\n muiguiElement.shadow.appendChild(this.domElement);\n parent.appendChild(muiguiElement);\n }\n if (title) {\n this.title(title);\n }\n this.#localStyleSheet.replaceSync(css.default);\n this.domElement.classList.add('muigui', 'muigui-colors');\n }\n setStyle(css) {\n this.#localStyleSheet.replace(css);\n }\n static setBaseStyles(css) {\n updateBaseStyle(css);\n }\n static getBaseStyleSheet() {\n return baseStyleSheet;\n }\n static setUserStyles(css) {\n updateUserStyle(css);\n }\n static getUserStyleSheet() {\n return userStyleSheet;\n }\n setTheme(name) {\n this.setStyle(getTheme(name));\n }\n static setTheme(name) {\n GUI.setBaseStyles(getTheme(name));\n }\n}\n\nexport default GUI;\n","function noop() {\n}\n\nconst keyDirections = {\n ArrowLeft: [-1, 0],\n ArrowRight: [1, 0],\n ArrowUp: [0, -1],\n ArrowDown: [0, 1],\n};\n\n// This probably needs to be global\nexport function addKeyboardEvents(elem, {onDown = noop, onUp = noop}) {\n const keyDown = function (event) {\n const mult = event.shiftKey ? 10 : 1;\n const [dx, dy] = (keyDirections[event.key] || [0, 0]).map(v => v * mult);\n const fn = event.type === 'keydown' ? onDown : onUp;\n fn({\n type: event.type.substring(3),\n dx,\n dy,\n event,\n });\n };\n\n elem.addEventListener('keydown', keyDown);\n elem.addEventListener('keyup', keyDown);\n\n return function () {\n elem.removeEventListener('keydown', keyDown);\n elem.removeEventListener('keyup', keyDown);\n };\n}","export function assert(truthy, msg = '') {\n if (!truthy) {\n throw new Error(msg);\n }\n}","import { assert } from '../libs/assert.js';\n\nfunction getEllipsePointForAngle(cx, cy, rx, ry, phi, theta) {\n const m = Math.abs(rx) * Math.cos(theta);\n const n = Math.abs(ry) * Math.sin(theta);\n\n return [\n cx + Math.cos(phi) * m - Math.sin(phi) * n,\n cy + Math.sin(phi) * m + Math.cos(phi) * n,\n ];\n}\n\nfunction getEndpointParameters(cx, cy, rx, ry, phi, theta, dTheta) {\n const [x1, y1] = getEllipsePointForAngle(cx, cy, rx, ry, phi, theta);\n const [x2, y2] = getEllipsePointForAngle(cx, cy, rx, ry, phi, theta + dTheta);\n\n const fa = Math.abs(dTheta) > Math.PI ? 1 : 0;\n const fs = dTheta > 0 ? 1 : 0;\n\n return { x1, y1, x2, y2, fa, fs };\n}\n\nexport function arc(cx, cy, r, start, end) {\n assert(Math.abs(start - end) <= Math.PI * 2);\n assert(start >= -Math.PI && start <= Math.PI * 2);\n assert(start <= end);\n assert(end >= -Math.PI && end <= Math.PI * 4);\n\n const { x1, y1, x2, y2, fa, fs } = getEndpointParameters(cx, cy, r, r, 0, start, end - start);\n return Math.abs(Math.abs(start - end) - Math.PI * 2) > Number.EPSILON\n ? `M${cx} ${cy} L${x1} ${y1} A ${r} ${r} 0 ${fa} ${fs} ${x2} ${y2} L${cx} ${cy}`\n : `M${x1} ${y1} L${x1} ${y1} A ${r} ${r} 0 ${fa} ${fs} ${x2} ${y2}`;\n}\n","import { identity } from '../libs/conversions.js';\nimport { createElem } from '../libs/elem.js';\nimport { addKeyboardEvents } from '../libs/keyboard.js';\nimport { arc } from '../libs/svg.js';\nimport { addTouchEvents } from '../libs/touch.js';\nimport { createWheelHelper } from '../libs/wheel.js';\nimport { clamp, copyExistingProperties, euclideanModulo, lerp, stepify } from '../libs/utils.js';\nimport EditView from './EditView.js';\n\nconst svg = `\n\n`;\n\nconst twoPiMod = v => euclideanModulo(v + Math.PI, Math.PI * 2) - Math.PI;\n\nexport default class DirectionView extends EditView {\n #arrowElem;\n #rangeElem;\n #lastV;\n #wrap;\n #options = {\n step: 1,\n min: -180,\n max: 180,\n\n /*\n --------\n / -π/2 \\\n / | \\\n |<- -π * |\n | * 0 ->| zero is down the positive X axis\n |<- +π * |\n \\ | /\n \\ π/2 /\n --------\n */\n dirMin: -Math.PI,\n dirMax: Math.PI,\n //dirMin: Math.PI * 0.5,\n //dirMax: Math.PI * 2.5,\n //dirMin: -Math.PI * 0.75, // test 10:30 to 7:30\n //dirMax: Math.PI * 0.75,\n //dirMin: Math.PI * 0.75, // test 7:30 to 10:30\n //dirMax: -Math.PI * 0.75,\n //dirMin: -Math.PI * 0.75, // test 10:30 to 1:30\n //dirMax: -Math.PI * 0.25,\n //dirMin: Math.PI * 0.25, // test 4:30 to 7:30\n //dirMax: Math.PI * 0.75,\n //dirMin: Math.PI * 0.75, // test 4:30 to 7:30\n //dirMax: Math.PI * 0.25,\n wrap: undefined,\n converters: identity,\n };\n\n constructor(setter, options = {}) {\n const wheelHelper = createWheelHelper();\n super(createElem('div', {\n className: 'muigui-direction muigui-no-scroll',\n innerHTML: svg,\n onWheel: e => {\n e.preventDefault();\n const {min, max, step} = this.#options;\n const delta = wheelHelper(e, step);\n let tempV = this.#lastV + delta;\n if (this.#wrap) {\n tempV = euclideanModulo(tempV - min, max - min) + min;\n }\n const newV = clamp(stepify(tempV, v => v, step), min, max);\n setter.setValue(newV);\n },\n }));\n const handleTouch = (e) => {\n const {min, max, step, dirMin, dirMax} = this.#options;\n const nx = e.nx * 2 - 1;\n const ny = e.ny * 2 - 1;\n const a = Math.atan2(ny, nx);\n\n const center = (dirMin + dirMax) / 2;\n\n const centeredAngle = twoPiMod(a - center);\n const centeredStart = twoPiMod(dirMin - center);\n const diff = dirMax - dirMin;\n\n const n = clamp((centeredAngle - centeredStart) / (diff), 0, 1);\n const newV = stepify(min + (max - min) * n, v => v, step);\n setter.setValue(newV);\n };\n addTouchEvents(this.domElement, {\n onDown: handleTouch,\n onMove: handleTouch,\n });\n addKeyboardEvents(this.domElement, {\n onDown: (e) => {\n const {min, max, step} = this.#options;\n const newV = clamp(stepify(this.#lastV + e.dx * step, v => v, step), min, max);\n setter.setValue(newV);\n },\n });\n this.#arrowElem = this.$('#muigui-arrow');\n this.#rangeElem = this.$('#muigui-range');\n this.setOptions(options);\n }\n updateDisplay(v) {\n this.#lastV = v;\n const {min, max} = this.#options;\n const n = (v - min) / (max - min);\n const angle = lerp(this.#options.dirMin, this.#options.dirMax, n);\n this.#arrowElem.style.transform = `rotate(${angle}rad)`;\n }\n setOptions(options) {\n copyExistingProperties(this.#options, options);\n const {dirMin, dirMax, wrap} = this.#options;\n this.#wrap = wrap !== undefined\n ? wrap\n : Math.abs(dirMin - dirMax) >= Math.PI * 2 - Number.EPSILON;\n const [min, max] = dirMin < dirMax ? [dirMin, dirMax] : [dirMax , dirMin];\n this.#rangeElem.setAttribute('d', arc(0, 0, 28.87, min, max));\n }\n}\n","import { identity } from '../libs/conversions.js';\nimport DirectionView from '../views/DirectionView.js';\nimport NumberView from '../views/NumberView.js';\n// import ValueController from './ValueController.js';\nimport PopDownController from './PopDownController.js';\n\n\n// deg2rad\n// where is 0\n// range (0, 360), (-180, +180), (0,0) Really this is a range\n\nexport default class Direction extends PopDownController {\n #options;\n constructor(object, property, options) {\n super(object, property, 'muigui-direction');\nthis.#options = options; // FIX\n this.addTop(new NumberView(this,\nidentity));\n this.addBottom(new DirectionView(this, options));\n this.updateDisplay();\n }\n}\n\n","import { createElem } from '../libs/elem.js';\nimport { makeId } from '../libs/ids.js';\nimport EditView from './EditView.js';\n\nexport default class RadioGridView extends EditView {\n #values;\n\n constructor(setter, keyValues, cols = 3) {\n const values = [];\n const name = makeId();\n super(createElem('div', {}, keyValues.map(([key, value], ndx) => {\n values.push(value);\n return createElem('label', {}, [\n createElem('input', {\n type: 'radio',\n name,\n value: ndx,\n onChange: function () {\n if (this.checked) {\n setter.setFinalValue(that.#values[this.value]);\n }\n },\n }),\n createElem('button', {\n type: 'button',\n textContent: key,\n onClick: function () {\n this.previousElementSibling.click();\n },\n }),\n ]);\n })));\n // eslint-disable-next-line @typescript-eslint/no-this-alias\n const that = this;\n this.#values = values;\n this.cols(cols);\n }\n updateDisplay(v) {\n const ndx = this.#values.indexOf(v);\n for (let i = 0; i < this.domElement.children.length; ++i) {\n this.domElement.children[i].children[0].checked = i === ndx;\n }\n }\n cols(cols) {\n this.domElement.style.gridTemplateColumns = `repeat(${cols}, 1fr)`;\n }\n}\n","import RadioGridView from '../views/RadioGridView.js';\nimport ValueController from './ValueController.js';\nimport { convertToKeyValues } from '../libs/key-values.js';\n\nexport default class RadioGrid extends ValueController {\n constructor(object, property, options) {\n super(object, property, 'muigui-radio-grid');\n const valueIsNumber = typeof this.getValue() === 'number';\n const {\n keyValues: keyValuesInput,\n cols = 3,\n } = options;\n const keyValues = convertToKeyValues(keyValuesInput, valueIsNumber);\n this.add(new RadioGridView(this, keyValues, cols));\n this.updateDisplay();\n }\n}","export function onResize(elem, callback) {\n new ResizeObserver(() => {\n callback({rect: elem.getBoundingClientRect(), elem});\n }).observe(elem);\n}\n\nexport function onResizeSVGNoScale(elem, hAnchor, vAnchor, callback) {\n onResize(elem, ({rect}) => {\n const {width, height} = rect;\n elem.setAttribute('viewBox', `-${width * hAnchor} -${height * vAnchor} ${width} ${height}`);\n callback({elem, rect});\n });\n}\n\nexport function onResizeCanvas(elem, callback) {\n onResize(elem, ({rect}) => {\n const {width, height} = rect;\n elem.width = width;\n elem.height = height;\n callback({elem, rect});\n });\n}\n","import { createElem } from '../libs/elem.js';\nimport { addKeyboardEvents } from '../libs/keyboard.js';\nimport { addTouchEvents } from '../libs/touch.js';\nimport { createWheelHelper } from '../libs/wheel.js';\nimport { onResizeSVGNoScale } from '../libs/resize-helpers.js';\nimport { clamp, copyExistingProperties, stepify } from '../libs/utils.js';\nimport EditView from './EditView.js';\n\nconst svg = `\n\n`;\n\nfunction createSVGTicks(start, end, step, min, max, height) {\n const p = [];\n if (start < min) {\n start += stepify(min - start, v => v, step);\n }\n end = Math.min(end, max);\n for (let i = start; i <= end; i += step) {\n p.push(`M${i} 0 l0 ${height}`);\n }\n return p.join(' ');\n}\n\nfunction createSVGNumbers(start, end, unitSize, unit, minusSize, min, max, labelFn) {\n const texts = [];\n if (start < min) {\n start += stepify(min - start, v => v, unitSize);\n }\n end = Math.min(end, max);\n const digits = Math.max(0, -Math.log10(unit));\n const f = v => labelFn(v.toFixed(digits));\n for (let i = start; i <= end; i += unitSize) {\n texts.push(`= 0 ? i : (i - minusSize / 2) }\" y=\"0\">${f(i / unitSize * unit)}`);\n }\n return texts.join('\\n');\n}\n\nfunction computeSizeOfMinus(elem) {\n const oldHTML = elem.innerHTML;\n elem.innerHTML = '- ';\n const text = elem.querySelector('text');\n const size = text.getComputedTextLength();\n elem.innerHTML = oldHTML;\n return size;\n}\n\nexport default class SliderView extends EditView {\n #svgElem;\n #originElem;\n #ticksElem;\n #thicksElem;\n #numbersElem;\n #leftGradElem;\n #rightGradElem;\n #width;\n #height;\n #lastV;\n #minusSize;\n #options = {\n min: -100,\n max: 100,\n step: 1,\n unit: 10,\n unitSize: 10,\n ticksPerUnit: 5,\n labelFn: v => v,\n tickHeight: 1,\n limits: true,\n thicksColor: undefined,\n orientation: undefined,\n };\n\n constructor(setter, options) {\n const wheelHelper = createWheelHelper();\n super(createElem('div', {\n innerHTML: svg,\n className: 'muigui-no-v-scroll',\n onWheel: e => {\n e.preventDefault();\n const {min, max, step} = this.#options;\n const delta = wheelHelper(e, step);\n const newV = clamp(stepify(this.#lastV + delta, v => v, step), min, max);\n setter.setValue(newV);\n },\n }));\n this.#svgElem = this.$('svg');\n this.#originElem = this.$('#muigui-origin');\n this.#ticksElem = this.$('#muigui-ticks');\n this.#thicksElem = this.$('#muigui-thicks');\n this.#numbersElem = this.$('#muigui-numbers');\n this.#leftGradElem = this.$('#muigui-left-grad');\n this.#rightGradElem = this.$('#muigui-right-grad');\n this.setOptions(options);\n let startV;\n addTouchEvents(this.domElement, {\n onDown: () => {\n startV = this.#lastV;\n },\n onMove: (e) => {\n const {min, max, unitSize, unit, step} = this.#options;\n const newV = clamp(stepify(startV - e.dx / unitSize * unit, v => v, step), min, max);\n setter.setValue(newV);\n },\n });\n addKeyboardEvents(this.domElement, {\n onDown: (e) => {\n const {min, max, step} = this.#options;\n const newV = clamp(stepify(this.#lastV + e.dx * step, v => v, step), min, max);\n setter.setValue(newV);\n },\n });\n onResizeSVGNoScale(this.#svgElem, 0.5, 0, ({rect: {width}}) => {\n this.#leftGradElem.setAttribute('x', -width / 2);\n this.#rightGradElem.setAttribute('x', width / 2 - 20);\n this.#minusSize = computeSizeOfMinus(this.#numbersElem);\n this.#width = width;\n this.#updateSlider();\n });\n }\n // |--------V--------|\n // . . | . . . | . . . |\n //\n #updateSlider() {\n // There's no size if ResizeObserver has not fired yet.\n if (!this.#width || this.#lastV === undefined) {\n return;\n }\n const {\n labelFn,\n limits,\n min,\n max,\n orientation,\n tickHeight,\n ticksPerUnit,\n unit,\n unitSize,\n thicksColor,\n } = this.#options;\n const unitsAcross = Math.ceil(this.#width / unitSize);\n const center = this.#lastV;\n const centerUnitSpace = center / unit;\n const startUnitSpace = Math.round(centerUnitSpace - unitsAcross);\n const endUnitSpace = startUnitSpace + unitsAcross * 2;\n const start = startUnitSpace * unitSize;\n const end = endUnitSpace * unitSize;\n const minUnitSpace = limits ? min * unitSize / unit : start;\n const maxUnitSpace = limits ? max * unitSize / unit : end;\n const height = labelFn(1) === '' ? 10 : 5;\n if (ticksPerUnit > 1) {\n this.#ticksElem.setAttribute('d', createSVGTicks(start, end, unitSize / ticksPerUnit, minUnitSpace, maxUnitSpace, height * tickHeight));\n }\n this.#thicksElem.style.stroke = thicksColor; //setAttribute('stroke', thicksColor);\n this.#thicksElem.setAttribute('d', createSVGTicks(start, end, unitSize, minUnitSpace, maxUnitSpace, height));\n this.#numbersElem.innerHTML = createSVGNumbers(start, end, unitSize, unit, this.#minusSize, minUnitSpace, maxUnitSpace, labelFn);\n this.#originElem.setAttribute('transform', `translate(${-this.#lastV * unitSize / unit} 0)`);\n this.#svgElem.classList.toggle('muigui-slider-up', orientation === 'up');\n }\n updateDisplay(v) {\n this.#lastV = v;\n this.#updateSlider();\n }\n setOptions(options) {\n copyExistingProperties(this.#options, options);\n return this;\n }\n}\n","import ValueController from './ValueController.js';\nimport NumberView from '../views/NumberView.js';\nimport SliderView from '../views/SliderView.js';\n\nexport default class Slider extends ValueController {\n constructor(object, property, options = {}) {\n super(object, property, 'muigui-slider');\n this.add(new SliderView(this, options));\n this.add(new NumberView(this, options));\n this.updateDisplay();\n }\n}\n","import { createElem } from '../libs/elem.js';\nimport { addTouchEvents } from '../libs/touch.js';\nimport { onResizeSVGNoScale } from '../libs/resize-helpers.js';\nimport EditView from './EditView.js';\n\nconst svg = `\n\n`;\n\nexport default class Vec2View extends EditView {\n #svgElem;\n #arrowElem;\n #circleElem;\n #lastV = [];\n\n constructor(setter) {\n super(createElem('div', {\n innerHTML: svg,\n className: 'muigui-no-scroll',\n }));\n const onTouch = (e) => {\n const {width, height} = this.#svgElem.getBoundingClientRect();\n const nx = e.nx * 2 - 1;\n const ny = e.ny * 2 - 1;\n setter.setValue([nx * width * 0.5, ny * height * 0.5]);\n };\n addTouchEvents(this.domElement, {\n onDown: onTouch,\n onMove: onTouch,\n });\n this.#svgElem = this.$('svg');\n this.#arrowElem = this.$('#muigui-arrow');\n this.#circleElem = this.$('#muigui-circle');\n onResizeSVGNoScale(this.#svgElem, 0.5, 0.5, () => this.#updateDisplayImpl);\n }\n #updateDisplayImpl() {\n const [x, y] = this.#lastV;\n this.#arrowElem.setAttribute('d', `M0,0L${x},${y}`);\n this.#circleElem.setAttribute('transform', `translate(${x}, ${y})`);\n }\n updateDisplay(v) {\n this.#lastV[0] = v[0];\n this.#lastV[1] = v[1];\n this.#updateDisplayImpl();\n }\n}\n","import NumberView from '../views/NumberView.js';\nimport Vec2View from '../views/Vec2View.js';\nimport PopDownController from './PopDownController.js';\nimport { strToNumber } from '../libs/conversions.js';\n\n// TODO: zoom with wheel and pinch?\n// TODO: grid?\n// // options\n// scale:\n// range: number (both x and y + /)\n// range: array (min, max)\n// xRange:\n// deg/rad/turn\n\nexport default class Vec2 extends PopDownController {\n constructor(object, property) {\n super(object, property, 'muigui-vec2');\n\n const makeSetter = (ndx) => {\n return {\n setValue: (v) => {\n const newV = this.getValue();\n newV[ndx] = v;\n this.setValue(newV);\n },\n setFinalValue: (v) => {\n const newV = this.getValue();\n newV[ndx] = v;\n this.setFinalValue(newV);\n },\n };\n };\n\n this.addTop(new NumberView(makeSetter(0), {\n converters: {\n to: v => v[0],\n from: strToNumber.from,\n },\n }));\n this.addTop(new NumberView(makeSetter(1), {\n converters: {\n to: v => v[1],\n from: strToNumber.from,\n },\n }));\n this.addBottom(new Vec2View(this));\n this.updateDisplay();\n }\n}\n","const darkColors = {\n main: '#ddd',\n};\nconst lightColors = {\n main: '#333',\n};\n\nconst darkMatcher = window.matchMedia('(prefers-color-scheme: dark)');\n\nlet colors;\nlet isDarkMode;\n\nfunction update() {\n isDarkMode = darkMatcher.matches;\n colors = isDarkMode ? darkColors : lightColors;\n}\ndarkMatcher.addEventListener('change', update);\nupdate();\n\nexport function graph(canvas, data, {\n min = -1,\n max = 1,\n interval = 16,\n color,\n }) {\n const ctx = canvas.getContext('2d');\n\n function render() {\n const {width, height} = canvas;\n ctx.clearRect(0, 0, width, height);\n ctx.beginPath();\n const range = max - min;\n for (let i = 0; i < data.length; ++i) {\n const x = i * width / data.length;\n const y = (data[i] - min) * height / range;\n ctx.lineTo(x, y);\n }\n ctx.strokeStyle = color || colors.main;\n ctx.stroke();\n }\n setInterval(render, interval);\n}","export function monitor(label, object, property, {interval = 200} = {}) {\n setInterval(() => {\n label.text(JSON.stringify(object[property], null, 2));\n }, interval);\n}\n","import GUI from './muigui.js';\n\nexport { default as ColorChooser } from './controllers/ColorChooser.js';\nexport { default as Direction } from './controllers/Direction.js';\nexport { default as RadioGrid } from './controllers/RadioGrid.js';\nexport { default as Range } from './controllers/Range.js';\nexport { default as Select } from './controllers/Select.js';\nexport { default as Slider } from './controllers/Slider.js';\nexport { default as TextNumber } from './controllers/TextNumber.js';\nexport { default as Vec2 } from './controllers/Vec2.js';\n\nimport {graph} from './libs/graph.js';\nimport {monitor} from './libs/monitor.js';\n\nexport const helpers = {\n graph,\n monitor,\n};\n\nexport default GUI;"],"names":["clamp","euclideanModulo","lerp","identity","noop","svg"],"mappings":";AAAA,UAAe;AACf,EAAE,OAAO,EAAE,CAAC;AACZ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD,MAAM,EAAE;AACR,EAAE,OAAO,EAAE;AACX,IAAI,OAAO,EAAE,CAAC,SAAS,CAAC;AACxB,IAAI,GAAG,EAAE,CAAC;AACV,IAAI,CAAC;AACL,GAAG;AACH,EAAE,KAAK,EAAE;AACT,IAAI,OAAO,EAAE,CAAC,SAAS,CAAC;AACxB,IAAI,GAAG,EAAE,CAAC;AACV;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD,GAAG;AACH,EAAE,IAAI,EAAE;AACR,IAAI,OAAO,EAAE,EAAE;AACf,IAAI,GAAG,EAAE,CAAC;AACV;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,EAAE,CAAC;AACH,GAAG;AACH,EAAE,IAAI,EAAE;AACR,IAAI,OAAO,EAAE,EAAE;AACf,IAAI,GAAG,EAAE,EAAE;AACX,GAAG;AACH,CAAC;AACD,CAAC;;AC/0BM,SAAS,YAAY,CAAC,IAAI,EAAE,KAAK,EAAE,QAAQ,EAAE;AACpD,EAAE,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;AACpD,IAAI,IAAI,OAAO,KAAK,KAAK,UAAU,IAAI,GAAG,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE;AAC7D,MAAM,MAAM,SAAS,GAAG,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,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G,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,GAAG,IAAI,MAAM,GAAG,KAAK,CAAC;AACjD,MAAM,GAAG,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AACvB,KAAK;AACL,IAAI,GAAG,CAAC,WAAW,GAAG,KAAK,IAAI,MAAM,CAAC,IAAI,CAAC;AAC3C,IAAI,GAAG,CAAC,MAAM,EAAE,CAAC;AACjB,GAAG;AACH,EAAE,WAAW,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;AAChC;;ACzCO,SAAS,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,QAAQ,GAAG,GAAG,CAAC,GAAG,EAAE,EAAE;AACxE,EAAE,WAAW,CAAC,MAAM;AACpB,IAAI,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;AAC1D,GAAG,EAAE,QAAQ,CAAC,CAAC;AACf;;ACUa,MAAA,OAAO,GAAG;IACrB,KAAK;IACL,OAAO;;;;;"}
\ No newline at end of file
diff --git a/dist/0.x/muigui.module.min.js b/dist/0.x/muigui.module.min.js
index 6716365..c21420e 100644
--- a/dist/0.x/muigui.module.min.js
+++ b/dist/0.x/muigui.module.min.js
@@ -1,2 +1,2 @@
-var t={default:'\n.muigui {\n --bg-color: #ddd;\n --color: #222;\n --contrast-color: #eee;\n --value-color: #145 ;\n --value-bg-color: #eeee;\n --disabled-color: #999;\n --menu-bg-color: #f8f8f8;\n --menu-sep-color: #bbb;\n --hover-bg-color: #999;\n --focus-color: #68C;\n --range-color: #888888;\n --invalid-color: #FF0000;\n --selected-color: rgb(255, 255, 255, 0.9);\n\n --button-bg-color: var(--value-bg-color);\n\n --range-left-color: var(--value-color);\n --range-right-color: var(--value-bg-color); \n --range-right-hover-color: var(--hover-bg-color);\n\n color: var(--color);\n background-color: var(--bg-color);\n}\n\n@media (prefers-color-scheme: dark) {\n .muigui {\n --bg-color: #222222;\n --color: #dddddd;\n --contrast-color: #000;\n --value-color: #43e5f7;\n --value-bg-color: #444444;\n --disabled-color: #666666;\n --menu-bg-color: #080808;\n --menu-sep-color: #444444;\n --hover-bg-color: #666666;\n --focus-color: #88AAFF;\n --range-color: #888888;\n --invalid-color: #FF6666;\n --selected-color: rgba(255, 255, 255, 0.3);\n\n --button-bg-color: var(--value-bg-color);\n\n --range-left-color: var(--value-color);\n --range-right-color: var(--value-bg-color); \n --range-right-hover-color: var(--hover-bg-color);\n\n color: var(--color);\n background-color: var(--bg-color);\n }\n}\n\n.muigui {\n --width: 250px;\n --label-width: 45%;\n --number-width: 40%;\n\n\n --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;\n --font-size: 11px;\n --font-family-mono: Menlo, Monaco, Consolas, "Droid Sans Mono", monospace;\n --font-size-mono: 11px;\n\n --line-height: 1.7em;\n --border-radius: 0px;\n\n width: var(--width);\n font-family: var(--font-family);\n font-size: var(--font-size);\n box-sizing: border-box;\n line-height: 100%;\n}\n.muigui * {\n box-sizing: inherit;\n}\n\n.muigui-no-scroll {\n touch-action: none;\n}\n.muigui-no-h-scroll {\n touch-action: pan-y;\n}\n.muigui-no-v-scroll {\n touch-action: pan-x;\n}\n\n.muigui-invalid-value {\n background-color: red !important;\n color: white !important;\n}\n\n.muigui-grid {\n display: grid;\n}\n.muigui-rows {\n display: flex;\n flex-direction: column;\n\n min-height: 20px;\n border: 2px solid red;\n}\n.muigui-columns {\n display: flex;\n flex-direction: row;\n\n height: 20px;\n border: 2px solid green;\n}\n.muigui-rows>*,\n.muigui-columns>* {\n flex: 1 1 auto;\n align-items: stretch;\n min-height: 0;\n min-width: 0;\n}\n\n.muigui-row {\n border: 2px solid yellow;\n min-height: 10px\n}\n.muigui-column {\n border: 2px solid lightgreen;\n}\n\n/* -------- */\n\n.muigui-show { /* */ }\n.muigui-hide { \n display: none !important;\n}\n.muigui-disabled {\n pointer-events: none;\n --color: var(--disabled-color) !important;\n --value-color: var(--disabled-color) !important;\n --range-left-color: var(--disabled-color) !important;\n}\n\n.muigui canvas,\n.muigui svg {\n display: block;\n border-radius: var(--border-radius);\n}\n.muigui canvas {\n background-color: var(--value-bg-color);\n}\n\n.muigui-controller {\n min-width: 0;\n min-height: var(--line-height);\n}\n.muigui-root,\n.muigui-menu {\n display: flex;\n flex-direction: column;\n position: relative;\n user-select: none;\n height: fit-content;\n margin: 0;\n padding-bottom: 0.1em;\n border-radius: var(--border-radius);\n}\n.muigui-menu {\n border-bottom: 1px solid var(--menu-sep-color);\n}\n\n.muigui-root>button:nth-child(1),\n.muigui-menu>button:nth-child(1) {\n border-top: 1px solid var(--menu-sep-color);\n border-bottom: 1px solid var(--menu-sep-color);\n position: relative;\n text-align: left;\n color: var(--color);\n background-color: var(--menu-bg-color);\n min-height: var(--line-height);\n padding-top: 0.2em;\n padding-bottom: 0.2em;\n cursor: pointer;\n border-radius: var(--border-radius);\n}\n.muigui-root>div:nth-child(2),\n.muigui-menu>div:nth-child(2) {\n flex: 1 1 auto;\n}\n\n.muigui-controller {\n margin-left: 0.2em;\n margin-right: 0.2em;\n}\n.muigui-root.muigui-controller,\n.muigui-menu.muigui-controller {\n margin-left: 0;\n margin-right: 0;\n}\n.muigui-controller>*:nth-child(1) {\n flex: 1 0 var(--label-width);\n min-width: 0;\n white-space: pre;\n}\n.muigui-controller>label:nth-child(1) {\n place-content: center start;\n display: inline-grid;\n overflow: hidden;\n}\n.muigui-controller>*:nth-child(2) {\n flex: 1 1 75%;\n min-width: 0;\n}\n\n/* -----------------------------------------\n a label controller is [[label][value]]\n*/\n\n.muigui-label-controller {\n display: flex;\n margin: 0.4em 0 0.4em 0;\n word-wrap: initial;\n align-items: stretch;\n}\n\n.muigui-value {\n display: flex;\n align-items: stretch;\n}\n.muigui-value>* {\n flex: 1 1 auto;\n min-width: 0;\n}\n.muigui-value>*:nth-child(1) {\n flex: 1 1 calc(100% - var(--number-width));\n}\n.muigui-value>*:nth-child(2) {\n flex: 1 1 var(--number-width);\n margin-left: 0.2em;\n}\n\n/* fix! */\n.muigui-open>button>label::before,\n.muigui-closed>button>label::before {\n width: 1.25em;\n height: var(--line-height);\n display: inline-grid;\n place-content: center start;\n pointer-events: none;\n}\n.muigui-open>button>label::before {\n content: "ⓧ"; /*"▼";*/\n}\n.muigui-closed>button>label::before {\n content: "⨁"; /*"▶";*/\n}\n.muigui-open>*:nth-child(2) {\n transition: max-height 0.2s ease-out,\n opacity 0.5s ease-out;\n max-height: 100vh;\n overflow: auto;\n opacity: 1;\n}\n\n.muigui-closed>*:nth-child(2) {\n transition: max-height 0.2s ease-out,\n opacity 1s;\n max-height: 0;\n opacity: 0;\n overflow: hidden;\n}\n\n/* ---- popdown ---- */\n\n.muigui-pop-down-top {\n display: flex;\n}\n/* fix? */\n.muigui-value>*:nth-child(1).muigui-pop-down-top {\n flex: 0;\n}\n.muigui-pop-down-bottom {\n\n}\n\n.muigui-pop-down-values {\n min-width: 0;\n display: flex;\n}\n.muigui-pop-down-values>* {\n flex: 1 1 auto;\n min-width: 0;\n}\n\n.muigui-value.muigui-pop-down-controller {\n flex-direction: column;\n}\n\n.muigui-pop-down-top input[type=checkbox] {\n -webkit-appearance: none;\n appearance: none;\n width: auto;\n color: var(--value-color);\n background-color: var(--value-bg-color);\n cursor: pointer;\n\n display: grid;\n place-content: center;\n margin: 0;\n font: inherit;\n color: currentColor;\n width: 1.7em;\n height: 1.7em;\n transform: translateY(-0.075em);\n}\n\n.muigui-pop-down-top input[type=checkbox]::before {\n content: "+";\n display: grid;\n place-content: center;\n border-radius: calc(var(--border-radius) + 2px);\n border-left: 1px solid rgba(255,255,255,0.3);\n border-top: 1px solid rgba(255,255,255,0.3);\n border-bottom: 1px solid rgba(0,0,0,0.2);\n border-right: 1px solid rgba(0,0,0,0.2);\n background-color: var(--range-color);\n color: var(--value-bg-color);\n width: calc(var(--line-height) - 4px);\n height: calc(var(--line-height) - 4px);\n}\n\n.muigui-pop-down-top input[type=checkbox]:checked::before {\n content: "X";\n}\n\n\n/* ---- select ---- */\n\n.muigui select,\n.muigui option,\n.muigui input,\n.muigui button {\n color: var(--value-color);\n background-color: var(--value-bg-color);\n font-family: var(--font-family);\n font-size: var(--font-size);\n border: none;\n margin: 0;\n border-radius: var(--border-radius);\n}\n.muigui select {\n appearance: none;\n margin: 0;\n margin-left: 0; /*?*/\n overflow: hidden; /* Safari */\n}\n\n.muigui select:focus,\n.muigui input:focus,\n.muigui button:focus {\n outline: 1px solid var(--focus-color);\n}\n\n.muigui select:hover,\n.muigui option:hover,\n.muigui input:hover,\n.muigui button:hover {\n background-color: var(--hover-bg-color); \n}\n\n/* ------ [ label ] ------ */\n\n.muigui-label {\n border-top: 1px solid var(--menu-sep-color);\n border-bottom: 1px solid var(--menu-sep-color);\n padding-top: 0.4em;\n padding-bottom: 0.3em;\n place-content: center start;\n background-color: var(--menu-bg-color);\n white-space: pre;\n border-radius: var(--border-radius);\n}\n\n/* ------ [ divider] ------ */\n\n.muigui-divider {\n min-height: 6px;\n border-top: 2px solid var(--menu-sep-color);\n margin-top: 6px;\n}\n\n/* ------ [ button ] ------ */\n\n.muigui-button {\n display: grid;\n\n}\n.muigui-button button {\n border: none;\n color: var(--value-color);\n background-color: var(--button-bg-color);\n cursor: pointer;\n place-content: center center;\n}\n\n/* ------ [ color ] ------ */\n\n.muigui-color>div {\n overflow: hidden;\n position: relative;\n margin-left: 0;\n margin-right: 0; /* why? */\n max-width: var(--line-height);\n border-radius: var(--border-radius);\n}\n\n.muigui-color>div:focus-within {\n outline: 1px solid var(--focus-color);\n}\n\n.muigui-color input[type=color] {\n border: none;\n padding: 0;\n background: inherit;\n cursor: pointer;\n position: absolute;\n width: 200%;\n left: -10px;\n top: -10px;\n height: 200%;\n}\n.muigui-disabled canvas,\n.muigui-disabled svg,\n.muigui-disabled img,\n.muigui-disabled .muigui-color input[type=color] {\n opacity: 0.2;\n}\n\n/* ------ [ checkbox ] ------ */\n\n.muigui-checkbox>label:nth-child(2) {\n display: grid;\n place-content: center start;\n margin: 0;\n}\n\n.muigui-checkbox input[type=checkbox] {\n -webkit-appearance: none;\n appearance: none;\n width: auto;\n color: var(--value-color);\n background-color: var(--value-bg-color);\n cursor: pointer;\n\n display: grid;\n place-content: center;\n margin: 0;\n font: inherit;\n color: currentColor;\n width: 1.7em;\n height: 1.7em;\n transform: translateY(-0.075em);\n}\n\n.muigui-checkbox input[type=checkbox]::before {\n content: "";\n color: var(--value-color);\n display: grid;\n place-content: center;\n}\n\n.muigui-checkbox input[type=checkbox]:checked::before {\n content: "✔";\n}\n\n.muigui input[type=number]::-webkit-inner-spin-button, \n.muigui input[type=number]::-webkit-outer-spin-button { \n -webkit-appearance: none;\n appearance: none;\n margin: 0; \n}\n.muigui input[type=number] {\n -moz-appearance: textfield;\n}\n\n/* ------ [ radio grid ] ------ */\n\n.muigui-radio-grid>div {\n display: grid;\n gap: 2px;\n}\n\n.muigui-radio-grid input {\n appearance: none;\n display: none;\n}\n\n.muigui-radio-grid button {\n color: var(--color);\n width: 100%;\n text-align: left;\n}\n\n.muigui-radio-grid input:checked + button {\n color: var(--value-color);\n background-color: var(--selected-color);\n}\n\n/* ------ [ color-chooser ] ------ */\n\n.muigui-color-chooser-cursor {\n stroke-width: 1px;\n stroke: white;\n fill: none;\n}\n.muigui-color-chooser-circle {\n stroke-width: 1px;\n stroke: white;\n fill: none;\n}\n\n\n/* ------ [ vec2 ] ------ */\n\n.muigui-vec2 svg {\n background-color: var(--value-bg-color);\n}\n\n.muigui-vec2-axis {\n stroke: 1px;\n stroke: var(--focus-color);\n}\n\n.muigui-vec2-line {\n stroke-width: 1px;\n stroke: var(--value-color);\n fill: var(--value-color);\n}\n\n/* ------ [ direction ] ------ */\n\n.muigui-direction svg {\n background-color: rgba(0,0,0,0.2);\n}\n\n.muigui-direction:focus-within svg {\n outline: none;\n}\n.muigui-direction-range {\n fill: var(--value-bg-color);\n}\n.muigui-direction svg:focus {\n outline: none;\n}\n.muigui-direction svg:focus .muigui-direction-range {\n stroke-width: 0.5px;\n stroke: var(--focus-color);\n}\n\n.muigui-direction-arrow {\n fill: var(--value-color);\n}\n\n/* ------ [ slider ] ------ */\n\n.muigui-slider>div {\n display: flex;\n align-items: stretch;\n height: var(--line-height);\n}\n.muigui-slider svg {\n flex: 1 1 auto;\n}\n.muigui-slider .muigui-slider-up #muigui-orientation {\n transform: scale(1, -1) translateY(-100%);\n}\n\n.muigui-slider .muigui-slider-up #muigui-number-orientation {\n transform: scale(1,-1);\n}\n\n.muigui-ticks {\n stroke: var(--range-color);\n}\n.muigui-thicks {\n stroke: var(--color);\n stroke-width: 2px;\n}\n.muigui-svg-text {\n fill: var(--color);\n font-size: 7px;\n}\n.muigui-mark {\n fill: var(--value-color);\n}\n\n/* ------ [ range ] ------ */\n\n\n.muigui-range input[type=range] {\n -webkit-appearance: none;\n appearance: none;\n background-color: transparent;\n}\n\n.muigui-range input[type=range]::-webkit-slider-thumb {\n -webkit-appearance: none;\n appearance: none;\n border-radius: calc(var(--border-radius) + 2px);\n border-left: 1px solid rgba(255,255,255,0.3);\n border-top: 1px solid rgba(255,255,255,0.3);\n border-bottom: 1px solid rgba(0,0,0,0.2);\n border-right: 1px solid rgba(0,0,0,0.2);\n background-color: var(--range-color);\n margin-top: calc((var(--line-height) - 2px) / -2);\n width: calc(var(--line-height) - 2px);\n height: calc(var(--line-height) - 2px);\n}\n\n.muigui-range input[type=range]::-webkit-slider-runnable-track {\n -webkit-appearance: none;\n appearance: none;\n border: 1px solid var(--menu-sep-color);\n height: 2px;\n}\n\n\n/* dat.gui style - doesn\'t work on Safari iOS */\n\n/*\n.muigui-range input[type=range] {\n cursor: ew-resize;\n overflow: hidden;\n}\n\n.muigui-range input[type=range] {\n -webkit-appearance: none;\n appearance: none;\n background-color: var(--range-right-color);\n margin: 0;\n}\n.muigui-range input[type=range]:hover {\n background-color: var(--range-right-hover-color);\n}\n\n.muigui-range input[type=range]::-webkit-slider-runnable-track {\n -webkit-appearance: none;\n appearance: none;\n height: max-content;\n color: var(--range-left-color);\n margin-top: -1px;\n}\n\n.muigui-range input[type=range]::-webkit-slider-thumb {\n -webkit-appearance: none;\n appearance: none;\n width: 0px;\n height: max-content;\n box-shadow: -1000px 0 0 1000px var(--range-left-color);\n}\n*/\n\n/* FF */\n/*\n.muigui-range input[type=range]::-moz-slider-progress {\n background-color: var(--range-left-color); \n}\n.muigui-range input[type=range]::-moz-slider-thumb {\n height: max-content;\n width: 0;\n border: none;\n box-shadow: -1000px 0 0 1000px var(--range-left-color);\n box-sizing: border-box;\n}\n*/\n\n.muigui-checkered-background {\n background-color: #404040;\n background-image:\n linear-gradient(45deg, #808080 25%, transparent 25%),\n linear-gradient(-45deg, #808080 25%, transparent 25%),\n linear-gradient(45deg, transparent 75%, #808080 75%),\n linear-gradient(-45deg, transparent 75%, #808080 75%);\n background-size: 16px 16px;\n background-position: 0 0, 0 8px, 8px -8px, -8px 0px;\n}\n\n/* ---------------------------------------------------------- */\n\n/* needs to be at bottom to take precedence */\n.muigui-auto-place {\n max-height: 100%;\n position: fixed;\n top: 0;\n right: 15px;\n z-index: 100001;\n}\n\n',themes:{default:"",float:"\n :root {\n color-scheme: light dark,\n }\n\n .muigui {\n --width: 400px;\n --bg-color: initial;\n --label-width: 25%;\n --number-width: 20%;\n }\n\n input,\n .muigui-label-controller>label {\n text-shadow:\n -1px -1px 0 var(--contrast-color),\n 1px -1px 0 var(--contrast-color),\n -1px 1px 0 var(--contrast-color),\n 1px 1px 0 var(--contrast-color);\n }\n\n .muigui-controller > label:nth-child(1) {\n place-content: center end;\n margin-right: 1em;\n }\n\n .muigui-value > :nth-child(2) {\n margin-left: 1em;\n }\n\n .muigui-root>*:nth-child(1) {\n display: none;\n }\n\n .muigui-range input[type=range]::-webkit-slider-thumb {\n border-radius: 1em;\n }\n\n .muigui-range input[type=range]::-webkit-slider-runnable-track {\n -webkit-appearance: initial;\n appearance: none;\n border: 1px solid rgba(0, 0, 0, 0.25);\n height: 2px;\n }\n\n .muigui-colors {\n --value-color: var(--color );\n --value-bg-color: rgba(0, 0, 0, 0.1);\n --disabled-color: #cccccc;\n --menu-bg-color: rgba(0, 0, 0, 0.1);\n --menu-sep-color: #bbbbbb;\n --hover-bg-color: rgba(0, 0, 0, 0);\n --invalid-color: #FF0000;\n --selected-color: rgba(0, 0, 0, 0.3);\n --range-color: rgba(0, 0, 0, 0.125);\n }\n"}};function e(t,e={},n=[]){const i=document.createElement(t);return function(t,e,n){for(const[n,i]of Object.entries(e))if("function"==typeof i&&n.startsWith("on")){const e=n.substring(2).toLowerCase();t.addEventListener(e,i,{passive:!1})}else if("object"==typeof i)for(const[e,o]of Object.entries(i))t[n][e]=o;else void 0===t[n]?t.setAttribute(n,i):t[n]=i;for(const e of n)t.appendChild(e)}(i,e,n),i}let n=0;function i(t,e){const n=t.indexOf(e);return n&&t.splice(n,1),t}function o(t,e,n){return Math.max(e,Math.min(n,t))}const r="undefined"!=typeof SharedArrayBuffer?function(t){return t&&t.buffer&&(t.buffer instanceof ArrayBuffer||t.buffer instanceof SharedArrayBuffer)}:function(t){return t&&t.buffer&&t.buffer instanceof ArrayBuffer},s=(t,e,n)=>Math.round(e(t)/n)/(1/n),a=(t,e)=>(t%e+e)%e;function l(t,e){for(const n in e)n in t&&(t[n]=e[n]);return t}const u=(t,e,n,i,o)=>(t-e)*(o-i)/(n-e)+i,c=({from:t,to:e})=>({to:n=>u(n,...t,...e),from:n=>[!0,u(n,...e,...t)]}),h=({from:t,to:e,step:n})=>({min:e[0],max:e[1],...n&&{step:n},converters:c({from:t,to:e})}),d={to:t=>t,from:t=>[!0,t]};function p(t,e,n,i,o){const{converters:{from:r}=d}=o,{min:s,max:a}=o,l=o.minRange||0,u=r(l)[1],c=t.add(e,n,{...o,min:s,max:a-l}).onChange((t=>{h.setValue(Math.min(a,Math.max(t+u,e[i])))})),h=t.add(e,i,{...o,min:s+l,max:a}).onChange((t=>{c.setValue(Math.max(s,Math.min(t-u,e[n])))}));return[c,h]}class m{domElement;#t;#e=[];constructor(t){this.domElement=t,this.#t=t}addElem(t){return this.#t.appendChild(t),t}removeElem(t){return this.#t.removeChild(t),t}pushSubElem(t){this.#t.appendChild(t),this.#t=t}popSubElem(){this.#t=this.#t.parentElement}add(t){return this.#e.push(t),this.addElem(t.domElement),t}remove(t){return this.removeElem(t.domElement),i(this.#e,t),t}pushSubView(t){this.pushSubElem(t.domElement)}popSubView(){this.popSubElem()}setOptions(t){for(const e of this.#e)e.setOptions(t)}updateDisplayIfNeeded(t,e){for(const n of this.#e)n.updateDisplayIfNeeded(t,e);return this}$(t){return this.domElement.querySelector(t)}}class g extends m{#n;#i;#o;constructor(t){super(e("div",{className:"muigui-controller"})),this.#n=[],this.#i=[],t&&this.domElement.classList.add(t)}get parent(){return this.#o}setParent(t){this.#o=t,this.enable(!this.disabled())}show(t=!0){return this.domElement.classList.toggle("muigui-hide",!t),this.domElement.classList.toggle("muigui-show",t),this}hide(){return this.show(!1)}disabled(){return!!this.domElement.closest(".muigui-disabled")}enable(t=!0){return this.domElement.classList.toggle("muigui-disabled",!t),["input","button","select","textarea"].forEach((t=>{this.domElement.querySelectorAll(t).forEach((t=>{const e=!!t.closest(".muigui-disabled");t.disabled=e}))})),this}disable(t=!0){return this.enable(!t)}onChange(t){return this.removeChange(t),this.#n.push(t),this}removeChange(t){return i(this.#n,t),this}onFinishChange(t){return this.removeFinishChange(t),this.#i.push(t),this}removeFinishChange(t){return i(this.#i,t),this}#r(t,e){for(const n of t)n.call(this,e)}emitChange(t,e,n){this.#r(this.#n,t),this.#o&&(void 0===e?this.#o.emitChange(t):this.#o.emitChange({object:e,property:n,value:t,controller:this}))}emitFinalChange(t,e,n){this.#r(this.#i,t),this.#o&&(void 0===e?this.#o.emitChange(t):this.#o.emitFinalChange({object:e,property:n,value:t,controller:this}))}updateDisplay(){}getColors(){const t=t=>t.replace(/-([a-z])/g,((t,e)=>e.toUpperCase())),n=e("div");this.domElement.appendChild(n);const i=Object.fromEntries(["color","bg-color","value-color","value-bg-color","hover-bg-color","menu-bg-color","menu-sep-color","disabled-color"].map((e=>{n.style.color=`var(--${e})`;const i=getComputedStyle(n);return[t(e),i.color]})));return n.remove(),i}}class f extends g{#s;#a;#l;#u={name:""};constructor(t,n,i={}){super("muigui-button",""),this.#s=t,this.#a=n,this.#l=this.addElem(e("button",{type:"button",onClick:()=>{this.#s[this.#a](this)}})),this.setOptions({name:n,...i})}setOptions(t){l(this.#u,t);const{name:e}=this.#u;this.#l.textContent=e}}function b(t,e){if(t.length!==e.length)return!1;for(let n=0;n{t.setValue(i.checked)},onChange:()=>{t.setFinalValue(i.checked)}});super(e("label",{},[i])),this.#b=i}updateDisplay(t){this.#b.checked=t}}const w=[],y=new Set;let k,E;function $(){k=void 0,E=!0;for(const t of w)y.has(t)||t();E=!1,y.size&&(E?C():(y.forEach((t=>{i(w,t)})),y.clear())),C()}function C(){!k&&w.length&&(k=requestAnimationFrame($))}let V=0;function I(){return"muigui-"+ ++V}class M extends m{constructor(t=""){super(e("div",{className:"muigui-value"})),t&&this.domElement.classList.add(t)}}class S extends g{#v;#x;constructor(t="",n=""){super("muigui-label-controller"),this.#v=I(),this.#x=e("label",{for:this.#v}),this.domElement.appendChild(this.#x),this.pushSubView(new M(t)),this.name(n)}get id(){return this.#v}name(t){return this.#x.title===this.#x.textContent&&(this.#x.title=t),this.#x.textContent=t,this}tooltip(t){this.#x.title=t}}class D extends S{#s;#a;#w;#y;#e;#k;constructor(t,e,n=""){super(n,e),this.#s=t,this.#a=e,this.#w=this.getValue(),this.#y=!1,this.#e=[]}get initialValue(){return this.#w}get object(){return this.#s}get property(){return this.#a}add(t){return this.#e.push(t),super.add(t),this.updateDisplay(),t}#E(t,e){let n=!1;if("object"==typeof t){const e=this.#s[this.#a];if(Array.isArray(t)||r(t))for(let i=0;i=0&&w.splice(e,1)}(this.#k)),this}}class N extends D{constructor(t,e){super(t,e,"muigui-checkbox");const n=this.id;this.add(new x(this,n)),this.updateDisplay()}}const F={to:t=>t,from:t=>[!0,t]},A={to:t=>t.toString(),from:t=>{const e=parseFloat(t);return[!Number.isNaN(e),e]}},U={radToDeg:c({to:[0,180],from:[0,Math.PI]})};function L(){let t=0;return function(e,n,i=5){t-=e.deltaY*n/i;const o=Math.floor(Math.abs(t)/n)*Math.sign(t)*n;return t-=o,o}}class O extends v{#$;#C;#V;#I;#u={step:.01,converters:A,min:Number.NEGATIVE_INFINITY,max:Number.POSITIVE_INFINITY};constructor(t,n){const i=t.setValue.bind(t),r=t.setFinalValue.bind(t),a=L();super(e("input",{type:"number",onInput:()=>this.#M(i,!0),onChange:()=>this.#M(r,!1),onWheel:e=>{e.preventDefault();const{min:n,max:i,step:r}=this.#u,l=a(e,r),u=parseFloat(this.domElement.value),c=o(s(u+l,(t=>t),r),n,i);t.setValue(c)}})),this.setOptions(n)}#M(t,e){const n=parseFloat(this.domElement.value),[i,r]=this.#C(n);let s;if(i&&!Number.isNaN(n)){const{min:n,max:i}=this.#u;s=r>=n&&r<=i,this.#I=e,t(o(r,n,i))}this.domElement.classList.toggle("muigui-invalid-value",!i||!s)}updateDisplay(t){this.#I||(this.domElement.value=s(t,this.#$,this.#V)),this.#I=!1}setOptions(t){l(this.#u,t);const{step:e,converters:{to:n,from:i}}=this.#u;return this.#$=n,this.#C=i,this.#V=e,this}}class j extends D{#S;#V;constructor(t,e,n={}){super(t,e,"muigui-checkbox"),this.#S=this.add(new O(this,n)),this.updateDisplay()}}class T extends v{#D;constructor(t,n){const i=[];super(e("select",{onChange:()=>{t.setFinalValue(this.#D[this.domElement.selectedIndex])}},n.map((([t,n])=>(i.push(n),e("option",{textContent:t})))))),this.#D=i}updateDisplay(t){const e=this.#D.indexOf(t);this.domElement.selectedIndex=e}}function H(t,e){return Array.isArray(t)?Array.isArray(t[0])?t:e?t.map(((t,e)=>[t,e])):t.map((t=>[t,t])):[...Object.entries(t)]}class z extends D{constructor(t,e,n){super(t,e,"muigui-select");const i="number"==typeof this.getValue(),{keyValues:o}=n,r=H(o,i);this.add(new T(this,r)),this.updateDisplay()}}class P extends v{#$;#C;#V;#I;#u={step:.01,min:0,max:1,converters:F};constructor(t,n){const i=L();super(e("input",{type:"range",onInput:()=>{this.#I=!0;const{min:e,max:n,step:i}=this.#u,r=parseFloat(this.domElement.value),a=o(s(r,(t=>t),i),e,n),[l,u]=this.#C(a);l&&t.setValue(u)},onChange:()=>{this.#I=!0;const{min:e,max:n,step:i}=this.#u,r=parseFloat(this.domElement.value),a=o(s(r,(t=>t),i),e,n),[l,u]=this.#C(a);l&&t.setFinalValue(u)},onWheel:e=>{e.preventDefault();const[n,r]=this.#C(parseFloat(this.domElement.value));if(!n)return;const{min:a,max:l,step:u}=this.#u,c=i(e,u),h=o(s(r+c,(t=>t),u),a,l);t.setValue(h)}})),this.setOptions(n)}updateDisplay(t){this.#I||(this.domElement.value=s(t,this.#$,this.#V)),this.#I=!1}setOptions(t){l(this.#u,t);const{step:e,min:n,max:i,converters:{to:o,from:r}}=this.#u;return this.#$=o,this.#C=r,this.#V=e,this.domElement.step=e,this.domElement.min=n,this.domElement.max=i,this}}class B extends D{constructor(t,e,n){super(t,e,"muigui-range"),this.add(new P(this,n)),this.add(new O(this,n))}}class G extends v{#$;#C;#I;#u={converters:F};constructor(t,n){const i=t.setValue.bind(t),o=t.setFinalValue.bind(t);super(e("input",{type:"text",onInput:()=>this.#M(i,!0),onChange:()=>this.#M(o,!1)})),this.setOptions(n)}#M(t,e){const[n,i]=this.#C(this.domElement.value);n&&(this.#I=e,t(i)),this.domElement.style.color=n?"":"var(--invalid-color)"}updateDisplay(t){this.#I||(this.domElement.value=this.#$(t),this.domElement.style.color=""),this.#I=!1}setOptions(t){l(this.#u,t);const{converters:{to:e,from:n}}=this.#u;return this.#$=e,this.#C=n,this}}class R extends D{constructor(t,e){super(t,e,"muigui-checkbox"),this.add(new G(this)),this.updateDisplay()}}const Y=(t,e,n)=>Math.max(e,Math.min(n,t)),K=(t,e,n)=>t+(e-t)*n,W=t=>t>=0?t%1:1-t%1,q=t=>+t.toFixed(0),J=t=>+t.toFixed(3),_=t=>parseInt(t.substring(1,3),16)<<16|parseInt(t.substring(3,5),16)<<8|parseInt(t.substring(5,7),16),X=t=>parseInt(t.substring(1,3),16)*2**24+65536*parseInt(t.substring(3,5),16)+256*parseInt(t.substring(5,7),16)+parseInt(t.substring(7,9),16),Z=t=>[parseInt(t.substring(1,3),16),parseInt(t.substring(3,5),16),parseInt(t.substring(5,7),16)],Q=t=>`#${Array.from(t).map((t=>t.toString(16).padStart(2,"0"))).join("")}`,tt=t=>[parseInt(t.substring(1,3),16),parseInt(t.substring(3,5),16),parseInt(t.substring(5,7),16),parseInt(t.substring(7,9),16)],et=t=>`#${Array.from(t).map((t=>t.toString(16).padStart(2,"0"))).join("")}`,nt=t=>Z(t).map((t=>J(t/255))),it=t=>Q(Array.from(t).map((t=>Math.round(Y(255*t,0,255))))),ot=t=>tt(t).map((t=>J(t/255))),rt=t=>et(Array.from(t).map((t=>Math.round(Y(255*t,0,255))))),st=t=>Y(Math.round(255*t),0,255).toString(16).padStart(2,"0"),at=t=>({r:parseInt(t.substring(1,3),16)/255,g:parseInt(t.substring(3,5),16)/255,b:parseInt(t.substring(5,7),16)/255}),lt=t=>({r:parseInt(t.substring(1,3),16)/255,g:parseInt(t.substring(3,5),16)/255,b:parseInt(t.substring(5,7),16)/255,a:parseInt(t.substring(7,9),16)/255}),ut=t=>`rgb(${Z(t).join(", ")})`,ct=/^\s*rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)\s*$/,ht=t=>`rgba(${tt(t).map(((t,e)=>3===e?t/255:t)).join(", ")})`,dt=/^\s*rgba\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+\.\d+|\d+)\s*\)\s*$/,pt=t=>{const e=yt(Z(t)).map((t=>q(t)));return`hsl(${e[0]}, ${e[1]}%, ${e[2]}%)`},mt=t=>{const e=kt(tt(t)).map(((t,e)=>3===e?J(t):q(t)));return`hsl(${e[0]} ${e[1]}% ${e[2]}% / ${e[3]})`},gt=/^\s*hsl\(\s*(\d+)(?:deg|)\s*(?:,|)\s*(\d+)%\s*(?:,|)\s*(\d+)%\s*\)\s*$/,ft=/^\s*hsl\(\s*(\d+)(?:deg|)\s*(?:,|)\s*(\d+)%\s*(?:,|)\s*(\d+)%\s*\/\s*(\d+\.\d+|\d+)\s*\)\s*$/,bt=(t,e)=>(t%e+e)%e;function vt([t,e,n]){t=bt(t,360),e=Y(e/100,0,1),n=Y(n/100,0,1);const i=e*Math.min(n,1-n);function o(e){const o=(e+t/30)%12;return n-i*Math.max(-1,Math.min(o-3,9-o,1))}return[o(0),o(8),o(4)].map((t=>Math.round(255*t)))}function xt([t,e,n]){const i=Math.max(t,e,n),o=Math.min(t,e,n),r=.5*(o+i),s=i-o;let a=0,l=0;if(0!==s)switch(l=0===r||1===r?0:(i-r)/Math.min(r,1-r),i){case t:a=(e-n)/s+(e{const[e,n,i]=xt(t.map((t=>t/255)));return[360*e,100*n,100*i]},kt=t=>{const[e,n,i,o]=wt(t.map((t=>t/255)));return[360*e,100*n,100*i,o]};function Et([t,e,n]){return e=Y(e,0,1),n=Y(n,0,1),[t,t+2/3,t+1/3].map((t=>K(1,Y(Math.abs(6*W(t)-3)-1,0,1),e)*n))}function $t([t,e,n,i]){return[...Et([t,e,n]),i]}const Ct=t=>Math.round(1e3*t)/1e3;function Vt([t,e,n]){const i=n>e?[n,e,-1,2/3]:[e,n,0,-1/3],o=i[0]>t?[i[0],i[1],i[3],t]:[t,i[1],i[2],i[0]],r=o[0]-Math.min(o[3],o[1]);return[Math.abs(o[2]+(o[3]-o[1])/(6*r+Number.EPSILON)),r/(o[0]+Number.EPSILON),o[0]].map(Ct)}const It=t=>t.endsWith("a")||t.startsWith("hex8"),Mt=[{re:/^#(?:[0-9a-f]){6}$/i,format:"hex6"},{re:/^(?:[0-9a-f]){6}$/i,format:"hex6-no-hash"},{re:/^#(?:[0-9a-f]){8}$/i,format:"hex8"},{re:/^(?:[0-9a-f]){8}$/i,format:"hex8-no-hash"},{re:/^#(?:[0-9a-f]){3}$/i,format:"hex3"},{re:/^(?:[0-9a-f]){3}$/i,format:"hex3-no-hash"},{re:ct,format:"css-rgb"},{re:gt,format:"css-hsl"},{re:dt,format:"css-rgba"},{re:ft,format:"css-hsla"}];function St(t){switch(typeof t){case"number":return console.warn('can not reliably guess format based on a number. You should pass in a format like {format: "uint32-rgb"} or {format: "uint32-rgb"}'),t<=16777215?"uint32-rgb":"uint32-rgba";case"string":{const e=function(t){for(const e of Mt)if(e.re.test(t))return e}(t.trim());if(e)return e.format;break}case"object":if(t instanceof Uint8Array||t instanceof Uint8ClampedArray){if(3===t.length)return"uint8-rgb";if(4===t.length)return"uint8-rgba"}else if(t instanceof Float32Array){if(3===t.length)return"float-rgb";if(4===t.length)return"float-rgba"}else if(Array.isArray(t)){if(3===t.length)return"float-rgb";if(4===t.length)return"float-rgba"}else if("r"in t&&"g"in t&&"b"in t)return"a"in t?"object-rgba":"object-rgb"}throw new Error(`unknown color format: ${t}`)}function Dt(t){return t.trim(t)}function Nt(t){return t.trim(t)}function Ft(t){return t[1]===t[2]&&t[3]===t[4]&&t[5]===t[6]?`#${t[1]}${t[3]}${t[5]}`:t}const At=/^(#|)([0-9a-f]{3})$/i;function Ut(t){const e=At.exec(t);if(e){const[,,t]=e;return"#"+`${(n=t)[0]}${n[0]}${n[1]}${n[1]}${n[2]}${n[2]}`}var n;return t}function Lt(t){return Ft(Dt(t))}const Ot=t=>{const e=ct.exec(t);if(!e)return[!1];const n=[e[1],e[2],e[3]].map((t=>parseInt(t)));return[!n.find((t=>t>255)),`rgb(${n.join(", ")})`]},jt=t=>{const e=dt.exec(t);if(!e)return[!1];const n=[e[1],e[2],e[3],e[4]].map(((t,e)=>3===e?parseFloat(t):parseInt(t)));return[!n.find((t=>t>255)),`rgba(${n.join(", ")})`]},Tt=t=>{const e=gt.exec(t);if(!e)return[!1];const n=[e[1],e[2],e[3]].map((t=>parseFloat(t)));return[!n.find((t=>Number.isNaN(t))),`hsl(${n[0]}, ${n[1]}%, ${n[2]}%)`]},Ht=t=>{const e=ft.exec(t);if(!e)return[!1];const n=[e[1],e[2],e[3],e[4]].map((t=>parseFloat(t)));return[!n.find((t=>Number.isNaN(t))),`hsl(${n[0]} ${n[1]}% ${n[2]}% / ${n[3]})`]},zt=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*$/,Pt=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*$/,Bt=/^\s*(?:0x){0,1}([0-9a-z]{1,6})\s*$/i,Gt=/^\s*(?:0x){0,1}([0-9a-z]{1,8})\s*$/i,Rt=/^\s*#[a-f0-9]{6}\s*$|^\s*#[a-f0-9]{3}\s*$/i,Yt=/^\s*[a-f0-9]{6}\s*$/i,Kt=/^\s*#[a-f0-9]{8}\s*$/i,Wt=/^\s*[a-f0-9]{8}\s*$/i,qt={hex6:{color:{from:t=>[!0,t],to:Dt},text:{from:t=>[Rt.test(t),t.trim()],to:t=>t}},hex8:{color:{from:t=>[!0,t],to:Nt},text:{from:t=>[Kt.test(t),t.trim()],to:t=>t}},hex3:{color:{from:t=>[!0,Lt(t)],to:Ut},text:{from:t=>[Rt.test(t),Ft(t.trim())],to:t=>t}},"hex6-no-hash":{color:{from:t=>[!0,t.substring(1)],to:t=>`#${Dt(t)}`},text:{from:t=>[Yt.test(t),t.trim()],to:t=>t}},"hex8-no-hash":{color:{from:t=>[!0,t.substring(1)],to:t=>`#${Nt(t)}`},text:{from:t=>[Wt.test(t),t.trim()],to:t=>t}},"hex3-no-hash":{color:{from:t=>[!0,Lt(t).substring(1)],to:Ut},text:{from:t=>[Yt.test(t),Ft(t.trim())],to:t=>t}},"uint32-rgb":{color:{from:t=>[!0,_(t)],to:t=>`#${Math.round(t).toString(16).padStart(6,"0")}`},text:{from:t=>(t=>{const e=Bt.exec(t);return e?[!0,parseInt(e[1],16)]:[!1]})(t),to:t=>`0x${t.toString(16).padStart(6,"0")}`}},"uint32-rgba":{color:{from:t=>[!0,X(t)],to:t=>`#${Math.round(t).toString(16).padStart(8,"0")}`},text:{from:t=>(t=>{const e=Gt.exec(t);return e?[!0,parseInt(e[1],16)]:[!1]})(t),to:t=>`0x${t.toString(16).padStart(8,"0")}`}},"uint8-rgb":{color:{from:t=>[!0,Z(t)],to:Q},text:{from:t=>{const e=zt.exec(t);if(!e)return[!1];const n=[e[1],e[2],e[3]].map((t=>parseInt(t)));return[!n.find((t=>t>255)),n]},to:t=>t.join(", ")}},"uint8-rgba":{color:{from:t=>[!0,tt(t)],to:et},text:{from:t=>{const e=Pt.exec(t);if(!e)return[!1];const n=[e[1],e[2],e[3],e[4]].map((t=>parseInt(t)));return[!n.find((t=>t>255)),n]},to:t=>t.join(", ")}},"float-rgb":{color:{from:t=>[!0,nt(t)],to:it},text:{from:t=>{const e=t.split(",").map((t=>t.trim())),n=e.map((t=>parseFloat(t)));if(3!==n.length)return[!1];const i=e.findIndex((t=>isNaN(t)));return[i<0,n.map((t=>J(t)))]},to:t=>Array.from(t).map((t=>J(t))).join(", ")}},"float-rgba":{color:{from:t=>[!0,ot(t)],to:rt},text:{from:t=>{const e=t.split(",").map((t=>t.trim())),n=e.map((t=>parseFloat(t)));if(4!==n.length)return[!1];const i=e.findIndex((t=>isNaN(t)));return[i<0,n.map((t=>J(t)))]},to:t=>Array.from(t).map((t=>J(t))).join(", ")}},"object-rgb":{color:{from:t=>[!0,at(t)],to:t=>`#${st(t.r)}${st(t.g)}${st(t.b)}`},text:{from:t=>{try{const e=t.replace(/([a-z])/g,'"$1"'),n=JSON.parse(e);if(Number.isNaN(n.r)||Number.isNaN(n.g)||Number.isNaN(n.b))throw new Error("not {r, g, b}");return[!0,n]}catch(t){return[!1]}},to:t=>`{r:${J(t.r)}, g:${J(t.g)}, b:${J(t.b)}}`}},"object-rgba":{color:{from:t=>[!0,lt(t)],to:t=>`#${st(t.r)}${st(t.g)}${st(t.b)}${st(t.a)}`},text:{from:t=>{try{const e=t.replace(/([a-z])/g,'"$1"'),n=JSON.parse(e);if(Number.isNaN(n.r)||Number.isNaN(n.g)||Number.isNaN(n.b)||Number.isNaN(n.a))throw new Error("not {r, g, b, a}");return[!0,n]}catch(t){return[!1]}},to:t=>`{r:${J(t.r)}, g:${J(t.g)}, b:${J(t.b)}}, a:${J(t.a)}}`}},"css-rgb":{color:{from:t=>[!0,ut(t)],to:t=>{const e=ct.exec(t);return Q([e[1],e[2],e[3]].map((t=>parseInt(t))))}},text:{from:Ot,to:t=>Ot(t)[1]}},"css-rgba":{color:{from:t=>[!0,ht(t)],to:t=>{const e=dt.exec(t);return et([e[1],e[2],e[3],e[4]].map(((t,e)=>3===e?255*parseFloat(t)|0:parseInt(t))))}},text:{from:jt,to:t=>jt(t)[1]}},"css-hsl":{color:{from:t=>[!0,pt(t)],to:t=>{const e=gt.exec(t),n=vt([e[1],e[2],e[3]].map((t=>parseFloat(t))));return Q(n)}},text:{from:Tt,to:t=>Tt(t)[1]}},"css-hsla":{color:{from:t=>[!0,mt(t)],to:t=>{const e=ft.exec(t),n=function([t,e,n,i]){return[...vt([t,e,n]),255*i|0]}([e[1],e[2],e[3],e[4]].map((t=>parseFloat(t))));return et(n)}},text:{from:Ht,to:t=>Ht(t)[1]}}};class Jt extends m{constructor(t,n){super(e(t,{className:n}))}}class _t extends S{#N;constructor(){super("muigui-canvas"),this.#N=this.add(new Jt("canvas","muigui-canvas")).domElement}get canvas(){return this.#N}}class Xt extends v{#$;#C;#F;#I;#u={converters:F};constructor(t,n){const i=e("input",{type:"color",onInput:()=>{const[e,n]=this.#C(i.value);e&&(this.#I=!0,t.setValue(n))},onChange:()=>{const[e,n]=this.#C(i.value);e&&(this.#I=!0,t.setFinalValue(n))}});super(e("div",{},[i])),this.setOptions(n),this.#F=i}updateDisplay(t){this.#I||(this.#F.value=this.#$(t)),this.#I=!1}setOptions(t){l(this.#u,t);const{converters:{to:e,from:n}}=this.#u;return this.#$=e,this.#C=n,this}}class Zt extends D{#A;#S;constructor(t,e,n={}){super(t,e,"muigui-color");const i=n.format||St(this.getValue()),{color:o,text:r}=qt[i];this.#A=this.add(new Xt(this,{converters:o})),this.#S=this.add(new G(this,{converters:r})),this.updateDisplay()}setOptions(t){const{format:e}=t;if(e){const{color:t,text:n}=qt[e];this.#A.setOptions({converters:t}),this.#S.setOptions({converters:n})}return super.setOptions(t),this}}class Qt extends g{constructor(){super("muigui-divider")}}class te extends g{#U;#L;constructor(t){super(t),this.#U=[],this.#L=this}get children(){return this.#U}get controllers(){return this.#U.filter((t=>!(t instanceof te)))}get folders(){return this.#U.filter((t=>t instanceof te))}reset(t=!0){for(const e of this.#U)e instanceof te&&!t||e.reset(t);return this}updateDisplay(){for(const t of this.#U)t.updateDisplay();return this}remove(t){const e=this.#U.indexOf(t);if(e>=0){const t=this.#U.splice(e,1)[0];t.domElement.remove(),t.setParent(null)}return this}#O(t){return this.domElement.appendChild(t.domElement),this.#U.push(t),t.setParent(this),t}addController(t){return this.#L.#O(t)}pushContainer(t){return this.addController(t),this.#L=t,t}popContainer(){return this.#L=this.#L.parent,this}}class ee extends te{#j;constructor(t="Controls",n="muigui-menu"){super(n),this.#j=e("label"),this.addElem(e("button",{type:"button",onClick:()=>this.toggleOpen()},[this.#j])),this.pushContainer(new te),this.name(t),this.open()}open(t=!0){return this.domElement.classList.toggle("muigui-closed",!t),this.domElement.classList.toggle("muigui-open",t),this}close(){return this.open(!1)}name(t){return this.#j.textContent=t,this}title(t){return this.name(t)}toggleOpen(){return this.open(!this.domElement.classList.contains("muigui-open")),this}}class ne extends g{constructor(t){super("muigui-label"),this.text(t)}text(t){return this.domElement.textContent=t,this}}function ie(){}function oe(t,e,n){const i=t.getBoundingClientRect(),o=e.clientX-i.left,r=e.clientY-i.top,s=o/i.width,a=r/i.height,l=o-(n=n||[o,r])[0],u=r-n[1];return{x:o,y:r,nx:s,ny:a,dx:l,dy:u,ndx:l/i.width,ndy:u/i.width}}function re(t,{onDown:e=ie,onMove:n=ie,onUp:i=ie}){let o;const r=function(e){const i={type:"move",...oe(t,e,o)};n(i)},s=function(e){t.releasePointerCapture(e.pointerId),t.removeEventListener("pointermove",r),t.removeEventListener("pointerup",s),document.body.style.backgroundColor="",i("up")},a=function(n){t.addEventListener("pointermove",r),t.addEventListener("pointerup",s),t.setPointerCapture(n.pointerId);const i=oe(t,n);o=[i.x,i.y],e({type:"down",...i})};return t.addEventListener("pointerdown",a),function(){t.removeEventListener("pointerdown",a)}}function se(t){return t.querySelectorAll("[data-src]").forEach((e=>{const i="muigui-id-"+n++;e.id=i,t.querySelectorAll(`[data-target=${e.dataset.src}]`).forEach((t=>{t.setAttribute("fill",`url(#${i})`)}))})),t}class ae extends v{#$;#C;#T;#H;#z;#P;#B;#G;#R;#Y;#K;#W;#q;#J;#u={converters:F,alpha:!1};#_;#X;constructor(t,n){super(e("div",{innerHTML:'\n\n\n\n',className:"muigui-no-scroll"})),this.#T=this.domElement.children[0],this.#z=this.domElement.children[1],this.#G=this.domElement.children[2],se(this.#T),se(this.#z),se(this.#G),this.#H=this.$(".muigui-color-chooser-circle"),this.#P=this.$("[data-src=muigui-color-chooser-hue]"),this.#B=this.$(".muigui-color-chooser-hue-cursor"),this.#R=this.$("[data-src=muigui-color-chooser-alpha]"),this.#Y=this.$(".muigui-color-chooser-alpha-cursor");const i=e=>{const n=o(e.nx,0,1),i=o(e.ny,0,1);this.#K[1]=n,this.#K[2]=1-i,this.#W=!0,this.#J=!0;const[r,s]=this.#C(this.#_(this.#K));r&&t.setValue(s)},r=e=>{const n=o(e.nx,0,1);this.#K[0]=n,this.#q=!0,this.#J=!0;const[i,r]=this.#C(this.#_(this.#K));i&&t.setValue(r)},s=e=>{const n=o(e.nx,0,1);this.#K[3]=n,this.#W=!0,this.#q=!0;const[i,r]=this.#C(this.#_(this.#K));i&&t.setValue(r)};re(this.#T,{onDown:i,onMove:i}),re(this.#z,{onDown:r,onMove:r}),re(this.#G,{onDown:s,onMove:s}),this.setOptions(n)}updateDisplay(t){this.#K||(this.#K=this.#X(this.#$(t)));{const[e,n,i,o=1]=this.#X(this.#$(t));this.#W||(this.#K[0]=n>.001&&i>.001?e:this.#K[0]),this.#q||(this.#K[1]=n,this.#K[2]=i),this.#J||(this.#K[3]=o)}{const[t,e,n,i]=this.#K,[o,r,s]=wt($t(this.#K));this.#W||this.#B.setAttribute("transform",`translate(${64*t}, 0)`),this.#P.children[0].setAttribute("stop-color",`hsl(${360*o} 0% 100% / ${i})`),this.#P.children[1].setAttribute("stop-color",`hsl(${360*o} 100% 50% / ${i})`),this.#J||this.#Y.setAttribute("transform",`translate(${64*i}, 0)`),this.#R.children[0].setAttribute("stop-color",`hsl(${360*o} ${100*r}% ${100*s}% / 0)`),this.#R.children[1].setAttribute("stop-color",`hsl(${360*o} ${100*r}% ${100*s}% / 1)`),this.#q||(this.#H.setAttribute("cx",""+64*e),this.#H.setAttribute("cy",""+48*(1-n)))}this.#W=!1,this.#q=!1,this.#J=!1}setOptions(t){l(this.#u,t);const{converters:{to:e,from:n},alpha:i}=this.#u;return this.#G.style.display=i?"":"none",this.#_=i?t=>rt($t(t)):t=>it(Et(t)),this.#X=i?t=>function([t,e,n,i]){return[...Vt([t,e,n]),i]}(ot(t)):t=>Vt(nt(t)),this.#$=e,this.#C=n,this}}class le extends D{#Z;#Q;#b;#tt;#u={open:!1};constructor(t,n,i={}){super(t,n,"muigui-pop-down-controller"),this.#Z=this.add(new Jt("div","muigui-pop-down-top"));const o=this.#Z.addElem(e("input",{type:"checkbox",onChange:()=>{this.#u.open=o.checked,this.updateDisplay()}}));this.#b=o,this.#Q=this.#Z.add(new Jt("div","muigui-pop-down-values")),this.#tt=this.add(new Jt("div","muigui-pop-down-bottom")),this.setOptions(i)}setKnobColor(t){this.#b&&(this.#b.style=`\n --range-color: ${t};\n --value-bg-color: ${t};\n `)}updateDisplay(){super.updateDisplay();const{open:t}=this.#u;this.domElement.children[1].classList.toggle("muigui-open",t),this.domElement.children[1].classList.toggle("muigui-closed",!t)}setOptions(t){l(this.#u,t),super.setOptions(t),this.updateDisplay()}addTop(t){return this.#Q.add(t)}addBottom(t){return this.#tt.add(t)}}class ue extends le{#A;#S;#$;#et;constructor(t,e,n={}){super(t,e,"muigui-color-chooser");const i=n.format||St(this.getValue()),{color:o,text:r}=qt[i];this.#$=o.to,this.#S=new G(this,{converters:r,alpha:It(i)}),this.#A=new ae(this,{converters:o,alpha:It(i)}),this.addTop(this.#S),this.addBottom(this.#A),this.#et=()=>{if(this.#$){const t=this.#$(this.getValue()),e=yt(Z(t));e[2]=(e[2]+50)%100;const n=Q(vt(e));this.setKnobColor(`${t.substring(0,7)}FF`,n)}},this.updateDisplay()}updateDisplay(){super.updateDisplay(),this.#et&&this.#et()}setOptions(t){return super.setOptions(t),this}}class ce extends ee{add(t,e,...n){const i=t instanceof g?t:function(t,e,...n){const[i]=n;if(Array.isArray(i))return new z(t,e,{keyValues:i});const o=typeof t[e];switch(o){case"number":if("number"==typeof n[0]&&"number"==typeof n[1]){const i=n[0],o=n[1],r=n[2];return new B(t,e,{min:i,max:o,...r&&{step:r}})}return 0===n.length?new j(t,e,...n):new B(t,e,...n);case"boolean":return new N(t,e,...n);case"function":return new f(t,e,...n);case"string":return new R(t,e,...n);case"undefined":throw new Error(`no property named ${e}`);default:throw new Error(`unhandled type ${o} for property ${e}`)}}(t,e,...n);return this.addController(i)}addCanvas(t){return this.addController(new _t(t))}addColor(t,e,n={}){const i=t[e];return It(n.format||St(i))?this.addController(new ue(t,e,n)):this.addController(new Zt(t,e,n))}addDivider(){return this.addController(new Qt)}addFolder(t){return this.addController(new ce(t))}addLabel(t){return this.addController(new ne(t))}}class he extends HTMLElement{constructor(){super(),this.shadow=this.attachShadow({mode:"open"})}}customElements.define("muigui-element",he);const de=new CSSStyleSheet;de.replaceSync(t.default);const pe=new CSSStyleSheet;function me(t){let e,n;function i(){if(e&&!n){const o=e;e=void 0,n=t.replace(o).then((()=>{n=void 0,i()}))}}return function(t){e=t,i()}}const ge=me(de),fe=me(pe);class be extends ce{static converters=U;static mapRange=u;static makeRangeConverters=c;static makeRangeOptions=h;static makeMinMaxPair=p;#nt=new CSSStyleSheet;constructor(t={}){super("Controls","muigui-root"),t instanceof HTMLElement&&(t={parent:t});const{autoPlace:n=!0,width:i,title:o="Controls"}=t;let{parent:r}=t;if(i&&(this.domElement.style.width=/^\d+$/.test(i)?`${i}px`:i),void 0===r&&n&&(r=document.body,this.domElement.classList.add("muigui-auto-place")),r){const t=e("muigui-element");t.shadowRoot.adoptedStyleSheets=[de,pe,this.#nt],t.shadow.appendChild(this.domElement),r.appendChild(t)}o&&this.title(o),this.domElement.classList.add("muigui","muigui-colors")}setStyle(t){this.#nt.replace(t)}static setBaseStyles(t){ge(t)}static getBaseStyleSheet(){return de}static setUserStyles(t){fe(t)}static getUserStyleSheet(){return pe}static setTheme(e){be.setBaseStyles(`${t.default}\n${t.themes[e]||""}`)}}function ve(){}const xe={ArrowLeft:[-1,0],ArrowRight:[1,0],ArrowUp:[0,-1],ArrowDown:[0,1]};function we(t,{onDown:e=ve,onUp:n=ve}){const i=function(t){const i=t.shiftKey?10:1,[o,r]=(xe[t.key]||[0,0]).map((t=>t*i));("keydown"===t.type?e:n)({type:t.type.substring(3),dx:o,dy:r,event:t})};return t.addEventListener("keydown",i),t.addEventListener("keyup",i),function(){t.removeEventListener("keydown",i),t.removeEventListener("keyup",i)}}function ye(t,e=""){if(!t)throw new Error(e)}function ke(t,e,n,i,o,r){const s=Math.abs(n)*Math.cos(r),a=Math.abs(i)*Math.sin(r);return[t+Math.cos(o)*s-Math.sin(o)*a,e+Math.sin(o)*s+Math.cos(o)*a]}function Ee(t,e,n,i,o){ye(Math.abs(i-o)<=2*Math.PI),ye(i>=-Math.PI&&i<=2*Math.PI),ye(i<=o),ye(o>=-Math.PI&&o<=4*Math.PI);const{x1:r,y1:s,x2:a,y2:l,fa:u,fs:c}=function(t,e,n,i,o,r,s){const[a,l]=ke(t,e,n,i,o,r),[u,c]=ke(t,e,n,i,o,r+s);return{x1:a,y1:l,x2:u,y2:c,fa:Math.abs(s)>Math.PI?1:0,fs:s>0?1:0}}(t,e,n,n,0,i,o-i);return Math.abs(Math.abs(i-o)-2*Math.PI)>Number.EPSILON?`M${t} ${e} L${r} ${s} A ${n} ${n} 0 ${u} ${c} ${a} ${l} L${t} ${e}`:`M${r} ${s} L${r} ${s} A ${n} ${n} 0 ${u} ${c} ${a} ${l}`}const $e=t=>a(t+Math.PI,2*Math.PI)-Math.PI;class Ce extends v{#it;#ot;#rt;#st;#u={step:1,min:-180,max:180,dirMin:-Math.PI,dirMax:Math.PI,wrap:void 0,converters:F};constructor(t,n={}){const i=L();super(e("div",{className:"muigui-direction muigui-no-scroll",innerHTML:'\n\n',onWheel:e=>{e.preventDefault();const{min:n,max:r,step:l}=this.#u,u=i(e,l);let c=this.#rt+u;this.#st&&(c=a(c-n,r-n)+n);const h=o(s(c,(t=>t),l),n,r);t.setValue(h)}}));const r=e=>{const{min:n,max:i,step:r,dirMin:a,dirMax:l}=this.#u,u=2*e.nx-1,c=2*e.ny-1,h=Math.atan2(c,u),d=(a+l)/2,p=o(($e(h-d)-$e(a-d))/(l-a),0,1),m=s(n+(i-n)*p,(t=>t),r);t.setValue(m)};re(this.domElement,{onDown:r,onMove:r}),we(this.domElement,{onDown:e=>{const{min:n,max:i,step:r}=this.#u,a=o(s(this.#rt+e.dx*r,(t=>t),r),n,i);t.setValue(a)}}),this.#it=this.$("#muigui-arrow"),this.#ot=this.$("#muigui-range"),this.setOptions(n)}updateDisplay(t){this.#rt=t;const{min:e,max:n}=this.#u,i=(t-e)/(n-e),o=(r=this.#u.dirMin,s=this.#u.dirMax,r+(s-r)*i);var r,s;this.#it.style.transform=`rotate(${o}rad)`}setOptions(t){l(this.#u,t);const{dirMin:e,dirMax:n,wrap:i}=this.#u;this.#st=void 0!==i?i:Math.abs(e-n)>=2*Math.PI-Number.EPSILON;const[o,r]=e(o.push(i),e("label",{},[e("input",{type:"radio",name:r,value:a,onChange:function(){this.checked&&t.setFinalValue(s.#D[this.value])}}),e("button",{type:"button",textContent:n,onClick:function(){this.previousElementSibling.click()}})]))))));const s=this;this.#D=o,this.cols(i)}updateDisplay(t){const e=this.#D.indexOf(t);for(let t=0;t{e({rect:t.getBoundingClientRect(),elem:t})})).observe(t)}function De(t,e,n,i){Se(t,(({rect:o})=>{const{width:r,height:s}=o;t.setAttribute("viewBox",`-${r*e} -${s*n} ${r} ${s}`),i({elem:t,rect:o})}))}function Ne(t,e,n,i,o,r){const a=[];tt),n)),e=Math.min(e,o);for(let i=t;i<=e;i+=n)a.push(`M${i} 0 l0 ${r}`);return a.join(" ")}class Fe extends v{#at;#lt;#ut;#ct;#ht;#dt;#pt;#mt;#gt;#rt;#ft;#u={min:-100,max:100,step:1,unit:10,unitSize:10,ticksPerUnit:5,labelFn:t=>t,tickHeight:1,limits:!0,thicksColor:void 0,orientation:void 0};constructor(t,n){const i=L();let r;super(e("div",{innerHTML:'\n\n',className:"muigui-no-v-scroll",onWheel:e=>{e.preventDefault();const{min:n,max:r,step:a}=this.#u,l=i(e,a),u=o(s(this.#rt+l,(t=>t),a),n,r);t.setValue(u)}})),this.#at=this.$("svg"),this.#lt=this.$("#muigui-origin"),this.#ut=this.$("#muigui-ticks"),this.#ct=this.$("#muigui-thicks"),this.#ht=this.$("#muigui-numbers"),this.#dt=this.$("#muigui-left-grad"),this.#pt=this.$("#muigui-right-grad"),this.setOptions(n),re(this.domElement,{onDown:()=>{r=this.#rt},onMove:e=>{const{min:n,max:i,unitSize:a,unit:l,step:u}=this.#u,c=o(s(r-e.dx/a*l,(t=>t),u),n,i);t.setValue(c)}}),we(this.domElement,{onDown:e=>{const{min:n,max:i,step:r}=this.#u,a=o(s(this.#rt+e.dx*r,(t=>t),r),n,i);t.setValue(a)}}),De(this.#at,.5,0,(({rect:{width:t}})=>{this.#dt.setAttribute("x",-t/2),this.#pt.setAttribute("x",t/2-20),this.#ft=function(t){const e=t.innerHTML;t.innerHTML="- ";const n=t.querySelector("text").getComputedTextLength();return t.innerHTML=e,n}(this.#ht),this.#mt=t,this.#bt()}))}#bt(){if(!this.#mt||void 0===this.#rt)return;const{labelFn:t,limits:e,min:n,max:i,orientation:o,tickHeight:r,ticksPerUnit:a,unit:l,unitSize:u,thicksColor:c}=this.#u,h=Math.ceil(this.#mt/u),d=this.#rt/l,p=Math.round(d-h),m=p*u,g=(p+2*h)*u,f=e?n*u/l:m,b=e?i*u/l:g,v=""===t(1)?10:5;a>1&&this.#ut.setAttribute("d",Ne(m,g,u/a,f,b,v*r)),this.#ct.style.stroke=c,this.#ct.setAttribute("d",Ne(m,g,u,f,b,v)),this.#ht.innerHTML=function(t,e,n,i,o,r,a,l){const u=[];tt),n)),e=Math.min(e,a);const c=Math.max(0,-Math.log10(i));for(let r=t;r<=e;r+=n)u.push(`${h=r/n*i,l(h.toFixed(c))}`);var h;return u.join("\n")}(m,g,u,l,this.#ft,f,b,t),this.#lt.setAttribute("transform",`translate(${-this.#rt*u/l} 0)`),this.#at.classList.toggle("muigui-slider-up","up"===o)}updateDisplay(t){this.#rt=t,this.#bt()}setOptions(t){return l(this.#u,t),this}}class Ae extends D{constructor(t,e,n={}){super(t,e,"muigui-slider"),this.add(new Fe(this,n)),this.add(new O(this,n)),this.updateDisplay()}}class Ue extends v{#at;#it;#H;#rt=[];constructor(t){super(e("div",{innerHTML:'\n\n',className:"muigui-no-scroll"}));const n=e=>{const{width:n,height:i}=this.#at.getBoundingClientRect(),o=2*e.nx-1,r=2*e.ny-1;t.setValue([o*n*.5,r*i*.5])};re(this.domElement,{onDown:n,onMove:n}),this.#at=this.$("svg"),this.#it=this.$("#muigui-arrow"),this.#H=this.$("#muigui-circle"),De(this.#at,.5,.5,(()=>this.#vt))}#vt(){const[t,e]=this.#rt;this.#it.setAttribute("d",`M0,0L${t},${e}`),this.#H.setAttribute("transform",`translate(${t}, ${e})`)}updateDisplay(t){this.#rt[0]=t[0],this.#rt[1]=t[1],this.#vt()}}class Le extends le{constructor(t,e){super(t,e,"muigui-vec2");const n=t=>({setValue:e=>{const n=this.getValue();n[t]=e,this.setValue(n)},setFinalValue:e=>{const n=this.getValue();n[t]=e,this.setFinalValue(n)}});this.addTop(new O(n(0),{converters:{to:t=>t[0],from:A.from}})),this.addTop(new O(n(1),{converters:{to:t=>t[1],from:A.from}})),this.addBottom(new Ue(this)),this.updateDisplay()}}export{ue as ColorChooser,Ve as Direction,Me as RadioGrid,B as Range,z as Select,Ae as Slider,j as TextNumber,Le as Vec2,be as default};
+var t={default:'\n.muigui {\n --bg-color: #ddd;\n --color: #222;\n --contrast-color: #eee;\n --value-color: #145 ;\n --value-bg-color: #eeee;\n --disabled-color: #999;\n --menu-bg-color: #f8f8f8;\n --menu-sep-color: #bbb;\n --hover-bg-color: #999;\n --focus-color: #8BF;\n --range-color: #AAA;\n --invalid-color: #FF0000;\n --selected-color: rgb(255, 255, 255, 0.9);\n\n --button-bg-color: var(--value-bg-color);\n\n --image-open: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPgogIDxyZWN0IHN0eWxlPSJmaWxsOiAjNDQ0OyIgeD0iMjAlIiB5PSI0NSUiIHdpZHRoPSI2MCUiIGhlaWdodD0iMTAlIj48L3JlY3Q+Cjwvc3ZnPg==);\n --image-closed: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPgogIDxyZWN0IHN0eWxlPSJmaWxsOiAjNDQ0OyIgeD0iNDUlIiB5PSIyMCUiIHdpZHRoPSIxMCUiIGhlaWdodD0iNjAlIj48L3JlY3Q+CiAgPHJlY3Qgc3R5bGU9ImZpbGw6ICM0NDQ7IiB4PSIyMCUiIHk9IjQ1JSIgd2lkdGg9IjYwJSIgaGVpZ2h0PSIxMCUiPjwvcmVjdD4KPC9zdmc+);\n --image-checkerboard: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPgogIDxyZWN0IHN0eWxlPSJmaWxsOiAjNDA0MDQwOyIgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSI+PC9yZWN0PgogIDxyZWN0IHN0eWxlPSJmaWxsOiAjODA4MDgwOyIgeD0iMCIgeT0iMCIgd2lkdGg9IjUwJSIgaGVpZ2h0PSI1MCUiPjwvcmVjdD4KICA8cmVjdCBzdHlsZT0iZmlsbDogIzgwODA4MDsiIHg9IjUwJSIgeT0iNTAlIiB3aWR0aD0iNTAlIiBoZWlnaHQ9IjUwJSI+PC9yZWN0Pgo8L3N2Zz4=);\n\n --range-left-color: var(--value-color);\n --range-right-color: var(--value-bg-color); \n --range-right-hover-color: var(--hover-bg-color);\n --button-image: \n linear-gradient(\n rgba(255, 255, 255, 1), rgba(0, 0, 0, 0.2)\n );\n\n color: var(--color);\n background-color: var(--bg-color);\n}\n\n@media (prefers-color-scheme: dark) {\n .muigui {\n --bg-color: #222222;\n --color: #dddddd;\n --contrast-color: #000;\n --value-color: #43e5f7;\n --value-bg-color: #444444;\n --disabled-color: #666666;\n --menu-bg-color: #080808;\n --menu-sep-color: #444444;\n --hover-bg-color: #666666;\n --focus-color: #458; /*#88AAFF*/;\n --range-color: #888888;\n --invalid-color: #FF6666;\n --selected-color: rgba(255, 255, 255, 0.3);\n\n --button-bg-color: var(--value-bg-color);\n\n --range-left-color: var(--value-color);\n --range-right-color: var(--value-bg-color); \n --range-right-hover-color: var(--hover-bg-color);\n --button-image: linear-gradient(\n rgba(0, 0, 0, 0.1), rgba(0, 0, 0, 0.4)\n );\n\n color: var(--color);\n background-color: var(--bg-color);\n\n --image-closed: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPgogIDxyZWN0IHN0eWxlPSJmaWxsOiAjREREOyIgeD0iMjAlIiB5PSI0NSUiIHdpZHRoPSI2MCUiIGhlaWdodD0iMTAlIj48L3JlY3Q+Cjwvc3ZnPg==);\n --image-open: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPgogIDxyZWN0IHN0eWxlPSJmaWxsOiAjREREOyIgeD0iNDUlIiB5PSIyMCUiIHdpZHRoPSIxMCUiIGhlaWdodD0iNjAlIj48L3JlY3Q+CiAgPHJlY3Qgc3R5bGU9ImZpbGw6ICNEREQ7IiB4PSIyMCUiIHk9IjQ1JSIgd2lkdGg9IjYwJSIgaGVpZ2h0PSIxMCUiPjwvcmVjdD4KPC9zdmc+);\n }\n}\n\n.muigui {\n --width: 250px;\n --label-width: 45%;\n --number-width: 40%;\n\n --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;\n --font-size: 11px;\n --font-family-mono: Menlo, Monaco, Consolas, "Droid Sans Mono", monospace;\n --font-size-mono: 11px;\n\n --line-height: 1.7em;\n --border-radius: 0px;\n\n width: var(--width);\n font-family: var(--font-family);\n font-size: var(--font-size);\n box-sizing: border-box;\n line-height: 100%;\n}\n.muigui * {\n box-sizing: inherit;\n}\n\n.muigui-no-scroll {\n touch-action: none;\n}\n.muigui-no-h-scroll {\n touch-action: pan-y;\n}\n.muigui-no-v-scroll {\n touch-action: pan-x;\n}\n\n.muigui-invalid-value {\n background-color: red !important;\n color: white !important;\n}\n\n.muigui-grid {\n display: grid;\n}\n.muigui-rows {\n display: flex;\n flex-direction: column;\n\n min-height: 20px;\n border: 2px solid red;\n}\n.muigui-columns {\n display: flex;\n flex-direction: row;\n\n height: 20px;\n border: 2px solid green;\n}\n.muigui-rows>*,\n.muigui-columns>* {\n flex: 1 1 auto;\n align-items: stretch;\n min-height: 0;\n min-width: 0;\n}\n\n.muigui-row {\n border: 2px solid yellow;\n min-height: 10px\n}\n.muigui-column {\n border: 2px solid lightgreen;\n}\n\n/* -------- */\n\n.muigui-show { /* */ }\n.muigui-hide { \n display: none !important;\n}\n.muigui-disabled {\n pointer-events: none;\n --color: var(--disabled-color) !important;\n --value-color: var(--disabled-color) !important;\n --range-left-color: var(--disabled-color) !important;\n}\n\n.muigui canvas,\n.muigui svg {\n display: block;\n border-radius: var(--border-radius);\n}\n.muigui canvas {\n background-color: var(--value-bg-color);\n}\n\n.muigui-controller {\n min-width: 0;\n min-height: var(--line-height);\n}\n.muigui-root {\n z-index: 1;\n}\n.muigui-root,\n.muigui-menu {\n display: flex;\n flex-direction: column;\n position: relative;\n user-select: none;\n height: fit-content;\n margin: 0;\n padding-bottom: 0.1em;\n border-radius: var(--border-radius);\n}\n.muigui-menu {\n border-bottom: 1px solid var(--menu-sep-color);\n}\n\n.muigui-root>button:nth-child(1),\n.muigui-menu>button:nth-child(1) {\n border-top: 1px solid var(--menu-sep-color);\n border-bottom: 1px solid var(--menu-sep-color);\n position: relative;\n text-align: left;\n color: var(--color);\n background-color: var(--menu-bg-color);\n min-height: var(--line-height);\n padding: 0.2em;\n cursor: pointer;\n border-radius: var(--border-radius);\n}\n.muigui-root>div:nth-child(2),\n.muigui-menu>div:nth-child(2) {\n flex: 1 1 auto;\n}\n\n.muigui-controller {\n margin-left: 0.2em;\n margin-right: 0.2em;\n}\n.muigui-root.muigui-controller,\n.muigui-menu.muigui-controller {\n margin-left: 0;\n margin-right: 0;\n}\n.muigui-controller>*:nth-child(1) {\n flex: 1 0 var(--label-width);\n min-width: 0;\n /* white-space: pre; why?? */\n}\n.muigui-controller>label:nth-child(1) {\n place-content: center start;\n display: inline-grid;\n overflow: hidden;\n}\n.muigui-controller>*:nth-child(2) {\n flex: 1 1 75%;\n min-width: 0;\n}\n\n/* -----------------------------------------\n a label controller is [[label][value]]\n*/\n\n.muigui-label-controller {\n display: flex;\n margin: 0.4em 0 0.4em 0;\n word-wrap: initial;\n align-items: stretch;\n}\n\n.muigui-value {\n display: flex;\n align-items: stretch;\n}\n.muigui-value>* {\n flex: 1 1 auto;\n min-width: 0;\n}\n.muigui-value>*:nth-child(1) {\n flex: 1 1 calc(100% - var(--number-width));\n}\n.muigui-value>*:nth-child(2) {\n flex: 1 1 var(--number-width);\n margin-left: 0.2em;\n}\n\n/* fix! */\n.muigui-open>button>label::before,\n.muigui-closed>button>label::before {\n content: "X";\n color: rgba(0, 0, 0, 0);\n background-color: var(--range-color);\n border-radius: 0.2em;\n width: 1.25em;\n margin-right: 0.25em;\n height: 1.25em; /*var(--line-height);*/\n display: inline-grid;\n place-content: center start;\n pointer-events: none;\n}\n.muigui-open>button>label::before {\n background-image: var(--image-open);\n}\n.muigui-closed>button>label::before {\n background-image: var(--image-closed);\n}\n\n.muigui-open>.muigui-open-container {\n transition: all 0.1s ease-out;\n overflow: auto;\n height: 100%;\n}\n.muigui-closed>.muigui-open-container {\n transition: all 0.1s ease-out;\n overflow: hidden;\n min-height: 0;\n}\n.muigui-open>.muigui-open-container>* {\n transition: all 0.1s ease-out;\n margin-top: 0px;\n}\n.muigui-closed>.muigui-open-container>* {\n transition: all 0.1s ease-out;\n margin-top: -100%;\n}\n\n/* ---- popdown ---- */\n\n.muigui-pop-down-top {\n display: flex;\n}\n/* fix? */\n.muigui-value>*:nth-child(1).muigui-pop-down-top {\n flex: 0;\n}\n.muigui-closed .muigui-pop-down-bottom {\n max-height: 0;\n}\n\n.muigui-value .muigui-pop-down-bottom {\n margin: 0;\n}\n\n.muigui-pop-down-values {\n min-width: 0;\n display: flex;\n}\n.muigui-pop-down-values>* {\n flex: 1 1 auto;\n min-width: 0;\n}\n\n.muigui-value.muigui-pop-down-controller {\n flex-direction: column;\n}\n\n.muigui-pop-down-top input[type=checkbox] {\n -webkit-appearance: none;\n appearance: none;\n width: auto;\n color: var(--value-color);\n background-color: var(--value-bg-color);\n background-image: var(--image-checkerboard);\n background-size: 10px 10px;\n background-position: 0 0, 0 5px, 5px -5px, -5px 0px;\n\n cursor: pointer;\n\n display: grid;\n place-content: center;\n margin: 0;\n font: inherit;\n color: currentColor;\n width: 1.7em;\n height: 1.7em;\n transform: translateY(-0.075em);\n}\n\n.muigui-pop-down-top input[type=checkbox]::before {\n content: "+";\n display: grid;\n place-content: center;\n border-radius: calc(var(--border-radius) + 2px);\n border-left: 1px solid rgba(255,255,255,0.3);\n border-top: 1px solid rgba(255,255,255,0.3);\n border-bottom: 1px solid rgba(0,0,0,0.2);\n border-right: 1px solid rgba(0,0,0,0.2);\n background-color: var(--range-color);\n color: var(--value-bg-color);\n width: calc(var(--line-height) - 4px);\n height: calc(var(--line-height) - 4px);\n}\n\n.muigui-pop-down-top input[type=checkbox]:checked::before {\n content: "X";\n}\n\n\n/* ---- select ---- */\n\n.muigui select,\n.muigui option,\n.muigui input,\n.muigui button {\n color: var(--value-color);\n background-color: var(--value-bg-color);\n font-family: var(--font-family);\n font-size: var(--font-size);\n border: none;\n margin: 0;\n border-radius: var(--border-radius);\n}\n.muigui select {\n appearance: none;\n margin: 0;\n margin-left: 0; /*?*/\n overflow: hidden; /* Safari */\n}\n\n.muigui select:focus,\n.muigui input:focus,\n.muigui button:focus {\n outline: 1px solid var(--focus-color);\n}\n\n.muigui select:hover,\n.muigui option:hover,\n.muigui input:hover,\n.muigui button:hover {\n background-color: var(--hover-bg-color); \n}\n\n/* ------ [ label ] ------ */\n\n.muigui-label {\n border-top: 1px solid var(--menu-sep-color);\n border-bottom: 1px solid var(--menu-sep-color);\n padding-top: 0.4em;\n padding-bottom: 0.3em;\n place-content: center start;\n background-color: var(--menu-bg-color);\n white-space: pre;\n border-radius: var(--border-radius);\n}\n\n/* ------ [ divider] ------ */\n\n.muigui-divider {\n min-height: 6px;\n border-top: 2px solid var(--menu-sep-color);\n margin-top: 6px;\n}\n\n/* ------ [ button ] ------ */\n\n.muigui-button {\n display: grid;\n padding: 2px 0 2px 0;\n}\n.muigui-button button {\n border: none;\n color: var(--value-color);\n background-color: var(--button-bg-color);\n background-image: var(--button-image);\n cursor: pointer;\n place-content: center center;\n height: var(--line-height);\n}\n\n/* ------ [ color ] ------ */\n\n.muigui-color>div {\n overflow: hidden;\n position: relative;\n margin-left: 0;\n margin-right: 0; /* why? */\n max-width: var(--line-height);\n border-radius: var(--border-radius);\n}\n\n.muigui-color>div:focus-within {\n outline: 1px solid var(--focus-color);\n}\n\n.muigui-color input[type=color] {\n border: none;\n padding: 0;\n background: inherit;\n cursor: pointer;\n position: absolute;\n width: 200%;\n left: -10px;\n top: -10px;\n height: 200%;\n}\n.muigui-disabled canvas,\n.muigui-disabled svg,\n.muigui-disabled img,\n.muigui-disabled .muigui-color input[type=color] {\n opacity: 0.2;\n}\n\n/* ------ [ checkbox ] ------ */\n\n.muigui-checkbox>label:nth-child(2) {\n display: grid;\n place-content: center start;\n margin: 0;\n}\n\n.muigui-checkbox input[type=checkbox] {\n -webkit-appearance: none;\n appearance: none;\n width: auto;\n color: var(--value-color);\n background-color: var(--value-bg-color);\n cursor: pointer;\n\n display: grid;\n place-content: center;\n margin: 0;\n font: inherit;\n color: currentColor;\n width: 1.7em;\n height: 1.7em;\n transform: translateY(-0.075em);\n}\n\n.muigui-checkbox input[type=checkbox]::before {\n content: "";\n color: var(--value-color);\n display: grid;\n place-content: center;\n}\n\n.muigui-checkbox input[type=checkbox]:checked::before {\n content: "✔";\n}\n\n.muigui input[type=number]::-webkit-inner-spin-button, \n.muigui input[type=number]::-webkit-outer-spin-button { \n -webkit-appearance: none;\n appearance: none;\n margin: 0; \n}\n.muigui input[type=number] {\n -moz-appearance: textfield;\n}\n\n/* ------ [ radio grid ] ------ */\n\n.muigui-radio-grid>div {\n display: grid;\n gap: 2px;\n}\n\n.muigui-radio-grid input {\n appearance: none;\n display: none;\n}\n\n.muigui-radio-grid button {\n color: var(--color);\n width: 100%;\n text-align: left;\n}\n\n.muigui-radio-grid input:checked + button {\n color: var(--value-color);\n background-color: var(--selected-color);\n}\n\n/* ------ [ color-chooser ] ------ */\n\n.muigui-color-chooser-cursor {\n stroke-width: 1px;\n stroke: white;\n fill: none;\n}\n.muigui-color-chooser-circle {\n stroke-width: 1px;\n stroke: white;\n fill: none;\n}\n\n\n/* ------ [ vec2 ] ------ */\n\n.muigui-vec2 svg {\n background-color: var(--value-bg-color);\n}\n\n.muigui-vec2-axis {\n stroke: 1px;\n stroke: var(--focus-color);\n}\n\n.muigui-vec2-line {\n stroke-width: 1px;\n stroke: var(--value-color);\n fill: var(--value-color);\n}\n\n/* ------ [ direction ] ------ */\n\n.muigui-direction svg {\n background-color: rgba(0,0,0,0.2);\n}\n\n.muigui-direction:focus-within svg {\n outline: none;\n}\n.muigui-direction-range {\n fill: var(--value-bg-color);\n}\n.muigui-direction svg:focus {\n outline: none;\n}\n.muigui-direction svg:focus .muigui-direction-range {\n stroke-width: 0.5px;\n stroke: var(--focus-color);\n}\n\n.muigui-direction-arrow {\n fill: var(--value-color);\n}\n\n/* ------ [ slider ] ------ */\n\n.muigui-slider>div {\n display: flex;\n align-items: stretch;\n height: var(--line-height);\n}\n.muigui-slider svg {\n flex: 1 1 auto;\n}\n.muigui-slider .muigui-slider-up #muigui-orientation {\n transform: scale(1, -1) translateY(-100%);\n}\n\n.muigui-slider .muigui-slider-up #muigui-number-orientation {\n transform: scale(1,-1);\n}\n\n.muigui-ticks {\n stroke: var(--range-color);\n}\n.muigui-thicks {\n stroke: var(--color);\n stroke-width: 2px;\n}\n.muigui-svg-text {\n fill: var(--color);\n font-size: 7px;\n}\n.muigui-mark {\n fill: var(--value-color);\n}\n\n/* ------ [ range ] ------ */\n\n\n.muigui-range input[type=range] {\n -webkit-appearance: none;\n appearance: none;\n background-color: transparent;\n}\n\n.muigui-range input[type=range]::-webkit-slider-thumb {\n -webkit-appearance: none;\n appearance: none;\n border-radius: calc(var(--border-radius) + 2px);\n border-left: 1px solid rgba(255,255,255,0.3);\n border-top: 1px solid rgba(255,255,255,0.3);\n border-bottom: 1px solid rgba(0,0,0,0.2);\n border-right: 1px solid rgba(0,0,0,0.2);\n background-color: var(--range-color);\n margin-top: calc((var(--line-height) - 6px) / -2);\n width: calc(var(--line-height) - 6px);\n height: calc(var(--line-height) - 6px);\n}\n\n.muigui-range input[type=range]::-webkit-slider-runnable-track {\n -webkit-appearance: none;\n appearance: none;\n border: 1px solid var(--menu-sep-color);\n height: 2px;\n}\n\n\n/* dat.gui style - doesn\'t work on Safari iOS */\n\n/*\n.muigui-range input[type=range] {\n cursor: ew-resize;\n overflow: hidden;\n}\n\n.muigui-range input[type=range] {\n -webkit-appearance: none;\n appearance: none;\n background-color: var(--range-right-color);\n margin: 0;\n}\n.muigui-range input[type=range]:hover {\n background-color: var(--range-right-hover-color);\n}\n\n.muigui-range input[type=range]::-webkit-slider-runnable-track {\n -webkit-appearance: none;\n appearance: none;\n height: max-content;\n color: var(--range-left-color);\n margin-top: -1px;\n}\n\n.muigui-range input[type=range]::-webkit-slider-thumb {\n -webkit-appearance: none;\n appearance: none;\n width: 0px;\n height: max-content;\n box-shadow: -1000px 0 0 1000px var(--range-left-color);\n}\n*/\n\n/* FF */\n/*\n.muigui-range input[type=range]::-moz-slider-progress {\n background-color: var(--range-left-color); \n}\n.muigui-range input[type=range]::-moz-slider-thumb {\n height: max-content;\n width: 0;\n border: none;\n box-shadow: -1000px 0 0 1000px var(--range-left-color);\n box-sizing: border-box;\n}\n*/\n\n.muigui-checkered-background {\n background-color: #404040;\n background-image:\n linear-gradient(45deg, #808080 25%, transparent 25%),\n linear-gradient(-45deg, #808080 25%, transparent 25%),\n linear-gradient(45deg, transparent 75%, #808080 75%),\n linear-gradient(-45deg, transparent 75%, #808080 75%);\n background-size: 16px 16px;\n background-position: 0 0, 0 8px, 8px -8px, -8px 0px;\n}\n\n/* ---------------------------------------------------------- */\n\n/* needs to be at bottom to take precedence */\n.muigui-auto-place {\n max-height: 100%;\n position: fixed;\n top: 0;\n right: 15px;\n z-index: 100001;\n}\n\n',themes:{default:{include:["default"],css:"\n "},float:{include:["default"],css:"\n :root {\n color-scheme: light dark,\n }\n\n .muigui {\n --width: 400px;\n --bg-color: initial;\n --label-width: 25%;\n --number-width: 20%;\n }\n\n input,\n .muigui-label-controller>label {\n text-shadow:\n -1px -1px 0 var(--contrast-color),\n 1px -1px 0 var(--contrast-color),\n -1px 1px 0 var(--contrast-color),\n 1px 1px 0 var(--contrast-color);\n }\n\n .muigui-controller > label:nth-child(1) {\n place-content: center end;\n margin-right: 1em;\n }\n\n .muigui-value > :nth-child(2) {\n margin-left: 1em;\n }\n\n .muigui-root>*:nth-child(1) {\n display: none;\n }\n\n .muigui-range input[type=range]::-webkit-slider-thumb {\n border-radius: 1em;\n }\n\n .muigui-range input[type=range]::-webkit-slider-runnable-track {\n -webkit-appearance: initial;\n appearance: none;\n border: 1px solid rgba(0, 0, 0, 0.25);\n height: 2px;\n }\n\n .muigui-colors {\n --value-color: var(--color );\n --value-bg-color: rgba(0, 0, 0, 0.1);\n --disabled-color: #cccccc;\n --menu-bg-color: rgba(0, 0, 0, 0.1);\n --menu-sep-color: #bbbbbb;\n --hover-bg-color: rgba(0, 0, 0, 0);\n --invalid-color: #FF0000;\n --selected-color: rgba(0, 0, 0, 0.3);\n --range-color: rgba(0, 0, 0, 0.125);\n }\n"},form:{include:[],css:"\n .muigui {\n --width: 100%;\n --label-width: 45%;\n --number-width: 40%;\n }\n .muigui-root>button {\n display: none;\n }\n .muigui-controller {\n margin-top: 1em;\n }\n .muigui-label-controller {\n display: flex;\n flex-direction: column;\n align-items: stretch;\n margin-top: 1em;\n }\n .muigui-label-controller:has(.muigui-checkbox) {\n flex-direction: row;\n }\n .muigui-value {\n display: flex;\n align-items: stretch;\n }\n .muigui-value>* {\n flex: 1 1 auto;\n min-width: 0;\n }\n .muigui-controller>*:nth-child(1) {\n flex: 1 0 var(--label-width);\n min-width: 0;\n white-space: pre;\n }\n .muigui-controller>label:nth-child(1) {\n place-content: center start;\n display: inline-grid;\n overflow: hidden;\n }\n .muigui-controller>*:nth-child(2) {\n flex: 1 1 75%;\n min-width: 0;\n }\n "},none:{include:[],css:""}}};function e(t,e={},n=[]){const i=document.createElement(t);return function(t,e,n){for(const[n,i]of Object.entries(e))if("function"==typeof i&&n.startsWith("on")){const e=n.substring(2).toLowerCase();t.addEventListener(e,i,{passive:!1})}else if("object"==typeof i)for(const[e,o]of Object.entries(i))t[n][e]=o;else void 0===t[n]?t.setAttribute(n,i):t[n]=i;for(const e of n)t.appendChild(e)}(i,e,n),i}let n=0;function i(t,e){const n=t.indexOf(e);return n&&t.splice(n,1),t}function o(t,e,n){return Math.max(e,Math.min(n,t))}const r="undefined"!=typeof SharedArrayBuffer?function(t){return t&&t.buffer&&(t.buffer instanceof ArrayBuffer||t.buffer instanceof SharedArrayBuffer)}:function(t){return t&&t.buffer&&t.buffer instanceof ArrayBuffer},s=(t,e,n)=>Math.round(e(t)/n)/(1/n),a=(t,e)=>(t%e+e)%e;function l(t,e){for(const n in e)n in t&&(t[n]=e[n]);return t}const u=(t,e,n,i,o)=>(t-e)*(o-i)/(n-e)+i,c=({from:t,to:e})=>({to:n=>u(n,...t,...e),from:n=>[!0,u(n,...e,...t)]}),h=({from:t,to:e,step:n})=>({min:e[0],max:e[1],...n&&{step:n},converters:c({from:t,to:e})}),d={to:t=>t,from:t=>[!0,t]};function m(t,e,n,i,o){const{converters:{from:r}=d}=o,{min:s,max:a}=o,l=o.minRange||0,u=r(l)[1],c=t.add(e,n,{...o,min:s,max:a-l}).onChange((t=>{h.setValue(Math.min(a,Math.max(t+u,e[i])))})),h=t.add(e,i,{...o,min:s+l,max:a}).onChange((t=>{c.setValue(Math.max(s,Math.min(t-u,e[n])))}));return[c,h]}class p{domElement;#t;#e=[];constructor(t){this.domElement=t,this.#t=t}addElem(t){return this.#t.appendChild(t),t}removeElem(t){return this.#t.removeChild(t),t}pushSubElem(t){this.#t.appendChild(t),this.#t=t}popSubElem(){this.#t=this.#t.parentElement}add(t){return this.#e.push(t),this.addElem(t.domElement),t}remove(t){return this.removeElem(t.domElement),i(this.#e,t),t}pushSubView(t){this.pushSubElem(t.domElement)}popSubView(){this.popSubElem()}setOptions(t){for(const e of this.#e)e.setOptions(t)}updateDisplayIfNeeded(t,e){for(const n of this.#e)n.updateDisplayIfNeeded(t,e);return this}$(t){return this.domElement.querySelector(t)}}class g extends p{#n;#i;#o;constructor(t){super(e("div",{className:"muigui-controller"})),this.#n=[],this.#i=[],t&&this.domElement.classList.add(t)}get parent(){return this.#o}setParent(t){this.#o=t,this.enable(!this.disabled())}show(t=!0){return this.domElement.classList.toggle("muigui-hide",!t),this.domElement.classList.toggle("muigui-show",t),this}hide(){return this.show(!1)}disabled(){return!!this.domElement.closest(".muigui-disabled")}enable(t=!0){return this.domElement.classList.toggle("muigui-disabled",!t),["input","button","select","textarea"].forEach((t=>{this.domElement.querySelectorAll(t).forEach((t=>{const e=!!t.closest(".muigui-disabled");t.disabled=e}))})),this}disable(t=!0){return this.enable(!t)}onChange(t){return this.removeChange(t),this.#n.push(t),this}removeChange(t){return i(this.#n,t),this}onFinishChange(t){return this.removeFinishChange(t),this.#i.push(t),this}removeFinishChange(t){return i(this.#i,t),this}#r(t,e){for(const n of t)n.call(this,e)}emitChange(t,e,n){this.#r(this.#n,t),this.#o&&(void 0===e?this.#o.emitChange(t):this.#o.emitChange({object:e,property:n,value:t,controller:this}))}emitFinalChange(t,e,n){this.#r(this.#i,t),this.#o&&(void 0===e?this.#o.emitChange(t):this.#o.emitFinalChange({object:e,property:n,value:t,controller:this}))}updateDisplay(){}getColors(){const t=t=>t.replace(/-([a-z])/g,((t,e)=>e.toUpperCase())),n=e("div");this.domElement.appendChild(n);const i=Object.fromEntries(["color","bg-color","value-color","value-bg-color","hover-bg-color","menu-bg-color","menu-sep-color","disabled-color"].map((e=>{n.style.color=`var(--${e})`;const i=getComputedStyle(n);return[t(e),i.color]})));return n.remove(),i}}class b extends g{#s;#a;#l;#u={name:""};constructor(t,n,i={}){super("muigui-button",""),this.#s=t,this.#a=n,this.#l=this.addElem(e("button",{type:"button",onClick:()=>{this.#s[this.#a](this)}})),this.setOptions({name:n,...i})}name(t){this.#l.textContent=t}setOptions(t){l(this.#u,t);const{name:e}=this.#u;this.#l.textContent=e}}function f(t,e){if(t.length!==e.length)return!1;for(let n=0;n{t.setValue(i.checked)},onChange:()=>{t.setFinalValue(i.checked)}});super(e("label",{},[i])),this.#f=i}updateDisplay(t){this.#f.checked=t}}const w=[],y=new Set;let k,E;function I(){k=void 0,E=!0;for(const t of w)y.has(t)||t();E=!1,y.size&&(E?$():(y.forEach((t=>{i(w,t)})),y.clear())),$()}function $(){!k&&w.length&&(k=requestAnimationFrame(I))}let C=0;function M(){return"muigui-"+ ++C}class S extends p{constructor(t=""){super(e("div",{className:"muigui-value"})),t&&this.domElement.classList.add(t)}}class V extends g{#v;#x;constructor(t="",n=""){super("muigui-label-controller"),this.#v=M(),this.#x=e("label",{for:this.#v}),this.domElement.appendChild(this.#x),this.pushSubView(new S(t)),this.name(n)}get id(){return this.#v}name(t){return this.#x.title===this.#x.textContent&&(this.#x.title=t),this.#x.textContent=t,this}tooltip(t){this.#x.title=t}}class D extends V{#s;#a;#w;#y;#e;#k;constructor(t,e,n=""){super(n,e),this.#s=t,this.#a=e,this.#w=this.getValue(),this.#y=!1,this.#e=[]}get initialValue(){return this.#w}get object(){return this.#s}get property(){return this.#a}add(t){return this.#e.push(t),super.add(t),this.updateDisplay(),t}#E(t,e){let n=!1;if("object"==typeof t){const e=this.#s[this.#a];if(Array.isArray(t)||r(t))for(let i=0;i=0&&w.splice(e,1)}(this.#k)),this}}class N extends D{constructor(t,e){super(t,e,"muigui-checkbox");const n=this.id;this.add(new x(this,n)),this.updateDisplay()}}const A={to:t=>t,from:t=>[!0,t]},j={to:t=>t.toString(),from:t=>{const e=parseFloat(t);return[!Number.isNaN(e),e]}},U={radToDeg:c({to:[0,180],from:[0,Math.PI]})};function L(){let t=0;return function(e,n,i=5){t-=e.deltaY*n/i;const o=Math.floor(Math.abs(t)/n)*Math.sign(t)*n;return t-=o,o}}class F extends v{#I;#$;#C;#M;#u={step:.01,converters:j,min:Number.NEGATIVE_INFINITY,max:Number.POSITIVE_INFINITY};constructor(t,n){const i=t.setValue.bind(t),r=t.setFinalValue.bind(t),a=L();super(e("input",{type:"number",onInput:()=>{this.#S(i,!0)},onChange:()=>{this.#S(r,!1)},onWheel:e=>{e.preventDefault();const{min:n,max:i,step:r}=this.#u,l=a(e,r),u=parseFloat(this.domElement.value),c=o(s(u+l,(t=>t),r),n,i),[h,d]=this.#$(c);h&&t.setValue(d)}})),this.setOptions(n)}#S(t,e){const n=parseFloat(this.domElement.value),[i,r]=this.#$(n);let s;if(i&&!Number.isNaN(n)){const{min:n,max:i}=this.#u;s=r>=n&&r<=i,this.#M=e,t(o(r,n,i))}this.domElement.classList.toggle("muigui-invalid-value",!i||!s)}updateDisplay(t){this.#M||(this.domElement.value=s(t,this.#I,this.#C)),this.#M=!1}setOptions(t){l(this.#u,t);const{step:e,converters:{to:n,from:i}}=this.#u;return this.#I=n,this.#$=i,this.#C=e,this}}class P extends D{#V;#C;constructor(t,e,n={}){super(t,e,"muigui-text-number"),this.#V=this.add(new F(this,n)),this.updateDisplay()}}class O extends v{#D;constructor(t,n){const i=[];super(e("select",{onChange:()=>{t.setFinalValue(this.#D[this.domElement.selectedIndex])}},n.map((([t,n])=>(i.push(n),e("option",{textContent:t})))))),this.#D=i}updateDisplay(t){const e=this.#D.indexOf(t);this.domElement.selectedIndex=e}}function H(t,e){return Array.isArray(t)?Array.isArray(t[0])?t:e?t.map(((t,e)=>[t,e])):t.map((t=>[t,t])):[...Object.entries(t)]}class z extends D{constructor(t,e,n){super(t,e,"muigui-select");const i="number"==typeof this.getValue(),{keyValues:o}=n,r=H(o,i);this.add(new O(this,r)),this.updateDisplay()}}class T extends v{#I;#$;#C;#M;#u={step:.01,min:0,max:1,converters:A};constructor(t,n){const i=L();super(e("input",{type:"range",onInput:()=>{this.#M=!0;const{min:e,max:n,step:i}=this.#u,r=parseFloat(this.domElement.value),a=o(s(r,(t=>t),i),e,n),[l,u]=this.#$(a);l&&t.setValue(u)},onChange:()=>{this.#M=!0;const{min:e,max:n,step:i}=this.#u,r=parseFloat(this.domElement.value),a=o(s(r,(t=>t),i),e,n),[l,u]=this.#$(a);l&&t.setFinalValue(u)},onWheel:e=>{e.preventDefault();const[n,r]=this.#$(parseFloat(this.domElement.value));if(!n)return;const{min:a,max:l,step:u}=this.#u,c=i(e,u),h=o(s(r+c,(t=>t),u),a,l);t.setValue(h)}})),this.setOptions(n)}updateDisplay(t){this.#M||(this.domElement.value=s(t,this.#I,this.#C)),this.#M=!1}setOptions(t){l(this.#u,t);const{step:e,min:n,max:i,converters:{to:o,from:r}}=this.#u;return this.#I=o,this.#$=r,this.#C=e,this.domElement.step=e,this.domElement.min=n,this.domElement.max=i,this}}class W extends D{constructor(t,e,n){super(t,e,"muigui-range"),this.add(new T(this,n)),this.add(new F(this,n))}}class B extends v{#I;#$;#M;#u={converters:A};constructor(t,n){const i=t.setValue.bind(t),o=t.setFinalValue.bind(t);super(e("input",{type:"text",onInput:()=>{this.#S(i,!0)},onChange:()=>{this.#S(o,!1)}})),this.setOptions(n)}#S(t,e){const[n,i]=this.#$(this.domElement.value);n&&(this.#M=e,t(i)),this.domElement.style.color=n?"":"var(--invalid-color)"}updateDisplay(t){this.#M||(this.domElement.value=this.#I(t),this.domElement.style.color=""),this.#M=!1}setOptions(t){l(this.#u,t);const{converters:{to:e,from:n}}=this.#u;return this.#I=e,this.#$=n,this}}class G extends D{constructor(t,e){super(t,e,"muigui-text"),this.add(new B(this)),this.updateDisplay()}}const R=(t,e,n)=>Math.max(e,Math.min(n,t)),Z=(t,e,n)=>t+(e-t)*n,J=t=>t>=0?t%1:1-t%1,Y=t=>+t.toFixed(0),Q=t=>+t.toFixed(3),K=t=>parseInt(t.substring(1,3),16)<<16|parseInt(t.substring(3,5),16)<<8|parseInt(t.substring(5,7),16),_=t=>parseInt(t.substring(1,3),16)*2**24+65536*parseInt(t.substring(3,5),16)+256*parseInt(t.substring(5,7),16)+parseInt(t.substring(7,9),16),q=t=>[parseInt(t.substring(1,3),16),parseInt(t.substring(3,5),16),parseInt(t.substring(5,7),16)],X=t=>`#${Array.from(t).map((t=>t.toString(16).padStart(2,"0"))).join("")}`,tt=t=>[parseInt(t.substring(1,3),16),parseInt(t.substring(3,5),16),parseInt(t.substring(5,7),16),parseInt(t.substring(7,9),16)],et=t=>`#${Array.from(t).map((t=>t.toString(16).padStart(2,"0"))).join("")}`,nt=t=>q(t).map((t=>Q(t/255))),it=t=>X(Array.from(t).map((t=>Math.round(R(255*t,0,255))))),ot=t=>tt(t).map((t=>Q(t/255))),rt=t=>et(Array.from(t).map((t=>Math.round(R(255*t,0,255))))),st=t=>R(Math.round(255*t),0,255).toString(16).padStart(2,"0"),at=t=>({r:parseInt(t.substring(1,3),16)/255,g:parseInt(t.substring(3,5),16)/255,b:parseInt(t.substring(5,7),16)/255}),lt=t=>({r:parseInt(t.substring(1,3),16)/255,g:parseInt(t.substring(3,5),16)/255,b:parseInt(t.substring(5,7),16)/255,a:parseInt(t.substring(7,9),16)/255}),ut=t=>`rgb(${q(t).join(", ")})`,ct=/^\s*rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)\s*$/,ht=t=>`rgba(${tt(t).map(((t,e)=>3===e?t/255:t)).join(", ")})`,dt=/^\s*rgba\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+\.\d+|\d+)\s*\)\s*$/,mt=t=>{const e=yt(q(t)).map((t=>Y(t)));return`hsl(${e[0]}, ${e[1]}%, ${e[2]}%)`},pt=t=>{const e=kt(tt(t)).map(((t,e)=>3===e?Q(t):Y(t)));return`hsl(${e[0]} ${e[1]}% ${e[2]}% / ${e[3]})`},gt=/^\s*hsl\(\s*(\d+)(?:deg|)\s*(?:,|)\s*(\d+)%\s*(?:,|)\s*(\d+)%\s*\)\s*$/,bt=/^\s*hsl\(\s*(\d+)(?:deg|)\s*(?:,|)\s*(\d+)%\s*(?:,|)\s*(\d+)%\s*\/\s*(\d+\.\d+|\d+)\s*\)\s*$/,ft=(t,e)=>(t%e+e)%e;function vt([t,e,n]){t=ft(t,360),e=R(e/100,0,1),n=R(n/100,0,1);const i=e*Math.min(n,1-n);function o(e){const o=(e+t/30)%12;return n-i*Math.max(-1,Math.min(o-3,9-o,1))}return[o(0),o(8),o(4)].map((t=>Math.round(255*t)))}function xt([t,e,n]){const i=Math.max(t,e,n),o=Math.min(t,e,n),r=.5*(o+i),s=i-o;let a=0,l=0;if(0!==s)switch(l=0===r||1===r?0:(i-r)/Math.min(r,1-r),i){case t:a=(e-n)/s+(e{const[e,n,i]=xt(t.map((t=>t/255)));return[360*e,100*n,100*i]},kt=t=>{const[e,n,i,o]=wt(t.map((t=>t/255)));return[360*e,100*n,100*i,o]};function Et([t,e,n]){return e=R(e,0,1),n=R(n,0,1),[t,t+2/3,t+1/3].map((t=>Z(1,R(Math.abs(6*J(t)-3)-1,0,1),e)*n))}function It([t,e,n,i]){return[...Et([t,e,n]),i]}const $t=t=>Math.round(1e3*t)/1e3;function Ct([t,e,n]){const i=n>e?[n,e,-1,2/3]:[e,n,0,-1/3],o=i[0]>t?[i[0],i[1],i[3],t]:[t,i[1],i[2],i[0]],r=o[0]-Math.min(o[3],o[1]);return[Math.abs(o[2]+(o[3]-o[1])/(6*r+Number.EPSILON)),r/(o[0]+Number.EPSILON),o[0]].map($t)}function Mt([t,e,n,i]){return[...Ct([t,e,n]),i]}const St=t=>t.endsWith("a")||t.startsWith("hex8"),Vt=[{re:/^#(?:[0-9a-f]){6}$/i,format:"hex6"},{re:/^(?:[0-9a-f]){6}$/i,format:"hex6-no-hash"},{re:/^#(?:[0-9a-f]){8}$/i,format:"hex8"},{re:/^(?:[0-9a-f]){8}$/i,format:"hex8-no-hash"},{re:/^#(?:[0-9a-f]){3}$/i,format:"hex3"},{re:/^(?:[0-9a-f]){3}$/i,format:"hex3-no-hash"},{re:ct,format:"css-rgb"},{re:gt,format:"css-hsl"},{re:dt,format:"css-rgba"},{re:bt,format:"css-hsla"}];function Dt(t){switch(typeof t){case"number":return console.warn('can not reliably guess format based on a number. You should pass in a format like {format: "uint32-rgb"} or {format: "uint32-rgb"}'),t<=16777215?"uint32-rgb":"uint32-rgba";case"string":{const e=function(t){for(const e of Vt)if(e.re.test(t))return e}(t.trim());if(e)return e.format;break}case"object":if(t instanceof Uint8Array||t instanceof Uint8ClampedArray){if(3===t.length)return"uint8-rgb";if(4===t.length)return"uint8-rgba"}else if(t instanceof Float32Array){if(3===t.length)return"float-rgb";if(4===t.length)return"float-rgba"}else if(Array.isArray(t)){if(3===t.length)return"float-rgb";if(4===t.length)return"float-rgba"}else if("r"in t&&"g"in t&&"b"in t)return"a"in t?"object-rgba":"object-rgb"}throw new Error(`unknown color format: ${t}`)}function Nt(t){return t.trim(t)}function At(t){return t.trim(t)}function jt(t){return t[1]===t[2]&&t[3]===t[4]&&t[5]===t[6]?`#${t[1]}${t[3]}${t[5]}`:t}const Ut=/^(#|)([0-9a-f]{3})$/i;function Lt(t){const e=Ut.exec(t);if(e){const[,,t]=e;return"#"+`${(n=t)[0]}${n[0]}${n[1]}${n[1]}${n[2]}${n[2]}`}var n;return t}function Ft(t){return jt(Nt(t))}const Pt=t=>{const e=ct.exec(t);if(!e)return[!1];const n=[e[1],e[2],e[3]].map((t=>parseInt(t)));return[!n.find((t=>t>255)),`rgb(${n.join(", ")})`]},Ot=t=>{const e=dt.exec(t);if(!e)return[!1];const n=[e[1],e[2],e[3],e[4]].map(((t,e)=>3===e?parseFloat(t):parseInt(t)));return[!n.find((t=>t>255)),`rgba(${n.join(", ")})`]},Ht=t=>{const e=gt.exec(t);if(!e)return[!1];const n=[e[1],e[2],e[3]].map((t=>parseFloat(t)));return[!n.find((t=>Number.isNaN(t))),`hsl(${n[0]}, ${n[1]}%, ${n[2]}%)`]},zt=t=>{const e=bt.exec(t);if(!e)return[!1];const n=[e[1],e[2],e[3],e[4]].map((t=>parseFloat(t)));return[!n.find((t=>Number.isNaN(t))),`hsl(${n[0]} ${n[1]}% ${n[2]}% / ${n[3]})`]},Tt=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*$/,Wt=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*$/,Bt=t=>{const e=t.split(",").map((t=>t.trim())),n=e.map((t=>parseFloat(t)));if(3!==n.length)return[!1];const i=e.findIndex((t=>isNaN(t)));return[i<0,n.map((t=>Q(t)))]},Gt=t=>{const e=t.split(",").map((t=>t.trim())),n=e.map((t=>parseFloat(t)));if(4!==n.length)return[!1];const i=e.findIndex((t=>isNaN(t)));return[i<0,n.map((t=>Q(t)))]},Rt=/^\s*(?:0x){0,1}([0-9a-z]{1,6})\s*$/i,Zt=/^\s*(?:0x){0,1}([0-9a-z]{1,8})\s*$/i,Jt=/^\s*#[a-f0-9]{6}\s*$|^\s*#[a-f0-9]{3}\s*$/i,Yt=/^\s*[a-f0-9]{6}\s*$/i,Qt=/^\s*#[a-f0-9]{8}\s*$/i,Kt=/^\s*[a-f0-9]{8}\s*$/i,_t={hex6:{color:{from:t=>[!0,t],to:Nt},text:{from:t=>[Jt.test(t),t.trim()],to:t=>t}},hex8:{color:{from:t=>[!0,t],to:At},text:{from:t=>[Qt.test(t),t.trim()],to:t=>t}},hex3:{color:{from:t=>[!0,Ft(t)],to:Lt},text:{from:t=>[Jt.test(t),jt(t.trim())],to:t=>t}},"hex6-no-hash":{color:{from:t=>[!0,t.substring(1)],to:t=>`#${Nt(t)}`},text:{from:t=>[Yt.test(t),t.trim()],to:t=>t}},"hex8-no-hash":{color:{from:t=>[!0,t.substring(1)],to:t=>`#${At(t)}`},text:{from:t=>[Kt.test(t),t.trim()],to:t=>t}},"hex3-no-hash":{color:{from:t=>[!0,Ft(t).substring(1)],to:Lt},text:{from:t=>[Yt.test(t),jt(t.trim())],to:t=>t}},"uint32-rgb":{color:{from:t=>[!0,K(t)],to:t=>`#${Math.round(t).toString(16).padStart(6,"0")}`},text:{from:t=>(t=>{const e=Rt.exec(t);return e?[!0,parseInt(e[1],16)]:[!1]})(t),to:t=>`0x${t.toString(16).padStart(6,"0")}`}},"uint32-rgba":{color:{from:t=>[!0,_(t)],to:t=>`#${Math.round(t).toString(16).padStart(8,"0")}`},text:{from:t=>(t=>{const e=Zt.exec(t);return e?[!0,parseInt(e[1],16)]:[!1]})(t),to:t=>`0x${t.toString(16).padStart(8,"0")}`}},"uint8-rgb":{color:{from:t=>[!0,q(t)],to:X},text:{from:t=>{const e=Tt.exec(t);if(!e)return[!1];const n=[e[1],e[2],e[3]].map((t=>parseInt(t)));return[!n.find((t=>t>255)),n]},to:t=>t.join(", ")}},"uint8-rgba":{color:{from:t=>[!0,tt(t)],to:et},text:{from:t=>{const e=Wt.exec(t);if(!e)return[!1];const n=[e[1],e[2],e[3],e[4]].map((t=>parseInt(t)));return[!n.find((t=>t>255)),n]},to:t=>t.join(", ")}},"float-rgb":{color:{from:t=>[!0,nt(t)],to:it},text:{from:Bt,to:t=>Array.from(t).map((t=>Q(t))).join(", ")}},"float-rgba":{color:{from:t=>[!0,ot(t)],to:rt},text:{from:Gt,to:t=>Array.from(t).map((t=>Q(t))).join(", ")}},"float-hsv":{color:{from:t=>[!0,Ct(nt(t))],to:t=>Et(it(t))},text:{from:Bt,to:t=>Array.from(t).map((t=>Q(t))).join(", ")}},"float-hsva":{color:{from:t=>[!0,Mt(nt(t))],to:t=>It(it(t))},text:{from:Gt,to:t=>Array.from(t).map((t=>Q(t))).join(", ")}},"object-rgb":{color:{from:t=>[!0,at(t)],to:t=>`#${st(t.r)}${st(t.g)}${st(t.b)}`},text:{from:t=>{try{const e=t.replace(/([a-z])/g,'"$1"'),n=JSON.parse(e);if(Number.isNaN(n.r)||Number.isNaN(n.g)||Number.isNaN(n.b))throw new Error("not {r, g, b}");return[!0,n]}catch(t){return[!1]}},to:t=>`{r:${Q(t.r)}, g:${Q(t.g)}, b:${Q(t.b)}}`}},"object-rgba":{color:{from:t=>[!0,lt(t)],to:t=>`#${st(t.r)}${st(t.g)}${st(t.b)}${st(t.a)}`},text:{from:t=>{try{const e=t.replace(/([a-z])/g,'"$1"'),n=JSON.parse(e);if(Number.isNaN(n.r)||Number.isNaN(n.g)||Number.isNaN(n.b)||Number.isNaN(n.a))throw new Error("not {r, g, b, a}");return[!0,n]}catch(t){return[!1]}},to:t=>`{r:${Q(t.r)}, g:${Q(t.g)}, b:${Q(t.b)}}, a:${Q(t.a)}}`}},"css-rgb":{color:{from:t=>[!0,ut(t)],to:t=>{const e=ct.exec(t);return X([e[1],e[2],e[3]].map((t=>parseInt(t))))}},text:{from:Pt,to:t=>Pt(t)[1]}},"css-rgba":{color:{from:t=>[!0,ht(t)],to:t=>{const e=dt.exec(t);return et([e[1],e[2],e[3],e[4]].map(((t,e)=>3===e?255*parseFloat(t)|0:parseInt(t))))}},text:{from:Ot,to:t=>Ot(t)[1]}},"css-hsl":{color:{from:t=>[!0,mt(t)],to:t=>{const e=gt.exec(t),n=vt([e[1],e[2],e[3]].map((t=>parseFloat(t))));return X(n)}},text:{from:Ht,to:t=>Ht(t)[1]}},"css-hsla":{color:{from:t=>[!0,pt(t)],to:t=>{const e=bt.exec(t),n=function([t,e,n,i]){return[...vt([t,e,n]),255*i|0]}([e[1],e[2],e[3],e[4]].map((t=>parseFloat(t))));return et(n)}},text:{from:zt,to:t=>zt(t)[1]}}};class qt extends p{constructor(t,n){super(e(t,{className:n}))}}class Xt extends V{#N;constructor(t){super("muigui-canvas",t),this.#N=this.add(new qt("canvas","muigui-canvas")).domElement}get canvas(){return this.#N}}class te extends v{#I;#$;#A;#M;#u={converters:A};constructor(t,n){const i=e("input",{type:"color",onInput:()=>{const[e,n]=this.#$(i.value);e&&(this.#M=!0,t.setValue(n))},onChange:()=>{const[e,n]=this.#$(i.value);e&&(this.#M=!0,t.setFinalValue(n))}});super(e("div",{},[i])),this.setOptions(n),this.#A=i}updateDisplay(t){this.#M||(this.#A.value=this.#I(t)),this.#M=!1}setOptions(t){l(this.#u,t);const{converters:{to:e,from:n}}=this.#u;return this.#I=e,this.#$=n,this}}class ee extends D{#j;#V;constructor(t,e,n={}){super(t,e,"muigui-color");const i=n.format||Dt(this.getValue()),{color:o,text:r}=_t[i];this.#j=this.add(new te(this,{converters:o})),this.#V=this.add(new B(this,{converters:r})),this.updateDisplay()}setOptions(t){const{format:e}=t;if(e){const{color:t,text:n}=_t[e];this.#j.setOptions({converters:t}),this.#V.setOptions({converters:n})}return super.setOptions(t),this}}class ne extends g{constructor(){super("muigui-divider")}}class ie extends g{#U;#L;constructor(t){super(t),this.#U=[],this.#L=this}get children(){return this.#U}get controllers(){return this.#U.filter((t=>!(t instanceof ie)))}get folders(){return this.#U.filter((t=>t instanceof ie))}reset(t=!0){for(const e of this.#U)e instanceof ie&&!t||e.reset(t);return this}updateDisplay(){for(const t of this.#U)t.updateDisplay();return this}remove(t){const e=this.#U.indexOf(t);if(e>=0){const t=this.#U.splice(e,1)[0];t.domElement.remove(),t.setParent(null)}return this}#F(t){return this.domElement.appendChild(t.domElement),this.#U.push(t),t.setParent(this),t}addController(t){return this.#L.#F(t)}pushContainer(t){return this.addController(t),this.#L=t,t}popContainer(){return this.#L=this.#L.parent,this}}class oe extends ie{#P;constructor(t="Controls",n="muigui-menu"){super(n),this.#P=e("label"),this.addElem(e("button",{type:"button",onClick:()=>this.toggleOpen()},[this.#P])),this.pushContainer(new ie("muigui-open-container")),this.pushContainer(new ie),this.name(t),this.open()}open(t=!0){return this.domElement.classList.toggle("muigui-closed",!t),this.domElement.classList.toggle("muigui-open",t),this}close(){return this.open(!1)}name(t){return this.#P.textContent=t,this}title(t){return this.name(t)}toggleOpen(){return this.open(!this.domElement.classList.contains("muigui-open")),this}}class re extends g{constructor(t){super("muigui-label"),this.text(t)}text(t){return this.domElement.textContent=t,this}}function se(){}function ae(t,e,n){const i=t.getBoundingClientRect(),o=e.clientX-i.left,r=e.clientY-i.top,s=o/i.width,a=r/i.height,l=o-(n=n||[o,r])[0],u=r-n[1];return{x:o,y:r,nx:s,ny:a,dx:l,dy:u,ndx:l/i.width,ndy:u/i.width}}function le(t,{onDown:e=se,onMove:n=se,onUp:i=se}){let o;const r=function(e){const i={type:"move",...ae(t,e,o)};n(i)},s=function(e){t.releasePointerCapture(e.pointerId),t.removeEventListener("pointermove",r),t.removeEventListener("pointerup",s),document.body.style.backgroundColor="",i("up")},a=function(n){t.addEventListener("pointermove",r),t.addEventListener("pointerup",s),t.setPointerCapture(n.pointerId);const i=ae(t,n);o=[i.x,i.y],e({type:"down",...i})};return t.addEventListener("pointerdown",a),function(){t.removeEventListener("pointerdown",a)}}function ue(t){return t.querySelectorAll("[data-src]").forEach((e=>{const i="muigui-id-"+n++;e.id=i,t.querySelectorAll(`[data-target=${e.dataset.src}]`).forEach((t=>{t.setAttribute("fill",`url(#${i})`)}))})),t}class ce extends v{#I;#$;#O;#H;#z;#T;#W;#B;#G;#R;#Z;#J;#Y;#Q;#u={converters:A,alpha:!1};#K;#_;constructor(t,n){super(e("div",{innerHTML:'\n\n\n\n',className:"muigui-no-scroll"})),this.#O=this.domElement.children[0],this.#z=this.domElement.children[1],this.#B=this.domElement.children[2],ue(this.#O),ue(this.#z),ue(this.#B),this.#H=this.$(".muigui-color-chooser-circle"),this.#T=this.$("[data-src=muigui-color-chooser-hue]"),this.#W=this.$(".muigui-color-chooser-hue-cursor"),this.#G=this.$("[data-src=muigui-color-chooser-alpha]"),this.#R=this.$(".muigui-color-chooser-alpha-cursor");const i=e=>{const n=o(e.nx,0,1),i=o(e.ny,0,1);this.#Z[1]=n,this.#Z[2]=1-i,this.#J=!0,this.#Q=!0;const[r,s]=this.#$(this.#K(this.#Z));r&&t.setValue(s)},r=e=>{const n=o(e.nx,0,1);this.#Z[0]=n,this.#Y=!0,this.#Q=!0;const[i,r]=this.#$(this.#K(this.#Z));i&&t.setValue(r)},s=e=>{const n=o(e.nx,0,1);this.#Z[3]=n,this.#J=!0,this.#Y=!0;const[i,r]=this.#$(this.#K(this.#Z));i&&t.setValue(r)};le(this.#O,{onDown:i,onMove:i}),le(this.#z,{onDown:r,onMove:r}),le(this.#B,{onDown:s,onMove:s}),this.setOptions(n)}updateDisplay(t){this.#Z||(this.#Z=this.#_(this.#I(t)));{const[e,n,i,o=1]=this.#_(this.#I(t));this.#J||(this.#Z[0]=n>.001&&i>.001?e:this.#Z[0]),this.#Y||(this.#Z[1]=n,this.#Z[2]=i),this.#Q||(this.#Z[3]=o)}{const[t,e,n,i]=this.#Z,[o,r,s]=wt(It(this.#Z));this.#J||this.#W.setAttribute("transform",`translate(${64*t}, 0)`),this.#T.children[0].setAttribute("stop-color",`hsl(${360*o} 0% 100% / ${i})`),this.#T.children[1].setAttribute("stop-color",`hsl(${360*o} 100% 50% / ${i})`),this.#Q||this.#R.setAttribute("transform",`translate(${64*i}, 0)`),this.#G.children[0].setAttribute("stop-color",`hsl(${360*o} ${100*r}% ${100*s}% / 0)`),this.#G.children[1].setAttribute("stop-color",`hsl(${360*o} ${100*r}% ${100*s}% / 1)`),this.#Y||(this.#H.setAttribute("cx",""+64*e),this.#H.setAttribute("cy",""+48*(1-n)))}this.#J=!1,this.#Y=!1,this.#Q=!1}setOptions(t){l(this.#u,t);const{converters:{to:e,from:n},alpha:i}=this.#u;return this.#B.style.display=i?"":"none",this.#K=i?t=>rt(It(t)):t=>it(Et(t)),this.#_=i?t=>Mt(ot(t)):t=>Ct(nt(t)),this.#I=e,this.#$=n,this}}class he extends D{#q;#X;#f;#tt;#u={open:!1};constructor(t,n,i={}){super(t,n,"muigui-pop-down-controller"),this.#q=this.add(new qt("div","muigui-pop-down-top"));const o=this.#q.addElem(e("input",{type:"checkbox",onChange:()=>{this.#u.open=o.checked,this.updateDisplay()}}));this.#f=o,this.#X=this.#q.add(new qt("div","muigui-pop-down-values"));const r=new qt("div","muigui-pop-down-bottom muigui-open-container");this.#tt=new qt("div"),r.add(this.#tt),this.add(r),this.setOptions(i)}setKnobColor(t){this.#f&&(this.#f.style=`\n --range-color: ${t};\n --value-bg-color: ${t};\n `)}updateDisplay(){super.updateDisplay();const{open:t}=this.#u;this.domElement.children[1].classList.toggle("muigui-open",t),this.domElement.children[1].classList.toggle("muigui-closed",!t)}setOptions(t){l(this.#u,t),super.setOptions(t),this.updateDisplay()}addTop(t){return this.#X.add(t)}addBottom(t){return this.#tt.add(t)}}class de extends he{#j;#V;#I;constructor(t,e,n={}){super(t,e,"muigui-color-chooser");const i=n.format||Dt(this.getValue()),{color:o,text:r}=_t[i];this.#I=o.to,this.#V=new B(this,{converters:r,alpha:St(i)}),this.#j=new ce(this,{converters:o,alpha:St(i)}),this.addTop(this.#V),this.addBottom(this.#j),this.___setKnobHelper=!0,this.updateDisplay()}#et(){if(this.#I){const t=this.#I(this.getValue()),e=9===t.length?t.substring(7,9):"FF",n=yt(q(t));n[2]=(n[2]+50)%100;const i=X(vt(n));this.setKnobColor(`${t.substring(0,7)}${e}`,i)}}updateDisplay(){super.updateDisplay(),this.___setKnobHelper&&this.#et()}setOptions(t){return super.setOptions(t),this}}class me extends oe{add(t,e,...n){const i=t instanceof g?t:function(t,e,...n){const[i]=n;if(Array.isArray(i))return new z(t,e,{keyValues:i});if(i&&i.keyValues)return new z(t,e,{keyValues:i.keyValues});const o=typeof t[e];switch(o){case"number":if("number"==typeof n[0]&&"number"==typeof n[1]){const i=n[0],o=n[1],r=n[2];return new W(t,e,{min:i,max:o,...r&&{step:r}})}return 0===n.length?new P(t,e,...n):new W(t,e,...n);case"boolean":return new N(t,e,...n);case"function":return new b(t,e,...n);case"string":return new G(t,e,...n);case"undefined":throw new Error(`no property named ${e}`);default:throw new Error(`unhandled type ${o} for property ${e}`)}}(t,e,...n);return this.addController(i)}addCanvas(t){return this.addController(new Xt(t))}addColor(t,e,n={}){const i=t[e];return St(n.format||Dt(i))?this.addController(new de(t,e,n)):this.addController(new ee(t,e,n))}addDivider(){return this.addController(new ne)}addFolder(t){return this.addController(new me(t))}addLabel(t){return this.addController(new re(t))}addButton(t,e){const n={fn:e};return this.add(n,"fn").name(t)}}class pe extends HTMLElement{constructor(){super(),this.shadow=this.attachShadow({mode:"open"})}}customElements.define("muigui-element",pe);const ge=new CSSStyleSheet,be=new CSSStyleSheet;function fe(t){let e,n;function i(){if(e&&!n){const o=e;e=void 0,n=t.replace(o).then((()=>{n=void 0,i()}))}}return function(t){e=t,i()}}const ve=fe(ge),xe=fe(be);function we(e){const{include:n,css:i}=t.themes[e];return`${n.map((e=>t[e])).join("\n")} : css.default}\n${i||""}`}class ye extends me{static converters=U;static mapRange=u;static makeRangeConverters=c;static makeRangeOptions=h;static makeMinMaxPair=m;#nt=new CSSStyleSheet;constructor(n={}){super("Controls","muigui-root"),n instanceof HTMLElement&&(n={parent:n});const{autoPlace:i=!0,width:o,title:r="Controls"}=n;let{parent:s}=n;if(o&&(this.domElement.style.width=/^\d+$/.test(o)?`${o}px`:o),void 0===s&&i&&(s=document.body,this.domElement.classList.add("muigui-auto-place")),s){const t=e("muigui-element");t.shadowRoot.adoptedStyleSheets=[this.#nt,ge,be],t.shadow.appendChild(this.domElement),s.appendChild(t)}r&&this.title(r),this.#nt.replaceSync(t.default),this.domElement.classList.add("muigui","muigui-colors")}setStyle(t){this.#nt.replace(t)}static setBaseStyles(t){ve(t)}static getBaseStyleSheet(){return ge}static setUserStyles(t){xe(t)}static getUserStyleSheet(){return be}setTheme(t){this.setStyle(we(t))}static setTheme(t){ye.setBaseStyles(we(t))}}function ke(){}const Ee={ArrowLeft:[-1,0],ArrowRight:[1,0],ArrowUp:[0,-1],ArrowDown:[0,1]};function Ie(t,{onDown:e=ke,onUp:n=ke}){const i=function(t){const i=t.shiftKey?10:1,[o,r]=(Ee[t.key]||[0,0]).map((t=>t*i));("keydown"===t.type?e:n)({type:t.type.substring(3),dx:o,dy:r,event:t})};return t.addEventListener("keydown",i),t.addEventListener("keyup",i),function(){t.removeEventListener("keydown",i),t.removeEventListener("keyup",i)}}function $e(t,e=""){if(!t)throw new Error(e)}function Ce(t,e,n,i,o,r){const s=Math.abs(n)*Math.cos(r),a=Math.abs(i)*Math.sin(r);return[t+Math.cos(o)*s-Math.sin(o)*a,e+Math.sin(o)*s+Math.cos(o)*a]}function Me(t,e,n,i,o){$e(Math.abs(i-o)<=2*Math.PI),$e(i>=-Math.PI&&i<=2*Math.PI),$e(i<=o),$e(o>=-Math.PI&&o<=4*Math.PI);const{x1:r,y1:s,x2:a,y2:l,fa:u,fs:c}=function(t,e,n,i,o,r,s){const[a,l]=Ce(t,e,n,i,o,r),[u,c]=Ce(t,e,n,i,o,r+s);return{x1:a,y1:l,x2:u,y2:c,fa:Math.abs(s)>Math.PI?1:0,fs:s>0?1:0}}(t,e,n,n,0,i,o-i);return Math.abs(Math.abs(i-o)-2*Math.PI)>Number.EPSILON?`M${t} ${e} L${r} ${s} A ${n} ${n} 0 ${u} ${c} ${a} ${l} L${t} ${e}`:`M${r} ${s} L${r} ${s} A ${n} ${n} 0 ${u} ${c} ${a} ${l}`}const Se=t=>a(t+Math.PI,2*Math.PI)-Math.PI;class Ve extends v{#it;#ot;#rt;#st;#u={step:1,min:-180,max:180,dirMin:-Math.PI,dirMax:Math.PI,wrap:void 0,converters:A};constructor(t,n={}){const i=L();super(e("div",{className:"muigui-direction muigui-no-scroll",innerHTML:'\n\n',onWheel:e=>{e.preventDefault();const{min:n,max:r,step:l}=this.#u,u=i(e,l);let c=this.#rt+u;this.#st&&(c=a(c-n,r-n)+n);const h=o(s(c,(t=>t),l),n,r);t.setValue(h)}}));const r=e=>{const{min:n,max:i,step:r,dirMin:a,dirMax:l}=this.#u,u=2*e.nx-1,c=2*e.ny-1,h=Math.atan2(c,u),d=(a+l)/2,m=o((Se(h-d)-Se(a-d))/(l-a),0,1),p=s(n+(i-n)*m,(t=>t),r);t.setValue(p)};le(this.domElement,{onDown:r,onMove:r}),Ie(this.domElement,{onDown:e=>{const{min:n,max:i,step:r}=this.#u,a=o(s(this.#rt+e.dx*r,(t=>t),r),n,i);t.setValue(a)}}),this.#it=this.$("#muigui-arrow"),this.#ot=this.$("#muigui-range"),this.setOptions(n)}updateDisplay(t){this.#rt=t;const{min:e,max:n}=this.#u,i=(t-e)/(n-e),o=(r=this.#u.dirMin,s=this.#u.dirMax,r+(s-r)*i);var r,s;this.#it.style.transform=`rotate(${o}rad)`}setOptions(t){l(this.#u,t);const{dirMin:e,dirMax:n,wrap:i}=this.#u;this.#st=void 0!==i?i:Math.abs(e-n)>=2*Math.PI-Number.EPSILON;const[o,r]=e(o.push(i),e("label",{},[e("input",{type:"radio",name:r,value:a,onChange:function(){this.checked&&t.setFinalValue(s.#D[this.value])}}),e("button",{type:"button",textContent:n,onClick:function(){this.previousElementSibling.click()}})]))))));const s=this;this.#D=o,this.cols(i)}updateDisplay(t){const e=this.#D.indexOf(t);for(let t=0;t{e({rect:t.getBoundingClientRect(),elem:t})})).observe(t)}function Ue(t,e,n,i){je(t,(({rect:o})=>{const{width:r,height:s}=o;t.setAttribute("viewBox",`-${r*e} -${s*n} ${r} ${s}`),i({elem:t,rect:o})}))}function Le(t,e,n,i,o,r){const a=[];tt),n)),e=Math.min(e,o);for(let i=t;i<=e;i+=n)a.push(`M${i} 0 l0 ${r}`);return a.join(" ")}class Fe extends v{#at;#lt;#ut;#ct;#ht;#dt;#mt;#pt;#gt;#rt;#bt;#u={min:-100,max:100,step:1,unit:10,unitSize:10,ticksPerUnit:5,labelFn:t=>t,tickHeight:1,limits:!0,thicksColor:void 0,orientation:void 0};constructor(t,n){const i=L();let r;super(e("div",{innerHTML:'\n\n',className:"muigui-no-v-scroll",onWheel:e=>{e.preventDefault();const{min:n,max:r,step:a}=this.#u,l=i(e,a),u=o(s(this.#rt+l,(t=>t),a),n,r);t.setValue(u)}})),this.#at=this.$("svg"),this.#lt=this.$("#muigui-origin"),this.#ut=this.$("#muigui-ticks"),this.#ct=this.$("#muigui-thicks"),this.#ht=this.$("#muigui-numbers"),this.#dt=this.$("#muigui-left-grad"),this.#mt=this.$("#muigui-right-grad"),this.setOptions(n),le(this.domElement,{onDown:()=>{r=this.#rt},onMove:e=>{const{min:n,max:i,unitSize:a,unit:l,step:u}=this.#u,c=o(s(r-e.dx/a*l,(t=>t),u),n,i);t.setValue(c)}}),Ie(this.domElement,{onDown:e=>{const{min:n,max:i,step:r}=this.#u,a=o(s(this.#rt+e.dx*r,(t=>t),r),n,i);t.setValue(a)}}),Ue(this.#at,.5,0,(({rect:{width:t}})=>{this.#dt.setAttribute("x",-t/2),this.#mt.setAttribute("x",t/2-20),this.#bt=function(t){const e=t.innerHTML;t.innerHTML="- ";const n=t.querySelector("text").getComputedTextLength();return t.innerHTML=e,n}(this.#ht),this.#pt=t,this.#ft()}))}#ft(){if(!this.#pt||void 0===this.#rt)return;const{labelFn:t,limits:e,min:n,max:i,orientation:o,tickHeight:r,ticksPerUnit:a,unit:l,unitSize:u,thicksColor:c}=this.#u,h=Math.ceil(this.#pt/u),d=this.#rt/l,m=Math.round(d-h),p=m*u,g=(m+2*h)*u,b=e?n*u/l:p,f=e?i*u/l:g,v=""===t(1)?10:5;a>1&&this.#ut.setAttribute("d",Le(p,g,u/a,b,f,v*r)),this.#ct.style.stroke=c,this.#ct.setAttribute("d",Le(p,g,u,b,f,v)),this.#ht.innerHTML=function(t,e,n,i,o,r,a,l){const u=[];tt),n)),e=Math.min(e,a);const c=Math.max(0,-Math.log10(i));for(let r=t;r<=e;r+=n)u.push(`${h=r/n*i,l(h.toFixed(c))}`);var h;return u.join("\n")}(p,g,u,l,this.#bt,b,f,t),this.#lt.setAttribute("transform",`translate(${-this.#rt*u/l} 0)`),this.#at.classList.toggle("muigui-slider-up","up"===o)}updateDisplay(t){this.#rt=t,this.#ft()}setOptions(t){return l(this.#u,t),this}}class Pe extends D{constructor(t,e,n={}){super(t,e,"muigui-slider"),this.add(new Fe(this,n)),this.add(new F(this,n)),this.updateDisplay()}}class Oe extends v{#at;#it;#H;#rt=[];constructor(t){super(e("div",{innerHTML:'\n\n',className:"muigui-no-scroll"}));const n=e=>{const{width:n,height:i}=this.#at.getBoundingClientRect(),o=2*e.nx-1,r=2*e.ny-1;t.setValue([o*n*.5,r*i*.5])};le(this.domElement,{onDown:n,onMove:n}),this.#at=this.$("svg"),this.#it=this.$("#muigui-arrow"),this.#H=this.$("#muigui-circle"),Ue(this.#at,.5,.5,(()=>this.#vt))}#vt(){const[t,e]=this.#rt;this.#it.setAttribute("d",`M0,0L${t},${e}`),this.#H.setAttribute("transform",`translate(${t}, ${e})`)}updateDisplay(t){this.#rt[0]=t[0],this.#rt[1]=t[1],this.#vt()}}class He extends he{constructor(t,e){super(t,e,"muigui-vec2");const n=t=>({setValue:e=>{const n=this.getValue();n[t]=e,this.setValue(n)},setFinalValue:e=>{const n=this.getValue();n[t]=e,this.setFinalValue(n)}});this.addTop(new F(n(0),{converters:{to:t=>t[0],from:j.from}})),this.addTop(new F(n(1),{converters:{to:t=>t[1],from:j.from}})),this.addBottom(new Oe(this)),this.updateDisplay()}}const ze={main:"#ddd"},Te={main:"#333"},We=window.matchMedia("(prefers-color-scheme: dark)");let Be,Ge;function Re(){Ge=We.matches,Be=Ge?ze:Te}We.addEventListener("change",Re),Re();const Ze={graph:function(t,e,{min:n=-1,max:i=1,interval:o=16,color:r}){const s=t.getContext("2d");setInterval((function(){const{width:o,height:a}=t;s.clearRect(0,0,o,a),s.beginPath();const l=i-n;for(let t=0;t{t.text(JSON.stringify(e[n],null,2))}),i)}};export{de as ColorChooser,De as Direction,Ae as RadioGrid,W as Range,z as Select,Pe as Slider,P as TextNumber,He as Vec2,ye as default,Ze as helpers};
//# sourceMappingURL=muigui.module.min.js.map
diff --git a/dist/0.x/muigui.module.min.js.map b/dist/0.x/muigui.module.min.js.map
index 3feaea2..7a3e54f 100644
--- a/dist/0.x/muigui.module.min.js.map
+++ b/dist/0.x/muigui.module.min.js.map
@@ -1 +1 @@
-{"version":3,"file":"muigui.module.min.js","sources":["../../src/styles/muigui.css.js","../../src/libs/elem.js","../../src/libs/utils.js","../../../src/views/View.ts","../../src/controllers/Controller.js","../../src/controllers/Button.js","../../src/views/EditView.js","../../src/views/CheckboxView.js","../../src/libs/taskrunner.js","../../src/libs/ids.js","../../src/views/ValueView.js","../../src/controllers/LabelController.js","../../src/controllers/ValueController.js","../../src/controllers/Checkbox.js","../../src/libs/conversions.js","../../src/libs/wheel.js","../../src/views/NumberView.js","../../src/controllers/TextNumber.js","../../src/views/SelectView.js","../../src/libs/key-values.js","../../src/controllers/Select.js","../../src/views/RangeView.js","../../src/controllers/Range.js","../../src/views/TextView.js","../../src/controllers/Text.js","../../src/libs/color-utils.js","../../src/views/ElementView.js","../../src/controllers/Canvas.js","../../src/views/ColorView.js","../../src/controllers/Color.js","../../src/controllers/Divider.js","../../src/controllers/Container.js","../../src/controllers/Folder.js","../../src/controllers/Label.js","../../src/libs/touch.js","../../src/views/ColorChooserView.js","../../src/controllers/PopDownController.js","../../src/controllers/ColorChooser.js","../../src/muigui.js","../../src/controllers/create-controller.js","../../src/libs/keyboard.js","../../src/libs/assert.js","../../src/libs/svg.js","../../src/views/DirectionView.js","../../src/controllers/Direction.js","../../src/views/RadioGridView.js","../../src/controllers/RadioGrid.js","../../src/libs/resize-helpers.js","../../src/views/SliderView.js","../../src/controllers/Slider.js","../../src/views/Vec2View.js","../../src/controllers/Vec2.js"],"sourcesContent":["export default {\n default: `\n.muigui {\n --bg-color: #ddd;\n --color: #222;\n --contrast-color: #eee;\n --value-color: #145 ;\n --value-bg-color: #eeee;\n --disabled-color: #999;\n --menu-bg-color: #f8f8f8;\n --menu-sep-color: #bbb;\n --hover-bg-color: #999;\n --focus-color: #68C;\n --range-color: #888888;\n --invalid-color: #FF0000;\n --selected-color: rgb(255, 255, 255, 0.9);\n\n --button-bg-color: var(--value-bg-color);\n\n --range-left-color: var(--value-color);\n --range-right-color: var(--value-bg-color); \n --range-right-hover-color: var(--hover-bg-color);\n\n color: var(--color);\n background-color: var(--bg-color);\n}\n\n@media (prefers-color-scheme: dark) {\n .muigui {\n --bg-color: #222222;\n --color: #dddddd;\n --contrast-color: #000;\n --value-color: #43e5f7;\n --value-bg-color: #444444;\n --disabled-color: #666666;\n --menu-bg-color: #080808;\n --menu-sep-color: #444444;\n --hover-bg-color: #666666;\n --focus-color: #88AAFF;\n --range-color: #888888;\n --invalid-color: #FF6666;\n --selected-color: rgba(255, 255, 255, 0.3);\n\n --button-bg-color: var(--value-bg-color);\n\n --range-left-color: var(--value-color);\n --range-right-color: var(--value-bg-color); \n --range-right-hover-color: var(--hover-bg-color);\n\n color: var(--color);\n background-color: var(--bg-color);\n }\n}\n\n.muigui {\n --width: 250px;\n --label-width: 45%;\n --number-width: 40%;\n\n\n --font-family: -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, Arial, sans-serif;\n --font-size: 11px;\n --font-family-mono: Menlo, Monaco, Consolas, \"Droid Sans Mono\", monospace;\n --font-size-mono: 11px;\n\n --line-height: 1.7em;\n --border-radius: 0px;\n\n width: var(--width);\n font-family: var(--font-family);\n font-size: var(--font-size);\n box-sizing: border-box;\n line-height: 100%;\n}\n.muigui * {\n box-sizing: inherit;\n}\n\n.muigui-no-scroll {\n touch-action: none;\n}\n.muigui-no-h-scroll {\n touch-action: pan-y;\n}\n.muigui-no-v-scroll {\n touch-action: pan-x;\n}\n\n.muigui-invalid-value {\n background-color: red !important;\n color: white !important;\n}\n\n.muigui-grid {\n display: grid;\n}\n.muigui-rows {\n display: flex;\n flex-direction: column;\n\n min-height: 20px;\n border: 2px solid red;\n}\n.muigui-columns {\n display: flex;\n flex-direction: row;\n\n height: 20px;\n border: 2px solid green;\n}\n.muigui-rows>*,\n.muigui-columns>* {\n flex: 1 1 auto;\n align-items: stretch;\n min-height: 0;\n min-width: 0;\n}\n\n.muigui-row {\n border: 2px solid yellow;\n min-height: 10px\n}\n.muigui-column {\n border: 2px solid lightgreen;\n}\n\n/* -------- */\n\n.muigui-show { /* */ }\n.muigui-hide { \n display: none !important;\n}\n.muigui-disabled {\n pointer-events: none;\n --color: var(--disabled-color) !important;\n --value-color: var(--disabled-color) !important;\n --range-left-color: var(--disabled-color) !important;\n}\n\n.muigui canvas,\n.muigui svg {\n display: block;\n border-radius: var(--border-radius);\n}\n.muigui canvas {\n background-color: var(--value-bg-color);\n}\n\n.muigui-controller {\n min-width: 0;\n min-height: var(--line-height);\n}\n.muigui-root,\n.muigui-menu {\n display: flex;\n flex-direction: column;\n position: relative;\n user-select: none;\n height: fit-content;\n margin: 0;\n padding-bottom: 0.1em;\n border-radius: var(--border-radius);\n}\n.muigui-menu {\n border-bottom: 1px solid var(--menu-sep-color);\n}\n\n.muigui-root>button:nth-child(1),\n.muigui-menu>button:nth-child(1) {\n border-top: 1px solid var(--menu-sep-color);\n border-bottom: 1px solid var(--menu-sep-color);\n position: relative;\n text-align: left;\n color: var(--color);\n background-color: var(--menu-bg-color);\n min-height: var(--line-height);\n padding-top: 0.2em;\n padding-bottom: 0.2em;\n cursor: pointer;\n border-radius: var(--border-radius);\n}\n.muigui-root>div:nth-child(2),\n.muigui-menu>div:nth-child(2) {\n flex: 1 1 auto;\n}\n\n.muigui-controller {\n margin-left: 0.2em;\n margin-right: 0.2em;\n}\n.muigui-root.muigui-controller,\n.muigui-menu.muigui-controller {\n margin-left: 0;\n margin-right: 0;\n}\n.muigui-controller>*:nth-child(1) {\n flex: 1 0 var(--label-width);\n min-width: 0;\n white-space: pre;\n}\n.muigui-controller>label:nth-child(1) {\n place-content: center start;\n display: inline-grid;\n overflow: hidden;\n}\n.muigui-controller>*:nth-child(2) {\n flex: 1 1 75%;\n min-width: 0;\n}\n\n/* -----------------------------------------\n a label controller is [[label][value]]\n*/\n\n.muigui-label-controller {\n display: flex;\n margin: 0.4em 0 0.4em 0;\n word-wrap: initial;\n align-items: stretch;\n}\n\n.muigui-value {\n display: flex;\n align-items: stretch;\n}\n.muigui-value>* {\n flex: 1 1 auto;\n min-width: 0;\n}\n.muigui-value>*:nth-child(1) {\n flex: 1 1 calc(100% - var(--number-width));\n}\n.muigui-value>*:nth-child(2) {\n flex: 1 1 var(--number-width);\n margin-left: 0.2em;\n}\n\n/* fix! */\n.muigui-open>button>label::before,\n.muigui-closed>button>label::before {\n width: 1.25em;\n height: var(--line-height);\n display: inline-grid;\n place-content: center start;\n pointer-events: none;\n}\n.muigui-open>button>label::before {\n content: \"ⓧ\"; /*\"▼\";*/\n}\n.muigui-closed>button>label::before {\n content: \"⨁\"; /*\"▶\";*/\n}\n.muigui-open>*:nth-child(2) {\n transition: max-height 0.2s ease-out,\n opacity 0.5s ease-out;\n max-height: 100vh;\n overflow: auto;\n opacity: 1;\n}\n\n.muigui-closed>*:nth-child(2) {\n transition: max-height 0.2s ease-out,\n opacity 1s;\n max-height: 0;\n opacity: 0;\n overflow: hidden;\n}\n\n/* ---- popdown ---- */\n\n.muigui-pop-down-top {\n display: flex;\n}\n/* fix? */\n.muigui-value>*:nth-child(1).muigui-pop-down-top {\n flex: 0;\n}\n.muigui-pop-down-bottom {\n\n}\n\n.muigui-pop-down-values {\n min-width: 0;\n display: flex;\n}\n.muigui-pop-down-values>* {\n flex: 1 1 auto;\n min-width: 0;\n}\n\n.muigui-value.muigui-pop-down-controller {\n flex-direction: column;\n}\n\n.muigui-pop-down-top input[type=checkbox] {\n -webkit-appearance: none;\n appearance: none;\n width: auto;\n color: var(--value-color);\n background-color: var(--value-bg-color);\n cursor: pointer;\n\n display: grid;\n place-content: center;\n margin: 0;\n font: inherit;\n color: currentColor;\n width: 1.7em;\n height: 1.7em;\n transform: translateY(-0.075em);\n}\n\n.muigui-pop-down-top input[type=checkbox]::before {\n content: \"+\";\n display: grid;\n place-content: center;\n border-radius: calc(var(--border-radius) + 2px);\n border-left: 1px solid rgba(255,255,255,0.3);\n border-top: 1px solid rgba(255,255,255,0.3);\n border-bottom: 1px solid rgba(0,0,0,0.2);\n border-right: 1px solid rgba(0,0,0,0.2);\n background-color: var(--range-color);\n color: var(--value-bg-color);\n width: calc(var(--line-height) - 4px);\n height: calc(var(--line-height) - 4px);\n}\n\n.muigui-pop-down-top input[type=checkbox]:checked::before {\n content: \"X\";\n}\n\n\n/* ---- select ---- */\n\n.muigui select,\n.muigui option,\n.muigui input,\n.muigui button {\n color: var(--value-color);\n background-color: var(--value-bg-color);\n font-family: var(--font-family);\n font-size: var(--font-size);\n border: none;\n margin: 0;\n border-radius: var(--border-radius);\n}\n.muigui select {\n appearance: none;\n margin: 0;\n margin-left: 0; /*?*/\n overflow: hidden; /* Safari */\n}\n\n.muigui select:focus,\n.muigui input:focus,\n.muigui button:focus {\n outline: 1px solid var(--focus-color);\n}\n\n.muigui select:hover,\n.muigui option:hover,\n.muigui input:hover,\n.muigui button:hover {\n background-color: var(--hover-bg-color); \n}\n\n/* ------ [ label ] ------ */\n\n.muigui-label {\n border-top: 1px solid var(--menu-sep-color);\n border-bottom: 1px solid var(--menu-sep-color);\n padding-top: 0.4em;\n padding-bottom: 0.3em;\n place-content: center start;\n background-color: var(--menu-bg-color);\n white-space: pre;\n border-radius: var(--border-radius);\n}\n\n/* ------ [ divider] ------ */\n\n.muigui-divider {\n min-height: 6px;\n border-top: 2px solid var(--menu-sep-color);\n margin-top: 6px;\n}\n\n/* ------ [ button ] ------ */\n\n.muigui-button {\n display: grid;\n\n}\n.muigui-button button {\n border: none;\n color: var(--value-color);\n background-color: var(--button-bg-color);\n cursor: pointer;\n place-content: center center;\n}\n\n/* ------ [ color ] ------ */\n\n.muigui-color>div {\n overflow: hidden;\n position: relative;\n margin-left: 0;\n margin-right: 0; /* why? */\n max-width: var(--line-height);\n border-radius: var(--border-radius);\n}\n\n.muigui-color>div:focus-within {\n outline: 1px solid var(--focus-color);\n}\n\n.muigui-color input[type=color] {\n border: none;\n padding: 0;\n background: inherit;\n cursor: pointer;\n position: absolute;\n width: 200%;\n left: -10px;\n top: -10px;\n height: 200%;\n}\n.muigui-disabled canvas,\n.muigui-disabled svg,\n.muigui-disabled img,\n.muigui-disabled .muigui-color input[type=color] {\n opacity: 0.2;\n}\n\n/* ------ [ checkbox ] ------ */\n\n.muigui-checkbox>label:nth-child(2) {\n display: grid;\n place-content: center start;\n margin: 0;\n}\n\n.muigui-checkbox input[type=checkbox] {\n -webkit-appearance: none;\n appearance: none;\n width: auto;\n color: var(--value-color);\n background-color: var(--value-bg-color);\n cursor: pointer;\n\n display: grid;\n place-content: center;\n margin: 0;\n font: inherit;\n color: currentColor;\n width: 1.7em;\n height: 1.7em;\n transform: translateY(-0.075em);\n}\n\n.muigui-checkbox input[type=checkbox]::before {\n content: \"\";\n color: var(--value-color);\n display: grid;\n place-content: center;\n}\n\n.muigui-checkbox input[type=checkbox]:checked::before {\n content: \"✔\";\n}\n\n.muigui input[type=number]::-webkit-inner-spin-button, \n.muigui input[type=number]::-webkit-outer-spin-button { \n -webkit-appearance: none;\n appearance: none;\n margin: 0; \n}\n.muigui input[type=number] {\n -moz-appearance: textfield;\n}\n\n/* ------ [ radio grid ] ------ */\n\n.muigui-radio-grid>div {\n display: grid;\n gap: 2px;\n}\n\n.muigui-radio-grid input {\n appearance: none;\n display: none;\n}\n\n.muigui-radio-grid button {\n color: var(--color);\n width: 100%;\n text-align: left;\n}\n\n.muigui-radio-grid input:checked + button {\n color: var(--value-color);\n background-color: var(--selected-color);\n}\n\n/* ------ [ color-chooser ] ------ */\n\n.muigui-color-chooser-cursor {\n stroke-width: 1px;\n stroke: white;\n fill: none;\n}\n.muigui-color-chooser-circle {\n stroke-width: 1px;\n stroke: white;\n fill: none;\n}\n\n\n/* ------ [ vec2 ] ------ */\n\n.muigui-vec2 svg {\n background-color: var(--value-bg-color);\n}\n\n.muigui-vec2-axis {\n stroke: 1px;\n stroke: var(--focus-color);\n}\n\n.muigui-vec2-line {\n stroke-width: 1px;\n stroke: var(--value-color);\n fill: var(--value-color);\n}\n\n/* ------ [ direction ] ------ */\n\n.muigui-direction svg {\n background-color: rgba(0,0,0,0.2);\n}\n\n.muigui-direction:focus-within svg {\n outline: none;\n}\n.muigui-direction-range {\n fill: var(--value-bg-color);\n}\n.muigui-direction svg:focus {\n outline: none;\n}\n.muigui-direction svg:focus .muigui-direction-range {\n stroke-width: 0.5px;\n stroke: var(--focus-color);\n}\n\n.muigui-direction-arrow {\n fill: var(--value-color);\n}\n\n/* ------ [ slider ] ------ */\n\n.muigui-slider>div {\n display: flex;\n align-items: stretch;\n height: var(--line-height);\n}\n.muigui-slider svg {\n flex: 1 1 auto;\n}\n.muigui-slider .muigui-slider-up #muigui-orientation {\n transform: scale(1, -1) translateY(-100%);\n}\n\n.muigui-slider .muigui-slider-up #muigui-number-orientation {\n transform: scale(1,-1);\n}\n\n.muigui-ticks {\n stroke: var(--range-color);\n}\n.muigui-thicks {\n stroke: var(--color);\n stroke-width: 2px;\n}\n.muigui-svg-text {\n fill: var(--color);\n font-size: 7px;\n}\n.muigui-mark {\n fill: var(--value-color);\n}\n\n/* ------ [ range ] ------ */\n\n\n.muigui-range input[type=range] {\n -webkit-appearance: none;\n appearance: none;\n background-color: transparent;\n}\n\n.muigui-range input[type=range]::-webkit-slider-thumb {\n -webkit-appearance: none;\n appearance: none;\n border-radius: calc(var(--border-radius) + 2px);\n border-left: 1px solid rgba(255,255,255,0.3);\n border-top: 1px solid rgba(255,255,255,0.3);\n border-bottom: 1px solid rgba(0,0,0,0.2);\n border-right: 1px solid rgba(0,0,0,0.2);\n background-color: var(--range-color);\n margin-top: calc((var(--line-height) - 2px) / -2);\n width: calc(var(--line-height) - 2px);\n height: calc(var(--line-height) - 2px);\n}\n\n.muigui-range input[type=range]::-webkit-slider-runnable-track {\n -webkit-appearance: none;\n appearance: none;\n border: 1px solid var(--menu-sep-color);\n height: 2px;\n}\n\n\n/* dat.gui style - doesn't work on Safari iOS */\n\n/*\n.muigui-range input[type=range] {\n cursor: ew-resize;\n overflow: hidden;\n}\n\n.muigui-range input[type=range] {\n -webkit-appearance: none;\n appearance: none;\n background-color: var(--range-right-color);\n margin: 0;\n}\n.muigui-range input[type=range]:hover {\n background-color: var(--range-right-hover-color);\n}\n\n.muigui-range input[type=range]::-webkit-slider-runnable-track {\n -webkit-appearance: none;\n appearance: none;\n height: max-content;\n color: var(--range-left-color);\n margin-top: -1px;\n}\n\n.muigui-range input[type=range]::-webkit-slider-thumb {\n -webkit-appearance: none;\n appearance: none;\n width: 0px;\n height: max-content;\n box-shadow: -1000px 0 0 1000px var(--range-left-color);\n}\n*/\n\n/* FF */\n/*\n.muigui-range input[type=range]::-moz-slider-progress {\n background-color: var(--range-left-color); \n}\n.muigui-range input[type=range]::-moz-slider-thumb {\n height: max-content;\n width: 0;\n border: none;\n box-shadow: -1000px 0 0 1000px var(--range-left-color);\n box-sizing: border-box;\n}\n*/\n\n.muigui-checkered-background {\n background-color: #404040;\n background-image:\n linear-gradient(45deg, #808080 25%, transparent 25%),\n linear-gradient(-45deg, #808080 25%, transparent 25%),\n linear-gradient(45deg, transparent 75%, #808080 75%),\n linear-gradient(-45deg, transparent 75%, #808080 75%);\n background-size: 16px 16px;\n background-position: 0 0, 0 8px, 8px -8px, -8px 0px;\n}\n\n/* ---------------------------------------------------------- */\n\n/* needs to be at bottom to take precedence */\n.muigui-auto-place {\n max-height: 100%;\n position: fixed;\n top: 0;\n right: 15px;\n z-index: 100001;\n}\n\n`,\nthemes: {\n default: '',\n float: `\n :root {\n color-scheme: light dark,\n }\n\n .muigui {\n --width: 400px;\n --bg-color: initial;\n --label-width: 25%;\n --number-width: 20%;\n }\n\n input,\n .muigui-label-controller>label {\n text-shadow:\n -1px -1px 0 var(--contrast-color),\n 1px -1px 0 var(--contrast-color),\n -1px 1px 0 var(--contrast-color),\n 1px 1px 0 var(--contrast-color);\n }\n\n .muigui-controller > label:nth-child(1) {\n place-content: center end;\n margin-right: 1em;\n }\n\n .muigui-value > :nth-child(2) {\n margin-left: 1em;\n }\n\n .muigui-root>*:nth-child(1) {\n display: none;\n }\n\n .muigui-range input[type=range]::-webkit-slider-thumb {\n border-radius: 1em;\n }\n\n .muigui-range input[type=range]::-webkit-slider-runnable-track {\n -webkit-appearance: initial;\n appearance: none;\n border: 1px solid rgba(0, 0, 0, 0.25);\n height: 2px;\n }\n\n .muigui-colors {\n --value-color: var(--color );\n --value-bg-color: rgba(0, 0, 0, 0.1);\n --disabled-color: #cccccc;\n --menu-bg-color: rgba(0, 0, 0, 0.1);\n --menu-sep-color: #bbbbbb;\n --hover-bg-color: rgba(0, 0, 0, 0);\n --invalid-color: #FF0000;\n --selected-color: rgba(0, 0, 0, 0.3);\n --range-color: rgba(0, 0, 0, 0.125);\n }\n`,\n},\n};\n","export function setElemProps(elem, attrs, children) {\n for (const [key, value] of Object.entries(attrs)) {\n if (typeof value === 'function' && key.startsWith('on')) {\n const eventName = key.substring(2).toLowerCase();\n elem.addEventListener(eventName, value, {passive: false});\n } else if (typeof value === 'object') {\n for (const [k, v] of Object.entries(value)) {\n elem[key][k] = v;\n }\n } else if (elem[key] === undefined) {\n elem.setAttribute(key, value);\n } else {\n elem[key] = value;\n }\n }\n for (const child of children) {\n elem.appendChild(child);\n }\n return elem;\n}\n\nexport function createElem(tag, attrs = {}, children = []) {\n const elem = document.createElement(tag);\n setElemProps(elem, attrs, children);\n return elem;\n}\n\nexport function addElem(tag, parent, attrs = {}, children = []) {\n const elem = createElem(tag, attrs, children);\n parent.appendChild(elem);\n return elem;\n}\n\nlet nextId = 0;\nexport function getNewId() {\n return `muigui-id-${nextId++}`;\n}\n","export function removeArrayElem(array, value) {\n const ndx = array.indexOf(value);\n if (ndx) {\n array.splice(ndx, 1);\n }\n return array;\n}\n\n/**\n * Converts an camelCase or snake_case id to \"camel case\" or \"snake case\"\n * @param {string} id\n */\nconst underscoreRE = /_/g;\nconst upperLowerRE = /([A-Z])([a-z])/g;\nexport function idToLabel(id) {\n return id.replace(underscoreRE, ' ')\n .replace(upperLowerRE, (m, m1, m2) => `${m1.toLowerCase()} ${m2}`);\n}\n\nexport function clamp(v, min, max) {\n return Math.max(min, Math.min(max, v));\n}\n\nexport const isTypedArray = typeof SharedArrayBuffer !== 'undefined'\n ? function isArrayBufferOrSharedArrayBuffer(a) {\n return a && a.buffer && (a.buffer instanceof ArrayBuffer || a.buffer instanceof SharedArrayBuffer);\n }\n : function isArrayBuffer(a) {\n return a && a.buffer && a.buffer instanceof ArrayBuffer;\n };\n\nexport const isArrayOrTypedArray = v => Array.isArray(v) || isTypedArray(v);\n\n// Yea, I know this should be `Math.round(v / step) * step\n// but try step = 0.1, newV = 19.95\n//\n// I get\n// Math.round(19.95 / 0.1) * 0.1\n// 19.900000000000002\n// vs\n// Math.round(19.95 / 0.1) / (1 / 0.1)\n// 19.9\n//\nexport const stepify = (v, from, step) => Math.round(from(v) / step) / (1 / step);\n\nexport const euclideanModulo = (v, n) => ((v % n) + n) % n;\nexport const lerp = (a, b, t) => a + (b - a) * t;\nexport function copyExistingProperties(dst, src) {\n for (const key in src) {\n if (key in dst) {\n dst[key] = src[key];\n }\n }\n return dst;\n}\n\nexport const mapRange = (v, inMin, inMax, outMin, outMax) => (v - inMin) * (outMax - outMin) / (inMax - inMin) + outMin;\n\nexport const makeRangeConverters = ({from, to}) => {\n return {\n to: v => mapRange(v, ...from, ...to),\n from: v => [true, mapRange(v, ...to, ...from)],\n };\n};\n\nexport const makeRangeOptions = ({from, to, step}) => {\n return {\n min: to[0],\n max: to[1],\n ...(step && {step}),\n converters: makeRangeConverters({from, to}),\n };\n};\n\n// TODO: remove an use one in conversions. Move makeRangeConverters there?\nexport const identity = {\n to: v => v,\n from: v => [true, v],\n};\nexport function makeMinMaxPair(gui, properties, minPropName, maxPropName, options) {\n const { converters: { from } = identity } = options;\n const { min, max } = options;\n const guiMinRange = options.minRange || 0;\n const valueMinRange = from(guiMinRange)[1];\n const minGui = gui\n .add(properties, minPropName, {\n ...options,\n min,\n max: max - guiMinRange,\n })\n .onChange(v => {\n maxGui.setValue(Math.min(max, Math.max(v + valueMinRange, properties[maxPropName])));\n });\n const maxGui = gui\n .add(properties, maxPropName, {\n ...options,\n min: min + guiMinRange,\n max,\n })\n .onChange(v => {\n minGui.setValue(Math.max(min, Math.min(v - valueMinRange, properties[minPropName])));\n });\n return [ minGui, maxGui ];\n}\n\n","import { removeArrayElem } from '../libs/utils.js';\n\nexport default class View {\n domElement: HTMLElement;\n\n #childDestElem: HTMLElement;\n #views: View[] = [];\n\n constructor(elem: HTMLElement) {\n this.domElement = elem;\n this.#childDestElem = elem;\n }\n addElem(elem: HTMLElement) {\n this.#childDestElem.appendChild(elem);\n return elem;\n }\n removeElem(elem: HTMLElement) {\n this.#childDestElem.removeChild(elem);\n return elem;\n }\n pushSubElem(elem: HTMLElement) {\n this.#childDestElem.appendChild(elem);\n this.#childDestElem = elem;\n }\n popSubElem() {\n this.#childDestElem = this.#childDestElem.parentElement!;\n }\n add(view: View) {\n this.#views.push(view);\n this.addElem(view.domElement);\n return view;\n }\n remove(view: View) {\n this.removeElem(view.domElement);\n removeArrayElem(this.#views, view);\n return view;\n }\n pushSubView(view: View) {\n this.pushSubElem(view.domElement);\n }\n popSubView() {\n this.popSubElem();\n }\n setOptions(options: any) {\n for (const view of this.#views) {\n view.setOptions(options);\n }\n }\n updateDisplayIfNeeded(newV: any, ignoreCache?: boolean) {\n for (const view of this.#views) {\n view.updateDisplayIfNeeded(newV, ignoreCache);\n }\n return this;\n }\n $(selector: string) {\n return this.domElement.querySelector(selector);\n }\n}","import { createElem } from '../libs/elem.js';\nimport { removeArrayElem } from '../libs/utils.js';\nimport View from '../views/View.js';\n\nexport default class Controller extends View {\n #changeFns;\n #finishChangeFns;\n #parent;\n\n constructor(className) {\n super(createElem('div', {className: 'muigui-controller'}));\n this.#changeFns = [];\n this.#finishChangeFns = [];\n // we need the specialization to come last so it takes precedence.\n if (className) {\n this.domElement.classList.add(className);\n }\n }\n get parent() {\n return this.#parent;\n }\n setParent(parent) {\n this.#parent = parent;\n this.enable(!this.disabled());\n }\n show(show = true) {\n this.domElement.classList.toggle('muigui-hide', !show);\n this.domElement.classList.toggle('muigui-show', show);\n return this;\n }\n hide() {\n return this.show(false);\n }\n disabled() {\n return !!this.domElement.closest('.muigui-disabled');\n }\n\n enable(enable = true) {\n this.domElement.classList.toggle('muigui-disabled', !enable);\n\n // If disabled we need to set the attribute 'disabled=true' to all\n // input/select/button/textarea's below\n //\n // If enabled we need to set the attribute 'disabled=false' to all below\n // until we hit a disabled controller.\n //\n // ATM the problem is we can find the input/select/button/textarea elements\n // but we can't easily find which controller they belong do.\n // But we don't need to? We can just check up if it or parent has\n // '.muigui-disabled'\n ['input', 'button', 'select', 'textarea'].forEach(tag => {\n this.domElement.querySelectorAll(tag).forEach(elem => {\n const disabled = !!elem.closest('.muigui-disabled');\n elem.disabled = disabled;\n });\n });\n\n return this;\n }\n disable(disable = true) {\n return this.enable(!disable);\n }\n onChange(fn) {\n this.removeChange(fn);\n this.#changeFns.push(fn);\n return this;\n }\n removeChange(fn) {\n removeArrayElem(this.#changeFns, fn);\n return this;\n }\n onFinishChange(fn) {\n this.removeFinishChange(fn);\n this.#finishChangeFns.push(fn);\n return this;\n }\n removeFinishChange(fn) {\n removeArrayElem(this.#finishChangeFns, fn);\n return this;\n }\n #callListeners(fns, newV) {\n for (const fn of fns) {\n fn.call(this, newV);\n }\n }\n emitChange(value, object, property) {\n this.#callListeners(this.#changeFns, value);\n if (this.#parent) {\n if (object === undefined) {\n this.#parent.emitChange(value);\n } else {\n this.#parent.emitChange({\n object,\n property,\n value,\n controller: this,\n });\n }\n }\n }\n emitFinalChange(value, object, property) {\n this.#callListeners(this.#finishChangeFns, value);\n if (this.#parent) {\n if (object === undefined) {\n this.#parent.emitChange(value);\n } else {\n this.#parent.emitFinalChange({\n object,\n property,\n value,\n controller: this,\n });\n }\n }\n }\n updateDisplay() {\n // placeholder. override\n }\n getColors() {\n const toCamelCase = s => s.replace(/-([a-z])/g, (m, m1) => m1.toUpperCase());\n const keys = [\n 'color',\n 'bg-color',\n 'value-color',\n 'value-bg-color',\n 'hover-bg-color',\n 'menu-bg-color',\n 'menu-sep-color',\n 'disabled-color',\n ];\n const div = createElem('div');\n this.domElement.appendChild(div);\n const colors = Object.fromEntries(keys.map(key => {\n div.style.color = `var(--${key})`;\n const s = getComputedStyle(div);\n return [toCamelCase(key), s.color];\n }));\n div.remove();\n return colors;\n }\n}\n","import {\n createElem,\n} from '../libs/elem.js';\nimport { copyExistingProperties } from '../libs/utils.js';\nimport Controller from './Controller.js';\n\nexport default class Button extends Controller {\n #object;\n #property;\n #buttonElem;\n #options = {\n name: '',\n };\n\n constructor(object, property, options = {}) {\n super('muigui-button', '');\n this.#object = object;\n this.#property = property;\n\n this.#buttonElem = this.addElem(\n createElem('button', {\n type: 'button',\n onClick: () => {\n this.#object[this.#property](this);\n },\n }));\n this.setOptions({name: property, ...options});\n }\n setOptions(options) {\n copyExistingProperties(this.#options, options);\n const {name} = this.#options;\n this.#buttonElem.textContent = name;\n }\n}","import { isTypedArray } from '../libs/utils.js';\nimport View from './View.js';\n\nfunction arraysEqual(a, b) {\n if (a.length !== b.length) {\n return false;\n }\n for (let i = 0; i < a.length; ++i) {\n if (a[i] !== b[i]) {\n return false;\n }\n }\n return true;\n}\n\nfunction copyArrayElementsFromTo(src, dst) {\n dst.length = src.length;\n for (let i = 0; i < src.length; ++i) {\n dst[i] = src[i];\n }\n}\n\nexport default class EditView extends View {\n #oldV;\n #updateCheck;\n\n #checkArrayNeedsUpdate(newV) {\n // It's an array, we need to compare all elements\n // Example, vec2, [r,g,b], ...\n const needUpdate = !arraysEqual(newV, this.#oldV);\n if (needUpdate) {\n copyArrayElementsFromTo(newV, this.#oldV);\n }\n return needUpdate;\n }\n\n #checkTypedArrayNeedsUpdate() {\n let once = true;\n return function checkTypedArrayNeedsUpdateImpl(newV) {\n // It's a typedarray, we need to compare all elements\n // Example: Float32Array([r, g, b])\n let needUpdate = once;\n once = false;\n if (!needUpdate) {\n needUpdate = !arraysEqual(newV, this.#oldV);\n }\n return needUpdate;\n };\n }\n\n #checkObjectNeedsUpdate(newV) {\n let needUpdate = false;\n for (const key in newV) {\n if (newV[key] !== this.#oldV[key]) {\n needUpdate = true;\n this.#oldV[key] = newV[key];\n }\n }\n return needUpdate;\n }\n\n #checkValueNeedsUpdate(newV) {\n const needUpdate = newV !== this.#oldV;\n this.#oldV = newV;\n return needUpdate;\n }\n\n #getUpdateCheckForType(newV) {\n if (Array.isArray(newV)) {\n this.#oldV = [];\n return this.#checkArrayNeedsUpdate.bind(this);\n } else if (isTypedArray(newV)) {\n this.#oldV = new newV.constructor(newV);\n return this.#checkTypedArrayNeedsUpdate(this);\n } else if (typeof newV === 'object') {\n this.#oldV = {};\n return this.#checkObjectNeedsUpdate.bind(this);\n } else {\n return this.#checkValueNeedsUpdate.bind(this);\n }\n }\n\n // The point of this is updating DOM elements\n // is slow but if we've called `listen` then\n // every frame we're going to try to update\n // things with the current value so if nothing\n // has changed then skip it.\n updateDisplayIfNeeded(newV, ignoreCache) {\n this.#updateCheck = this.#updateCheck || this.#getUpdateCheckForType(newV);\n // Note: We call #updateCheck first because it updates\n // the cache\n if (this.#updateCheck(newV) || ignoreCache) {\n this.updateDisplay(newV);\n }\n }\n setOptions(/*options*/) {\n // override this\n return this;\n }\n}\n","import { createElem } from '../libs/elem.js';\nimport EditView from './EditView.js';\n\nexport default class CheckboxView extends EditView {\n #checkboxElem;\n constructor(setter, id) {\n const checkboxElem = createElem('input', {\n type: 'checkbox',\n id,\n onInput: () => {\n setter.setValue(checkboxElem.checked);\n },\n onChange: () => {\n setter.setFinalValue(checkboxElem.checked);\n },\n });\n super(createElem('label', {}, [checkboxElem]));\n this.#checkboxElem = checkboxElem;\n }\n updateDisplay(v) {\n this.#checkboxElem.checked = v;\n }\n}\n","import { removeArrayElem } from './utils.js';\n\nconst tasks = [];\nconst tasksToRemove = new Set();\n\nlet requestId;\nlet processing;\n\nfunction removeTasks() {\n if (!tasksToRemove.size) {\n return;\n }\n\n if (processing) {\n queueProcessing();\n return;\n }\n\n tasksToRemove.forEach(task => {\n removeArrayElem(tasks, task);\n });\n tasksToRemove.clear();\n}\n\nfunction processTasks() {\n requestId = undefined;\n processing = true;\n for (const task of tasks) {\n if (!tasksToRemove.has(task)) {\n task();\n }\n }\n processing = false;\n removeTasks();\n queueProcessing();\n}\n\nfunction queueProcessing() {\n if (!requestId && tasks.length) {\n requestId = requestAnimationFrame(processTasks);\n }\n}\n\nexport function addTask(fn) {\n tasks.push(fn);\n queueProcessing();\n}\n\nexport function removeTask(fn) {\n tasksToRemove.set(fn);\n\n const ndx = tasks.indexOf(fn);\n if (ndx >= 0) {\n tasks.splice(ndx, 1);\n }\n}","let id = 0;\n\nexport function makeId() {\n return `muigui-${++id}`;\n}\n","import { createElem } from '../libs/elem.js';\nimport View from './View.js';\n\nexport default class ValueView extends View {\n constructor(className = '') {\n super(createElem('div', {className: 'muigui-value'}));\n if (className) {\n this.domElement.classList.add(className);\n }\n }\n}","import { createElem } from '../libs/elem.js';\nimport { makeId } from '../libs/ids.js';\nimport ValueView from '../views/ValueView.js';\nimport Controller from './Controller.js';\n\nexport default class LabelController extends Controller {\n #id;\n #nameElem;\n\n constructor(className = '', name = '') {\n super('muigui-label-controller');\n this.#id = makeId();\n this.#nameElem = createElem('label', {for: this.#id});\n this.domElement.appendChild(this.#nameElem);\n this.pushSubView(new ValueView(className));\n this.name(name);\n }\n get id() {\n return this.#id;\n }\n name(name) {\n if (this.#nameElem.title === this.#nameElem.textContent) {\n this.#nameElem.title = name;\n }\n this.#nameElem.textContent = name;\n return this;\n }\n tooltip(tip) {\n this.#nameElem.title = tip;\n }\n}\n\n","import {addTask, removeTask} from '../libs/taskrunner.js';\nimport { isTypedArray } from '../libs/utils.js';\nimport LabelController from './LabelController.js';\n\nexport default class ValueController extends LabelController {\n #object;\n #property;\n #initialValue;\n #listening;\n #views;\n #updateFn;\n\n constructor(object, property, className = '') {\n super(className, property);\n this.#object = object;\n this.#property = property;\n this.#initialValue = this.getValue();\n this.#listening = false;\n this.#views = [];\n }\n get initialValue() {\n return this.#initialValue;\n }\n get object() {\n return this.#object;\n }\n get property() {\n return this.#property;\n }\n add(view) {\n this.#views.push(view);\n super.add(view);\n this.updateDisplay();\n return view;\n }\n #setValueImpl(v, ignoreCache) {\n let isDifferent = false;\n if (typeof v === 'object') {\n const dst = this.#object[this.#property];\n // don't replace objects, just their values.\n if (Array.isArray(v) || isTypedArray(v)) {\n for (let i = 0; i < v.length; ++i) {\n isDifferent ||= dst[i] !== v[i];\n dst[i] = v[i];\n }\n } else {\n for (const key of Object.keys(v)) {\n isDifferent ||= dst[key] !== v[key];\n }\n Object.assign(dst, v);\n }\n } else {\n isDifferent = this.#object[this.#property] !== v;\n this.#object[this.#property] = v;\n }\n this.updateDisplay(ignoreCache);\n if (isDifferent) {\n this.emitChange(this.getValue(), this.#object, this.#property);\n }\n return isDifferent;\n }\n setValue(v) {\n this.#setValueImpl(v);\n }\n setFinalValue(v) {\n const isDifferent = this.#setValueImpl(v, true);\n if (isDifferent) {\n this.emitFinalChange(this.getValue(), this.#object, this.#property);\n }\n return this;\n }\n updateDisplay(ignoreCache) {\n const newV = this.getValue();\n for (const view of this.#views) {\n view.updateDisplayIfNeeded(newV, ignoreCache);\n }\n return this;\n }\n setOptions(options) {\n for (const view of this.#views) {\n view.setOptions(options);\n }\n this.updateDisplay();\n return this;\n }\n getValue() {\n return this.#object[this.#property];\n }\n value(v) {\n this.setValue(v);\n return this;\n }\n reset() {\n this.setValue(this.#initialValue);\n return this;\n }\n listen(listen = true) {\n if (!this.#updateFn) {\n this.#updateFn = this.updateDisplay.bind(this);\n }\n if (listen) {\n if (!this.#listening) {\n this.#listening = true;\n addTask(this.#updateFn);\n }\n } else {\n if (this.#listening) {\n this.#listening = false;\n removeTask(this.#updateFn);\n }\n }\n return this;\n }\n}\n\n","import CheckboxView from '../views/CheckboxView.js';\nimport ValueController from './ValueController.js';\n\nexport default class Checkbox extends ValueController {\n constructor(object, property) {\n super(object, property, 'muigui-checkbox');\n const id = this.id;\n this.add(new CheckboxView(this, id));\n this.updateDisplay();\n }\n}","import {\n makeRangeConverters,\n} from './utils.js';\n\nexport const identity = {\n to: v => v,\n from: v => [true, v],\n};\n\n// from: from string to value\n// to: from value to string\nexport const strToNumber = {\n to: v => v.toString(),\n from: v => {\n const newV = parseFloat(v);\n return [!Number.isNaN(newV), newV];\n },\n};\n\nexport const converters = {\n radToDeg: makeRangeConverters({to: [0, 180], from: [0, Math.PI]}),\n};\n","export function createWheelHelper() {\n let wheelAccum = 0;\n return function (e, step, wheelScale = 5) {\n wheelAccum -= e.deltaY * step / wheelScale;\n const wheelSteps = Math.floor(Math.abs(wheelAccum) / step) * Math.sign(wheelAccum);\n const delta = wheelSteps * step;\n wheelAccum -= delta;\n return delta;\n };\n}\n","import { createElem } from '../libs/elem.js';\nimport { strToNumber } from '../libs/conversions.js';\nimport { createWheelHelper } from '../libs/wheel.js';\nimport { clamp, copyExistingProperties, stepify } from '../libs/utils.js';\nimport EditView from './EditView.js';\n\nexport default class NumberView extends EditView {\n #to;\n #from;\n #step;\n #skipUpdate;\n #options = {\n step: 0.01,\n converters: strToNumber,\n min: Number.NEGATIVE_INFINITY,\n max: Number.POSITIVE_INFINITY,\n };\n\n constructor(setter, options) {\n const setValue = setter.setValue.bind(setter);\n const setFinalValue = setter.setFinalValue.bind(setter);\n const wheelHelper = createWheelHelper();\n super(createElem('input', {\n type: 'number',\n onInput: () => this.#handleInput(setValue, true),\n onChange: () => this.#handleInput(setFinalValue, false),\n onWheel: e => {\n e.preventDefault();\n const {min, max, step} = this.#options;\n const delta = wheelHelper(e, step);\n const v = parseFloat(this.domElement.value);\n const newV = clamp(stepify(v + delta, v => v, step), min, max);\n setter.setValue(newV);\n },\n }));\n this.setOptions(options);\n }\n #handleInput(setFn, skipUpdate) {\n const v = parseFloat(this.domElement.value);\n const [valid, newV] = this.#from(v);\n let inRange;\n if (valid && !Number.isNaN(v)) {\n const {min, max} = this.#options;\n inRange = newV >= min && newV <= max;\n this.#skipUpdate = skipUpdate;\n setFn(clamp(newV, min, max));\n }\n this.domElement.classList.toggle('muigui-invalid-value', !valid || !inRange);\n }\n updateDisplay(v) {\n if (!this.#skipUpdate) {\n this.domElement.value = stepify(v, this.#to, this.#step);\n }\n this.#skipUpdate = false;\n }\n setOptions(options) {\n copyExistingProperties(this.#options, options);\n const {\n step,\n converters: {to, from},\n } = this.#options;\n this.#to = to;\n this.#from = from;\n this.#step = step;\n return this;\n }\n}\n","\nimport NumberView from '../views/NumberView.js';\nimport ValueController from './ValueController.js';\n\n// Wanted to name this `Number` but it conflicts with\n// JavaScript `Number`. It most likely wouldn't be\n// an issue? But users might `import {Number} ...` and\n// things would break.\nexport default class TextNumber extends ValueController {\n #textView;\n #step;\n\n constructor(object, property, options = {}) {\n super(object, property, 'muigui-checkbox');\n this.#textView = this.add(new NumberView(this, options));\n this.updateDisplay();\n }\n}","import { createElem } from '../libs/elem.js';\nimport EditView from './EditView.js';\n\nexport default class SelectView extends EditView {\n #values;\n\n constructor(setter, keyValues) {\n const values = [];\n super(createElem('select', {\n onChange: () => {\n setter.setFinalValue(this.#values[this.domElement.selectedIndex]);\n },\n }, keyValues.map(([key, value]) => {\n values.push(value);\n return createElem('option', {textContent: key});\n })));\n this.#values = values;\n }\n updateDisplay(v) {\n const ndx = this.#values.indexOf(v);\n this.domElement.selectedIndex = ndx;\n }\n}\n","\n// 4 cases\n// (a) keyValues is array of arrays, each sub array is key value\n// (b) keyValues is array and value is number then keys = array contents, value = index\n// (c) keyValues is array and value is not number, key = array contents, value = array contents\n// (d) keyValues is object then key->value\nexport function convertToKeyValues(keyValues, valueIsNumber) {\n if (Array.isArray(keyValues)) {\n if (Array.isArray(keyValues[0])) {\n // (a) keyValues is array of arrays, each sub array is key value\n return keyValues;\n } else {\n if (valueIsNumber) {\n // (b) keyValues is array and value is number then keys = array contents, value = index\n return keyValues.map((v, ndx) => [v, ndx]);\n } else {\n // (c) keyValues is array and value is not number, key = array contents, value = array contents\n return keyValues.map(v => [v, v]);\n }\n }\n } else {\n // (d)\n return [...Object.entries(keyValues)];\n }\n}\n","import SelectView from '../views/SelectView.js';\nimport ValueController from './ValueController.js';\nimport { convertToKeyValues } from '../libs/key-values.js';\n\nexport default class Select extends ValueController {\n constructor(object, property, options) {\n super(object, property, 'muigui-select');\n const valueIsNumber = typeof this.getValue() === 'number';\n const {keyValues: keyValuesInput} = options;\n const keyValues = convertToKeyValues(keyValuesInput, valueIsNumber);\n this.add(new SelectView(this, keyValues));\n this.updateDisplay();\n }\n}","import { createElem } from '../libs/elem.js';\nimport { identity } from '../libs/conversions.js';\nimport { clamp, copyExistingProperties, stepify } from '../libs/utils.js';\nimport { createWheelHelper } from '../libs/wheel.js';\nimport EditView from './EditView.js';\n\nexport default class RangeView extends EditView {\n #to;\n #from;\n #step;\n #skipUpdate;\n #options = {\n step: 0.01,\n min: 0,\n max: 1,\n converters: identity,\n };\n\n constructor(setter, options) {\n const wheelHelper = createWheelHelper();\n super(createElem('input', {\n type: 'range',\n onInput: () => {\n this.#skipUpdate = true;\n const {min, max, step} = this.#options;\n const v = parseFloat(this.domElement.value);\n const newV = clamp(stepify(v, v => v, step), min, max);\n const [valid, validV] = this.#from(newV);\n if (valid) {\n setter.setValue(validV);\n }\n },\n onChange: () => {\n this.#skipUpdate = true;\n const {min, max, step} = this.#options;\n const v = parseFloat(this.domElement.value);\n const newV = clamp(stepify(v, v => v, step), min, max);\n const [valid, validV] = this.#from(newV);\n if (valid) {\n setter.setFinalValue(validV);\n }\n },\n onWheel: e => {\n e.preventDefault();\n const [valid, v] = this.#from(parseFloat(this.domElement.value));\n if (!valid) {\n return;\n }\n const {min, max, step} = this.#options;\n const delta = wheelHelper(e, step);\n const newV = clamp(stepify(v + delta, v => v, step), min, max);\n setter.setValue(newV);\n },\n }));\n this.setOptions(options);\n }\n updateDisplay(v) {\n if (!this.#skipUpdate) {\n this.domElement.value = stepify(v, this.#to, this.#step);\n }\n this.#skipUpdate = false;\n }\n setOptions(options) {\n copyExistingProperties(this.#options, options);\n const {\n step,\n min,\n max,\n converters: {to, from},\n } = this.#options;\n this.#to = to;\n this.#from = from;\n this.#step = step;\n this.domElement.step = step;\n this.domElement.min = min;\n this.domElement.max = max;\n return this;\n }\n}","import ValueController from './ValueController.js';\nimport NumberView from '../views/NumberView.js';\nimport RangeView from '../views/RangeView.js';\n\nexport default class Range extends ValueController {\n constructor(object, property, options) {\n super(object, property, 'muigui-range');\n this.add(new RangeView(this, options));\n this.add(new NumberView(this, options));\n }\n}\n","import { createElem } from '../libs/elem.js';\nimport { identity } from '../libs/conversions.js';\nimport EditView from './EditView.js';\nimport { copyExistingProperties } from '../libs/utils.js';\n\nexport default class TextView extends EditView {\n #to;\n #from;\n #skipUpdate;\n #options = {\n converters: identity,\n };\n\n constructor(setter, options) {\n const setValue = setter.setValue.bind(setter);\n const setFinalValue = setter.setFinalValue.bind(setter);\n super(createElem('input', {\n type: 'text',\n onInput: () => this.#handleInput(setValue, true),\n onChange: () => this.#handleInput(setFinalValue, false),\n }));\n this.setOptions(options);\n }\n #handleInput(setFn, skipUpdate) {\n const [valid, newV] = this.#from(this.domElement.value);\n if (valid) {\n this.#skipUpdate = skipUpdate;\n setFn(newV);\n }\n this.domElement.style.color = valid ? '' : 'var(--invalid-color)';\n\n }\n updateDisplay(v) {\n if (!this.#skipUpdate) {\n this.domElement.value = this.#to(v);\n this.domElement.style.color = '';\n }\n this.#skipUpdate = false;\n }\n setOptions(options) {\n copyExistingProperties(this.#options, options);\n const {\n converters: {to, from},\n } = this.#options;\n this.#to = to;\n this.#from = from;\n return this;\n }\n}\n","import TextView from '../views/TextView.js';\nimport ValueController from './ValueController.js';\n\nexport default class Text extends ValueController {\n constructor(object, property) {\n super(object, property, 'muigui-checkbox');\n this.add(new TextView(this));\n this.updateDisplay();\n }\n}","const clamp = (v, min, max) => Math.max(min, Math.min(max, v));\nconst lerp = (a, b, t) => a + (b - a) * t;\nconst fract = v => v >= 0 ? v % 1 : 1 - (v % 1);\n\nconst f0 = v => +v.toFixed(0); // converts to string (eg 1.2 => \"1\"), then converts back to number (eg, \"1.200\" => 1.2)\nconst f3 = v => +v.toFixed(3); // converts to string (eg 1.2 => \"1.200\"), then converts back to number (eg, \"1.200\" => 1.2)\n\nconst hexToUint32RGB = v => (parseInt(v.substring(1, 3), 16) << 16) |\n (parseInt(v.substring(3, 5), 16) << 8 ) |\n (parseInt(v.substring(5, 7), 16) );\nconst uint32RGBToHex = v => `#${(Math.round(v)).toString(16).padStart(6, '0')}`;\nconst hexToUint32RGBA = v => (parseInt(v.substring(1, 3), 16) * 2 ** 24) +\n (parseInt(v.substring(3, 5), 16) * 2 ** 16) +\n (parseInt(v.substring(5, 7), 16) * 2 ** 8) +\n (parseInt(v.substring(7, 9), 16) );\nconst uint32RGBAToHex = v => `#${(Math.round(v)).toString(16).padStart(8, '0')}`;\n\nexport const hexToUint8RGB = v => [\n parseInt(v.substring(1, 3), 16),\n parseInt(v.substring(3, 5), 16),\n parseInt(v.substring(5, 7), 16),\n];\nexport const uint8RGBToHex = v => `#${Array.from(v).map(v => v.toString(16).padStart(2, '0')).join('')}`;\n\nexport const hexToUint8RGBA = v => [\n parseInt(v.substring(1, 3), 16),\n parseInt(v.substring(3, 5), 16),\n parseInt(v.substring(5, 7), 16),\n parseInt(v.substring(7, 9), 16),\n];\nexport const uint8RGBAToHex = v => `#${Array.from(v).map(v => v.toString(16).padStart(2, '0')).join('')}`;\n\nexport const hexToFloatRGB = v => hexToUint8RGB(v).map(v => f3(v / 255));\nexport const floatRGBToHex = v => uint8RGBToHex(Array.from(v).map(v => Math.round(clamp(v * 255, 0, 255))));\n\nexport const hexToFloatRGBA = v => hexToUint8RGBA(v).map(v => f3(v / 255));\nexport const floatRGBAToHex = v => uint8RGBAToHex(Array.from(v).map(v => Math.round(clamp(v * 255, 0, 255))));\n\nconst scaleAndClamp = v => clamp(Math.round(v * 255), 0, 255).toString(16).padStart(2, '0');\n\nconst hexToObjectRGB = v => ({\n r: parseInt(v.substring(1, 3), 16) / 255,\n g: parseInt(v.substring(3, 5), 16) / 255,\n b: parseInt(v.substring(5, 7), 16) / 255,\n});\nconst objectRGBToHex = v => `#${scaleAndClamp(v.r)}${scaleAndClamp(v.g)}${scaleAndClamp(v.b)}`;\nconst hexToObjectRGBA = v => ({\n r: parseInt(v.substring(1, 3), 16) / 255,\n g: parseInt(v.substring(3, 5), 16) / 255,\n b: parseInt(v.substring(5, 7), 16) / 255,\n a: parseInt(v.substring(7, 9), 16) / 255,\n});\nconst objectRGBAToHex = v => `#${scaleAndClamp(v.r)}${scaleAndClamp(v.g)}${scaleAndClamp(v.b)}${scaleAndClamp(v.a)}`;\n\nconst hexToCssRGB = v => `rgb(${hexToUint8RGB(v).join(', ')})`;\nconst cssRGBRegex = /^\\s*rgb\\(\\s*(\\d+)\\s*,\\s*(\\d+)\\s*,\\s*(\\d+)\\s*\\)\\s*$/;\nconst cssRGBToHex = v => {\n const m = cssRGBRegex.exec(v);\n return uint8RGBToHex([m[1], m[2], m[3]].map(v => parseInt(v)));\n};\nconst hexToCssRGBA = v => `rgba(${hexToUint8RGBA(v).map((v, i) => i === 3 ? v / 255 : v).join(', ')})`;\nconst cssRGBARegex = /^\\s*rgba\\(\\s*(\\d+)\\s*,\\s*(\\d+)\\s*,\\s*(\\d+)\\s*,\\s*(\\d+\\.\\d+|\\d+)\\s*\\)\\s*$/;\nconst cssRGBAToHex = v => {\n const m = cssRGBARegex.exec(v);\n return uint8RGBAToHex([m[1], m[2], m[3], m[4]].map((v, i) => i === 3 ? (parseFloat(v) * 255 | 0) : parseInt(v)));\n};\n\nconst hexToCssHSL = v => {\n const hsl = rgbUint8ToHsl(hexToUint8RGB(v)).map(v => f0(v));\n return `hsl(${hsl[0]}, ${hsl[1]}%, ${hsl[2]}%)`;\n};\nconst hexToCssHSLA = v => {\n const hsla = rgbaUint8ToHsla(hexToUint8RGBA(v)).map((v, i) => i === 3 ? f3(v) : f0(v));\n return `hsl(${hsla[0]} ${hsla[1]}% ${hsla[2]}% / ${hsla[3]})`;\n};\nconst cssHSLRegex = /^\\s*hsl\\(\\s*(\\d+)(?:deg|)\\s*(?:,|)\\s*(\\d+)%\\s*(?:,|)\\s*(\\d+)%\\s*\\)\\s*$/;\nconst cssHSLARegex = /^\\s*hsl\\(\\s*(\\d+)(?:deg|)\\s*(?:,|)\\s*(\\d+)%\\s*(?:,|)\\s*(\\d+)%\\s*\\/\\s*(\\d+\\.\\d+|\\d+)\\s*\\)\\s*$/;\n\nconst hex3DigitTo6Digit = v => `${v[0]}${v[0]}${v[1]}${v[1]}${v[2]}${v[2]}`;\nconst cssHSLToHex = v => {\n const m = cssHSLRegex.exec(v);\n const rgb = hslToRgbUint8([m[1], m[2], m[3]].map(v => parseFloat(v)));\n return uint8RGBToHex(rgb);\n};\nconst cssHSLAToHex = v => {\n const m = cssHSLARegex.exec(v);\n const rgba = hslaToRgbaUint8([m[1], m[2], m[3], m[4]].map(v => parseFloat(v)));\n return uint8RGBAToHex(rgba);\n};\n\nconst euclideanModulo = (v, n) => ((v % n) + n) % n;\n\nexport function hslToRgbUint8([h, s, l]) {\n h = euclideanModulo(h, 360);\n s = clamp(s / 100, 0, 1);\n l = clamp(l / 100, 0, 1);\n\n const a = s * Math.min(l, 1 - l);\n\n function f(n) {\n const k = (n + h / 30) % 12;\n return l - a * Math.max(-1, Math.min(k - 3, 9 - k, 1));\n }\n\n return [f(0), f(8), f(4)].map(v => Math.round(v * 255));\n}\n\nexport function hslaToRgbaUint8([h, s, l, a]) {\n const rgb = hslToRgbUint8([h, s, l]);\n return [...rgb, a * 255 | 0];\n}\n\nexport function rgbFloatToHsl01([r, g, b]) {\n const max = Math.max(r, g, b);\n const min = Math.min(r, g, b);\n const l = (min + max) * 0.5;\n const d = max - min;\n let h = 0;\n let s = 0;\n\n if (d !== 0) {\n s = (l === 0 || l === 1)\n ? 0\n : (max - l) / Math.min(l, 1 - l);\n\n switch (max) {\n case r: h = (g - b) / d + (g < b ? 6 : 0); break;\n case g: h = (b - r) / d + 2; break;\n case b: h = (r - g) / d + 4;\n }\n }\n\n return [h / 6, s, l];\n}\n\nexport function rgbaFloatToHsla01([r, g, b, a]) {\n const hsl = rgbFloatToHsl01([r, g, b]);\n return [...hsl, a];\n}\n\nexport const rgbUint8ToHsl = (rgb) => {\n const [h, s, l] = rgbFloatToHsl01(rgb.map(v => v / 255));\n return [h * 360, s * 100, l * 100];\n};\n\nexport const rgbaUint8ToHsla = (rgba) => {\n const [h, s, l, a] = rgbaFloatToHsla01(rgba.map(v => v / 255));\n return [h * 360, s * 100, l * 100, a];\n};\n\nexport function hsv01ToRGBFloat([hue, sat, val]) {\n sat = clamp(sat, 0, 1);\n val = clamp(val, 0, 1);\n return [hue, hue + 2 / 3, hue + 1 / 3].map(\n v => lerp(1, clamp(Math.abs(fract(v) * 6 - 3.0) - 1, 0, 1), sat) * val\n );\n}\n\nexport function hsva01ToRGBAFloat([hue, sat, val, alpha]) {\n const rgb = hsv01ToRGBFloat([hue, sat, val]);\n return [...rgb, alpha];\n}\n\nconst round3 = v => Math.round(v * 1000) / 1000;\n\nexport function rgbFloatToHSV01([r, g, b]) {\n const p = b > g\n ? [b, g, -1, 2 / 3]\n : [g, b, 0, -1 / 3];\n const q = p[0] > r\n ? [p[0], p[1], p[3], r]\n : [r, p[1], p[2], p[0]];\n const d = q[0] - Math.min(q[3], q[1]);\n return [\n Math.abs(q[2] + (q[3] - q[1]) / (6 * d + Number.EPSILON)),\n d / (q[0] + Number.EPSILON),\n q[0],\n ].map(round3);\n}\n\nexport function rgbaFloatToHSVA01([r, g, b, a]) {\n const hsv = rgbFloatToHSV01([r, g, b]);\n return [...hsv, a];\n}\n\n// window.hsv01ToRGBFloat = hsv01ToRGBFloat;\n// window.rgbFloatToHSV01 = rgbFloatToHSV01;\n\n// Yea, meh!\nexport const hasAlpha = format => format.endsWith('a') || format.startsWith('hex8');\n\nconst cssStringFormats = [\n { re: /^#(?:[0-9a-f]){6}$/i, format: 'hex6' },\n { re: /^(?:[0-9a-f]){6}$/i, format: 'hex6-no-hash' },\n { re: /^#(?:[0-9a-f]){8}$/i, format: 'hex8' },\n { re: /^(?:[0-9a-f]){8}$/i, format: 'hex8-no-hash' },\n { re: /^#(?:[0-9a-f]){3}$/i, format: 'hex3' },\n { re: /^(?:[0-9a-f]){3}$/i, format: 'hex3-no-hash' },\n { re: cssRGBRegex, format: 'css-rgb' },\n { re: cssHSLRegex, format: 'css-hsl' },\n { re: cssRGBARegex, format: 'css-rgba' },\n { re: cssHSLARegex, format: 'css-hsla' },\n];\n\nfunction guessStringColorFormat(v) {\n for (const formatInfo of cssStringFormats) {\n if (formatInfo.re.test(v)) {\n return formatInfo;\n }\n }\n return undefined;\n}\n\nexport function guessFormat(v) {\n switch (typeof v) {\n case 'number':\n console.warn('can not reliably guess format based on a number. You should pass in a format like {format: \"uint32-rgb\"} or {format: \"uint32-rgb\"}');\n return v <= 0xFFFFFF ? 'uint32-rgb' : 'uint32-rgba';\n case 'string': {\n const formatInfo = guessStringColorFormat(v.trim());\n if (formatInfo) {\n return formatInfo.format;\n }\n break;\n }\n case 'object':\n if (v instanceof Uint8Array || v instanceof Uint8ClampedArray) {\n if (v.length === 3) {\n return 'uint8-rgb';\n } else if (v.length === 4) {\n return 'uint8-rgba';\n }\n } else if (v instanceof Float32Array) {\n if (v.length === 3) {\n return 'float-rgb';\n } else if (v.length === 4) {\n return 'float-rgba';\n }\n } else if (Array.isArray(v)) {\n if (v.length === 3) {\n return 'float-rgb';\n } else if (v.length === 4) {\n return 'float-rgba';\n }\n } else {\n if ('r' in v && 'g' in v && 'b' in v) {\n if ('a' in v) {\n return 'object-rgba';\n } else {\n return 'object-rgb';\n }\n }\n }\n }\n throw new Error(`unknown color format: ${v}`);\n}\n\nfunction fixHex6(v) {\n return v.trim(v);\n //const formatInfo = guessStringColorFormat(v.trim());\n //const fix = formatInfo ? formatInfo.fix : v => v;\n //return fix(v.trim());\n}\n\nfunction fixHex8(v) {\n return v.trim(v);\n //const formatInfo = guessStringColorFormat(v.trim());\n //const fix = formatInfo ? formatInfo.fix : v => v;\n //return fix(v.trim());\n}\n\nfunction hex6ToHex3(hex6) {\n return (hex6[1] === hex6[2] &&\n hex6[3] === hex6[4] &&\n hex6[5] === hex6[6])\n ? `#${hex6[1]}${hex6[3]}${hex6[5]}`\n : hex6;\n}\n\nconst hex3RE = /^(#|)([0-9a-f]{3})$/i;\nfunction hex3ToHex6(hex3) {\n const m = hex3RE.exec(hex3);\n if (m) {\n const [, , m2] = m;\n return `#${hex3DigitTo6Digit(m2)}`;\n }\n return hex3;\n}\n\nfunction fixHex3(v) {\n return hex6ToHex3(fixHex6(v));\n}\n\nconst strToRGBObject = (s) => {\n try {\n const json = s.replace(/([a-z])/g, '\"$1\"');\n const rgb = JSON.parse(json);\n if (Number.isNaN(rgb.r) || Number.isNaN(rgb.g) || Number.isNaN(rgb.b)) {\n throw new Error('not {r, g, b}');\n }\n return [true, rgb];\n } catch (e) {\n return [false];\n }\n};\n\nconst strToRGBAObject = (s) => {\n try {\n const json = s.replace(/([a-z])/g, '\"$1\"');\n const rgba = JSON.parse(json);\n if (Number.isNaN(rgba.r) || Number.isNaN(rgba.g) || Number.isNaN(rgba.b) || Number.isNaN(rgba.a)) {\n throw new Error('not {r, g, b, a}');\n }\n return [true, rgba];\n } catch (e) {\n return [false];\n }\n};\n\nconst strToCssRGB = s => {\n const m = cssRGBRegex.exec(s);\n if (!m) {\n return [false];\n }\n const v = [m[1], m[2], m[3]].map(v => parseInt(v));\n const outOfRange = v.find(v => v > 255);\n return [!outOfRange, `rgb(${v.join(', ')})`];\n};\n\nconst strToCssRGBA = s => {\n const m = cssRGBARegex.exec(s);\n if (!m) {\n return [false];\n }\n const v = [m[1], m[2], m[3], m[4]].map((v, i) => i === 3 ? parseFloat(v) : parseInt(v));\n const outOfRange = v.find(v => v > 255);\n return [!outOfRange, `rgba(${v.join(', ')})`];\n};\n\nconst strToCssHSL = s => {\n const m = cssHSLRegex.exec(s);\n if (!m) {\n return [false];\n }\n const v = [m[1], m[2], m[3]].map(v => parseFloat(v));\n const outOfRange = v.find(v => Number.isNaN(v));\n return [!outOfRange, `hsl(${v[0]}, ${v[1]}%, ${v[2]}%)`];\n};\n\nconst strToCssHSLA = s => {\n const m = cssHSLARegex.exec(s);\n if (!m) {\n return [false];\n }\n const v = [m[1], m[2], m[3], m[4]].map(v => parseFloat(v));\n const outOfRange = v.find(v => Number.isNaN(v));\n return [!outOfRange, `hsl(${v[0]} ${v[1]}% ${v[2]}% / ${v[3]})`];\n};\n\nconst rgbObjectToStr = rgb => {\n return `{r:${f3(rgb.r)}, g:${f3(rgb.g)}, b:${f3(rgb.b)}}`;\n};\nconst rgbaObjectToStr = rgba => {\n return `{r:${f3(rgba.r)}, g:${f3(rgba.g)}, b:${f3(rgba.b)}}, a:${f3(rgba.a)}}`;\n};\n\nconst strTo3IntsRE = /^\\s*(\\d+)\\s*,\\s*(\\d+)\\s*,\\s*(\\d+)\\s*$/;\nconst strTo3Ints = s => {\n const m = strTo3IntsRE.exec(s);\n if (!m) {\n return [false];\n }\n const v = [m[1], m[2], m[3]].map(v => parseInt(v));\n const outOfRange = v.find(v => v > 255);\n return [!outOfRange, v];\n};\n\nconst strTo4IntsRE = /^\\s*(\\d+)\\s*,\\s*(\\d+)\\s*,\\s*(\\d+)\\s*$/;\nconst strTo4Ints = s => {\n const m = strTo4IntsRE.exec(s);\n if (!m) {\n return [false];\n }\n const v = [m[1], m[2], m[3], m[4]].map(v => parseInt(v));\n const outOfRange = v.find(v => v > 255);\n return [!outOfRange, v];\n};\n\nconst strTo3Floats = s => {\n const numbers = s.split(',').map(s => s.trim());\n const v = numbers.map(v => parseFloat(v));\n if (v.length !== 3) {\n return [false];\n }\n // Note: using isNaN not Number.isNaN\n const badNdx = numbers.findIndex(v => isNaN(v));\n return [badNdx < 0, v.map(v => f3(v))];\n};\n\nconst strTo4Floats = s => {\n const numbers = s.split(',').map(s => s.trim());\n const v = numbers.map(v => parseFloat(v));\n if (v.length !== 4) {\n return [false];\n }\n // Note: using isNaN not Number.isNaN\n const badNdx = numbers.findIndex(v => isNaN(v));\n return [badNdx < 0, v.map(v => f3(v))];\n};\n\nconst strToUint32RGBRegex = /^\\s*(?:0x){0,1}([0-9a-z]{1,6})\\s*$/i;\nconst strToUint32RGB = s => {\n const m = strToUint32RGBRegex.exec(s);\n if (!m) {\n return [false];\n }\n return [true, parseInt(m[1], 16)];\n};\n\nconst strToUint32RGBARegex = /^\\s*(?:0x){0,1}([0-9a-z]{1,8})\\s*$/i;\nconst strToUint32RGBA = s => {\n const m = strToUint32RGBARegex.exec(s);\n if (!m) {\n return [false];\n }\n return [true, parseInt(m[1], 16)];\n};\n\nconst hex6RE = /^\\s*#[a-f0-9]{6}\\s*$|^\\s*#[a-f0-9]{3}\\s*$/i;\nconst hexNoHash6RE = /^\\s*[a-f0-9]{6}\\s*$/i;\nconst hex8RE = /^\\s*#[a-f0-9]{8}\\s*$/i;\nconst hexNoHash8RE = /^\\s*[a-f0-9]{8}\\s*$/i;\n\n// For each format converter\n//\n// fromHex/toHex convert from/to '#RRGGBB'\n//\n// fromHex converts from the string '#RRBBGG' to the format\n// (eg: for uint32-rgb, '#123456' becomes 0x123456)\n//\n// toHex converts from the format to '#RRGGBB'\n// (eg: for uint8-rgb, [16, 33, 50] becomes '#102132')\n//\n//\n// fromStr/toStr convert from/to what's in the input[type=text] element\n//\n// toStr converts from the format to its string representation\n// (eg, for object-rgb, {r: 1, g: 0.5, b:0} becomes \"{r: 1, g: 0.5, b:0}\")\n// ^object ^string\n//\n// fromStr converts its string representation to its format\n// (eg, for object-rgb) \"{r: 1, g: 0.5, b:0}\" becomes {r: 1, g: 0.5, b:0})\n// ^string ^object\n// fromString returns an array which is [valid, v]\n// where valid is true if the string was a valid and v is the converted\n// format if v is true.\n//\n// Note: toStr should convert to \"ideal\" form (whatever that is).\n// (eg, for css-rgb\n// \"{ r: 0.10000, g: 001, b: 0}\" becomes \"{r: 0.1, g: 1, b: 0}\"\n// notice that css-rgb is a string to a string\n// )\nexport const colorFormatConverters = {\n 'hex6': {\n color: {\n from: v => [true, v],\n to: fixHex6,\n },\n text: {\n from: v => [hex6RE.test(v), v.trim()],\n to: v => v,\n },\n },\n 'hex8': {\n color: {\n from: v => [true, v],\n to: fixHex8,\n },\n text: {\n from: v => [hex8RE.test(v), v.trim()],\n to: v => v,\n },\n },\n 'hex3': {\n color: {\n from: v => [true, fixHex3(v)],\n to: hex3ToHex6,\n },\n text: {\n from: v => [hex6RE.test(v), hex6ToHex3(v.trim())],\n to: v => v,\n },\n },\n 'hex6-no-hash': {\n color: {\n from: v => [true, v.substring(1)],\n to: v => `#${fixHex6(v)}`,\n },\n text: {\n from: v => [hexNoHash6RE.test(v), v.trim()],\n to: v => v,\n },\n },\n 'hex8-no-hash': {\n color: {\n from: v => [true, v.substring(1)],\n to: v => `#${fixHex8(v)}`,\n },\n text: {\n from: v => [hexNoHash8RE.test(v), v.trim()],\n to: v => v,\n },\n },\n 'hex3-no-hash': {\n color: {\n from: v => [true, fixHex3(v).substring(1)],\n to: hex3ToHex6,\n },\n text: {\n from: v => [hexNoHash6RE.test(v), hex6ToHex3(v.trim())],\n to: v => v,\n },\n },\n 'uint32-rgb': {\n color: {\n from: v => [true, hexToUint32RGB(v)],\n to: uint32RGBToHex,\n },\n text: {\n from: v => strToUint32RGB(v),\n to: v => `0x${v.toString(16).padStart(6, '0')}`,\n },\n },\n 'uint32-rgba': {\n color: {\n from: v => [true, hexToUint32RGBA(v)],\n to: uint32RGBAToHex,\n },\n text: {\n from: v => strToUint32RGBA(v),\n to: v => `0x${v.toString(16).padStart(8, '0')}`,\n },\n },\n 'uint8-rgb': {\n color: {\n from: v => [true, hexToUint8RGB(v)],\n to: uint8RGBToHex,\n },\n text: {\n from: strTo3Ints,\n to: v => v.join(', '),\n },\n },\n 'uint8-rgba': {\n color: {\n from: v => [true, hexToUint8RGBA(v)],\n to: uint8RGBAToHex,\n },\n text: {\n from: strTo4Ints,\n to: v => v.join(', '),\n },\n },\n 'float-rgb': {\n color: {\n from: v => [true, hexToFloatRGB(v)],\n to: floatRGBToHex,\n },\n text: {\n from: strTo3Floats,\n // need Array.from because map of Float32Array makes a Float32Array\n to: v => Array.from(v).map(v => f3(v)).join(', '),\n },\n },\n 'float-rgba': {\n color: {\n from: v => [true, hexToFloatRGBA(v)],\n to: floatRGBAToHex,\n },\n text: {\n from: strTo4Floats,\n // need Array.from because map of Float32Array makes a Float32Array\n to: v => Array.from(v).map(v => f3(v)).join(', '),\n },\n },\n 'object-rgb': {\n color: {\n from: v => [true, hexToObjectRGB(v)],\n to: objectRGBToHex,\n },\n text: {\n from: strToRGBObject,\n to: rgbObjectToStr,\n },\n },\n 'object-rgba': {\n color: {\n from: v => [true, hexToObjectRGBA(v)],\n to: objectRGBAToHex,\n },\n text: {\n from: strToRGBAObject,\n to: rgbaObjectToStr,\n },\n },\n 'css-rgb': {\n color: {\n from: v => [true, hexToCssRGB(v)],\n to: cssRGBToHex,\n },\n text: {\n from: strToCssRGB,\n to: v => strToCssRGB(v)[1],\n },\n },\n 'css-rgba': {\n color: {\n from: v => [true, hexToCssRGBA(v)],\n to: cssRGBAToHex,\n },\n text: {\n from: strToCssRGBA,\n to: v => strToCssRGBA(v)[1],\n },\n },\n 'css-hsl': {\n color: {\n from: v => [true, hexToCssHSL(v)],\n to: cssHSLToHex,\n },\n text: {\n from: strToCssHSL,\n to: v => strToCssHSL(v)[1],\n },\n },\n 'css-hsla': {\n color: {\n from: v => [true, hexToCssHSLA(v)],\n to: cssHSLAToHex,\n },\n text: {\n from: strToCssHSLA,\n to: v => strToCssHSLA(v)[1],\n },\n },\n};","import { createElem } from '../libs/elem.js';\nimport View from './View.js';\n\nexport default class ElementView extends View {\n constructor(tag, className) {\n super(createElem(tag, {className}));\n }\n}","import ElementView from '../views/ElementView.js';\nimport LabelController from './LabelController.js';\n\n// TODO: remove this? Should just be user side\nexport default class Canvas extends LabelController {\n #canvasElem;\n\n constructor() {\n super('muigui-canvas');\n this.#canvasElem = this.add(\n new ElementView('canvas', 'muigui-canvas'),\n ).domElement;\n }\n get canvas() {\n return this.#canvasElem;\n }\n}","import { createElem } from '../libs/elem.js';\nimport { identity } from '../libs/conversions.js';\nimport EditView from './EditView.js';\nimport { copyExistingProperties } from '../libs/utils.js';\n\nexport default class ColorView extends EditView {\n #to;\n #from;\n #colorElem;\n #skipUpdate;\n #options = {\n converters: identity,\n };\n\n constructor(setter, options) {\n const colorElem = createElem('input', {\n type: 'color',\n onInput: () => {\n const [valid, newV] = this.#from(colorElem.value);\n if (valid) {\n this.#skipUpdate = true;\n setter.setValue(newV);\n }\n },\n onChange: () => {\n const [valid, newV] = this.#from(colorElem.value);\n if (valid) {\n this.#skipUpdate = true;\n setter.setFinalValue(newV);\n }\n },\n });\n super(createElem('div', {}, [colorElem]));\n this.setOptions(options);\n this.#colorElem = colorElem;\n }\n updateDisplay(v) {\n if (!this.#skipUpdate) {\n this.#colorElem.value = this.#to(v);\n }\n this.#skipUpdate = false;\n }\n setOptions(options) {\n copyExistingProperties(this.#options, options);\n const {converters: {to, from}} = this.#options;\n this.#to = to;\n this.#from = from;\n return this;\n }\n}\n","import {\n colorFormatConverters,\n guessFormat,\n} from '../libs/color-utils.js';\nimport ValueController from './ValueController.js';\nimport TextView from '../views/TextView.js';\nimport ColorView from '../views/ColorView.js';\n\nexport default class Color extends ValueController {\n #colorView;\n #textView;\n\n constructor(object, property, options = {}) {\n super(object, property, 'muigui-color');\n const format = options.format || guessFormat(this.getValue());\n const {color, text} = colorFormatConverters[format];\n this.#colorView = this.add(new ColorView(this, {converters: color}));\n this.#textView = this.add(new TextView(this, {converters: text}));\n this.updateDisplay();\n }\n setOptions(options) {\n const {format} = options;\n if (format) {\n const {color, text} = colorFormatConverters[format];\n this.#colorView.setOptions({converters: color});\n this.#textView.setOptions({converters: text});\n }\n super.setOptions(options);\n return this;\n }\n}","import Controller from './Controller.js';\n\n// This feels like it should be something else like\n// gui.addController({className: 'muigui-divider')};\nexport default class Divider extends Controller {\n constructor() {\n super('muigui-divider');\n }\n}","import Controller from './Controller.js';\n\nexport default class Container extends Controller {\n #controllers;\n #childDestController;\n\n constructor(className) {\n super(className);\n this.#controllers = [];\n this.#childDestController = this;\n }\n get children() {\n return this.#controllers; // should we return a copy?\n }\n get controllers() {\n return this.#controllers.filter(c => !(c instanceof Container));\n }\n get folders() {\n return this.#controllers.filter(c => c instanceof Container);\n }\n reset(recursive = true) {\n for (const controller of this.#controllers) {\n if (!(controller instanceof Container) || recursive) {\n controller.reset(recursive);\n }\n }\n return this;\n }\n updateDisplay() {\n for (const controller of this.#controllers) {\n controller.updateDisplay();\n }\n return this;\n }\n remove(controller) {\n const ndx = this.#controllers.indexOf(controller);\n if (ndx >= 0) {\n const c = this.#controllers.splice(ndx, 1);\n const c0 = c[0];\n const elem = c0.domElement;\n elem.remove();\n c0.setParent(null);\n }\n return this;\n }\n #addControllerImpl(controller) {\n this.domElement.appendChild(controller.domElement);\n this.#controllers.push(controller);\n controller.setParent(this);\n return controller;\n }\n addController(controller) {\n return this.#childDestController.#addControllerImpl(controller);\n }\n pushContainer(container) {\n this.addController(container);\n this.#childDestController = container;\n return container;\n }\n popContainer() {\n this.#childDestController = this.#childDestController.parent;\n return this;\n }\n}\n","import { createElem } from '../libs/elem.js';\nimport Container from './Container.js';\n\nexport default class Folder extends Container {\n #labelElem;\n\n constructor(name = 'Controls', className = 'muigui-menu') {\n super(className);\n this.#labelElem = createElem('label');\n this.addElem(createElem('button', {\n type: 'button',\n onClick: () => this.toggleOpen(),\n }, [this.#labelElem]));\n this.pushContainer(new Container());\n this.name(name);\n this.open();\n }\n open(open = true) {\n this.domElement.classList.toggle('muigui-closed', !open);\n this.domElement.classList.toggle('muigui-open', open);\n return this;\n }\n close() {\n return this.open(false);\n }\n name(name) {\n this.#labelElem.textContent = name;\n return this;\n }\n title(title) {\n return this.name(title);\n }\n toggleOpen() {\n this.open(!this.domElement.classList.contains('muigui-open'));\n return this;\n }\n}\n","import Controller from './Controller.js';\n\n// This feels like it should be something else like\n// gui.addDividing = new Controller()\nexport default class Label extends Controller {\n constructor(text) {\n super('muigui-label');\n this.text(text);\n }\n text(text) {\n this.domElement.textContent = text;\n return this;\n }\n}","function noop() {\n}\n\nexport function computeRelativePosition(elem, event, start) {\n const rect = elem.getBoundingClientRect();\n const x = event.clientX - rect.left;\n const y = event.clientY - rect.top;\n const nx = x / rect.width;\n const ny = y / rect.height;\n start = start || [x, y];\n const dx = x - start[0];\n const dy = y - start[1];\n const ndx = dx / rect.width;\n const ndy = dy / rect.width;\n return {x, y, nx, ny, dx, dy, ndx, ndy};\n}\n\nexport function addTouchEvents(elem, {onDown = noop, onMove = noop, onUp = noop}) {\n let start;\n const pointerMove = function (event) {\n const e = {\n type: 'move',\n ...computeRelativePosition(elem, event, start),\n };\n onMove(e);\n };\n\n const pointerUp = function (event) {\n elem.releasePointerCapture(event.pointerId);\n elem.removeEventListener('pointermove', pointerMove);\n elem.removeEventListener('pointerup', pointerUp);\n\n document.body.style.backgroundColor = '';\n\n onUp('up');\n };\n\n const pointerDown = function (event) {\n elem.addEventListener('pointermove', pointerMove);\n elem.addEventListener('pointerup', pointerUp);\n elem.setPointerCapture(event.pointerId);\n\n const rel = computeRelativePosition(elem, event);\n start = [rel.x, rel.y];\n onDown({\n type: 'down',\n ...rel,\n });\n };\n\n elem.addEventListener('pointerdown', pointerDown);\n\n return function () {\n elem.removeEventListener('pointerdown', pointerDown);\n };\n}","import { createElem, getNewId } from '../libs/elem.js';\nimport { addTouchEvents } from '../libs/touch.js';\nimport { identity } from '../libs/conversions.js';\nimport { clamp } from '../libs/utils.js';\nimport EditView from './EditView.js';\nimport {\n hexToFloatRGB,\n hexToFloatRGBA,\n hsv01ToRGBFloat,\n hsva01ToRGBAFloat,\n rgbFloatToHSV01,\n rgbaFloatToHSVA01,\n floatRGBToHex,\n floatRGBAToHex,\n rgbaFloatToHsla01,\n} from '../libs/color-utils.js';\nimport { copyExistingProperties } from '../libs/utils.js';\n\nconst svg = `\n\n\n\n`;\n\nfunction connectFillTargets(elem) {\n elem.querySelectorAll('[data-src]').forEach(srcElem => {\n const id = getNewId();\n srcElem.id = id;\n elem.querySelectorAll(`[data-target=${srcElem.dataset.src}]`).forEach(targetElem => {\n targetElem.setAttribute('fill', `url(#${id})`);\n });\n });\n return elem;\n}\n\n// Was originally going to make alpha an option. Issue is\n// hard coded conversions?\nexport default class ColorChooserView extends EditView {\n #to;\n #from;\n #satLevelElem;\n #circleElem;\n #hueUIElem;\n #hueElem;\n #hueCursorElem;\n #alphaUIElem;\n #alphaElem;\n #alphaCursorElem;\n #hsva;\n #skipHueUpdate;\n #skipSatLevelUpdate;\n #skipAlphaUpdate;\n #options = {\n converters: identity,\n alpha: false,\n };\n #convertInternalToHex;\n #convertHexToInternal;\n\n constructor(setter, options) {\n super(createElem('div', {\n innerHTML: svg,\n className: 'muigui-no-scroll',\n }));\n this.#satLevelElem = this.domElement.children[0];\n this.#hueUIElem = this.domElement.children[1];\n this.#alphaUIElem = this.domElement.children[2];\n connectFillTargets(this.#satLevelElem);\n connectFillTargets(this.#hueUIElem);\n connectFillTargets(this.#alphaUIElem);\n this.#circleElem = this.$('.muigui-color-chooser-circle');\n this.#hueElem = this.$('[data-src=muigui-color-chooser-hue]');\n this.#hueCursorElem = this.$('.muigui-color-chooser-hue-cursor');\n this.#alphaElem = this.$('[data-src=muigui-color-chooser-alpha]');\n this.#alphaCursorElem = this.$('.muigui-color-chooser-alpha-cursor');\n\n const handleSatLevelChange = (e) => {\n const s = clamp(e.nx, 0, 1);\n const v = clamp(e.ny, 0, 1);\n this.#hsva[1] = s;\n this.#hsva[2] = (1 - v);\n this.#skipHueUpdate = true;\n this.#skipAlphaUpdate = true;\n const [valid, newV] = this.#from(this.#convertInternalToHex(this.#hsva));\n if (valid) {\n setter.setValue(newV);\n }\n };\n\n const handleHueChange = (e) => {\n const h = clamp(e.nx, 0, 1);\n this.#hsva[0] = h;\n this.#skipSatLevelUpdate = true;\n this.#skipAlphaUpdate = true;\n const [valid, newV] = this.#from(this.#convertInternalToHex(this.#hsva));\n if (valid) {\n setter.setValue(newV);\n }\n };\n\n const handleAlphaChange = (e) => {\n const a = clamp(e.nx, 0, 1);\n this.#hsva[3] = a;\n this.#skipHueUpdate = true;\n this.#skipSatLevelUpdate = true;\n const [valid, newV] = this.#from(this.#convertInternalToHex(this.#hsva));\n if (valid) {\n setter.setValue(newV);\n }\n };\n\n addTouchEvents(this.#satLevelElem, {\n onDown: handleSatLevelChange,\n onMove: handleSatLevelChange,\n });\n addTouchEvents(this.#hueUIElem, {\n onDown: handleHueChange,\n onMove: handleHueChange,\n });\n addTouchEvents(this.#alphaUIElem, {\n onDown: handleAlphaChange,\n onMove: handleAlphaChange,\n });\n this.setOptions(options);\n }\n updateDisplay(newV) {\n if (!this.#hsva) {\n this.#hsva = this.#convertHexToInternal(this.#to(newV));\n }\n {\n const [h, s, v, a = 1] = this.#convertHexToInternal(this.#to(newV));\n // Don't copy the hue if it was un-computable.\n if (!this.#skipHueUpdate) {\n this.#hsva[0] = s > 0.001 && v > 0.001 ? h : this.#hsva[0];\n }\n if (!this.#skipSatLevelUpdate) {\n this.#hsva[1] = s;\n this.#hsva[2] = v;\n }\n if (!this.#skipAlphaUpdate) {\n this.#hsva[3] = a;\n }\n }\n {\n const [h, s, v, a] = this.#hsva;\n const [hue, sat, lum] = rgbaFloatToHsla01(hsva01ToRGBAFloat(this.#hsva));\n\n if (!this.#skipHueUpdate) {\n this.#hueCursorElem.setAttribute('transform', `translate(${h * 64}, 0)`);\n }\n this.#hueElem.children[0].setAttribute('stop-color', `hsl(${hue * 360} 0% 100% / ${a})`);\n this.#hueElem.children[1].setAttribute('stop-color', `hsl(${hue * 360} 100% 50% / ${a})`);\n if (!this.#skipAlphaUpdate) {\n this.#alphaCursorElem.setAttribute('transform', `translate(${a * 64}, 0)`);\n }\n this.#alphaElem.children[0].setAttribute('stop-color', `hsl(${hue * 360} ${sat * 100}% ${lum * 100}% / 0)`);\n this.#alphaElem.children[1].setAttribute('stop-color', `hsl(${hue * 360} ${sat * 100}% ${lum * 100}% / 1)`);\n\n if (!this.#skipSatLevelUpdate) {\n this.#circleElem.setAttribute('cx', `${s * 64}`);\n this.#circleElem.setAttribute('cy', `${(1 - v) * 48}`);\n }\n }\n this.#skipHueUpdate = false;\n this.#skipSatLevelUpdate = false;\n this.#skipAlphaUpdate = false;\n }\n setOptions(options) {\n copyExistingProperties(this.#options, options);\n const {converters: {to, from}, alpha} = this.#options;\n this.#alphaUIElem.style.display = alpha ? '' : 'none';\n this.#convertInternalToHex = alpha\n ? v => floatRGBAToHex(hsva01ToRGBAFloat(v))\n : v => floatRGBToHex(hsv01ToRGBFloat(v));\n this.#convertHexToInternal = alpha\n ? v => rgbaFloatToHSVA01(hexToFloatRGBA(v))\n : v => rgbFloatToHSV01(hexToFloatRGB(v));\n this.#to = to;\n this.#from = from;\n return this;\n }\n}\n","import ElementView from '../views/ElementView.js';\nimport ValueController from './ValueController.js';\nimport { copyExistingProperties } from '../libs/utils.js';\nimport { createElem } from '../libs/elem.js';\n/*\n\nholder = new TabHolder\ntab = holder.add(new Tab(\"name\"))\ntab.add(...)\n\n\npc = new PopdownController\ntop = pc.add(new Row())\ntop.add(new Button());\nvalues = topRow.add(new Div())\nbottom = pc.add(new Row());\n\n\n\npc = new PopdownController\npc.addTop\npc.addTop\n\npc.addBottom\n\n\n*/\n\nexport default class PopDownController extends ValueController {\n #top;\n #valuesView;\n #checkboxElem;\n #bottom;\n #options = {\n open: false,\n };\n\n constructor(object, property, options = {}) {\n super(object, property, 'muigui-pop-down-controller');\n /*\n [ValueView\n [[B][values]] upper row\n [[ visual ]] lower row\n ]\n */\n this.#top = this.add(new ElementView('div', 'muigui-pop-down-top'));\n// this.#top.add(new CheckboxView(makeSetter(this.#options, 'open')));\n const checkboxElem = this.#top.addElem(createElem('input', {\n type: 'checkbox',\n onChange: () => {\n this.#options.open = checkboxElem.checked;\n this.updateDisplay();\n },\n }));\n this.#checkboxElem = checkboxElem;\n this.#valuesView = this.#top.add(new ElementView('div', 'muigui-pop-down-values'));\n this.#bottom = this.add(new ElementView('div', 'muigui-pop-down-bottom'));\n this.setOptions(options);\n }\n setKnobColor(bgCssColor/*, fgCssColor*/) {\n if (this.#checkboxElem) {\n this.#checkboxElem.style = `\n --range-color: ${bgCssColor};\n --value-bg-color: ${bgCssColor};\n `;\n }\n }\n updateDisplay() {\n super.updateDisplay();\n const {open} = this.#options;\n this.domElement.children[1].classList.toggle('muigui-open', open);\n this.domElement.children[1].classList.toggle('muigui-closed', !open);\n }\n setOptions(options) {\n copyExistingProperties(this.#options, options);\n super.setOptions(options);\n this.updateDisplay();\n }\n addTop(view) {\n return this.#valuesView.add(view);\n }\n addBottom(view) {\n return this.#bottom.add(view);\n }\n}","/* eslint-disable no-underscore-dangle */\nimport {\n colorFormatConverters,\n guessFormat,\n hasAlpha,\n hexToUint8RGB,\n hslToRgbUint8,\n rgbUint8ToHsl,\n uint8RGBToHex,\n} from '../libs/color-utils.js';\nimport ColorChooserView from '../views/ColorChooserView.js';\nimport TextView from '../views/TextView.js';\nimport PopDownController from './PopDownController.js';\n\nexport default class ColorChooser extends PopDownController {\n #colorView;\n #textView;\n #to;\n #setKnobHelper;\n\n constructor(object, property, options = {}) {\n super(object, property, 'muigui-color-chooser');\n const format = options.format || guessFormat(this.getValue());\n const {color, text} = colorFormatConverters[format];\n this.#to = color.to;\n this.#textView = new TextView(this, {converters: text, alpha: hasAlpha(format)});\n this.#colorView = new ColorChooserView(this, {converters: color, alpha: hasAlpha(format)});\n this.addTop(this.#textView);\n this.addBottom(this.#colorView);\n // WTF! FIX!\n this.#setKnobHelper = () => {\n if (this.#to) {\n const hex6Or8 = this.#to(this.getValue());\n const hsl = rgbUint8ToHsl(hexToUint8RGB(hex6Or8));\n hsl[2] = (hsl[2] + 50) % 100;\n const hex = uint8RGBToHex(hslToRgbUint8(hsl));\n this.setKnobColor(`${hex6Or8.substring(0, 7)}FF`, hex);\n }\n };\n this.updateDisplay();\n }\n updateDisplay() {\n super.updateDisplay();\n if (this.#setKnobHelper) {\n this.#setKnobHelper();\n }\n }\n setOptions(options) {\n super.setOptions(options);\n return this;\n }\n}\n","import css from './styles/muigui.css.js';\nimport {createElem} from './libs/elem.js';\nimport {createController} from './controllers/create-controller.js';\nimport {\n mapRange,\n makeRangeConverters,\n makeRangeOptions,\n makeMinMaxPair,\n} from './libs/utils.js';\nimport {\n converters\n} from './libs/conversions.js';\nimport {\n hasAlpha,\n guessFormat,\n} from './libs/color-utils.js';\nimport Canvas from './controllers/Canvas.js';\nimport Color from './controllers/Color.js';\nimport Divider from './controllers/Divider.js';\nimport Folder from './controllers/Folder.js';\nimport Label from './controllers/Label.js';\nimport Controller from './controllers/Controller.js';\nimport ColorChooser from './controllers/ColorChooser.js';\n\nimport Column from './layout/Column.js';\nimport Frame from './layout/Frame.js';\nimport Grid from './layout/Grid.js';\nimport Row from './layout/Row.js';\n\nexport {\n Column,\n Frame,\n Grid,\n Row,\n};\n\nexport class GUIFolder extends Folder {\n add(object, property, ...args) {\n const controller = object instanceof Controller\n ? object\n : createController(object, property, ...args);\n return this.addController(controller);\n }\n addCanvas(name) {\n return this.addController(new Canvas(name));\n }\n addColor(object, property, options = {}) {\n const value = object[property];\n if (hasAlpha(options.format || guessFormat(value))) {\n return this.addController(new ColorChooser(object, property, options));\n } else {\n return this.addController(new Color(object, property, options));\n }\n }\n addDivider() {\n return this.addController(new Divider());\n }\n addFolder(name) {\n return this.addController(new GUIFolder(name));\n }\n addLabel(text) {\n return this.addController(new Label(text));\n }\n}\n\nclass MuiguiElement extends HTMLElement {\n constructor() {\n super();\n this.shadow = this.attachShadow({mode: 'open'});\n }\n}\n\ncustomElements.define('muigui-element', MuiguiElement);\n\nconst baseStyleSheet = new CSSStyleSheet();\nbaseStyleSheet.replaceSync(css.default);\nconst userStyleSheet = new CSSStyleSheet();\n\nfunction makeStyleSheetUpdater(styleSheet) {\n let newCss;\n let newCssPromise;\n\n function updateStyle() {\n if (newCss && !newCssPromise) {\n const s = newCss;\n newCss = undefined;\n newCssPromise = styleSheet.replace(s).then(() => {\n newCssPromise = undefined;\n updateStyle();\n });\n }\n }\n\n return function updateStyleSheet(css) {\n newCss = css;\n updateStyle();\n };\n}\n\nconst updateBaseStyle = makeStyleSheetUpdater(baseStyleSheet);\nconst updateUserStyle = makeStyleSheetUpdater(userStyleSheet);\n\nexport class GUI extends GUIFolder {\n static converters = converters;\n static mapRange = mapRange;\n static makeRangeConverters = makeRangeConverters;\n static makeRangeOptions = makeRangeOptions;\n static makeMinMaxPair = makeMinMaxPair;\n #localStyleSheet = new CSSStyleSheet();\n\n constructor(options = {}) {\n super('Controls', 'muigui-root');\n if (options instanceof HTMLElement) {\n options = {parent: options};\n }\n const {\n autoPlace = true,\n width,\n title = 'Controls',\n } = options;\n let {\n parent,\n } = options;\n\n if (width) {\n this.domElement.style.width = /^\\d+$/.test(width) ? `${width}px` : width;\n }\n if (parent === undefined && autoPlace) {\n parent = document.body;\n this.domElement.classList.add('muigui-auto-place');\n }\n if (parent) {\n const muiguiElement = createElem('muigui-element');\n muiguiElement.shadowRoot.adoptedStyleSheets = [baseStyleSheet, userStyleSheet, this.#localStyleSheet];\n muiguiElement.shadow.appendChild(this.domElement);\n parent.appendChild(muiguiElement);\n }\n if (title) {\n this.title(title);\n }\n this.domElement.classList.add('muigui', 'muigui-colors');\n }\n setStyle(css) {\n this.#localStyleSheet.replace(css);\n }\n static setBaseStyles(css) {\n updateBaseStyle(css);\n }\n static getBaseStyleSheet() {\n return baseStyleSheet;\n }\n static setUserStyles(css) {\n updateUserStyle(css);\n }\n static getUserStyleSheet() {\n return userStyleSheet;\n }\n static setTheme(name) {\n GUI.setBaseStyles(`${css.default}\\n${css.themes[name] || ''}`);\n }\n}\n\nexport default GUI;\n","import Button from './Button.js';\nimport Checkbox from './Checkbox.js';\nimport TextNumber from './TextNumber.js';\nimport Select from './Select.js';\nimport Range from './Range.js';\nimport Text from './Text.js';\n\n// const isConversion = o => typeof o.to === 'function' && typeof o.from === 'function';\n\n/**\n * possible inputs\n * add(o, p, min: number, max: number)\n * add(o, p, min: number, max: number, step: number)\n * add(o, p, array: [value])\n * add(o, p, array: [[key, value]])\n *\n * @param {*} object\n * @param {string} property\n * @param {...any} args\n * @returns {Controller}\n */\nexport function createController(object, property, ...args) {\n const [arg1] = args;\n if (Array.isArray(arg1)) {\n return new Select(object, property, {keyValues: arg1});\n }\n\n const t = typeof object[property];\n switch (t) {\n case 'number':\n if (typeof args[0] === 'number' && typeof args[1] === 'number') {\n const min = args[0];\n const max = args[1];\n const step = args[2];\n return new Range(object, property, {min, max, ...(step && {step})});\n }\n return args.length === 0\n ? new TextNumber(object, property, ...args)\n : new Range(object, property, ...args);\n case 'boolean':\n return new Checkbox(object, property, ...args);\n case 'function':\n return new Button(object, property, ...args);\n case 'string':\n return new Text(object, property, ...args);\n case 'undefined':\n throw new Error(`no property named ${property}`);\n default:\n throw new Error(`unhandled type ${t} for property ${property}`);\n }\n}","function noop() {\n}\n\nconst keyDirections = {\n ArrowLeft: [-1, 0],\n ArrowRight: [1, 0],\n ArrowUp: [0, -1],\n ArrowDown: [0, 1],\n};\n\n// This probably needs to be global\nexport function addKeyboardEvents(elem, {onDown = noop, onUp = noop}) {\n const keyDown = function (event) {\n const mult = event.shiftKey ? 10 : 1;\n const [dx, dy] = (keyDirections[event.key] || [0, 0]).map(v => v * mult);\n const fn = event.type === 'keydown' ? onDown : onUp;\n fn({\n type: event.type.substring(3),\n dx,\n dy,\n event,\n });\n };\n\n elem.addEventListener('keydown', keyDown);\n elem.addEventListener('keyup', keyDown);\n\n return function () {\n elem.removeEventListener('keydown', keyDown);\n elem.removeEventListener('keyup', keyDown);\n };\n}","export function assert(truthy, msg = '') {\n if (!truthy) {\n throw new Error(msg);\n }\n}","import { assert } from '../libs/assert.js';\n\nfunction getEllipsePointForAngle(cx, cy, rx, ry, phi, theta) {\n const m = Math.abs(rx) * Math.cos(theta);\n const n = Math.abs(ry) * Math.sin(theta);\n\n return [\n cx + Math.cos(phi) * m - Math.sin(phi) * n,\n cy + Math.sin(phi) * m + Math.cos(phi) * n,\n ];\n}\n\nfunction getEndpointParameters(cx, cy, rx, ry, phi, theta, dTheta) {\n const [x1, y1] = getEllipsePointForAngle(cx, cy, rx, ry, phi, theta);\n const [x2, y2] = getEllipsePointForAngle(cx, cy, rx, ry, phi, theta + dTheta);\n\n const fa = Math.abs(dTheta) > Math.PI ? 1 : 0;\n const fs = dTheta > 0 ? 1 : 0;\n\n return { x1, y1, x2, y2, fa, fs };\n}\n\nexport function arc(cx, cy, r, start, end) {\n assert(Math.abs(start - end) <= Math.PI * 2);\n assert(start >= -Math.PI && start <= Math.PI * 2);\n assert(start <= end);\n assert(end >= -Math.PI && end <= Math.PI * 4);\n\n const { x1, y1, x2, y2, fa, fs } = getEndpointParameters(cx, cy, r, r, 0, start, end - start);\n return Math.abs(Math.abs(start - end) - Math.PI * 2) > Number.EPSILON\n ? `M${cx} ${cy} L${x1} ${y1} A ${r} ${r} 0 ${fa} ${fs} ${x2} ${y2} L${cx} ${cy}`\n : `M${x1} ${y1} L${x1} ${y1} A ${r} ${r} 0 ${fa} ${fs} ${x2} ${y2}`;\n}\n","import { identity } from '../libs/conversions.js';\nimport { createElem } from '../libs/elem.js';\nimport { addKeyboardEvents } from '../libs/keyboard.js';\nimport { arc } from '../libs/svg.js';\nimport { addTouchEvents } from '../libs/touch.js';\nimport { createWheelHelper } from '../libs/wheel.js';\nimport { clamp, copyExistingProperties, euclideanModulo, lerp, stepify } from '../libs/utils.js';\nimport EditView from './EditView.js';\n\nconst svg = `\n\n`;\n\nconst twoPiMod = v => euclideanModulo(v + Math.PI, Math.PI * 2) - Math.PI;\n\nexport default class DirectionView extends EditView {\n #arrowElem;\n #rangeElem;\n #lastV;\n #wrap;\n #options = {\n step: 1,\n min: -180,\n max: 180,\n\n /*\n --------\n / -π/2 \\\n / | \\\n |<- -π * |\n | * 0 ->| zero is down the positive X axis\n |<- +π * |\n \\ | /\n \\ π/2 /\n --------\n */\n dirMin: -Math.PI,\n dirMax: Math.PI,\n //dirMin: Math.PI * 0.5,\n //dirMax: Math.PI * 2.5,\n //dirMin: -Math.PI * 0.75, // test 10:30 to 7:30\n //dirMax: Math.PI * 0.75,\n //dirMin: Math.PI * 0.75, // test 7:30 to 10:30\n //dirMax: -Math.PI * 0.75,\n //dirMin: -Math.PI * 0.75, // test 10:30 to 1:30\n //dirMax: -Math.PI * 0.25,\n //dirMin: Math.PI * 0.25, // test 4:30 to 7:30\n //dirMax: Math.PI * 0.75,\n //dirMin: Math.PI * 0.75, // test 4:30 to 7:30\n //dirMax: Math.PI * 0.25,\n wrap: undefined,\n converters: identity,\n };\n\n constructor(setter, options = {}) {\n const wheelHelper = createWheelHelper();\n super(createElem('div', {\n className: 'muigui-direction muigui-no-scroll',\n innerHTML: svg,\n onWheel: e => {\n e.preventDefault();\n const {min, max, step} = this.#options;\n const delta = wheelHelper(e, step);\n let tempV = this.#lastV + delta;\n if (this.#wrap) {\n tempV = euclideanModulo(tempV - min, max - min) + min;\n }\n const newV = clamp(stepify(tempV, v => v, step), min, max);\n setter.setValue(newV);\n },\n }));\n const handleTouch = (e) => {\n const {min, max, step, dirMin, dirMax} = this.#options;\n const nx = e.nx * 2 - 1;\n const ny = e.ny * 2 - 1;\n const a = Math.atan2(ny, nx);\n\n const center = (dirMin + dirMax) / 2;\n\n const centeredAngle = twoPiMod(a - center);\n const centeredStart = twoPiMod(dirMin - center);\n const diff = dirMax - dirMin;\n\n const n = clamp((centeredAngle - centeredStart) / (diff), 0, 1);\n const newV = stepify(min + (max - min) * n, v => v, step);\n setter.setValue(newV);\n };\n addTouchEvents(this.domElement, {\n onDown: handleTouch,\n onMove: handleTouch,\n });\n addKeyboardEvents(this.domElement, {\n onDown: (e) => {\n const {min, max, step} = this.#options;\n const newV = clamp(stepify(this.#lastV + e.dx * step, v => v, step), min, max);\n setter.setValue(newV);\n },\n });\n this.#arrowElem = this.$('#muigui-arrow');\n this.#rangeElem = this.$('#muigui-range');\n this.setOptions(options);\n }\n updateDisplay(v) {\n this.#lastV = v;\n const {min, max} = this.#options;\n const n = (v - min) / (max - min);\n const angle = lerp(this.#options.dirMin, this.#options.dirMax, n);\n this.#arrowElem.style.transform = `rotate(${angle}rad)`;\n }\n setOptions(options) {\n copyExistingProperties(this.#options, options);\n const {dirMin, dirMax, wrap} = this.#options;\n this.#wrap = wrap !== undefined\n ? wrap\n : Math.abs(dirMin - dirMax) >= Math.PI * 2 - Number.EPSILON;\n const [min, max] = dirMin < dirMax ? [dirMin, dirMax] : [dirMax , dirMin];\n this.#rangeElem.setAttribute('d', arc(0, 0, 28.87, min, max));\n }\n}\n","import { identity } from '../libs/conversions.js';\nimport DirectionView from '../views/DirectionView.js';\nimport NumberView from '../views/NumberView.js';\n// import ValueController from './ValueController.js';\nimport PopDownController from './PopDownController.js';\n\n\n// deg2rad\n// where is 0\n// range (0, 360), (-180, +180), (0,0) Really this is a range\n\nexport default class Direction extends PopDownController {\n #options;\n constructor(object, property, options) {\n super(object, property, 'muigui-direction');\nthis.#options = options; // FIX\n this.addTop(new NumberView(this,\nidentity));\n this.addBottom(new DirectionView(this, options));\n this.updateDisplay();\n }\n}\n\n","import { createElem } from '../libs/elem.js';\nimport { makeId } from '../libs/ids.js';\nimport EditView from './EditView.js';\n\nexport default class RadioGridView extends EditView {\n #values;\n\n constructor(setter, keyValues, cols = 3) {\n const values = [];\n const name = makeId();\n super(createElem('div', {}, keyValues.map(([key, value], ndx) => {\n values.push(value);\n return createElem('label', {}, [\n createElem('input', {\n type: 'radio',\n name,\n value: ndx,\n onChange: function () {\n if (this.checked) {\n setter.setFinalValue(that.#values[this.value]);\n }\n },\n }),\n createElem('button', {\n type: 'button',\n textContent: key,\n onClick: function () {\n this.previousElementSibling.click();\n },\n }),\n ]);\n })));\n // eslint-disable-next-line @typescript-eslint/no-this-alias\n const that = this;\n this.#values = values;\n this.cols(cols);\n }\n updateDisplay(v) {\n const ndx = this.#values.indexOf(v);\n for (let i = 0; i < this.domElement.children.length; ++i) {\n this.domElement.children[i].children[0].checked = i === ndx;\n }\n }\n cols(cols) {\n this.domElement.style.gridTemplateColumns = `repeat(${cols}, 1fr)`;\n }\n}\n","import RadioGridView from '../views/RadioGridView.js';\nimport ValueController from './ValueController.js';\nimport { convertToKeyValues } from '../libs/key-values.js';\n\nexport default class RadioGrid extends ValueController {\n constructor(object, property, options) {\n super(object, property, 'muigui-radio-grid');\n const valueIsNumber = typeof this.getValue() === 'number';\n const {\n keyValues: keyValuesInput,\n cols = 3,\n } = options;\n const keyValues = convertToKeyValues(keyValuesInput, valueIsNumber);\n this.add(new RadioGridView(this, keyValues, cols));\n this.updateDisplay();\n }\n}","export function onResize(elem, callback) {\n new ResizeObserver(() => {\n callback({rect: elem.getBoundingClientRect(), elem});\n }).observe(elem);\n}\n\nexport function onResizeSVGNoScale(elem, hAnchor, vAnchor, callback) {\n onResize(elem, ({rect}) => {\n const {width, height} = rect;\n elem.setAttribute('viewBox', `-${width * hAnchor} -${height * vAnchor} ${width} ${height}`);\n callback({elem, rect});\n });\n}\n\nexport function onResizeCanvas(elem, callback) {\n onResize(elem, ({rect}) => {\n const {width, height} = rect;\n elem.width = width;\n elem.height = height;\n callback({elem, rect});\n });\n}\n","import { createElem } from '../libs/elem.js';\nimport { addKeyboardEvents } from '../libs/keyboard.js';\nimport { addTouchEvents } from '../libs/touch.js';\nimport { createWheelHelper } from '../libs/wheel.js';\nimport { onResizeSVGNoScale } from '../libs/resize-helpers.js';\nimport { clamp, copyExistingProperties, stepify } from '../libs/utils.js';\nimport EditView from './EditView.js';\n\nconst svg = `\n\n`;\n\nfunction createSVGTicks(start, end, step, min, max, height) {\n const p = [];\n if (start < min) {\n start += stepify(min - start, v => v, step);\n }\n end = Math.min(end, max);\n for (let i = start; i <= end; i += step) {\n p.push(`M${i} 0 l0 ${height}`);\n }\n return p.join(' ');\n}\n\nfunction createSVGNumbers(start, end, unitSize, unit, minusSize, min, max, labelFn) {\n const texts = [];\n if (start < min) {\n start += stepify(min - start, v => v, unitSize);\n }\n end = Math.min(end, max);\n const digits = Math.max(0, -Math.log10(unit));\n const f = v => labelFn(v.toFixed(digits));\n for (let i = start; i <= end; i += unitSize) {\n texts.push(`= 0 ? i : (i - minusSize / 2) }\" y=\"0\">${f(i / unitSize * unit)}`);\n }\n return texts.join('\\n');\n}\n\nfunction computeSizeOfMinus(elem) {\n const oldHTML = elem.innerHTML;\n elem.innerHTML = '- ';\n const text = elem.querySelector('text');\n const size = text.getComputedTextLength();\n elem.innerHTML = oldHTML;\n return size;\n}\n\nexport default class SliderView extends EditView {\n #svgElem;\n #originElem;\n #ticksElem;\n #thicksElem;\n #numbersElem;\n #leftGradElem;\n #rightGradElem;\n #width;\n #height;\n #lastV;\n #minusSize;\n #options = {\n min: -100,\n max: 100,\n step: 1,\n unit: 10,\n unitSize: 10,\n ticksPerUnit: 5,\n labelFn: v => v,\n tickHeight: 1,\n limits: true,\n thicksColor: undefined,\n orientation: undefined,\n };\n\n constructor(setter, options) {\n const wheelHelper = createWheelHelper();\n super(createElem('div', {\n innerHTML: svg,\n className: 'muigui-no-v-scroll',\n onWheel: e => {\n e.preventDefault();\n const {min, max, step} = this.#options;\n const delta = wheelHelper(e, step);\n const newV = clamp(stepify(this.#lastV + delta, v => v, step), min, max);\n setter.setValue(newV);\n },\n }));\n this.#svgElem = this.$('svg');\n this.#originElem = this.$('#muigui-origin');\n this.#ticksElem = this.$('#muigui-ticks');\n this.#thicksElem = this.$('#muigui-thicks');\n this.#numbersElem = this.$('#muigui-numbers');\n this.#leftGradElem = this.$('#muigui-left-grad');\n this.#rightGradElem = this.$('#muigui-right-grad');\n this.setOptions(options);\n let startV;\n addTouchEvents(this.domElement, {\n onDown: () => {\n startV = this.#lastV;\n },\n onMove: (e) => {\n const {min, max, unitSize, unit, step} = this.#options;\n const newV = clamp(stepify(startV - e.dx / unitSize * unit, v => v, step), min, max);\n setter.setValue(newV);\n },\n });\n addKeyboardEvents(this.domElement, {\n onDown: (e) => {\n const {min, max, step} = this.#options;\n const newV = clamp(stepify(this.#lastV + e.dx * step, v => v, step), min, max);\n setter.setValue(newV);\n },\n });\n onResizeSVGNoScale(this.#svgElem, 0.5, 0, ({rect: {width}}) => {\n this.#leftGradElem.setAttribute('x', -width / 2);\n this.#rightGradElem.setAttribute('x', width / 2 - 20);\n this.#minusSize = computeSizeOfMinus(this.#numbersElem);\n this.#width = width;\n this.#updateSlider();\n });\n }\n // |--------V--------|\n // . . | . . . | . . . |\n //\n #updateSlider() {\n // There's no size if ResizeObserver has not fired yet.\n if (!this.#width || this.#lastV === undefined) {\n return;\n }\n const {\n labelFn,\n limits,\n min,\n max,\n orientation,\n tickHeight,\n ticksPerUnit,\n unit,\n unitSize,\n thicksColor,\n } = this.#options;\n const unitsAcross = Math.ceil(this.#width / unitSize);\n const center = this.#lastV;\n const centerUnitSpace = center / unit;\n const startUnitSpace = Math.round(centerUnitSpace - unitsAcross);\n const endUnitSpace = startUnitSpace + unitsAcross * 2;\n const start = startUnitSpace * unitSize;\n const end = endUnitSpace * unitSize;\n const minUnitSpace = limits ? min * unitSize / unit : start;\n const maxUnitSpace = limits ? max * unitSize / unit : end;\n const height = labelFn(1) === '' ? 10 : 5;\n if (ticksPerUnit > 1) {\n this.#ticksElem.setAttribute('d', createSVGTicks(start, end, unitSize / ticksPerUnit, minUnitSpace, maxUnitSpace, height * tickHeight));\n }\n this.#thicksElem.style.stroke = thicksColor; //setAttribute('stroke', thicksColor);\n this.#thicksElem.setAttribute('d', createSVGTicks(start, end, unitSize, minUnitSpace, maxUnitSpace, height));\n this.#numbersElem.innerHTML = createSVGNumbers(start, end, unitSize, unit, this.#minusSize, minUnitSpace, maxUnitSpace, labelFn);\n this.#originElem.setAttribute('transform', `translate(${-this.#lastV * unitSize / unit} 0)`);\n this.#svgElem.classList.toggle('muigui-slider-up', orientation === 'up');\n }\n updateDisplay(v) {\n this.#lastV = v;\n this.#updateSlider();\n }\n setOptions(options) {\n copyExistingProperties(this.#options, options);\n return this;\n }\n}\n","import ValueController from './ValueController.js';\nimport NumberView from '../views/NumberView.js';\nimport SliderView from '../views/SliderView.js';\n\nexport default class Slider extends ValueController {\n constructor(object, property, options = {}) {\n super(object, property, 'muigui-slider');\n this.add(new SliderView(this, options));\n this.add(new NumberView(this, options));\n this.updateDisplay();\n }\n}\n","import { createElem } from '../libs/elem.js';\nimport { addTouchEvents } from '../libs/touch.js';\nimport { onResizeSVGNoScale } from '../libs/resize-helpers.js';\nimport EditView from './EditView.js';\n\nconst svg = `\n\n`;\n\nexport default class Vec2View extends EditView {\n #svgElem;\n #arrowElem;\n #circleElem;\n #lastV = [];\n\n constructor(setter) {\n super(createElem('div', {\n innerHTML: svg,\n className: 'muigui-no-scroll',\n }));\n const onTouch = (e) => {\n const {width, height} = this.#svgElem.getBoundingClientRect();\n const nx = e.nx * 2 - 1;\n const ny = e.ny * 2 - 1;\n setter.setValue([nx * width * 0.5, ny * height * 0.5]);\n };\n addTouchEvents(this.domElement, {\n onDown: onTouch,\n onMove: onTouch,\n });\n this.#svgElem = this.$('svg');\n this.#arrowElem = this.$('#muigui-arrow');\n this.#circleElem = this.$('#muigui-circle');\n onResizeSVGNoScale(this.#svgElem, 0.5, 0.5, () => this.#updateDisplayImpl);\n }\n #updateDisplayImpl() {\n const [x, y] = this.#lastV;\n this.#arrowElem.setAttribute('d', `M0,0L${x},${y}`);\n this.#circleElem.setAttribute('transform', `translate(${x}, ${y})`);\n }\n updateDisplay(v) {\n this.#lastV[0] = v[0];\n this.#lastV[1] = v[1];\n this.#updateDisplayImpl();\n }\n}\n","import NumberView from '../views/NumberView.js';\nimport Vec2View from '../views/Vec2View.js';\nimport PopDownController from './PopDownController.js';\nimport { strToNumber } from '../libs/conversions.js';\n\n// TODO: zoom with wheel and pinch?\n// TODO: grid?\n// // options\n// scale:\n// range: number (both x and y + /)\n// range: array (min, max)\n// xRange:\n// deg/rad/turn\n\nexport default class Vec2 extends PopDownController {\n constructor(object, property) {\n super(object, property, 'muigui-vec2');\n\n const makeSetter = (ndx) => {\n return {\n setValue: (v) => {\n const newV = this.getValue();\n newV[ndx] = v;\n this.setValue(newV);\n },\n setFinalValue: (v) => {\n const newV = this.getValue();\n newV[ndx] = v;\n this.setFinalValue(newV);\n },\n };\n };\n\n this.addTop(new NumberView(makeSetter(0), {\n converters: {\n to: v => v[0],\n from: strToNumber.from,\n },\n }));\n this.addTop(new NumberView(makeSetter(1), {\n converters: {\n to: v => v[1],\n from: strToNumber.from,\n },\n }));\n this.addBottom(new Vec2View(this));\n this.updateDisplay();\n }\n}\n"],"names":["css","default","themes","float","createElem","tag","attrs","children","elem","document","createElement","key","value","Object","entries","startsWith","eventName","substring","toLowerCase","addEventListener","passive","k","v","undefined","setAttribute","child","appendChild","setElemProps","nextId","removeArrayElem","array","ndx","indexOf","splice","clamp","min","max","Math","isTypedArray","SharedArrayBuffer","a","buffer","ArrayBuffer","stepify","from","step","round","euclideanModulo","n","copyExistingProperties","dst","src","mapRange","inMin","inMax","outMin","outMax","makeRangeConverters","to","makeRangeOptions","converters","identity","makeMinMaxPair","gui","properties","minPropName","maxPropName","options","guiMinRange","minRange","valueMinRange","minGui","add","onChange","maxGui","setValue","View","domElement","childDestElem","views","constructor","this","addElem","removeElem","removeChild","pushSubElem","popSubElem","parentElement","view","push","remove","pushSubView","popSubView","setOptions","updateDisplayIfNeeded","newV","ignoreCache","$","selector","querySelector","Controller","changeFns","finishChangeFns","parent","className","super","classList","setParent","enable","disabled","show","toggle","hide","closest","forEach","querySelectorAll","disable","fn","removeChange","onFinishChange","removeFinishChange","callListeners","fns","call","emitChange","object","property","controller","emitFinalChange","updateDisplay","getColors","toCamelCase","s","replace","m","m1","toUpperCase","div","colors","fromEntries","map","style","color","getComputedStyle","Button","buttonElem","name","type","onClick","textContent","arraysEqual","b","length","i","EditView","oldV","updateCheck","checkArrayNeedsUpdate","needUpdate","copyArrayElementsFromTo","checkTypedArrayNeedsUpdate","once","checkObjectNeedsUpdate","checkValueNeedsUpdate","getUpdateCheckForType","Array","isArray","bind","CheckboxView","checkboxElem","setter","id","onInput","checked","setFinalValue","tasks","tasksToRemove","Set","requestId","processing","processTasks","task","has","size","queueProcessing","clear","requestAnimationFrame","makeId","ValueView","LabelController","nameElem","for","title","tooltip","tip","ValueController","initialValue","listening","updateFn","getValue","setValueImpl","isDifferent","keys","assign","reset","listen","set","removeTask","Checkbox","strToNumber","toString","parseFloat","Number","isNaN","radToDeg","PI","createWheelHelper","wheelAccum","e","wheelScale","deltaY","delta","floor","abs","sign","NumberView","skipUpdate","NEGATIVE_INFINITY","POSITIVE_INFINITY","wheelHelper","handleInput","onWheel","preventDefault","setFn","valid","inRange","TextNumber","textView","SelectView","values","keyValues","selectedIndex","convertToKeyValues","valueIsNumber","Select","keyValuesInput","RangeView","validV","Range","TextView","Text","lerp","t","fract","f0","toFixed","f3","hexToUint32RGB","parseInt","hexToUint32RGBA","hexToUint8RGB","uint8RGBToHex","padStart","join","hexToUint8RGBA","uint8RGBAToHex","hexToFloatRGB","floatRGBToHex","hexToFloatRGBA","floatRGBAToHex","scaleAndClamp","hexToObjectRGB","r","g","hexToObjectRGBA","hexToCssRGB","cssRGBRegex","hexToCssRGBA","cssRGBARegex","hexToCssHSL","hsl","rgbUint8ToHsl","hexToCssHSLA","hsla","rgbaUint8ToHsla","cssHSLRegex","cssHSLARegex","hslToRgbUint8","h","l","f","rgbFloatToHsl01","d","rgbaFloatToHsla01","rgb","rgba","hsv01ToRGBFloat","hue","sat","val","hsva01ToRGBAFloat","alpha","round3","rgbFloatToHSV01","p","q","EPSILON","hasAlpha","format","endsWith","cssStringFormats","re","guessFormat","console","warn","formatInfo","test","guessStringColorFormat","trim","Uint8Array","Uint8ClampedArray","Float32Array","Error","fixHex6","fixHex8","hex6ToHex3","hex6","hex3RE","hex3ToHex6","hex3","exec","m2","fixHex3","strToCssRGB","find","strToCssRGBA","strToCssHSL","strToCssHSLA","strTo3IntsRE","strTo4IntsRE","strToUint32RGBRegex","strToUint32RGBARegex","hex6RE","hexNoHash6RE","hex8RE","hexNoHash8RE","colorFormatConverters","text","hex8","strToUint32RGB","strToUint32RGBA","numbers","split","badNdx","findIndex","json","JSON","parse","hslaToRgbaUint8","ElementView","Canvas","canvasElem","canvas","ColorView","colorElem","Color","colorView","Divider","Container","controllers","childDestController","filter","c","folders","recursive","c0","addControllerImpl","addController","pushContainer","container","popContainer","Folder","labelElem","toggleOpen","open","close","contains","Label","noop","computeRelativePosition","event","start","rect","getBoundingClientRect","x","clientX","left","y","clientY","top","nx","width","ny","height","dx","dy","ndy","addTouchEvents","onDown","onMove","onUp","pointerMove","pointerUp","releasePointerCapture","pointerId","removeEventListener","body","backgroundColor","pointerDown","setPointerCapture","rel","connectFillTargets","srcElem","dataset","targetElem","ColorChooserView","satLevelElem","circleElem","hueUIElem","hueElem","hueCursorElem","alphaUIElem","alphaElem","alphaCursorElem","hsva","skipHueUpdate","skipSatLevelUpdate","skipAlphaUpdate","convertInternalToHex","convertHexToInternal","innerHTML","handleSatLevelChange","handleHueChange","handleAlphaChange","lum","display","rgbaFloatToHSVA01","PopDownController","valuesView","bottom","setKnobColor","bgCssColor","addTop","addBottom","ColorChooser","setKnobHelper","hex6Or8","hex","GUIFolder","args","arg1","createController","addCanvas","addColor","addDivider","addFolder","addLabel","MuiguiElement","HTMLElement","shadow","attachShadow","mode","customElements","define","baseStyleSheet","CSSStyleSheet","replaceSync","userStyleSheet","makeStyleSheetUpdater","styleSheet","newCss","newCssPromise","updateStyle","then","updateBaseStyle","updateUserStyle","GUI","static","localStyleSheet","autoPlace","muiguiElement","shadowRoot","adoptedStyleSheets","setStyle","setBaseStyles","keyDirections","ArrowLeft","ArrowRight","ArrowUp","ArrowDown","addKeyboardEvents","keyDown","mult","shiftKey","assert","truthy","msg","getEllipsePointForAngle","cx","cy","rx","ry","phi","theta","cos","sin","arc","end","x1","y1","x2","y2","fa","fs","dTheta","getEndpointParameters","twoPiMod","DirectionView","arrowElem","rangeElem","lastV","wrap","dirMin","dirMax","tempV","handleTouch","atan2","center","angle","transform","Direction","RadioGridView","cols","that","previousElementSibling","click","gridTemplateColumns","RadioGrid","onResize","callback","ResizeObserver","observe","onResizeSVGNoScale","hAnchor","vAnchor","createSVGTicks","SliderView","svgElem","originElem","ticksElem","thicksElem","numbersElem","leftGradElem","rightGradElem","minusSize","unit","unitSize","ticksPerUnit","labelFn","tickHeight","limits","thicksColor","orientation","startV","oldHTML","getComputedTextLength","computeSizeOfMinus","updateSlider","unitsAcross","ceil","centerUnitSpace","startUnitSpace","minUnitSpace","maxUnitSpace","stroke","texts","digits","log10","createSVGNumbers","Slider","Vec2View","onTouch","updateDisplayImpl","Vec2","makeSetter"],"mappings":"AAAA,IAAeA,EAAA,CACbC,QAAS,s7cAsrBXC,OAAQ,CACND,QAAS,GACTE,MAAO,gyCCpqBF,SAASC,EAAWC,EAAKC,EAAQ,CAAA,EAAIC,EAAW,IACrD,MAAMC,EAAOC,SAASC,cAAcL,GAEpC,OAxBK,SAAsBG,EAAMF,EAAOC,GACxC,IAAK,MAAOI,EAAKC,KAAUC,OAAOC,QAAQR,GACxC,GAAqB,mBAAVM,GAAwBD,EAAII,WAAW,MAAO,CACvD,MAAMC,EAAYL,EAAIM,UAAU,GAAGC,cACnCV,EAAKW,iBAAiBH,EAAWJ,EAAO,CAACQ,SAAS,GACxD,MAAW,GAAqB,iBAAVR,EAChB,IAAK,MAAOS,EAAGC,KAAMT,OAAOC,QAAQF,GAClCJ,EAAKG,GAAKU,GAAKC,YAEMC,IAAdf,EAAKG,GACdH,EAAKgB,aAAab,EAAKC,GAEvBJ,EAAKG,GAAOC,EAGhB,IAAK,MAAMa,KAASlB,EAClBC,EAAKkB,YAAYD,EAGrB,CAIEE,CAAanB,EAAMF,EAAOC,GACnBC,CACT,CAQA,IAAIoB,EAAS,ECjCN,SAASC,EAAgBC,EAAOlB,GACrC,MAAMmB,EAAMD,EAAME,QAAQpB,GAI1B,OAHImB,GACFD,EAAMG,OAAOF,EAAK,GAEbD,CACT,CAaO,SAASI,EAAMZ,EAAGa,EAAKC,GAC5B,OAAOC,KAAKD,IAAID,EAAKE,KAAKF,IAAIC,EAAKd,GACrC,CAEO,MAAMgB,EAA4C,oBAAtBC,kBAC/B,SAA0CC,GAC1C,OAAOA,GAAKA,EAAEC,SAAWD,EAAEC,kBAAkBC,aAAeF,EAAEC,kBAAkBF,kBACjF,EACC,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9f,MAAK4d,GAAW5d,KAAKgB,EAAE,OACvBhB,MAAK+b,GAAa/b,KAAKgB,EAAE,iBACzBhB,MAAK0V,EAAc1V,KAAKgB,EAAE,kBAC1Buc,GAAmBvd,MAAK4d,GAAU,GAAK,IAAK,IAAM5d,MAAK+f,IACxD,CACDA,MACE,MAAOtM,EAAGG,GAAK5T,MAAKic,GACpBjc,MAAK+b,GAAWxf,aAAa,IAAK,QAAQkX,KAAKG,KAC/C5T,MAAK0V,EAAYnZ,aAAa,YAAa,aAAakX,MAAMG,KAC/D,CACD5Q,cAAc3G,GACZ2D,MAAKic,GAAO,GAAK5f,EAAE,GACnB2D,MAAKic,GAAO,GAAK5f,EAAE,GACnB2D,MAAK+f,IACN,ECpCY,MAAMC,WAAalJ,GAChC/W,YAAY6C,EAAQC,GAClBrB,MAAMoB,EAAQC,EAAU,eAExB,MAAMod,EAAcnjB,IACX,CACL4C,SAAWrD,IACT,MAAMyE,EAAOd,KAAKsH,WAClBxG,EAAKhE,GAAOT,EACZ2D,KAAKN,SAASoB,EAAK,EAErB+E,cAAgBxJ,IACd,MAAMyE,EAAOd,KAAKsH,WAClBxG,EAAKhE,GAAOT,EACZ2D,KAAK6F,cAAc/E,EAAK,IAK9Bd,KAAKmX,OAAO,IAAInO,EAAWiX,EAAW,GAAI,CACxCthB,WAAY,CACVF,GAAIpC,GAAKA,EAAE,GACXsB,KAAMqK,EAAYrK,SAGtBqC,KAAKmX,OAAO,IAAInO,EAAWiX,EAAW,GAAI,CACxCthB,WAAY,CACVF,GAAIpC,GAAKA,EAAE,GACXsB,KAAMqK,EAAYrK,SAGtBqC,KAAKoX,UAAU,IAAIyI,GAAS7f,OAC5BA,KAAKgD,eACN"}
\ No newline at end of file
+{"version":3,"file":"muigui.module.min.js","sources":["../../src/styles/muigui.css.js","../../src/libs/elem.js","../../src/libs/utils.js","../../../src/views/View.ts","../../src/controllers/Controller.js","../../src/controllers/Button.js","../../src/views/EditView.js","../../src/views/CheckboxView.js","../../src/libs/taskrunner.js","../../src/libs/ids.js","../../src/views/ValueView.js","../../src/controllers/LabelController.js","../../src/controllers/ValueController.js","../../src/controllers/Checkbox.js","../../src/libs/conversions.js","../../src/libs/wheel.js","../../src/views/NumberView.js","../../src/controllers/TextNumber.js","../../src/views/SelectView.js","../../src/libs/key-values.js","../../src/controllers/Select.js","../../src/views/RangeView.js","../../src/controllers/Range.js","../../src/views/TextView.js","../../src/controllers/Text.js","../../src/libs/color-utils.js","../../src/views/ElementView.js","../../src/controllers/Canvas.js","../../src/views/ColorView.js","../../src/controllers/Color.js","../../src/controllers/Divider.js","../../src/controllers/Container.js","../../src/controllers/Folder.js","../../src/controllers/Label.js","../../src/libs/touch.js","../../src/views/ColorChooserView.js","../../src/controllers/PopDownController.js","../../src/controllers/ColorChooser.js","../../src/muigui.js","../../src/controllers/create-controller.js","../../src/libs/keyboard.js","../../src/libs/assert.js","../../src/libs/svg.js","../../src/views/DirectionView.js","../../src/controllers/Direction.js","../../src/views/RadioGridView.js","../../src/controllers/RadioGrid.js","../../src/libs/resize-helpers.js","../../src/views/SliderView.js","../../src/controllers/Slider.js","../../src/views/Vec2View.js","../../src/controllers/Vec2.js","../../src/libs/graph.js","../../../src/esm.ts","../../src/libs/monitor.js"],"sourcesContent":["export default {\n default: `\n.muigui {\n --bg-color: #ddd;\n --color: #222;\n --contrast-color: #eee;\n --value-color: #145 ;\n --value-bg-color: #eeee;\n --disabled-color: #999;\n --menu-bg-color: #f8f8f8;\n --menu-sep-color: #bbb;\n --hover-bg-color: #999;\n --focus-color: #8BF;\n --range-color: #AAA;\n --invalid-color: #FF0000;\n --selected-color: rgb(255, 255, 255, 0.9);\n\n --button-bg-color: var(--value-bg-color);\n\n --image-open: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPgogIDxyZWN0IHN0eWxlPSJmaWxsOiAjNDQ0OyIgeD0iMjAlIiB5PSI0NSUiIHdpZHRoPSI2MCUiIGhlaWdodD0iMTAlIj48L3JlY3Q+Cjwvc3ZnPg==);\n --image-closed: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPgogIDxyZWN0IHN0eWxlPSJmaWxsOiAjNDQ0OyIgeD0iNDUlIiB5PSIyMCUiIHdpZHRoPSIxMCUiIGhlaWdodD0iNjAlIj48L3JlY3Q+CiAgPHJlY3Qgc3R5bGU9ImZpbGw6ICM0NDQ7IiB4PSIyMCUiIHk9IjQ1JSIgd2lkdGg9IjYwJSIgaGVpZ2h0PSIxMCUiPjwvcmVjdD4KPC9zdmc+);\n --image-checkerboard: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPgogIDxyZWN0IHN0eWxlPSJmaWxsOiAjNDA0MDQwOyIgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSI+PC9yZWN0PgogIDxyZWN0IHN0eWxlPSJmaWxsOiAjODA4MDgwOyIgeD0iMCIgeT0iMCIgd2lkdGg9IjUwJSIgaGVpZ2h0PSI1MCUiPjwvcmVjdD4KICA8cmVjdCBzdHlsZT0iZmlsbDogIzgwODA4MDsiIHg9IjUwJSIgeT0iNTAlIiB3aWR0aD0iNTAlIiBoZWlnaHQ9IjUwJSI+PC9yZWN0Pgo8L3N2Zz4=);\n\n --range-left-color: var(--value-color);\n --range-right-color: var(--value-bg-color); \n --range-right-hover-color: var(--hover-bg-color);\n --button-image: \n linear-gradient(\n rgba(255, 255, 255, 1), rgba(0, 0, 0, 0.2)\n );\n\n color: var(--color);\n background-color: var(--bg-color);\n}\n\n@media (prefers-color-scheme: dark) {\n .muigui {\n --bg-color: #222222;\n --color: #dddddd;\n --contrast-color: #000;\n --value-color: #43e5f7;\n --value-bg-color: #444444;\n --disabled-color: #666666;\n --menu-bg-color: #080808;\n --menu-sep-color: #444444;\n --hover-bg-color: #666666;\n --focus-color: #458; /*#88AAFF*/;\n --range-color: #888888;\n --invalid-color: #FF6666;\n --selected-color: rgba(255, 255, 255, 0.3);\n\n --button-bg-color: var(--value-bg-color);\n\n --range-left-color: var(--value-color);\n --range-right-color: var(--value-bg-color); \n --range-right-hover-color: var(--hover-bg-color);\n --button-image: linear-gradient(\n rgba(0, 0, 0, 0.1), rgba(0, 0, 0, 0.4)\n );\n\n color: var(--color);\n background-color: var(--bg-color);\n\n --image-closed: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPgogIDxyZWN0IHN0eWxlPSJmaWxsOiAjREREOyIgeD0iMjAlIiB5PSI0NSUiIHdpZHRoPSI2MCUiIGhlaWdodD0iMTAlIj48L3JlY3Q+Cjwvc3ZnPg==);\n --image-open: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPgogIDxyZWN0IHN0eWxlPSJmaWxsOiAjREREOyIgeD0iNDUlIiB5PSIyMCUiIHdpZHRoPSIxMCUiIGhlaWdodD0iNjAlIj48L3JlY3Q+CiAgPHJlY3Qgc3R5bGU9ImZpbGw6ICNEREQ7IiB4PSIyMCUiIHk9IjQ1JSIgd2lkdGg9IjYwJSIgaGVpZ2h0PSIxMCUiPjwvcmVjdD4KPC9zdmc+);\n }\n}\n\n.muigui {\n --width: 250px;\n --label-width: 45%;\n --number-width: 40%;\n\n --font-family: -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, Arial, sans-serif;\n --font-size: 11px;\n --font-family-mono: Menlo, Monaco, Consolas, \"Droid Sans Mono\", monospace;\n --font-size-mono: 11px;\n\n --line-height: 1.7em;\n --border-radius: 0px;\n\n width: var(--width);\n font-family: var(--font-family);\n font-size: var(--font-size);\n box-sizing: border-box;\n line-height: 100%;\n}\n.muigui * {\n box-sizing: inherit;\n}\n\n.muigui-no-scroll {\n touch-action: none;\n}\n.muigui-no-h-scroll {\n touch-action: pan-y;\n}\n.muigui-no-v-scroll {\n touch-action: pan-x;\n}\n\n.muigui-invalid-value {\n background-color: red !important;\n color: white !important;\n}\n\n.muigui-grid {\n display: grid;\n}\n.muigui-rows {\n display: flex;\n flex-direction: column;\n\n min-height: 20px;\n border: 2px solid red;\n}\n.muigui-columns {\n display: flex;\n flex-direction: row;\n\n height: 20px;\n border: 2px solid green;\n}\n.muigui-rows>*,\n.muigui-columns>* {\n flex: 1 1 auto;\n align-items: stretch;\n min-height: 0;\n min-width: 0;\n}\n\n.muigui-row {\n border: 2px solid yellow;\n min-height: 10px\n}\n.muigui-column {\n border: 2px solid lightgreen;\n}\n\n/* -------- */\n\n.muigui-show { /* */ }\n.muigui-hide { \n display: none !important;\n}\n.muigui-disabled {\n pointer-events: none;\n --color: var(--disabled-color) !important;\n --value-color: var(--disabled-color) !important;\n --range-left-color: var(--disabled-color) !important;\n}\n\n.muigui canvas,\n.muigui svg {\n display: block;\n border-radius: var(--border-radius);\n}\n.muigui canvas {\n background-color: var(--value-bg-color);\n}\n\n.muigui-controller {\n min-width: 0;\n min-height: var(--line-height);\n}\n.muigui-root {\n z-index: 1;\n}\n.muigui-root,\n.muigui-menu {\n display: flex;\n flex-direction: column;\n position: relative;\n user-select: none;\n height: fit-content;\n margin: 0;\n padding-bottom: 0.1em;\n border-radius: var(--border-radius);\n}\n.muigui-menu {\n border-bottom: 1px solid var(--menu-sep-color);\n}\n\n.muigui-root>button:nth-child(1),\n.muigui-menu>button:nth-child(1) {\n border-top: 1px solid var(--menu-sep-color);\n border-bottom: 1px solid var(--menu-sep-color);\n position: relative;\n text-align: left;\n color: var(--color);\n background-color: var(--menu-bg-color);\n min-height: var(--line-height);\n padding: 0.2em;\n cursor: pointer;\n border-radius: var(--border-radius);\n}\n.muigui-root>div:nth-child(2),\n.muigui-menu>div:nth-child(2) {\n flex: 1 1 auto;\n}\n\n.muigui-controller {\n margin-left: 0.2em;\n margin-right: 0.2em;\n}\n.muigui-root.muigui-controller,\n.muigui-menu.muigui-controller {\n margin-left: 0;\n margin-right: 0;\n}\n.muigui-controller>*:nth-child(1) {\n flex: 1 0 var(--label-width);\n min-width: 0;\n /* white-space: pre; why?? */\n}\n.muigui-controller>label:nth-child(1) {\n place-content: center start;\n display: inline-grid;\n overflow: hidden;\n}\n.muigui-controller>*:nth-child(2) {\n flex: 1 1 75%;\n min-width: 0;\n}\n\n/* -----------------------------------------\n a label controller is [[label][value]]\n*/\n\n.muigui-label-controller {\n display: flex;\n margin: 0.4em 0 0.4em 0;\n word-wrap: initial;\n align-items: stretch;\n}\n\n.muigui-value {\n display: flex;\n align-items: stretch;\n}\n.muigui-value>* {\n flex: 1 1 auto;\n min-width: 0;\n}\n.muigui-value>*:nth-child(1) {\n flex: 1 1 calc(100% - var(--number-width));\n}\n.muigui-value>*:nth-child(2) {\n flex: 1 1 var(--number-width);\n margin-left: 0.2em;\n}\n\n/* fix! */\n.muigui-open>button>label::before,\n.muigui-closed>button>label::before {\n content: \"X\";\n color: rgba(0, 0, 0, 0);\n background-color: var(--range-color);\n border-radius: 0.2em;\n width: 1.25em;\n margin-right: 0.25em;\n height: 1.25em; /*var(--line-height);*/\n display: inline-grid;\n place-content: center start;\n pointer-events: none;\n}\n.muigui-open>button>label::before {\n background-image: var(--image-open);\n}\n.muigui-closed>button>label::before {\n background-image: var(--image-closed);\n}\n\n.muigui-open>.muigui-open-container {\n transition: all 0.1s ease-out;\n overflow: auto;\n height: 100%;\n}\n.muigui-closed>.muigui-open-container {\n transition: all 0.1s ease-out;\n overflow: hidden;\n min-height: 0;\n}\n.muigui-open>.muigui-open-container>* {\n transition: all 0.1s ease-out;\n margin-top: 0px;\n}\n.muigui-closed>.muigui-open-container>* {\n transition: all 0.1s ease-out;\n margin-top: -100%;\n}\n\n/* ---- popdown ---- */\n\n.muigui-pop-down-top {\n display: flex;\n}\n/* fix? */\n.muigui-value>*:nth-child(1).muigui-pop-down-top {\n flex: 0;\n}\n.muigui-closed .muigui-pop-down-bottom {\n max-height: 0;\n}\n\n.muigui-value .muigui-pop-down-bottom {\n margin: 0;\n}\n\n.muigui-pop-down-values {\n min-width: 0;\n display: flex;\n}\n.muigui-pop-down-values>* {\n flex: 1 1 auto;\n min-width: 0;\n}\n\n.muigui-value.muigui-pop-down-controller {\n flex-direction: column;\n}\n\n.muigui-pop-down-top input[type=checkbox] {\n -webkit-appearance: none;\n appearance: none;\n width: auto;\n color: var(--value-color);\n background-color: var(--value-bg-color);\n background-image: var(--image-checkerboard);\n background-size: 10px 10px;\n background-position: 0 0, 0 5px, 5px -5px, -5px 0px;\n\n cursor: pointer;\n\n display: grid;\n place-content: center;\n margin: 0;\n font: inherit;\n color: currentColor;\n width: 1.7em;\n height: 1.7em;\n transform: translateY(-0.075em);\n}\n\n.muigui-pop-down-top input[type=checkbox]::before {\n content: \"+\";\n display: grid;\n place-content: center;\n border-radius: calc(var(--border-radius) + 2px);\n border-left: 1px solid rgba(255,255,255,0.3);\n border-top: 1px solid rgba(255,255,255,0.3);\n border-bottom: 1px solid rgba(0,0,0,0.2);\n border-right: 1px solid rgba(0,0,0,0.2);\n background-color: var(--range-color);\n color: var(--value-bg-color);\n width: calc(var(--line-height) - 4px);\n height: calc(var(--line-height) - 4px);\n}\n\n.muigui-pop-down-top input[type=checkbox]:checked::before {\n content: \"X\";\n}\n\n\n/* ---- select ---- */\n\n.muigui select,\n.muigui option,\n.muigui input,\n.muigui button {\n color: var(--value-color);\n background-color: var(--value-bg-color);\n font-family: var(--font-family);\n font-size: var(--font-size);\n border: none;\n margin: 0;\n border-radius: var(--border-radius);\n}\n.muigui select {\n appearance: none;\n margin: 0;\n margin-left: 0; /*?*/\n overflow: hidden; /* Safari */\n}\n\n.muigui select:focus,\n.muigui input:focus,\n.muigui button:focus {\n outline: 1px solid var(--focus-color);\n}\n\n.muigui select:hover,\n.muigui option:hover,\n.muigui input:hover,\n.muigui button:hover {\n background-color: var(--hover-bg-color); \n}\n\n/* ------ [ label ] ------ */\n\n.muigui-label {\n border-top: 1px solid var(--menu-sep-color);\n border-bottom: 1px solid var(--menu-sep-color);\n padding-top: 0.4em;\n padding-bottom: 0.3em;\n place-content: center start;\n background-color: var(--menu-bg-color);\n white-space: pre;\n border-radius: var(--border-radius);\n}\n\n/* ------ [ divider] ------ */\n\n.muigui-divider {\n min-height: 6px;\n border-top: 2px solid var(--menu-sep-color);\n margin-top: 6px;\n}\n\n/* ------ [ button ] ------ */\n\n.muigui-button {\n display: grid;\n padding: 2px 0 2px 0;\n}\n.muigui-button button {\n border: none;\n color: var(--value-color);\n background-color: var(--button-bg-color);\n background-image: var(--button-image);\n cursor: pointer;\n place-content: center center;\n height: var(--line-height);\n}\n\n/* ------ [ color ] ------ */\n\n.muigui-color>div {\n overflow: hidden;\n position: relative;\n margin-left: 0;\n margin-right: 0; /* why? */\n max-width: var(--line-height);\n border-radius: var(--border-radius);\n}\n\n.muigui-color>div:focus-within {\n outline: 1px solid var(--focus-color);\n}\n\n.muigui-color input[type=color] {\n border: none;\n padding: 0;\n background: inherit;\n cursor: pointer;\n position: absolute;\n width: 200%;\n left: -10px;\n top: -10px;\n height: 200%;\n}\n.muigui-disabled canvas,\n.muigui-disabled svg,\n.muigui-disabled img,\n.muigui-disabled .muigui-color input[type=color] {\n opacity: 0.2;\n}\n\n/* ------ [ checkbox ] ------ */\n\n.muigui-checkbox>label:nth-child(2) {\n display: grid;\n place-content: center start;\n margin: 0;\n}\n\n.muigui-checkbox input[type=checkbox] {\n -webkit-appearance: none;\n appearance: none;\n width: auto;\n color: var(--value-color);\n background-color: var(--value-bg-color);\n cursor: pointer;\n\n display: grid;\n place-content: center;\n margin: 0;\n font: inherit;\n color: currentColor;\n width: 1.7em;\n height: 1.7em;\n transform: translateY(-0.075em);\n}\n\n.muigui-checkbox input[type=checkbox]::before {\n content: \"\";\n color: var(--value-color);\n display: grid;\n place-content: center;\n}\n\n.muigui-checkbox input[type=checkbox]:checked::before {\n content: \"✔\";\n}\n\n.muigui input[type=number]::-webkit-inner-spin-button, \n.muigui input[type=number]::-webkit-outer-spin-button { \n -webkit-appearance: none;\n appearance: none;\n margin: 0; \n}\n.muigui input[type=number] {\n -moz-appearance: textfield;\n}\n\n/* ------ [ radio grid ] ------ */\n\n.muigui-radio-grid>div {\n display: grid;\n gap: 2px;\n}\n\n.muigui-radio-grid input {\n appearance: none;\n display: none;\n}\n\n.muigui-radio-grid button {\n color: var(--color);\n width: 100%;\n text-align: left;\n}\n\n.muigui-radio-grid input:checked + button {\n color: var(--value-color);\n background-color: var(--selected-color);\n}\n\n/* ------ [ color-chooser ] ------ */\n\n.muigui-color-chooser-cursor {\n stroke-width: 1px;\n stroke: white;\n fill: none;\n}\n.muigui-color-chooser-circle {\n stroke-width: 1px;\n stroke: white;\n fill: none;\n}\n\n\n/* ------ [ vec2 ] ------ */\n\n.muigui-vec2 svg {\n background-color: var(--value-bg-color);\n}\n\n.muigui-vec2-axis {\n stroke: 1px;\n stroke: var(--focus-color);\n}\n\n.muigui-vec2-line {\n stroke-width: 1px;\n stroke: var(--value-color);\n fill: var(--value-color);\n}\n\n/* ------ [ direction ] ------ */\n\n.muigui-direction svg {\n background-color: rgba(0,0,0,0.2);\n}\n\n.muigui-direction:focus-within svg {\n outline: none;\n}\n.muigui-direction-range {\n fill: var(--value-bg-color);\n}\n.muigui-direction svg:focus {\n outline: none;\n}\n.muigui-direction svg:focus .muigui-direction-range {\n stroke-width: 0.5px;\n stroke: var(--focus-color);\n}\n\n.muigui-direction-arrow {\n fill: var(--value-color);\n}\n\n/* ------ [ slider ] ------ */\n\n.muigui-slider>div {\n display: flex;\n align-items: stretch;\n height: var(--line-height);\n}\n.muigui-slider svg {\n flex: 1 1 auto;\n}\n.muigui-slider .muigui-slider-up #muigui-orientation {\n transform: scale(1, -1) translateY(-100%);\n}\n\n.muigui-slider .muigui-slider-up #muigui-number-orientation {\n transform: scale(1,-1);\n}\n\n.muigui-ticks {\n stroke: var(--range-color);\n}\n.muigui-thicks {\n stroke: var(--color);\n stroke-width: 2px;\n}\n.muigui-svg-text {\n fill: var(--color);\n font-size: 7px;\n}\n.muigui-mark {\n fill: var(--value-color);\n}\n\n/* ------ [ range ] ------ */\n\n\n.muigui-range input[type=range] {\n -webkit-appearance: none;\n appearance: none;\n background-color: transparent;\n}\n\n.muigui-range input[type=range]::-webkit-slider-thumb {\n -webkit-appearance: none;\n appearance: none;\n border-radius: calc(var(--border-radius) + 2px);\n border-left: 1px solid rgba(255,255,255,0.3);\n border-top: 1px solid rgba(255,255,255,0.3);\n border-bottom: 1px solid rgba(0,0,0,0.2);\n border-right: 1px solid rgba(0,0,0,0.2);\n background-color: var(--range-color);\n margin-top: calc((var(--line-height) - 6px) / -2);\n width: calc(var(--line-height) - 6px);\n height: calc(var(--line-height) - 6px);\n}\n\n.muigui-range input[type=range]::-webkit-slider-runnable-track {\n -webkit-appearance: none;\n appearance: none;\n border: 1px solid var(--menu-sep-color);\n height: 2px;\n}\n\n\n/* dat.gui style - doesn't work on Safari iOS */\n\n/*\n.muigui-range input[type=range] {\n cursor: ew-resize;\n overflow: hidden;\n}\n\n.muigui-range input[type=range] {\n -webkit-appearance: none;\n appearance: none;\n background-color: var(--range-right-color);\n margin: 0;\n}\n.muigui-range input[type=range]:hover {\n background-color: var(--range-right-hover-color);\n}\n\n.muigui-range input[type=range]::-webkit-slider-runnable-track {\n -webkit-appearance: none;\n appearance: none;\n height: max-content;\n color: var(--range-left-color);\n margin-top: -1px;\n}\n\n.muigui-range input[type=range]::-webkit-slider-thumb {\n -webkit-appearance: none;\n appearance: none;\n width: 0px;\n height: max-content;\n box-shadow: -1000px 0 0 1000px var(--range-left-color);\n}\n*/\n\n/* FF */\n/*\n.muigui-range input[type=range]::-moz-slider-progress {\n background-color: var(--range-left-color); \n}\n.muigui-range input[type=range]::-moz-slider-thumb {\n height: max-content;\n width: 0;\n border: none;\n box-shadow: -1000px 0 0 1000px var(--range-left-color);\n box-sizing: border-box;\n}\n*/\n\n.muigui-checkered-background {\n background-color: #404040;\n background-image:\n linear-gradient(45deg, #808080 25%, transparent 25%),\n linear-gradient(-45deg, #808080 25%, transparent 25%),\n linear-gradient(45deg, transparent 75%, #808080 75%),\n linear-gradient(-45deg, transparent 75%, #808080 75%);\n background-size: 16px 16px;\n background-position: 0 0, 0 8px, 8px -8px, -8px 0px;\n}\n\n/* ---------------------------------------------------------- */\n\n/* needs to be at bottom to take precedence */\n.muigui-auto-place {\n max-height: 100%;\n position: fixed;\n top: 0;\n right: 15px;\n z-index: 100001;\n}\n\n`,\nthemes: {\n default: {\n include: ['default'],\n css: `\n `,\n },\n float: {\n include: ['default'],\n css: `\n :root {\n color-scheme: light dark,\n }\n\n .muigui {\n --width: 400px;\n --bg-color: initial;\n --label-width: 25%;\n --number-width: 20%;\n }\n\n input,\n .muigui-label-controller>label {\n text-shadow:\n -1px -1px 0 var(--contrast-color),\n 1px -1px 0 var(--contrast-color),\n -1px 1px 0 var(--contrast-color),\n 1px 1px 0 var(--contrast-color);\n }\n\n .muigui-controller > label:nth-child(1) {\n place-content: center end;\n margin-right: 1em;\n }\n\n .muigui-value > :nth-child(2) {\n margin-left: 1em;\n }\n\n .muigui-root>*:nth-child(1) {\n display: none;\n }\n\n .muigui-range input[type=range]::-webkit-slider-thumb {\n border-radius: 1em;\n }\n\n .muigui-range input[type=range]::-webkit-slider-runnable-track {\n -webkit-appearance: initial;\n appearance: none;\n border: 1px solid rgba(0, 0, 0, 0.25);\n height: 2px;\n }\n\n .muigui-colors {\n --value-color: var(--color );\n --value-bg-color: rgba(0, 0, 0, 0.1);\n --disabled-color: #cccccc;\n --menu-bg-color: rgba(0, 0, 0, 0.1);\n --menu-sep-color: #bbbbbb;\n --hover-bg-color: rgba(0, 0, 0, 0);\n --invalid-color: #FF0000;\n --selected-color: rgba(0, 0, 0, 0.3);\n --range-color: rgba(0, 0, 0, 0.125);\n }\n`,\n },\n form: {\n include: [],\n css: `\n .muigui {\n --width: 100%;\n --label-width: 45%;\n --number-width: 40%;\n }\n .muigui-root>button {\n display: none;\n }\n .muigui-controller {\n margin-top: 1em;\n }\n .muigui-label-controller {\n display: flex;\n flex-direction: column;\n align-items: stretch;\n margin-top: 1em;\n }\n .muigui-label-controller:has(.muigui-checkbox) {\n flex-direction: row;\n }\n .muigui-value {\n display: flex;\n align-items: stretch;\n }\n .muigui-value>* {\n flex: 1 1 auto;\n min-width: 0;\n }\n .muigui-controller>*:nth-child(1) {\n flex: 1 0 var(--label-width);\n min-width: 0;\n white-space: pre;\n }\n .muigui-controller>label:nth-child(1) {\n place-content: center start;\n display: inline-grid;\n overflow: hidden;\n }\n .muigui-controller>*:nth-child(2) {\n flex: 1 1 75%;\n min-width: 0;\n }\n `,\n },\n none: {\n include: [],\n css: '',\n },\n},\n};\n","export function setElemProps(elem, attrs, children) {\n for (const [key, value] of Object.entries(attrs)) {\n if (typeof value === 'function' && key.startsWith('on')) {\n const eventName = key.substring(2).toLowerCase();\n elem.addEventListener(eventName, value, {passive: false});\n } else if (typeof value === 'object') {\n for (const [k, v] of Object.entries(value)) {\n elem[key][k] = v;\n }\n } else if (elem[key] === undefined) {\n elem.setAttribute(key, value);\n } else {\n elem[key] = value;\n }\n }\n for (const child of children) {\n elem.appendChild(child);\n }\n return elem;\n}\n\nexport function createElem(tag, attrs = {}, children = []) {\n const elem = document.createElement(tag);\n setElemProps(elem, attrs, children);\n return elem;\n}\n\nexport function addElem(tag, parent, attrs = {}, children = []) {\n const elem = createElem(tag, attrs, children);\n parent.appendChild(elem);\n return elem;\n}\n\nlet nextId = 0;\nexport function getNewId() {\n return `muigui-id-${nextId++}`;\n}\n","export function removeArrayElem(array, value) {\n const ndx = array.indexOf(value);\n if (ndx) {\n array.splice(ndx, 1);\n }\n return array;\n}\n\n/**\n * Converts an camelCase or snake_case id to \"camel case\" or \"snake case\"\n * @param {string} id\n */\nconst underscoreRE = /_/g;\nconst upperLowerRE = /([A-Z])([a-z])/g;\nexport function idToLabel(id) {\n return id.replace(underscoreRE, ' ')\n .replace(upperLowerRE, (m, m1, m2) => `${m1.toLowerCase()} ${m2}`);\n}\n\nexport function clamp(v, min, max) {\n return Math.max(min, Math.min(max, v));\n}\n\nexport const isTypedArray = typeof SharedArrayBuffer !== 'undefined'\n ? function isArrayBufferOrSharedArrayBuffer(a) {\n return a && a.buffer && (a.buffer instanceof ArrayBuffer || a.buffer instanceof SharedArrayBuffer);\n }\n : function isArrayBuffer(a) {\n return a && a.buffer && a.buffer instanceof ArrayBuffer;\n };\n\nexport const isArrayOrTypedArray = v => Array.isArray(v) || isTypedArray(v);\n\n// Yea, I know this should be `Math.round(v / step) * step\n// but try step = 0.1, newV = 19.95\n//\n// I get\n// Math.round(19.95 / 0.1) * 0.1\n// 19.900000000000002\n// vs\n// Math.round(19.95 / 0.1) / (1 / 0.1)\n// 19.9\n//\nexport const stepify = (v, from, step) => Math.round(from(v) / step) / (1 / step);\n\nexport const euclideanModulo = (v, n) => ((v % n) + n) % n;\nexport const lerp = (a, b, t) => a + (b - a) * t;\nexport function copyExistingProperties(dst, src) {\n for (const key in src) {\n if (key in dst) {\n dst[key] = src[key];\n }\n }\n return dst;\n}\n\nexport const mapRange = (v, inMin, inMax, outMin, outMax) => (v - inMin) * (outMax - outMin) / (inMax - inMin) + outMin;\n\nexport const makeRangeConverters = ({from, to}) => {\n return {\n to: v => mapRange(v, ...from, ...to),\n from: v => [true, mapRange(v, ...to, ...from)],\n };\n};\n\nexport const makeRangeOptions = ({from, to, step}) => {\n return {\n min: to[0],\n max: to[1],\n ...(step && {step}),\n converters: makeRangeConverters({from, to}),\n };\n};\n\n// TODO: remove an use one in conversions. Move makeRangeConverters there?\nexport const identity = {\n to: v => v,\n from: v => [true, v],\n};\nexport function makeMinMaxPair(gui, properties, minPropName, maxPropName, options) {\n const { converters: { from } = identity } = options;\n const { min, max } = options;\n const guiMinRange = options.minRange || 0;\n const valueMinRange = from(guiMinRange)[1];\n const minGui = gui\n .add(properties, minPropName, {\n ...options,\n min,\n max: max - guiMinRange,\n })\n .onChange(v => {\n maxGui.setValue(Math.min(max, Math.max(v + valueMinRange, properties[maxPropName])));\n });\n const maxGui = gui\n .add(properties, maxPropName, {\n ...options,\n min: min + guiMinRange,\n max,\n })\n .onChange(v => {\n minGui.setValue(Math.max(min, Math.min(v - valueMinRange, properties[minPropName])));\n });\n return [ minGui, maxGui ];\n}\n\n","import { removeArrayElem } from '../libs/utils.js';\n\nexport default class View {\n domElement: HTMLElement;\n\n #childDestElem: HTMLElement;\n #views: View[] = [];\n\n constructor(elem: HTMLElement) {\n this.domElement = elem;\n this.#childDestElem = elem;\n }\n addElem(elem: HTMLElement) {\n this.#childDestElem.appendChild(elem);\n return elem;\n }\n removeElem(elem: HTMLElement) {\n this.#childDestElem.removeChild(elem);\n return elem;\n }\n pushSubElem(elem: HTMLElement) {\n this.#childDestElem.appendChild(elem);\n this.#childDestElem = elem;\n }\n popSubElem() {\n this.#childDestElem = this.#childDestElem.parentElement!;\n }\n add(view: View) {\n this.#views.push(view);\n this.addElem(view.domElement);\n return view;\n }\n remove(view: View) {\n this.removeElem(view.domElement);\n removeArrayElem(this.#views, view);\n return view;\n }\n pushSubView(view: View) {\n this.pushSubElem(view.domElement);\n }\n popSubView() {\n this.popSubElem();\n }\n setOptions(options: any) {\n for (const view of this.#views) {\n view.setOptions(options);\n }\n }\n updateDisplayIfNeeded(newV: any, ignoreCache?: boolean) {\n for (const view of this.#views) {\n view.updateDisplayIfNeeded(newV, ignoreCache);\n }\n return this;\n }\n $(selector: string) {\n return this.domElement.querySelector(selector);\n }\n}","import { createElem } from '../libs/elem.js';\nimport { removeArrayElem } from '../libs/utils.js';\nimport View from '../views/View.js';\n\nexport default class Controller extends View {\n #changeFns;\n #finishChangeFns;\n #parent;\n\n constructor(className) {\n super(createElem('div', {className: 'muigui-controller'}));\n this.#changeFns = [];\n this.#finishChangeFns = [];\n // we need the specialization to come last so it takes precedence.\n if (className) {\n this.domElement.classList.add(className);\n }\n }\n get parent() {\n return this.#parent;\n }\n setParent(parent) {\n this.#parent = parent;\n this.enable(!this.disabled());\n }\n show(show = true) {\n this.domElement.classList.toggle('muigui-hide', !show);\n this.domElement.classList.toggle('muigui-show', show);\n return this;\n }\n hide() {\n return this.show(false);\n }\n disabled() {\n return !!this.domElement.closest('.muigui-disabled');\n }\n\n enable(enable = true) {\n this.domElement.classList.toggle('muigui-disabled', !enable);\n\n // If disabled we need to set the attribute 'disabled=true' to all\n // input/select/button/textarea's below\n //\n // If enabled we need to set the attribute 'disabled=false' to all below\n // until we hit a disabled controller.\n //\n // ATM the problem is we can find the input/select/button/textarea elements\n // but we can't easily find which controller they belong do.\n // But we don't need to? We can just check up if it or parent has\n // '.muigui-disabled'\n ['input', 'button', 'select', 'textarea'].forEach(tag => {\n this.domElement.querySelectorAll(tag).forEach(elem => {\n const disabled = !!elem.closest('.muigui-disabled');\n elem.disabled = disabled;\n });\n });\n\n return this;\n }\n disable(disable = true) {\n return this.enable(!disable);\n }\n onChange(fn) {\n this.removeChange(fn);\n this.#changeFns.push(fn);\n return this;\n }\n removeChange(fn) {\n removeArrayElem(this.#changeFns, fn);\n return this;\n }\n onFinishChange(fn) {\n this.removeFinishChange(fn);\n this.#finishChangeFns.push(fn);\n return this;\n }\n removeFinishChange(fn) {\n removeArrayElem(this.#finishChangeFns, fn);\n return this;\n }\n #callListeners(fns, newV) {\n for (const fn of fns) {\n fn.call(this, newV);\n }\n }\n emitChange(value, object, property) {\n this.#callListeners(this.#changeFns, value);\n if (this.#parent) {\n if (object === undefined) {\n this.#parent.emitChange(value);\n } else {\n this.#parent.emitChange({\n object,\n property,\n value,\n controller: this,\n });\n }\n }\n }\n emitFinalChange(value, object, property) {\n this.#callListeners(this.#finishChangeFns, value);\n if (this.#parent) {\n if (object === undefined) {\n this.#parent.emitChange(value);\n } else {\n this.#parent.emitFinalChange({\n object,\n property,\n value,\n controller: this,\n });\n }\n }\n }\n updateDisplay() {\n // placeholder. override\n }\n getColors() {\n const toCamelCase = s => s.replace(/-([a-z])/g, (m, m1) => m1.toUpperCase());\n const keys = [\n 'color',\n 'bg-color',\n 'value-color',\n 'value-bg-color',\n 'hover-bg-color',\n 'menu-bg-color',\n 'menu-sep-color',\n 'disabled-color',\n ];\n const div = createElem('div');\n this.domElement.appendChild(div);\n const colors = Object.fromEntries(keys.map(key => {\n div.style.color = `var(--${key})`;\n const s = getComputedStyle(div);\n return [toCamelCase(key), s.color];\n }));\n div.remove();\n return colors;\n }\n}\n","import {\n createElem,\n} from '../libs/elem.js';\nimport { copyExistingProperties } from '../libs/utils.js';\nimport Controller from './Controller.js';\n\nexport default class Button extends Controller {\n #object;\n #property;\n #buttonElem;\n #options = {\n name: '',\n };\n\n constructor(object, property, options = {}) {\n super('muigui-button', '');\n this.#object = object;\n this.#property = property;\n\n this.#buttonElem = this.addElem(\n createElem('button', {\n type: 'button',\n onClick: () => {\n this.#object[this.#property](this);\n },\n }));\n this.setOptions({name: property, ...options});\n }\n name(name) {\n this.#buttonElem.textContent = name;\n }\n setOptions(options) {\n copyExistingProperties(this.#options, options);\n const {name} = this.#options;\n this.#buttonElem.textContent = name;\n }\n}","import { isTypedArray } from '../libs/utils.js';\nimport View from './View.js';\n\nfunction arraysEqual(a, b) {\n if (a.length !== b.length) {\n return false;\n }\n for (let i = 0; i < a.length; ++i) {\n if (a[i] !== b[i]) {\n return false;\n }\n }\n return true;\n}\n\nfunction copyArrayElementsFromTo(src, dst) {\n dst.length = src.length;\n for (let i = 0; i < src.length; ++i) {\n dst[i] = src[i];\n }\n}\n\nexport default class EditView extends View {\n #oldV;\n #updateCheck;\n\n #checkArrayNeedsUpdate(newV) {\n // It's an array, we need to compare all elements\n // Example, vec2, [r,g,b], ...\n const needUpdate = !arraysEqual(newV, this.#oldV);\n if (needUpdate) {\n copyArrayElementsFromTo(newV, this.#oldV);\n }\n return needUpdate;\n }\n\n #checkTypedArrayNeedsUpdate() {\n let once = true;\n return function checkTypedArrayNeedsUpdateImpl(newV) {\n // It's a typedarray, we need to compare all elements\n // Example: Float32Array([r, g, b])\n let needUpdate = once;\n once = false;\n if (!needUpdate) {\n needUpdate = !arraysEqual(newV, this.#oldV);\n }\n return needUpdate;\n };\n }\n\n #checkObjectNeedsUpdate(newV) {\n let needUpdate = false;\n for (const key in newV) {\n if (newV[key] !== this.#oldV[key]) {\n needUpdate = true;\n this.#oldV[key] = newV[key];\n }\n }\n return needUpdate;\n }\n\n #checkValueNeedsUpdate(newV) {\n const needUpdate = newV !== this.#oldV;\n this.#oldV = newV;\n return needUpdate;\n }\n\n #getUpdateCheckForType(newV) {\n if (Array.isArray(newV)) {\n this.#oldV = [];\n return this.#checkArrayNeedsUpdate.bind(this);\n } else if (isTypedArray(newV)) {\n this.#oldV = new newV.constructor(newV);\n return this.#checkTypedArrayNeedsUpdate(this);\n } else if (typeof newV === 'object') {\n this.#oldV = {};\n return this.#checkObjectNeedsUpdate.bind(this);\n } else {\n return this.#checkValueNeedsUpdate.bind(this);\n }\n }\n\n // The point of this is updating DOM elements\n // is slow but if we've called `listen` then\n // every frame we're going to try to update\n // things with the current value so if nothing\n // has changed then skip it.\n updateDisplayIfNeeded(newV, ignoreCache) {\n this.#updateCheck = this.#updateCheck || this.#getUpdateCheckForType(newV);\n // Note: We call #updateCheck first because it updates\n // the cache\n if (this.#updateCheck(newV) || ignoreCache) {\n this.updateDisplay(newV);\n }\n }\n setOptions(/*options*/) {\n // override this\n return this;\n }\n}\n","import { createElem } from '../libs/elem.js';\nimport EditView from './EditView.js';\n\nexport default class CheckboxView extends EditView {\n #checkboxElem;\n constructor(setter, id) {\n const checkboxElem = createElem('input', {\n type: 'checkbox',\n id,\n onInput: () => {\n setter.setValue(checkboxElem.checked);\n },\n onChange: () => {\n setter.setFinalValue(checkboxElem.checked);\n },\n });\n super(createElem('label', {}, [checkboxElem]));\n this.#checkboxElem = checkboxElem;\n }\n updateDisplay(v) {\n this.#checkboxElem.checked = v;\n }\n}\n","import { removeArrayElem } from './utils.js';\n\nconst tasks = [];\nconst tasksToRemove = new Set();\n\nlet requestId;\nlet processing;\n\nfunction removeTasks() {\n if (!tasksToRemove.size) {\n return;\n }\n\n if (processing) {\n queueProcessing();\n return;\n }\n\n tasksToRemove.forEach(task => {\n removeArrayElem(tasks, task);\n });\n tasksToRemove.clear();\n}\n\nfunction processTasks() {\n requestId = undefined;\n processing = true;\n for (const task of tasks) {\n if (!tasksToRemove.has(task)) {\n task();\n }\n }\n processing = false;\n removeTasks();\n queueProcessing();\n}\n\nfunction queueProcessing() {\n if (!requestId && tasks.length) {\n requestId = requestAnimationFrame(processTasks);\n }\n}\n\nexport function addTask(fn) {\n tasks.push(fn);\n queueProcessing();\n}\n\nexport function removeTask(fn) {\n tasksToRemove.set(fn);\n\n const ndx = tasks.indexOf(fn);\n if (ndx >= 0) {\n tasks.splice(ndx, 1);\n }\n}","let id = 0;\n\nexport function makeId() {\n return `muigui-${++id}`;\n}\n","import { createElem } from '../libs/elem.js';\nimport View from './View.js';\n\nexport default class ValueView extends View {\n constructor(className = '') {\n super(createElem('div', {className: 'muigui-value'}));\n if (className) {\n this.domElement.classList.add(className);\n }\n }\n}","import { createElem } from '../libs/elem.js';\nimport { makeId } from '../libs/ids.js';\nimport ValueView from '../views/ValueView.js';\nimport Controller from './Controller.js';\n\nexport default class LabelController extends Controller {\n #id;\n #nameElem;\n\n constructor(className = '', name = '') {\n super('muigui-label-controller');\n this.#id = makeId();\n this.#nameElem = createElem('label', {for: this.#id});\n this.domElement.appendChild(this.#nameElem);\n this.pushSubView(new ValueView(className));\n this.name(name);\n }\n get id() {\n return this.#id;\n }\n name(name) {\n if (this.#nameElem.title === this.#nameElem.textContent) {\n this.#nameElem.title = name;\n }\n this.#nameElem.textContent = name;\n return this;\n }\n tooltip(tip) {\n this.#nameElem.title = tip;\n }\n}\n\n","import {addTask, removeTask} from '../libs/taskrunner.js';\nimport { isTypedArray } from '../libs/utils.js';\nimport LabelController from './LabelController.js';\n\nexport default class ValueController extends LabelController {\n #object;\n #property;\n #initialValue;\n #listening;\n #views;\n #updateFn;\n\n constructor(object, property, className = '') {\n super(className, property);\n this.#object = object;\n this.#property = property;\n this.#initialValue = this.getValue();\n this.#listening = false;\n this.#views = [];\n }\n get initialValue() {\n return this.#initialValue;\n }\n get object() {\n return this.#object;\n }\n get property() {\n return this.#property;\n }\n add(view) {\n this.#views.push(view);\n super.add(view);\n this.updateDisplay();\n return view;\n }\n #setValueImpl(v, ignoreCache) {\n let isDifferent = false;\n if (typeof v === 'object') {\n const dst = this.#object[this.#property];\n // don't replace objects, just their values.\n if (Array.isArray(v) || isTypedArray(v)) {\n for (let i = 0; i < v.length; ++i) {\n isDifferent ||= dst[i] !== v[i];\n dst[i] = v[i];\n }\n } else {\n for (const key of Object.keys(v)) {\n isDifferent ||= dst[key] !== v[key];\n }\n Object.assign(dst, v);\n }\n } else {\n isDifferent = this.#object[this.#property] !== v;\n this.#object[this.#property] = v;\n }\n this.updateDisplay(ignoreCache);\n if (isDifferent) {\n this.emitChange(this.getValue(), this.#object, this.#property);\n }\n return isDifferent;\n }\n setValue(v) {\n this.#setValueImpl(v);\n }\n setFinalValue(v) {\n const isDifferent = this.#setValueImpl(v, true);\n if (isDifferent) {\n this.emitFinalChange(this.getValue(), this.#object, this.#property);\n }\n return this;\n }\n updateDisplay(ignoreCache) {\n const newV = this.getValue();\n for (const view of this.#views) {\n view.updateDisplayIfNeeded(newV, ignoreCache);\n }\n return this;\n }\n setOptions(options) {\n for (const view of this.#views) {\n view.setOptions(options);\n }\n this.updateDisplay();\n return this;\n }\n getValue() {\n return this.#object[this.#property];\n }\n value(v) {\n this.setValue(v);\n return this;\n }\n reset() {\n this.setValue(this.#initialValue);\n return this;\n }\n listen(listen = true) {\n if (!this.#updateFn) {\n this.#updateFn = this.updateDisplay.bind(this);\n }\n if (listen) {\n if (!this.#listening) {\n this.#listening = true;\n addTask(this.#updateFn);\n }\n } else {\n if (this.#listening) {\n this.#listening = false;\n removeTask(this.#updateFn);\n }\n }\n return this;\n }\n}\n\n","import CheckboxView from '../views/CheckboxView.js';\nimport ValueController from './ValueController.js';\n\nexport default class Checkbox extends ValueController {\n constructor(object, property) {\n super(object, property, 'muigui-checkbox');\n const id = this.id;\n this.add(new CheckboxView(this, id));\n this.updateDisplay();\n }\n}","import {\n makeRangeConverters,\n} from './utils.js';\n\nexport const identity = {\n to: v => v,\n from: v => [true, v],\n};\n\n// from: from string to value\n// to: from value to string\nexport const strToNumber = {\n to: v => v.toString(),\n from: v => {\n const newV = parseFloat(v);\n return [!Number.isNaN(newV), newV];\n },\n};\n\nexport const converters = {\n radToDeg: makeRangeConverters({to: [0, 180], from: [0, Math.PI]}),\n};\n","export function createWheelHelper() {\n let wheelAccum = 0;\n return function (e, step, wheelScale = 5) {\n wheelAccum -= e.deltaY * step / wheelScale;\n const wheelSteps = Math.floor(Math.abs(wheelAccum) / step) * Math.sign(wheelAccum);\n const delta = wheelSteps * step;\n wheelAccum -= delta;\n return delta;\n };\n}\n","import { createElem } from '../libs/elem.js';\nimport { strToNumber } from '../libs/conversions.js';\nimport { createWheelHelper } from '../libs/wheel.js';\nimport { clamp, copyExistingProperties, stepify } from '../libs/utils.js';\nimport EditView from './EditView.js';\n\nexport default class NumberView extends EditView {\n #to;\n #from;\n #step;\n #skipUpdate;\n #options = {\n step: 0.01,\n converters: strToNumber,\n min: Number.NEGATIVE_INFINITY,\n max: Number.POSITIVE_INFINITY,\n };\n\n constructor(setter, options) {\n const setValue = setter.setValue.bind(setter);\n const setFinalValue = setter.setFinalValue.bind(setter);\n const wheelHelper = createWheelHelper();\n super(createElem('input', {\n type: 'number',\n onInput: () => {\n this.#handleInput(setValue, true);\n },\n onChange: () => {\n this.#handleInput(setFinalValue, false);\n },\n onWheel: e => {\n e.preventDefault();\n const {min, max, step} = this.#options;\n const delta = wheelHelper(e, step);\n const v = parseFloat(this.domElement.value);\n const newV = clamp(stepify(v + delta, v => v, step), min, max);\n const [valid, outV] = this.#from(newV);\n if (valid) {\n setter.setValue(outV);\n }\n },\n }));\n this.setOptions(options);\n }\n #handleInput(setFn, skipUpdate) {\n const v = parseFloat(this.domElement.value);\n const [valid, newV] = this.#from(v);\n let inRange;\n if (valid && !Number.isNaN(v)) {\n const {min, max} = this.#options;\n inRange = newV >= min && newV <= max;\n this.#skipUpdate = skipUpdate;\n setFn(clamp(newV, min, max));\n }\n this.domElement.classList.toggle('muigui-invalid-value', !valid || !inRange);\n }\n updateDisplay(v) {\n if (!this.#skipUpdate) {\n this.domElement.value = stepify(v, this.#to, this.#step);\n }\n this.#skipUpdate = false;\n }\n setOptions(options) {\n copyExistingProperties(this.#options, options);\n const {\n step,\n converters: {to, from},\n } = this.#options;\n this.#to = to;\n this.#from = from;\n this.#step = step;\n return this;\n }\n}\n","\nimport NumberView from '../views/NumberView.js';\nimport ValueController from './ValueController.js';\n\n// Wanted to name this `Number` but it conflicts with\n// JavaScript `Number`. It most likely wouldn't be\n// an issue? But users might `import {Number} ...` and\n// things would break.\nexport default class TextNumber extends ValueController {\n #textView;\n #step;\n\n constructor(object, property, options = {}) {\n super(object, property, 'muigui-text-number');\n this.#textView = this.add(new NumberView(this, options));\n this.updateDisplay();\n }\n}","import { createElem } from '../libs/elem.js';\nimport EditView from './EditView.js';\n\nexport default class SelectView extends EditView {\n #values;\n\n constructor(setter, keyValues) {\n const values = [];\n super(createElem('select', {\n onChange: () => {\n setter.setFinalValue(this.#values[this.domElement.selectedIndex]);\n },\n }, keyValues.map(([key, value]) => {\n values.push(value);\n return createElem('option', {textContent: key});\n })));\n this.#values = values;\n }\n updateDisplay(v) {\n const ndx = this.#values.indexOf(v);\n this.domElement.selectedIndex = ndx;\n }\n}\n","\n// 4 cases\n// (a) keyValues is array of arrays, each sub array is key value\n// (b) keyValues is array and value is number then keys = array contents, value = index\n// (c) keyValues is array and value is not number, key = array contents, value = array contents\n// (d) keyValues is object then key->value\nexport function convertToKeyValues(keyValues, valueIsNumber) {\n if (Array.isArray(keyValues)) {\n if (Array.isArray(keyValues[0])) {\n // (a) keyValues is array of arrays, each sub array is key value\n return keyValues;\n } else {\n if (valueIsNumber) {\n // (b) keyValues is array and value is number then keys = array contents, value = index\n return keyValues.map((v, ndx) => [v, ndx]);\n } else {\n // (c) keyValues is array and value is not number, key = array contents, value = array contents\n return keyValues.map(v => [v, v]);\n }\n }\n } else {\n // (d)\n return [...Object.entries(keyValues)];\n }\n}\n","import SelectView from '../views/SelectView.js';\nimport ValueController from './ValueController.js';\nimport { convertToKeyValues } from '../libs/key-values.js';\n\nexport default class Select extends ValueController {\n constructor(object, property, options) {\n super(object, property, 'muigui-select');\n const valueIsNumber = typeof this.getValue() === 'number';\n const {keyValues: keyValuesInput} = options;\n const keyValues = convertToKeyValues(keyValuesInput, valueIsNumber);\n this.add(new SelectView(this, keyValues));\n this.updateDisplay();\n }\n}","import { createElem } from '../libs/elem.js';\nimport { identity } from '../libs/conversions.js';\nimport { clamp, copyExistingProperties, stepify } from '../libs/utils.js';\nimport { createWheelHelper } from '../libs/wheel.js';\nimport EditView from './EditView.js';\n\nexport default class RangeView extends EditView {\n #to;\n #from;\n #step;\n #skipUpdate;\n #options = {\n step: 0.01,\n min: 0,\n max: 1,\n converters: identity,\n };\n\n constructor(setter, options) {\n const wheelHelper = createWheelHelper();\n super(createElem('input', {\n type: 'range',\n onInput: () => {\n this.#skipUpdate = true;\n const {min, max, step} = this.#options;\n const v = parseFloat(this.domElement.value);\n const newV = clamp(stepify(v, v => v, step), min, max);\n const [valid, validV] = this.#from(newV);\n if (valid) {\n setter.setValue(validV);\n }\n },\n onChange: () => {\n this.#skipUpdate = true;\n const {min, max, step} = this.#options;\n const v = parseFloat(this.domElement.value);\n const newV = clamp(stepify(v, v => v, step), min, max);\n const [valid, validV] = this.#from(newV);\n if (valid) {\n setter.setFinalValue(validV);\n }\n },\n onWheel: e => {\n e.preventDefault();\n const [valid, v] = this.#from(parseFloat(this.domElement.value));\n if (!valid) {\n return;\n }\n const {min, max, step} = this.#options;\n const delta = wheelHelper(e, step);\n const newV = clamp(stepify(v + delta, v => v, step), min, max);\n setter.setValue(newV);\n },\n }));\n this.setOptions(options);\n }\n updateDisplay(v) {\n if (!this.#skipUpdate) {\n this.domElement.value = stepify(v, this.#to, this.#step);\n }\n this.#skipUpdate = false;\n }\n setOptions(options) {\n copyExistingProperties(this.#options, options);\n const {\n step,\n min,\n max,\n converters: {to, from},\n } = this.#options;\n this.#to = to;\n this.#from = from;\n this.#step = step;\n this.domElement.step = step;\n this.domElement.min = min;\n this.domElement.max = max;\n return this;\n }\n}","import ValueController from './ValueController.js';\nimport NumberView from '../views/NumberView.js';\nimport RangeView from '../views/RangeView.js';\n\nexport default class Range extends ValueController {\n constructor(object, property, options) {\n super(object, property, 'muigui-range');\n this.add(new RangeView(this, options));\n this.add(new NumberView(this, options));\n }\n}\n","import { createElem } from '../libs/elem.js';\nimport { identity } from '../libs/conversions.js';\nimport EditView from './EditView.js';\nimport { copyExistingProperties } from '../libs/utils.js';\n\nexport default class TextView extends EditView {\n #to;\n #from;\n #skipUpdate;\n #options = {\n converters: identity,\n };\n\n constructor(setter, options) {\n const setValue = setter.setValue.bind(setter);\n const setFinalValue = setter.setFinalValue.bind(setter);\n super(createElem('input', {\n type: 'text',\n onInput: () => {\n this.#handleInput(setValue, true);\n },\n onChange: () => {\n this.#handleInput(setFinalValue, false);\n },\n }));\n this.setOptions(options);\n }\n #handleInput(setFn, skipUpdate) {\n const [valid, newV] = this.#from(this.domElement.value);\n if (valid) {\n this.#skipUpdate = skipUpdate;\n setFn(newV);\n }\n this.domElement.style.color = valid ? '' : 'var(--invalid-color)';\n\n }\n updateDisplay(v) {\n if (!this.#skipUpdate) {\n this.domElement.value = this.#to(v);\n this.domElement.style.color = '';\n }\n this.#skipUpdate = false;\n }\n setOptions(options) {\n copyExistingProperties(this.#options, options);\n const {\n converters: {to, from},\n } = this.#options;\n this.#to = to;\n this.#from = from;\n return this;\n }\n}\n","import TextView from '../views/TextView.js';\nimport ValueController from './ValueController.js';\n\nexport default class Text extends ValueController {\n constructor(object, property) {\n super(object, property, 'muigui-text');\n this.add(new TextView(this));\n this.updateDisplay();\n }\n}","const clamp = (v, min, max) => Math.max(min, Math.min(max, v));\nconst lerp = (a, b, t) => a + (b - a) * t;\nconst fract = v => v >= 0 ? v % 1 : 1 - (v % 1);\n\nconst f0 = v => +v.toFixed(0); // converts to string (eg 1.2 => \"1\"), then converts back to number (eg, \"1.200\" => 1.2)\nconst f3 = v => +v.toFixed(3); // converts to string (eg 1.2 => \"1.200\"), then converts back to number (eg, \"1.200\" => 1.2)\n\nconst hexToUint32RGB = v => (parseInt(v.substring(1, 3), 16) << 16) |\n (parseInt(v.substring(3, 5), 16) << 8 ) |\n (parseInt(v.substring(5, 7), 16) );\nconst uint32RGBToHex = v => `#${(Math.round(v)).toString(16).padStart(6, '0')}`;\nconst hexToUint32RGBA = v => (parseInt(v.substring(1, 3), 16) * 2 ** 24) +\n (parseInt(v.substring(3, 5), 16) * 2 ** 16) +\n (parseInt(v.substring(5, 7), 16) * 2 ** 8) +\n (parseInt(v.substring(7, 9), 16) );\nconst uint32RGBAToHex = v => `#${(Math.round(v)).toString(16).padStart(8, '0')}`;\n\nexport const hexToUint8RGB = v => [\n parseInt(v.substring(1, 3), 16),\n parseInt(v.substring(3, 5), 16),\n parseInt(v.substring(5, 7), 16),\n];\nexport const uint8RGBToHex = v => `#${Array.from(v).map(v => v.toString(16).padStart(2, '0')).join('')}`;\n\nexport const hexToUint8RGBA = v => [\n parseInt(v.substring(1, 3), 16),\n parseInt(v.substring(3, 5), 16),\n parseInt(v.substring(5, 7), 16),\n parseInt(v.substring(7, 9), 16),\n];\nexport const uint8RGBAToHex = v => `#${Array.from(v).map(v => v.toString(16).padStart(2, '0')).join('')}`;\n\nexport const hexToFloatRGB = v => hexToUint8RGB(v).map(v => f3(v / 255));\nexport const floatRGBToHex = v => uint8RGBToHex(Array.from(v).map(v => Math.round(clamp(v * 255, 0, 255))));\n\nexport const hexToFloatRGBA = v => hexToUint8RGBA(v).map(v => f3(v / 255));\nexport const floatRGBAToHex = v => uint8RGBAToHex(Array.from(v).map(v => Math.round(clamp(v * 255, 0, 255))));\n\nconst scaleAndClamp = v => clamp(Math.round(v * 255), 0, 255).toString(16).padStart(2, '0');\n\nconst hexToObjectRGB = v => ({\n r: parseInt(v.substring(1, 3), 16) / 255,\n g: parseInt(v.substring(3, 5), 16) / 255,\n b: parseInt(v.substring(5, 7), 16) / 255,\n});\nconst objectRGBToHex = v => `#${scaleAndClamp(v.r)}${scaleAndClamp(v.g)}${scaleAndClamp(v.b)}`;\nconst hexToObjectRGBA = v => ({\n r: parseInt(v.substring(1, 3), 16) / 255,\n g: parseInt(v.substring(3, 5), 16) / 255,\n b: parseInt(v.substring(5, 7), 16) / 255,\n a: parseInt(v.substring(7, 9), 16) / 255,\n});\nconst objectRGBAToHex = v => `#${scaleAndClamp(v.r)}${scaleAndClamp(v.g)}${scaleAndClamp(v.b)}${scaleAndClamp(v.a)}`;\n\nconst hexToCssRGB = v => `rgb(${hexToUint8RGB(v).join(', ')})`;\nconst cssRGBRegex = /^\\s*rgb\\(\\s*(\\d+)\\s*,\\s*(\\d+)\\s*,\\s*(\\d+)\\s*\\)\\s*$/;\nconst cssRGBToHex = v => {\n const m = cssRGBRegex.exec(v);\n return uint8RGBToHex([m[1], m[2], m[3]].map(v => parseInt(v)));\n};\nconst hexToCssRGBA = v => `rgba(${hexToUint8RGBA(v).map((v, i) => i === 3 ? v / 255 : v).join(', ')})`;\nconst cssRGBARegex = /^\\s*rgba\\(\\s*(\\d+)\\s*,\\s*(\\d+)\\s*,\\s*(\\d+)\\s*,\\s*(\\d+\\.\\d+|\\d+)\\s*\\)\\s*$/;\nconst cssRGBAToHex = v => {\n const m = cssRGBARegex.exec(v);\n return uint8RGBAToHex([m[1], m[2], m[3], m[4]].map((v, i) => i === 3 ? (parseFloat(v) * 255 | 0) : parseInt(v)));\n};\n\nconst hexToCssHSL = v => {\n const hsl = rgbUint8ToHsl(hexToUint8RGB(v)).map(v => f0(v));\n return `hsl(${hsl[0]}, ${hsl[1]}%, ${hsl[2]}%)`;\n};\nconst hexToCssHSLA = v => {\n const hsla = rgbaUint8ToHsla(hexToUint8RGBA(v)).map((v, i) => i === 3 ? f3(v) : f0(v));\n return `hsl(${hsla[0]} ${hsla[1]}% ${hsla[2]}% / ${hsla[3]})`;\n};\nconst cssHSLRegex = /^\\s*hsl\\(\\s*(\\d+)(?:deg|)\\s*(?:,|)\\s*(\\d+)%\\s*(?:,|)\\s*(\\d+)%\\s*\\)\\s*$/;\nconst cssHSLARegex = /^\\s*hsl\\(\\s*(\\d+)(?:deg|)\\s*(?:,|)\\s*(\\d+)%\\s*(?:,|)\\s*(\\d+)%\\s*\\/\\s*(\\d+\\.\\d+|\\d+)\\s*\\)\\s*$/;\n\nconst hex3DigitTo6Digit = v => `${v[0]}${v[0]}${v[1]}${v[1]}${v[2]}${v[2]}`;\nconst cssHSLToHex = v => {\n const m = cssHSLRegex.exec(v);\n const rgb = hslToRgbUint8([m[1], m[2], m[3]].map(v => parseFloat(v)));\n return uint8RGBToHex(rgb);\n};\nconst cssHSLAToHex = v => {\n const m = cssHSLARegex.exec(v);\n const rgba = hslaToRgbaUint8([m[1], m[2], m[3], m[4]].map(v => parseFloat(v)));\n return uint8RGBAToHex(rgba);\n};\n\nconst euclideanModulo = (v, n) => ((v % n) + n) % n;\n\nexport function hslToRgbUint8([h, s, l]) {\n h = euclideanModulo(h, 360);\n s = clamp(s / 100, 0, 1);\n l = clamp(l / 100, 0, 1);\n\n const a = s * Math.min(l, 1 - l);\n\n function f(n) {\n const k = (n + h / 30) % 12;\n return l - a * Math.max(-1, Math.min(k - 3, 9 - k, 1));\n }\n\n return [f(0), f(8), f(4)].map(v => Math.round(v * 255));\n}\n\nexport function hslaToRgbaUint8([h, s, l, a]) {\n const rgb = hslToRgbUint8([h, s, l]);\n return [...rgb, a * 255 | 0];\n}\n\nexport function rgbFloatToHsl01([r, g, b]) {\n const max = Math.max(r, g, b);\n const min = Math.min(r, g, b);\n const l = (min + max) * 0.5;\n const d = max - min;\n let h = 0;\n let s = 0;\n\n if (d !== 0) {\n s = (l === 0 || l === 1)\n ? 0\n : (max - l) / Math.min(l, 1 - l);\n\n switch (max) {\n case r: h = (g - b) / d + (g < b ? 6 : 0); break;\n case g: h = (b - r) / d + 2; break;\n case b: h = (r - g) / d + 4;\n }\n }\n\n return [h / 6, s, l];\n}\n\nexport function rgbaFloatToHsla01([r, g, b, a]) {\n const hsl = rgbFloatToHsl01([r, g, b]);\n return [...hsl, a];\n}\n\nexport const rgbUint8ToHsl = (rgb) => {\n const [h, s, l] = rgbFloatToHsl01(rgb.map(v => v / 255));\n return [h * 360, s * 100, l * 100];\n};\n\nexport const rgbaUint8ToHsla = (rgba) => {\n const [h, s, l, a] = rgbaFloatToHsla01(rgba.map(v => v / 255));\n return [h * 360, s * 100, l * 100, a];\n};\n\nexport function hsv01ToRGBFloat([hue, sat, val]) {\n sat = clamp(sat, 0, 1);\n val = clamp(val, 0, 1);\n return [hue, hue + 2 / 3, hue + 1 / 3].map(\n v => lerp(1, clamp(Math.abs(fract(v) * 6 - 3.0) - 1, 0, 1), sat) * val\n );\n}\n\nexport function hsva01ToRGBAFloat([hue, sat, val, alpha]) {\n const rgb = hsv01ToRGBFloat([hue, sat, val]);\n return [...rgb, alpha];\n}\n\nconst round3 = v => Math.round(v * 1000) / 1000;\n\nexport function rgbFloatToHSV01([r, g, b]) {\n const p = b > g\n ? [b, g, -1, 2 / 3]\n : [g, b, 0, -1 / 3];\n const q = p[0] > r\n ? [p[0], p[1], p[3], r]\n : [r, p[1], p[2], p[0]];\n const d = q[0] - Math.min(q[3], q[1]);\n return [\n Math.abs(q[2] + (q[3] - q[1]) / (6 * d + Number.EPSILON)),\n d / (q[0] + Number.EPSILON),\n q[0],\n ].map(round3);\n}\n\nexport function rgbaFloatToHSVA01([r, g, b, a]) {\n const hsv = rgbFloatToHSV01([r, g, b]);\n return [...hsv, a];\n}\n\n// window.hsv01ToRGBFloat = hsv01ToRGBFloat;\n// window.rgbFloatToHSV01 = rgbFloatToHSV01;\n\n// Yea, meh!\nexport const hasAlpha = format => format.endsWith('a') || format.startsWith('hex8');\n\nconst cssStringFormats = [\n { re: /^#(?:[0-9a-f]){6}$/i, format: 'hex6' },\n { re: /^(?:[0-9a-f]){6}$/i, format: 'hex6-no-hash' },\n { re: /^#(?:[0-9a-f]){8}$/i, format: 'hex8' },\n { re: /^(?:[0-9a-f]){8}$/i, format: 'hex8-no-hash' },\n { re: /^#(?:[0-9a-f]){3}$/i, format: 'hex3' },\n { re: /^(?:[0-9a-f]){3}$/i, format: 'hex3-no-hash' },\n { re: cssRGBRegex, format: 'css-rgb' },\n { re: cssHSLRegex, format: 'css-hsl' },\n { re: cssRGBARegex, format: 'css-rgba' },\n { re: cssHSLARegex, format: 'css-hsla' },\n];\n\nfunction guessStringColorFormat(v) {\n for (const formatInfo of cssStringFormats) {\n if (formatInfo.re.test(v)) {\n return formatInfo;\n }\n }\n return undefined;\n}\n\nexport function guessFormat(v) {\n switch (typeof v) {\n case 'number':\n console.warn('can not reliably guess format based on a number. You should pass in a format like {format: \"uint32-rgb\"} or {format: \"uint32-rgb\"}');\n return v <= 0xFFFFFF ? 'uint32-rgb' : 'uint32-rgba';\n case 'string': {\n const formatInfo = guessStringColorFormat(v.trim());\n if (formatInfo) {\n return formatInfo.format;\n }\n break;\n }\n case 'object':\n if (v instanceof Uint8Array || v instanceof Uint8ClampedArray) {\n if (v.length === 3) {\n return 'uint8-rgb';\n } else if (v.length === 4) {\n return 'uint8-rgba';\n }\n } else if (v instanceof Float32Array) {\n if (v.length === 3) {\n return 'float-rgb';\n } else if (v.length === 4) {\n return 'float-rgba';\n }\n } else if (Array.isArray(v)) {\n if (v.length === 3) {\n return 'float-rgb';\n } else if (v.length === 4) {\n return 'float-rgba';\n }\n } else {\n if ('r' in v && 'g' in v && 'b' in v) {\n if ('a' in v) {\n return 'object-rgba';\n } else {\n return 'object-rgb';\n }\n }\n }\n }\n throw new Error(`unknown color format: ${v}`);\n}\n\nfunction fixHex6(v) {\n return v.trim(v);\n //const formatInfo = guessStringColorFormat(v.trim());\n //const fix = formatInfo ? formatInfo.fix : v => v;\n //return fix(v.trim());\n}\n\nfunction fixHex8(v) {\n return v.trim(v);\n //const formatInfo = guessStringColorFormat(v.trim());\n //const fix = formatInfo ? formatInfo.fix : v => v;\n //return fix(v.trim());\n}\n\nfunction hex6ToHex3(hex6) {\n return (hex6[1] === hex6[2] &&\n hex6[3] === hex6[4] &&\n hex6[5] === hex6[6])\n ? `#${hex6[1]}${hex6[3]}${hex6[5]}`\n : hex6;\n}\n\nconst hex3RE = /^(#|)([0-9a-f]{3})$/i;\nfunction hex3ToHex6(hex3) {\n const m = hex3RE.exec(hex3);\n if (m) {\n const [, , m2] = m;\n return `#${hex3DigitTo6Digit(m2)}`;\n }\n return hex3;\n}\n\nfunction fixHex3(v) {\n return hex6ToHex3(fixHex6(v));\n}\n\nconst strToRGBObject = (s) => {\n try {\n const json = s.replace(/([a-z])/g, '\"$1\"');\n const rgb = JSON.parse(json);\n if (Number.isNaN(rgb.r) || Number.isNaN(rgb.g) || Number.isNaN(rgb.b)) {\n throw new Error('not {r, g, b}');\n }\n return [true, rgb];\n } catch (e) {\n return [false];\n }\n};\n\nconst strToRGBAObject = (s) => {\n try {\n const json = s.replace(/([a-z])/g, '\"$1\"');\n const rgba = JSON.parse(json);\n if (Number.isNaN(rgba.r) || Number.isNaN(rgba.g) || Number.isNaN(rgba.b) || Number.isNaN(rgba.a)) {\n throw new Error('not {r, g, b, a}');\n }\n return [true, rgba];\n } catch (e) {\n return [false];\n }\n};\n\nconst strToCssRGB = s => {\n const m = cssRGBRegex.exec(s);\n if (!m) {\n return [false];\n }\n const v = [m[1], m[2], m[3]].map(v => parseInt(v));\n const outOfRange = v.find(v => v > 255);\n return [!outOfRange, `rgb(${v.join(', ')})`];\n};\n\nconst strToCssRGBA = s => {\n const m = cssRGBARegex.exec(s);\n if (!m) {\n return [false];\n }\n const v = [m[1], m[2], m[3], m[4]].map((v, i) => i === 3 ? parseFloat(v) : parseInt(v));\n const outOfRange = v.find(v => v > 255);\n return [!outOfRange, `rgba(${v.join(', ')})`];\n};\n\nconst strToCssHSL = s => {\n const m = cssHSLRegex.exec(s);\n if (!m) {\n return [false];\n }\n const v = [m[1], m[2], m[3]].map(v => parseFloat(v));\n const outOfRange = v.find(v => Number.isNaN(v));\n return [!outOfRange, `hsl(${v[0]}, ${v[1]}%, ${v[2]}%)`];\n};\n\nconst strToCssHSLA = s => {\n const m = cssHSLARegex.exec(s);\n if (!m) {\n return [false];\n }\n const v = [m[1], m[2], m[3], m[4]].map(v => parseFloat(v));\n const outOfRange = v.find(v => Number.isNaN(v));\n return [!outOfRange, `hsl(${v[0]} ${v[1]}% ${v[2]}% / ${v[3]})`];\n};\n\nconst rgbObjectToStr = rgb => {\n return `{r:${f3(rgb.r)}, g:${f3(rgb.g)}, b:${f3(rgb.b)}}`;\n};\nconst rgbaObjectToStr = rgba => {\n return `{r:${f3(rgba.r)}, g:${f3(rgba.g)}, b:${f3(rgba.b)}}, a:${f3(rgba.a)}}`;\n};\n\nconst strTo3IntsRE = /^\\s*(\\d+)\\s*,\\s*(\\d+)\\s*,\\s*(\\d+)\\s*$/;\nconst strTo3Ints = s => {\n const m = strTo3IntsRE.exec(s);\n if (!m) {\n return [false];\n }\n const v = [m[1], m[2], m[3]].map(v => parseInt(v));\n const outOfRange = v.find(v => v > 255);\n return [!outOfRange, v];\n};\n\nconst strTo4IntsRE = /^\\s*(\\d+)\\s*,\\s*(\\d+)\\s*,\\s*(\\d+)\\s*$/;\nconst strTo4Ints = s => {\n const m = strTo4IntsRE.exec(s);\n if (!m) {\n return [false];\n }\n const v = [m[1], m[2], m[3], m[4]].map(v => parseInt(v));\n const outOfRange = v.find(v => v > 255);\n return [!outOfRange, v];\n};\n\nconst strTo3Floats = s => {\n const numbers = s.split(',').map(s => s.trim());\n const v = numbers.map(v => parseFloat(v));\n if (v.length !== 3) {\n return [false];\n }\n // Note: using isNaN not Number.isNaN\n const badNdx = numbers.findIndex(v => isNaN(v));\n return [badNdx < 0, v.map(v => f3(v))];\n};\n\nconst strTo4Floats = s => {\n const numbers = s.split(',').map(s => s.trim());\n const v = numbers.map(v => parseFloat(v));\n if (v.length !== 4) {\n return [false];\n }\n // Note: using isNaN not Number.isNaN\n const badNdx = numbers.findIndex(v => isNaN(v));\n return [badNdx < 0, v.map(v => f3(v))];\n};\n\nconst strToUint32RGBRegex = /^\\s*(?:0x){0,1}([0-9a-z]{1,6})\\s*$/i;\nconst strToUint32RGB = s => {\n const m = strToUint32RGBRegex.exec(s);\n if (!m) {\n return [false];\n }\n return [true, parseInt(m[1], 16)];\n};\n\nconst strToUint32RGBARegex = /^\\s*(?:0x){0,1}([0-9a-z]{1,8})\\s*$/i;\nconst strToUint32RGBA = s => {\n const m = strToUint32RGBARegex.exec(s);\n if (!m) {\n return [false];\n }\n return [true, parseInt(m[1], 16)];\n};\n\nconst hex6RE = /^\\s*#[a-f0-9]{6}\\s*$|^\\s*#[a-f0-9]{3}\\s*$/i;\nconst hexNoHash6RE = /^\\s*[a-f0-9]{6}\\s*$/i;\nconst hex8RE = /^\\s*#[a-f0-9]{8}\\s*$/i;\nconst hexNoHash8RE = /^\\s*[a-f0-9]{8}\\s*$/i;\n\n// For each format converter\n//\n// fromHex/toHex convert from/to '#RRGGBB'\n//\n// fromHex converts from the string '#RRBBGG' to the format\n// (eg: for uint32-rgb, '#123456' becomes 0x123456)\n//\n// toHex converts from the format to '#RRGGBB'\n// (eg: for uint8-rgb, [16, 33, 50] becomes '#102132')\n//\n//\n// fromStr/toStr convert from/to what's in the input[type=text] element\n//\n// toStr converts from the format to its string representation\n// (eg, for object-rgb, {r: 1, g: 0.5, b:0} becomes \"{r: 1, g: 0.5, b:0}\")\n// ^object ^string\n//\n// fromStr converts its string representation to its format\n// (eg, for object-rgb) \"{r: 1, g: 0.5, b:0}\" becomes {r: 1, g: 0.5, b:0})\n// ^string ^object\n// fromString returns an array which is [valid, v]\n// where valid is true if the string was a valid and v is the converted\n// format if v is true.\n//\n// Note: toStr should convert to \"ideal\" form (whatever that is).\n// (eg, for css-rgb\n// \"{ r: 0.10000, g: 001, b: 0}\" becomes \"{r: 0.1, g: 1, b: 0}\"\n// notice that css-rgb is a string to a string\n// )\nexport const colorFormatConverters = {\n 'hex6': {\n color: {\n from: v => [true, v],\n to: fixHex6,\n },\n text: {\n from: v => [hex6RE.test(v), v.trim()],\n to: v => v,\n },\n },\n 'hex8': {\n color: {\n from: v => [true, v],\n to: fixHex8,\n },\n text: {\n from: v => [hex8RE.test(v), v.trim()],\n to: v => v,\n },\n },\n 'hex3': {\n color: {\n from: v => [true, fixHex3(v)],\n to: hex3ToHex6,\n },\n text: {\n from: v => [hex6RE.test(v), hex6ToHex3(v.trim())],\n to: v => v,\n },\n },\n 'hex6-no-hash': {\n color: {\n from: v => [true, v.substring(1)],\n to: v => `#${fixHex6(v)}`,\n },\n text: {\n from: v => [hexNoHash6RE.test(v), v.trim()],\n to: v => v,\n },\n },\n 'hex8-no-hash': {\n color: {\n from: v => [true, v.substring(1)],\n to: v => `#${fixHex8(v)}`,\n },\n text: {\n from: v => [hexNoHash8RE.test(v), v.trim()],\n to: v => v,\n },\n },\n 'hex3-no-hash': {\n color: {\n from: v => [true, fixHex3(v).substring(1)],\n to: hex3ToHex6,\n },\n text: {\n from: v => [hexNoHash6RE.test(v), hex6ToHex3(v.trim())],\n to: v => v,\n },\n },\n 'uint32-rgb': {\n color: {\n from: v => [true, hexToUint32RGB(v)],\n to: uint32RGBToHex,\n },\n text: {\n from: v => strToUint32RGB(v),\n to: v => `0x${v.toString(16).padStart(6, '0')}`,\n },\n },\n 'uint32-rgba': {\n color: {\n from: v => [true, hexToUint32RGBA(v)],\n to: uint32RGBAToHex,\n },\n text: {\n from: v => strToUint32RGBA(v),\n to: v => `0x${v.toString(16).padStart(8, '0')}`,\n },\n },\n 'uint8-rgb': {\n color: {\n from: v => [true, hexToUint8RGB(v)],\n to: uint8RGBToHex,\n },\n text: {\n from: strTo3Ints,\n to: v => v.join(', '),\n },\n },\n 'uint8-rgba': {\n color: {\n from: v => [true, hexToUint8RGBA(v)],\n to: uint8RGBAToHex,\n },\n text: {\n from: strTo4Ints,\n to: v => v.join(', '),\n },\n },\n 'float-rgb': {\n color: {\n from: v => [true, hexToFloatRGB(v)],\n to: floatRGBToHex,\n },\n text: {\n from: strTo3Floats,\n // need Array.from because map of Float32Array makes a Float32Array\n to: v => Array.from(v).map(v => f3(v)).join(', '),\n },\n },\n 'float-rgba': {\n color: {\n from: v => [true, hexToFloatRGBA(v)],\n to: floatRGBAToHex,\n },\n text: {\n from: strTo4Floats,\n // need Array.from because map of Float32Array makes a Float32Array\n to: v => Array.from(v).map(v => f3(v)).join(', '),\n },\n },\n 'float-hsv': {\n color: {\n from: v => [true, rgbFloatToHSV01(hexToFloatRGB(v))],\n to: v => hsv01ToRGBFloat(floatRGBToHex(v)),\n },\n text: {\n from: strTo3Floats,\n // need Array.from because map of Float32Array makes a Float32Array\n to: v => Array.from(v).map(v => f3(v)).join(', '),\n },\n },\n 'float-hsva': {\n color: {\n from: v => [true, rgbaFloatToHSVA01(hexToFloatRGB(v))],\n to: v => hsva01ToRGBAFloat(floatRGBToHex(v)),\n },\n text: {\n from: strTo4Floats,\n // need Array.from because map of Float32Array makes a Float32Array\n to: v => Array.from(v).map(v => f3(v)).join(', '),\n },\n },\n //'float-hsl': {\n // color: {\n // from: v => [true, rgbFloatToHsl01(hexToFloatRGB(v))],\n // to: v => hsl01ToRGBFloat(floatRGBToHex(v)),\n // },\n // text: {\n // from: strTo3Floats,\n // // need Array.from because map of Float32Array makes a Float32Array\n // to: v => Array.from(v).map(v => f3(v)).join(', '),\n // },\n //},\n //'float-hsla': {\n // color: {\n // from: v => [true, hexToFloatRGBA(v)],\n // to: floatRGBAToHex,\n // },\n // text: {\n // from: strTo4Floats,\n // // need Array.from because map of Float32Array makes a Float32Array\n // to: v => Array.from(v).map(v => f3(v)).join(', '),\n // },\n //},\n 'object-rgb': {\n color: {\n from: v => [true, hexToObjectRGB(v)],\n to: objectRGBToHex,\n },\n text: {\n from: strToRGBObject,\n to: rgbObjectToStr,\n },\n },\n 'object-rgba': {\n color: {\n from: v => [true, hexToObjectRGBA(v)],\n to: objectRGBAToHex,\n },\n text: {\n from: strToRGBAObject,\n to: rgbaObjectToStr,\n },\n },\n 'css-rgb': {\n color: {\n from: v => [true, hexToCssRGB(v)],\n to: cssRGBToHex,\n },\n text: {\n from: strToCssRGB,\n to: v => strToCssRGB(v)[1],\n },\n },\n 'css-rgba': {\n color: {\n from: v => [true, hexToCssRGBA(v)],\n to: cssRGBAToHex,\n },\n text: {\n from: strToCssRGBA,\n to: v => strToCssRGBA(v)[1],\n },\n },\n 'css-hsl': {\n color: {\n from: v => [true, hexToCssHSL(v)],\n to: cssHSLToHex,\n },\n text: {\n from: strToCssHSL,\n to: v => strToCssHSL(v)[1],\n },\n },\n 'css-hsla': {\n color: {\n from: v => [true, hexToCssHSLA(v)],\n to: cssHSLAToHex,\n },\n text: {\n from: strToCssHSLA,\n to: v => strToCssHSLA(v)[1],\n },\n },\n};","import { createElem } from '../libs/elem.js';\nimport View from './View.js';\n\nexport default class ElementView extends View {\n constructor(tag, className) {\n super(createElem(tag, {className}));\n }\n}","import ElementView from '../views/ElementView.js';\nimport LabelController from './LabelController.js';\n\n// TODO: remove this? Should just be user side\nexport default class Canvas extends LabelController {\n #canvasElem;\n\n constructor(name) {\n super('muigui-canvas', name);\n this.#canvasElem = this.add(\n new ElementView('canvas', 'muigui-canvas'),\n ).domElement;\n }\n get canvas() {\n return this.#canvasElem;\n }\n}","import { createElem } from '../libs/elem.js';\nimport { identity } from '../libs/conversions.js';\nimport EditView from './EditView.js';\nimport { copyExistingProperties } from '../libs/utils.js';\n\nexport default class ColorView extends EditView {\n #to;\n #from;\n #colorElem;\n #skipUpdate;\n #options = {\n converters: identity,\n };\n\n constructor(setter, options) {\n const colorElem = createElem('input', {\n type: 'color',\n onInput: () => {\n const [valid, newV] = this.#from(colorElem.value);\n if (valid) {\n this.#skipUpdate = true;\n setter.setValue(newV);\n }\n },\n onChange: () => {\n const [valid, newV] = this.#from(colorElem.value);\n if (valid) {\n this.#skipUpdate = true;\n setter.setFinalValue(newV);\n }\n },\n });\n super(createElem('div', {}, [colorElem]));\n this.setOptions(options);\n this.#colorElem = colorElem;\n }\n updateDisplay(v) {\n if (!this.#skipUpdate) {\n this.#colorElem.value = this.#to(v);\n }\n this.#skipUpdate = false;\n }\n setOptions(options) {\n copyExistingProperties(this.#options, options);\n const {converters: {to, from}} = this.#options;\n this.#to = to;\n this.#from = from;\n return this;\n }\n}\n","import {\n colorFormatConverters,\n guessFormat,\n} from '../libs/color-utils.js';\nimport ValueController from './ValueController.js';\nimport TextView from '../views/TextView.js';\nimport ColorView from '../views/ColorView.js';\n\nexport default class Color extends ValueController {\n #colorView;\n #textView;\n\n constructor(object, property, options = {}) {\n super(object, property, 'muigui-color');\n const format = options.format || guessFormat(this.getValue());\n const {color, text} = colorFormatConverters[format];\n this.#colorView = this.add(new ColorView(this, {converters: color}));\n this.#textView = this.add(new TextView(this, {converters: text}));\n this.updateDisplay();\n }\n setOptions(options) {\n const {format} = options;\n if (format) {\n const {color, text} = colorFormatConverters[format];\n this.#colorView.setOptions({converters: color});\n this.#textView.setOptions({converters: text});\n }\n super.setOptions(options);\n return this;\n }\n}","import Controller from './Controller.js';\n\n// This feels like it should be something else like\n// gui.addController({className: 'muigui-divider')};\nexport default class Divider extends Controller {\n constructor() {\n super('muigui-divider');\n }\n}","import Controller from './Controller.js';\n\nexport default class Container extends Controller {\n #controllers;\n #childDestController;\n\n constructor(className) {\n super(className);\n this.#controllers = [];\n this.#childDestController = this;\n }\n get children() {\n return this.#controllers; // should we return a copy?\n }\n get controllers() {\n return this.#controllers.filter(c => !(c instanceof Container));\n }\n get folders() {\n return this.#controllers.filter(c => c instanceof Container);\n }\n reset(recursive = true) {\n for (const controller of this.#controllers) {\n if (!(controller instanceof Container) || recursive) {\n controller.reset(recursive);\n }\n }\n return this;\n }\n updateDisplay() {\n for (const controller of this.#controllers) {\n controller.updateDisplay();\n }\n return this;\n }\n remove(controller) {\n const ndx = this.#controllers.indexOf(controller);\n if (ndx >= 0) {\n const c = this.#controllers.splice(ndx, 1);\n const c0 = c[0];\n const elem = c0.domElement;\n elem.remove();\n c0.setParent(null);\n }\n return this;\n }\n #addControllerImpl(controller) {\n this.domElement.appendChild(controller.domElement);\n this.#controllers.push(controller);\n controller.setParent(this);\n return controller;\n }\n addController(controller) {\n return this.#childDestController.#addControllerImpl(controller);\n }\n pushContainer(container) {\n this.addController(container);\n this.#childDestController = container;\n return container;\n }\n popContainer() {\n this.#childDestController = this.#childDestController.parent;\n return this;\n }\n}\n","import { createElem } from '../libs/elem.js';\nimport Container from './Container.js';\n\nexport default class Folder extends Container {\n #labelElem;\n\n constructor(name = 'Controls', className = 'muigui-menu') {\n super(className);\n this.#labelElem = createElem('label');\n this.addElem(createElem('button', {\n type: 'button',\n onClick: () => this.toggleOpen(),\n }, [this.#labelElem]));\n this.pushContainer(new Container('muigui-open-container'));\n this.pushContainer(new Container());\n this.name(name);\n this.open();\n }\n open(open = true) {\n this.domElement.classList.toggle('muigui-closed', !open);\n this.domElement.classList.toggle('muigui-open', open);\n return this;\n }\n close() {\n return this.open(false);\n }\n name(name) {\n this.#labelElem.textContent = name;\n return this;\n }\n title(title) {\n return this.name(title);\n }\n toggleOpen() {\n this.open(!this.domElement.classList.contains('muigui-open'));\n return this;\n }\n}\n","import Controller from './Controller.js';\n\n// This feels like it should be something else like\n// gui.addDividing = new Controller()\nexport default class Label extends Controller {\n constructor(text) {\n super('muigui-label');\n this.text(text);\n }\n text(text) {\n this.domElement.textContent = text;\n return this;\n }\n}","function noop() {\n}\n\nexport function computeRelativePosition(elem, event, start) {\n const rect = elem.getBoundingClientRect();\n const x = event.clientX - rect.left;\n const y = event.clientY - rect.top;\n const nx = x / rect.width;\n const ny = y / rect.height;\n start = start || [x, y];\n const dx = x - start[0];\n const dy = y - start[1];\n const ndx = dx / rect.width;\n const ndy = dy / rect.width;\n return {x, y, nx, ny, dx, dy, ndx, ndy};\n}\n\nexport function addTouchEvents(elem, {onDown = noop, onMove = noop, onUp = noop}) {\n let start;\n const pointerMove = function (event) {\n const e = {\n type: 'move',\n ...computeRelativePosition(elem, event, start),\n };\n onMove(e);\n };\n\n const pointerUp = function (event) {\n elem.releasePointerCapture(event.pointerId);\n elem.removeEventListener('pointermove', pointerMove);\n elem.removeEventListener('pointerup', pointerUp);\n\n document.body.style.backgroundColor = '';\n\n onUp('up');\n };\n\n const pointerDown = function (event) {\n elem.addEventListener('pointermove', pointerMove);\n elem.addEventListener('pointerup', pointerUp);\n elem.setPointerCapture(event.pointerId);\n\n const rel = computeRelativePosition(elem, event);\n start = [rel.x, rel.y];\n onDown({\n type: 'down',\n ...rel,\n });\n };\n\n elem.addEventListener('pointerdown', pointerDown);\n\n return function () {\n elem.removeEventListener('pointerdown', pointerDown);\n };\n}","import { createElem, getNewId } from '../libs/elem.js';\nimport { addTouchEvents } from '../libs/touch.js';\nimport { identity } from '../libs/conversions.js';\nimport { clamp } from '../libs/utils.js';\nimport EditView from './EditView.js';\nimport {\n hexToFloatRGB,\n hexToFloatRGBA,\n hsv01ToRGBFloat,\n hsva01ToRGBAFloat,\n rgbFloatToHSV01,\n rgbaFloatToHSVA01,\n floatRGBToHex,\n floatRGBAToHex,\n rgbaFloatToHsla01,\n} from '../libs/color-utils.js';\nimport { copyExistingProperties } from '../libs/utils.js';\n\nconst svg = `\n\n\n\n`;\n\nfunction connectFillTargets(elem) {\n elem.querySelectorAll('[data-src]').forEach(srcElem => {\n const id = getNewId();\n srcElem.id = id;\n elem.querySelectorAll(`[data-target=${srcElem.dataset.src}]`).forEach(targetElem => {\n targetElem.setAttribute('fill', `url(#${id})`);\n });\n });\n return elem;\n}\n\n// Was originally going to make alpha an option. Issue is\n// hard coded conversions?\nexport default class ColorChooserView extends EditView {\n #to;\n #from;\n #satLevelElem;\n #circleElem;\n #hueUIElem;\n #hueElem;\n #hueCursorElem;\n #alphaUIElem;\n #alphaElem;\n #alphaCursorElem;\n #hsva;\n #skipHueUpdate;\n #skipSatLevelUpdate;\n #skipAlphaUpdate;\n #options = {\n converters: identity,\n alpha: false,\n };\n #convertInternalToHex;\n #convertHexToInternal;\n\n constructor(setter, options) {\n super(createElem('div', {\n innerHTML: svg,\n className: 'muigui-no-scroll',\n }));\n this.#satLevelElem = this.domElement.children[0];\n this.#hueUIElem = this.domElement.children[1];\n this.#alphaUIElem = this.domElement.children[2];\n connectFillTargets(this.#satLevelElem);\n connectFillTargets(this.#hueUIElem);\n connectFillTargets(this.#alphaUIElem);\n this.#circleElem = this.$('.muigui-color-chooser-circle');\n this.#hueElem = this.$('[data-src=muigui-color-chooser-hue]');\n this.#hueCursorElem = this.$('.muigui-color-chooser-hue-cursor');\n this.#alphaElem = this.$('[data-src=muigui-color-chooser-alpha]');\n this.#alphaCursorElem = this.$('.muigui-color-chooser-alpha-cursor');\n\n const handleSatLevelChange = (e) => {\n const s = clamp(e.nx, 0, 1);\n const v = clamp(e.ny, 0, 1);\n this.#hsva[1] = s;\n this.#hsva[2] = (1 - v);\n this.#skipHueUpdate = true;\n this.#skipAlphaUpdate = true;\n const [valid, newV] = this.#from(this.#convertInternalToHex(this.#hsva));\n if (valid) {\n setter.setValue(newV);\n }\n };\n\n const handleHueChange = (e) => {\n const h = clamp(e.nx, 0, 1);\n this.#hsva[0] = h;\n this.#skipSatLevelUpdate = true;\n this.#skipAlphaUpdate = true;\n const [valid, newV] = this.#from(this.#convertInternalToHex(this.#hsva));\n if (valid) {\n setter.setValue(newV);\n }\n };\n\n const handleAlphaChange = (e) => {\n const a = clamp(e.nx, 0, 1);\n this.#hsva[3] = a;\n this.#skipHueUpdate = true;\n this.#skipSatLevelUpdate = true;\n const [valid, newV] = this.#from(this.#convertInternalToHex(this.#hsva));\n if (valid) {\n setter.setValue(newV);\n }\n };\n\n addTouchEvents(this.#satLevelElem, {\n onDown: handleSatLevelChange,\n onMove: handleSatLevelChange,\n });\n addTouchEvents(this.#hueUIElem, {\n onDown: handleHueChange,\n onMove: handleHueChange,\n });\n addTouchEvents(this.#alphaUIElem, {\n onDown: handleAlphaChange,\n onMove: handleAlphaChange,\n });\n this.setOptions(options);\n }\n updateDisplay(newV) {\n if (!this.#hsva) {\n this.#hsva = this.#convertHexToInternal(this.#to(newV));\n }\n {\n const [h, s, v, a = 1] = this.#convertHexToInternal(this.#to(newV));\n // Don't copy the hue if it was un-computable.\n if (!this.#skipHueUpdate) {\n this.#hsva[0] = s > 0.001 && v > 0.001 ? h : this.#hsva[0];\n }\n if (!this.#skipSatLevelUpdate) {\n this.#hsva[1] = s;\n this.#hsva[2] = v;\n }\n if (!this.#skipAlphaUpdate) {\n this.#hsva[3] = a;\n }\n }\n {\n const [h, s, v, a] = this.#hsva;\n const [hue, sat, lum] = rgbaFloatToHsla01(hsva01ToRGBAFloat(this.#hsva));\n\n if (!this.#skipHueUpdate) {\n this.#hueCursorElem.setAttribute('transform', `translate(${h * 64}, 0)`);\n }\n this.#hueElem.children[0].setAttribute('stop-color', `hsl(${hue * 360} 0% 100% / ${a})`);\n this.#hueElem.children[1].setAttribute('stop-color', `hsl(${hue * 360} 100% 50% / ${a})`);\n if (!this.#skipAlphaUpdate) {\n this.#alphaCursorElem.setAttribute('transform', `translate(${a * 64}, 0)`);\n }\n this.#alphaElem.children[0].setAttribute('stop-color', `hsl(${hue * 360} ${sat * 100}% ${lum * 100}% / 0)`);\n this.#alphaElem.children[1].setAttribute('stop-color', `hsl(${hue * 360} ${sat * 100}% ${lum * 100}% / 1)`);\n\n if (!this.#skipSatLevelUpdate) {\n this.#circleElem.setAttribute('cx', `${s * 64}`);\n this.#circleElem.setAttribute('cy', `${(1 - v) * 48}`);\n }\n }\n this.#skipHueUpdate = false;\n this.#skipSatLevelUpdate = false;\n this.#skipAlphaUpdate = false;\n }\n setOptions(options) {\n copyExistingProperties(this.#options, options);\n const {converters: {to, from}, alpha} = this.#options;\n this.#alphaUIElem.style.display = alpha ? '' : 'none';\n this.#convertInternalToHex = alpha\n ? v => floatRGBAToHex(hsva01ToRGBAFloat(v))\n : v => floatRGBToHex(hsv01ToRGBFloat(v));\n this.#convertHexToInternal = alpha\n ? v => rgbaFloatToHSVA01(hexToFloatRGBA(v))\n : v => rgbFloatToHSV01(hexToFloatRGB(v));\n this.#to = to;\n this.#from = from;\n return this;\n }\n}\n","import ElementView from '../views/ElementView.js';\nimport ValueController from './ValueController.js';\nimport { copyExistingProperties } from '../libs/utils.js';\nimport { createElem } from '../libs/elem.js';\n/*\n\nholder = new TabHolder\ntab = holder.add(new Tab(\"name\"))\ntab.add(...)\n\n\npc = new PopdownController\ntop = pc.add(new Row())\ntop.add(new Button());\nvalues = topRow.add(new Div())\nbottom = pc.add(new Row());\n\n\n\npc = new PopdownController\npc.addTop\npc.addTop\n\npc.addBottom\n\n\n*/\n\nexport default class PopDownController extends ValueController {\n #top;\n #valuesView;\n #checkboxElem;\n #bottom;\n #options = {\n open: false,\n };\n\n constructor(object, property, options = {}) {\n super(object, property, 'muigui-pop-down-controller');\n /*\n [ValueView\n [[B][values]] upper row\n [[ visual ]] lower row\n ]\n */\n this.#top = this.add(new ElementView('div', 'muigui-pop-down-top'));\n// this.#top.add(new CheckboxView(makeSetter(this.#options, 'open')));\n const checkboxElem = this.#top.addElem(createElem('input', {\n type: 'checkbox',\n onChange: () => {\n this.#options.open = checkboxElem.checked;\n this.updateDisplay();\n },\n }));\n this.#checkboxElem = checkboxElem;\n this.#valuesView = this.#top.add(new ElementView('div', 'muigui-pop-down-values'));\n const container = new ElementView('div', 'muigui-pop-down-bottom muigui-open-container');\n this.#bottom = new ElementView('div');\n container.add(this.#bottom);\n this.add(container);\n this.setOptions(options);\n }\n setKnobColor(bgCssColor/*, fgCssColor*/) {\n if (this.#checkboxElem) {\n this.#checkboxElem.style = `\n --range-color: ${bgCssColor};\n --value-bg-color: ${bgCssColor};\n `;\n }\n }\n updateDisplay() {\n super.updateDisplay();\n const {open} = this.#options;\n this.domElement.children[1].classList.toggle('muigui-open', open);\n this.domElement.children[1].classList.toggle('muigui-closed', !open);\n }\n setOptions(options) {\n copyExistingProperties(this.#options, options);\n super.setOptions(options);\n this.updateDisplay();\n }\n addTop(view) {\n return this.#valuesView.add(view);\n }\n addBottom(view) {\n return this.#bottom.add(view);\n }\n}","/* eslint-disable no-underscore-dangle */\nimport {\n colorFormatConverters,\n guessFormat,\n hasAlpha,\n hexToUint8RGB,\n hslToRgbUint8,\n rgbUint8ToHsl,\n uint8RGBToHex,\n} from '../libs/color-utils.js';\nimport ColorChooserView from '../views/ColorChooserView.js';\nimport TextView from '../views/TextView.js';\nimport PopDownController from './PopDownController.js';\n\nexport default class ColorChooser extends PopDownController {\n #colorView;\n #textView;\n #to;\n\n constructor(object, property, options = {}) {\n super(object, property, 'muigui-color-chooser');\n const format = options.format || guessFormat(this.getValue());\n const {color, text} = colorFormatConverters[format];\n this.#to = color.to;\n this.#textView = new TextView(this, {converters: text, alpha: hasAlpha(format)});\n this.#colorView = new ColorChooserView(this, {converters: color, alpha: hasAlpha(format)});\n this.addTop(this.#textView);\n this.addBottom(this.#colorView);\n // WTF! FIX!\n this.___setKnobHelper = true;\n this.updateDisplay();\n }\n #setKnobHelper() {\n if (this.#to) {\n const hex6Or8 = this.#to(this.getValue());\n const alpha = hex6Or8.length === 9 ? hex6Or8.substring(7, 9) : 'FF';\n const hsl = rgbUint8ToHsl(hexToUint8RGB(hex6Or8));\n hsl[2] = (hsl[2] + 50) % 100;\n const hex = uint8RGBToHex(hslToRgbUint8(hsl));\n this.setKnobColor(`${hex6Or8.substring(0, 7)}${alpha}`, hex);\n }\n }\n updateDisplay() {\n super.updateDisplay();\n if (this.___setKnobHelper) {\n this.#setKnobHelper();\n }\n }\n setOptions(options) {\n super.setOptions(options);\n return this;\n }\n}\n","import css from './styles/muigui.css.js';\nimport {createElem} from './libs/elem.js';\nimport {createController} from './controllers/create-controller.js';\nimport {\n mapRange,\n makeRangeConverters,\n makeRangeOptions,\n makeMinMaxPair,\n} from './libs/utils.js';\nimport {\n converters\n} from './libs/conversions.js';\nimport {\n hasAlpha,\n guessFormat,\n} from './libs/color-utils.js';\nimport Canvas from './controllers/Canvas.js';\nimport Color from './controllers/Color.js';\nimport Divider from './controllers/Divider.js';\nimport Folder from './controllers/Folder.js';\nimport Label from './controllers/Label.js';\nimport Controller from './controllers/Controller.js';\nimport ColorChooser from './controllers/ColorChooser.js';\n\nimport Column from './layout/Column.js';\nimport Frame from './layout/Frame.js';\nimport Grid from './layout/Grid.js';\nimport Row from './layout/Row.js';\n\nexport {\n Column,\n Frame,\n Grid,\n Row,\n};\n\nexport class GUIFolder extends Folder {\n add(object, property, ...args) {\n const controller = object instanceof Controller\n ? object\n : createController(object, property, ...args);\n return this.addController(controller);\n }\n addCanvas(name) {\n return this.addController(new Canvas(name));\n }\n addColor(object, property, options = {}) {\n const value = object[property];\n if (hasAlpha(options.format || guessFormat(value))) {\n return this.addController(new ColorChooser(object, property, options));\n } else {\n return this.addController(new Color(object, property, options));\n }\n }\n addDivider() {\n return this.addController(new Divider());\n }\n addFolder(name) {\n return this.addController(new GUIFolder(name));\n }\n addLabel(text) {\n return this.addController(new Label(text));\n }\n addButton(name, fn) {\n const o = {fn};\n return this.add(o, 'fn').name(name);\n }\n}\n\nclass MuiguiElement extends HTMLElement {\n constructor() {\n super();\n this.shadow = this.attachShadow({mode: 'open'});\n }\n}\n\ncustomElements.define('muigui-element', MuiguiElement);\n\nconst baseStyleSheet = new CSSStyleSheet();\n//baseStyleSheet.replaceSync(css.default);\nconst userStyleSheet = new CSSStyleSheet();\n\nfunction makeStyleSheetUpdater(styleSheet) {\n let newCss;\n let newCssPromise;\n\n function updateStyle() {\n if (newCss && !newCssPromise) {\n const s = newCss;\n newCss = undefined;\n newCssPromise = styleSheet.replace(s).then(() => {\n newCssPromise = undefined;\n updateStyle();\n });\n }\n }\n\n return function updateStyleSheet(css) {\n newCss = css;\n updateStyle();\n };\n}\n\nconst updateBaseStyle = makeStyleSheetUpdater(baseStyleSheet);\nconst updateUserStyle = makeStyleSheetUpdater(userStyleSheet);\n\nfunction getTheme(name) {\n const { include, css: cssStr } = css.themes[name];\n return `${include.map(m => css[m]).join('\\n')} : css.default}\\n${cssStr || ''}`;\n}\n\nexport class GUI extends GUIFolder {\n static converters = converters;\n static mapRange = mapRange;\n static makeRangeConverters = makeRangeConverters;\n static makeRangeOptions = makeRangeOptions;\n static makeMinMaxPair = makeMinMaxPair;\n #localStyleSheet = new CSSStyleSheet();\n\n constructor(options = {}) {\n super('Controls', 'muigui-root');\n if (options instanceof HTMLElement) {\n options = {parent: options};\n }\n const {\n autoPlace = true,\n width,\n title = 'Controls',\n } = options;\n let {\n parent,\n } = options;\n\n if (width) {\n this.domElement.style.width = /^\\d+$/.test(width) ? `${width}px` : width;\n }\n if (parent === undefined && autoPlace) {\n parent = document.body;\n this.domElement.classList.add('muigui-auto-place');\n }\n if (parent) {\n const muiguiElement = createElem('muigui-element');\n muiguiElement.shadowRoot.adoptedStyleSheets = [this.#localStyleSheet, baseStyleSheet, userStyleSheet];\n muiguiElement.shadow.appendChild(this.domElement);\n parent.appendChild(muiguiElement);\n }\n if (title) {\n this.title(title);\n }\n this.#localStyleSheet.replaceSync(css.default);\n this.domElement.classList.add('muigui', 'muigui-colors');\n }\n setStyle(css) {\n this.#localStyleSheet.replace(css);\n }\n static setBaseStyles(css) {\n updateBaseStyle(css);\n }\n static getBaseStyleSheet() {\n return baseStyleSheet;\n }\n static setUserStyles(css) {\n updateUserStyle(css);\n }\n static getUserStyleSheet() {\n return userStyleSheet;\n }\n setTheme(name) {\n this.setStyle(getTheme(name));\n }\n static setTheme(name) {\n GUI.setBaseStyles(getTheme(name));\n }\n}\n\nexport default GUI;\n","import Button from './Button.js';\nimport Checkbox from './Checkbox.js';\nimport TextNumber from './TextNumber.js';\nimport Select from './Select.js';\nimport Range from './Range.js';\nimport Text from './Text.js';\n\n// const isConversion = o => typeof o.to === 'function' && typeof o.from === 'function';\n\n/**\n * possible inputs\n * add(o, p, min: number, max: number)\n * add(o, p, min: number, max: number, step: number)\n * add(o, p, array: [value])\n * add(o, p, array: [[key, value]])\n *\n * @param {*} object\n * @param {string} property\n * @param {...any} args\n * @returns {Controller}\n */\nexport function createController(object, property, ...args) {\n const [arg1] = args;\n if (Array.isArray(arg1)) {\n return new Select(object, property, {keyValues: arg1});\n }\n if (arg1 && arg1.keyValues) {\n return new Select(object, property, {keyValues: arg1.keyValues});\n }\n\n const t = typeof object[property];\n switch (t) {\n case 'number':\n if (typeof args[0] === 'number' && typeof args[1] === 'number') {\n const min = args[0];\n const max = args[1];\n const step = args[2];\n return new Range(object, property, {min, max, ...(step && {step})});\n }\n return args.length === 0\n ? new TextNumber(object, property, ...args)\n : new Range(object, property, ...args);\n case 'boolean':\n return new Checkbox(object, property, ...args);\n case 'function':\n return new Button(object, property, ...args);\n case 'string':\n return new Text(object, property, ...args);\n case 'undefined':\n throw new Error(`no property named ${property}`);\n default:\n throw new Error(`unhandled type ${t} for property ${property}`);\n }\n}","function noop() {\n}\n\nconst keyDirections = {\n ArrowLeft: [-1, 0],\n ArrowRight: [1, 0],\n ArrowUp: [0, -1],\n ArrowDown: [0, 1],\n};\n\n// This probably needs to be global\nexport function addKeyboardEvents(elem, {onDown = noop, onUp = noop}) {\n const keyDown = function (event) {\n const mult = event.shiftKey ? 10 : 1;\n const [dx, dy] = (keyDirections[event.key] || [0, 0]).map(v => v * mult);\n const fn = event.type === 'keydown' ? onDown : onUp;\n fn({\n type: event.type.substring(3),\n dx,\n dy,\n event,\n });\n };\n\n elem.addEventListener('keydown', keyDown);\n elem.addEventListener('keyup', keyDown);\n\n return function () {\n elem.removeEventListener('keydown', keyDown);\n elem.removeEventListener('keyup', keyDown);\n };\n}","export function assert(truthy, msg = '') {\n if (!truthy) {\n throw new Error(msg);\n }\n}","import { assert } from '../libs/assert.js';\n\nfunction getEllipsePointForAngle(cx, cy, rx, ry, phi, theta) {\n const m = Math.abs(rx) * Math.cos(theta);\n const n = Math.abs(ry) * Math.sin(theta);\n\n return [\n cx + Math.cos(phi) * m - Math.sin(phi) * n,\n cy + Math.sin(phi) * m + Math.cos(phi) * n,\n ];\n}\n\nfunction getEndpointParameters(cx, cy, rx, ry, phi, theta, dTheta) {\n const [x1, y1] = getEllipsePointForAngle(cx, cy, rx, ry, phi, theta);\n const [x2, y2] = getEllipsePointForAngle(cx, cy, rx, ry, phi, theta + dTheta);\n\n const fa = Math.abs(dTheta) > Math.PI ? 1 : 0;\n const fs = dTheta > 0 ? 1 : 0;\n\n return { x1, y1, x2, y2, fa, fs };\n}\n\nexport function arc(cx, cy, r, start, end) {\n assert(Math.abs(start - end) <= Math.PI * 2);\n assert(start >= -Math.PI && start <= Math.PI * 2);\n assert(start <= end);\n assert(end >= -Math.PI && end <= Math.PI * 4);\n\n const { x1, y1, x2, y2, fa, fs } = getEndpointParameters(cx, cy, r, r, 0, start, end - start);\n return Math.abs(Math.abs(start - end) - Math.PI * 2) > Number.EPSILON\n ? `M${cx} ${cy} L${x1} ${y1} A ${r} ${r} 0 ${fa} ${fs} ${x2} ${y2} L${cx} ${cy}`\n : `M${x1} ${y1} L${x1} ${y1} A ${r} ${r} 0 ${fa} ${fs} ${x2} ${y2}`;\n}\n","import { identity } from '../libs/conversions.js';\nimport { createElem } from '../libs/elem.js';\nimport { addKeyboardEvents } from '../libs/keyboard.js';\nimport { arc } from '../libs/svg.js';\nimport { addTouchEvents } from '../libs/touch.js';\nimport { createWheelHelper } from '../libs/wheel.js';\nimport { clamp, copyExistingProperties, euclideanModulo, lerp, stepify } from '../libs/utils.js';\nimport EditView from './EditView.js';\n\nconst svg = `\n\n`;\n\nconst twoPiMod = v => euclideanModulo(v + Math.PI, Math.PI * 2) - Math.PI;\n\nexport default class DirectionView extends EditView {\n #arrowElem;\n #rangeElem;\n #lastV;\n #wrap;\n #options = {\n step: 1,\n min: -180,\n max: 180,\n\n /*\n --------\n / -π/2 \\\n / | \\\n |<- -π * |\n | * 0 ->| zero is down the positive X axis\n |<- +π * |\n \\ | /\n \\ π/2 /\n --------\n */\n dirMin: -Math.PI,\n dirMax: Math.PI,\n //dirMin: Math.PI * 0.5,\n //dirMax: Math.PI * 2.5,\n //dirMin: -Math.PI * 0.75, // test 10:30 to 7:30\n //dirMax: Math.PI * 0.75,\n //dirMin: Math.PI * 0.75, // test 7:30 to 10:30\n //dirMax: -Math.PI * 0.75,\n //dirMin: -Math.PI * 0.75, // test 10:30 to 1:30\n //dirMax: -Math.PI * 0.25,\n //dirMin: Math.PI * 0.25, // test 4:30 to 7:30\n //dirMax: Math.PI * 0.75,\n //dirMin: Math.PI * 0.75, // test 4:30 to 7:30\n //dirMax: Math.PI * 0.25,\n wrap: undefined,\n converters: identity,\n };\n\n constructor(setter, options = {}) {\n const wheelHelper = createWheelHelper();\n super(createElem('div', {\n className: 'muigui-direction muigui-no-scroll',\n innerHTML: svg,\n onWheel: e => {\n e.preventDefault();\n const {min, max, step} = this.#options;\n const delta = wheelHelper(e, step);\n let tempV = this.#lastV + delta;\n if (this.#wrap) {\n tempV = euclideanModulo(tempV - min, max - min) + min;\n }\n const newV = clamp(stepify(tempV, v => v, step), min, max);\n setter.setValue(newV);\n },\n }));\n const handleTouch = (e) => {\n const {min, max, step, dirMin, dirMax} = this.#options;\n const nx = e.nx * 2 - 1;\n const ny = e.ny * 2 - 1;\n const a = Math.atan2(ny, nx);\n\n const center = (dirMin + dirMax) / 2;\n\n const centeredAngle = twoPiMod(a - center);\n const centeredStart = twoPiMod(dirMin - center);\n const diff = dirMax - dirMin;\n\n const n = clamp((centeredAngle - centeredStart) / (diff), 0, 1);\n const newV = stepify(min + (max - min) * n, v => v, step);\n setter.setValue(newV);\n };\n addTouchEvents(this.domElement, {\n onDown: handleTouch,\n onMove: handleTouch,\n });\n addKeyboardEvents(this.domElement, {\n onDown: (e) => {\n const {min, max, step} = this.#options;\n const newV = clamp(stepify(this.#lastV + e.dx * step, v => v, step), min, max);\n setter.setValue(newV);\n },\n });\n this.#arrowElem = this.$('#muigui-arrow');\n this.#rangeElem = this.$('#muigui-range');\n this.setOptions(options);\n }\n updateDisplay(v) {\n this.#lastV = v;\n const {min, max} = this.#options;\n const n = (v - min) / (max - min);\n const angle = lerp(this.#options.dirMin, this.#options.dirMax, n);\n this.#arrowElem.style.transform = `rotate(${angle}rad)`;\n }\n setOptions(options) {\n copyExistingProperties(this.#options, options);\n const {dirMin, dirMax, wrap} = this.#options;\n this.#wrap = wrap !== undefined\n ? wrap\n : Math.abs(dirMin - dirMax) >= Math.PI * 2 - Number.EPSILON;\n const [min, max] = dirMin < dirMax ? [dirMin, dirMax] : [dirMax , dirMin];\n this.#rangeElem.setAttribute('d', arc(0, 0, 28.87, min, max));\n }\n}\n","import { identity } from '../libs/conversions.js';\nimport DirectionView from '../views/DirectionView.js';\nimport NumberView from '../views/NumberView.js';\n// import ValueController from './ValueController.js';\nimport PopDownController from './PopDownController.js';\n\n\n// deg2rad\n// where is 0\n// range (0, 360), (-180, +180), (0,0) Really this is a range\n\nexport default class Direction extends PopDownController {\n #options;\n constructor(object, property, options) {\n super(object, property, 'muigui-direction');\nthis.#options = options; // FIX\n this.addTop(new NumberView(this,\nidentity));\n this.addBottom(new DirectionView(this, options));\n this.updateDisplay();\n }\n}\n\n","import { createElem } from '../libs/elem.js';\nimport { makeId } from '../libs/ids.js';\nimport EditView from './EditView.js';\n\nexport default class RadioGridView extends EditView {\n #values;\n\n constructor(setter, keyValues, cols = 3) {\n const values = [];\n const name = makeId();\n super(createElem('div', {}, keyValues.map(([key, value], ndx) => {\n values.push(value);\n return createElem('label', {}, [\n createElem('input', {\n type: 'radio',\n name,\n value: ndx,\n onChange: function () {\n if (this.checked) {\n setter.setFinalValue(that.#values[this.value]);\n }\n },\n }),\n createElem('button', {\n type: 'button',\n textContent: key,\n onClick: function () {\n this.previousElementSibling.click();\n },\n }),\n ]);\n })));\n // eslint-disable-next-line @typescript-eslint/no-this-alias\n const that = this;\n this.#values = values;\n this.cols(cols);\n }\n updateDisplay(v) {\n const ndx = this.#values.indexOf(v);\n for (let i = 0; i < this.domElement.children.length; ++i) {\n this.domElement.children[i].children[0].checked = i === ndx;\n }\n }\n cols(cols) {\n this.domElement.style.gridTemplateColumns = `repeat(${cols}, 1fr)`;\n }\n}\n","import RadioGridView from '../views/RadioGridView.js';\nimport ValueController from './ValueController.js';\nimport { convertToKeyValues } from '../libs/key-values.js';\n\nexport default class RadioGrid extends ValueController {\n constructor(object, property, options) {\n super(object, property, 'muigui-radio-grid');\n const valueIsNumber = typeof this.getValue() === 'number';\n const {\n keyValues: keyValuesInput,\n cols = 3,\n } = options;\n const keyValues = convertToKeyValues(keyValuesInput, valueIsNumber);\n this.add(new RadioGridView(this, keyValues, cols));\n this.updateDisplay();\n }\n}","export function onResize(elem, callback) {\n new ResizeObserver(() => {\n callback({rect: elem.getBoundingClientRect(), elem});\n }).observe(elem);\n}\n\nexport function onResizeSVGNoScale(elem, hAnchor, vAnchor, callback) {\n onResize(elem, ({rect}) => {\n const {width, height} = rect;\n elem.setAttribute('viewBox', `-${width * hAnchor} -${height * vAnchor} ${width} ${height}`);\n callback({elem, rect});\n });\n}\n\nexport function onResizeCanvas(elem, callback) {\n onResize(elem, ({rect}) => {\n const {width, height} = rect;\n elem.width = width;\n elem.height = height;\n callback({elem, rect});\n });\n}\n","import { createElem } from '../libs/elem.js';\nimport { addKeyboardEvents } from '../libs/keyboard.js';\nimport { addTouchEvents } from '../libs/touch.js';\nimport { createWheelHelper } from '../libs/wheel.js';\nimport { onResizeSVGNoScale } from '../libs/resize-helpers.js';\nimport { clamp, copyExistingProperties, stepify } from '../libs/utils.js';\nimport EditView from './EditView.js';\n\nconst svg = `\n\n`;\n\nfunction createSVGTicks(start, end, step, min, max, height) {\n const p = [];\n if (start < min) {\n start += stepify(min - start, v => v, step);\n }\n end = Math.min(end, max);\n for (let i = start; i <= end; i += step) {\n p.push(`M${i} 0 l0 ${height}`);\n }\n return p.join(' ');\n}\n\nfunction createSVGNumbers(start, end, unitSize, unit, minusSize, min, max, labelFn) {\n const texts = [];\n if (start < min) {\n start += stepify(min - start, v => v, unitSize);\n }\n end = Math.min(end, max);\n const digits = Math.max(0, -Math.log10(unit));\n const f = v => labelFn(v.toFixed(digits));\n for (let i = start; i <= end; i += unitSize) {\n texts.push(`= 0 ? i : (i - minusSize / 2) }\" y=\"0\">${f(i / unitSize * unit)}`);\n }\n return texts.join('\\n');\n}\n\nfunction computeSizeOfMinus(elem) {\n const oldHTML = elem.innerHTML;\n elem.innerHTML = '- ';\n const text = elem.querySelector('text');\n const size = text.getComputedTextLength();\n elem.innerHTML = oldHTML;\n return size;\n}\n\nexport default class SliderView extends EditView {\n #svgElem;\n #originElem;\n #ticksElem;\n #thicksElem;\n #numbersElem;\n #leftGradElem;\n #rightGradElem;\n #width;\n #height;\n #lastV;\n #minusSize;\n #options = {\n min: -100,\n max: 100,\n step: 1,\n unit: 10,\n unitSize: 10,\n ticksPerUnit: 5,\n labelFn: v => v,\n tickHeight: 1,\n limits: true,\n thicksColor: undefined,\n orientation: undefined,\n };\n\n constructor(setter, options) {\n const wheelHelper = createWheelHelper();\n super(createElem('div', {\n innerHTML: svg,\n className: 'muigui-no-v-scroll',\n onWheel: e => {\n e.preventDefault();\n const {min, max, step} = this.#options;\n const delta = wheelHelper(e, step);\n const newV = clamp(stepify(this.#lastV + delta, v => v, step), min, max);\n setter.setValue(newV);\n },\n }));\n this.#svgElem = this.$('svg');\n this.#originElem = this.$('#muigui-origin');\n this.#ticksElem = this.$('#muigui-ticks');\n this.#thicksElem = this.$('#muigui-thicks');\n this.#numbersElem = this.$('#muigui-numbers');\n this.#leftGradElem = this.$('#muigui-left-grad');\n this.#rightGradElem = this.$('#muigui-right-grad');\n this.setOptions(options);\n let startV;\n addTouchEvents(this.domElement, {\n onDown: () => {\n startV = this.#lastV;\n },\n onMove: (e) => {\n const {min, max, unitSize, unit, step} = this.#options;\n const newV = clamp(stepify(startV - e.dx / unitSize * unit, v => v, step), min, max);\n setter.setValue(newV);\n },\n });\n addKeyboardEvents(this.domElement, {\n onDown: (e) => {\n const {min, max, step} = this.#options;\n const newV = clamp(stepify(this.#lastV + e.dx * step, v => v, step), min, max);\n setter.setValue(newV);\n },\n });\n onResizeSVGNoScale(this.#svgElem, 0.5, 0, ({rect: {width}}) => {\n this.#leftGradElem.setAttribute('x', -width / 2);\n this.#rightGradElem.setAttribute('x', width / 2 - 20);\n this.#minusSize = computeSizeOfMinus(this.#numbersElem);\n this.#width = width;\n this.#updateSlider();\n });\n }\n // |--------V--------|\n // . . | . . . | . . . |\n //\n #updateSlider() {\n // There's no size if ResizeObserver has not fired yet.\n if (!this.#width || this.#lastV === undefined) {\n return;\n }\n const {\n labelFn,\n limits,\n min,\n max,\n orientation,\n tickHeight,\n ticksPerUnit,\n unit,\n unitSize,\n thicksColor,\n } = this.#options;\n const unitsAcross = Math.ceil(this.#width / unitSize);\n const center = this.#lastV;\n const centerUnitSpace = center / unit;\n const startUnitSpace = Math.round(centerUnitSpace - unitsAcross);\n const endUnitSpace = startUnitSpace + unitsAcross * 2;\n const start = startUnitSpace * unitSize;\n const end = endUnitSpace * unitSize;\n const minUnitSpace = limits ? min * unitSize / unit : start;\n const maxUnitSpace = limits ? max * unitSize / unit : end;\n const height = labelFn(1) === '' ? 10 : 5;\n if (ticksPerUnit > 1) {\n this.#ticksElem.setAttribute('d', createSVGTicks(start, end, unitSize / ticksPerUnit, minUnitSpace, maxUnitSpace, height * tickHeight));\n }\n this.#thicksElem.style.stroke = thicksColor; //setAttribute('stroke', thicksColor);\n this.#thicksElem.setAttribute('d', createSVGTicks(start, end, unitSize, minUnitSpace, maxUnitSpace, height));\n this.#numbersElem.innerHTML = createSVGNumbers(start, end, unitSize, unit, this.#minusSize, minUnitSpace, maxUnitSpace, labelFn);\n this.#originElem.setAttribute('transform', `translate(${-this.#lastV * unitSize / unit} 0)`);\n this.#svgElem.classList.toggle('muigui-slider-up', orientation === 'up');\n }\n updateDisplay(v) {\n this.#lastV = v;\n this.#updateSlider();\n }\n setOptions(options) {\n copyExistingProperties(this.#options, options);\n return this;\n }\n}\n","import ValueController from './ValueController.js';\nimport NumberView from '../views/NumberView.js';\nimport SliderView from '../views/SliderView.js';\n\nexport default class Slider extends ValueController {\n constructor(object, property, options = {}) {\n super(object, property, 'muigui-slider');\n this.add(new SliderView(this, options));\n this.add(new NumberView(this, options));\n this.updateDisplay();\n }\n}\n","import { createElem } from '../libs/elem.js';\nimport { addTouchEvents } from '../libs/touch.js';\nimport { onResizeSVGNoScale } from '../libs/resize-helpers.js';\nimport EditView from './EditView.js';\n\nconst svg = `\n\n`;\n\nexport default class Vec2View extends EditView {\n #svgElem;\n #arrowElem;\n #circleElem;\n #lastV = [];\n\n constructor(setter) {\n super(createElem('div', {\n innerHTML: svg,\n className: 'muigui-no-scroll',\n }));\n const onTouch = (e) => {\n const {width, height} = this.#svgElem.getBoundingClientRect();\n const nx = e.nx * 2 - 1;\n const ny = e.ny * 2 - 1;\n setter.setValue([nx * width * 0.5, ny * height * 0.5]);\n };\n addTouchEvents(this.domElement, {\n onDown: onTouch,\n onMove: onTouch,\n });\n this.#svgElem = this.$('svg');\n this.#arrowElem = this.$('#muigui-arrow');\n this.#circleElem = this.$('#muigui-circle');\n onResizeSVGNoScale(this.#svgElem, 0.5, 0.5, () => this.#updateDisplayImpl);\n }\n #updateDisplayImpl() {\n const [x, y] = this.#lastV;\n this.#arrowElem.setAttribute('d', `M0,0L${x},${y}`);\n this.#circleElem.setAttribute('transform', `translate(${x}, ${y})`);\n }\n updateDisplay(v) {\n this.#lastV[0] = v[0];\n this.#lastV[1] = v[1];\n this.#updateDisplayImpl();\n }\n}\n","import NumberView from '../views/NumberView.js';\nimport Vec2View from '../views/Vec2View.js';\nimport PopDownController from './PopDownController.js';\nimport { strToNumber } from '../libs/conversions.js';\n\n// TODO: zoom with wheel and pinch?\n// TODO: grid?\n// // options\n// scale:\n// range: number (both x and y + /)\n// range: array (min, max)\n// xRange:\n// deg/rad/turn\n\nexport default class Vec2 extends PopDownController {\n constructor(object, property) {\n super(object, property, 'muigui-vec2');\n\n const makeSetter = (ndx) => {\n return {\n setValue: (v) => {\n const newV = this.getValue();\n newV[ndx] = v;\n this.setValue(newV);\n },\n setFinalValue: (v) => {\n const newV = this.getValue();\n newV[ndx] = v;\n this.setFinalValue(newV);\n },\n };\n };\n\n this.addTop(new NumberView(makeSetter(0), {\n converters: {\n to: v => v[0],\n from: strToNumber.from,\n },\n }));\n this.addTop(new NumberView(makeSetter(1), {\n converters: {\n to: v => v[1],\n from: strToNumber.from,\n },\n }));\n this.addBottom(new Vec2View(this));\n this.updateDisplay();\n }\n}\n","const darkColors = {\n main: '#ddd',\n};\nconst lightColors = {\n main: '#333',\n};\n\nconst darkMatcher = window.matchMedia('(prefers-color-scheme: dark)');\n\nlet colors;\nlet isDarkMode;\n\nfunction update() {\n isDarkMode = darkMatcher.matches;\n colors = isDarkMode ? darkColors : lightColors;\n}\ndarkMatcher.addEventListener('change', update);\nupdate();\n\nexport function graph(canvas, data, {\n min = -1,\n max = 1,\n interval = 16,\n color,\n }) {\n const ctx = canvas.getContext('2d');\n\n function render() {\n const {width, height} = canvas;\n ctx.clearRect(0, 0, width, height);\n ctx.beginPath();\n const range = max - min;\n for (let i = 0; i < data.length; ++i) {\n const x = i * width / data.length;\n const y = (data[i] - min) * height / range;\n ctx.lineTo(x, y);\n }\n ctx.strokeStyle = color || colors.main;\n ctx.stroke();\n }\n setInterval(render, interval);\n}","import GUI from './muigui.js';\n\nexport { default as ColorChooser } from './controllers/ColorChooser.js';\nexport { default as Direction } from './controllers/Direction.js';\nexport { default as RadioGrid } from './controllers/RadioGrid.js';\nexport { default as Range } from './controllers/Range.js';\nexport { default as Select } from './controllers/Select.js';\nexport { default as Slider } from './controllers/Slider.js';\nexport { default as TextNumber } from './controllers/TextNumber.js';\nexport { default as Vec2 } from './controllers/Vec2.js';\n\nimport {graph} from './libs/graph.js';\nimport {monitor} from './libs/monitor.js';\n\nexport const helpers = {\n graph,\n monitor,\n};\n\nexport default GUI;","export function monitor(label, object, property, {interval = 200} = {}) {\n setInterval(() => {\n label.text(JSON.stringify(object[property], null, 2));\n }, interval);\n}\n"],"names":["css","default","themes","include","float","form","none","createElem","tag","attrs","children","elem","document","createElement","key","value","Object","entries","startsWith","eventName","substring","toLowerCase","addEventListener","passive","k","v","undefined","setAttribute","child","appendChild","setElemProps","nextId","removeArrayElem","array","ndx","indexOf","splice","clamp","min","max","Math","isTypedArray","SharedArrayBuffer","a","buffer","ArrayBuffer","stepify","from","step","round","euclideanModulo","n","copyExistingProperties","dst","src","mapRange","inMin","inMax","outMin","outMax","makeRangeConverters","to","makeRangeOptions","converters","identity","makeMinMaxPair","gui","properties","minPropName","maxPropName","options","guiMinRange","minRange","valueMinRange","minGui","add","onChange","maxGui","setValue","View","domElement","childDestElem","views","constructor","this","addElem","removeElem","removeChild","pushSubElem","popSubElem","parentElement","view","push","remove","pushSubView","popSubView","setOptions","updateDisplayIfNeeded","newV","ignoreCache","$","selector","querySelector","Controller","changeFns","finishChangeFns","parent","className","super","classList","setParent","enable","disabled","show","toggle","hide","closest","forEach","querySelectorAll","disable","fn","removeChange","onFinishChange","removeFinishChange","callListeners","fns","call","emitChange","object","property","controller","emitFinalChange","updateDisplay","getColors","toCamelCase","s","replace","m","m1","toUpperCase","div","colors","fromEntries","map","style","color","getComputedStyle","Button","buttonElem","name","type","onClick","textContent","arraysEqual","b","length","i","EditView","oldV","updateCheck","checkArrayNeedsUpdate","needUpdate","copyArrayElementsFromTo","checkTypedArrayNeedsUpdate","once","checkObjectNeedsUpdate","checkValueNeedsUpdate","getUpdateCheckForType","Array","isArray","bind","CheckboxView","checkboxElem","setter","id","onInput","checked","setFinalValue","tasks","tasksToRemove","Set","requestId","processing","processTasks","task","has","size","queueProcessing","clear","requestAnimationFrame","makeId","ValueView","LabelController","nameElem","for","title","tooltip","tip","ValueController","initialValue","listening","updateFn","getValue","setValueImpl","isDifferent","keys","assign","reset","listen","set","removeTask","Checkbox","strToNumber","toString","parseFloat","Number","isNaN","radToDeg","PI","createWheelHelper","wheelAccum","e","wheelScale","deltaY","delta","floor","abs","sign","NumberView","skipUpdate","NEGATIVE_INFINITY","POSITIVE_INFINITY","wheelHelper","handleInput","onWheel","preventDefault","valid","outV","setFn","inRange","TextNumber","textView","SelectView","values","keyValues","selectedIndex","convertToKeyValues","valueIsNumber","Select","keyValuesInput","RangeView","validV","Range","TextView","Text","lerp","t","fract","f0","toFixed","f3","hexToUint32RGB","parseInt","hexToUint32RGBA","hexToUint8RGB","uint8RGBToHex","padStart","join","hexToUint8RGBA","uint8RGBAToHex","hexToFloatRGB","floatRGBToHex","hexToFloatRGBA","floatRGBAToHex","scaleAndClamp","hexToObjectRGB","r","g","hexToObjectRGBA","hexToCssRGB","cssRGBRegex","hexToCssRGBA","cssRGBARegex","hexToCssHSL","hsl","rgbUint8ToHsl","hexToCssHSLA","hsla","rgbaUint8ToHsla","cssHSLRegex","cssHSLARegex","hslToRgbUint8","h","l","f","rgbFloatToHsl01","d","rgbaFloatToHsla01","rgb","rgba","hsv01ToRGBFloat","hue","sat","val","hsva01ToRGBAFloat","alpha","round3","rgbFloatToHSV01","p","q","EPSILON","rgbaFloatToHSVA01","hasAlpha","format","endsWith","cssStringFormats","re","guessFormat","console","warn","formatInfo","test","guessStringColorFormat","trim","Uint8Array","Uint8ClampedArray","Float32Array","Error","fixHex6","fixHex8","hex6ToHex3","hex6","hex3RE","hex3ToHex6","hex3","exec","m2","fixHex3","strToCssRGB","find","strToCssRGBA","strToCssHSL","strToCssHSLA","strTo3IntsRE","strTo4IntsRE","strTo3Floats","numbers","split","badNdx","findIndex","strTo4Floats","strToUint32RGBRegex","strToUint32RGBARegex","hex6RE","hexNoHash6RE","hex8RE","hexNoHash8RE","colorFormatConverters","text","hex8","strToUint32RGB","strToUint32RGBA","json","JSON","parse","hslaToRgbaUint8","ElementView","Canvas","canvasElem","canvas","ColorView","colorElem","Color","colorView","Divider","Container","controllers","childDestController","filter","c","folders","recursive","c0","addControllerImpl","addController","pushContainer","container","popContainer","Folder","labelElem","toggleOpen","open","close","contains","Label","noop","computeRelativePosition","event","start","rect","getBoundingClientRect","x","clientX","left","y","clientY","top","nx","width","ny","height","dx","dy","ndy","addTouchEvents","onDown","onMove","onUp","pointerMove","pointerUp","releasePointerCapture","pointerId","removeEventListener","body","backgroundColor","pointerDown","setPointerCapture","rel","connectFillTargets","srcElem","dataset","targetElem","ColorChooserView","satLevelElem","circleElem","hueUIElem","hueElem","hueCursorElem","alphaUIElem","alphaElem","alphaCursorElem","hsva","skipHueUpdate","skipSatLevelUpdate","skipAlphaUpdate","convertInternalToHex","convertHexToInternal","innerHTML","handleSatLevelChange","handleHueChange","handleAlphaChange","lum","display","PopDownController","valuesView","bottom","setKnobColor","bgCssColor","addTop","addBottom","ColorChooser","___setKnobHelper","setKnobHelper","hex6Or8","hex","GUIFolder","args","arg1","createController","addCanvas","addColor","addDivider","addFolder","addLabel","addButton","o","MuiguiElement","HTMLElement","shadow","attachShadow","mode","customElements","define","baseStyleSheet","CSSStyleSheet","userStyleSheet","makeStyleSheetUpdater","styleSheet","newCss","newCssPromise","updateStyle","then","updateBaseStyle","updateUserStyle","getTheme","cssStr","GUI","static","localStyleSheet","autoPlace","muiguiElement","shadowRoot","adoptedStyleSheets","replaceSync","setStyle","setTheme","setBaseStyles","keyDirections","ArrowLeft","ArrowRight","ArrowUp","ArrowDown","addKeyboardEvents","keyDown","mult","shiftKey","assert","truthy","msg","getEllipsePointForAngle","cx","cy","rx","ry","phi","theta","cos","sin","arc","end","x1","y1","x2","y2","fa","fs","dTheta","getEndpointParameters","twoPiMod","DirectionView","arrowElem","rangeElem","lastV","wrap","dirMin","dirMax","tempV","handleTouch","atan2","center","angle","transform","Direction","RadioGridView","cols","that","previousElementSibling","click","gridTemplateColumns","RadioGrid","onResize","callback","ResizeObserver","observe","onResizeSVGNoScale","hAnchor","vAnchor","createSVGTicks","SliderView","svgElem","originElem","ticksElem","thicksElem","numbersElem","leftGradElem","rightGradElem","minusSize","unit","unitSize","ticksPerUnit","labelFn","tickHeight","limits","thicksColor","orientation","startV","oldHTML","getComputedTextLength","computeSizeOfMinus","updateSlider","unitsAcross","ceil","centerUnitSpace","startUnitSpace","minUnitSpace","maxUnitSpace","stroke","texts","digits","log10","createSVGNumbers","Slider","Vec2View","onTouch","updateDisplayImpl","Vec2","makeSetter","darkColors","main","lightColors","darkMatcher","window","matchMedia","isDarkMode","update","matches","helpers","graph","data","interval","ctx","getContext","setInterval","clearRect","beginPath","range","lineTo","strokeStyle","monitor","label","stringify"],"mappings":"AAAA,IAAeA,EAAA,CACbC,QAAS,yshBAwtBXC,OAAQ,CACND,QAAS,CACPE,QAAS,CAAC,WACVH,IAAK,UAGPI,MAAO,CACLD,QAAS,CAAC,WACVH,IAAK,+xCA0DPK,KAAM,CACJF,QAAS,GACTH,IAAK,28BA6CPM,KAAM,CACJH,QAAS,GACTH,IAAK,MCvzBF,SAASO,EAAWC,EAAKC,EAAQ,CAAA,EAAIC,EAAW,IACrD,MAAMC,EAAOC,SAASC,cAAcL,GAEpC,OAxBK,SAAsBG,EAAMF,EAAOC,GACxC,IAAK,MAAOI,EAAKC,KAAUC,OAAOC,QAAQR,GACxC,GAAqB,mBAAVM,GAAwBD,EAAII,WAAW,MAAO,CACvD,MAAMC,EAAYL,EAAIM,UAAU,GAAGC,cACnCV,EAAKW,iBAAiBH,EAAWJ,EAAO,CAACQ,SAAS,GACxD,MAAW,GAAqB,iBAAVR,EAChB,IAAK,MAAOS,EAAGC,KAAMT,OAAOC,QAAQF,GAClCJ,EAAKG,GAAKU,GAAKC,YAEMC,IAAdf,EAAKG,GACdH,EAAKgB,aAAab,EAAKC,GAEvBJ,EAAKG,GAAOC,EAGhB,IAAK,MAAMa,KAASlB,EAClBC,EAAKkB,YAAYD,EAGrB,CAIEE,CAAanB,EAAMF,EAAOC,GACnBC,CACT,CAQA,IAAIoB,EAAS,ECjCN,SAASC,EAAgBC,EAA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tBqC,KAAKsX,OAAO,IAAItO,EAAW0X,EAAW,GAAI,CACxC/hB,WAAY,CACVF,GAAIpC,GAAKA,EAAE,GACXsB,KAAMqK,EAAYrK,SAGtBqC,KAAKuX,UAAU,IAAI+I,GAAStgB,OAC5BA,KAAKgD,eACN,EC/CH,MAAM2d,GAAa,CACjBC,KAAM,QAEFC,GAAc,CAClBD,KAAM,QAGFE,GAAcC,OAAOC,WAAW,gCAEtC,IAAIvd,GACAwd,GAEJ,SAASC,KACPD,GAAaH,GAAYK,QACzB1d,GAASwd,GAAaN,GAAaE,EACrC,CACAC,GAAY5kB,iBAAiB,SAAUglB,IACvCA,KCHa,MAAAE,GAAU,CACrBC,MDIK,SAAexP,EAAQyP,GAAMpkB,IAChCA,GAAM,EAAEC,IACRA,EAAM,EAACokB,SACPA,EAAW,GAAE1d,MACbA,IAEF,MAAM2d,EAAM3P,EAAO4P,WAAW,MAe9BC,aAbA,WACE,MAAMtN,MAACA,EAAKE,OAAEA,GAAUzC,EACxB2P,EAAIG,UAAU,EAAG,EAAGvN,EAAOE,GAC3BkN,EAAII,YACJ,MAAMC,EAAQ1kB,EAAMD,EACpB,IAAK,IAAIsH,EAAI,EAAGA,EAAI8c,EAAK/c,SAAUC,EAAG,CACpC,MAAMqP,EAAIrP,EAAI4P,EAAQkN,EAAK/c,OACrByP,GAAKsN,EAAK9c,GAAKtH,GAAOoX,EAASuN,EACrCL,EAAIM,OAAOjO,EAAGG,EACf,CACDwN,EAAIO,YAAcle,GAASJ,GAAOmd,KAClCY,EAAIxB,QACL,GACmBuB,EACtB,ECzBES,QChBK,SAAiBC,EAAOrf,EAAQC,GAAU0e,SAACA,EAAW,KAAO,IAClEG,aAAY,KACVO,EAAM/Q,KAAKK,KAAK2Q,UAAUtf,EAAOC,GAAW,KAAM,GAAG,GACpD0e,EACL"}
\ No newline at end of file
diff --git a/dist/0.x/styles/muigui.css.d.ts b/dist/0.x/styles/muigui.css.d.ts
index 8ba9894..519c287 100644
--- a/dist/0.x/styles/muigui.css.d.ts
+++ b/dist/0.x/styles/muigui.css.d.ts
@@ -2,9 +2,29 @@ declare namespace _default {
let _default: string;
export { _default as default };
export namespace themes {
- let _default_1: string;
+ namespace _default_1 {
+ let include: string[];
+ let css: string;
+ }
export { _default_1 as default };
- export let float: string;
+ export namespace float {
+ let include_1: string[];
+ export { include_1 as include };
+ let css_1: string;
+ export { css_1 as css };
+ }
+ export namespace form {
+ let include_2: never[];
+ export { include_2 as include };
+ let css_2: string;
+ export { css_2 as css };
+ }
+ export namespace none {
+ let include_3: never[];
+ export { include_3 as include };
+ let css_3: string;
+ export { css_3 as css };
+ }
}
}
export default _default;
diff --git a/examples/3rdParty/twgl-full.module.js b/examples/3rdParty/twgl-full.module.js
new file mode 100644
index 0000000..dd530b7
--- /dev/null
+++ b/examples/3rdParty/twgl-full.module.js
@@ -0,0 +1,10085 @@
+/* @license twgl.js 5.5.3 Copyright (c) 2015, Gregg Tavares All Rights Reserved.
+Available via the MIT license.
+see: http://github.com/greggman/twgl.js for details */
+/*
+ * Copyright 2019 Gregg Tavares
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+/**
+ *
+ * Vec3 math math functions.
+ *
+ * Almost all functions take an optional `dst` argument. If it is not passed in the
+ * functions will create a new Vec3. In other words you can do this
+ *
+ * var v = v3.cross(v1, v2); // Creates a new Vec3 with the cross product of v1 x v2.
+ *
+ * or
+ *
+ * var v = v3.create();
+ * v3.cross(v1, v2, v); // Puts the cross product of v1 x v2 in v
+ *
+ * The first style is often easier but depending on where it's used it generates garbage where
+ * as there is almost never allocation with the second style.
+ *
+ * It is always save to pass any vector as the destination. So for example
+ *
+ * v3.cross(v1, v2, v1); // Puts the cross product of v1 x v2 in v1
+ *
+ * @module twgl/v3
+ */
+
+let VecType = Float32Array;
+
+/**
+ * A JavaScript array with 3 values or a Float32Array with 3 values.
+ * When created by the library will create the default type which is `Float32Array`
+ * but can be set by calling {@link module:twgl/v3.setDefaultType}.
+ * @typedef {(number[]|Float32Array)} Vec3
+ * @memberOf module:twgl/v3
+ */
+
+/**
+ * Sets the type this library creates for a Vec3
+ * @param {constructor} ctor the constructor for the type. Either `Float32Array` or `Array`
+ * @return {constructor} previous constructor for Vec3
+ * @memberOf module:twgl/v3
+ */
+function setDefaultType$1(ctor) {
+ const oldType = VecType;
+ VecType = ctor;
+ return oldType;
+}
+
+/**
+ * Creates a vec3; may be called with x, y, z to set initial values.
+ * @param {number} [x] Initial x value.
+ * @param {number} [y] Initial y value.
+ * @param {number} [z] Initial z value.
+ * @return {module:twgl/v3.Vec3} the created vector
+ * @memberOf module:twgl/v3
+ */
+function create$1(x, y, z) {
+ const dst = new VecType(3);
+ if (x) {
+ dst[0] = x;
+ }
+ if (y) {
+ dst[1] = y;
+ }
+ if (z) {
+ dst[2] = z;
+ }
+ return dst;
+}
+
+/**
+ * Adds two vectors; assumes a and b have the same dimension.
+ * @param {module:twgl/v3.Vec3} a Operand vector.
+ * @param {module:twgl/v3.Vec3} b Operand vector.
+ * @param {module:twgl/v3.Vec3} [dst] vector to hold result. If not new one is created.
+ * @return {module:twgl/v3.Vec3} A vector tha tis the sum of a and b.
+ * @memberOf module:twgl/v3
+ */
+function add(a, b, dst) {
+ dst = dst || new VecType(3);
+
+ dst[0] = a[0] + b[0];
+ dst[1] = a[1] + b[1];
+ dst[2] = a[2] + b[2];
+
+ return dst;
+}
+
+/**
+ * Subtracts two vectors.
+ * @param {module:twgl/v3.Vec3} a Operand vector.
+ * @param {module:twgl/v3.Vec3} b Operand vector.
+ * @param {module:twgl/v3.Vec3} [dst] vector to hold result. If not new one is created.
+ * @return {module:twgl/v3.Vec3} A vector that is the difference of a and b.
+ * @memberOf module:twgl/v3
+ */
+function subtract(a, b, dst) {
+ dst = dst || new VecType(3);
+
+ dst[0] = a[0] - b[0];
+ dst[1] = a[1] - b[1];
+ dst[2] = a[2] - b[2];
+
+ return dst;
+}
+
+/**
+ * Performs linear interpolation on two vectors.
+ * Given vectors a and b and interpolation coefficient t, returns
+ * a + t * (b - a).
+ * @param {module:twgl/v3.Vec3} a Operand vector.
+ * @param {module:twgl/v3.Vec3} b Operand vector.
+ * @param {number} t Interpolation coefficient.
+ * @param {module:twgl/v3.Vec3} [dst] vector to hold result. If not new one is created.
+ * @return {module:twgl/v3.Vec3} The linear interpolated result.
+ * @memberOf module:twgl/v3
+ */
+function lerp(a, b, t, dst) {
+ dst = dst || new VecType(3);
+
+ dst[0] = a[0] + t * (b[0] - a[0]);
+ dst[1] = a[1] + t * (b[1] - a[1]);
+ dst[2] = a[2] + t * (b[2] - a[2]);
+
+ return dst;
+}
+
+/**
+ * Performs linear interpolation on two vectors.
+ * Given vectors a and b and interpolation coefficient vector t, returns
+ * a + t * (b - a).
+ * @param {module:twgl/v3.Vec3} a Operand vector.
+ * @param {module:twgl/v3.Vec3} b Operand vector.
+ * @param {module:twgl/v3.Vec3} t Interpolation coefficients vector.
+ * @param {module:twgl/v3.Vec3} [dst] vector to hold result. If not new one is created.
+ * @return {module:twgl/v3.Vec3} the linear interpolated result.
+ * @memberOf module:twgl/v3
+ */
+function lerpV(a, b, t, dst) {
+ dst = dst || new VecType(3);
+
+ dst[0] = a[0] + t[0] * (b[0] - a[0]);
+ dst[1] = a[1] + t[1] * (b[1] - a[1]);
+ dst[2] = a[2] + t[2] * (b[2] - a[2]);
+
+ return dst;
+}
+
+/**
+ * Return max values of two vectors.
+ * Given vectors a and b returns
+ * [max(a[0], b[0]), max(a[1], b[1]), max(a[2], b[2])].
+ * @param {module:twgl/v3.Vec3} a Operand vector.
+ * @param {module:twgl/v3.Vec3} b Operand vector.
+ * @param {module:twgl/v3.Vec3} [dst] vector to hold result. If not new one is created.
+ * @return {module:twgl/v3.Vec3} The max components vector.
+ * @memberOf module:twgl/v3
+ */
+function max(a, b, dst) {
+ dst = dst || new VecType(3);
+
+ dst[0] = Math.max(a[0], b[0]);
+ dst[1] = Math.max(a[1], b[1]);
+ dst[2] = Math.max(a[2], b[2]);
+
+ return dst;
+}
+
+/**
+ * Return min values of two vectors.
+ * Given vectors a and b returns
+ * [min(a[0], b[0]), min(a[1], b[1]), min(a[2], b[2])].
+ * @param {module:twgl/v3.Vec3} a Operand vector.
+ * @param {module:twgl/v3.Vec3} b Operand vector.
+ * @param {module:twgl/v3.Vec3} [dst] vector to hold result. If not new one is created.
+ * @return {module:twgl/v3.Vec3} The min components vector.
+ * @memberOf module:twgl/v3
+ */
+function min(a, b, dst) {
+ dst = dst || new VecType(3);
+
+ dst[0] = Math.min(a[0], b[0]);
+ dst[1] = Math.min(a[1], b[1]);
+ dst[2] = Math.min(a[2], b[2]);
+
+ return dst;
+}
+
+/**
+ * Multiplies a vector by a scalar.
+ * @param {module:twgl/v3.Vec3} v The vector.
+ * @param {number} k The scalar.
+ * @param {module:twgl/v3.Vec3} [dst] vector to hold result. If not new one is created.
+ * @return {module:twgl/v3.Vec3} The scaled vector.
+ * @memberOf module:twgl/v3
+ */
+function mulScalar(v, k, dst) {
+ dst = dst || new VecType(3);
+
+ dst[0] = v[0] * k;
+ dst[1] = v[1] * k;
+ dst[2] = v[2] * k;
+
+ return dst;
+}
+
+/**
+ * Divides a vector by a scalar.
+ * @param {module:twgl/v3.Vec3} v The vector.
+ * @param {number} k The scalar.
+ * @param {module:twgl/v3.Vec3} [dst] vector to hold result. If not new one is created.
+ * @return {module:twgl/v3.Vec3} The scaled vector.
+ * @memberOf module:twgl/v3
+ */
+function divScalar(v, k, dst) {
+ dst = dst || new VecType(3);
+
+ dst[0] = v[0] / k;
+ dst[1] = v[1] / k;
+ dst[2] = v[2] / k;
+
+ return dst;
+}
+
+/**
+ * Computes the cross product of two vectors; assumes both vectors have
+ * three entries.
+ * @param {module:twgl/v3.Vec3} a Operand vector.
+ * @param {module:twgl/v3.Vec3} b Operand vector.
+ * @param {module:twgl/v3.Vec3} [dst] vector to hold result. If not new one is created.
+ * @return {module:twgl/v3.Vec3} The vector of a cross b.
+ * @memberOf module:twgl/v3
+ */
+function cross(a, b, dst) {
+ dst = dst || new VecType(3);
+
+ const t1 = a[2] * b[0] - a[0] * b[2];
+ const t2 = a[0] * b[1] - a[1] * b[0];
+ dst[0] = a[1] * b[2] - a[2] * b[1];
+ dst[1] = t1;
+ dst[2] = t2;
+
+ return dst;
+}
+
+/**
+ * Computes the dot product of two vectors; assumes both vectors have
+ * three entries.
+ * @param {module:twgl/v3.Vec3} a Operand vector.
+ * @param {module:twgl/v3.Vec3} b Operand vector.
+ * @return {number} dot product
+ * @memberOf module:twgl/v3
+ */
+function dot(a, b) {
+ return (a[0] * b[0]) + (a[1] * b[1]) + (a[2] * b[2]);
+}
+
+/**
+ * Computes the length of vector
+ * @param {module:twgl/v3.Vec3} v vector.
+ * @return {number} length of vector.
+ * @memberOf module:twgl/v3
+ */
+function length$1(v) {
+ return Math.sqrt(v[0] * v[0] + v[1] * v[1] + v[2] * v[2]);
+}
+
+/**
+ * Computes the square of the length of vector
+ * @param {module:twgl/v3.Vec3} v vector.
+ * @return {number} square of the length of vector.
+ * @memberOf module:twgl/v3
+ */
+function lengthSq(v) {
+ return v[0] * v[0] + v[1] * v[1] + v[2] * v[2];
+}
+
+/**
+ * Computes the distance between 2 points
+ * @param {module:twgl/v3.Vec3} a vector.
+ * @param {module:twgl/v3.Vec3} b vector.
+ * @return {number} distance between a and b
+ * @memberOf module:twgl/v3
+ */
+function distance(a, b) {
+ const dx = a[0] - b[0];
+ const dy = a[1] - b[1];
+ const dz = a[2] - b[2];
+ return Math.sqrt(dx * dx + dy * dy + dz * dz);
+}
+
+/**
+ * Computes the square of the distance between 2 points
+ * @param {module:twgl/v3.Vec3} a vector.
+ * @param {module:twgl/v3.Vec3} b vector.
+ * @return {number} square of the distance between a and b
+ * @memberOf module:twgl/v3
+ */
+function distanceSq(a, b) {
+ const dx = a[0] - b[0];
+ const dy = a[1] - b[1];
+ const dz = a[2] - b[2];
+ return dx * dx + dy * dy + dz * dz;
+}
+
+/**
+ * Divides a vector by its Euclidean length and returns the quotient.
+ * @param {module:twgl/v3.Vec3} a The vector.
+ * @param {module:twgl/v3.Vec3} [dst] vector to hold result. If not new one is created.
+ * @return {module:twgl/v3.Vec3} The normalized vector.
+ * @memberOf module:twgl/v3
+ */
+function normalize(a, dst) {
+ dst = dst || new VecType(3);
+
+ const lenSq = a[0] * a[0] + a[1] * a[1] + a[2] * a[2];
+ const len = Math.sqrt(lenSq);
+ if (len > 0.00001) {
+ dst[0] = a[0] / len;
+ dst[1] = a[1] / len;
+ dst[2] = a[2] / len;
+ } else {
+ dst[0] = 0;
+ dst[1] = 0;
+ dst[2] = 0;
+ }
+
+ return dst;
+}
+
+/**
+ * Negates a vector.
+ * @param {module:twgl/v3.Vec3} v The vector.
+ * @param {module:twgl/v3.Vec3} [dst] vector to hold result. If not new one is created.
+ * @return {module:twgl/v3.Vec3} -v.
+ * @memberOf module:twgl/v3
+ */
+function negate$1(v, dst) {
+ dst = dst || new VecType(3);
+
+ dst[0] = -v[0];
+ dst[1] = -v[1];
+ dst[2] = -v[2];
+
+ return dst;
+}
+
+/**
+ * Copies a vector.
+ * @param {module:twgl/v3.Vec3} v The vector.
+ * @param {module:twgl/v3.Vec3} [dst] vector to hold result. If not new one is created.
+ * @return {module:twgl/v3.Vec3} A copy of v.
+ * @memberOf module:twgl/v3
+ */
+function copy$1(v, dst) {
+ dst = dst || new VecType(3);
+
+ dst[0] = v[0];
+ dst[1] = v[1];
+ dst[2] = v[2];
+
+ return dst;
+}
+
+/**
+ * Multiplies a vector by another vector (component-wise); assumes a and
+ * b have the same length.
+ * @param {module:twgl/v3.Vec3} a Operand vector.
+ * @param {module:twgl/v3.Vec3} b Operand vector.
+ * @param {module:twgl/v3.Vec3} [dst] vector to hold result. If not new one is created.
+ * @return {module:twgl/v3.Vec3} The vector of products of entries of a and
+ * b.
+ * @memberOf module:twgl/v3
+ */
+function multiply$1(a, b, dst) {
+ dst = dst || new VecType(3);
+
+ dst[0] = a[0] * b[0];
+ dst[1] = a[1] * b[1];
+ dst[2] = a[2] * b[2];
+
+ return dst;
+}
+
+/**
+ * Divides a vector by another vector (component-wise); assumes a and
+ * b have the same length.
+ * @param {module:twgl/v3.Vec3} a Operand vector.
+ * @param {module:twgl/v3.Vec3} b Operand vector.
+ * @param {module:twgl/v3.Vec3} [dst] vector to hold result. If not new one is created.
+ * @return {module:twgl/v3.Vec3} The vector of quotients of entries of a and
+ * b.
+ * @memberOf module:twgl/v3
+ */
+function divide(a, b, dst) {
+ dst = dst || new VecType(3);
+
+ dst[0] = a[0] / b[0];
+ dst[1] = a[1] / b[1];
+ dst[2] = a[2] / b[2];
+
+ return dst;
+}
+
+var v3 = /*#__PURE__*/Object.freeze({
+ __proto__: null,
+ add: add,
+ copy: copy$1,
+ create: create$1,
+ cross: cross,
+ distance: distance,
+ distanceSq: distanceSq,
+ divide: divide,
+ divScalar: divScalar,
+ dot: dot,
+ lerp: lerp,
+ lerpV: lerpV,
+ length: length$1,
+ lengthSq: lengthSq,
+ max: max,
+ min: min,
+ mulScalar: mulScalar,
+ multiply: multiply$1,
+ negate: negate$1,
+ normalize: normalize,
+ setDefaultType: setDefaultType$1,
+ subtract: subtract
+});
+
+/*
+ * Copyright 2019 Gregg Tavares
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+/**
+ * 4x4 Matrix math math functions.
+ *
+ * Almost all functions take an optional `dst` argument. If it is not passed in the
+ * functions will create a new matrix. In other words you can do this
+ *
+ * const mat = m4.translation([1, 2, 3]); // Creates a new translation matrix
+ *
+ * or
+ *
+ * const mat = m4.create();
+ * m4.translation([1, 2, 3], mat); // Puts translation matrix in mat.
+ *
+ * The first style is often easier but depending on where it's used it generates garbage where
+ * as there is almost never allocation with the second style.
+ *
+ * It is always save to pass any matrix as the destination. So for example
+ *
+ * const mat = m4.identity();
+ * const trans = m4.translation([1, 2, 3]);
+ * m4.multiply(mat, trans, mat); // Multiplies mat * trans and puts result in mat.
+ *
+ * @module twgl/m4
+ */
+let MatType = Float32Array;
+
+/**
+ * A JavaScript array with 16 values or a Float32Array with 16 values.
+ * When created by the library will create the default type which is `Float32Array`
+ * but can be set by calling {@link module:twgl/m4.setDefaultType}.
+ * @typedef {(number[]|Float32Array)} Mat4
+ * @memberOf module:twgl/m4
+ */
+
+/**
+ * Sets the type this library creates for a Mat4
+ * @param {constructor} ctor the constructor for the type. Either `Float32Array` or `Array`
+ * @return {constructor} previous constructor for Mat4
+ * @memberOf module:twgl/m4
+ */
+function setDefaultType(ctor) {
+ const oldType = MatType;
+ MatType = ctor;
+ return oldType;
+}
+
+/**
+ * Negates a matrix.
+ * @param {module:twgl/m4.Mat4} m The matrix.
+ * @param {module:twgl/m4.Mat4} [dst] matrix to hold result. If not passed a new one is created.
+ * @return {module:twgl/m4.Mat4} -m.
+ * @memberOf module:twgl/m4
+ */
+function negate(m, dst) {
+ dst = dst || new MatType(16);
+
+ dst[ 0] = -m[ 0];
+ dst[ 1] = -m[ 1];
+ dst[ 2] = -m[ 2];
+ dst[ 3] = -m[ 3];
+ dst[ 4] = -m[ 4];
+ dst[ 5] = -m[ 5];
+ dst[ 6] = -m[ 6];
+ dst[ 7] = -m[ 7];
+ dst[ 8] = -m[ 8];
+ dst[ 9] = -m[ 9];
+ dst[10] = -m[10];
+ dst[11] = -m[11];
+ dst[12] = -m[12];
+ dst[13] = -m[13];
+ dst[14] = -m[14];
+ dst[15] = -m[15];
+
+ return dst;
+}
+
+/**
+ * Creates a matrix.
+ * @return {module:twgl/m4.Mat4} A new matrix.
+ * @memberOf module:twgl/m4
+ */
+function create() {
+ return new MatType(16).fill(0);
+}
+
+/**
+ * Copies a matrix.
+ * @param {module:twgl/m4.Mat4} m The matrix.
+ * @param {module:twgl/m4.Mat4} [dst] The matrix. If not passed a new one is created.
+ * @return {module:twgl/m4.Mat4} A copy of m.
+ * @memberOf module:twgl/m4
+ */
+function copy(m, dst) {
+ dst = dst || new MatType(16);
+
+ dst[ 0] = m[ 0];
+ dst[ 1] = m[ 1];
+ dst[ 2] = m[ 2];
+ dst[ 3] = m[ 3];
+ dst[ 4] = m[ 4];
+ dst[ 5] = m[ 5];
+ dst[ 6] = m[ 6];
+ dst[ 7] = m[ 7];
+ dst[ 8] = m[ 8];
+ dst[ 9] = m[ 9];
+ dst[10] = m[10];
+ dst[11] = m[11];
+ dst[12] = m[12];
+ dst[13] = m[13];
+ dst[14] = m[14];
+ dst[15] = m[15];
+
+ return dst;
+}
+
+/**
+ * Creates an n-by-n identity matrix.
+ *
+ * @param {module:twgl/m4.Mat4} [dst] matrix to hold result. If not passed a new one is created.
+ * @return {module:twgl/m4.Mat4} An n-by-n identity matrix.
+ * @memberOf module:twgl/m4
+ */
+function identity(dst) {
+ dst = dst || new MatType(16);
+
+ dst[ 0] = 1;
+ dst[ 1] = 0;
+ dst[ 2] = 0;
+ dst[ 3] = 0;
+ dst[ 4] = 0;
+ dst[ 5] = 1;
+ dst[ 6] = 0;
+ dst[ 7] = 0;
+ dst[ 8] = 0;
+ dst[ 9] = 0;
+ dst[10] = 1;
+ dst[11] = 0;
+ dst[12] = 0;
+ dst[13] = 0;
+ dst[14] = 0;
+ dst[15] = 1;
+
+ return dst;
+}
+
+/**
+ * Takes the transpose of a matrix.
+ * @param {module:twgl/m4.Mat4} m The matrix.
+ * @param {module:twgl/m4.Mat4} [dst] matrix to hold result. If not passed a new one is created.
+ * @return {module:twgl/m4.Mat4} The transpose of m.
+ * @memberOf module:twgl/m4
+ */
+ function transpose(m, dst) {
+ dst = dst || new MatType(16);
+ if (dst === m) {
+ let t;
+
+ t = m[1];
+ m[1] = m[4];
+ m[4] = t;
+
+ t = m[2];
+ m[2] = m[8];
+ m[8] = t;
+
+ t = m[3];
+ m[3] = m[12];
+ m[12] = t;
+
+ t = m[6];
+ m[6] = m[9];
+ m[9] = t;
+
+ t = m[7];
+ m[7] = m[13];
+ m[13] = t;
+
+ t = m[11];
+ m[11] = m[14];
+ m[14] = t;
+ return dst;
+ }
+
+ const m00 = m[0 * 4 + 0];
+ const m01 = m[0 * 4 + 1];
+ const m02 = m[0 * 4 + 2];
+ const m03 = m[0 * 4 + 3];
+ const m10 = m[1 * 4 + 0];
+ const m11 = m[1 * 4 + 1];
+ const m12 = m[1 * 4 + 2];
+ const m13 = m[1 * 4 + 3];
+ const m20 = m[2 * 4 + 0];
+ const m21 = m[2 * 4 + 1];
+ const m22 = m[2 * 4 + 2];
+ const m23 = m[2 * 4 + 3];
+ const m30 = m[3 * 4 + 0];
+ const m31 = m[3 * 4 + 1];
+ const m32 = m[3 * 4 + 2];
+ const m33 = m[3 * 4 + 3];
+
+ dst[ 0] = m00;
+ dst[ 1] = m10;
+ dst[ 2] = m20;
+ dst[ 3] = m30;
+ dst[ 4] = m01;
+ dst[ 5] = m11;
+ dst[ 6] = m21;
+ dst[ 7] = m31;
+ dst[ 8] = m02;
+ dst[ 9] = m12;
+ dst[10] = m22;
+ dst[11] = m32;
+ dst[12] = m03;
+ dst[13] = m13;
+ dst[14] = m23;
+ dst[15] = m33;
+
+ return dst;
+}
+
+/**
+ * Computes the inverse of a 4-by-4 matrix.
+ * @param {module:twgl/m4.Mat4} m The matrix.
+ * @param {module:twgl/m4.Mat4} [dst] matrix to hold result. If not passed a new one is created.
+ * @return {module:twgl/m4.Mat4} The inverse of m.
+ * @memberOf module:twgl/m4
+ */
+function inverse(m, dst) {
+ dst = dst || new MatType(16);
+
+ const m00 = m[0 * 4 + 0];
+ const m01 = m[0 * 4 + 1];
+ const m02 = m[0 * 4 + 2];
+ const m03 = m[0 * 4 + 3];
+ const m10 = m[1 * 4 + 0];
+ const m11 = m[1 * 4 + 1];
+ const m12 = m[1 * 4 + 2];
+ const m13 = m[1 * 4 + 3];
+ const m20 = m[2 * 4 + 0];
+ const m21 = m[2 * 4 + 1];
+ const m22 = m[2 * 4 + 2];
+ const m23 = m[2 * 4 + 3];
+ const m30 = m[3 * 4 + 0];
+ const m31 = m[3 * 4 + 1];
+ const m32 = m[3 * 4 + 2];
+ const m33 = m[3 * 4 + 3];
+ const tmp_0 = m22 * m33;
+ const tmp_1 = m32 * m23;
+ const tmp_2 = m12 * m33;
+ const tmp_3 = m32 * m13;
+ const tmp_4 = m12 * m23;
+ const tmp_5 = m22 * m13;
+ const tmp_6 = m02 * m33;
+ const tmp_7 = m32 * m03;
+ const tmp_8 = m02 * m23;
+ const tmp_9 = m22 * m03;
+ const tmp_10 = m02 * m13;
+ const tmp_11 = m12 * m03;
+ const tmp_12 = m20 * m31;
+ const tmp_13 = m30 * m21;
+ const tmp_14 = m10 * m31;
+ const tmp_15 = m30 * m11;
+ const tmp_16 = m10 * m21;
+ const tmp_17 = m20 * m11;
+ const tmp_18 = m00 * m31;
+ const tmp_19 = m30 * m01;
+ const tmp_20 = m00 * m21;
+ const tmp_21 = m20 * m01;
+ const tmp_22 = m00 * m11;
+ const tmp_23 = m10 * m01;
+
+ const t0 = (tmp_0 * m11 + tmp_3 * m21 + tmp_4 * m31) -
+ (tmp_1 * m11 + tmp_2 * m21 + tmp_5 * m31);
+ const t1 = (tmp_1 * m01 + tmp_6 * m21 + tmp_9 * m31) -
+ (tmp_0 * m01 + tmp_7 * m21 + tmp_8 * m31);
+ const t2 = (tmp_2 * m01 + tmp_7 * m11 + tmp_10 * m31) -
+ (tmp_3 * m01 + tmp_6 * m11 + tmp_11 * m31);
+ const t3 = (tmp_5 * m01 + tmp_8 * m11 + tmp_11 * m21) -
+ (tmp_4 * m01 + tmp_9 * m11 + tmp_10 * m21);
+
+ const d = 1.0 / (m00 * t0 + m10 * t1 + m20 * t2 + m30 * t3);
+
+ dst[ 0] = d * t0;
+ dst[ 1] = d * t1;
+ dst[ 2] = d * t2;
+ dst[ 3] = d * t3;
+ dst[ 4] = d * ((tmp_1 * m10 + tmp_2 * m20 + tmp_5 * m30) -
+ (tmp_0 * m10 + tmp_3 * m20 + tmp_4 * m30));
+ dst[ 5] = d * ((tmp_0 * m00 + tmp_7 * m20 + tmp_8 * m30) -
+ (tmp_1 * m00 + tmp_6 * m20 + tmp_9 * m30));
+ dst[ 6] = d * ((tmp_3 * m00 + tmp_6 * m10 + tmp_11 * m30) -
+ (tmp_2 * m00 + tmp_7 * m10 + tmp_10 * m30));
+ dst[ 7] = d * ((tmp_4 * m00 + tmp_9 * m10 + tmp_10 * m20) -
+ (tmp_5 * m00 + tmp_8 * m10 + tmp_11 * m20));
+ dst[ 8] = d * ((tmp_12 * m13 + tmp_15 * m23 + tmp_16 * m33) -
+ (tmp_13 * m13 + tmp_14 * m23 + tmp_17 * m33));
+ dst[ 9] = d * ((tmp_13 * m03 + tmp_18 * m23 + tmp_21 * m33) -
+ (tmp_12 * m03 + tmp_19 * m23 + tmp_20 * m33));
+ dst[10] = d * ((tmp_14 * m03 + tmp_19 * m13 + tmp_22 * m33) -
+ (tmp_15 * m03 + tmp_18 * m13 + tmp_23 * m33));
+ dst[11] = d * ((tmp_17 * m03 + tmp_20 * m13 + tmp_23 * m23) -
+ (tmp_16 * m03 + tmp_21 * m13 + tmp_22 * m23));
+ dst[12] = d * ((tmp_14 * m22 + tmp_17 * m32 + tmp_13 * m12) -
+ (tmp_16 * m32 + tmp_12 * m12 + tmp_15 * m22));
+ dst[13] = d * ((tmp_20 * m32 + tmp_12 * m02 + tmp_19 * m22) -
+ (tmp_18 * m22 + tmp_21 * m32 + tmp_13 * m02));
+ dst[14] = d * ((tmp_18 * m12 + tmp_23 * m32 + tmp_15 * m02) -
+ (tmp_22 * m32 + tmp_14 * m02 + tmp_19 * m12));
+ dst[15] = d * ((tmp_22 * m22 + tmp_16 * m02 + tmp_21 * m12) -
+ (tmp_20 * m12 + tmp_23 * m22 + tmp_17 * m02));
+
+ return dst;
+}
+
+/**
+ * Multiplies two 4-by-4 matrices with a on the left and b on the right
+ * @param {module:twgl/m4.Mat4} a The matrix on the left.
+ * @param {module:twgl/m4.Mat4} b The matrix on the right.
+ * @param {module:twgl/m4.Mat4} [dst] matrix to hold result. If not passed a new one is created.
+ * @return {module:twgl/m4.Mat4} The matrix product of a and b.
+ * @memberOf module:twgl/m4
+ */
+function multiply(a, b, dst) {
+ dst = dst || new MatType(16);
+
+ const a00 = a[0];
+ const a01 = a[1];
+ const a02 = a[2];
+ const a03 = a[3];
+ const a10 = a[ 4 + 0];
+ const a11 = a[ 4 + 1];
+ const a12 = a[ 4 + 2];
+ const a13 = a[ 4 + 3];
+ const a20 = a[ 8 + 0];
+ const a21 = a[ 8 + 1];
+ const a22 = a[ 8 + 2];
+ const a23 = a[ 8 + 3];
+ const a30 = a[12 + 0];
+ const a31 = a[12 + 1];
+ const a32 = a[12 + 2];
+ const a33 = a[12 + 3];
+ const b00 = b[0];
+ const b01 = b[1];
+ const b02 = b[2];
+ const b03 = b[3];
+ const b10 = b[ 4 + 0];
+ const b11 = b[ 4 + 1];
+ const b12 = b[ 4 + 2];
+ const b13 = b[ 4 + 3];
+ const b20 = b[ 8 + 0];
+ const b21 = b[ 8 + 1];
+ const b22 = b[ 8 + 2];
+ const b23 = b[ 8 + 3];
+ const b30 = b[12 + 0];
+ const b31 = b[12 + 1];
+ const b32 = b[12 + 2];
+ const b33 = b[12 + 3];
+
+ dst[ 0] = a00 * b00 + a10 * b01 + a20 * b02 + a30 * b03;
+ dst[ 1] = a01 * b00 + a11 * b01 + a21 * b02 + a31 * b03;
+ dst[ 2] = a02 * b00 + a12 * b01 + a22 * b02 + a32 * b03;
+ dst[ 3] = a03 * b00 + a13 * b01 + a23 * b02 + a33 * b03;
+ dst[ 4] = a00 * b10 + a10 * b11 + a20 * b12 + a30 * b13;
+ dst[ 5] = a01 * b10 + a11 * b11 + a21 * b12 + a31 * b13;
+ dst[ 6] = a02 * b10 + a12 * b11 + a22 * b12 + a32 * b13;
+ dst[ 7] = a03 * b10 + a13 * b11 + a23 * b12 + a33 * b13;
+ dst[ 8] = a00 * b20 + a10 * b21 + a20 * b22 + a30 * b23;
+ dst[ 9] = a01 * b20 + a11 * b21 + a21 * b22 + a31 * b23;
+ dst[10] = a02 * b20 + a12 * b21 + a22 * b22 + a32 * b23;
+ dst[11] = a03 * b20 + a13 * b21 + a23 * b22 + a33 * b23;
+ dst[12] = a00 * b30 + a10 * b31 + a20 * b32 + a30 * b33;
+ dst[13] = a01 * b30 + a11 * b31 + a21 * b32 + a31 * b33;
+ dst[14] = a02 * b30 + a12 * b31 + a22 * b32 + a32 * b33;
+ dst[15] = a03 * b30 + a13 * b31 + a23 * b32 + a33 * b33;
+
+ return dst;
+}
+
+/**
+ * Sets the translation component of a 4-by-4 matrix to the given
+ * vector.
+ * @param {module:twgl/m4.Mat4} a The matrix.
+ * @param {module:twgl/v3.Vec3} v The vector.
+ * @param {module:twgl/m4.Mat4} [dst] matrix to hold result. If not passed a new one is created.
+ * @return {module:twgl/m4.Mat4} The matrix with translation set.
+ * @memberOf module:twgl/m4
+ */
+function setTranslation(a, v, dst) {
+ dst = dst || identity();
+ if (a !== dst) {
+ dst[ 0] = a[ 0];
+ dst[ 1] = a[ 1];
+ dst[ 2] = a[ 2];
+ dst[ 3] = a[ 3];
+ dst[ 4] = a[ 4];
+ dst[ 5] = a[ 5];
+ dst[ 6] = a[ 6];
+ dst[ 7] = a[ 7];
+ dst[ 8] = a[ 8];
+ dst[ 9] = a[ 9];
+ dst[10] = a[10];
+ dst[11] = a[11];
+ }
+ dst[12] = v[0];
+ dst[13] = v[1];
+ dst[14] = v[2];
+ dst[15] = 1;
+ return dst;
+}
+
+/**
+ * Returns the translation component of a 4-by-4 matrix as a vector with 3
+ * entries.
+ * @param {module:twgl/m4.Mat4} m The matrix.
+ * @param {module:twgl/v3.Vec3} [dst] vector to hold result. If not passed a new one is created.
+ * @return {module:twgl/v3.Vec3} The translation component of m.
+ * @memberOf module:twgl/m4
+ */
+function getTranslation(m, dst) {
+ dst = dst || create$1();
+ dst[0] = m[12];
+ dst[1] = m[13];
+ dst[2] = m[14];
+ return dst;
+}
+
+/**
+ * Returns an axis of a 4x4 matrix as a vector with 3 entries
+ * @param {module:twgl/m4.Mat4} m The matrix.
+ * @param {number} axis The axis 0 = x, 1 = y, 2 = z;
+ * @return {module:twgl/v3.Vec3} [dst] vector.
+ * @return {module:twgl/v3.Vec3} The axis component of m.
+ * @memberOf module:twgl/m4
+ */
+function getAxis(m, axis, dst) {
+ dst = dst || create$1();
+ const off = axis * 4;
+ dst[0] = m[off + 0];
+ dst[1] = m[off + 1];
+ dst[2] = m[off + 2];
+ return dst;
+}
+
+/**
+ * Sets an axis of a 4x4 matrix as a vector with 3 entries
+ * @param {module:twgl/m4.Mat4} m The matrix.
+ * @param {module:twgl/v3.Vec3} v the axis vector
+ * @param {number} axis The axis 0 = x, 1 = y, 2 = z;
+ * @param {module:twgl/m4.Mat4} [dst] The matrix to set. If not passed a new one is created.
+ * @return {module:twgl/m4.Mat4} The matrix with axis set.
+ * @memberOf module:twgl/m4
+ */
+function setAxis(a, v, axis, dst) {
+ if (dst !== a) {
+ dst = copy(a, dst);
+ }
+ const off = axis * 4;
+ dst[off + 0] = v[0];
+ dst[off + 1] = v[1];
+ dst[off + 2] = v[2];
+ return dst;
+}
+
+/**
+ * Computes a 4-by-4 perspective transformation matrix given the angular height
+ * of the frustum, the aspect ratio, and the near and far clipping planes. The
+ * arguments define a frustum extending in the negative z direction. The given
+ * angle is the vertical angle of the frustum, and the horizontal angle is
+ * determined to produce the given aspect ratio. The arguments near and far are
+ * the distances to the near and far clipping planes. Note that near and far
+ * are not z coordinates, but rather they are distances along the negative
+ * z-axis. The matrix generated sends the viewing frustum to the unit box.
+ * We assume a unit box extending from -1 to 1 in the x and y dimensions and
+ * from 0 to 1 in the z dimension.
+ * @param {number} fieldOfViewYInRadians The camera angle from top to bottom (in radians).
+ * @param {number} aspect The aspect ratio width / height.
+ * @param {number} zNear The depth (negative z coordinate)
+ * of the near clipping plane.
+ * @param {number} zFar The depth (negative z coordinate)
+ * of the far clipping plane.
+ * @param {module:twgl/m4.Mat4} [dst] matrix to hold result. If not passed a new one is created.
+ * @return {module:twgl/m4.Mat4} The perspective matrix.
+ * @memberOf module:twgl/m4
+ */
+function perspective(fieldOfViewYInRadians, aspect, zNear, zFar, dst) {
+ dst = dst || new MatType(16);
+
+ const f = Math.tan(Math.PI * 0.5 - 0.5 * fieldOfViewYInRadians);
+ const rangeInv = 1.0 / (zNear - zFar);
+
+ dst[0] = f / aspect;
+ dst[1] = 0;
+ dst[2] = 0;
+ dst[3] = 0;
+
+ dst[4] = 0;
+ dst[5] = f;
+ dst[6] = 0;
+ dst[7] = 0;
+
+ dst[8] = 0;
+ dst[9] = 0;
+ dst[10] = (zNear + zFar) * rangeInv;
+ dst[11] = -1;
+
+ dst[12] = 0;
+ dst[13] = 0;
+ dst[14] = zNear * zFar * rangeInv * 2;
+ dst[15] = 0;
+
+ return dst;
+}
+
+/**
+ * Computes a 4-by-4 orthogonal transformation matrix given the left, right,
+ * bottom, and top dimensions of the near clipping plane as well as the
+ * near and far clipping plane distances.
+ * @param {number} left Left side of the near clipping plane viewport.
+ * @param {number} right Right side of the near clipping plane viewport.
+ * @param {number} bottom Bottom of the near clipping plane viewport.
+ * @param {number} top Top of the near clipping plane viewport.
+ * @param {number} near The depth (negative z coordinate)
+ * of the near clipping plane.
+ * @param {number} far The depth (negative z coordinate)
+ * of the far clipping plane.
+ * @param {module:twgl/m4.Mat4} [dst] Output matrix. If not passed a new one is created.
+ * @return {module:twgl/m4.Mat4} The perspective matrix.
+ * @memberOf module:twgl/m4
+ */
+function ortho(left, right, bottom, top, near, far, dst) {
+ dst = dst || new MatType(16);
+
+ dst[0] = 2 / (right - left);
+ dst[1] = 0;
+ dst[2] = 0;
+ dst[3] = 0;
+
+ dst[4] = 0;
+ dst[5] = 2 / (top - bottom);
+ dst[6] = 0;
+ dst[7] = 0;
+
+ dst[8] = 0;
+ dst[9] = 0;
+ dst[10] = 2 / (near - far);
+ dst[11] = 0;
+
+ dst[12] = (right + left) / (left - right);
+ dst[13] = (top + bottom) / (bottom - top);
+ dst[14] = (far + near) / (near - far);
+ dst[15] = 1;
+
+ return dst;
+}
+
+/**
+ * Computes a 4-by-4 perspective transformation matrix given the left, right,
+ * top, bottom, near and far clipping planes. The arguments define a frustum
+ * extending in the negative z direction. The arguments near and far are the
+ * distances to the near and far clipping planes. Note that near and far are not
+ * z coordinates, but rather they are distances along the negative z-axis. The
+ * matrix generated sends the viewing frustum to the unit box. We assume a unit
+ * box extending from -1 to 1 in the x and y dimensions and from 0 to 1 in the z
+ * dimension.
+ * @param {number} left The x coordinate of the left plane of the box.
+ * @param {number} right The x coordinate of the right plane of the box.
+ * @param {number} bottom The y coordinate of the bottom plane of the box.
+ * @param {number} top The y coordinate of the right plane of the box.
+ * @param {number} near The negative z coordinate of the near plane of the box.
+ * @param {number} far The negative z coordinate of the far plane of the box.
+ * @param {module:twgl/m4.Mat4} [dst] Output matrix. If not passed a new one is created.
+ * @return {module:twgl/m4.Mat4} The perspective projection matrix.
+ * @memberOf module:twgl/m4
+ */
+function frustum(left, right, bottom, top, near, far, dst) {
+ dst = dst || new MatType(16);
+
+ const dx = (right - left);
+ const dy = (top - bottom);
+ const dz = (near - far);
+
+ dst[ 0] = 2 * near / dx;
+ dst[ 1] = 0;
+ dst[ 2] = 0;
+ dst[ 3] = 0;
+ dst[ 4] = 0;
+ dst[ 5] = 2 * near / dy;
+ dst[ 6] = 0;
+ dst[ 7] = 0;
+ dst[ 8] = (left + right) / dx;
+ dst[ 9] = (top + bottom) / dy;
+ dst[10] = far / dz;
+ dst[11] = -1;
+ dst[12] = 0;
+ dst[13] = 0;
+ dst[14] = near * far / dz;
+ dst[15] = 0;
+
+ return dst;
+}
+
+let xAxis;
+let yAxis;
+let zAxis;
+
+/**
+ * Computes a 4-by-4 look-at transformation.
+ *
+ * This is a matrix which positions the camera itself. If you want
+ * a view matrix (a matrix which moves things in front of the camera)
+ * take the inverse of this.
+ *
+ * @param {module:twgl/v3.Vec3} eye The position of the eye.
+ * @param {module:twgl/v3.Vec3} target The position meant to be viewed.
+ * @param {module:twgl/v3.Vec3} up A vector pointing up.
+ * @param {module:twgl/m4.Mat4} [dst] matrix to hold result. If not passed a new one is created.
+ * @return {module:twgl/m4.Mat4} The look-at matrix.
+ * @memberOf module:twgl/m4
+ */
+function lookAt(eye, target, up, dst) {
+ dst = dst || new MatType(16);
+
+ xAxis = xAxis || create$1();
+ yAxis = yAxis || create$1();
+ zAxis = zAxis || create$1();
+
+ normalize(
+ subtract(eye, target, zAxis), zAxis);
+ normalize(cross(up, zAxis, xAxis), xAxis);
+ normalize(cross(zAxis, xAxis, yAxis), yAxis);
+
+ dst[ 0] = xAxis[0];
+ dst[ 1] = xAxis[1];
+ dst[ 2] = xAxis[2];
+ dst[ 3] = 0;
+ dst[ 4] = yAxis[0];
+ dst[ 5] = yAxis[1];
+ dst[ 6] = yAxis[2];
+ dst[ 7] = 0;
+ dst[ 8] = zAxis[0];
+ dst[ 9] = zAxis[1];
+ dst[10] = zAxis[2];
+ dst[11] = 0;
+ dst[12] = eye[0];
+ dst[13] = eye[1];
+ dst[14] = eye[2];
+ dst[15] = 1;
+
+ return dst;
+}
+
+/**
+ * Creates a 4-by-4 matrix which translates by the given vector v.
+ * @param {module:twgl/v3.Vec3} v The vector by
+ * which to translate.
+ * @param {module:twgl/m4.Mat4} [dst] matrix to hold result. If not passed a new one is created.
+ * @return {module:twgl/m4.Mat4} The translation matrix.
+ * @memberOf module:twgl/m4
+ */
+function translation(v, dst) {
+ dst = dst || new MatType(16);
+
+ dst[ 0] = 1;
+ dst[ 1] = 0;
+ dst[ 2] = 0;
+ dst[ 3] = 0;
+ dst[ 4] = 0;
+ dst[ 5] = 1;
+ dst[ 6] = 0;
+ dst[ 7] = 0;
+ dst[ 8] = 0;
+ dst[ 9] = 0;
+ dst[10] = 1;
+ dst[11] = 0;
+ dst[12] = v[0];
+ dst[13] = v[1];
+ dst[14] = v[2];
+ dst[15] = 1;
+ return dst;
+}
+
+/**
+ * Translates the given 4-by-4 matrix by the given vector v.
+ * @param {module:twgl/m4.Mat4} m The matrix.
+ * @param {module:twgl/v3.Vec3} v The vector by
+ * which to translate.
+ * @param {module:twgl/m4.Mat4} [dst] matrix to hold result. If not passed a new one is created.
+ * @return {module:twgl/m4.Mat4} The translated matrix.
+ * @memberOf module:twgl/m4
+ */
+function translate(m, v, dst) {
+ dst = dst || new MatType(16);
+
+ const v0 = v[0];
+ const v1 = v[1];
+ const v2 = v[2];
+ const m00 = m[0];
+ const m01 = m[1];
+ const m02 = m[2];
+ const m03 = m[3];
+ const m10 = m[1 * 4 + 0];
+ const m11 = m[1 * 4 + 1];
+ const m12 = m[1 * 4 + 2];
+ const m13 = m[1 * 4 + 3];
+ const m20 = m[2 * 4 + 0];
+ const m21 = m[2 * 4 + 1];
+ const m22 = m[2 * 4 + 2];
+ const m23 = m[2 * 4 + 3];
+ const m30 = m[3 * 4 + 0];
+ const m31 = m[3 * 4 + 1];
+ const m32 = m[3 * 4 + 2];
+ const m33 = m[3 * 4 + 3];
+
+ if (m !== dst) {
+ dst[ 0] = m00;
+ dst[ 1] = m01;
+ dst[ 2] = m02;
+ dst[ 3] = m03;
+ dst[ 4] = m10;
+ dst[ 5] = m11;
+ dst[ 6] = m12;
+ dst[ 7] = m13;
+ dst[ 8] = m20;
+ dst[ 9] = m21;
+ dst[10] = m22;
+ dst[11] = m23;
+ }
+
+ dst[12] = m00 * v0 + m10 * v1 + m20 * v2 + m30;
+ dst[13] = m01 * v0 + m11 * v1 + m21 * v2 + m31;
+ dst[14] = m02 * v0 + m12 * v1 + m22 * v2 + m32;
+ dst[15] = m03 * v0 + m13 * v1 + m23 * v2 + m33;
+
+ return dst;
+}
+
+/**
+ * Creates a 4-by-4 matrix which rotates around the x-axis by the given angle.
+ * @param {number} angleInRadians The angle by which to rotate (in radians).
+ * @param {module:twgl/m4.Mat4} [dst] matrix to hold result. If not passed a new one is created.
+ * @return {module:twgl/m4.Mat4} The rotation matrix.
+ * @memberOf module:twgl/m4
+ */
+function rotationX(angleInRadians, dst) {
+ dst = dst || new MatType(16);
+
+ const c = Math.cos(angleInRadians);
+ const s = Math.sin(angleInRadians);
+
+ dst[ 0] = 1;
+ dst[ 1] = 0;
+ dst[ 2] = 0;
+ dst[ 3] = 0;
+ dst[ 4] = 0;
+ dst[ 5] = c;
+ dst[ 6] = s;
+ dst[ 7] = 0;
+ dst[ 8] = 0;
+ dst[ 9] = -s;
+ dst[10] = c;
+ dst[11] = 0;
+ dst[12] = 0;
+ dst[13] = 0;
+ dst[14] = 0;
+ dst[15] = 1;
+
+ return dst;
+}
+
+/**
+ * Rotates the given 4-by-4 matrix around the x-axis by the given
+ * angle.
+ * @param {module:twgl/m4.Mat4} m The matrix.
+ * @param {number} angleInRadians The angle by which to rotate (in radians).
+ * @param {module:twgl/m4.Mat4} [dst] matrix to hold result. If not passed a new one is created.
+ * @return {module:twgl/m4.Mat4} The rotated matrix.
+ * @memberOf module:twgl/m4
+ */
+function rotateX(m, angleInRadians, dst) {
+ dst = dst || new MatType(16);
+
+ const m10 = m[4];
+ const m11 = m[5];
+ const m12 = m[6];
+ const m13 = m[7];
+ const m20 = m[8];
+ const m21 = m[9];
+ const m22 = m[10];
+ const m23 = m[11];
+ const c = Math.cos(angleInRadians);
+ const s = Math.sin(angleInRadians);
+
+ dst[4] = c * m10 + s * m20;
+ dst[5] = c * m11 + s * m21;
+ dst[6] = c * m12 + s * m22;
+ dst[7] = c * m13 + s * m23;
+ dst[8] = c * m20 - s * m10;
+ dst[9] = c * m21 - s * m11;
+ dst[10] = c * m22 - s * m12;
+ dst[11] = c * m23 - s * m13;
+
+ if (m !== dst) {
+ dst[ 0] = m[ 0];
+ dst[ 1] = m[ 1];
+ dst[ 2] = m[ 2];
+ dst[ 3] = m[ 3];
+ dst[12] = m[12];
+ dst[13] = m[13];
+ dst[14] = m[14];
+ dst[15] = m[15];
+ }
+
+ return dst;
+}
+
+/**
+ * Creates a 4-by-4 matrix which rotates around the y-axis by the given angle.
+ * @param {number} angleInRadians The angle by which to rotate (in radians).
+ * @param {module:twgl/m4.Mat4} [dst] matrix to hold result. If not passed a new one is created.
+ * @return {module:twgl/m4.Mat4} The rotation matrix.
+ * @memberOf module:twgl/m4
+ */
+function rotationY(angleInRadians, dst) {
+ dst = dst || new MatType(16);
+
+ const c = Math.cos(angleInRadians);
+ const s = Math.sin(angleInRadians);
+
+ dst[ 0] = c;
+ dst[ 1] = 0;
+ dst[ 2] = -s;
+ dst[ 3] = 0;
+ dst[ 4] = 0;
+ dst[ 5] = 1;
+ dst[ 6] = 0;
+ dst[ 7] = 0;
+ dst[ 8] = s;
+ dst[ 9] = 0;
+ dst[10] = c;
+ dst[11] = 0;
+ dst[12] = 0;
+ dst[13] = 0;
+ dst[14] = 0;
+ dst[15] = 1;
+
+ return dst;
+}
+
+/**
+ * Rotates the given 4-by-4 matrix around the y-axis by the given
+ * angle.
+ * @param {module:twgl/m4.Mat4} m The matrix.
+ * @param {number} angleInRadians The angle by which to rotate (in radians).
+ * @param {module:twgl/m4.Mat4} [dst] matrix to hold result. If not passed a new one is created.
+ * @return {module:twgl/m4.Mat4} The rotated matrix.
+ * @memberOf module:twgl/m4
+ */
+function rotateY(m, angleInRadians, dst) {
+ dst = dst || new MatType(16);
+
+ const m00 = m[0 * 4 + 0];
+ const m01 = m[0 * 4 + 1];
+ const m02 = m[0 * 4 + 2];
+ const m03 = m[0 * 4 + 3];
+ const m20 = m[2 * 4 + 0];
+ const m21 = m[2 * 4 + 1];
+ const m22 = m[2 * 4 + 2];
+ const m23 = m[2 * 4 + 3];
+ const c = Math.cos(angleInRadians);
+ const s = Math.sin(angleInRadians);
+
+ dst[ 0] = c * m00 - s * m20;
+ dst[ 1] = c * m01 - s * m21;
+ dst[ 2] = c * m02 - s * m22;
+ dst[ 3] = c * m03 - s * m23;
+ dst[ 8] = c * m20 + s * m00;
+ dst[ 9] = c * m21 + s * m01;
+ dst[10] = c * m22 + s * m02;
+ dst[11] = c * m23 + s * m03;
+
+ if (m !== dst) {
+ dst[ 4] = m[ 4];
+ dst[ 5] = m[ 5];
+ dst[ 6] = m[ 6];
+ dst[ 7] = m[ 7];
+ dst[12] = m[12];
+ dst[13] = m[13];
+ dst[14] = m[14];
+ dst[15] = m[15];
+ }
+
+ return dst;
+}
+
+/**
+ * Creates a 4-by-4 matrix which rotates around the z-axis by the given angle.
+ * @param {number} angleInRadians The angle by which to rotate (in radians).
+ * @param {module:twgl/m4.Mat4} [dst] matrix to hold result. If not passed a new one is created.
+ * @return {module:twgl/m4.Mat4} The rotation matrix.
+ * @memberOf module:twgl/m4
+ */
+function rotationZ(angleInRadians, dst) {
+ dst = dst || new MatType(16);
+
+ const c = Math.cos(angleInRadians);
+ const s = Math.sin(angleInRadians);
+
+ dst[ 0] = c;
+ dst[ 1] = s;
+ dst[ 2] = 0;
+ dst[ 3] = 0;
+ dst[ 4] = -s;
+ dst[ 5] = c;
+ dst[ 6] = 0;
+ dst[ 7] = 0;
+ dst[ 8] = 0;
+ dst[ 9] = 0;
+ dst[10] = 1;
+ dst[11] = 0;
+ dst[12] = 0;
+ dst[13] = 0;
+ dst[14] = 0;
+ dst[15] = 1;
+
+ return dst;
+}
+
+/**
+ * Rotates the given 4-by-4 matrix around the z-axis by the given
+ * angle.
+ * @param {module:twgl/m4.Mat4} m The matrix.
+ * @param {number} angleInRadians The angle by which to rotate (in radians).
+ * @param {module:twgl/m4.Mat4} [dst] matrix to hold result. If not passed a new one is created.
+ * @return {module:twgl/m4.Mat4} The rotated matrix.
+ * @memberOf module:twgl/m4
+ */
+function rotateZ(m, angleInRadians, dst) {
+ dst = dst || new MatType(16);
+
+ const m00 = m[0 * 4 + 0];
+ const m01 = m[0 * 4 + 1];
+ const m02 = m[0 * 4 + 2];
+ const m03 = m[0 * 4 + 3];
+ const m10 = m[1 * 4 + 0];
+ const m11 = m[1 * 4 + 1];
+ const m12 = m[1 * 4 + 2];
+ const m13 = m[1 * 4 + 3];
+ const c = Math.cos(angleInRadians);
+ const s = Math.sin(angleInRadians);
+
+ dst[ 0] = c * m00 + s * m10;
+ dst[ 1] = c * m01 + s * m11;
+ dst[ 2] = c * m02 + s * m12;
+ dst[ 3] = c * m03 + s * m13;
+ dst[ 4] = c * m10 - s * m00;
+ dst[ 5] = c * m11 - s * m01;
+ dst[ 6] = c * m12 - s * m02;
+ dst[ 7] = c * m13 - s * m03;
+
+ if (m !== dst) {
+ dst[ 8] = m[ 8];
+ dst[ 9] = m[ 9];
+ dst[10] = m[10];
+ dst[11] = m[11];
+ dst[12] = m[12];
+ dst[13] = m[13];
+ dst[14] = m[14];
+ dst[15] = m[15];
+ }
+
+ return dst;
+}
+
+/**
+ * Creates a 4-by-4 matrix which rotates around the given axis by the given
+ * angle.
+ * @param {module:twgl/v3.Vec3} axis The axis
+ * about which to rotate.
+ * @param {number} angleInRadians The angle by which to rotate (in radians).
+ * @param {module:twgl/m4.Mat4} [dst] matrix to hold result. If not passed a new one is created.
+ * @return {module:twgl/m4.Mat4} A matrix which rotates angle radians
+ * around the axis.
+ * @memberOf module:twgl/m4
+ */
+function axisRotation(axis, angleInRadians, dst) {
+ dst = dst || new MatType(16);
+
+ let x = axis[0];
+ let y = axis[1];
+ let z = axis[2];
+ const n = Math.sqrt(x * x + y * y + z * z);
+ x /= n;
+ y /= n;
+ z /= n;
+ const xx = x * x;
+ const yy = y * y;
+ const zz = z * z;
+ const c = Math.cos(angleInRadians);
+ const s = Math.sin(angleInRadians);
+ const oneMinusCosine = 1 - c;
+
+ dst[ 0] = xx + (1 - xx) * c;
+ dst[ 1] = x * y * oneMinusCosine + z * s;
+ dst[ 2] = x * z * oneMinusCosine - y * s;
+ dst[ 3] = 0;
+ dst[ 4] = x * y * oneMinusCosine - z * s;
+ dst[ 5] = yy + (1 - yy) * c;
+ dst[ 6] = y * z * oneMinusCosine + x * s;
+ dst[ 7] = 0;
+ dst[ 8] = x * z * oneMinusCosine + y * s;
+ dst[ 9] = y * z * oneMinusCosine - x * s;
+ dst[10] = zz + (1 - zz) * c;
+ dst[11] = 0;
+ dst[12] = 0;
+ dst[13] = 0;
+ dst[14] = 0;
+ dst[15] = 1;
+
+ return dst;
+}
+
+/**
+ * Rotates the given 4-by-4 matrix around the given axis by the
+ * given angle.
+ * @param {module:twgl/m4.Mat4} m The matrix.
+ * @param {module:twgl/v3.Vec3} axis The axis
+ * about which to rotate.
+ * @param {number} angleInRadians The angle by which to rotate (in radians).
+ * @param {module:twgl/m4.Mat4} [dst] matrix to hold result. If not passed a new one is created.
+ * @return {module:twgl/m4.Mat4} The rotated matrix.
+ * @memberOf module:twgl/m4
+ */
+function axisRotate(m, axis, angleInRadians, dst) {
+ dst = dst || new MatType(16);
+
+ let x = axis[0];
+ let y = axis[1];
+ let z = axis[2];
+ const n = Math.sqrt(x * x + y * y + z * z);
+ x /= n;
+ y /= n;
+ z /= n;
+ const xx = x * x;
+ const yy = y * y;
+ const zz = z * z;
+ const c = Math.cos(angleInRadians);
+ const s = Math.sin(angleInRadians);
+ const oneMinusCosine = 1 - c;
+
+ const r00 = xx + (1 - xx) * c;
+ const r01 = x * y * oneMinusCosine + z * s;
+ const r02 = x * z * oneMinusCosine - y * s;
+ const r10 = x * y * oneMinusCosine - z * s;
+ const r11 = yy + (1 - yy) * c;
+ const r12 = y * z * oneMinusCosine + x * s;
+ const r20 = x * z * oneMinusCosine + y * s;
+ const r21 = y * z * oneMinusCosine - x * s;
+ const r22 = zz + (1 - zz) * c;
+
+ const m00 = m[0];
+ const m01 = m[1];
+ const m02 = m[2];
+ const m03 = m[3];
+ const m10 = m[4];
+ const m11 = m[5];
+ const m12 = m[6];
+ const m13 = m[7];
+ const m20 = m[8];
+ const m21 = m[9];
+ const m22 = m[10];
+ const m23 = m[11];
+
+ dst[ 0] = r00 * m00 + r01 * m10 + r02 * m20;
+ dst[ 1] = r00 * m01 + r01 * m11 + r02 * m21;
+ dst[ 2] = r00 * m02 + r01 * m12 + r02 * m22;
+ dst[ 3] = r00 * m03 + r01 * m13 + r02 * m23;
+ dst[ 4] = r10 * m00 + r11 * m10 + r12 * m20;
+ dst[ 5] = r10 * m01 + r11 * m11 + r12 * m21;
+ dst[ 6] = r10 * m02 + r11 * m12 + r12 * m22;
+ dst[ 7] = r10 * m03 + r11 * m13 + r12 * m23;
+ dst[ 8] = r20 * m00 + r21 * m10 + r22 * m20;
+ dst[ 9] = r20 * m01 + r21 * m11 + r22 * m21;
+ dst[10] = r20 * m02 + r21 * m12 + r22 * m22;
+ dst[11] = r20 * m03 + r21 * m13 + r22 * m23;
+
+ if (m !== dst) {
+ dst[12] = m[12];
+ dst[13] = m[13];
+ dst[14] = m[14];
+ dst[15] = m[15];
+ }
+
+ return dst;
+}
+
+/**
+ * Creates a 4-by-4 matrix which scales in each dimension by an amount given by
+ * the corresponding entry in the given vector; assumes the vector has three
+ * entries.
+ * @param {module:twgl/v3.Vec3} v A vector of
+ * three entries specifying the factor by which to scale in each dimension.
+ * @param {module:twgl/m4.Mat4} [dst] matrix to hold result. If not passed a new one is created.
+ * @return {module:twgl/m4.Mat4} The scaling matrix.
+ * @memberOf module:twgl/m4
+ */
+function scaling(v, dst) {
+ dst = dst || new MatType(16);
+
+ dst[ 0] = v[0];
+ dst[ 1] = 0;
+ dst[ 2] = 0;
+ dst[ 3] = 0;
+ dst[ 4] = 0;
+ dst[ 5] = v[1];
+ dst[ 6] = 0;
+ dst[ 7] = 0;
+ dst[ 8] = 0;
+ dst[ 9] = 0;
+ dst[10] = v[2];
+ dst[11] = 0;
+ dst[12] = 0;
+ dst[13] = 0;
+ dst[14] = 0;
+ dst[15] = 1;
+
+ return dst;
+}
+
+/**
+ * Scales the given 4-by-4 matrix in each dimension by an amount
+ * given by the corresponding entry in the given vector; assumes the vector has
+ * three entries.
+ * @param {module:twgl/m4.Mat4} m The matrix to be modified.
+ * @param {module:twgl/v3.Vec3} v A vector of three entries specifying the
+ * factor by which to scale in each dimension.
+ * @param {module:twgl/m4.Mat4} [dst] matrix to hold result. If not passed a new one is created.
+ * @return {module:twgl/m4.Mat4} The scaled matrix.
+ * @memberOf module:twgl/m4
+ */
+function scale(m, v, dst) {
+ dst = dst || new MatType(16);
+
+ const v0 = v[0];
+ const v1 = v[1];
+ const v2 = v[2];
+
+ dst[ 0] = v0 * m[0 * 4 + 0];
+ dst[ 1] = v0 * m[0 * 4 + 1];
+ dst[ 2] = v0 * m[0 * 4 + 2];
+ dst[ 3] = v0 * m[0 * 4 + 3];
+ dst[ 4] = v1 * m[1 * 4 + 0];
+ dst[ 5] = v1 * m[1 * 4 + 1];
+ dst[ 6] = v1 * m[1 * 4 + 2];
+ dst[ 7] = v1 * m[1 * 4 + 3];
+ dst[ 8] = v2 * m[2 * 4 + 0];
+ dst[ 9] = v2 * m[2 * 4 + 1];
+ dst[10] = v2 * m[2 * 4 + 2];
+ dst[11] = v2 * m[2 * 4 + 3];
+
+ if (m !== dst) {
+ dst[12] = m[12];
+ dst[13] = m[13];
+ dst[14] = m[14];
+ dst[15] = m[15];
+ }
+
+ return dst;
+}
+
+/**
+ * Takes a 4-by-4 matrix and a vector with 3 entries,
+ * interprets the vector as a point, transforms that point by the matrix, and
+ * returns the result as a vector with 3 entries.
+ * @param {module:twgl/m4.Mat4} m The matrix.
+ * @param {module:twgl/v3.Vec3} v The point.
+ * @param {module:twgl/v3.Vec3} [dst] optional vec3 to store result. If not passed a new one is created.
+ * @return {module:twgl/v3.Vec3} The transformed point.
+ * @memberOf module:twgl/m4
+ */
+function transformPoint(m, v, dst) {
+ dst = dst || create$1();
+ const v0 = v[0];
+ const v1 = v[1];
+ const v2 = v[2];
+ const d = v0 * m[0 * 4 + 3] + v1 * m[1 * 4 + 3] + v2 * m[2 * 4 + 3] + m[3 * 4 + 3];
+
+ dst[0] = (v0 * m[0 * 4 + 0] + v1 * m[1 * 4 + 0] + v2 * m[2 * 4 + 0] + m[3 * 4 + 0]) / d;
+ dst[1] = (v0 * m[0 * 4 + 1] + v1 * m[1 * 4 + 1] + v2 * m[2 * 4 + 1] + m[3 * 4 + 1]) / d;
+ dst[2] = (v0 * m[0 * 4 + 2] + v1 * m[1 * 4 + 2] + v2 * m[2 * 4 + 2] + m[3 * 4 + 2]) / d;
+
+ return dst;
+}
+
+/**
+ * Takes a 4-by-4 matrix and a vector with 3 entries, interprets the vector as a
+ * direction, transforms that direction by the matrix, and returns the result;
+ * assumes the transformation of 3-dimensional space represented by the matrix
+ * is parallel-preserving, i.e. any combination of rotation, scaling and
+ * translation, but not a perspective distortion. Returns a vector with 3
+ * entries.
+ * @param {module:twgl/m4.Mat4} m The matrix.
+ * @param {module:twgl/v3.Vec3} v The direction.
+ * @param {module:twgl/v3.Vec3} [dst] optional Vec3 to store result. If not passed a new one is created.
+ * @return {module:twgl/v3.Vec3} The transformed direction.
+ * @memberOf module:twgl/m4
+ */
+function transformDirection(m, v, dst) {
+ dst = dst || create$1();
+
+ const v0 = v[0];
+ const v1 = v[1];
+ const v2 = v[2];
+
+ dst[0] = v0 * m[0 * 4 + 0] + v1 * m[1 * 4 + 0] + v2 * m[2 * 4 + 0];
+ dst[1] = v0 * m[0 * 4 + 1] + v1 * m[1 * 4 + 1] + v2 * m[2 * 4 + 1];
+ dst[2] = v0 * m[0 * 4 + 2] + v1 * m[1 * 4 + 2] + v2 * m[2 * 4 + 2];
+
+ return dst;
+}
+
+/**
+ * Takes a 4-by-4 matrix m and a vector v with 3 entries, interprets the vector
+ * as a normal to a surface, and computes a vector which is normal upon
+ * transforming that surface by the matrix. The effect of this function is the
+ * same as transforming v (as a direction) by the inverse-transpose of m. This
+ * function assumes the transformation of 3-dimensional space represented by the
+ * matrix is parallel-preserving, i.e. any combination of rotation, scaling and
+ * translation, but not a perspective distortion. Returns a vector with 3
+ * entries.
+ * @param {module:twgl/m4.Mat4} m The matrix.
+ * @param {module:twgl/v3.Vec3} v The normal.
+ * @param {module:twgl/v3.Vec3} [dst] The direction. If not passed a new one is created.
+ * @return {module:twgl/v3.Vec3} The transformed normal.
+ * @memberOf module:twgl/m4
+ */
+function transformNormal$1(m, v, dst) {
+ dst = dst || create$1();
+ const mi = inverse(m);
+ const v0 = v[0];
+ const v1 = v[1];
+ const v2 = v[2];
+
+ dst[0] = v0 * mi[0 * 4 + 0] + v1 * mi[0 * 4 + 1] + v2 * mi[0 * 4 + 2];
+ dst[1] = v0 * mi[1 * 4 + 0] + v1 * mi[1 * 4 + 1] + v2 * mi[1 * 4 + 2];
+ dst[2] = v0 * mi[2 * 4 + 0] + v1 * mi[2 * 4 + 1] + v2 * mi[2 * 4 + 2];
+
+ return dst;
+}
+
+var m4 = /*#__PURE__*/Object.freeze({
+ __proto__: null,
+ axisRotate: axisRotate,
+ axisRotation: axisRotation,
+ copy: copy,
+ create: create,
+ frustum: frustum,
+ getAxis: getAxis,
+ getTranslation: getTranslation,
+ identity: identity,
+ inverse: inverse,
+ lookAt: lookAt,
+ multiply: multiply,
+ negate: negate,
+ ortho: ortho,
+ perspective: perspective,
+ rotateX: rotateX,
+ rotateY: rotateY,
+ rotateZ: rotateZ,
+ rotationX: rotationX,
+ rotationY: rotationY,
+ rotationZ: rotationZ,
+ scale: scale,
+ scaling: scaling,
+ setAxis: setAxis,
+ setDefaultType: setDefaultType,
+ setTranslation: setTranslation,
+ transformDirection: transformDirection,
+ transformNormal: transformNormal$1,
+ transformPoint: transformPoint,
+ translate: translate,
+ translation: translation,
+ transpose: transpose
+});
+
+/*
+ * Copyright 2019 Gregg Tavares
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+/* DataType */
+const BYTE$2 = 0x1400;
+const UNSIGNED_BYTE$3 = 0x1401;
+const SHORT$2 = 0x1402;
+const UNSIGNED_SHORT$3 = 0x1403;
+const INT$3 = 0x1404;
+const UNSIGNED_INT$3 = 0x1405;
+const FLOAT$3 = 0x1406;
+const UNSIGNED_SHORT_4_4_4_4$1 = 0x8033;
+const UNSIGNED_SHORT_5_5_5_1$1 = 0x8034;
+const UNSIGNED_SHORT_5_6_5$1 = 0x8363;
+const HALF_FLOAT$1 = 0x140B;
+const UNSIGNED_INT_2_10_10_10_REV$1 = 0x8368;
+const UNSIGNED_INT_10F_11F_11F_REV$1 = 0x8C3B;
+const UNSIGNED_INT_5_9_9_9_REV$1 = 0x8C3E;
+const FLOAT_32_UNSIGNED_INT_24_8_REV$1 = 0x8DAD;
+const UNSIGNED_INT_24_8$1 = 0x84FA;
+
+const glTypeToTypedArray = {};
+{
+ const tt = glTypeToTypedArray;
+ tt[BYTE$2] = Int8Array;
+ tt[UNSIGNED_BYTE$3] = Uint8Array;
+ tt[SHORT$2] = Int16Array;
+ tt[UNSIGNED_SHORT$3] = Uint16Array;
+ tt[INT$3] = Int32Array;
+ tt[UNSIGNED_INT$3] = Uint32Array;
+ tt[FLOAT$3] = Float32Array;
+ tt[UNSIGNED_SHORT_4_4_4_4$1] = Uint16Array;
+ tt[UNSIGNED_SHORT_5_5_5_1$1] = Uint16Array;
+ tt[UNSIGNED_SHORT_5_6_5$1] = Uint16Array;
+ tt[HALF_FLOAT$1] = Uint16Array;
+ tt[UNSIGNED_INT_2_10_10_10_REV$1] = Uint32Array;
+ tt[UNSIGNED_INT_10F_11F_11F_REV$1] = Uint32Array;
+ tt[UNSIGNED_INT_5_9_9_9_REV$1] = Uint32Array;
+ tt[FLOAT_32_UNSIGNED_INT_24_8_REV$1] = Uint32Array;
+ tt[UNSIGNED_INT_24_8$1] = Uint32Array;
+}
+
+/**
+ * Get the GL type for a typedArray
+ * @param {ArrayBufferView} typedArray a typedArray
+ * @return {number} the GL type for array. For example pass in an `Int8Array` and `gl.BYTE` will
+ * be returned. Pass in a `Uint32Array` and `gl.UNSIGNED_INT` will be returned
+ * @memberOf module:twgl/typedArray
+ */
+function getGLTypeForTypedArray(typedArray) {
+ if (typedArray instanceof Int8Array) { return BYTE$2; } // eslint-disable-line
+ if (typedArray instanceof Uint8Array) { return UNSIGNED_BYTE$3; } // eslint-disable-line
+ if (typedArray instanceof Uint8ClampedArray) { return UNSIGNED_BYTE$3; } // eslint-disable-line
+ if (typedArray instanceof Int16Array) { return SHORT$2; } // eslint-disable-line
+ if (typedArray instanceof Uint16Array) { return UNSIGNED_SHORT$3; } // eslint-disable-line
+ if (typedArray instanceof Int32Array) { return INT$3; } // eslint-disable-line
+ if (typedArray instanceof Uint32Array) { return UNSIGNED_INT$3; } // eslint-disable-line
+ if (typedArray instanceof Float32Array) { return FLOAT$3; } // eslint-disable-line
+ throw new Error('unsupported typed array type');
+}
+
+/**
+ * Get the GL type for a typedArray type
+ * @param {ArrayBufferView} typedArrayType a typedArray constructor
+ * @return {number} the GL type for type. For example pass in `Int8Array` and `gl.BYTE` will
+ * be returned. Pass in `Uint32Array` and `gl.UNSIGNED_INT` will be returned
+ * @memberOf module:twgl/typedArray
+ */
+function getGLTypeForTypedArrayType(typedArrayType) {
+ if (typedArrayType === Int8Array) { return BYTE$2; } // eslint-disable-line
+ if (typedArrayType === Uint8Array) { return UNSIGNED_BYTE$3; } // eslint-disable-line
+ if (typedArrayType === Uint8ClampedArray) { return UNSIGNED_BYTE$3; } // eslint-disable-line
+ if (typedArrayType === Int16Array) { return SHORT$2; } // eslint-disable-line
+ if (typedArrayType === Uint16Array) { return UNSIGNED_SHORT$3; } // eslint-disable-line
+ if (typedArrayType === Int32Array) { return INT$3; } // eslint-disable-line
+ if (typedArrayType === Uint32Array) { return UNSIGNED_INT$3; } // eslint-disable-line
+ if (typedArrayType === Float32Array) { return FLOAT$3; } // eslint-disable-line
+ throw new Error('unsupported typed array type');
+}
+
+/**
+ * Get the typed array constructor for a given GL type
+ * @param {number} type the GL type. (eg: `gl.UNSIGNED_INT`)
+ * @return {function} the constructor for a the corresponding typed array. (eg. `Uint32Array`).
+ * @memberOf module:twgl/typedArray
+ */
+function getTypedArrayTypeForGLType(type) {
+ const CTOR = glTypeToTypedArray[type];
+ if (!CTOR) {
+ throw new Error('unknown gl type');
+ }
+ return CTOR;
+}
+
+const isArrayBuffer$1 = typeof SharedArrayBuffer !== 'undefined'
+ ? function isArrayBufferOrSharedArrayBuffer(a) {
+ return a && a.buffer && (a.buffer instanceof ArrayBuffer || a.buffer instanceof SharedArrayBuffer);
+ }
+ : function isArrayBuffer(a) {
+ return a && a.buffer && a.buffer instanceof ArrayBuffer;
+ };
+
+var typedarrays = /*#__PURE__*/Object.freeze({
+ __proto__: null,
+ getGLTypeForTypedArray: getGLTypeForTypedArray,
+ getGLTypeForTypedArrayType: getGLTypeForTypedArrayType,
+ getTypedArrayTypeForGLType: getTypedArrayTypeForGLType,
+ isArrayBuffer: isArrayBuffer$1
+});
+
+/*
+ * Copyright 2019 Gregg Tavares
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+/* eslint no-console: "off" */
+
+/**
+ * Copy named properties
+ *
+ * @param {string[]} names names of properties to copy
+ * @param {object} src object to copy properties from
+ * @param {object} dst object to copy properties to
+ * @private
+ */
+function copyNamedProperties(names, src, dst) {
+ names.forEach(function(name) {
+ const value = src[name];
+ if (value !== undefined) {
+ dst[name] = value;
+ }
+ });
+}
+
+/**
+ * Copies properties from source to dest only if a matching key is in dest
+ *
+ * @param {Object.} src the source
+ * @param {Object.} dst the dest
+ * @private
+ */
+function copyExistingProperties(src, dst) {
+ Object.keys(dst).forEach(function(key) {
+ if (dst.hasOwnProperty(key) && src.hasOwnProperty(key)) { /* eslint no-prototype-builtins: 0 */
+ dst[key] = src[key];
+ }
+ });
+}
+
+function error$1(...args) {
+ console.error(...args);
+}
+
+function warn$1(...args) {
+ console.warn(...args);
+}
+
+const isTypeWeakMaps = new Map();
+
+function isType(object, type) {
+ if (!object || typeof object !== 'object') {
+ return false;
+ }
+ let weakMap = isTypeWeakMaps.get(type);
+ if (!weakMap) {
+ weakMap = new WeakMap();
+ isTypeWeakMaps.set(type, weakMap);
+ }
+ let isOfType = weakMap.get(object);
+ if (isOfType === undefined) {
+ const s = Object.prototype.toString.call(object);
+ isOfType = s.substring(8, s.length - 1) === type;
+ weakMap.set(object, isOfType);
+ }
+ return isOfType;
+}
+
+function isBuffer(gl, t) {
+ return typeof WebGLBuffer !== 'undefined' && isType(t, 'WebGLBuffer');
+}
+
+function isRenderbuffer(gl, t) {
+ return typeof WebGLRenderbuffer !== 'undefined' && isType(t, 'WebGLRenderbuffer');
+}
+
+function isTexture(gl, t) {
+ return typeof WebGLTexture !== 'undefined' && isType(t, 'WebGLTexture');
+}
+
+function isSampler(gl, t) {
+ return typeof WebGLSampler !== 'undefined' && isType(t, 'WebGLSampler');
+}
+
+/*
+ * Copyright 2019 Gregg Tavares
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+const STATIC_DRAW = 0x88e4;
+const ARRAY_BUFFER$1 = 0x8892;
+const ELEMENT_ARRAY_BUFFER$2 = 0x8893;
+const BUFFER_SIZE = 0x8764;
+
+const BYTE$1 = 0x1400;
+const UNSIGNED_BYTE$2 = 0x1401;
+const SHORT$1 = 0x1402;
+const UNSIGNED_SHORT$2 = 0x1403;
+const INT$2 = 0x1404;
+const UNSIGNED_INT$2 = 0x1405;
+const FLOAT$2 = 0x1406;
+const defaults$2 = {
+ attribPrefix: "",
+};
+
+/**
+ * Sets the default attrib prefix
+ *
+ * When writing shaders I prefer to name attributes with `a_`, uniforms with `u_` and varyings with `v_`
+ * as it makes it clear where they came from. But, when building geometry I prefer using un-prefixed names.
+ *
+ * In other words I'll create arrays of geometry like this
+ *
+ * var arrays = {
+ * position: ...
+ * normal: ...
+ * texcoord: ...
+ * };
+ *
+ * But need those mapped to attributes and my attributes start with `a_`.
+ *
+ * @deprecated see {@link module:twgl.setDefaults}
+ * @param {string} prefix prefix for attribs
+ * @memberOf module:twgl/attributes
+ */
+function setAttributePrefix(prefix) {
+ defaults$2.attribPrefix = prefix;
+}
+
+function setDefaults$2(newDefaults) {
+ copyExistingProperties(newDefaults, defaults$2);
+}
+
+function setBufferFromTypedArray(gl, type, buffer, array, drawType) {
+ gl.bindBuffer(type, buffer);
+ gl.bufferData(type, array, drawType || STATIC_DRAW);
+}
+
+/**
+ * Given typed array creates a WebGLBuffer and copies the typed array
+ * into it.
+ *
+ * @param {WebGLRenderingContext} gl A WebGLRenderingContext
+ * @param {ArrayBuffer|SharedArrayBuffer|ArrayBufferView|WebGLBuffer} typedArray the typed array. Note: If a WebGLBuffer is passed in it will just be returned. No action will be taken
+ * @param {number} [type] the GL bind type for the buffer. Default = `gl.ARRAY_BUFFER`.
+ * @param {number} [drawType] the GL draw type for the buffer. Default = 'gl.STATIC_DRAW`.
+ * @return {WebGLBuffer} the created WebGLBuffer
+ * @memberOf module:twgl/attributes
+ */
+function createBufferFromTypedArray(gl, typedArray, type, drawType) {
+ if (isBuffer(gl, typedArray)) {
+ return typedArray;
+ }
+ type = type || ARRAY_BUFFER$1;
+ const buffer = gl.createBuffer();
+ setBufferFromTypedArray(gl, type, buffer, typedArray, drawType);
+ return buffer;
+}
+
+function isIndices(name) {
+ return name === "indices";
+}
+
+// This is really just a guess. Though I can't really imagine using
+// anything else? Maybe for some compression?
+function getNormalizationForTypedArrayType(typedArrayType) {
+ if (typedArrayType === Int8Array) { return true; } // eslint-disable-line
+ if (typedArrayType === Uint8Array) { return true; } // eslint-disable-line
+ return false;
+}
+
+function getArray$1(array) {
+ return array.length ? array : array.data;
+}
+
+const texcoordRE = /coord|texture/i;
+const colorRE = /color|colour/i;
+
+function guessNumComponentsFromName(name, length) {
+ let numComponents;
+ if (texcoordRE.test(name)) {
+ numComponents = 2;
+ } else if (colorRE.test(name)) {
+ numComponents = 4;
+ } else {
+ numComponents = 3; // position, normals, indices ...
+ }
+
+ if (length % numComponents > 0) {
+ throw new Error(`Can not guess numComponents for attribute '${name}'. Tried ${numComponents} but ${length} values is not evenly divisible by ${numComponents}. You should specify it.`);
+ }
+
+ return numComponents;
+}
+
+function getNumComponents$1(array, arrayName, numValues) {
+ return array.numComponents || array.size || guessNumComponentsFromName(arrayName, numValues || getArray$1(array).length);
+}
+
+function makeTypedArray(array, name) {
+ if (isArrayBuffer$1(array)) {
+ return array;
+ }
+
+ if (isArrayBuffer$1(array.data)) {
+ return array.data;
+ }
+
+ if (Array.isArray(array)) {
+ array = {
+ data: array,
+ };
+ }
+
+ let Type = array.type ? typedArrayTypeFromGLTypeOrTypedArrayCtor(array.type) : undefined;
+ if (!Type) {
+ if (isIndices(name)) {
+ Type = Uint16Array;
+ } else {
+ Type = Float32Array;
+ }
+ }
+ return new Type(array.data);
+}
+
+function glTypeFromGLTypeOrTypedArrayType(glTypeOrTypedArrayCtor) {
+ return typeof glTypeOrTypedArrayCtor === 'number'
+ ? glTypeOrTypedArrayCtor
+ : glTypeOrTypedArrayCtor ? getGLTypeForTypedArrayType(glTypeOrTypedArrayCtor) : FLOAT$2;
+}
+
+function typedArrayTypeFromGLTypeOrTypedArrayCtor(glTypeOrTypedArrayCtor) {
+ return typeof glTypeOrTypedArrayCtor === 'number'
+ ? getTypedArrayTypeForGLType(glTypeOrTypedArrayCtor)
+ : glTypeOrTypedArrayCtor || Float32Array;
+}
+
+function attribBufferFromBuffer(gl, array/*, arrayName */) {
+ return {
+ buffer: array.buffer,
+ numValues: 2 * 3 * 4, // safely divided by 2, 3, 4
+ type: glTypeFromGLTypeOrTypedArrayType(array.type),
+ arrayType: typedArrayTypeFromGLTypeOrTypedArrayCtor(array.type),
+ };
+}
+
+function attribBufferFromSize(gl, array/*, arrayName*/) {
+ const numValues = array.data || array;
+ const arrayType = typedArrayTypeFromGLTypeOrTypedArrayCtor(array.type);
+ const numBytes = numValues * arrayType.BYTES_PER_ELEMENT;
+ const buffer = gl.createBuffer();
+ gl.bindBuffer(ARRAY_BUFFER$1, buffer);
+ gl.bufferData(ARRAY_BUFFER$1, numBytes, array.drawType || STATIC_DRAW);
+ return {
+ buffer,
+ numValues,
+ type: getGLTypeForTypedArrayType(arrayType),
+ arrayType,
+ };
+}
+
+function attribBufferFromArrayLike(gl, array, arrayName) {
+ const typedArray = makeTypedArray(array, arrayName);
+ return {
+ arrayType: typedArray.constructor,
+ buffer: createBufferFromTypedArray(gl, typedArray, undefined, array.drawType),
+ type: getGLTypeForTypedArray(typedArray),
+ numValues: 0,
+ };
+}
+
+/**
+ * The info for an attribute. This is effectively just the arguments to `gl.vertexAttribPointer` plus the WebGLBuffer
+ * for the attribute.
+ *
+ * @typedef {Object} AttribInfo
+ * @property {number[]|ArrayBufferView} [value] a constant value for the attribute. Note: if this is set the attribute will be
+ * disabled and set to this constant value and all other values will be ignored.
+ * @property {number} [numComponents] the number of components for this attribute.
+ * @property {number} [size] synonym for `numComponents`.
+ * @property {number} [type] the type of the attribute (eg. `gl.FLOAT`, `gl.UNSIGNED_BYTE`, etc...) Default = `gl.FLOAT`
+ * @property {boolean} [normalize] whether or not to normalize the data. Default = false
+ * @property {number} [offset] offset into buffer in bytes. Default = 0
+ * @property {number} [stride] the stride in bytes per element. Default = 0
+ * @property {number} [divisor] the divisor in instances. Default = 0.
+ * Requires WebGL2 or the ANGLE_instanced_arrays extension.
+ * and, if you're using WebGL1 you must have called {@link module:twgl.addExtensionsToContext}
+ * @property {WebGLBuffer} buffer the buffer that contains the data for this attribute
+ * @property {number} [drawType] the draw type passed to gl.bufferData. Default = gl.STATIC_DRAW
+ * @memberOf module:twgl
+ */
+
+/**
+ * @typedef {(Int8ArrayConstructor|Uint8ArrayConstructor|Int16ArrayConstructor|Uint16ArrayConstructor|Int32ArrayConstructor|Uint32ArrayConstructor|Float32ArrayConstructor)} TypedArrayConstructor
+ */
+
+/**
+ * Use this type of array spec when TWGL can't guess the type or number of components of an array
+ * @typedef {Object} FullArraySpec
+ * @property {number[]|ArrayBufferView} [value] a constant value for the attribute. Note: if this is set the attribute will be
+ * disabled and set to this constant value and all other values will be ignored.
+ * @property {(number|number[]|ArrayBufferView)} [data] The data of the array. A number alone becomes the number of elements of type.
+ * @property {number} [numComponents] number of components for `vertexAttribPointer`. Default is based on the name of the array.
+ * If `coord` is in the name assumes `numComponents = 2`.
+ * If `color` is in the name assumes `numComponents = 4`.
+ * otherwise assumes `numComponents = 3`
+ * @property {number|TypedArrayConstructor} [type] type. This is used if `data` is a JavaScript array, or `buffer` is passed in, or `data` is a number.
+ * It can either be the constructor for a typedarray. (eg. `Uint8Array`) OR a WebGL type, (eg `gl.UNSIGNED_BYTE`).
+ * For example if you want colors in a `Uint8Array` you might have a `FullArraySpec` like `{ type: gl.UNSIGNED_BYTE, data: [255,0,255,255, ...], }`.
+ * @property {number} [size] synonym for `numComponents`.
+ * @property {boolean} [normalize] normalize for `vertexAttribPointer`. Default is true if type is `Int8Array` or `Uint8Array` otherwise false.
+ * @property {number} [stride] stride for `vertexAttribPointer`. Default = 0
+ * @property {number} [offset] offset for `vertexAttribPointer`. Default = 0
+ * @property {number} [divisor] divisor for `vertexAttribDivisor`. Default = 0.
+ * Requires WebGL2 or the ANGLE_instanced_arrays extension.
+ * and, if you using WebGL1 you must have called {@link module:twgl.addExtensionsToContext}
+ * @property {string} [attrib] name of attribute this array maps to. Defaults to same name as array prefixed by the default attribPrefix.
+ * @property {string} [name] synonym for `attrib`.
+ * @property {string} [attribName] synonym for `attrib`.
+ * @property {WebGLBuffer} [buffer] Buffer to use for this attribute. This lets you use your own buffer
+ * but you will need to supply `numComponents` and `type`. You can effectively pass an `AttribInfo`
+ * to provide this. Example:
+ *
+ * const bufferInfo1 = twgl.createBufferInfoFromArrays(gl, {
+ * position: [1, 2, 3, ... ],
+ * });
+ * const bufferInfo2 = twgl.createBufferInfoFromArrays(gl, {
+ * position: bufferInfo1.attribs.position, // use the same buffer from bufferInfo1
+ * });
+ *
+ * @property {number} [drawType] the draw type passed to gl.bufferData. Default = gl.STATIC_DRAW
+ * @memberOf module:twgl
+ */
+
+/**
+ * An individual array in {@link module:twgl.Arrays}
+ *
+ * When passed to {@link module:twgl.createBufferInfoFromArrays} if an ArraySpec is `number[]` or `ArrayBufferView`
+ * the types will be guessed based on the name. `indices` will be `Uint16Array`, everything else will
+ * be `Float32Array`. If an ArraySpec is a number it's the number of floats for an empty (zeroed) buffer.
+ *
+ * @typedef {(number|number[]|ArrayBufferView|module:twgl.FullArraySpec)} ArraySpec
+ * @memberOf module:twgl
+ */
+
+/**
+ * This is a JavaScript object of arrays by name. The names should match your shader's attributes. If your
+ * attributes have a common prefix you can specify it by calling {@link module:twgl.setAttributePrefix}.
+ *
+ * Bare JavaScript Arrays
+ *
+ * var arrays = {
+ * position: [-1, 1, 0],
+ * normal: [0, 1, 0],
+ * ...
+ * }
+ *
+ * Bare TypedArrays
+ *
+ * var arrays = {
+ * position: new Float32Array([-1, 1, 0]),
+ * color: new Uint8Array([255, 128, 64, 255]),
+ * ...
+ * }
+ *
+ * * Will guess at `numComponents` if not specified based on name.
+ *
+ * If `coord` is in the name assumes `numComponents = 2`
+ *
+ * If `color` is in the name assumes `numComponents = 4`
+ *
+ * otherwise assumes `numComponents = 3`
+ *
+ * Objects with various fields. See {@link module:twgl.FullArraySpec}.
+ *
+ * var arrays = {
+ * position: { numComponents: 3, data: [0, 0, 0, 10, 0, 0, 0, 10, 0, 10, 10, 0], },
+ * texcoord: { numComponents: 2, data: [0, 0, 0, 1, 1, 0, 1, 1], },
+ * normal: { numComponents: 3, data: [0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1], },
+ * indices: { numComponents: 3, data: [0, 1, 2, 1, 2, 3], },
+ * };
+ *
+ * @typedef {Object.} Arrays
+ * @memberOf module:twgl
+ */
+
+
+/**
+ * Creates a set of attribute data and WebGLBuffers from set of arrays
+ *
+ * Given
+ *
+ * var arrays = {
+ * position: { numComponents: 3, data: [0, 0, 0, 10, 0, 0, 0, 10, 0, 10, 10, 0], },
+ * texcoord: { numComponents: 2, data: [0, 0, 0, 1, 1, 0, 1, 1], },
+ * normal: { numComponents: 3, data: [0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1], },
+ * color: { numComponents: 4, data: [255, 255, 255, 255, 255, 0, 0, 255, 0, 0, 255, 255], type: Uint8Array, },
+ * indices: { numComponents: 3, data: [0, 1, 2, 1, 2, 3], },
+ * };
+ *
+ * returns something like
+ *
+ * var attribs = {
+ * position: { numComponents: 3, type: gl.FLOAT, normalize: false, buffer: WebGLBuffer, },
+ * texcoord: { numComponents: 2, type: gl.FLOAT, normalize: false, buffer: WebGLBuffer, },
+ * normal: { numComponents: 3, type: gl.FLOAT, normalize: false, buffer: WebGLBuffer, },
+ * color: { numComponents: 4, type: gl.UNSIGNED_BYTE, normalize: true, buffer: WebGLBuffer, },
+ * };
+ *
+ * notes:
+ *
+ * * Arrays can take various forms
+ *
+ * Bare JavaScript Arrays
+ *
+ * var arrays = {
+ * position: [-1, 1, 0],
+ * normal: [0, 1, 0],
+ * ...
+ * }
+ *
+ * Bare TypedArrays
+ *
+ * var arrays = {
+ * position: new Float32Array([-1, 1, 0]),
+ * color: new Uint8Array([255, 128, 64, 255]),
+ * ...
+ * }
+ *
+ * * Will guess at `numComponents` if not specified based on name.
+ *
+ * If `coord` is in the name assumes `numComponents = 2`
+ *
+ * If `color` is in the name assumes `numComponents = 4`
+ *
+ * otherwise assumes `numComponents = 3`
+ *
+ * @param {WebGLRenderingContext} gl The webgl rendering context.
+ * @param {module:twgl.Arrays} arrays The arrays
+ * @param {module:twgl.BufferInfo} [srcBufferInfo] a BufferInfo to copy from
+ * This lets you share buffers. Any arrays you supply will override
+ * the buffers from srcBufferInfo.
+ * @return {Object.} the attribs
+ * @memberOf module:twgl/attributes
+ */
+function createAttribsFromArrays(gl, arrays) {
+ const attribs = {};
+ Object.keys(arrays).forEach(function(arrayName) {
+ if (!isIndices(arrayName)) {
+ const array = arrays[arrayName];
+ const attribName = array.attrib || array.name || array.attribName || (defaults$2.attribPrefix + arrayName);
+ if (array.value) {
+ if (!Array.isArray(array.value) && !isArrayBuffer$1(array.value)) {
+ throw new Error('array.value is not array or typedarray');
+ }
+ attribs[attribName] = {
+ value: array.value,
+ };
+ } else {
+ let fn;
+ if (array.buffer && array.buffer instanceof WebGLBuffer) {
+ fn = attribBufferFromBuffer;
+ } else if (typeof array === "number" || typeof array.data === "number") {
+ fn = attribBufferFromSize;
+ } else {
+ fn = attribBufferFromArrayLike;
+ }
+ const {buffer, type, numValues, arrayType} = fn(gl, array, arrayName);
+ const normalization = array.normalize !== undefined ? array.normalize : getNormalizationForTypedArrayType(arrayType);
+ const numComponents = getNumComponents$1(array, arrayName, numValues);
+ attribs[attribName] = {
+ buffer: buffer,
+ numComponents: numComponents,
+ type: type,
+ normalize: normalization,
+ stride: array.stride || 0,
+ offset: array.offset || 0,
+ divisor: array.divisor === undefined ? undefined : array.divisor,
+ drawType: array.drawType,
+ };
+ }
+ }
+ });
+ gl.bindBuffer(ARRAY_BUFFER$1, null);
+ return attribs;
+}
+
+/**
+ * Sets the contents of a buffer attached to an attribInfo
+ *
+ * This is helper function to dynamically update a buffer.
+ *
+ * Let's say you make a bufferInfo
+ *
+ * var arrays = {
+ * position: new Float32Array([0, 0, 0, 10, 0, 0, 0, 10, 0, 10, 10, 0]),
+ * texcoord: new Float32Array([0, 0, 0, 1, 1, 0, 1, 1]),
+ * normal: new Float32Array([0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1]),
+ * indices: new Uint16Array([0, 1, 2, 1, 2, 3]),
+ * };
+ * var bufferInfo = twgl.createBufferInfoFromArrays(gl, arrays);
+ *
+ * And you want to dynamically update the positions. You could do this
+ *
+ * // assuming arrays.position has already been updated with new data.
+ * twgl.setAttribInfoBufferFromArray(gl, bufferInfo.attribs.position, arrays.position);
+ *
+ * @param {WebGLRenderingContext} gl
+ * @param {AttribInfo} attribInfo The attribInfo who's buffer contents to set. NOTE: If you have an attribute prefix
+ * the name of the attribute will include the prefix.
+ * @param {ArraySpec} array Note: it is arguably inefficient to pass in anything but a typed array because anything
+ * else will have to be converted to a typed array before it can be used by WebGL. During init time that
+ * inefficiency is usually not important but if you're updating data dynamically best to be efficient.
+ * @param {number} [offset] an optional offset into the buffer. This is only an offset into the WebGL buffer
+ * not the array. To pass in an offset into the array itself use a typed array and create an `ArrayBufferView`
+ * for the portion of the array you want to use.
+ *
+ * var someArray = new Float32Array(1000); // an array with 1000 floats
+ * var someSubArray = new Float32Array(someArray.buffer, offsetInBytes, sizeInUnits); // a view into someArray
+ *
+ * Now you can pass `someSubArray` into setAttribInfoBufferFromArray`
+ * @memberOf module:twgl/attributes
+ */
+function setAttribInfoBufferFromArray(gl, attribInfo, array, offset) {
+ array = makeTypedArray(array);
+ if (offset !== undefined) {
+ gl.bindBuffer(ARRAY_BUFFER$1, attribInfo.buffer);
+ gl.bufferSubData(ARRAY_BUFFER$1, offset, array);
+ } else {
+ setBufferFromTypedArray(gl, ARRAY_BUFFER$1, attribInfo.buffer, array, attribInfo.drawType);
+ }
+}
+
+function getBytesPerValueForGLType(gl, type) {
+ if (type === BYTE$1) return 1; // eslint-disable-line
+ if (type === UNSIGNED_BYTE$2) return 1; // eslint-disable-line
+ if (type === SHORT$1) return 2; // eslint-disable-line
+ if (type === UNSIGNED_SHORT$2) return 2; // eslint-disable-line
+ if (type === INT$2) return 4; // eslint-disable-line
+ if (type === UNSIGNED_INT$2) return 4; // eslint-disable-line
+ if (type === FLOAT$2) return 4; // eslint-disable-line
+ return 0;
+}
+
+// Tries to get the number of elements from a set of arrays.
+const positionKeys = ['position', 'positions', 'a_position'];
+function getNumElementsFromNonIndexedArrays(arrays) {
+ let key;
+ let ii;
+ for (ii = 0; ii < positionKeys.length; ++ii) {
+ key = positionKeys[ii];
+ if (key in arrays) {
+ break;
+ }
+ }
+ if (ii === positionKeys.length) {
+ key = Object.keys(arrays)[0];
+ }
+ const array = arrays[key];
+ const length = getArray$1(array).length;
+ if (length === undefined) {
+ return 1; // There's no arrays
+ }
+ const numComponents = getNumComponents$1(array, key);
+ const numElements = length / numComponents;
+ if (length % numComponents > 0) {
+ throw new Error(`numComponents ${numComponents} not correct for length ${length}`);
+ }
+ return numElements;
+}
+
+function getNumElementsFromAttributes(gl, attribs) {
+ let key;
+ let ii;
+ for (ii = 0; ii < positionKeys.length; ++ii) {
+ key = positionKeys[ii];
+ if (key in attribs) {
+ break;
+ }
+ key = defaults$2.attribPrefix + key;
+ if (key in attribs) {
+ break;
+ }
+ }
+ if (ii === positionKeys.length) {
+ key = Object.keys(attribs)[0];
+ }
+ const attrib = attribs[key];
+ if (!attrib.buffer) {
+ return 1; // There's no buffer
+ }
+ gl.bindBuffer(ARRAY_BUFFER$1, attrib.buffer);
+ const numBytes = gl.getBufferParameter(ARRAY_BUFFER$1, BUFFER_SIZE);
+ gl.bindBuffer(ARRAY_BUFFER$1, null);
+
+ const bytesPerValue = getBytesPerValueForGLType(gl, attrib.type);
+ const totalElements = numBytes / bytesPerValue;
+ const numComponents = attrib.numComponents || attrib.size;
+ // TODO: check stride
+ const numElements = totalElements / numComponents;
+ if (numElements % 1 !== 0) {
+ throw new Error(`numComponents ${numComponents} not correct for length ${length}`);
+ }
+ return numElements;
+}
+
+/**
+ * @typedef {Object} BufferInfo
+ * @property {number} numElements The number of elements to pass to `gl.drawArrays` or `gl.drawElements`.
+ * @property {number} [elementType] The type of indices `UNSIGNED_BYTE`, `UNSIGNED_SHORT` etc..
+ * @property {WebGLBuffer} [indices] The indices `ELEMENT_ARRAY_BUFFER` if any indices exist.
+ * @property {Object.} [attribs] The attribs appropriate to call `setAttributes`
+ * @memberOf module:twgl
+ */
+
+/**
+ * Creates a BufferInfo from an object of arrays.
+ *
+ * This can be passed to {@link module:twgl.setBuffersAndAttributes} and to
+ * {@link module:twgl:drawBufferInfo}.
+ *
+ * Given an object like
+ *
+ * var arrays = {
+ * position: { numComponents: 3, data: [0, 0, 0, 10, 0, 0, 0, 10, 0, 10, 10, 0], },
+ * texcoord: { numComponents: 2, data: [0, 0, 0, 1, 1, 0, 1, 1], },
+ * normal: { numComponents: 3, data: [0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1], },
+ * indices: { numComponents: 3, data: [0, 1, 2, 1, 2, 3], },
+ * };
+ *
+ * Creates an BufferInfo like this
+ *
+ * bufferInfo = {
+ * numElements: 4, // or whatever the number of elements is
+ * indices: WebGLBuffer, // this property will not exist if there are no indices
+ * attribs: {
+ * position: { buffer: WebGLBuffer, numComponents: 3, },
+ * normal: { buffer: WebGLBuffer, numComponents: 3, },
+ * texcoord: { buffer: WebGLBuffer, numComponents: 2, },
+ * },
+ * };
+ *
+ * The properties of arrays can be JavaScript arrays in which case the number of components
+ * will be guessed.
+ *
+ * var arrays = {
+ * position: [0, 0, 0, 10, 0, 0, 0, 10, 0, 10, 10, 0],
+ * texcoord: [0, 0, 0, 1, 1, 0, 1, 1],
+ * normal: [0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1],
+ * indices: [0, 1, 2, 1, 2, 3],
+ * };
+ *
+ * They can also be TypedArrays
+ *
+ * var arrays = {
+ * position: new Float32Array([0, 0, 0, 10, 0, 0, 0, 10, 0, 10, 10, 0]),
+ * texcoord: new Float32Array([0, 0, 0, 1, 1, 0, 1, 1]),
+ * normal: new Float32Array([0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1]),
+ * indices: new Uint16Array([0, 1, 2, 1, 2, 3]),
+ * };
+ *
+ * Or AugmentedTypedArrays
+ *
+ * var positions = createAugmentedTypedArray(3, 4);
+ * var texcoords = createAugmentedTypedArray(2, 4);
+ * var normals = createAugmentedTypedArray(3, 4);
+ * var indices = createAugmentedTypedArray(3, 2, Uint16Array);
+ *
+ * positions.push([0, 0, 0, 10, 0, 0, 0, 10, 0, 10, 10, 0]);
+ * texcoords.push([0, 0, 0, 1, 1, 0, 1, 1]);
+ * normals.push([0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1]);
+ * indices.push([0, 1, 2, 1, 2, 3]);
+ *
+ * var arrays = {
+ * position: positions,
+ * texcoord: texcoords,
+ * normal: normals,
+ * indices: indices,
+ * };
+ *
+ * For the last example it is equivalent to
+ *
+ * var bufferInfo = {
+ * attribs: {
+ * position: { numComponents: 3, buffer: gl.createBuffer(), },
+ * texcoord: { numComponents: 2, buffer: gl.createBuffer(), },
+ * normal: { numComponents: 3, buffer: gl.createBuffer(), },
+ * },
+ * indices: gl.createBuffer(),
+ * numElements: 6,
+ * };
+ *
+ * gl.bindBuffer(gl.ARRAY_BUFFER, bufferInfo.attribs.position.buffer);
+ * gl.bufferData(gl.ARRAY_BUFFER, arrays.position, gl.STATIC_DRAW);
+ * gl.bindBuffer(gl.ARRAY_BUFFER, bufferInfo.attribs.texcoord.buffer);
+ * gl.bufferData(gl.ARRAY_BUFFER, arrays.texcoord, gl.STATIC_DRAW);
+ * gl.bindBuffer(gl.ARRAY_BUFFER, bufferInfo.attribs.normal.buffer);
+ * gl.bufferData(gl.ARRAY_BUFFER, arrays.normal, gl.STATIC_DRAW);
+ * gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, bufferInfo.indices);
+ * gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, arrays.indices, gl.STATIC_DRAW);
+ *
+ * @param {WebGLRenderingContext} gl A WebGLRenderingContext
+ * @param {module:twgl.Arrays} arrays Your data
+ * @param {module:twgl.BufferInfo} [srcBufferInfo] An existing
+ * buffer info to start from. WebGLBuffers etc specified
+ * in the srcBufferInfo will be used in a new BufferInfo
+ * with any arrays specified overriding the ones in
+ * srcBufferInfo.
+ * @return {module:twgl.BufferInfo} A BufferInfo
+ * @memberOf module:twgl/attributes
+ */
+function createBufferInfoFromArrays(gl, arrays, srcBufferInfo) {
+ const newAttribs = createAttribsFromArrays(gl, arrays);
+ const bufferInfo = Object.assign({}, srcBufferInfo ? srcBufferInfo : {});
+ bufferInfo.attribs = Object.assign({}, srcBufferInfo ? srcBufferInfo.attribs : {}, newAttribs);
+ const indices = arrays.indices;
+ if (indices) {
+ const newIndices = makeTypedArray(indices, "indices");
+ bufferInfo.indices = createBufferFromTypedArray(gl, newIndices, ELEMENT_ARRAY_BUFFER$2);
+ bufferInfo.numElements = newIndices.length;
+ bufferInfo.elementType = getGLTypeForTypedArray(newIndices);
+ } else if (!bufferInfo.numElements) {
+ bufferInfo.numElements = getNumElementsFromAttributes(gl, bufferInfo.attribs);
+ }
+
+ return bufferInfo;
+}
+
+/**
+ * Creates a buffer from an array, typed array, or array spec
+ *
+ * Given something like this
+ *
+ * [1, 2, 3],
+ *
+ * or
+ *
+ * new Uint16Array([1,2,3]);
+ *
+ * or
+ *
+ * {
+ * data: [1, 2, 3],
+ * type: Uint8Array,
+ * }
+ *
+ * returns a WebGLBuffer that contains the given data.
+ *
+ * @param {WebGLRenderingContext} gl A WebGLRenderingContext.
+ * @param {module:twgl.ArraySpec} array an array, typed array, or array spec.
+ * @param {string} arrayName name of array. Used to guess the type if type can not be derived otherwise.
+ * @return {WebGLBuffer} a WebGLBuffer containing the data in array.
+ * @memberOf module:twgl/attributes
+ */
+function createBufferFromArray(gl, array, arrayName) {
+ const type = arrayName === "indices" ? ELEMENT_ARRAY_BUFFER$2 : ARRAY_BUFFER$1;
+ const typedArray = makeTypedArray(array, arrayName);
+ return createBufferFromTypedArray(gl, typedArray, type);
+}
+
+/**
+ * Creates buffers from arrays or typed arrays
+ *
+ * Given something like this
+ *
+ * var arrays = {
+ * positions: [1, 2, 3],
+ * normals: [0, 0, 1],
+ * }
+ *
+ * returns something like
+ *
+ * buffers = {
+ * positions: WebGLBuffer,
+ * normals: WebGLBuffer,
+ * }
+ *
+ * If the buffer is named 'indices' it will be made an ELEMENT_ARRAY_BUFFER.
+ *
+ * @param {WebGLRenderingContext} gl A WebGLRenderingContext.
+ * @param {module:twgl.Arrays} arrays
+ * @return {Object} returns an object with one WebGLBuffer per array
+ * @memberOf module:twgl/attributes
+ */
+function createBuffersFromArrays(gl, arrays) {
+ const buffers = { };
+ Object.keys(arrays).forEach(function(key) {
+ buffers[key] = createBufferFromArray(gl, arrays[key], key);
+ });
+
+ // Ugh!
+ if (arrays.indices) {
+ buffers.numElements = arrays.indices.length;
+ buffers.elementType = getGLTypeForTypedArray(makeTypedArray(arrays.indices));
+ } else {
+ buffers.numElements = getNumElementsFromNonIndexedArrays(arrays);
+ }
+
+ return buffers;
+}
+
+var attributes = /*#__PURE__*/Object.freeze({
+ __proto__: null,
+ createAttribsFromArrays: createAttribsFromArrays,
+ createBuffersFromArrays: createBuffersFromArrays,
+ createBufferFromArray: createBufferFromArray,
+ createBufferFromTypedArray: createBufferFromTypedArray,
+ createBufferInfoFromArrays: createBufferInfoFromArrays,
+ setAttribInfoBufferFromArray: setAttribInfoBufferFromArray,
+ setAttributePrefix: setAttributePrefix,
+ setAttributeDefaults_: setDefaults$2,
+ getNumComponents_: getNumComponents$1,
+ getArray_: getArray$1
+});
+
+/*
+ * Copyright 2019 Gregg Tavares
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+const getArray = getArray$1; // eslint-disable-line
+const getNumComponents = getNumComponents$1; // eslint-disable-line
+
+/**
+ * @typedef {(Int8Array|Uint8Array|Int16Array|Uint16Array|Int32Array|Uint32Array|Float32Array)} TypedArray
+ */
+
+/**
+ * Add `push` to a typed array. It just keeps a 'cursor'
+ * and allows use to `push` values into the array so we
+ * don't have to manually compute offsets
+ * @param {TypedArray} typedArray TypedArray to augment
+ * @param {number} numComponents number of components.
+ * @private
+ */
+function augmentTypedArray(typedArray, numComponents) {
+ let cursor = 0;
+ typedArray.push = function() {
+ for (let ii = 0; ii < arguments.length; ++ii) {
+ const value = arguments[ii];
+ if (value instanceof Array || isArrayBuffer$1(value)) {
+ for (let jj = 0; jj < value.length; ++jj) {
+ typedArray[cursor++] = value[jj];
+ }
+ } else {
+ typedArray[cursor++] = value;
+ }
+ }
+ };
+ typedArray.reset = function(opt_index) {
+ cursor = opt_index || 0;
+ };
+ typedArray.numComponents = numComponents;
+ Object.defineProperty(typedArray, 'numElements', {
+ get: function() {
+ return this.length / this.numComponents | 0;
+ },
+ });
+ return typedArray;
+}
+
+/**
+ * creates a typed array with a `push` function attached
+ * so that you can easily *push* values.
+ *
+ * `push` can take multiple arguments. If an argument is an array each element
+ * of the array will be added to the typed array.
+ *
+ * Example:
+ *
+ * const array = createAugmentedTypedArray(3, 2); // creates a Float32Array with 6 values
+ * array.push(1, 2, 3);
+ * array.push([4, 5, 6]);
+ * // array now contains [1, 2, 3, 4, 5, 6]
+ *
+ * Also has `numComponents` and `numElements` properties.
+ *
+ * @param {number} numComponents number of components
+ * @param {number} numElements number of elements. The total size of the array will be `numComponents * numElements`.
+ * @param {constructor} opt_type A constructor for the type. Default = `Float32Array`.
+ * @return {ArrayBufferView} A typed array.
+ * @memberOf module:twgl/primitives
+ */
+function createAugmentedTypedArray(numComponents, numElements, opt_type) {
+ const Type = opt_type || Float32Array;
+ return augmentTypedArray(new Type(numComponents * numElements), numComponents);
+}
+
+function allButIndices(name) {
+ return name !== "indices";
+}
+
+/**
+ * Given indexed vertices creates a new set of vertices un-indexed by expanding the indexed vertices.
+ * @param {Object.} vertices The indexed vertices to deindex
+ * @return {Object.} The deindexed vertices
+ * @memberOf module:twgl/primitives
+ */
+function deindexVertices(vertices) {
+ const indices = vertices.indices;
+ const newVertices = {};
+ const numElements = indices.length;
+
+ function expandToUnindexed(channel) {
+ const srcBuffer = vertices[channel];
+ const numComponents = srcBuffer.numComponents;
+ const dstBuffer = createAugmentedTypedArray(numComponents, numElements, srcBuffer.constructor);
+ for (let ii = 0; ii < numElements; ++ii) {
+ const ndx = indices[ii];
+ const offset = ndx * numComponents;
+ for (let jj = 0; jj < numComponents; ++jj) {
+ dstBuffer.push(srcBuffer[offset + jj]);
+ }
+ }
+ newVertices[channel] = dstBuffer;
+ }
+
+ Object.keys(vertices).filter(allButIndices).forEach(expandToUnindexed);
+
+ return newVertices;
+}
+
+/**
+ * flattens the normals of deindexed vertices in place.
+ * @param {Object.} vertices The deindexed vertices who's normals to flatten
+ * @return {Object.} The flattened vertices (same as was passed in)
+ * @memberOf module:twgl/primitives
+ */
+function flattenNormals(vertices) {
+ if (vertices.indices) {
+ throw new Error('can not flatten normals of indexed vertices. deindex them first');
+ }
+
+ const normals = vertices.normal;
+ const numNormals = normals.length;
+ for (let ii = 0; ii < numNormals; ii += 9) {
+ // pull out the 3 normals for this triangle
+ const nax = normals[ii + 0];
+ const nay = normals[ii + 1];
+ const naz = normals[ii + 2];
+
+ const nbx = normals[ii + 3];
+ const nby = normals[ii + 4];
+ const nbz = normals[ii + 5];
+
+ const ncx = normals[ii + 6];
+ const ncy = normals[ii + 7];
+ const ncz = normals[ii + 8];
+
+ // add them
+ let nx = nax + nbx + ncx;
+ let ny = nay + nby + ncy;
+ let nz = naz + nbz + ncz;
+
+ // normalize them
+ const length = Math.sqrt(nx * nx + ny * ny + nz * nz);
+
+ nx /= length;
+ ny /= length;
+ nz /= length;
+
+ // copy them back in
+ normals[ii + 0] = nx;
+ normals[ii + 1] = ny;
+ normals[ii + 2] = nz;
+
+ normals[ii + 3] = nx;
+ normals[ii + 4] = ny;
+ normals[ii + 5] = nz;
+
+ normals[ii + 6] = nx;
+ normals[ii + 7] = ny;
+ normals[ii + 8] = nz;
+ }
+
+ return vertices;
+}
+
+function applyFuncToV3Array(array, matrix, fn) {
+ const len = array.length;
+ const tmp = new Float32Array(3);
+ for (let ii = 0; ii < len; ii += 3) {
+ fn(matrix, [array[ii], array[ii + 1], array[ii + 2]], tmp);
+ array[ii ] = tmp[0];
+ array[ii + 1] = tmp[1];
+ array[ii + 2] = tmp[2];
+ }
+}
+
+function transformNormal(mi, v, dst) {
+ dst = dst || create$1();
+ const v0 = v[0];
+ const v1 = v[1];
+ const v2 = v[2];
+
+ dst[0] = v0 * mi[0 * 4 + 0] + v1 * mi[0 * 4 + 1] + v2 * mi[0 * 4 + 2];
+ dst[1] = v0 * mi[1 * 4 + 0] + v1 * mi[1 * 4 + 1] + v2 * mi[1 * 4 + 2];
+ dst[2] = v0 * mi[2 * 4 + 0] + v1 * mi[2 * 4 + 1] + v2 * mi[2 * 4 + 2];
+
+ return dst;
+}
+
+/**
+ * Reorients directions by the given matrix..
+ * @param {(number[]|TypedArray)} array The array. Assumes value floats per element.
+ * @param {module:twgl/m4.Mat4} matrix A matrix to multiply by.
+ * @return {(number[]|TypedArray)} the same array that was passed in
+ * @memberOf module:twgl/primitives
+ */
+function reorientDirections(array, matrix) {
+ applyFuncToV3Array(array, matrix, transformDirection);
+ return array;
+}
+
+/**
+ * Reorients normals by the inverse-transpose of the given
+ * matrix..
+ * @param {(number[]|TypedArray)} array The array. Assumes value floats per element.
+ * @param {module:twgl/m4.Mat4} matrix A matrix to multiply by.
+ * @return {(number[]|TypedArray)} the same array that was passed in
+ * @memberOf module:twgl/primitives
+ */
+function reorientNormals(array, matrix) {
+ applyFuncToV3Array(array, inverse(matrix), transformNormal);
+ return array;
+}
+
+/**
+ * Reorients positions by the given matrix. In other words, it
+ * multiplies each vertex by the given matrix.
+ * @param {(number[]|TypedArray)} array The array. Assumes value floats per element.
+ * @param {module:twgl/m4.Mat4} matrix A matrix to multiply by.
+ * @return {(number[]|TypedArray)} the same array that was passed in
+ * @memberOf module:twgl/primitives
+ */
+function reorientPositions(array, matrix) {
+ applyFuncToV3Array(array, matrix, transformPoint);
+ return array;
+}
+
+/**
+ * @typedef {(number[]|TypedArray)} NativeArrayOrTypedArray
+ */
+
+/**
+ * Reorients arrays by the given matrix. Assumes arrays have
+ * names that contains 'pos' could be reoriented as positions,
+ * 'binorm' or 'tan' as directions, and 'norm' as normals.
+ *
+ * @param {Object.} arrays The vertices to reorient
+ * @param {module:twgl/m4.Mat4} matrix matrix to reorient by.
+ * @return {Object.} same arrays that were passed in.
+ * @memberOf module:twgl/primitives
+ */
+function reorientVertices(arrays, matrix) {
+ Object.keys(arrays).forEach(function(name) {
+ const array = arrays[name];
+ if (name.indexOf("pos") >= 0) {
+ reorientPositions(array, matrix);
+ } else if (name.indexOf("tan") >= 0 || name.indexOf("binorm") >= 0) {
+ reorientDirections(array, matrix);
+ } else if (name.indexOf("norm") >= 0) {
+ reorientNormals(array, matrix);
+ }
+ });
+ return arrays;
+}
+
+/**
+ * Creates XY quad BufferInfo
+ *
+ * The default with no parameters will return a 2x2 quad with values from -1 to +1.
+ * If you want a unit quad with that goes from 0 to 1 you'd call it with
+ *
+ * twgl.primitives.createXYQuadBufferInfo(gl, 1, 0.5, 0.5);
+ *
+ * If you want a unit quad centered above 0,0 you'd call it with
+ *
+ * twgl.primitives.createXYQuadBufferInfo(gl, 1, 0, 0.5);
+ *
+ * @param {WebGLRenderingContext} gl The WebGLRenderingContext.
+ * @param {number} [size] the size across the quad. Defaults to 2 which means vertices will go from -1 to +1
+ * @param {number} [xOffset] the amount to offset the quad in X
+ * @param {number} [yOffset] the amount to offset the quad in Y
+ * @return {Object.} the created XY Quad BufferInfo
+ * @memberOf module:twgl/primitives
+ * @function createXYQuadBuffers
+ */
+
+/**
+ * Creates XY quad Buffers
+ *
+ * The default with no parameters will return a 2x2 quad with values from -1 to +1.
+ * If you want a unit quad with that goes from 0 to 1 you'd call it with
+ *
+ * twgl.primitives.createXYQuadBufferInfo(gl, 1, 0.5, 0.5);
+ *
+ * If you want a unit quad centered above 0,0 you'd call it with
+ *
+ * twgl.primitives.createXYQuadBufferInfo(gl, 1, 0, 0.5);
+ *
+ * @param {WebGLRenderingContext} gl The WebGLRenderingContext.
+ * @param {number} [size] the size across the quad. Defaults to 2 which means vertices will go from -1 to +1
+ * @param {number} [xOffset] the amount to offset the quad in X
+ * @param {number} [yOffset] the amount to offset the quad in Y
+ * @return {module:twgl.BufferInfo} the created XY Quad buffers
+ * @memberOf module:twgl/primitives
+ * @function createXYQuadBufferInfo
+ */
+
+/**
+ * Creates XY quad vertices
+ *
+ * The default with no parameters will return a 2x2 quad with values from -1 to +1.
+ * If you want a unit quad with that goes from 0 to 1 you'd call it with
+ *
+ * twgl.primitives.createXYQuadVertices(1, 0.5, 0.5);
+ *
+ * If you want a unit quad centered above 0,0 you'd call it with
+ *
+ * twgl.primitives.createXYQuadVertices(1, 0, 0.5);
+ *
+ * @param {number} [size] the size across the quad. Defaults to 2 which means vertices will go from -1 to +1
+ * @param {number} [xOffset] the amount to offset the quad in X
+ * @param {number} [yOffset] the amount to offset the quad in Y
+ * @return {Object.} the created XY Quad vertices
+ * @memberOf module:twgl/primitives
+ */
+function createXYQuadVertices(size, xOffset, yOffset) {
+ size = size || 2;
+ xOffset = xOffset || 0;
+ yOffset = yOffset || 0;
+ size *= 0.5;
+ return {
+ position: {
+ numComponents: 2,
+ data: [
+ xOffset + -1 * size, yOffset + -1 * size,
+ xOffset + 1 * size, yOffset + -1 * size,
+ xOffset + -1 * size, yOffset + 1 * size,
+ xOffset + 1 * size, yOffset + 1 * size,
+ ],
+ },
+ normal: [
+ 0, 0, 1,
+ 0, 0, 1,
+ 0, 0, 1,
+ 0, 0, 1,
+ ],
+ texcoord: [
+ 0, 0,
+ 1, 0,
+ 0, 1,
+ 1, 1,
+ ],
+ indices: [ 0, 1, 2, 2, 1, 3 ],
+ };
+}
+
+/**
+ * Creates XZ plane BufferInfo.
+ *
+ * The created plane has position, normal, and texcoord data
+ *
+ * @param {WebGLRenderingContext} gl The WebGLRenderingContext.
+ * @param {number} [width] Width of the plane. Default = 1
+ * @param {number} [depth] Depth of the plane. Default = 1
+ * @param {number} [subdivisionsWidth] Number of steps across the plane. Default = 1
+ * @param {number} [subdivisionsDepth] Number of steps down the plane. Default = 1
+ * @param {module:twgl/m4.Mat4} [matrix] A matrix by which to multiply all the vertices.
+ * @return {module:twgl.BufferInfo} The created plane BufferInfo.
+ * @memberOf module:twgl/primitives
+ * @function createPlaneBufferInfo
+ */
+
+/**
+ * Creates XZ plane buffers.
+ *
+ * The created plane has position, normal, and texcoord data
+ *
+ * @param {WebGLRenderingContext} gl The WebGLRenderingContext.
+ * @param {number} [width] Width of the plane. Default = 1
+ * @param {number} [depth] Depth of the plane. Default = 1
+ * @param {number} [subdivisionsWidth] Number of steps across the plane. Default = 1
+ * @param {number} [subdivisionsDepth] Number of steps down the plane. Default = 1
+ * @param {module:twgl/m4.Mat4} [matrix] A matrix by which to multiply all the vertices.
+ * @return {Object.} The created plane buffers.
+ * @memberOf module:twgl/primitives
+ * @function createPlaneBuffers
+ */
+
+/**
+ * Creates XZ plane vertices.
+ *
+ * The created plane has position, normal, and texcoord data
+ *
+ * @param {number} [width] Width of the plane. Default = 1
+ * @param {number} [depth] Depth of the plane. Default = 1
+ * @param {number} [subdivisionsWidth] Number of steps across the plane. Default = 1
+ * @param {number} [subdivisionsDepth] Number of steps down the plane. Default = 1
+ * @param {module:twgl/m4.Mat4} [matrix] A matrix by which to multiply all the vertices.
+ * @return {Object.} The created plane vertices.
+ * @memberOf module:twgl/primitives
+ */
+function createPlaneVertices(
+ width,
+ depth,
+ subdivisionsWidth,
+ subdivisionsDepth,
+ matrix) {
+ width = width || 1;
+ depth = depth || 1;
+ subdivisionsWidth = subdivisionsWidth || 1;
+ subdivisionsDepth = subdivisionsDepth || 1;
+ matrix = matrix || identity();
+
+ const numVertices = (subdivisionsWidth + 1) * (subdivisionsDepth + 1);
+ const positions = createAugmentedTypedArray(3, numVertices);
+ const normals = createAugmentedTypedArray(3, numVertices);
+ const texcoords = createAugmentedTypedArray(2, numVertices);
+
+ for (let z = 0; z <= subdivisionsDepth; z++) {
+ for (let x = 0; x <= subdivisionsWidth; x++) {
+ const u = x / subdivisionsWidth;
+ const v = z / subdivisionsDepth;
+ positions.push(
+ width * u - width * 0.5,
+ 0,
+ depth * v - depth * 0.5);
+ normals.push(0, 1, 0);
+ texcoords.push(u, v);
+ }
+ }
+
+ const numVertsAcross = subdivisionsWidth + 1;
+ const indices = createAugmentedTypedArray(
+ 3, subdivisionsWidth * subdivisionsDepth * 2, Uint16Array);
+
+ for (let z = 0; z < subdivisionsDepth; z++) { // eslint-disable-line
+ for (let x = 0; x < subdivisionsWidth; x++) { // eslint-disable-line
+ // Make triangle 1 of quad.
+ indices.push(
+ (z + 0) * numVertsAcross + x,
+ (z + 1) * numVertsAcross + x,
+ (z + 0) * numVertsAcross + x + 1);
+
+ // Make triangle 2 of quad.
+ indices.push(
+ (z + 1) * numVertsAcross + x,
+ (z + 1) * numVertsAcross + x + 1,
+ (z + 0) * numVertsAcross + x + 1);
+ }
+ }
+
+ const arrays = reorientVertices({
+ position: positions,
+ normal: normals,
+ texcoord: texcoords,
+ indices: indices,
+ }, matrix);
+ return arrays;
+}
+
+/**
+ * Creates sphere BufferInfo.
+ *
+ * The created sphere has position, normal, and texcoord data
+ *
+ * @param {WebGLRenderingContext} gl The WebGLRenderingContext.
+ * @param {number} radius radius of the sphere.
+ * @param {number} subdivisionsAxis number of steps around the sphere.
+ * @param {number} subdivisionsHeight number of vertically on the sphere.
+ * @param {number} [opt_startLatitudeInRadians] where to start the
+ * top of the sphere. Default = 0.
+ * @param {number} [opt_endLatitudeInRadians] Where to end the
+ * bottom of the sphere. Default = Math.PI.
+ * @param {number} [opt_startLongitudeInRadians] where to start
+ * wrapping the sphere. Default = 0.
+ * @param {number} [opt_endLongitudeInRadians] where to end
+ * wrapping the sphere. Default = 2 * Math.PI.
+ * @return {module:twgl.BufferInfo} The created sphere BufferInfo.
+ * @memberOf module:twgl/primitives
+ * @function createSphereBufferInfo
+ */
+
+/**
+ * Creates sphere buffers.
+ *
+ * The created sphere has position, normal, and texcoord data
+ *
+ * @param {WebGLRenderingContext} gl The WebGLRenderingContext.
+ * @param {number} radius radius of the sphere.
+ * @param {number} subdivisionsAxis number of steps around the sphere.
+ * @param {number} subdivisionsHeight number of vertically on the sphere.
+ * @param {number} [opt_startLatitudeInRadians] where to start the
+ * top of the sphere. Default = 0.
+ * @param {number} [opt_endLatitudeInRadians] Where to end the
+ * bottom of the sphere. Default = Math.PI.
+ * @param {number} [opt_startLongitudeInRadians] where to start
+ * wrapping the sphere. Default = 0.
+ * @param {number} [opt_endLongitudeInRadians] where to end
+ * wrapping the sphere. Default = 2 * Math.PI.
+ * @return {Object.} The created sphere buffers.
+ * @memberOf module:twgl/primitives
+ * @function createSphereBuffers
+ */
+
+/**
+ * Creates sphere vertices.
+ *
+ * The created sphere has position, normal, and texcoord data
+ *
+ * @param {number} radius radius of the sphere.
+ * @param {number} subdivisionsAxis number of steps around the sphere.
+ * @param {number} subdivisionsHeight number of vertically on the sphere.
+ * @param {number} [opt_startLatitudeInRadians] where to start the
+ * top of the sphere. Default = 0.
+ * @param {number} [opt_endLatitudeInRadians] Where to end the
+ * bottom of the sphere. Default = Math.PI.
+ * @param {number} [opt_startLongitudeInRadians] where to start
+ * wrapping the sphere. Default = 0.
+ * @param {number} [opt_endLongitudeInRadians] where to end
+ * wrapping the sphere. Default = 2 * Math.PI.
+ * @return {Object.} The created sphere vertices.
+ * @memberOf module:twgl/primitives
+ */
+function createSphereVertices(
+ radius,
+ subdivisionsAxis,
+ subdivisionsHeight,
+ opt_startLatitudeInRadians,
+ opt_endLatitudeInRadians,
+ opt_startLongitudeInRadians,
+ opt_endLongitudeInRadians) {
+ if (subdivisionsAxis <= 0 || subdivisionsHeight <= 0) {
+ throw new Error('subdivisionAxis and subdivisionHeight must be > 0');
+ }
+
+ opt_startLatitudeInRadians = opt_startLatitudeInRadians || 0;
+ opt_endLatitudeInRadians = opt_endLatitudeInRadians || Math.PI;
+ opt_startLongitudeInRadians = opt_startLongitudeInRadians || 0;
+ opt_endLongitudeInRadians = opt_endLongitudeInRadians || (Math.PI * 2);
+
+ const latRange = opt_endLatitudeInRadians - opt_startLatitudeInRadians;
+ const longRange = opt_endLongitudeInRadians - opt_startLongitudeInRadians;
+
+ // We are going to generate our sphere by iterating through its
+ // spherical coordinates and generating 2 triangles for each quad on a
+ // ring of the sphere.
+ const numVertices = (subdivisionsAxis + 1) * (subdivisionsHeight + 1);
+ const positions = createAugmentedTypedArray(3, numVertices);
+ const normals = createAugmentedTypedArray(3, numVertices);
+ const texcoords = createAugmentedTypedArray(2, numVertices);
+
+ // Generate the individual vertices in our vertex buffer.
+ for (let y = 0; y <= subdivisionsHeight; y++) {
+ for (let x = 0; x <= subdivisionsAxis; x++) {
+ // Generate a vertex based on its spherical coordinates
+ const u = x / subdivisionsAxis;
+ const v = y / subdivisionsHeight;
+ const theta = longRange * u + opt_startLongitudeInRadians;
+ const phi = latRange * v + opt_startLatitudeInRadians;
+ const sinTheta = Math.sin(theta);
+ const cosTheta = Math.cos(theta);
+ const sinPhi = Math.sin(phi);
+ const cosPhi = Math.cos(phi);
+ const ux = cosTheta * sinPhi;
+ const uy = cosPhi;
+ const uz = sinTheta * sinPhi;
+ positions.push(radius * ux, radius * uy, radius * uz);
+ normals.push(ux, uy, uz);
+ texcoords.push(1 - u, v);
+ }
+ }
+
+ const numVertsAround = subdivisionsAxis + 1;
+ const indices = createAugmentedTypedArray(3, subdivisionsAxis * subdivisionsHeight * 2, Uint16Array);
+ for (let x = 0; x < subdivisionsAxis; x++) { // eslint-disable-line
+ for (let y = 0; y < subdivisionsHeight; y++) { // eslint-disable-line
+ // Make triangle 1 of quad.
+ indices.push(
+ (y + 0) * numVertsAround + x,
+ (y + 0) * numVertsAround + x + 1,
+ (y + 1) * numVertsAround + x);
+
+ // Make triangle 2 of quad.
+ indices.push(
+ (y + 1) * numVertsAround + x,
+ (y + 0) * numVertsAround + x + 1,
+ (y + 1) * numVertsAround + x + 1);
+ }
+ }
+
+ return {
+ position: positions,
+ normal: normals,
+ texcoord: texcoords,
+ indices: indices,
+ };
+}
+
+/**
+ * Array of the indices of corners of each face of a cube.
+ * @type {Array.}
+ * @private
+ */
+const CUBE_FACE_INDICES = [
+ [3, 7, 5, 1], // right
+ [6, 2, 0, 4], // left
+ [6, 7, 3, 2], // ??
+ [0, 1, 5, 4], // ??
+ [7, 6, 4, 5], // front
+ [2, 3, 1, 0], // back
+];
+
+/**
+ * Creates a BufferInfo for a cube.
+ *
+ * The cube is created around the origin. (-size / 2, size / 2).
+ *
+ * @param {WebGLRenderingContext} gl The WebGLRenderingContext.
+ * @param {number} [size] width, height and depth of the cube.
+ * @return {module:twgl.BufferInfo} The created BufferInfo.
+ * @memberOf module:twgl/primitives
+ * @function createCubeBufferInfo
+ */
+
+/**
+ * Creates the buffers and indices for a cube.
+ *
+ * The cube is created around the origin. (-size / 2, size / 2).
+ *
+ * @param {WebGLRenderingContext} gl The WebGLRenderingContext.
+ * @param {number} [size] width, height and depth of the cube.
+ * @return {Object.} The created buffers.
+ * @memberOf module:twgl/primitives
+ * @function createCubeBuffers
+ */
+
+/**
+ * Creates the vertices and indices for a cube.
+ *
+ * The cube is created around the origin. (-size / 2, size / 2).
+ *
+ * @param {number} [size] width, height and depth of the cube.
+ * @return {Object.} The created vertices.
+ * @memberOf module:twgl/primitives
+ */
+function createCubeVertices(size) {
+ size = size || 1;
+ const k = size / 2;
+
+ const cornerVertices = [
+ [-k, -k, -k],
+ [+k, -k, -k],
+ [-k, +k, -k],
+ [+k, +k, -k],
+ [-k, -k, +k],
+ [+k, -k, +k],
+ [-k, +k, +k],
+ [+k, +k, +k],
+ ];
+
+ const faceNormals = [
+ [+1, +0, +0],
+ [-1, +0, +0],
+ [+0, +1, +0],
+ [+0, -1, +0],
+ [+0, +0, +1],
+ [+0, +0, -1],
+ ];
+
+ const uvCoords = [
+ [1, 0],
+ [0, 0],
+ [0, 1],
+ [1, 1],
+ ];
+
+ const numVertices = 6 * 4;
+ const positions = createAugmentedTypedArray(3, numVertices);
+ const normals = createAugmentedTypedArray(3, numVertices);
+ const texcoords = createAugmentedTypedArray(2 , numVertices);
+ const indices = createAugmentedTypedArray(3, 6 * 2, Uint16Array);
+
+ for (let f = 0; f < 6; ++f) {
+ const faceIndices = CUBE_FACE_INDICES[f];
+ for (let v = 0; v < 4; ++v) {
+ const position = cornerVertices[faceIndices[v]];
+ const normal = faceNormals[f];
+ const uv = uvCoords[v];
+
+ // Each face needs all four vertices because the normals and texture
+ // coordinates are not all the same.
+ positions.push(position);
+ normals.push(normal);
+ texcoords.push(uv);
+
+ }
+ // Two triangles make a square face.
+ const offset = 4 * f;
+ indices.push(offset + 0, offset + 1, offset + 2);
+ indices.push(offset + 0, offset + 2, offset + 3);
+ }
+
+ return {
+ position: positions,
+ normal: normals,
+ texcoord: texcoords,
+ indices: indices,
+ };
+}
+
+/**
+ * Creates a BufferInfo for a truncated cone, which is like a cylinder
+ * except that it has different top and bottom radii. A truncated cone
+ * can also be used to create cylinders and regular cones. The
+ * truncated cone will be created centered about the origin, with the
+ * y axis as its vertical axis.
+ *
+ * @param {WebGLRenderingContext} gl The WebGLRenderingContext.
+ * @param {number} bottomRadius Bottom radius of truncated cone.
+ * @param {number} topRadius Top radius of truncated cone.
+ * @param {number} height Height of truncated cone.
+ * @param {number} radialSubdivisions The number of subdivisions around the
+ * truncated cone.
+ * @param {number} verticalSubdivisions The number of subdivisions down the
+ * truncated cone.
+ * @param {boolean} [opt_topCap] Create top cap. Default = true.
+ * @param {boolean} [opt_bottomCap] Create bottom cap. Default = true.
+ * @return {module:twgl.BufferInfo} The created cone BufferInfo.
+ * @memberOf module:twgl/primitives
+ * @function createTruncatedConeBufferInfo
+ */
+
+/**
+ * Creates buffers for a truncated cone, which is like a cylinder
+ * except that it has different top and bottom radii. A truncated cone
+ * can also be used to create cylinders and regular cones. The
+ * truncated cone will be created centered about the origin, with the
+ * y axis as its vertical axis.
+ *
+ * @param {WebGLRenderingContext} gl The WebGLRenderingContext.
+ * @param {number} bottomRadius Bottom radius of truncated cone.
+ * @param {number} topRadius Top radius of truncated cone.
+ * @param {number} height Height of truncated cone.
+ * @param {number} radialSubdivisions The number of subdivisions around the
+ * truncated cone.
+ * @param {number} verticalSubdivisions The number of subdivisions down the
+ * truncated cone.
+ * @param {boolean} [opt_topCap] Create top cap. Default = true.
+ * @param {boolean} [opt_bottomCap] Create bottom cap. Default = true.
+ * @return {Object.} The created cone buffers.
+ * @memberOf module:twgl/primitives
+ * @function createTruncatedConeBuffers
+ */
+
+/**
+ * Creates vertices for a truncated cone, which is like a cylinder
+ * except that it has different top and bottom radii. A truncated cone
+ * can also be used to create cylinders and regular cones. The
+ * truncated cone will be created centered about the origin, with the
+ * y axis as its vertical axis. .
+ *
+ * @param {number} bottomRadius Bottom radius of truncated cone.
+ * @param {number} topRadius Top radius of truncated cone.
+ * @param {number} height Height of truncated cone.
+ * @param {number} radialSubdivisions The number of subdivisions around the
+ * truncated cone.
+ * @param {number} verticalSubdivisions The number of subdivisions down the
+ * truncated cone.
+ * @param {boolean} [opt_topCap] Create top cap. Default = true.
+ * @param {boolean} [opt_bottomCap] Create bottom cap. Default = true.
+ * @return {Object.} The created cone vertices.
+ * @memberOf module:twgl/primitives
+ */
+function createTruncatedConeVertices(
+ bottomRadius,
+ topRadius,
+ height,
+ radialSubdivisions,
+ verticalSubdivisions,
+ opt_topCap,
+ opt_bottomCap) {
+ if (radialSubdivisions < 3) {
+ throw new Error('radialSubdivisions must be 3 or greater');
+ }
+
+ if (verticalSubdivisions < 1) {
+ throw new Error('verticalSubdivisions must be 1 or greater');
+ }
+
+ const topCap = (opt_topCap === undefined) ? true : opt_topCap;
+ const bottomCap = (opt_bottomCap === undefined) ? true : opt_bottomCap;
+
+ const extra = (topCap ? 2 : 0) + (bottomCap ? 2 : 0);
+
+ const numVertices = (radialSubdivisions + 1) * (verticalSubdivisions + 1 + extra);
+ const positions = createAugmentedTypedArray(3, numVertices);
+ const normals = createAugmentedTypedArray(3, numVertices);
+ const texcoords = createAugmentedTypedArray(2, numVertices);
+ const indices = createAugmentedTypedArray(3, radialSubdivisions * (verticalSubdivisions + extra / 2) * 2, Uint16Array);
+
+ const vertsAroundEdge = radialSubdivisions + 1;
+
+ // The slant of the cone is constant across its surface
+ const slant = Math.atan2(bottomRadius - topRadius, height);
+ const cosSlant = Math.cos(slant);
+ const sinSlant = Math.sin(slant);
+
+ const start = topCap ? -2 : 0;
+ const end = verticalSubdivisions + (bottomCap ? 2 : 0);
+
+ for (let yy = start; yy <= end; ++yy) {
+ let v = yy / verticalSubdivisions;
+ let y = height * v;
+ let ringRadius;
+ if (yy < 0) {
+ y = 0;
+ v = 1;
+ ringRadius = bottomRadius;
+ } else if (yy > verticalSubdivisions) {
+ y = height;
+ v = 1;
+ ringRadius = topRadius;
+ } else {
+ ringRadius = bottomRadius +
+ (topRadius - bottomRadius) * (yy / verticalSubdivisions);
+ }
+ if (yy === -2 || yy === verticalSubdivisions + 2) {
+ ringRadius = 0;
+ v = 0;
+ }
+ y -= height / 2;
+ for (let ii = 0; ii < vertsAroundEdge; ++ii) {
+ const sin = Math.sin(ii * Math.PI * 2 / radialSubdivisions);
+ const cos = Math.cos(ii * Math.PI * 2 / radialSubdivisions);
+ positions.push(sin * ringRadius, y, cos * ringRadius);
+ if (yy < 0) {
+ normals.push(0, -1, 0);
+ } else if (yy > verticalSubdivisions) {
+ normals.push(0, 1, 0);
+ } else if (ringRadius === 0.0) {
+ normals.push(0, 0, 0);
+ } else {
+ normals.push(sin * cosSlant, sinSlant, cos * cosSlant);
+ }
+ texcoords.push((ii / radialSubdivisions), 1 - v);
+ }
+ }
+
+ for (let yy = 0; yy < verticalSubdivisions + extra; ++yy) { // eslint-disable-line
+ if (yy === 1 && topCap || yy === verticalSubdivisions + extra - 2 && bottomCap) {
+ continue;
+ }
+ for (let ii = 0; ii < radialSubdivisions; ++ii) { // eslint-disable-line
+ indices.push(vertsAroundEdge * (yy + 0) + 0 + ii,
+ vertsAroundEdge * (yy + 0) + 1 + ii,
+ vertsAroundEdge * (yy + 1) + 1 + ii);
+ indices.push(vertsAroundEdge * (yy + 0) + 0 + ii,
+ vertsAroundEdge * (yy + 1) + 1 + ii,
+ vertsAroundEdge * (yy + 1) + 0 + ii);
+ }
+ }
+
+ return {
+ position: positions,
+ normal: normals,
+ texcoord: texcoords,
+ indices: indices,
+ };
+}
+
+/**
+ * Expands RLE data
+ * @param {number[]} rleData data in format of run-length, x, y, z, run-length, x, y, z
+ * @param {number[]} [padding] value to add each entry with.
+ * @return {number[]} the expanded rleData
+ * @private
+ */
+function expandRLEData(rleData, padding) {
+ padding = padding || [];
+ const data = [];
+ for (let ii = 0; ii < rleData.length; ii += 4) {
+ const runLength = rleData[ii];
+ const element = rleData.slice(ii + 1, ii + 4);
+ element.push.apply(element, padding);
+ for (let jj = 0; jj < runLength; ++jj) {
+ data.push.apply(data, element);
+ }
+ }
+ return data;
+}
+
+/**
+ * Creates 3D 'F' BufferInfo.
+ * An 'F' is useful because you can easily tell which way it is oriented.
+ * The created 'F' has position, normal, texcoord, and color buffers.
+ *
+ * @param {WebGLRenderingContext} gl The WebGLRenderingContext.
+ * @return {module:twgl.BufferInfo} The created BufferInfo.
+ * @memberOf module:twgl/primitives
+ * @function create3DFBufferInfo
+ */
+
+/**
+ * Creates 3D 'F' buffers.
+ * An 'F' is useful because you can easily tell which way it is oriented.
+ * The created 'F' has position, normal, texcoord, and color buffers.
+ *
+ * @param {WebGLRenderingContext} gl The WebGLRenderingContext.
+ * @return {Object.} The created buffers.
+ * @memberOf module:twgl/primitives
+ * @function create3DFBuffers
+ */
+
+/**
+ * Creates 3D 'F' vertices.
+ * An 'F' is useful because you can easily tell which way it is oriented.
+ * The created 'F' has position, normal, texcoord, and color arrays.
+ *
+ * @return {Object.} The created vertices.
+ * @memberOf module:twgl/primitives
+ */
+function create3DFVertices() {
+
+ const positions = [
+ // left column front
+ 0, 0, 0,
+ 0, 150, 0,
+ 30, 0, 0,
+ 0, 150, 0,
+ 30, 150, 0,
+ 30, 0, 0,
+
+ // top rung front
+ 30, 0, 0,
+ 30, 30, 0,
+ 100, 0, 0,
+ 30, 30, 0,
+ 100, 30, 0,
+ 100, 0, 0,
+
+ // middle rung front
+ 30, 60, 0,
+ 30, 90, 0,
+ 67, 60, 0,
+ 30, 90, 0,
+ 67, 90, 0,
+ 67, 60, 0,
+
+ // left column back
+ 0, 0, 30,
+ 30, 0, 30,
+ 0, 150, 30,
+ 0, 150, 30,
+ 30, 0, 30,
+ 30, 150, 30,
+
+ // top rung back
+ 30, 0, 30,
+ 100, 0, 30,
+ 30, 30, 30,
+ 30, 30, 30,
+ 100, 0, 30,
+ 100, 30, 30,
+
+ // middle rung back
+ 30, 60, 30,
+ 67, 60, 30,
+ 30, 90, 30,
+ 30, 90, 30,
+ 67, 60, 30,
+ 67, 90, 30,
+
+ // top
+ 0, 0, 0,
+ 100, 0, 0,
+ 100, 0, 30,
+ 0, 0, 0,
+ 100, 0, 30,
+ 0, 0, 30,
+
+ // top rung front
+ 100, 0, 0,
+ 100, 30, 0,
+ 100, 30, 30,
+ 100, 0, 0,
+ 100, 30, 30,
+ 100, 0, 30,
+
+ // under top rung
+ 30, 30, 0,
+ 30, 30, 30,
+ 100, 30, 30,
+ 30, 30, 0,
+ 100, 30, 30,
+ 100, 30, 0,
+
+ // between top rung and middle
+ 30, 30, 0,
+ 30, 60, 30,
+ 30, 30, 30,
+ 30, 30, 0,
+ 30, 60, 0,
+ 30, 60, 30,
+
+ // top of middle rung
+ 30, 60, 0,
+ 67, 60, 30,
+ 30, 60, 30,
+ 30, 60, 0,
+ 67, 60, 0,
+ 67, 60, 30,
+
+ // front of middle rung
+ 67, 60, 0,
+ 67, 90, 30,
+ 67, 60, 30,
+ 67, 60, 0,
+ 67, 90, 0,
+ 67, 90, 30,
+
+ // bottom of middle rung.
+ 30, 90, 0,
+ 30, 90, 30,
+ 67, 90, 30,
+ 30, 90, 0,
+ 67, 90, 30,
+ 67, 90, 0,
+
+ // front of bottom
+ 30, 90, 0,
+ 30, 150, 30,
+ 30, 90, 30,
+ 30, 90, 0,
+ 30, 150, 0,
+ 30, 150, 30,
+
+ // bottom
+ 0, 150, 0,
+ 0, 150, 30,
+ 30, 150, 30,
+ 0, 150, 0,
+ 30, 150, 30,
+ 30, 150, 0,
+
+ // left side
+ 0, 0, 0,
+ 0, 0, 30,
+ 0, 150, 30,
+ 0, 0, 0,
+ 0, 150, 30,
+ 0, 150, 0,
+ ];
+
+ const texcoords = [
+ // left column front
+ 0.22, 0.19,
+ 0.22, 0.79,
+ 0.34, 0.19,
+ 0.22, 0.79,
+ 0.34, 0.79,
+ 0.34, 0.19,
+
+ // top rung front
+ 0.34, 0.19,
+ 0.34, 0.31,
+ 0.62, 0.19,
+ 0.34, 0.31,
+ 0.62, 0.31,
+ 0.62, 0.19,
+
+ // middle rung front
+ 0.34, 0.43,
+ 0.34, 0.55,
+ 0.49, 0.43,
+ 0.34, 0.55,
+ 0.49, 0.55,
+ 0.49, 0.43,
+
+ // left column back
+ 0, 0,
+ 1, 0,
+ 0, 1,
+ 0, 1,
+ 1, 0,
+ 1, 1,
+
+ // top rung back
+ 0, 0,
+ 1, 0,
+ 0, 1,
+ 0, 1,
+ 1, 0,
+ 1, 1,
+
+ // middle rung back
+ 0, 0,
+ 1, 0,
+ 0, 1,
+ 0, 1,
+ 1, 0,
+ 1, 1,
+
+ // top
+ 0, 0,
+ 1, 0,
+ 1, 1,
+ 0, 0,
+ 1, 1,
+ 0, 1,
+
+ // top rung front
+ 0, 0,
+ 1, 0,
+ 1, 1,
+ 0, 0,
+ 1, 1,
+ 0, 1,
+
+ // under top rung
+ 0, 0,
+ 0, 1,
+ 1, 1,
+ 0, 0,
+ 1, 1,
+ 1, 0,
+
+ // between top rung and middle
+ 0, 0,
+ 1, 1,
+ 0, 1,
+ 0, 0,
+ 1, 0,
+ 1, 1,
+
+ // top of middle rung
+ 0, 0,
+ 1, 1,
+ 0, 1,
+ 0, 0,
+ 1, 0,
+ 1, 1,
+
+ // front of middle rung
+ 0, 0,
+ 1, 1,
+ 0, 1,
+ 0, 0,
+ 1, 0,
+ 1, 1,
+
+ // bottom of middle rung.
+ 0, 0,
+ 0, 1,
+ 1, 1,
+ 0, 0,
+ 1, 1,
+ 1, 0,
+
+ // front of bottom
+ 0, 0,
+ 1, 1,
+ 0, 1,
+ 0, 0,
+ 1, 0,
+ 1, 1,
+
+ // bottom
+ 0, 0,
+ 0, 1,
+ 1, 1,
+ 0, 0,
+ 1, 1,
+ 1, 0,
+
+ // left side
+ 0, 0,
+ 0, 1,
+ 1, 1,
+ 0, 0,
+ 1, 1,
+ 1, 0,
+ ];
+
+ const normals = expandRLEData([
+ // left column front
+ // top rung front
+ // middle rung front
+ 18, 0, 0, 1,
+
+ // left column back
+ // top rung back
+ // middle rung back
+ 18, 0, 0, -1,
+
+ // top
+ 6, 0, 1, 0,
+
+ // top rung front
+ 6, 1, 0, 0,
+
+ // under top rung
+ 6, 0, -1, 0,
+
+ // between top rung and middle
+ 6, 1, 0, 0,
+
+ // top of middle rung
+ 6, 0, 1, 0,
+
+ // front of middle rung
+ 6, 1, 0, 0,
+
+ // bottom of middle rung.
+ 6, 0, -1, 0,
+
+ // front of bottom
+ 6, 1, 0, 0,
+
+ // bottom
+ 6, 0, -1, 0,
+
+ // left side
+ 6, -1, 0, 0,
+ ]);
+
+ const colors = expandRLEData([
+ // left column front
+ // top rung front
+ // middle rung front
+ 18, 200, 70, 120,
+
+ // left column back
+ // top rung back
+ // middle rung back
+ 18, 80, 70, 200,
+
+ // top
+ 6, 70, 200, 210,
+
+ // top rung front
+ 6, 200, 200, 70,
+
+ // under top rung
+ 6, 210, 100, 70,
+
+ // between top rung and middle
+ 6, 210, 160, 70,
+
+ // top of middle rung
+ 6, 70, 180, 210,
+
+ // front of middle rung
+ 6, 100, 70, 210,
+
+ // bottom of middle rung.
+ 6, 76, 210, 100,
+
+ // front of bottom
+ 6, 140, 210, 80,
+
+ // bottom
+ 6, 90, 130, 110,
+
+ // left side
+ 6, 160, 160, 220,
+ ], [255]);
+
+ const numVerts = positions.length / 3;
+
+ const arrays = {
+ position: createAugmentedTypedArray(3, numVerts),
+ texcoord: createAugmentedTypedArray(2, numVerts),
+ normal: createAugmentedTypedArray(3, numVerts),
+ color: createAugmentedTypedArray(4, numVerts, Uint8Array),
+ indices: createAugmentedTypedArray(3, numVerts / 3, Uint16Array),
+ };
+
+ arrays.position.push(positions);
+ arrays.texcoord.push(texcoords);
+ arrays.normal.push(normals);
+ arrays.color.push(colors);
+
+ for (let ii = 0; ii < numVerts; ++ii) {
+ arrays.indices.push(ii);
+ }
+
+ return arrays;
+}
+
+/**
+ * Creates crescent BufferInfo.
+ *
+ * @param {WebGLRenderingContext} gl The WebGLRenderingContext.
+ * @param {number} verticalRadius The vertical radius of the crescent.
+ * @param {number} outerRadius The outer radius of the crescent.
+ * @param {number} innerRadius The inner radius of the crescent.
+ * @param {number} thickness The thickness of the crescent.
+ * @param {number} subdivisionsDown number of steps around the crescent.
+ * @param {number} [startOffset] Where to start arc. Default 0.
+ * @param {number} [endOffset] Where to end arg. Default 1.
+ * @return {module:twgl.BufferInfo} The created BufferInfo.
+ * @memberOf module:twgl/primitives
+ * @function createCresentBufferInfo
+ */
+
+/**
+ * Creates crescent buffers.
+ *
+ * @param {WebGLRenderingContext} gl The WebGLRenderingContext.
+ * @param {number} verticalRadius The vertical radius of the crescent.
+ * @param {number} outerRadius The outer radius of the crescent.
+ * @param {number} innerRadius The inner radius of the crescent.
+ * @param {number} thickness The thickness of the crescent.
+ * @param {number} subdivisionsDown number of steps around the crescent.
+ * @param {number} [startOffset] Where to start arc. Default 0.
+ * @param {number} [endOffset] Where to end arg. Default 1.
+ * @return {Object.} The created buffers.
+ * @memberOf module:twgl/primitives
+ * @function createCresentBuffers
+ */
+
+/**
+ * Creates crescent vertices.
+ *
+ * @param {number} verticalRadius The vertical radius of the crescent.
+ * @param {number} outerRadius The outer radius of the crescent.
+ * @param {number} innerRadius The inner radius of the crescent.
+ * @param {number} thickness The thickness of the crescent.
+ * @param {number} subdivisionsDown number of steps around the crescent.
+ * @param {number} [startOffset] Where to start arc. Default 0.
+ * @param {number} [endOffset] Where to end arg. Default 1.
+ * @return {Object.} The created vertices.
+ * @memberOf module:twgl/primitives
+ * @function createCresentBuffers
+ */
+
+/**
+ * Creates crescent BufferInfo.
+ *
+ * @param {WebGLRenderingContext} gl The WebGLRenderingContext.
+ * @param {number} verticalRadius The vertical radius of the crescent.
+ * @param {number} outerRadius The outer radius of the crescent.
+ * @param {number} innerRadius The inner radius of the crescent.
+ * @param {number} thickness The thickness of the crescent.
+ * @param {number} subdivisionsDown number of steps around the crescent.
+ * @param {number} [startOffset] Where to start arc. Default 0.
+ * @param {number} [endOffset] Where to end arg. Default 1.
+ * @return {module:twgl.BufferInfo} The created BufferInfo.
+ * @memberOf module:twgl/primitives
+ * @function createCrescentBufferInfo
+ */
+
+/**
+ * Creates crescent buffers.
+ *
+ * @param {WebGLRenderingContext} gl The WebGLRenderingContext.
+ * @param {number} verticalRadius The vertical radius of the crescent.
+ * @param {number} outerRadius The outer radius of the crescent.
+ * @param {number} innerRadius The inner radius of the crescent.
+ * @param {number} thickness The thickness of the crescent.
+ * @param {number} subdivisionsDown number of steps around the crescent.
+ * @param {number} [startOffset] Where to start arc. Default 0.
+ * @param {number} [endOffset] Where to end arg. Default 1.
+ * @return {Object.} The created buffers.
+ * @memberOf module:twgl/primitives
+ * @function createCrescentBuffers
+ */
+
+/**
+ * Creates crescent vertices.
+ *
+ * @param {number} verticalRadius The vertical radius of the crescent.
+ * @param {number} outerRadius The outer radius of the crescent.
+ * @param {number} innerRadius The inner radius of the crescent.
+ * @param {number} thickness The thickness of the crescent.
+ * @param {number} subdivisionsDown number of steps around the crescent.
+ * @param {number} [startOffset] Where to start arc. Default 0.
+ * @param {number} [endOffset] Where to end arg. Default 1.
+ * @return {Object.} The created vertices.
+ * @memberOf module:twgl/primitives
+ */
+ function createCrescentVertices(
+ verticalRadius,
+ outerRadius,
+ innerRadius,
+ thickness,
+ subdivisionsDown,
+ startOffset,
+ endOffset) {
+ if (subdivisionsDown <= 0) {
+ throw new Error('subdivisionDown must be > 0');
+ }
+
+ startOffset = startOffset || 0;
+ endOffset = endOffset || 1;
+
+ const subdivisionsThick = 2;
+
+ const offsetRange = endOffset - startOffset;
+ const numVertices = (subdivisionsDown + 1) * 2 * (2 + subdivisionsThick);
+ const positions = createAugmentedTypedArray(3, numVertices);
+ const normals = createAugmentedTypedArray(3, numVertices);
+ const texcoords = createAugmentedTypedArray(2, numVertices);
+
+ function lerp(a, b, s) {
+ return a + (b - a) * s;
+ }
+
+ function createArc(arcRadius, x, normalMult, normalAdd, uMult, uAdd) {
+ for (let z = 0; z <= subdivisionsDown; z++) {
+ const uBack = x / (subdivisionsThick - 1);
+ const v = z / subdivisionsDown;
+ const xBack = (uBack - 0.5) * 2;
+ const angle = (startOffset + (v * offsetRange)) * Math.PI;
+ const s = Math.sin(angle);
+ const c = Math.cos(angle);
+ const radius = lerp(verticalRadius, arcRadius, s);
+ const px = xBack * thickness;
+ const py = c * verticalRadius;
+ const pz = s * radius;
+ positions.push(px, py, pz);
+ const n = add(multiply$1([0, s, c], normalMult), normalAdd);
+ normals.push(n);
+ texcoords.push(uBack * uMult + uAdd, v);
+ }
+ }
+
+ // Generate the individual vertices in our vertex buffer.
+ for (let x = 0; x < subdivisionsThick; x++) {
+ const uBack = (x / (subdivisionsThick - 1) - 0.5) * 2;
+ createArc(outerRadius, x, [1, 1, 1], [0, 0, 0], 1, 0);
+ createArc(outerRadius, x, [0, 0, 0], [uBack, 0, 0], 0, 0);
+ createArc(innerRadius, x, [1, 1, 1], [0, 0, 0], 1, 0);
+ createArc(innerRadius, x, [0, 0, 0], [uBack, 0, 0], 0, 1);
+ }
+
+ // Do outer surface.
+ const indices = createAugmentedTypedArray(3, (subdivisionsDown * 2) * (2 + subdivisionsThick), Uint16Array);
+
+ function createSurface(leftArcOffset, rightArcOffset) {
+ for (let z = 0; z < subdivisionsDown; ++z) {
+ // Make triangle 1 of quad.
+ indices.push(
+ leftArcOffset + z + 0,
+ leftArcOffset + z + 1,
+ rightArcOffset + z + 0);
+
+ // Make triangle 2 of quad.
+ indices.push(
+ leftArcOffset + z + 1,
+ rightArcOffset + z + 1,
+ rightArcOffset + z + 0);
+ }
+ }
+
+ const numVerticesDown = subdivisionsDown + 1;
+ // front
+ createSurface(numVerticesDown * 0, numVerticesDown * 4);
+ // right
+ createSurface(numVerticesDown * 5, numVerticesDown * 7);
+ // back
+ createSurface(numVerticesDown * 6, numVerticesDown * 2);
+ // left
+ createSurface(numVerticesDown * 3, numVerticesDown * 1);
+
+ return {
+ position: positions,
+ normal: normals,
+ texcoord: texcoords,
+ indices: indices,
+ };
+}
+
+/**
+ * Creates cylinder BufferInfo. The cylinder will be created around the origin
+ * along the y-axis.
+ *
+ * @param {WebGLRenderingContext} gl The WebGLRenderingContext.
+ * @param {number} radius Radius of cylinder.
+ * @param {number} height Height of cylinder.
+ * @param {number} radialSubdivisions The number of subdivisions around the cylinder.
+ * @param {number} verticalSubdivisions The number of subdivisions down the cylinder.
+ * @param {boolean} [topCap] Create top cap. Default = true.
+ * @param {boolean} [bottomCap] Create bottom cap. Default = true.
+ * @return {module:twgl.BufferInfo} The created BufferInfo.
+ * @memberOf module:twgl/primitives
+ * @function createCylinderBufferInfo
+ */
+
+ /**
+ * Creates cylinder buffers. The cylinder will be created around the origin
+ * along the y-axis.
+ *
+ * @param {WebGLRenderingContext} gl The WebGLRenderingContext.
+ * @param {number} radius Radius of cylinder.
+ * @param {number} height Height of cylinder.
+ * @param {number} radialSubdivisions The number of subdivisions around the cylinder.
+ * @param {number} verticalSubdivisions The number of subdivisions down the cylinder.
+ * @param {boolean} [topCap] Create top cap. Default = true.
+ * @param {boolean} [bottomCap] Create bottom cap. Default = true.
+ * @return {Object.} The created buffers.
+ * @memberOf module:twgl/primitives
+ * @function createCylinderBuffers
+ */
+
+ /**
+ * Creates cylinder vertices. The cylinder will be created around the origin
+ * along the y-axis.
+ *
+ * @param {number} radius Radius of cylinder.
+ * @param {number} height Height of cylinder.
+ * @param {number} radialSubdivisions The number of subdivisions around the cylinder.
+ * @param {number} verticalSubdivisions The number of subdivisions down the cylinder.
+ * @param {boolean} [topCap] Create top cap. Default = true.
+ * @param {boolean} [bottomCap] Create bottom cap. Default = true.
+ * @return {Object.} The created vertices.
+ * @memberOf module:twgl/primitives
+ */
+function createCylinderVertices(
+ radius,
+ height,
+ radialSubdivisions,
+ verticalSubdivisions,
+ topCap,
+ bottomCap) {
+ return createTruncatedConeVertices(
+ radius,
+ radius,
+ height,
+ radialSubdivisions,
+ verticalSubdivisions,
+ topCap,
+ bottomCap);
+}
+
+/**
+ * Creates BufferInfo for a torus
+ *
+ * @param {WebGLRenderingContext} gl The WebGLRenderingContext.
+ * @param {number} radius radius of center of torus circle.
+ * @param {number} thickness radius of torus ring.
+ * @param {number} radialSubdivisions The number of subdivisions around the torus.
+ * @param {number} bodySubdivisions The number of subdivisions around the body torus.
+ * @param {boolean} [startAngle] start angle in radians. Default = 0.
+ * @param {boolean} [endAngle] end angle in radians. Default = Math.PI * 2.
+ * @return {module:twgl.BufferInfo} The created BufferInfo.
+ * @memberOf module:twgl/primitives
+ * @function createTorusBufferInfo
+ */
+
+/**
+ * Creates buffers for a torus
+ *
+ * @param {WebGLRenderingContext} gl The WebGLRenderingContext.
+ * @param {number} radius radius of center of torus circle.
+ * @param {number} thickness radius of torus ring.
+ * @param {number} radialSubdivisions The number of subdivisions around the torus.
+ * @param {number} bodySubdivisions The number of subdivisions around the body torus.
+ * @param {boolean} [startAngle] start angle in radians. Default = 0.
+ * @param {boolean} [endAngle] end angle in radians. Default = Math.PI * 2.
+ * @return {Object.} The created buffers.
+ * @memberOf module:twgl/primitives
+ * @function createTorusBuffers
+ */
+
+/**
+ * Creates vertices for a torus
+ *
+ * @param {number} radius radius of center of torus circle.
+ * @param {number} thickness radius of torus ring.
+ * @param {number} radialSubdivisions The number of subdivisions around the torus.
+ * @param {number} bodySubdivisions The number of subdivisions around the body torus.
+ * @param {boolean} [startAngle] start angle in radians. Default = 0.
+ * @param {boolean} [endAngle] end angle in radians. Default = Math.PI * 2.
+ * @return {Object.} The created vertices.
+ * @memberOf module:twgl/primitives
+ */
+function createTorusVertices(
+ radius,
+ thickness,
+ radialSubdivisions,
+ bodySubdivisions,
+ startAngle,
+ endAngle) {
+ if (radialSubdivisions < 3) {
+ throw new Error('radialSubdivisions must be 3 or greater');
+ }
+
+ if (bodySubdivisions < 3) {
+ throw new Error('verticalSubdivisions must be 3 or greater');
+ }
+
+ startAngle = startAngle || 0;
+ endAngle = endAngle || Math.PI * 2;
+ const range = endAngle - startAngle;
+
+ const radialParts = radialSubdivisions + 1;
+ const bodyParts = bodySubdivisions + 1;
+ const numVertices = radialParts * bodyParts;
+ const positions = createAugmentedTypedArray(3, numVertices);
+ const normals = createAugmentedTypedArray(3, numVertices);
+ const texcoords = createAugmentedTypedArray(2, numVertices);
+ const indices = createAugmentedTypedArray(3, (radialSubdivisions) * (bodySubdivisions) * 2, Uint16Array);
+
+ for (let slice = 0; slice < bodyParts; ++slice) {
+ const v = slice / bodySubdivisions;
+ const sliceAngle = v * Math.PI * 2;
+ const sliceSin = Math.sin(sliceAngle);
+ const ringRadius = radius + sliceSin * thickness;
+ const ny = Math.cos(sliceAngle);
+ const y = ny * thickness;
+ for (let ring = 0; ring < radialParts; ++ring) {
+ const u = ring / radialSubdivisions;
+ const ringAngle = startAngle + u * range;
+ const xSin = Math.sin(ringAngle);
+ const zCos = Math.cos(ringAngle);
+ const x = xSin * ringRadius;
+ const z = zCos * ringRadius;
+ const nx = xSin * sliceSin;
+ const nz = zCos * sliceSin;
+ positions.push(x, y, z);
+ normals.push(nx, ny, nz);
+ texcoords.push(u, 1 - v);
+ }
+ }
+
+ for (let slice = 0; slice < bodySubdivisions; ++slice) { // eslint-disable-line
+ for (let ring = 0; ring < radialSubdivisions; ++ring) { // eslint-disable-line
+ const nextRingIndex = 1 + ring;
+ const nextSliceIndex = 1 + slice;
+ indices.push(radialParts * slice + ring,
+ radialParts * nextSliceIndex + ring,
+ radialParts * slice + nextRingIndex);
+ indices.push(radialParts * nextSliceIndex + ring,
+ radialParts * nextSliceIndex + nextRingIndex,
+ radialParts * slice + nextRingIndex);
+ }
+ }
+
+ return {
+ position: positions,
+ normal: normals,
+ texcoord: texcoords,
+ indices: indices,
+ };
+}
+
+
+/**
+ * Creates a disc BufferInfo. The disc will be in the xz plane, centered at
+ * the origin. When creating, at least 3 divisions, or pie
+ * pieces, need to be specified, otherwise the triangles making
+ * up the disc will be degenerate. You can also specify the
+ * number of radial pieces `stacks`. A value of 1 for
+ * stacks will give you a simple disc of pie pieces. If you
+ * want to create an annulus you can set `innerRadius` to a
+ * value > 0. Finally, `stackPower` allows you to have the widths
+ * increase or decrease as you move away from the center. This
+ * is particularly useful when using the disc as a ground plane
+ * with a fixed camera such that you don't need the resolution
+ * of small triangles near the perimeter. For example, a value
+ * of 2 will produce stacks whose outside radius increases with
+ * the square of the stack index. A value of 1 will give uniform
+ * stacks.
+ *
+ * @param {WebGLRenderingContext} gl The WebGLRenderingContext.
+ * @param {number} radius Radius of the ground plane.
+ * @param {number} divisions Number of triangles in the ground plane (at least 3).
+ * @param {number} [stacks] Number of radial divisions (default=1).
+ * @param {number} [innerRadius] Default 0.
+ * @param {number} [stackPower] Power to raise stack size to for decreasing width.
+ * @return {module:twgl.BufferInfo} The created BufferInfo.
+ * @memberOf module:twgl/primitives
+ * @function createDiscBufferInfo
+ */
+
+/**
+ * Creates disc buffers. The disc will be in the xz plane, centered at
+ * the origin. When creating, at least 3 divisions, or pie
+ * pieces, need to be specified, otherwise the triangles making
+ * up the disc will be degenerate. You can also specify the
+ * number of radial pieces `stacks`. A value of 1 for
+ * stacks will give you a simple disc of pie pieces. If you
+ * want to create an annulus you can set `innerRadius` to a
+ * value > 0. Finally, `stackPower` allows you to have the widths
+ * increase or decrease as you move away from the center. This
+ * is particularly useful when using the disc as a ground plane
+ * with a fixed camera such that you don't need the resolution
+ * of small triangles near the perimeter. For example, a value
+ * of 2 will produce stacks whose outside radius increases with
+ * the square of the stack index. A value of 1 will give uniform
+ * stacks.
+ *
+ * @param {WebGLRenderingContext} gl The WebGLRenderingContext.
+ * @param {number} radius Radius of the ground plane.
+ * @param {number} divisions Number of triangles in the ground plane (at least 3).
+ * @param {number} [stacks] Number of radial divisions (default=1).
+ * @param {number} [innerRadius] Default 0.
+ * @param {number} [stackPower] Power to raise stack size to for decreasing width.
+ * @return {Object.} The created buffers.
+ * @memberOf module:twgl/primitives
+ * @function createDiscBuffers
+ */
+
+/**
+ * Creates disc vertices. The disc will be in the xz plane, centered at
+ * the origin. When creating, at least 3 divisions, or pie
+ * pieces, need to be specified, otherwise the triangles making
+ * up the disc will be degenerate. You can also specify the
+ * number of radial pieces `stacks`. A value of 1 for
+ * stacks will give you a simple disc of pie pieces. If you
+ * want to create an annulus you can set `innerRadius` to a
+ * value > 0. Finally, `stackPower` allows you to have the widths
+ * increase or decrease as you move away from the center. This
+ * is particularly useful when using the disc as a ground plane
+ * with a fixed camera such that you don't need the resolution
+ * of small triangles near the perimeter. For example, a value
+ * of 2 will produce stacks whose outside radius increases with
+ * the square of the stack index. A value of 1 will give uniform
+ * stacks.
+ *
+ * @param {number} radius Radius of the ground plane.
+ * @param {number} divisions Number of triangles in the ground plane (at least 3).
+ * @param {number} [stacks] Number of radial divisions (default=1).
+ * @param {number} [innerRadius] Default 0.
+ * @param {number} [stackPower] Power to raise stack size to for decreasing width.
+ * @return {Object.} The created vertices.
+ * @memberOf module:twgl/primitives
+ */
+function createDiscVertices(
+ radius,
+ divisions,
+ stacks,
+ innerRadius,
+ stackPower) {
+ if (divisions < 3) {
+ throw new Error('divisions must be at least 3');
+ }
+
+ stacks = stacks ? stacks : 1;
+ stackPower = stackPower ? stackPower : 1;
+ innerRadius = innerRadius ? innerRadius : 0;
+
+ // Note: We don't share the center vertex because that would
+ // mess up texture coordinates.
+ const numVertices = (divisions + 1) * (stacks + 1);
+
+ const positions = createAugmentedTypedArray(3, numVertices);
+ const normals = createAugmentedTypedArray(3, numVertices);
+ const texcoords = createAugmentedTypedArray(2, numVertices);
+ const indices = createAugmentedTypedArray(3, stacks * divisions * 2, Uint16Array);
+
+ let firstIndex = 0;
+ const radiusSpan = radius - innerRadius;
+ const pointsPerStack = divisions + 1;
+
+ // Build the disk one stack at a time.
+ for (let stack = 0; stack <= stacks; ++stack) {
+ const stackRadius = innerRadius + radiusSpan * Math.pow(stack / stacks, stackPower);
+
+ for (let i = 0; i <= divisions; ++i) {
+ const theta = 2.0 * Math.PI * i / divisions;
+ const x = stackRadius * Math.cos(theta);
+ const z = stackRadius * Math.sin(theta);
+
+ positions.push(x, 0, z);
+ normals.push(0, 1, 0);
+ texcoords.push(1 - (i / divisions), stack / stacks);
+ if (stack > 0 && i !== divisions) {
+ // a, b, c and d are the indices of the vertices of a quad. unless
+ // the current stack is the one closest to the center, in which case
+ // the vertices a and b connect to the center vertex.
+ const a = firstIndex + (i + 1);
+ const b = firstIndex + i;
+ const c = firstIndex + i - pointsPerStack;
+ const d = firstIndex + (i + 1) - pointsPerStack;
+
+ // Make a quad of the vertices a, b, c, d.
+ indices.push(a, b, c);
+ indices.push(a, c, d);
+ }
+ }
+
+ firstIndex += divisions + 1;
+ }
+
+ return {
+ position: positions,
+ normal: normals,
+ texcoord: texcoords,
+ indices: indices,
+ };
+}
+
+/**
+ * creates a random integer between 0 and range - 1 inclusive.
+ * @param {number} range
+ * @return {number} random value between 0 and range - 1 inclusive.
+ * @private
+ */
+function randInt(range) {
+ return Math.random() * range | 0;
+}
+
+/**
+ * Used to supply random colors
+ * @callback RandomColorFunc
+ * @param {number} ndx index of triangle/quad if unindexed or index of vertex if indexed
+ * @param {number} channel 0 = red, 1 = green, 2 = blue, 3 = alpha
+ * @return {number} a number from 0 to 255
+ * @memberOf module:twgl/primitives
+ */
+
+/**
+ * @typedef {Object} RandomVerticesOptions
+ * @property {number} [vertsPerColor] Defaults to 3 for non-indexed vertices
+ * @property {module:twgl/primitives.RandomColorFunc} [rand] A function to generate random numbers
+ * @memberOf module:twgl/primitives
+ */
+
+/**
+ * Creates an augmentedTypedArray of random vertex colors.
+ * If the vertices are indexed (have an indices array) then will
+ * just make random colors. Otherwise assumes they are triangles
+ * and makes one random color for every 3 vertices.
+ * @param {Object.} vertices Vertices as returned from one of the createXXXVertices functions.
+ * @param {module:twgl/primitives.RandomVerticesOptions} [options] options.
+ * @return {Object.} same vertices as passed in with `color` added.
+ * @memberOf module:twgl/primitives
+ */
+function makeRandomVertexColors(vertices, options) {
+ options = options || {};
+ const numElements = vertices.position.numElements;
+ const vColors = createAugmentedTypedArray(4, numElements, Uint8Array);
+ const rand = options.rand || function(ndx, channel) {
+ return channel < 3 ? randInt(256) : 255;
+ };
+ vertices.color = vColors;
+ if (vertices.indices) {
+ // just make random colors if index
+ for (let ii = 0; ii < numElements; ++ii) {
+ vColors.push(rand(ii, 0), rand(ii, 1), rand(ii, 2), rand(ii, 3));
+ }
+ } else {
+ // make random colors per triangle
+ const numVertsPerColor = options.vertsPerColor || 3;
+ const numSets = numElements / numVertsPerColor;
+ for (let ii = 0; ii < numSets; ++ii) { // eslint-disable-line
+ const color = [rand(ii, 0), rand(ii, 1), rand(ii, 2), rand(ii, 3)];
+ for (let jj = 0; jj < numVertsPerColor; ++jj) {
+ vColors.push(color);
+ }
+ }
+ }
+ return vertices;
+}
+
+/**
+ * creates a function that calls fn to create vertices and then
+ * creates a buffers for them
+ * @private
+ */
+function createBufferFunc(fn) {
+ return function(gl) {
+ const arrays = fn.apply(this, Array.prototype.slice.call(arguments, 1));
+ return createBuffersFromArrays(gl, arrays);
+ };
+}
+
+/**
+ * creates a function that calls fn to create vertices and then
+ * creates a bufferInfo object for them
+ * @private
+ */
+function createBufferInfoFunc(fn) {
+ return function(gl) {
+ const arrays = fn.apply(null, Array.prototype.slice.call(arguments, 1));
+ return createBufferInfoFromArrays(gl, arrays);
+ };
+}
+
+const arraySpecPropertyNames = [
+ "numComponents",
+ "size",
+ "type",
+ "normalize",
+ "stride",
+ "offset",
+ "attrib",
+ "name",
+ "attribName",
+];
+
+/**
+ * Copy elements from one array to another
+ *
+ * @param {Array|TypedArray} src source array
+ * @param {Array|TypedArray} dst dest array
+ * @param {number} dstNdx index in dest to copy src
+ * @param {number} [offset] offset to add to copied values
+ * @private
+ */
+function copyElements(src, dst, dstNdx, offset) {
+ offset = offset || 0;
+ const length = src.length;
+ for (let ii = 0; ii < length; ++ii) {
+ dst[dstNdx + ii] = src[ii] + offset;
+ }
+}
+
+/**
+ * Creates an array of the same time
+ *
+ * @param {(number[]|ArrayBufferView|module:twgl.FullArraySpec)} srcArray array who's type to copy
+ * @param {number} length size of new array
+ * @return {(number[]|ArrayBufferView|module:twgl.FullArraySpec)} array with same type as srcArray
+ * @private
+ */
+function createArrayOfSameType(srcArray, length) {
+ const arraySrc = getArray(srcArray);
+ const newArray = new arraySrc.constructor(length);
+ let newArraySpec = newArray;
+ // If it appears to have been augmented make new one augmented
+ if (arraySrc.numComponents && arraySrc.numElements) {
+ augmentTypedArray(newArray, arraySrc.numComponents);
+ }
+ // If it was a full spec make new one a full spec
+ if (srcArray.data) {
+ newArraySpec = {
+ data: newArray,
+ };
+ copyNamedProperties(arraySpecPropertyNames, srcArray, newArraySpec);
+ }
+ return newArraySpec;
+}
+
+/**
+ * Concatenates sets of vertices
+ *
+ * Assumes the vertices match in composition. For example
+ * if one set of vertices has positions, normals, and indices
+ * all sets of vertices must have positions, normals, and indices
+ * and of the same type.
+ *
+ * Example:
+ *
+ * const cubeVertices = twgl.primitives.createCubeVertices(2);
+ * const sphereVertices = twgl.primitives.createSphereVertices(1, 10, 10);
+ * // move the sphere 2 units up
+ * twgl.primitives.reorientVertices(
+ * sphereVertices, twgl.m4.translation([0, 2, 0]));
+ * // merge the sphere with the cube
+ * const cubeSphereVertices = twgl.primitives.concatVertices(
+ * [cubeVertices, sphereVertices]);
+ * // turn them into WebGL buffers and attrib data
+ * const bufferInfo = twgl.createBufferInfoFromArrays(gl, cubeSphereVertices);
+ *
+ * @param {module:twgl.Arrays[]} arrays Array of arrays of vertices
+ * @return {module:twgl.Arrays} The concatenated vertices.
+ * @memberOf module:twgl/primitives
+ */
+function concatVertices(arrayOfArrays) {
+ const names = {};
+ let baseName;
+ // get names of all arrays.
+ // and numElements for each set of vertices
+ for (let ii = 0; ii < arrayOfArrays.length; ++ii) {
+ const arrays = arrayOfArrays[ii];
+ Object.keys(arrays).forEach(function(name) { // eslint-disable-line
+ if (!names[name]) {
+ names[name] = [];
+ }
+ if (!baseName && name !== 'indices') {
+ baseName = name;
+ }
+ const arrayInfo = arrays[name];
+ const numComponents = getNumComponents(arrayInfo, name);
+ const array = getArray(arrayInfo);
+ const numElements = array.length / numComponents;
+ names[name].push(numElements);
+ });
+ }
+
+ // compute length of combined array
+ // and return one for reference
+ function getLengthOfCombinedArrays(name) {
+ let length = 0;
+ let arraySpec;
+ for (let ii = 0; ii < arrayOfArrays.length; ++ii) {
+ const arrays = arrayOfArrays[ii];
+ const arrayInfo = arrays[name];
+ const array = getArray(arrayInfo);
+ length += array.length;
+ if (!arraySpec || arrayInfo.data) {
+ arraySpec = arrayInfo;
+ }
+ }
+ return {
+ length: length,
+ spec: arraySpec,
+ };
+ }
+
+ function copyArraysToNewArray(name, base, newArray) {
+ let baseIndex = 0;
+ let offset = 0;
+ for (let ii = 0; ii < arrayOfArrays.length; ++ii) {
+ const arrays = arrayOfArrays[ii];
+ const arrayInfo = arrays[name];
+ const array = getArray(arrayInfo);
+ if (name === 'indices') {
+ copyElements(array, newArray, offset, baseIndex);
+ baseIndex += base[ii];
+ } else {
+ copyElements(array, newArray, offset);
+ }
+ offset += array.length;
+ }
+ }
+
+ const base = names[baseName];
+
+ const newArrays = {};
+ Object.keys(names).forEach(function(name) {
+ const info = getLengthOfCombinedArrays(name);
+ const newArraySpec = createArrayOfSameType(info.spec, info.length);
+ copyArraysToNewArray(name, base, getArray(newArraySpec));
+ newArrays[name] = newArraySpec;
+ });
+ return newArrays;
+}
+
+/**
+ * Creates a duplicate set of vertices
+ *
+ * This is useful for calling reorientVertices when you
+ * also want to keep the original available
+ *
+ * @param {module:twgl.Arrays} arrays of vertices
+ * @return {module:twgl.Arrays} The duplicated vertices.
+ * @memberOf module:twgl/primitives
+ */
+function duplicateVertices(arrays) {
+ const newArrays = {};
+ Object.keys(arrays).forEach(function(name) {
+ const arraySpec = arrays[name];
+ const srcArray = getArray(arraySpec);
+ const newArraySpec = createArrayOfSameType(arraySpec, srcArray.length);
+ copyElements(srcArray, getArray(newArraySpec), 0);
+ newArrays[name] = newArraySpec;
+ });
+ return newArrays;
+}
+
+const create3DFBufferInfo = createBufferInfoFunc(create3DFVertices);
+const create3DFBuffers = createBufferFunc(create3DFVertices);
+const createCubeBufferInfo = createBufferInfoFunc(createCubeVertices);
+const createCubeBuffers = createBufferFunc(createCubeVertices);
+const createPlaneBufferInfo = createBufferInfoFunc(createPlaneVertices);
+const createPlaneBuffers = createBufferFunc(createPlaneVertices);
+const createSphereBufferInfo = createBufferInfoFunc(createSphereVertices);
+const createSphereBuffers = createBufferFunc(createSphereVertices);
+const createTruncatedConeBufferInfo = createBufferInfoFunc(createTruncatedConeVertices);
+const createTruncatedConeBuffers = createBufferFunc(createTruncatedConeVertices);
+const createXYQuadBufferInfo = createBufferInfoFunc(createXYQuadVertices);
+const createXYQuadBuffers = createBufferFunc(createXYQuadVertices);
+const createCrescentBufferInfo = createBufferInfoFunc(createCrescentVertices);
+const createCrescentBuffers = createBufferFunc(createCrescentVertices);
+const createCylinderBufferInfo = createBufferInfoFunc(createCylinderVertices);
+const createCylinderBuffers = createBufferFunc(createCylinderVertices);
+const createTorusBufferInfo = createBufferInfoFunc(createTorusVertices);
+const createTorusBuffers = createBufferFunc(createTorusVertices);
+const createDiscBufferInfo = createBufferInfoFunc(createDiscVertices);
+const createDiscBuffers = createBufferFunc(createDiscVertices);
+
+// these were mis-spelled until 4.12
+const createCresentBufferInfo = createCrescentBufferInfo;
+const createCresentBuffers = createCrescentBuffers;
+const createCresentVertices = createCrescentVertices;
+
+var primitives = /*#__PURE__*/Object.freeze({
+ __proto__: null,
+ create3DFBufferInfo: create3DFBufferInfo,
+ create3DFBuffers: create3DFBuffers,
+ create3DFVertices: create3DFVertices,
+ createAugmentedTypedArray: createAugmentedTypedArray,
+ createCubeBufferInfo: createCubeBufferInfo,
+ createCubeBuffers: createCubeBuffers,
+ createCubeVertices: createCubeVertices,
+ createPlaneBufferInfo: createPlaneBufferInfo,
+ createPlaneBuffers: createPlaneBuffers,
+ createPlaneVertices: createPlaneVertices,
+ createSphereBufferInfo: createSphereBufferInfo,
+ createSphereBuffers: createSphereBuffers,
+ createSphereVertices: createSphereVertices,
+ createTruncatedConeBufferInfo: createTruncatedConeBufferInfo,
+ createTruncatedConeBuffers: createTruncatedConeBuffers,
+ createTruncatedConeVertices: createTruncatedConeVertices,
+ createXYQuadBufferInfo: createXYQuadBufferInfo,
+ createXYQuadBuffers: createXYQuadBuffers,
+ createXYQuadVertices: createXYQuadVertices,
+ createCresentBufferInfo: createCresentBufferInfo,
+ createCresentBuffers: createCresentBuffers,
+ createCresentVertices: createCresentVertices,
+ createCrescentBufferInfo: createCrescentBufferInfo,
+ createCrescentBuffers: createCrescentBuffers,
+ createCrescentVertices: createCrescentVertices,
+ createCylinderBufferInfo: createCylinderBufferInfo,
+ createCylinderBuffers: createCylinderBuffers,
+ createCylinderVertices: createCylinderVertices,
+ createTorusBufferInfo: createTorusBufferInfo,
+ createTorusBuffers: createTorusBuffers,
+ createTorusVertices: createTorusVertices,
+ createDiscBufferInfo: createDiscBufferInfo,
+ createDiscBuffers: createDiscBuffers,
+ createDiscVertices: createDiscVertices,
+ deindexVertices: deindexVertices,
+ flattenNormals: flattenNormals,
+ makeRandomVertexColors: makeRandomVertexColors,
+ reorientDirections: reorientDirections,
+ reorientNormals: reorientNormals,
+ reorientPositions: reorientPositions,
+ reorientVertices: reorientVertices,
+ concatVertices: concatVertices,
+ duplicateVertices: duplicateVertices
+});
+
+/*
+ * Copyright 2019 Gregg Tavares
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+/**
+ * Gets the gl version as a number
+ * @param {WebGLRenderingContext} gl A WebGLRenderingContext
+ * @return {number} version of gl
+ * @private
+ */
+//function getVersionAsNumber(gl) {
+// return parseFloat(gl.getParameter(gl.VERSION).substr(6));
+//}
+
+/**
+ * Check if context is WebGL 2.0
+ * @param {WebGLRenderingContext} gl A WebGLRenderingContext
+ * @return {bool} true if it's WebGL 2.0
+ * @memberOf module:twgl
+ */
+function isWebGL2(gl) {
+ // This is the correct check but it's slow
+ // return gl.getParameter(gl.VERSION).indexOf("WebGL 2.0") === 0;
+ // This might also be the correct check but I'm assuming it's slow-ish
+ // return gl instanceof WebGL2RenderingContext;
+ return !!gl.texStorage2D;
+}
+
+/**
+ * Check if context is WebGL 1.0
+ * @param {WebGLRenderingContext} gl A WebGLRenderingContext
+ * @return {bool} true if it's WebGL 1.0
+ * @memberOf module:twgl
+ */
+function isWebGL1(gl) {
+ // This is the correct check but it's slow
+ // const version = getVersionAsNumber(gl);
+ // return version <= 1.0 && version > 0.0; // because as of 2016/5 Edge returns 0.96
+ // This might also be the correct check but I'm assuming it's slow-ish
+ // return gl instanceof WebGLRenderingContext;
+ return !gl.texStorage2D;
+}
+
+/**
+ * Gets a string for WebGL enum
+ *
+ * Note: Several enums are the same. Without more
+ * context (which function) it's impossible to always
+ * give the correct enum. As it is, for matching values
+ * it gives all enums. Checking the WebGL2RenderingContext
+ * that means
+ *
+ * 0 = ZERO | POINT | NONE | NO_ERROR
+ * 1 = ONE | LINES | SYNC_FLUSH_COMMANDS_BIT
+ * 32777 = BLEND_EQUATION_RGB | BLEND_EQUATION_RGB
+ * 36662 = COPY_READ_BUFFER | COPY_READ_BUFFER_BINDING
+ * 36663 = COPY_WRITE_BUFFER | COPY_WRITE_BUFFER_BINDING
+ * 36006 = FRAMEBUFFER_BINDING | DRAW_FRAMEBUFFER_BINDING
+ *
+ * It's also not useful for bits really unless you pass in individual bits.
+ * In other words
+ *
+ * const bits = gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT;
+ * twgl.glEnumToString(gl, bits); // not going to work
+ *
+ * Note that some enums only exist on extensions. If you
+ * want them to show up you need to pass the extension at least
+ * once. For example
+ *
+ * const ext = gl.getExtension('WEBGL_compressed_texture_s3tc');
+ * if (ext) {
+ * twgl.glEnumToString(ext, 0); // just prime the function
+ *
+ * ..later..
+ *
+ * const internalFormat = ext.COMPRESSED_RGB_S3TC_DXT1_EXT;
+ * console.log(twgl.glEnumToString(gl, internalFormat));
+ *
+ * Notice I didn't have to pass the extension the second time. This means
+ * you can have place that generically gets an enum for texture formats for example.
+ * and as long as you primed the function with the extensions
+ *
+ * If you're using `twgl.addExtensionsToContext` to enable your extensions
+ * then twgl will automatically get the extension's enums.
+ *
+ * @param {WebGLRenderingContext} gl A WebGLRenderingContext or any extension object
+ * @param {number} value the value of the enum you want to look up.
+ * @return {string} enum string or hex value
+ * @memberOf module:twgl
+ * @function glEnumToString
+ */
+const glEnumToString = (function() {
+ const haveEnumsForType = {};
+ const enums = {};
+
+ function addEnums(gl) {
+ const type = gl.constructor.name;
+ if (!haveEnumsForType[type]) {
+ for (const key in gl) {
+ if (typeof gl[key] === 'number') {
+ const existing = enums[gl[key]];
+ enums[gl[key]] = existing ? `${existing} | ${key}` : key;
+ }
+ }
+ haveEnumsForType[type] = true;
+ }
+ }
+
+ return function glEnumToString(gl, value) {
+ addEnums(gl);
+ return enums[value] || (typeof value === 'number' ? `0x${value.toString(16)}` : value);
+ };
+}());
+
+var utils = /*#__PURE__*/Object.freeze({
+ __proto__: null,
+ glEnumToString: glEnumToString,
+ isWebGL1: isWebGL1,
+ isWebGL2: isWebGL2
+});
+
+/*
+ * Copyright 2019 Gregg Tavares
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+const defaults$1 = {
+ textureColor: new Uint8Array([128, 192, 255, 255]),
+ textureOptions: {},
+ crossOrigin: undefined,
+};
+const isArrayBuffer = isArrayBuffer$1;
+
+// Should we make this on demand?
+const getShared2DContext = function() {
+ let s_ctx;
+ return function getShared2DContext() {
+ s_ctx = s_ctx ||
+ ((typeof document !== 'undefined' && document.createElement)
+ ? document.createElement("canvas").getContext("2d")
+ : null);
+ return s_ctx;
+ };
+}();
+
+// NOTE: Chrome supports 2D canvas in a Worker (behind flag as of v64 but
+// not only does Firefox NOT support it but Firefox freezes immediately
+// if you try to create one instead of just returning null and continuing.
+// : (global.OffscreenCanvas && (new global.OffscreenCanvas(1, 1)).getContext("2d")); // OffscreenCanvas may not support 2d
+
+// NOTE: We can maybe remove some of the need for the 2d canvas. In WebGL2
+// we can use the various unpack settings. Otherwise we could try using
+// the ability of an ImageBitmap to be cut. Unfortunately cutting an ImageBitmap
+// is async and the current TWGL code expects a non-Async result though that
+// might not be a problem. ImageBitmap though is not available in Edge or Safari
+// as of 2018-01-02
+
+/* PixelFormat */
+const ALPHA = 0x1906;
+const RGB = 0x1907;
+const RGBA$1 = 0x1908;
+const LUMINANCE = 0x1909;
+const LUMINANCE_ALPHA = 0x190A;
+const DEPTH_COMPONENT$1 = 0x1902;
+const DEPTH_STENCIL$1 = 0x84F9;
+
+/* TextureWrapMode */
+// const REPEAT = 0x2901;
+// const MIRRORED_REPEAT = 0x8370;
+const CLAMP_TO_EDGE$1 = 0x812f;
+
+/* TextureMagFilter */
+const NEAREST = 0x2600;
+const LINEAR$1 = 0x2601;
+
+/* TextureMinFilter */
+// const NEAREST_MIPMAP_NEAREST = 0x2700;
+// const LINEAR_MIPMAP_NEAREST = 0x2701;
+// const NEAREST_MIPMAP_LINEAR = 0x2702;
+// const LINEAR_MIPMAP_LINEAR = 0x2703;
+
+/* Texture Target */
+const TEXTURE_2D$2 = 0x0de1;
+const TEXTURE_CUBE_MAP$1 = 0x8513;
+const TEXTURE_3D$1 = 0x806f;
+const TEXTURE_2D_ARRAY$1 = 0x8c1a;
+
+/* Cubemap Targets */
+const TEXTURE_CUBE_MAP_POSITIVE_X = 0x8515;
+const TEXTURE_CUBE_MAP_NEGATIVE_X = 0x8516;
+const TEXTURE_CUBE_MAP_POSITIVE_Y = 0x8517;
+const TEXTURE_CUBE_MAP_NEGATIVE_Y = 0x8518;
+const TEXTURE_CUBE_MAP_POSITIVE_Z = 0x8519;
+const TEXTURE_CUBE_MAP_NEGATIVE_Z = 0x851a;
+
+/* Texture Parameters */
+const TEXTURE_MIN_FILTER = 0x2801;
+const TEXTURE_MAG_FILTER = 0x2800;
+const TEXTURE_WRAP_S = 0x2802;
+const TEXTURE_WRAP_T = 0x2803;
+const TEXTURE_WRAP_R = 0x8072;
+const TEXTURE_MIN_LOD = 0x813a;
+const TEXTURE_MAX_LOD = 0x813b;
+const TEXTURE_BASE_LEVEL = 0x813c;
+const TEXTURE_MAX_LEVEL = 0x813d;
+const TEXTURE_COMPARE_MODE = 0x884C;
+const TEXTURE_COMPARE_FUNC = 0x884D;
+
+/* Pixel store */
+const UNPACK_ALIGNMENT = 0x0cf5;
+const UNPACK_ROW_LENGTH = 0x0cf2;
+const UNPACK_IMAGE_HEIGHT = 0x806e;
+const UNPACK_SKIP_PIXELS = 0x0cf4;
+const UNPACK_SKIP_ROWS = 0x0cf3;
+const UNPACK_SKIP_IMAGES = 0x806d;
+const UNPACK_COLORSPACE_CONVERSION_WEBGL = 0x9243;
+const UNPACK_PREMULTIPLY_ALPHA_WEBGL = 0x9241;
+const UNPACK_FLIP_Y_WEBGL = 0x9240;
+
+const R8 = 0x8229;
+const R8_SNORM = 0x8F94;
+const R16F = 0x822D;
+const R32F = 0x822E;
+const R8UI = 0x8232;
+const R8I = 0x8231;
+const RG16UI = 0x823A;
+const RG16I = 0x8239;
+const RG32UI = 0x823C;
+const RG32I = 0x823B;
+const RG8 = 0x822B;
+const RG8_SNORM = 0x8F95;
+const RG16F = 0x822F;
+const RG32F = 0x8230;
+const RG8UI = 0x8238;
+const RG8I = 0x8237;
+const R16UI = 0x8234;
+const R16I = 0x8233;
+const R32UI = 0x8236;
+const R32I = 0x8235;
+const RGB8 = 0x8051;
+const SRGB8 = 0x8C41;
+const RGB565$1 = 0x8D62;
+const RGB8_SNORM = 0x8F96;
+const R11F_G11F_B10F = 0x8C3A;
+const RGB9_E5 = 0x8C3D;
+const RGB16F = 0x881B;
+const RGB32F = 0x8815;
+const RGB8UI = 0x8D7D;
+const RGB8I = 0x8D8F;
+const RGB16UI = 0x8D77;
+const RGB16I = 0x8D89;
+const RGB32UI = 0x8D71;
+const RGB32I = 0x8D83;
+const RGBA8 = 0x8058;
+const SRGB8_ALPHA8 = 0x8C43;
+const RGBA8_SNORM = 0x8F97;
+const RGB5_A1$1 = 0x8057;
+const RGBA4$1 = 0x8056;
+const RGB10_A2 = 0x8059;
+const RGBA16F = 0x881A;
+const RGBA32F = 0x8814;
+const RGBA8UI = 0x8D7C;
+const RGBA8I = 0x8D8E;
+const RGB10_A2UI = 0x906F;
+const RGBA16UI = 0x8D76;
+const RGBA16I = 0x8D88;
+const RGBA32I = 0x8D82;
+const RGBA32UI = 0x8D70;
+
+const DEPTH_COMPONENT16$1 = 0x81A5;
+const DEPTH_COMPONENT24$1 = 0x81A6;
+const DEPTH_COMPONENT32F$1 = 0x8CAC;
+const DEPTH32F_STENCIL8$1 = 0x8CAD;
+const DEPTH24_STENCIL8$1 = 0x88F0;
+
+/* DataType */
+const BYTE = 0x1400;
+const UNSIGNED_BYTE$1 = 0x1401;
+const SHORT = 0x1402;
+const UNSIGNED_SHORT$1 = 0x1403;
+const INT$1 = 0x1404;
+const UNSIGNED_INT$1 = 0x1405;
+const FLOAT$1 = 0x1406;
+const UNSIGNED_SHORT_4_4_4_4 = 0x8033;
+const UNSIGNED_SHORT_5_5_5_1 = 0x8034;
+const UNSIGNED_SHORT_5_6_5 = 0x8363;
+const HALF_FLOAT = 0x140B;
+const HALF_FLOAT_OES = 0x8D61; // Thanks Khronos for making this different >:(
+const UNSIGNED_INT_2_10_10_10_REV = 0x8368;
+const UNSIGNED_INT_10F_11F_11F_REV = 0x8C3B;
+const UNSIGNED_INT_5_9_9_9_REV = 0x8C3E;
+const FLOAT_32_UNSIGNED_INT_24_8_REV = 0x8DAD;
+const UNSIGNED_INT_24_8 = 0x84FA;
+
+const RG = 0x8227;
+const RG_INTEGER = 0x8228;
+const RED = 0x1903;
+const RED_INTEGER = 0x8D94;
+const RGB_INTEGER = 0x8D98;
+const RGBA_INTEGER = 0x8D99;
+
+const formatInfo = {};
+{
+ // NOTE: this is named `numColorComponents` vs `numComponents` so we can let Uglify mangle
+ // the name.
+ const f = formatInfo;
+ f[ALPHA] = { numColorComponents: 1, };
+ f[LUMINANCE] = { numColorComponents: 1, };
+ f[LUMINANCE_ALPHA] = { numColorComponents: 2, };
+ f[RGB] = { numColorComponents: 3, };
+ f[RGBA$1] = { numColorComponents: 4, };
+ f[RED] = { numColorComponents: 1, };
+ f[RED_INTEGER] = { numColorComponents: 1, };
+ f[RG] = { numColorComponents: 2, };
+ f[RG_INTEGER] = { numColorComponents: 2, };
+ f[RGB] = { numColorComponents: 3, };
+ f[RGB_INTEGER] = { numColorComponents: 3, };
+ f[RGBA$1] = { numColorComponents: 4, };
+ f[RGBA_INTEGER] = { numColorComponents: 4, };
+ f[DEPTH_COMPONENT$1] = { numColorComponents: 1, };
+ f[DEPTH_STENCIL$1] = { numColorComponents: 2, };
+}
+
+/**
+ * @typedef {Object} TextureFormatDetails
+ * @property {number} textureFormat format to pass texImage2D and similar functions.
+ * @property {boolean} colorRenderable true if you can render to this format of texture.
+ * @property {boolean} textureFilterable true if you can filter the texture, false if you can ony use `NEAREST`.
+ * @property {number[]} type Array of possible types you can pass to texImage2D and similar function
+ * @property {Object.} bytesPerElementMap A map of types to bytes per element
+ * @private
+ */
+
+let s_textureInternalFormatInfo;
+function getTextureInternalFormatInfo(internalFormat) {
+ if (!s_textureInternalFormatInfo) {
+ // NOTE: these properties need unique names so we can let Uglify mangle the name.
+ const t = {};
+ // unsized formats
+ t[ALPHA] = { textureFormat: ALPHA, colorRenderable: true, textureFilterable: true, bytesPerElement: [1, 2, 2, 4], type: [UNSIGNED_BYTE$1, HALF_FLOAT, HALF_FLOAT_OES, FLOAT$1], };
+ t[LUMINANCE] = { textureFormat: LUMINANCE, colorRenderable: true, textureFilterable: true, bytesPerElement: [1, 2, 2, 4], type: [UNSIGNED_BYTE$1, HALF_FLOAT, HALF_FLOAT_OES, FLOAT$1], };
+ t[LUMINANCE_ALPHA] = { textureFormat: LUMINANCE_ALPHA, colorRenderable: true, textureFilterable: true, bytesPerElement: [2, 4, 4, 8], type: [UNSIGNED_BYTE$1, HALF_FLOAT, HALF_FLOAT_OES, FLOAT$1], };
+ t[RGB] = { textureFormat: RGB, colorRenderable: true, textureFilterable: true, bytesPerElement: [3, 6, 6, 12, 2], type: [UNSIGNED_BYTE$1, HALF_FLOAT, HALF_FLOAT_OES, FLOAT$1, UNSIGNED_SHORT_5_6_5], };
+ t[RGBA$1] = { textureFormat: RGBA$1, colorRenderable: true, textureFilterable: true, bytesPerElement: [4, 8, 8, 16, 2, 2], type: [UNSIGNED_BYTE$1, HALF_FLOAT, HALF_FLOAT_OES, FLOAT$1, UNSIGNED_SHORT_4_4_4_4, UNSIGNED_SHORT_5_5_5_1], };
+ t[DEPTH_COMPONENT$1] = { textureFormat: DEPTH_COMPONENT$1, colorRenderable: true, textureFilterable: false, bytesPerElement: [2, 4], type: [UNSIGNED_INT$1, UNSIGNED_SHORT$1], };
+
+ // sized formats
+ t[R8] = { textureFormat: RED, colorRenderable: true, textureFilterable: true, bytesPerElement: [1], type: [UNSIGNED_BYTE$1], };
+ t[R8_SNORM] = { textureFormat: RED, colorRenderable: false, textureFilterable: true, bytesPerElement: [1], type: [BYTE], };
+ t[R16F] = { textureFormat: RED, colorRenderable: false, textureFilterable: true, bytesPerElement: [4, 2], type: [FLOAT$1, HALF_FLOAT], };
+ t[R32F] = { textureFormat: RED, colorRenderable: false, textureFilterable: false, bytesPerElement: [4], type: [FLOAT$1], };
+ t[R8UI] = { textureFormat: RED_INTEGER, colorRenderable: true, textureFilterable: false, bytesPerElement: [1], type: [UNSIGNED_BYTE$1], };
+ t[R8I] = { textureFormat: RED_INTEGER, colorRenderable: true, textureFilterable: false, bytesPerElement: [1], type: [BYTE], };
+ t[R16UI] = { textureFormat: RED_INTEGER, colorRenderable: true, textureFilterable: false, bytesPerElement: [2], type: [UNSIGNED_SHORT$1], };
+ t[R16I] = { textureFormat: RED_INTEGER, colorRenderable: true, textureFilterable: false, bytesPerElement: [2], type: [SHORT], };
+ t[R32UI] = { textureFormat: RED_INTEGER, colorRenderable: true, textureFilterable: false, bytesPerElement: [4], type: [UNSIGNED_INT$1], };
+ t[R32I] = { textureFormat: RED_INTEGER, colorRenderable: true, textureFilterable: false, bytesPerElement: [4], type: [INT$1], };
+ t[RG8] = { textureFormat: RG, colorRenderable: true, textureFilterable: true, bytesPerElement: [2], type: [UNSIGNED_BYTE$1], };
+ t[RG8_SNORM] = { textureFormat: RG, colorRenderable: false, textureFilterable: true, bytesPerElement: [2], type: [BYTE], };
+ t[RG16F] = { textureFormat: RG, colorRenderable: false, textureFilterable: true, bytesPerElement: [8, 4], type: [FLOAT$1, HALF_FLOAT], };
+ t[RG32F] = { textureFormat: RG, colorRenderable: false, textureFilterable: false, bytesPerElement: [8], type: [FLOAT$1], };
+ t[RG8UI] = { textureFormat: RG_INTEGER, colorRenderable: true, textureFilterable: false, bytesPerElement: [2], type: [UNSIGNED_BYTE$1], };
+ t[RG8I] = { textureFormat: RG_INTEGER, colorRenderable: true, textureFilterable: false, bytesPerElement: [2], type: [BYTE], };
+ t[RG16UI] = { textureFormat: RG_INTEGER, colorRenderable: true, textureFilterable: false, bytesPerElement: [4], type: [UNSIGNED_SHORT$1], };
+ t[RG16I] = { textureFormat: RG_INTEGER, colorRenderable: true, textureFilterable: false, bytesPerElement: [4], type: [SHORT], };
+ t[RG32UI] = { textureFormat: RG_INTEGER, colorRenderable: true, textureFilterable: false, bytesPerElement: [8], type: [UNSIGNED_INT$1], };
+ t[RG32I] = { textureFormat: RG_INTEGER, colorRenderable: true, textureFilterable: false, bytesPerElement: [8], type: [INT$1], };
+ t[RGB8] = { textureFormat: RGB, colorRenderable: true, textureFilterable: true, bytesPerElement: [3], type: [UNSIGNED_BYTE$1], };
+ t[SRGB8] = { textureFormat: RGB, colorRenderable: false, textureFilterable: true, bytesPerElement: [3], type: [UNSIGNED_BYTE$1], };
+ t[RGB565$1] = { textureFormat: RGB, colorRenderable: true, textureFilterable: true, bytesPerElement: [3, 2], type: [UNSIGNED_BYTE$1, UNSIGNED_SHORT_5_6_5], };
+ t[RGB8_SNORM] = { textureFormat: RGB, colorRenderable: false, textureFilterable: true, bytesPerElement: [3], type: [BYTE], };
+ t[R11F_G11F_B10F] = { textureFormat: RGB, colorRenderable: false, textureFilterable: true, bytesPerElement: [12, 6, 4], type: [FLOAT$1, HALF_FLOAT, UNSIGNED_INT_10F_11F_11F_REV], };
+ t[RGB9_E5] = { textureFormat: RGB, colorRenderable: false, textureFilterable: true, bytesPerElement: [12, 6, 4], type: [FLOAT$1, HALF_FLOAT, UNSIGNED_INT_5_9_9_9_REV], };
+ t[RGB16F] = { textureFormat: RGB, colorRenderable: false, textureFilterable: true, bytesPerElement: [12, 6], type: [FLOAT$1, HALF_FLOAT], };
+ t[RGB32F] = { textureFormat: RGB, colorRenderable: false, textureFilterable: false, bytesPerElement: [12], type: [FLOAT$1], };
+ t[RGB8UI] = { textureFormat: RGB_INTEGER, colorRenderable: false, textureFilterable: false, bytesPerElement: [3], type: [UNSIGNED_BYTE$1], };
+ t[RGB8I] = { textureFormat: RGB_INTEGER, colorRenderable: false, textureFilterable: false, bytesPerElement: [3], type: [BYTE], };
+ t[RGB16UI] = { textureFormat: RGB_INTEGER, colorRenderable: false, textureFilterable: false, bytesPerElement: [6], type: [UNSIGNED_SHORT$1], };
+ t[RGB16I] = { textureFormat: RGB_INTEGER, colorRenderable: false, textureFilterable: false, bytesPerElement: [6], type: [SHORT], };
+ t[RGB32UI] = { textureFormat: RGB_INTEGER, colorRenderable: false, textureFilterable: false, bytesPerElement: [12], type: [UNSIGNED_INT$1], };
+ t[RGB32I] = { textureFormat: RGB_INTEGER, colorRenderable: false, textureFilterable: false, bytesPerElement: [12], type: [INT$1], };
+ t[RGBA8] = { textureFormat: RGBA$1, colorRenderable: true, textureFilterable: true, bytesPerElement: [4], type: [UNSIGNED_BYTE$1], };
+ t[SRGB8_ALPHA8] = { textureFormat: RGBA$1, colorRenderable: true, textureFilterable: true, bytesPerElement: [4], type: [UNSIGNED_BYTE$1], };
+ t[RGBA8_SNORM] = { textureFormat: RGBA$1, colorRenderable: false, textureFilterable: true, bytesPerElement: [4], type: [BYTE], };
+ t[RGB5_A1$1] = { textureFormat: RGBA$1, colorRenderable: true, textureFilterable: true, bytesPerElement: [4, 2, 4], type: [UNSIGNED_BYTE$1, UNSIGNED_SHORT_5_5_5_1, UNSIGNED_INT_2_10_10_10_REV], };
+ t[RGBA4$1] = { textureFormat: RGBA$1, colorRenderable: true, textureFilterable: true, bytesPerElement: [4, 2], type: [UNSIGNED_BYTE$1, UNSIGNED_SHORT_4_4_4_4], };
+ t[RGB10_A2] = { textureFormat: RGBA$1, colorRenderable: true, textureFilterable: true, bytesPerElement: [4], type: [UNSIGNED_INT_2_10_10_10_REV], };
+ t[RGBA16F] = { textureFormat: RGBA$1, colorRenderable: false, textureFilterable: true, bytesPerElement: [16, 8], type: [FLOAT$1, HALF_FLOAT], };
+ t[RGBA32F] = { textureFormat: RGBA$1, colorRenderable: false, textureFilterable: false, bytesPerElement: [16], type: [FLOAT$1], };
+ t[RGBA8UI] = { textureFormat: RGBA_INTEGER, colorRenderable: true, textureFilterable: false, bytesPerElement: [4], type: [UNSIGNED_BYTE$1], };
+ t[RGBA8I] = { textureFormat: RGBA_INTEGER, colorRenderable: true, textureFilterable: false, bytesPerElement: [4], type: [BYTE], };
+ t[RGB10_A2UI] = { textureFormat: RGBA_INTEGER, colorRenderable: true, textureFilterable: false, bytesPerElement: [4], type: [UNSIGNED_INT_2_10_10_10_REV], };
+ t[RGBA16UI] = { textureFormat: RGBA_INTEGER, colorRenderable: true, textureFilterable: false, bytesPerElement: [8], type: [UNSIGNED_SHORT$1], };
+ t[RGBA16I] = { textureFormat: RGBA_INTEGER, colorRenderable: true, textureFilterable: false, bytesPerElement: [8], type: [SHORT], };
+ t[RGBA32I] = { textureFormat: RGBA_INTEGER, colorRenderable: true, textureFilterable: false, bytesPerElement: [16], type: [INT$1], };
+ t[RGBA32UI] = { textureFormat: RGBA_INTEGER, colorRenderable: true, textureFilterable: false, bytesPerElement: [16], type: [UNSIGNED_INT$1], };
+ // Sized Internal
+ t[DEPTH_COMPONENT16$1] = { textureFormat: DEPTH_COMPONENT$1, colorRenderable: true, textureFilterable: false, bytesPerElement: [2, 4], type: [UNSIGNED_SHORT$1, UNSIGNED_INT$1], };
+ t[DEPTH_COMPONENT24$1] = { textureFormat: DEPTH_COMPONENT$1, colorRenderable: true, textureFilterable: false, bytesPerElement: [4], type: [UNSIGNED_INT$1], };
+ t[DEPTH_COMPONENT32F$1] = { textureFormat: DEPTH_COMPONENT$1, colorRenderable: true, textureFilterable: false, bytesPerElement: [4], type: [FLOAT$1], };
+ t[DEPTH24_STENCIL8$1] = { textureFormat: DEPTH_STENCIL$1, colorRenderable: true, textureFilterable: false, bytesPerElement: [4], type: [UNSIGNED_INT_24_8], };
+ t[DEPTH32F_STENCIL8$1] = { textureFormat: DEPTH_STENCIL$1, colorRenderable: true, textureFilterable: false, bytesPerElement: [4], type: [FLOAT_32_UNSIGNED_INT_24_8_REV], };
+
+ Object.keys(t).forEach(function(internalFormat) {
+ const info = t[internalFormat];
+ info.bytesPerElementMap = {};
+ info.bytesPerElement.forEach(function(bytesPerElement, ndx) {
+ const type = info.type[ndx];
+ info.bytesPerElementMap[type] = bytesPerElement;
+ });
+ });
+ s_textureInternalFormatInfo = t;
+ }
+ return s_textureInternalFormatInfo[internalFormat];
+}
+
+/**
+ * Gets the number of bytes per element for a given internalFormat / type
+ * @param {number} internalFormat The internalFormat parameter from texImage2D etc..
+ * @param {number} type The type parameter for texImage2D etc..
+ * @return {number} the number of bytes per element for the given internalFormat, type combo
+ * @memberOf module:twgl/textures
+ */
+function getBytesPerElementForInternalFormat(internalFormat, type) {
+ const info = getTextureInternalFormatInfo(internalFormat);
+ if (!info) {
+ throw "unknown internal format";
+ }
+ const bytesPerElement = info.bytesPerElementMap[type];
+ if (bytesPerElement === undefined) {
+ throw "unknown internal format";
+ }
+ return bytesPerElement;
+}
+
+/**
+ * Info related to a specific texture internalFormat as returned
+ * from {@link module:twgl/textures.getFormatAndTypeForInternalFormat}.
+ *
+ * @typedef {Object} TextureFormatInfo
+ * @property {number} format Format to pass to texImage2D and related functions
+ * @property {number} type Type to pass to texImage2D and related functions
+ * @memberOf module:twgl/textures
+ */
+
+/**
+ * Gets the format and type for a given internalFormat
+ *
+ * @param {number} internalFormat The internal format
+ * @return {module:twgl/textures.TextureFormatInfo} the corresponding format and type,
+ * @memberOf module:twgl/textures
+ */
+function getFormatAndTypeForInternalFormat(internalFormat) {
+ const info = getTextureInternalFormatInfo(internalFormat);
+ if (!info) {
+ throw "unknown internal format";
+ }
+ return {
+ format: info.textureFormat,
+ type: info.type[0],
+ };
+}
+
+/**
+ * Returns true if value is power of 2
+ * @param {number} value number to check.
+ * @return true if value is power of 2
+ * @private
+ */
+function isPowerOf2(value) {
+ return (value & (value - 1)) === 0;
+}
+
+/**
+ * Gets whether or not we can generate mips for the given
+ * internal format.
+ *
+ * @param {WebGLRenderingContext} gl the WebGLRenderingContext
+ * @param {number} width The width parameter from texImage2D etc..
+ * @param {number} height The height parameter from texImage2D etc..
+ * @param {number} internalFormat The internalFormat parameter from texImage2D etc..
+ * @return {boolean} true if we can generate mips
+ * @memberOf module:twgl/textures
+ */
+function canGenerateMipmap(gl, width, height, internalFormat) {
+ if (!isWebGL2(gl)) {
+ return isPowerOf2(width) && isPowerOf2(height);
+ }
+ const info = getTextureInternalFormatInfo(internalFormat);
+ if (!info) {
+ throw "unknown internal format";
+ }
+ return info.colorRenderable && info.textureFilterable;
+}
+
+/**
+ * Gets whether or not we can generate mips for the given format
+ * @param {number} internalFormat The internalFormat parameter from texImage2D etc..
+ * @return {boolean} true if we can generate mips
+ * @memberOf module:twgl/textures
+ */
+function canFilter(internalFormat) {
+ const info = getTextureInternalFormatInfo(internalFormat);
+ if (!info) {
+ throw "unknown internal format";
+ }
+ return info.textureFilterable;
+}
+
+/**
+ * Gets the number of components for a given image format.
+ * @param {number} format the format.
+ * @return {number} the number of components for the format.
+ * @memberOf module:twgl/textures
+ */
+function getNumComponentsForFormat(format) {
+ const info = formatInfo[format];
+ if (!info) {
+ throw "unknown format: " + format;
+ }
+ return info.numColorComponents;
+}
+
+/**
+ * Gets the texture type for a given array type.
+ * @param {WebGLRenderingContext} gl the WebGLRenderingContext
+ * @return {number} the gl texture type
+ * @private
+ */
+function getTextureTypeForArrayType(gl, src, defaultType) {
+ if (isArrayBuffer(src)) {
+ return getGLTypeForTypedArray(src);
+ }
+ return defaultType || UNSIGNED_BYTE$1;
+}
+
+function guessDimensions(gl, target, width, height, numElements) {
+ if (numElements % 1 !== 0) {
+ throw "can't guess dimensions";
+ }
+ if (!width && !height) {
+ const size = Math.sqrt(numElements / (target === TEXTURE_CUBE_MAP$1 ? 6 : 1));
+ if (size % 1 === 0) {
+ width = size;
+ height = size;
+ } else {
+ width = numElements;
+ height = 1;
+ }
+ } else if (!height) {
+ height = numElements / width;
+ if (height % 1) {
+ throw "can't guess dimensions";
+ }
+ } else if (!width) {
+ width = numElements / height;
+ if (width % 1) {
+ throw "can't guess dimensions";
+ }
+ }
+ return {
+ width: width,
+ height: height,
+ };
+}
+
+/**
+ * Sets the default texture color.
+ *
+ * The default texture color is used when loading textures from
+ * urls. Because the URL will be loaded async we'd like to be
+ * able to use the texture immediately. By putting a 1x1 pixel
+ * color in the texture we can start using the texture before
+ * the URL has loaded.
+ *
+ * @param {number[]} color Array of 4 values in the range 0 to 1
+ * @deprecated see {@link module:twgl.setDefaults}
+ * @memberOf module:twgl/textures
+ */
+function setDefaultTextureColor(color) {
+ defaults$1.textureColor = new Uint8Array([color[0] * 255, color[1] * 255, color[2] * 255, color[3] * 255]);
+}
+
+function setDefaults$1(newDefaults) {
+ copyExistingProperties(newDefaults, defaults$1);
+ if (newDefaults.textureColor) {
+ setDefaultTextureColor(newDefaults.textureColor);
+ }
+}
+
+/**
+ * A function to generate the source for a texture.
+ * @callback TextureFunc
+ * @param {WebGLRenderingContext} gl A WebGLRenderingContext
+ * @param {module:twgl.TextureOptions} options the texture options
+ * @return {*} Returns any of the things documented for `src` for {@link module:twgl.TextureOptions}.
+ * @memberOf module:twgl
+ */
+
+/**
+ * Texture options passed to most texture functions. Each function will use whatever options
+ * are appropriate for its needs. This lets you pass the same options to all functions.
+ *
+ * Note: A `TexImageSource` is defined in the WebGL spec as a `HTMLImageElement`, `HTMLVideoElement`,
+ * `HTMLCanvasElement`, `ImageBitmap`, or `ImageData`.
+ *
+ * @typedef {Object} TextureOptions
+ * @property {number} [target] the type of texture `gl.TEXTURE_2D` or `gl.TEXTURE_CUBE_MAP`. Defaults to `gl.TEXTURE_2D`.
+ * @property {number} [level] the mip level to affect. Defaults to 0. Note, if set auto will be considered false unless explicitly set to true.
+ * @property {number} [width] the width of the texture. Only used if src is an array or typed array or null.
+ * @property {number} [height] the height of a texture. Only used if src is an array or typed array or null.
+ * @property {number} [depth] the depth of a texture. Only used if src is an array or type array or null and target is `TEXTURE_3D` .
+ * @property {number} [min] the min filter setting (eg. `gl.LINEAR`). Defaults to `gl.NEAREST_MIPMAP_LINEAR`
+ * or if texture is not a power of 2 on both dimensions then defaults to `gl.LINEAR`.
+ * @property {number} [mag] the mag filter setting (eg. `gl.LINEAR`). Defaults to `gl.LINEAR`
+ * @property {number} [minMag] both the min and mag filter settings.
+ * @property {number} [internalFormat] internal format for texture. Defaults to `gl.RGBA`
+ * @property {number} [format] format for texture. Defaults to `gl.RGBA`.
+ * @property {number} [type] type for texture. Defaults to `gl.UNSIGNED_BYTE` unless `src` is ArrayBufferView. If `src`
+ * is ArrayBufferView defaults to type that matches ArrayBufferView type.
+ * @property {number} [wrap] Texture wrapping for both S and T (and R if TEXTURE_3D or WebGLSampler). Defaults to `gl.REPEAT` for 2D unless src is WebGL1 and src not npot and `gl.CLAMP_TO_EDGE` for cube
+ * @property {number} [wrapS] Texture wrapping for S. Defaults to `gl.REPEAT` and `gl.CLAMP_TO_EDGE` for cube. If set takes precedence over `wrap`.
+ * @property {number} [wrapT] Texture wrapping for T. Defaults to `gl.REPEAT` and `gl.CLAMP_TO_EDGE` for cube. If set takes precedence over `wrap`.
+ * @property {number} [wrapR] Texture wrapping for R. Defaults to `gl.REPEAT` and `gl.CLAMP_TO_EDGE` for cube. If set takes precedence over `wrap`.
+ * @property {number} [minLod] TEXTURE_MIN_LOD setting
+ * @property {number} [maxLod] TEXTURE_MAX_LOD setting
+ * @property {number} [baseLevel] TEXTURE_BASE_LEVEL setting
+ * @property {number} [maxLevel] TEXTURE_MAX_LEVEL setting
+ * @property {number} [compareFunc] TEXTURE_COMPARE_FUNC setting
+ * @property {number} [compareMode] TEXTURE_COMPARE_MODE setting
+ * @property {number} [unpackAlignment] The `gl.UNPACK_ALIGNMENT` used when uploading an array. Defaults to 1.
+ * @property {number[]|ArrayBufferView} [color] Color to initialize this texture with if loading an image asynchronously.
+ * The default use a blue 1x1 pixel texture. You can set another default by calling `twgl.setDefaults`
+ * or you can set an individual texture's initial color by setting this property. Example: `[1, .5, .5, 1]` = pink
+ * @property {number} [premultiplyAlpha] Whether or not to premultiply alpha. Defaults to whatever the current setting is.
+ * This lets you set it once before calling `twgl.createTexture` or `twgl.createTextures` and only override
+ * the current setting for specific textures.
+ * @property {number} [flipY] Whether or not to flip the texture vertically on upload. Defaults to whatever the current setting is.
+ * This lets you set it once before calling `twgl.createTexture` or `twgl.createTextures` and only override
+ * the current setting for specific textures.
+ * @property {number} [colorspaceConversion] Whether or not to let the browser do colorspace conversion of the texture on upload. Defaults to whatever the current setting is.
+ * This lets you set it once before calling `twgl.createTexture` or `twgl.createTextures` and only override
+ * the current setting for specific textures.
+ * @property {boolean} [auto] If `undefined` or `true`, in WebGL1, texture filtering is set automatically for non-power of 2 images and
+ * mips are generated for power of 2 images. In WebGL2 mips are generated if they can be. Note: if `level` is set above
+ * then then `auto` is assumed to be `false` unless explicity set to `true`.
+ * @property {number[]} [cubeFaceOrder] The order that cube faces are pulled out of an img or set of images. The default is
+ *
+ * [gl.TEXTURE_CUBE_MAP_POSITIVE_X,
+ * gl.TEXTURE_CUBE_MAP_NEGATIVE_X,
+ * gl.TEXTURE_CUBE_MAP_POSITIVE_Y,
+ * gl.TEXTURE_CUBE_MAP_NEGATIVE_Y,
+ * gl.TEXTURE_CUBE_MAP_POSITIVE_Z,
+ * gl.TEXTURE_CUBE_MAP_NEGATIVE_Z]
+ *
+ * @property {(number[]|ArrayBufferView|TexImageSource|TexImageSource[]|string|string[]|module:twgl.TextureFunc)} [src] source for texture
+ *
+ * If `string` then it's assumed to be a URL to an image. The image will be downloaded async. A usable
+ * 1x1 pixel texture will be returned immediately. The texture will be updated once the image has downloaded.
+ * If `target` is `gl.TEXTURE_CUBE_MAP` will attempt to divide image into 6 square pieces. 1x6, 6x1, 3x2, 2x3.
+ * The pieces will be uploaded in `cubeFaceOrder`
+ *
+ * If `string[]` or `TexImageSource[]` and target is `gl.TEXTURE_CUBE_MAP` then it must have 6 entries, one for each face of a cube map.
+ *
+ * If `string[]` or `TexImageSource[]` and target is `gl.TEXTURE_2D_ARRAY` then each entry is a slice of the a 2d array texture
+ * and will be scaled to the specified width and height OR to the size of the first image that loads.
+ *
+ * If `TexImageSource` then it wil be used immediately to create the contents of the texture. Examples `HTMLImageElement`,
+ * `HTMLCanvasElement`, `HTMLVideoElement`.
+ *
+ * If `number[]` or `ArrayBufferView` it's assumed to be data for a texture. If `width` or `height` is
+ * not specified it is guessed as follows. First the number of elements is computed by `src.length / numComponents`
+ * where `numComponents` is derived from `format`. If `target` is `gl.TEXTURE_CUBE_MAP` then `numElements` is divided
+ * by 6. Then
+ *
+ * * If neither `width` nor `height` are specified and `sqrt(numElements)` is an integer then width and height
+ * are set to `sqrt(numElements)`. Otherwise `width = numElements` and `height = 1`.
+ *
+ * * If only one of `width` or `height` is specified then the other equals `numElements / specifiedDimension`.
+ *
+ * If `number[]` will be converted to `type`.
+ *
+ * If `src` is a function it will be called with a `WebGLRenderingContext` and these options.
+ * Whatever it returns is subject to these rules. So it can return a string url, an `HTMLElement`
+ * an array etc...
+ *
+ * If `src` is undefined then an empty texture will be created of size `width` by `height`.
+ *
+ * @property {string} [crossOrigin] What to set the crossOrigin property of images when they are downloaded.
+ * default: undefined. Also see {@link module:twgl.setDefaults}.
+ *
+ * @memberOf module:twgl
+ */
+
+/**
+ * Sets any packing state that will be set based on the options.
+ * @param {module:twgl.TextureOptions} options A TextureOptions object with whatever parameters you want set.
+ * @param {WebGLRenderingContext} gl the WebGLRenderingContext
+ * @private
+ */
+function setPackState(gl, options) {
+ if (options.colorspaceConversion !== undefined) {
+ gl.pixelStorei(UNPACK_COLORSPACE_CONVERSION_WEBGL, options.colorspaceConversion);
+ }
+ if (options.premultiplyAlpha !== undefined) {
+ gl.pixelStorei(UNPACK_PREMULTIPLY_ALPHA_WEBGL, options.premultiplyAlpha);
+ }
+ if (options.flipY !== undefined) {
+ gl.pixelStorei(UNPACK_FLIP_Y_WEBGL, options.flipY);
+ }
+}
+
+/**
+ * Set skip state to defaults
+ * @param {WebGLRenderingContext} gl the WebGLRenderingContext
+ * @private
+ */
+function setSkipStateToDefault(gl) {
+ gl.pixelStorei(UNPACK_ALIGNMENT, 4);
+ if (isWebGL2(gl)) {
+ gl.pixelStorei(UNPACK_ROW_LENGTH, 0);
+ gl.pixelStorei(UNPACK_IMAGE_HEIGHT, 0);
+ gl.pixelStorei(UNPACK_SKIP_PIXELS, 0);
+ gl.pixelStorei(UNPACK_SKIP_ROWS, 0);
+ gl.pixelStorei(UNPACK_SKIP_IMAGES, 0);
+ }
+}
+
+/**
+ * Sets the parameters of a texture or sampler
+ * @param {WebGLRenderingContext} gl the WebGLRenderingContext
+ * @param {number|WebGLSampler} target texture target or sampler
+ * @param {function()} parameteriFn texParameteri or samplerParameteri fn
+ * @param {WebGLTexture} tex the WebGLTexture to set parameters for
+ * @param {module:twgl.TextureOptions} options A TextureOptions object with whatever parameters you want set.
+ * This is often the same options you passed in when you created the texture.
+ * @private
+ */
+function setTextureSamplerParameters(gl, target, parameteriFn, options) {
+ if (options.minMag) {
+ parameteriFn.call(gl, target, TEXTURE_MIN_FILTER, options.minMag);
+ parameteriFn.call(gl, target, TEXTURE_MAG_FILTER, options.minMag);
+ }
+ if (options.min) {
+ parameteriFn.call(gl, target, TEXTURE_MIN_FILTER, options.min);
+ }
+ if (options.mag) {
+ parameteriFn.call(gl, target, TEXTURE_MAG_FILTER, options.mag);
+ }
+ if (options.wrap) {
+ parameteriFn.call(gl, target, TEXTURE_WRAP_S, options.wrap);
+ parameteriFn.call(gl, target, TEXTURE_WRAP_T, options.wrap);
+ if (target === TEXTURE_3D$1 || isSampler(gl, target)) {
+ parameteriFn.call(gl, target, TEXTURE_WRAP_R, options.wrap);
+ }
+ }
+ if (options.wrapR) {
+ parameteriFn.call(gl, target, TEXTURE_WRAP_R, options.wrapR);
+ }
+ if (options.wrapS) {
+ parameteriFn.call(gl, target, TEXTURE_WRAP_S, options.wrapS);
+ }
+ if (options.wrapT) {
+ parameteriFn.call(gl, target, TEXTURE_WRAP_T, options.wrapT);
+ }
+ if (options.minLod !== undefined) {
+ parameteriFn.call(gl, target, TEXTURE_MIN_LOD, options.minLod);
+ }
+ if (options.maxLod !== undefined) {
+ parameteriFn.call(gl, target, TEXTURE_MAX_LOD, options.maxLod);
+ }
+ if (options.baseLevel !== undefined) {
+ parameteriFn.call(gl, target, TEXTURE_BASE_LEVEL, options.baseLevel);
+ }
+ if (options.maxLevel !== undefined) {
+ parameteriFn.call(gl, target, TEXTURE_MAX_LEVEL, options.maxLevel);
+ }
+ if (options.compareFunc !== undefined) {
+ parameteriFn.call(gl, target, TEXTURE_COMPARE_FUNC, options.compareFunc);
+ }
+ if (options.compareMode !== undefined) {
+ parameteriFn.call(gl, target, TEXTURE_COMPARE_MODE, options.compareMode);
+ }
+}
+
+/**
+ * Sets the texture parameters of a texture.
+ * @param {WebGLRenderingContext} gl the WebGLRenderingContext
+ * @param {WebGLTexture} tex the WebGLTexture to set parameters for
+ * @param {module:twgl.TextureOptions} options A TextureOptions object with whatever parameters you want set.
+ * This is often the same options you passed in when you created the texture.
+ * @memberOf module:twgl/textures
+ */
+function setTextureParameters(gl, tex, options) {
+ const target = options.target || TEXTURE_2D$2;
+ gl.bindTexture(target, tex);
+ setTextureSamplerParameters(gl, target, gl.texParameteri, options);
+}
+
+/**
+ * Sets the sampler parameters of a sampler.
+ * @param {WebGLRenderingContext} gl the WebGLRenderingContext
+ * @param {WebGLSampler} sampler the WebGLSampler to set parameters for
+ * @param {module:twgl.TextureOptions} options A TextureOptions object with whatever parameters you want set.
+ * @memberOf module:twgl/textures
+ */
+function setSamplerParameters(gl, sampler, options) {
+ setTextureSamplerParameters(gl, sampler, gl.samplerParameteri, options);
+}
+
+/**
+ * Creates a new sampler object and sets parameters.
+ *
+ * Example:
+ *
+ * const sampler = twgl.createSampler(gl, {
+ * minMag: gl.NEAREST, // sets both TEXTURE_MIN_FILTER and TEXTURE_MAG_FILTER
+ * wrap: gl.CLAMP_TO_NEAREST, // sets both TEXTURE_WRAP_S and TEXTURE_WRAP_T and TEXTURE_WRAP_R
+ * });
+ *
+ * @param {WebGLRenderingContext} gl the WebGLRenderingContext
+ * @param {Object.} options A object of TextureOptions one per sampler.
+ * @return {Object.} the created samplers by name
+ * @private
+ */
+function createSampler(gl, options) {
+ const sampler = gl.createSampler();
+ setSamplerParameters(gl, sampler, options);
+ return sampler;
+}
+
+/**
+ * Creates a multiple sampler objects and sets parameters on each.
+ *
+ * Example:
+ *
+ * const samplers = twgl.createSamplers(gl, {
+ * nearest: {
+ * minMag: gl.NEAREST,
+ * },
+ * nearestClampS: {
+ * minMag: gl.NEAREST,
+ * wrapS: gl.CLAMP_TO_NEAREST,
+ * },
+ * linear: {
+ * minMag: gl.LINEAR,
+ * },
+ * nearestClamp: {
+ * minMag: gl.NEAREST,
+ * wrap: gl.CLAMP_TO_EDGE,
+ * },
+ * linearClamp: {
+ * minMag: gl.LINEAR,
+ * wrap: gl.CLAMP_TO_EDGE,
+ * },
+ * linearClampT: {
+ * minMag: gl.LINEAR,
+ * wrapT: gl.CLAMP_TO_EDGE,
+ * },
+ * });
+ *
+ * @param {WebGLRenderingContext} gl the WebGLRenderingContext
+ * @param {module:twgl.TextureOptions} [options] A TextureOptions object with whatever parameters you want set on the sampler
+ * @private
+ */
+function createSamplers(gl, samplerOptions) {
+ const samplers = {};
+ Object.keys(samplerOptions).forEach(function(name) {
+ samplers[name] = createSampler(gl, samplerOptions[name]);
+ });
+ return samplers;
+}
+
+/**
+ * Makes a 1x1 pixel
+ * If no color is passed in uses the default color which can be set by calling `setDefaultTextureColor`.
+ * @param {(number[]|ArrayBufferView)} [color] The color using 0-1 values
+ * @return {Uint8Array} Unit8Array with color.
+ * @private
+ */
+function make1Pixel(color) {
+ color = color || defaults$1.textureColor;
+ if (isArrayBuffer(color)) {
+ return color;
+ }
+ return new Uint8Array([color[0] * 255, color[1] * 255, color[2] * 255, color[3] * 255]);
+}
+
+/**
+ * Sets filtering or generates mips for texture based on width or height
+ * If width or height is not passed in uses `options.width` and//or `options.height`
+ *
+ * @param {WebGLRenderingContext} gl the WebGLRenderingContext
+ * @param {WebGLTexture} tex the WebGLTexture to set parameters for
+ * @param {module:twgl.TextureOptions} [options] A TextureOptions object with whatever parameters you want set.
+ * This is often the same options you passed in when you created the texture.
+ * @param {number} [width] width of texture
+ * @param {number} [height] height of texture
+ * @param {number} [internalFormat] The internalFormat parameter from texImage2D etc..
+ * @memberOf module:twgl/textures
+ */
+function setTextureFilteringForSize(gl, tex, options, width, height, internalFormat) {
+ options = options || defaults$1.textureOptions;
+ internalFormat = internalFormat || RGBA$1;
+ const target = options.target || TEXTURE_2D$2;
+ width = width || options.width;
+ height = height || options.height;
+ gl.bindTexture(target, tex);
+ if (canGenerateMipmap(gl, width, height, internalFormat)) {
+ gl.generateMipmap(target);
+ } else {
+ const filtering = canFilter(internalFormat) ? LINEAR$1 : NEAREST;
+ gl.texParameteri(target, TEXTURE_MIN_FILTER, filtering);
+ gl.texParameteri(target, TEXTURE_MAG_FILTER, filtering);
+ gl.texParameteri(target, TEXTURE_WRAP_S, CLAMP_TO_EDGE$1);
+ gl.texParameteri(target, TEXTURE_WRAP_T, CLAMP_TO_EDGE$1);
+ }
+}
+
+function shouldAutomaticallySetTextureFilteringForSize(options) {
+ return options.auto === true || (options.auto === undefined && options.level === undefined);
+}
+
+/**
+ * Gets an array of cubemap face enums
+ * @param {WebGLRenderingContext} gl the WebGLRenderingContext
+ * @param {module:twgl.TextureOptions} options A TextureOptions object with whatever parameters you want set.
+ * This is often the same options you passed in when you created the texture.
+ * @return {number[]} cubemap face enums
+ * @private
+ */
+function getCubeFaceOrder(gl, options) {
+ options = options || {};
+ return options.cubeFaceOrder || [
+ TEXTURE_CUBE_MAP_POSITIVE_X,
+ TEXTURE_CUBE_MAP_NEGATIVE_X,
+ TEXTURE_CUBE_MAP_POSITIVE_Y,
+ TEXTURE_CUBE_MAP_NEGATIVE_Y,
+ TEXTURE_CUBE_MAP_POSITIVE_Z,
+ TEXTURE_CUBE_MAP_NEGATIVE_Z,
+ ];
+}
+
+/**
+ * @typedef {Object} FaceInfo
+ * @property {number} face gl enum for texImage2D
+ * @property {number} ndx face index (0 - 5) into source data
+ * @ignore
+ */
+
+/**
+ * Gets an array of FaceInfos
+ * There's a bug in some NVidia drivers that will crash the driver if
+ * `gl.TEXTURE_CUBE_MAP_POSITIVE_X` is not uploaded first. So, we take
+ * the user's desired order from his faces to WebGL and make sure we
+ * do the faces in WebGL order
+ *
+ * @param {WebGLRenderingContext} gl the WebGLRenderingContext
+ * @param {module:twgl.TextureOptions} options A TextureOptions object with whatever parameters you want set.
+ * @return {FaceInfo[]} cubemap face infos. Arguably the `face` property of each element is redundant but
+ * it's needed internally to sort the array of `ndx` properties by `face`.
+ * @private
+ */
+function getCubeFacesWithNdx(gl, options) {
+ const faces = getCubeFaceOrder(gl, options);
+ // work around bug in NVidia drivers. We have to upload the first face first else the driver crashes :(
+ const facesWithNdx = faces.map(function(face, ndx) {
+ return { face: face, ndx: ndx };
+ });
+ facesWithNdx.sort(function(a, b) {
+ return a.face - b.face;
+ });
+ return facesWithNdx;
+}
+
+/**
+ * Set a texture from the contents of an element. Will also set
+ * texture filtering or generate mips based on the dimensions of the element
+ * unless `options.auto === false`. If `target === gl.TEXTURE_CUBE_MAP` will
+ * attempt to slice image into 1x6, 2x3, 3x2, or 6x1 images, one for each face.
+ * @param {WebGLRenderingContext} gl the WebGLRenderingContext
+ * @param {WebGLTexture} tex the WebGLTexture to set parameters for
+ * @param {HTMLElement} element a canvas, img, or video element.
+ * @param {module:twgl.TextureOptions} [options] A TextureOptions object with whatever parameters you want set.
+ * This is often the same options you passed in when you created the texture.
+ * @memberOf module:twgl/textures
+ * @kind function
+ */
+function setTextureFromElement(gl, tex, element, options) {
+ options = options || defaults$1.textureOptions;
+ const target = options.target || TEXTURE_2D$2;
+ const level = options.level || 0;
+ let width = element.width;
+ let height = element.height;
+ const internalFormat = options.internalFormat || options.format || RGBA$1;
+ const formatType = getFormatAndTypeForInternalFormat(internalFormat);
+ const format = options.format || formatType.format;
+ const type = options.type || formatType.type;
+ setPackState(gl, options);
+ gl.bindTexture(target, tex);
+ if (target === TEXTURE_CUBE_MAP$1) {
+ // guess the parts
+ const imgWidth = element.width;
+ const imgHeight = element.height;
+ let size;
+ let slices;
+ if (imgWidth / 6 === imgHeight) {
+ // It's 6x1
+ size = imgHeight;
+ slices = [0, 0, 1, 0, 2, 0, 3, 0, 4, 0, 5, 0];
+ } else if (imgHeight / 6 === imgWidth) {
+ // It's 1x6
+ size = imgWidth;
+ slices = [0, 0, 0, 1, 0, 2, 0, 3, 0, 4, 0, 5];
+ } else if (imgWidth / 3 === imgHeight / 2) {
+ // It's 3x2
+ size = imgWidth / 3;
+ slices = [0, 0, 1, 0, 2, 0, 0, 1, 1, 1, 2, 1];
+ } else if (imgWidth / 2 === imgHeight / 3) {
+ // It's 2x3
+ size = imgWidth / 2;
+ slices = [0, 0, 1, 0, 0, 1, 1, 1, 0, 2, 1, 2];
+ } else {
+ throw "can't figure out cube map from element: " + (element.src ? element.src : element.nodeName);
+ }
+ const ctx = getShared2DContext();
+ if (ctx) {
+ ctx.canvas.width = size;
+ ctx.canvas.height = size;
+ width = size;
+ height = size;
+ getCubeFacesWithNdx(gl, options).forEach(function(f) {
+ const xOffset = slices[f.ndx * 2 + 0] * size;
+ const yOffset = slices[f.ndx * 2 + 1] * size;
+ ctx.drawImage(element, xOffset, yOffset, size, size, 0, 0, size, size);
+ gl.texImage2D(f.face, level, internalFormat, format, type, ctx.canvas);
+ });
+ // Free up the canvas memory
+ ctx.canvas.width = 1;
+ ctx.canvas.height = 1;
+ } else if (typeof createImageBitmap !== 'undefined') {
+ // NOTE: It seems like we should prefer ImageBitmap because unlike canvas it's
+ // note lossy? (alpha is not premultiplied? although I'm not sure what
+ width = size;
+ height = size;
+ getCubeFacesWithNdx(gl, options).forEach(function(f) {
+ const xOffset = slices[f.ndx * 2 + 0] * size;
+ const yOffset = slices[f.ndx * 2 + 1] * size;
+ // We can't easily use a default texture color here as it would have to match
+ // the type across all faces where as with a 2D one there's only one face
+ // so we're replacing everything all at once. It also has to be the correct size.
+ // On the other hand we need all faces to be the same size so as one face loads
+ // the rest match else the texture will be un-renderable.
+ gl.texImage2D(f.face, level, internalFormat, size, size, 0, format, type, null);
+ createImageBitmap(element, xOffset, yOffset, size, size, {
+ premultiplyAlpha: 'none',
+ colorSpaceConversion: 'none',
+ })
+ .then(function(imageBitmap) {
+ setPackState(gl, options);
+ gl.bindTexture(target, tex);
+ gl.texImage2D(f.face, level, internalFormat, format, type, imageBitmap);
+ if (shouldAutomaticallySetTextureFilteringForSize(options)) {
+ setTextureFilteringForSize(gl, tex, options, width, height, internalFormat);
+ }
+ });
+ });
+ }
+ } else if (target === TEXTURE_3D$1 || target === TEXTURE_2D_ARRAY$1) {
+ const smallest = Math.min(element.width, element.height);
+ const largest = Math.max(element.width, element.height);
+ const depth = largest / smallest;
+ if (depth % 1 !== 0) {
+ throw "can not compute 3D dimensions of element";
+ }
+ const xMult = element.width === largest ? 1 : 0;
+ const yMult = element.height === largest ? 1 : 0;
+ gl.pixelStorei(UNPACK_ALIGNMENT, 1);
+ gl.pixelStorei(UNPACK_ROW_LENGTH, element.width);
+ gl.pixelStorei(UNPACK_IMAGE_HEIGHT, 0);
+ gl.pixelStorei(UNPACK_SKIP_IMAGES, 0);
+ gl.texImage3D(target, level, internalFormat, smallest, smallest, smallest, 0, format, type, null);
+ for (let d = 0; d < depth; ++d) {
+ const srcX = d * smallest * xMult;
+ const srcY = d * smallest * yMult;
+ gl.pixelStorei(UNPACK_SKIP_PIXELS, srcX);
+ gl.pixelStorei(UNPACK_SKIP_ROWS, srcY);
+ gl.texSubImage3D(target, level, 0, 0, d, smallest, smallest, 1, format, type, element);
+ }
+ setSkipStateToDefault(gl);
+ } else {
+ gl.texImage2D(target, level, internalFormat, format, type, element);
+ }
+ if (shouldAutomaticallySetTextureFilteringForSize(options)) {
+ setTextureFilteringForSize(gl, tex, options, width, height, internalFormat);
+ }
+ setTextureParameters(gl, tex, options);
+}
+
+function noop() {
+}
+
+/**
+ * Checks whether the url's origin is the same so that we can set the `crossOrigin`
+ * @param {string} url url to image
+ * @returns {boolean} true if the window's origin is the same as image's url
+ * @private
+ */
+function urlIsSameOrigin(url) {
+ if (typeof document !== 'undefined') {
+ // for IE really
+ const a = document.createElement('a');
+ a.href = url;
+ return a.hostname === location.hostname &&
+ a.port === location.port &&
+ a.protocol === location.protocol;
+ } else {
+ const localOrigin = (new URL(location.href)).origin;
+ const urlOrigin = (new URL(url, location.href)).origin;
+ return urlOrigin === localOrigin;
+ }
+}
+
+function setToAnonymousIfUndefinedAndURLIsNotSameOrigin(url, crossOrigin) {
+ return crossOrigin === undefined && !urlIsSameOrigin(url)
+ ? 'anonymous'
+ : crossOrigin;
+}
+
+/**
+ * Loads an image
+ * @param {string} url url to image
+ * @param {string} crossOrigin
+ * @param {function(err, img)} [callback] a callback that's passed an error and the image. The error will be non-null
+ * if there was an error
+ * @return {HTMLImageElement} the image being loaded.
+ * @private
+ */
+function loadImage(url, crossOrigin, callback) {
+ callback = callback || noop;
+ let img;
+ crossOrigin = crossOrigin !== undefined ? crossOrigin : defaults$1.crossOrigin;
+ crossOrigin = setToAnonymousIfUndefinedAndURLIsNotSameOrigin(url, crossOrigin);
+ if (typeof Image !== 'undefined') {
+ img = new Image();
+ if (crossOrigin !== undefined) {
+ img.crossOrigin = crossOrigin;
+ }
+
+ const clearEventHandlers = function clearEventHandlers() {
+ img.removeEventListener('error', onError); // eslint-disable-line
+ img.removeEventListener('load', onLoad); // eslint-disable-line
+ img = null;
+ };
+
+ const onError = function onError() {
+ const msg = "couldn't load image: " + url;
+ error$1(msg);
+ callback(msg, img);
+ clearEventHandlers();
+ };
+
+ const onLoad = function onLoad() {
+ callback(null, img);
+ clearEventHandlers();
+ };
+
+ img.addEventListener('error', onError);
+ img.addEventListener('load', onLoad);
+ img.src = url;
+ return img;
+ } else if (typeof ImageBitmap !== 'undefined') {
+ let err;
+ let bm;
+ const cb = function cb() {
+ callback(err, bm);
+ };
+
+ const options = {};
+ if (crossOrigin) {
+ options.mode = 'cors'; // TODO: not sure how to translate image.crossOrigin
+ }
+ fetch(url, options).then(function(response) {
+ if (!response.ok) {
+ throw response;
+ }
+ return response.blob();
+ }).then(function(blob) {
+ return createImageBitmap(blob, {
+ premultiplyAlpha: 'none',
+ colorSpaceConversion: 'none',
+ });
+ }).then(function(bitmap) {
+ // not sure if this works. We don't want
+ // to catch the user's error. So, call
+ // the callback in a timeout so we're
+ // not in this scope inside the promise.
+ bm = bitmap;
+ setTimeout(cb);
+ }).catch(function(e) {
+ err = e;
+ setTimeout(cb);
+ });
+ img = null;
+ }
+ return img;
+}
+
+/**
+ * check if object is a TexImageSource
+ *
+ * @param {Object} obj Object to test
+ * @return {boolean} true if object is a TexImageSource
+ * @private
+ */
+function isTexImageSource(obj) {
+ return (typeof ImageBitmap !== 'undefined' && obj instanceof ImageBitmap) ||
+ (typeof ImageData !== 'undefined' && obj instanceof ImageData) ||
+ (typeof HTMLElement !== 'undefined' && obj instanceof HTMLElement);
+}
+
+/**
+ * if obj is an TexImageSource then just
+ * uses it otherwise if obj is a string
+ * then load it first.
+ *
+ * @param {string|TexImageSource} obj
+ * @param {string} crossOrigin
+ * @param {function(err, img)} [callback] a callback that's passed an error and the image. The error will be non-null
+ * if there was an error
+ * @private
+ */
+function loadAndUseImage(obj, crossOrigin, callback) {
+ if (isTexImageSource(obj)) {
+ setTimeout(function() {
+ callback(null, obj);
+ });
+ return obj;
+ }
+
+ return loadImage(obj, crossOrigin, callback);
+}
+
+/**
+ * Sets a texture to a 1x1 pixel color. If `options.color === false` is nothing happens. If it's not set
+ * the default texture color is used which can be set by calling `setDefaultTextureColor`.
+ * @param {WebGLRenderingContext} gl the WebGLRenderingContext
+ * @param {WebGLTexture} tex the WebGLTexture to set parameters for
+ * @param {module:twgl.TextureOptions} [options] A TextureOptions object with whatever parameters you want set.
+ * This is often the same options you passed in when you created the texture.
+ * @memberOf module:twgl/textures
+ * @private
+ */
+function setTextureTo1PixelColor(gl, tex, options) {
+ options = options || defaults$1.textureOptions;
+ const target = options.target || TEXTURE_2D$2;
+ gl.bindTexture(target, tex);
+ if (options.color === false) {
+ return;
+ }
+ // Assume it's a URL
+ // Put 1x1 pixels in texture. That makes it renderable immediately regardless of filtering.
+ const color = make1Pixel(options.color);
+ if (target === TEXTURE_CUBE_MAP$1) {
+ for (let ii = 0; ii < 6; ++ii) {
+ gl.texImage2D(TEXTURE_CUBE_MAP_POSITIVE_X + ii, 0, RGBA$1, 1, 1, 0, RGBA$1, UNSIGNED_BYTE$1, color);
+ }
+ } else if (target === TEXTURE_3D$1 || target === TEXTURE_2D_ARRAY$1) {
+ gl.texImage3D(target, 0, RGBA$1, 1, 1, 1, 0, RGBA$1, UNSIGNED_BYTE$1, color);
+ } else {
+ gl.texImage2D(target, 0, RGBA$1, 1, 1, 0, RGBA$1, UNSIGNED_BYTE$1, color);
+ }
+}
+
+/**
+ * The src image(s) used to create a texture.
+ *
+ * When you call {@link module:twgl.createTexture} or {@link module:twgl.createTextures}
+ * you can pass in urls for images to load into the textures. If it's a single url
+ * then this will be a single HTMLImageElement. If it's an array of urls used for a cubemap
+ * this will be a corresponding array of images for the cubemap.
+ *
+ * @typedef {HTMLImageElement|HTMLImageElement[]} TextureSrc
+ * @memberOf module:twgl
+ */
+
+/**
+ * A callback for when an image finished downloading and been uploaded into a texture
+ * @callback TextureReadyCallback
+ * @param {*} err If truthy there was an error.
+ * @param {WebGLTexture} texture the texture.
+ * @param {module:twgl.TextureSrc} source image(s) used to as the src for the texture
+ * @memberOf module:twgl
+ */
+
+/**
+ * A callback for when all images have finished downloading and been uploaded into their respective textures
+ * @callback TexturesReadyCallback
+ * @param {*} err If truthy there was an error.
+ * @param {Object.} textures the created textures by name. Same as returned by {@link module:twgl.createTextures}.
+ * @param {Object.} sources the image(s) used for the texture by name.
+ * @memberOf module:twgl
+ */
+
+/**
+ * A callback for when an image finished downloading and been uploaded into a texture
+ * @callback CubemapReadyCallback
+ * @param {*} err If truthy there was an error.
+ * @param {WebGLTexture} tex the texture.
+ * @param {HTMLImageElement[]} imgs the images for each face.
+ * @memberOf module:twgl
+ */
+
+/**
+ * A callback for when an image finished downloading and been uploaded into a texture
+ * @callback ThreeDReadyCallback
+ * @param {*} err If truthy there was an error.
+ * @param {WebGLTexture} tex the texture.
+ * @param {HTMLImageElement[]} imgs the images for each slice.
+ * @memberOf module:twgl
+ */
+
+/**
+ * Loads a texture from an image from a Url as specified in `options.src`
+ * If `options.color !== false` will set the texture to a 1x1 pixel color so that the texture is
+ * immediately useable. It will be updated with the contents of the image once the image has finished
+ * downloading. Filtering options will be set as appropriate for image unless `options.auto === false`.
+ * @param {WebGLRenderingContext} gl the WebGLRenderingContext
+ * @param {WebGLTexture} tex the WebGLTexture to set parameters for
+ * @param {module:twgl.TextureOptions} [options] A TextureOptions object with whatever parameters you want set.
+ * @param {module:twgl.TextureReadyCallback} [callback] A function to be called when the image has finished loading. err will
+ * be non null if there was an error.
+ * @return {HTMLImageElement} the image being downloaded.
+ * @memberOf module:twgl/textures
+ */
+function loadTextureFromUrl(gl, tex, options, callback) {
+ callback = callback || noop;
+ options = options || defaults$1.textureOptions;
+ setTextureTo1PixelColor(gl, tex, options);
+ // Because it's async we need to copy the options.
+ options = Object.assign({}, options);
+ const img = loadAndUseImage(options.src, options.crossOrigin, function(err, img) {
+ if (err) {
+ callback(err, tex, img);
+ } else {
+ setTextureFromElement(gl, tex, img, options);
+ callback(null, tex, img);
+ }
+ });
+ return img;
+}
+
+/**
+ * Loads a cubemap from 6 urls or TexImageSources as specified in `options.src`. Will set the cubemap to a 1x1 pixel color
+ * so that it is usable immediately unless `option.color === false`.
+ * @param {WebGLRenderingContext} gl the WebGLRenderingContext
+ * @param {WebGLTexture} tex the WebGLTexture to set parameters for
+ * @param {module:twgl.TextureOptions} options A TextureOptions object with whatever parameters you want set.
+ * @param {module:twgl.CubemapReadyCallback} [callback] A function to be called when all the images have finished loading. err will
+ * be non null if there was an error.
+ * @memberOf module:twgl/textures
+ * @private
+ */
+function loadCubemapFromUrls(gl, tex, options, callback) {
+ callback = callback || noop;
+ const urls = options.src;
+ if (urls.length !== 6) {
+ throw "there must be 6 urls for a cubemap";
+ }
+ const level = options.level || 0;
+ const internalFormat = options.internalFormat || options.format || RGBA$1;
+ const formatType = getFormatAndTypeForInternalFormat(internalFormat);
+ const format = options.format || formatType.format;
+ const type = options.type || UNSIGNED_BYTE$1;
+ const target = options.target || TEXTURE_2D$2;
+ if (target !== TEXTURE_CUBE_MAP$1) {
+ throw "target must be TEXTURE_CUBE_MAP";
+ }
+ setTextureTo1PixelColor(gl, tex, options);
+ // Because it's async we need to copy the options.
+ options = Object.assign({}, options);
+ let numToLoad = 6;
+ const errors = [];
+ const faces = getCubeFaceOrder(gl, options);
+ let imgs; // eslint-disable-line
+
+ function uploadImg(faceTarget) {
+ return function(err, img) {
+ --numToLoad;
+ if (err) {
+ errors.push(err);
+ } else {
+ if (img.width !== img.height) {
+ errors.push("cubemap face img is not a square: " + img.src);
+ } else {
+ setPackState(gl, options);
+ gl.bindTexture(target, tex);
+
+ // So assuming this is the first image we now have one face that's img sized
+ // and 5 faces that are 1x1 pixel so size the other faces
+ if (numToLoad === 5) {
+ // use the default order
+ getCubeFaceOrder().forEach(function(otherTarget) {
+ // Should we re-use the same face or a color?
+ gl.texImage2D(otherTarget, level, internalFormat, format, type, img);
+ });
+ } else {
+ gl.texImage2D(faceTarget, level, internalFormat, format, type, img);
+ }
+
+ if (shouldAutomaticallySetTextureFilteringForSize(options)) {
+ gl.generateMipmap(target);
+ }
+ }
+ }
+
+ if (numToLoad === 0) {
+ callback(errors.length ? errors : undefined, tex, imgs);
+ }
+ };
+ }
+
+ imgs = urls.map(function(url, ndx) {
+ return loadAndUseImage(url, options.crossOrigin, uploadImg(faces[ndx]));
+ });
+}
+
+/**
+ * Loads a 2d array or 3d texture from urls OR TexImageSources as specified in `options.src`.
+ * Will set the texture to a 1x1 pixel color
+ * so that it is usable immediately unless `option.color === false`.
+ *
+ * If the width and height is not specified the width and height of the first
+ * image loaded will be used. Note that since images are loaded async
+ * which image downloads first is unknown.
+ *
+ * If an image is not the same size as the width and height it will be scaled
+ * to that width and height.
+ *
+ * @param {WebGLRenderingContext} gl the WebGLRenderingContext
+ * @param {WebGLTexture} tex the WebGLTexture to set parameters for
+ * @param {module:twgl.TextureOptions} options A TextureOptions object with whatever parameters you want set.
+ * @param {module:twgl.ThreeDReadyCallback} [callback] A function to be called when all the images have finished loading. err will
+ * be non null if there was an error.
+ * @memberOf module:twgl/textures
+ * @private
+ */
+function loadSlicesFromUrls(gl, tex, options, callback) {
+ callback = callback || noop;
+ const urls = options.src;
+ const internalFormat = options.internalFormat || options.format || RGBA$1;
+ const formatType = getFormatAndTypeForInternalFormat(internalFormat);
+ const format = options.format || formatType.format;
+ const type = options.type || UNSIGNED_BYTE$1;
+ const target = options.target || TEXTURE_2D_ARRAY$1;
+ if (target !== TEXTURE_3D$1 && target !== TEXTURE_2D_ARRAY$1) {
+ throw "target must be TEXTURE_3D or TEXTURE_2D_ARRAY";
+ }
+ setTextureTo1PixelColor(gl, tex, options);
+ // Because it's async we need to copy the options.
+ options = Object.assign({}, options);
+ let numToLoad = urls.length;
+ const errors = [];
+ let imgs; // eslint-disable-line
+ const level = options.level || 0;
+ let width = options.width;
+ let height = options.height;
+ const depth = urls.length;
+ let firstImage = true;
+
+ function uploadImg(slice) {
+ return function(err, img) {
+ --numToLoad;
+ if (err) {
+ errors.push(err);
+ } else {
+ setPackState(gl, options);
+ gl.bindTexture(target, tex);
+
+ if (firstImage) {
+ firstImage = false;
+ width = options.width || img.width;
+ height = options.height || img.height;
+ gl.texImage3D(target, level, internalFormat, width, height, depth, 0, format, type, null);
+
+ // put it in every slice otherwise some slices will be 0,0,0,0
+ for (let s = 0; s < depth; ++s) {
+ gl.texSubImage3D(target, level, 0, 0, s, width, height, 1, format, type, img);
+ }
+ } else {
+ let src = img;
+ let ctx;
+ if (img.width !== width || img.height !== height) {
+ // Size the image to fix
+ ctx = getShared2DContext();
+ src = ctx.canvas;
+ ctx.canvas.width = width;
+ ctx.canvas.height = height;
+ ctx.drawImage(img, 0, 0, width, height);
+ }
+
+ gl.texSubImage3D(target, level, 0, 0, slice, width, height, 1, format, type, src);
+
+ // free the canvas memory
+ if (ctx && src === ctx.canvas) {
+ ctx.canvas.width = 0;
+ ctx.canvas.height = 0;
+ }
+ }
+
+ if (shouldAutomaticallySetTextureFilteringForSize(options)) {
+ gl.generateMipmap(target);
+ }
+ }
+
+ if (numToLoad === 0) {
+ callback(errors.length ? errors : undefined, tex, imgs);
+ }
+ };
+ }
+
+ imgs = urls.map(function(url, ndx) {
+ return loadAndUseImage(url, options.crossOrigin, uploadImg(ndx));
+ });
+}
+
+/**
+ * Sets a texture from an array or typed array. If the width or height is not provided will attempt to
+ * guess the size. See {@link module:twgl.TextureOptions}.
+ * @param {WebGLRenderingContext} gl the WebGLRenderingContext
+ * @param {WebGLTexture} tex the WebGLTexture to set parameters for
+ * @param {(number[]|ArrayBufferView)} src An array or typed arry with texture data.
+ * @param {module:twgl.TextureOptions} [options] A TextureOptions object with whatever parameters you want set.
+ * This is often the same options you passed in when you created the texture.
+ * @memberOf module:twgl/textures
+ */
+function setTextureFromArray(gl, tex, src, options) {
+ options = options || defaults$1.textureOptions;
+ const target = options.target || TEXTURE_2D$2;
+ gl.bindTexture(target, tex);
+ let width = options.width;
+ let height = options.height;
+ let depth = options.depth;
+ const level = options.level || 0;
+ const internalFormat = options.internalFormat || options.format || RGBA$1;
+ const formatType = getFormatAndTypeForInternalFormat(internalFormat);
+ const format = options.format || formatType.format;
+ const type = options.type || getTextureTypeForArrayType(gl, src, formatType.type);
+ if (!isArrayBuffer(src)) {
+ const Type = getTypedArrayTypeForGLType(type);
+ src = new Type(src);
+ } else if (src instanceof Uint8ClampedArray) {
+ src = new Uint8Array(src.buffer);
+ }
+
+ const bytesPerElement = getBytesPerElementForInternalFormat(internalFormat, type);
+ const numElements = src.byteLength / bytesPerElement; // TODO: check UNPACK_ALIGNMENT?
+ if (numElements % 1) {
+ throw "length wrong size for format: " + glEnumToString(gl, format);
+ }
+ let dimensions;
+ if (target === TEXTURE_3D$1 || target === TEXTURE_2D_ARRAY$1) {
+ if (!width && !height && !depth) {
+ const size = Math.cbrt(numElements);
+ if (size % 1 !== 0) {
+ throw "can't guess cube size of array of numElements: " + numElements;
+ }
+ width = size;
+ height = size;
+ depth = size;
+ } else if (width && (!height || !depth)) {
+ dimensions = guessDimensions(gl, target, height, depth, numElements / width);
+ height = dimensions.width;
+ depth = dimensions.height;
+ } else if (height && (!width || !depth)) {
+ dimensions = guessDimensions(gl, target, width, depth, numElements / height);
+ width = dimensions.width;
+ depth = dimensions.height;
+ } else {
+ dimensions = guessDimensions(gl, target, width, height, numElements / depth);
+ width = dimensions.width;
+ height = dimensions.height;
+ }
+ } else {
+ dimensions = guessDimensions(gl, target, width, height, numElements);
+ width = dimensions.width;
+ height = dimensions.height;
+ }
+ setSkipStateToDefault(gl);
+ gl.pixelStorei(UNPACK_ALIGNMENT, options.unpackAlignment || 1);
+ setPackState(gl, options);
+ if (target === TEXTURE_CUBE_MAP$1) {
+ const elementsPerElement = bytesPerElement / src.BYTES_PER_ELEMENT;
+ const faceSize = numElements / 6 * elementsPerElement;
+
+ getCubeFacesWithNdx(gl, options).forEach(f => {
+ const offset = faceSize * f.ndx;
+ const data = src.subarray(offset, offset + faceSize);
+ gl.texImage2D(f.face, level, internalFormat, width, height, 0, format, type, data);
+ });
+ } else if (target === TEXTURE_3D$1 || target === TEXTURE_2D_ARRAY$1) {
+ gl.texImage3D(target, level, internalFormat, width, height, depth, 0, format, type, src);
+ } else {
+ gl.texImage2D(target, level, internalFormat, width, height, 0, format, type, src);
+ }
+ return {
+ width: width,
+ height: height,
+ depth: depth,
+ type: type,
+ };
+}
+
+/**
+ * Sets a texture with no contents of a certain size. In other words calls `gl.texImage2D` with `null`.
+ * You must set `options.width` and `options.height`.
+ * @param {WebGLRenderingContext} gl the WebGLRenderingContext
+ * @param {WebGLTexture} tex the WebGLTexture to set parameters for
+ * @param {module:twgl.TextureOptions} options A TextureOptions object with whatever parameters you want set.
+ * @memberOf module:twgl/textures
+ */
+function setEmptyTexture(gl, tex, options) {
+ const target = options.target || TEXTURE_2D$2;
+ gl.bindTexture(target, tex);
+ const level = options.level || 0;
+ const internalFormat = options.internalFormat || options.format || RGBA$1;
+ const formatType = getFormatAndTypeForInternalFormat(internalFormat);
+ const format = options.format || formatType.format;
+ const type = options.type || formatType.type;
+ setPackState(gl, options);
+ if (target === TEXTURE_CUBE_MAP$1) {
+ for (let ii = 0; ii < 6; ++ii) {
+ gl.texImage2D(TEXTURE_CUBE_MAP_POSITIVE_X + ii, level, internalFormat, options.width, options.height, 0, format, type, null);
+ }
+ } else if (target === TEXTURE_3D$1 || target === TEXTURE_2D_ARRAY$1) {
+ gl.texImage3D(target, level, internalFormat, options.width, options.height, options.depth, 0, format, type, null);
+ } else {
+ gl.texImage2D(target, level, internalFormat, options.width, options.height, 0, format, type, null);
+ }
+}
+
+/**
+ * Creates a texture based on the options passed in.
+ *
+ * Note: may reset UNPACK_ALIGNMENT, UNPACK_ROW_LENGTH, UNPACK_IMAGE_HEIGHT, UNPACK_SKIP_IMAGES
+ * UNPACK_SKIP_PIXELS, and UNPACK_SKIP_ROWS
+ *
+ * @param {WebGLRenderingContext} gl the WebGLRenderingContext
+ * @param {module:twgl.TextureOptions} [options] A TextureOptions object with whatever parameters you want set.
+ * @param {module:twgl.TextureReadyCallback} [callback] A callback called when an image has been downloaded and uploaded to the texture.
+ * @return {WebGLTexture} the created texture.
+ * @memberOf module:twgl/textures
+ */
+function createTexture(gl, options, callback) {
+ callback = callback || noop;
+ options = options || defaults$1.textureOptions;
+ const tex = gl.createTexture();
+ const target = options.target || TEXTURE_2D$2;
+ let width = options.width || 1;
+ let height = options.height || 1;
+ const internalFormat = options.internalFormat || RGBA$1;
+ gl.bindTexture(target, tex);
+ if (target === TEXTURE_CUBE_MAP$1) {
+ // this should have been the default for cubemaps :(
+ gl.texParameteri(target, TEXTURE_WRAP_S, CLAMP_TO_EDGE$1);
+ gl.texParameteri(target, TEXTURE_WRAP_T, CLAMP_TO_EDGE$1);
+ }
+ let src = options.src;
+ if (src) {
+ if (typeof src === "function") {
+ src = src(gl, options);
+ }
+ if (typeof (src) === "string") {
+ loadTextureFromUrl(gl, tex, options, callback);
+ } else if (isArrayBuffer(src) ||
+ (Array.isArray(src) && (
+ typeof src[0] === 'number' ||
+ Array.isArray(src[0]) ||
+ isArrayBuffer(src[0]))
+ )
+ ) {
+ const dimensions = setTextureFromArray(gl, tex, src, options);
+ width = dimensions.width;
+ height = dimensions.height;
+ } else if (Array.isArray(src) && (typeof (src[0]) === 'string' || isTexImageSource(src[0]))) {
+ if (target === TEXTURE_CUBE_MAP$1) {
+ loadCubemapFromUrls(gl, tex, options, callback);
+ } else {
+ loadSlicesFromUrls(gl, tex, options, callback);
+ }
+ } else { // if (isTexImageSource(src))
+ setTextureFromElement(gl, tex, src, options);
+ width = src.width;
+ height = src.height;
+ }
+ } else {
+ setEmptyTexture(gl, tex, options);
+ }
+ if (shouldAutomaticallySetTextureFilteringForSize(options)) {
+ setTextureFilteringForSize(gl, tex, options, width, height, internalFormat);
+ }
+ setTextureParameters(gl, tex, options);
+ return tex;
+}
+
+/**
+ * Resizes a texture based on the options passed in.
+ *
+ * Note: This is not a generic resize anything function.
+ * It's mostly used by {@link module:twgl.resizeFramebufferInfo}
+ * It will use `options.src` if it exists to try to determine a `type`
+ * otherwise it will assume `gl.UNSIGNED_BYTE`. No data is provided
+ * for the texture. Texture parameters will be set accordingly
+ *
+ * @param {WebGLRenderingContext} gl the WebGLRenderingContext
+ * @param {WebGLTexture} tex the texture to resize
+ * @param {module:twgl.TextureOptions} options A TextureOptions object with whatever parameters you want set.
+ * @param {number} [width] the new width. If not passed in will use `options.width`
+ * @param {number} [height] the new height. If not passed in will use `options.height`
+ * @param {number} [depth] the new depth. If not passed in will use `options.depth`
+ * @memberOf module:twgl/textures
+ */
+function resizeTexture(gl, tex, options, width, height, depth) {
+ width = width || options.width;
+ height = height || options.height;
+ depth = depth || options.depth;
+ const target = options.target || TEXTURE_2D$2;
+ gl.bindTexture(target, tex);
+ const level = options.level || 0;
+ const internalFormat = options.internalFormat || options.format || RGBA$1;
+ const formatType = getFormatAndTypeForInternalFormat(internalFormat);
+ const format = options.format || formatType.format;
+ let type;
+ const src = options.src;
+ if (!src) {
+ type = options.type || formatType.type;
+ } else if (isArrayBuffer(src) || (Array.isArray(src) && typeof (src[0]) === 'number')) {
+ type = options.type || getTextureTypeForArrayType(gl, src, formatType.type);
+ } else {
+ type = options.type || formatType.type;
+ }
+ if (target === TEXTURE_CUBE_MAP$1) {
+ for (let ii = 0; ii < 6; ++ii) {
+ gl.texImage2D(TEXTURE_CUBE_MAP_POSITIVE_X + ii, level, internalFormat, width, height, 0, format, type, null);
+ }
+ } else if (target === TEXTURE_3D$1 || target === TEXTURE_2D_ARRAY$1) {
+ gl.texImage3D(target, level, internalFormat, width, height, depth, 0, format, type, null);
+ } else {
+ gl.texImage2D(target, level, internalFormat, width, height, 0, format, type, null);
+ }
+}
+
+/**
+ * Check if a src is an async request.
+ * if src is a string we're going to download an image
+ * if src is an array of strings we're going to download cubemap images
+ * @param {*} src The src from a TextureOptions
+ * @returns {bool} true if src is async.
+ * @private
+ */
+function isAsyncSrc(src) {
+ return typeof src === 'string' ||
+ (Array.isArray(src) && typeof src[0] === 'string');
+}
+
+/**
+ * Creates a bunch of textures based on the passed in options.
+ *
+ * Example:
+ *
+ * const textures = twgl.createTextures(gl, {
+ * // a power of 2 image
+ * hftIcon: { src: "images/hft-icon-16.png", mag: gl.NEAREST },
+ * // a non-power of 2 image
+ * clover: { src: "images/clover.jpg" },
+ * // From a canvas
+ * fromCanvas: { src: ctx.canvas },
+ * // A cubemap from 6 images
+ * yokohama: {
+ * target: gl.TEXTURE_CUBE_MAP,
+ * src: [
+ * 'images/yokohama/posx.jpg',
+ * 'images/yokohama/negx.jpg',
+ * 'images/yokohama/posy.jpg',
+ * 'images/yokohama/negy.jpg',
+ * 'images/yokohama/posz.jpg',
+ * 'images/yokohama/negz.jpg',
+ * ],
+ * },
+ * // A cubemap from 1 image (can be 1x6, 2x3, 3x2, 6x1)
+ * goldengate: {
+ * target: gl.TEXTURE_CUBE_MAP,
+ * src: 'images/goldengate.jpg',
+ * },
+ * // A 2x2 pixel texture from a JavaScript array
+ * checker: {
+ * mag: gl.NEAREST,
+ * min: gl.LINEAR,
+ * src: [
+ * 255,255,255,255,
+ * 192,192,192,255,
+ * 192,192,192,255,
+ * 255,255,255,255,
+ * ],
+ * },
+ * // a 1x2 pixel texture from a typed array.
+ * stripe: {
+ * mag: gl.NEAREST,
+ * min: gl.LINEAR,
+ * format: gl.LUMINANCE,
+ * src: new Uint8Array([
+ * 255,
+ * 128,
+ * 255,
+ * 128,
+ * 255,
+ * 128,
+ * 255,
+ * 128,
+ * ]),
+ * width: 1,
+ * },
+ * });
+ *
+ * Now
+ *
+ * * `textures.hftIcon` will be a 2d texture
+ * * `textures.clover` will be a 2d texture
+ * * `textures.fromCanvas` will be a 2d texture
+ * * `textures.yohohama` will be a cubemap texture
+ * * `textures.goldengate` will be a cubemap texture
+ * * `textures.checker` will be a 2d texture
+ * * `textures.stripe` will be a 2d texture
+ *
+ * @param {WebGLRenderingContext} gl the WebGLRenderingContext
+ * @param {Object.} options A object of TextureOptions one per texture.
+ * @param {module:twgl.TexturesReadyCallback} [callback] A callback called when all textures have been downloaded.
+ * @return {Object.} the created textures by name
+ * @memberOf module:twgl/textures
+ */
+function createTextures(gl, textureOptions, callback) {
+ callback = callback || noop;
+ let numDownloading = 0;
+ const errors = [];
+ const textures = {};
+ const images = {};
+
+ function callCallbackIfReady() {
+ if (numDownloading === 0) {
+ setTimeout(function() {
+ callback(errors.length ? errors : undefined, textures, images);
+ }, 0);
+ }
+ }
+
+ Object.keys(textureOptions).forEach(function(name) {
+ const options = textureOptions[name];
+ let onLoadFn;
+ if (isAsyncSrc(options.src)) {
+ onLoadFn = function(err, tex, img) {
+ images[name] = img;
+ --numDownloading;
+ if (err) {
+ errors.push(err);
+ }
+ callCallbackIfReady();
+ };
+ ++numDownloading;
+ }
+ textures[name] = createTexture(gl, options, onLoadFn);
+ });
+
+ // queue the callback if there are no images to download.
+ // We do this because if your code is structured to wait for
+ // images to download but then you comment out all the async
+ // images your code would break.
+ callCallbackIfReady();
+
+ return textures;
+}
+
+var textures = /*#__PURE__*/Object.freeze({
+ __proto__: null,
+ setTextureDefaults_: setDefaults$1,
+ createSampler: createSampler,
+ createSamplers: createSamplers,
+ setSamplerParameters: setSamplerParameters,
+ createTexture: createTexture,
+ setEmptyTexture: setEmptyTexture,
+ setTextureFromArray: setTextureFromArray,
+ loadTextureFromUrl: loadTextureFromUrl,
+ setTextureFromElement: setTextureFromElement,
+ setTextureFilteringForSize: setTextureFilteringForSize,
+ setTextureParameters: setTextureParameters,
+ setDefaultTextureColor: setDefaultTextureColor,
+ createTextures: createTextures,
+ resizeTexture: resizeTexture,
+ canGenerateMipmap: canGenerateMipmap,
+ canFilter: canFilter,
+ getNumComponentsForFormat: getNumComponentsForFormat,
+ getBytesPerElementForInternalFormat: getBytesPerElementForInternalFormat,
+ getFormatAndTypeForInternalFormat: getFormatAndTypeForInternalFormat
+});
+
+/*
+ * Copyright 2019 Gregg Tavares
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+/**
+ * Low level shader program related functions
+ *
+ * You should generally not need to use these functions. They are provided
+ * for those cases where you're doing something out of the ordinary
+ * and you need lower level access.
+ *
+ * For backward compatibility they are available at both `twgl.programs` and `twgl`
+ * itself
+ *
+ * See {@link module:twgl} for core functions
+ *
+ * @module twgl/programs
+ */
+
+const error = error$1;
+const warn = warn$1;
+function getElementById(id) {
+ return (typeof document !== 'undefined' && document.getElementById)
+ ? document.getElementById(id)
+ : null;
+}
+
+const TEXTURE0 = 0x84c0;
+const DYNAMIC_DRAW = 0x88e8;
+
+const ARRAY_BUFFER = 0x8892;
+const ELEMENT_ARRAY_BUFFER$1 = 0x8893;
+const UNIFORM_BUFFER = 0x8a11;
+const TRANSFORM_FEEDBACK_BUFFER = 0x8c8e;
+
+const TRANSFORM_FEEDBACK = 0x8e22;
+
+const COMPILE_STATUS = 0x8b81;
+const LINK_STATUS = 0x8b82;
+const FRAGMENT_SHADER = 0x8b30;
+const VERTEX_SHADER = 0x8b31;
+const SEPARATE_ATTRIBS = 0x8c8d;
+
+const ACTIVE_UNIFORMS = 0x8b86;
+const ACTIVE_ATTRIBUTES = 0x8b89;
+const TRANSFORM_FEEDBACK_VARYINGS = 0x8c83;
+const ACTIVE_UNIFORM_BLOCKS = 0x8a36;
+const UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER = 0x8a44;
+const UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER = 0x8a46;
+const UNIFORM_BLOCK_DATA_SIZE = 0x8a40;
+const UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES = 0x8a43;
+
+const FLOAT = 0x1406;
+const FLOAT_VEC2 = 0x8B50;
+const FLOAT_VEC3 = 0x8B51;
+const FLOAT_VEC4 = 0x8B52;
+const INT = 0x1404;
+const INT_VEC2 = 0x8B53;
+const INT_VEC3 = 0x8B54;
+const INT_VEC4 = 0x8B55;
+const BOOL = 0x8B56;
+const BOOL_VEC2 = 0x8B57;
+const BOOL_VEC3 = 0x8B58;
+const BOOL_VEC4 = 0x8B59;
+const FLOAT_MAT2 = 0x8B5A;
+const FLOAT_MAT3 = 0x8B5B;
+const FLOAT_MAT4 = 0x8B5C;
+const SAMPLER_2D = 0x8B5E;
+const SAMPLER_CUBE = 0x8B60;
+const SAMPLER_3D = 0x8B5F;
+const SAMPLER_2D_SHADOW = 0x8B62;
+const FLOAT_MAT2x3 = 0x8B65;
+const FLOAT_MAT2x4 = 0x8B66;
+const FLOAT_MAT3x2 = 0x8B67;
+const FLOAT_MAT3x4 = 0x8B68;
+const FLOAT_MAT4x2 = 0x8B69;
+const FLOAT_MAT4x3 = 0x8B6A;
+const SAMPLER_2D_ARRAY = 0x8DC1;
+const SAMPLER_2D_ARRAY_SHADOW = 0x8DC4;
+const SAMPLER_CUBE_SHADOW = 0x8DC5;
+const UNSIGNED_INT = 0x1405;
+const UNSIGNED_INT_VEC2 = 0x8DC6;
+const UNSIGNED_INT_VEC3 = 0x8DC7;
+const UNSIGNED_INT_VEC4 = 0x8DC8;
+const INT_SAMPLER_2D = 0x8DCA;
+const INT_SAMPLER_3D = 0x8DCB;
+const INT_SAMPLER_CUBE = 0x8DCC;
+const INT_SAMPLER_2D_ARRAY = 0x8DCF;
+const UNSIGNED_INT_SAMPLER_2D = 0x8DD2;
+const UNSIGNED_INT_SAMPLER_3D = 0x8DD3;
+const UNSIGNED_INT_SAMPLER_CUBE = 0x8DD4;
+const UNSIGNED_INT_SAMPLER_2D_ARRAY = 0x8DD7;
+
+const TEXTURE_2D$1 = 0x0DE1;
+const TEXTURE_CUBE_MAP = 0x8513;
+const TEXTURE_3D = 0x806F;
+const TEXTURE_2D_ARRAY = 0x8C1A;
+
+const typeMap = {};
+
+/**
+ * Returns the corresponding bind point for a given sampler type
+ * @private
+ */
+function getBindPointForSamplerType(gl, type) {
+ return typeMap[type].bindPoint;
+}
+
+// This kind of sucks! If you could compose functions as in `var fn = gl[name];`
+// this code could be a lot smaller but that is sadly really slow (T_T)
+
+function floatSetter(gl, location) {
+ return function(v) {
+ gl.uniform1f(location, v);
+ };
+}
+
+function floatArraySetter(gl, location) {
+ return function(v) {
+ gl.uniform1fv(location, v);
+ };
+}
+
+function floatVec2Setter(gl, location) {
+ return function(v) {
+ gl.uniform2fv(location, v);
+ };
+}
+
+function floatVec3Setter(gl, location) {
+ return function(v) {
+ gl.uniform3fv(location, v);
+ };
+}
+
+function floatVec4Setter(gl, location) {
+ return function(v) {
+ gl.uniform4fv(location, v);
+ };
+}
+
+function intSetter(gl, location) {
+ return function(v) {
+ gl.uniform1i(location, v);
+ };
+}
+
+function intArraySetter(gl, location) {
+ return function(v) {
+ gl.uniform1iv(location, v);
+ };
+}
+
+function intVec2Setter(gl, location) {
+ return function(v) {
+ gl.uniform2iv(location, v);
+ };
+}
+
+function intVec3Setter(gl, location) {
+ return function(v) {
+ gl.uniform3iv(location, v);
+ };
+}
+
+function intVec4Setter(gl, location) {
+ return function(v) {
+ gl.uniform4iv(location, v);
+ };
+}
+
+function uintSetter(gl, location) {
+ return function(v) {
+ gl.uniform1ui(location, v);
+ };
+}
+
+function uintArraySetter(gl, location) {
+ return function(v) {
+ gl.uniform1uiv(location, v);
+ };
+}
+
+function uintVec2Setter(gl, location) {
+ return function(v) {
+ gl.uniform2uiv(location, v);
+ };
+}
+
+function uintVec3Setter(gl, location) {
+ return function(v) {
+ gl.uniform3uiv(location, v);
+ };
+}
+
+function uintVec4Setter(gl, location) {
+ return function(v) {
+ gl.uniform4uiv(location, v);
+ };
+}
+
+function floatMat2Setter(gl, location) {
+ return function(v) {
+ gl.uniformMatrix2fv(location, false, v);
+ };
+}
+
+function floatMat3Setter(gl, location) {
+ return function(v) {
+ gl.uniformMatrix3fv(location, false, v);
+ };
+}
+
+function floatMat4Setter(gl, location) {
+ return function(v) {
+ gl.uniformMatrix4fv(location, false, v);
+ };
+}
+
+function floatMat23Setter(gl, location) {
+ return function(v) {
+ gl.uniformMatrix2x3fv(location, false, v);
+ };
+}
+
+function floatMat32Setter(gl, location) {
+ return function(v) {
+ gl.uniformMatrix3x2fv(location, false, v);
+ };
+}
+
+function floatMat24Setter(gl, location) {
+ return function(v) {
+ gl.uniformMatrix2x4fv(location, false, v);
+ };
+}
+
+function floatMat42Setter(gl, location) {
+ return function(v) {
+ gl.uniformMatrix4x2fv(location, false, v);
+ };
+}
+
+function floatMat34Setter(gl, location) {
+ return function(v) {
+ gl.uniformMatrix3x4fv(location, false, v);
+ };
+}
+
+function floatMat43Setter(gl, location) {
+ return function(v) {
+ gl.uniformMatrix4x3fv(location, false, v);
+ };
+}
+
+function samplerSetter(gl, type, unit, location) {
+ const bindPoint = getBindPointForSamplerType(gl, type);
+ return isWebGL2(gl) ? function(textureOrPair) {
+ let texture;
+ let sampler;
+ if (!textureOrPair || isTexture(gl, textureOrPair)) {
+ texture = textureOrPair;
+ sampler = null;
+ } else {
+ texture = textureOrPair.texture;
+ sampler = textureOrPair.sampler;
+ }
+ gl.uniform1i(location, unit);
+ gl.activeTexture(TEXTURE0 + unit);
+ gl.bindTexture(bindPoint, texture);
+ gl.bindSampler(unit, sampler);
+ } : function(texture) {
+ gl.uniform1i(location, unit);
+ gl.activeTexture(TEXTURE0 + unit);
+ gl.bindTexture(bindPoint, texture);
+ };
+}
+
+function samplerArraySetter(gl, type, unit, location, size) {
+ const bindPoint = getBindPointForSamplerType(gl, type);
+ const units = new Int32Array(size);
+ for (let ii = 0; ii < size; ++ii) {
+ units[ii] = unit + ii;
+ }
+
+ return isWebGL2(gl) ? function(textures) {
+ gl.uniform1iv(location, units);
+ textures.forEach(function(textureOrPair, index) {
+ gl.activeTexture(TEXTURE0 + units[index]);
+ let texture;
+ let sampler;
+ if (!textureOrPair || isTexture(gl, textureOrPair)) {
+ texture = textureOrPair;
+ sampler = null;
+ } else {
+ texture = textureOrPair.texture;
+ sampler = textureOrPair.sampler;
+ }
+ gl.bindSampler(unit, sampler);
+ gl.bindTexture(bindPoint, texture);
+ });
+ } : function(textures) {
+ gl.uniform1iv(location, units);
+ textures.forEach(function(texture, index) {
+ gl.activeTexture(TEXTURE0 + units[index]);
+ gl.bindTexture(bindPoint, texture);
+ });
+ };
+}
+
+typeMap[FLOAT] = { Type: Float32Array, size: 4, setter: floatSetter, arraySetter: floatArraySetter, };
+typeMap[FLOAT_VEC2] = { Type: Float32Array, size: 8, setter: floatVec2Setter, cols: 2, };
+typeMap[FLOAT_VEC3] = { Type: Float32Array, size: 12, setter: floatVec3Setter, cols: 3, };
+typeMap[FLOAT_VEC4] = { Type: Float32Array, size: 16, setter: floatVec4Setter, cols: 4, };
+typeMap[INT] = { Type: Int32Array, size: 4, setter: intSetter, arraySetter: intArraySetter, };
+typeMap[INT_VEC2] = { Type: Int32Array, size: 8, setter: intVec2Setter, cols: 2, };
+typeMap[INT_VEC3] = { Type: Int32Array, size: 12, setter: intVec3Setter, cols: 3, };
+typeMap[INT_VEC4] = { Type: Int32Array, size: 16, setter: intVec4Setter, cols: 4, };
+typeMap[UNSIGNED_INT] = { Type: Uint32Array, size: 4, setter: uintSetter, arraySetter: uintArraySetter, };
+typeMap[UNSIGNED_INT_VEC2] = { Type: Uint32Array, size: 8, setter: uintVec2Setter, cols: 2, };
+typeMap[UNSIGNED_INT_VEC3] = { Type: Uint32Array, size: 12, setter: uintVec3Setter, cols: 3, };
+typeMap[UNSIGNED_INT_VEC4] = { Type: Uint32Array, size: 16, setter: uintVec4Setter, cols: 4, };
+typeMap[BOOL] = { Type: Uint32Array, size: 4, setter: intSetter, arraySetter: intArraySetter, };
+typeMap[BOOL_VEC2] = { Type: Uint32Array, size: 8, setter: intVec2Setter, cols: 2, };
+typeMap[BOOL_VEC3] = { Type: Uint32Array, size: 12, setter: intVec3Setter, cols: 3, };
+typeMap[BOOL_VEC4] = { Type: Uint32Array, size: 16, setter: intVec4Setter, cols: 4, };
+typeMap[FLOAT_MAT2] = { Type: Float32Array, size: 32, setter: floatMat2Setter, rows: 2, cols: 2, };
+typeMap[FLOAT_MAT3] = { Type: Float32Array, size: 48, setter: floatMat3Setter, rows: 3, cols: 3, };
+typeMap[FLOAT_MAT4] = { Type: Float32Array, size: 64, setter: floatMat4Setter, rows: 4, cols: 4, };
+typeMap[FLOAT_MAT2x3] = { Type: Float32Array, size: 32, setter: floatMat23Setter, rows: 2, cols: 3, };
+typeMap[FLOAT_MAT2x4] = { Type: Float32Array, size: 32, setter: floatMat24Setter, rows: 2, cols: 4, };
+typeMap[FLOAT_MAT3x2] = { Type: Float32Array, size: 48, setter: floatMat32Setter, rows: 3, cols: 2, };
+typeMap[FLOAT_MAT3x4] = { Type: Float32Array, size: 48, setter: floatMat34Setter, rows: 3, cols: 4, };
+typeMap[FLOAT_MAT4x2] = { Type: Float32Array, size: 64, setter: floatMat42Setter, rows: 4, cols: 2, };
+typeMap[FLOAT_MAT4x3] = { Type: Float32Array, size: 64, setter: floatMat43Setter, rows: 4, cols: 3, };
+typeMap[SAMPLER_2D] = { Type: null, size: 0, setter: samplerSetter, arraySetter: samplerArraySetter, bindPoint: TEXTURE_2D$1, };
+typeMap[SAMPLER_CUBE] = { Type: null, size: 0, setter: samplerSetter, arraySetter: samplerArraySetter, bindPoint: TEXTURE_CUBE_MAP, };
+typeMap[SAMPLER_3D] = { Type: null, size: 0, setter: samplerSetter, arraySetter: samplerArraySetter, bindPoint: TEXTURE_3D, };
+typeMap[SAMPLER_2D_SHADOW] = { Type: null, size: 0, setter: samplerSetter, arraySetter: samplerArraySetter, bindPoint: TEXTURE_2D$1, };
+typeMap[SAMPLER_2D_ARRAY] = { Type: null, size: 0, setter: samplerSetter, arraySetter: samplerArraySetter, bindPoint: TEXTURE_2D_ARRAY, };
+typeMap[SAMPLER_2D_ARRAY_SHADOW] = { Type: null, size: 0, setter: samplerSetter, arraySetter: samplerArraySetter, bindPoint: TEXTURE_2D_ARRAY, };
+typeMap[SAMPLER_CUBE_SHADOW] = { Type: null, size: 0, setter: samplerSetter, arraySetter: samplerArraySetter, bindPoint: TEXTURE_CUBE_MAP, };
+typeMap[INT_SAMPLER_2D] = { Type: null, size: 0, setter: samplerSetter, arraySetter: samplerArraySetter, bindPoint: TEXTURE_2D$1, };
+typeMap[INT_SAMPLER_3D] = { Type: null, size: 0, setter: samplerSetter, arraySetter: samplerArraySetter, bindPoint: TEXTURE_3D, };
+typeMap[INT_SAMPLER_CUBE] = { Type: null, size: 0, setter: samplerSetter, arraySetter: samplerArraySetter, bindPoint: TEXTURE_CUBE_MAP, };
+typeMap[INT_SAMPLER_2D_ARRAY] = { Type: null, size: 0, setter: samplerSetter, arraySetter: samplerArraySetter, bindPoint: TEXTURE_2D_ARRAY, };
+typeMap[UNSIGNED_INT_SAMPLER_2D] = { Type: null, size: 0, setter: samplerSetter, arraySetter: samplerArraySetter, bindPoint: TEXTURE_2D$1, };
+typeMap[UNSIGNED_INT_SAMPLER_3D] = { Type: null, size: 0, setter: samplerSetter, arraySetter: samplerArraySetter, bindPoint: TEXTURE_3D, };
+typeMap[UNSIGNED_INT_SAMPLER_CUBE] = { Type: null, size: 0, setter: samplerSetter, arraySetter: samplerArraySetter, bindPoint: TEXTURE_CUBE_MAP, };
+typeMap[UNSIGNED_INT_SAMPLER_2D_ARRAY] = { Type: null, size: 0, setter: samplerSetter, arraySetter: samplerArraySetter, bindPoint: TEXTURE_2D_ARRAY, };
+
+function floatAttribSetter(gl, index) {
+ return function(b) {
+ if (b.value) {
+ gl.disableVertexAttribArray(index);
+ switch (b.value.length) {
+ case 4:
+ gl.vertexAttrib4fv(index, b.value);
+ break;
+ case 3:
+ gl.vertexAttrib3fv(index, b.value);
+ break;
+ case 2:
+ gl.vertexAttrib2fv(index, b.value);
+ break;
+ case 1:
+ gl.vertexAttrib1fv(index, b.value);
+ break;
+ default:
+ throw new Error('the length of a float constant value must be between 1 and 4!');
+ }
+ } else {
+ gl.bindBuffer(ARRAY_BUFFER, b.buffer);
+ gl.enableVertexAttribArray(index);
+ gl.vertexAttribPointer(
+ index, b.numComponents || b.size, b.type || FLOAT, b.normalize || false, b.stride || 0, b.offset || 0);
+ if (gl.vertexAttribDivisor) {
+ gl.vertexAttribDivisor(index, b.divisor || 0);
+ }
+ }
+ };
+}
+
+function intAttribSetter(gl, index) {
+ return function(b) {
+ if (b.value) {
+ gl.disableVertexAttribArray(index);
+ if (b.value.length === 4) {
+ gl.vertexAttrib4iv(index, b.value);
+ } else {
+ throw new Error('The length of an integer constant value must be 4!');
+ }
+ } else {
+ gl.bindBuffer(ARRAY_BUFFER, b.buffer);
+ gl.enableVertexAttribArray(index);
+ gl.vertexAttribIPointer(
+ index, b.numComponents || b.size, b.type || INT, b.stride || 0, b.offset || 0);
+ if (gl.vertexAttribDivisor) {
+ gl.vertexAttribDivisor(index, b.divisor || 0);
+ }
+ }
+ };
+}
+
+function uintAttribSetter(gl, index) {
+ return function(b) {
+ if (b.value) {
+ gl.disableVertexAttribArray(index);
+ if (b.value.length === 4) {
+ gl.vertexAttrib4uiv(index, b.value);
+ } else {
+ throw new Error('The length of an unsigned integer constant value must be 4!');
+ }
+ } else {
+ gl.bindBuffer(ARRAY_BUFFER, b.buffer);
+ gl.enableVertexAttribArray(index);
+ gl.vertexAttribIPointer(
+ index, b.numComponents || b.size, b.type || UNSIGNED_INT, b.stride || 0, b.offset || 0);
+ if (gl.vertexAttribDivisor) {
+ gl.vertexAttribDivisor(index, b.divisor || 0);
+ }
+ }
+ };
+}
+
+function matAttribSetter(gl, index, typeInfo) {
+ const defaultSize = typeInfo.size;
+ const count = typeInfo.count;
+
+ return function(b) {
+ gl.bindBuffer(ARRAY_BUFFER, b.buffer);
+ const numComponents = b.size || b.numComponents || defaultSize;
+ const size = numComponents / count;
+ const type = b.type || FLOAT;
+ const typeInfo = typeMap[type];
+ const stride = typeInfo.size * numComponents;
+ const normalize = b.normalize || false;
+ const offset = b.offset || 0;
+ const rowOffset = stride / count;
+ for (let i = 0; i < count; ++i) {
+ gl.enableVertexAttribArray(index + i);
+ gl.vertexAttribPointer(
+ index + i, size, type, normalize, stride, offset + rowOffset * i);
+ if (gl.vertexAttribDivisor) {
+ gl.vertexAttribDivisor(index + i, b.divisor || 0);
+ }
+ }
+ };
+}
+
+
+
+const attrTypeMap = {};
+attrTypeMap[FLOAT] = { size: 4, setter: floatAttribSetter, };
+attrTypeMap[FLOAT_VEC2] = { size: 8, setter: floatAttribSetter, };
+attrTypeMap[FLOAT_VEC3] = { size: 12, setter: floatAttribSetter, };
+attrTypeMap[FLOAT_VEC4] = { size: 16, setter: floatAttribSetter, };
+attrTypeMap[INT] = { size: 4, setter: intAttribSetter, };
+attrTypeMap[INT_VEC2] = { size: 8, setter: intAttribSetter, };
+attrTypeMap[INT_VEC3] = { size: 12, setter: intAttribSetter, };
+attrTypeMap[INT_VEC4] = { size: 16, setter: intAttribSetter, };
+attrTypeMap[UNSIGNED_INT] = { size: 4, setter: uintAttribSetter, };
+attrTypeMap[UNSIGNED_INT_VEC2] = { size: 8, setter: uintAttribSetter, };
+attrTypeMap[UNSIGNED_INT_VEC3] = { size: 12, setter: uintAttribSetter, };
+attrTypeMap[UNSIGNED_INT_VEC4] = { size: 16, setter: uintAttribSetter, };
+attrTypeMap[BOOL] = { size: 4, setter: intAttribSetter, };
+attrTypeMap[BOOL_VEC2] = { size: 8, setter: intAttribSetter, };
+attrTypeMap[BOOL_VEC3] = { size: 12, setter: intAttribSetter, };
+attrTypeMap[BOOL_VEC4] = { size: 16, setter: intAttribSetter, };
+attrTypeMap[FLOAT_MAT2] = { size: 4, setter: matAttribSetter, count: 2, };
+attrTypeMap[FLOAT_MAT3] = { size: 9, setter: matAttribSetter, count: 3, };
+attrTypeMap[FLOAT_MAT4] = { size: 16, setter: matAttribSetter, count: 4, };
+
+const errorRE = /ERROR:\s*\d+:(\d+)/gi;
+function addLineNumbersWithError(src, log = '', lineOffset = 0) {
+ // Note: Error message formats are not defined by any spec so this may or may not work.
+ const matches = [...log.matchAll(errorRE)];
+ const lineNoToErrorMap = new Map(matches.map((m, ndx) => {
+ const lineNo = parseInt(m[1]);
+ const next = matches[ndx + 1];
+ const end = next ? next.index : log.length;
+ const msg = log.substring(m.index, end);
+ return [lineNo - 1, msg];
+ }));
+ return src.split('\n').map((line, lineNo) => {
+ const err = lineNoToErrorMap.get(lineNo);
+ return `${lineNo + 1 + lineOffset}: ${line}${err ? `\n\n^^^ ${err}` : ''}`;
+ }).join('\n');
+}
+
+/**
+ * Error Callback
+ * @callback ErrorCallback
+ * @param {string} msg error message.
+ * @param {number} [lineOffset] amount to add to line number
+ * @memberOf module:twgl
+ */
+
+/**
+ * Program Callback
+ * @callback ProgramCallback
+ * @param {string} [err] error message, falsy if no error
+ * @param {WebGLProgram|module:twgl.ProgramInfo} [result] the program or programInfo
+ */
+
+const spaceRE = /^[ \t]*\n/;
+
+/**
+ * Remove the first end of line because WebGL 2.0 requires
+ * #version 300 es
+ * as the first line. No whitespace allowed before that line
+ * so
+ *
+ *
+ *
+ * Has one line before it which is invalid according to GLSL ES 3.00
+ *
+ * @param {string} shaderSource The source of the shader
+ * @returns {{shaderSource: string, lineOffset: number}}
+ * @private
+ */
+function prepShaderSource(shaderSource) {
+ let lineOffset = 0;
+ if (spaceRE.test(shaderSource)) {
+ lineOffset = 1;
+ shaderSource = shaderSource.replace(spaceRE, '');
+ }
+ return {lineOffset, shaderSource};
+}
+
+/**
+ * @param {module:twgl.ProgramOptions} progOptions
+ * @param {string} msg
+ * @return null
+ * @private
+ */
+function reportError(progOptions, msg) {
+ progOptions.errorCallback(msg);
+ if (progOptions.callback) {
+ setTimeout(() => {
+ progOptions.callback(`${msg}\n${progOptions.errors.join('\n')}`);
+ });
+ }
+ return null;
+}
+
+/**
+ * Check Shader status
+ * @param {WebGLRenderingContext} gl The WebGLRenderingContext to use.
+ * @param {number} shaderType The shader type
+ * @param {WebGLShader} shader The shader
+ * @param {ErrorCallback} [errFn] function to receive error message.
+ * @return {string} errors or empty string
+ * @private
+ */
+function checkShaderStatus(gl, shaderType, shader, errFn) {
+ errFn = errFn || error;
+ // Check the compile status
+ const compiled = gl.getShaderParameter(shader, COMPILE_STATUS);
+ if (!compiled) {
+ // Something went wrong during compilation; get the error
+ const lastError = gl.getShaderInfoLog(shader);
+ const {lineOffset, shaderSource} = prepShaderSource(gl.getShaderSource(shader));
+ const error = `${addLineNumbersWithError(shaderSource, lastError, lineOffset)}\nError compiling ${glEnumToString(gl, shaderType)}: ${lastError}`;
+ errFn(error);
+ return error;
+ }
+ return '';
+}
+
+/**
+ * @typedef {Object} FullProgramSpec
+ * @property {string[]} shaders the shader source or element ids.
+ * @property {function(string)} [errorCallback] callback for errors
+ * @property {Object.|string[]} [attribLocations] a attribute name to location map, or array of attribute names where index = location.
+ * @property {(module:twgl.BufferInfo|Object.|string[])} [transformFeedbackVaryings] If passed
+ * a BufferInfo will use the attribs names inside. If passed an object of AttribInfos will use the names from that object. Otherwise
+ * you can pass an array of names.
+ * @property {number} [transformFeedbackMode] the mode to pass `gl.transformFeedbackVaryings`. Defaults to `SEPARATE_ATTRIBS`.
+ * @property {ProgramCallback} [callback] callback for async program compilation.
+ * @memberOf module:twgl
+ */
+
+/**
+ * @typedef {string[]|module:twgl.FullProgramSpec} ProgramSpec
+ * @memberOf module:twgl
+ */
+
+/**
+ * @typedef {Object} ProgramOptions
+ * @property {function(string)} [errorCallback] callback for errors
+ * @property {Object.|string[]} [attribLocations] a attribute name to location map, or array of attribute names where index = location.
+ * @property {(module:twgl.BufferInfo|Object.|string[])} [transformFeedbackVaryings] If passed
+ * a BufferInfo will use the attribs names inside. If passed an object of AttribInfos will use the names from that object. Otherwise
+ * you can pass an array of names.
+ * @property {number} [transformFeedbackMode] the mode to pass `gl.transformFeedbackVaryings`. Defaults to `SEPARATE_ATTRIBS`.
+ * @property {ProgramCallback} [callback] callback for async program compilation.
+ * @memberOf module:twgl
+ */
+
+/**
+ * Gets the program options based on all these optional arguments
+ * @param {module:twgl.ProgramOptions|string[]} [opt_attribs] Options for the program or an array of attribs names. Locations will be assigned by index if not passed in
+ * @param {number[]} [opt_locations] The locations for the. A parallel array to opt_attribs letting you assign locations.
+ * @param {module:twgl.ErrorCallback} [opt_errorCallback] callback for errors. By default it just prints an error to the console
+ * on error. If you want something else pass an callback. It's passed an error message.
+ * @return {module:twgl.ProgramOptions} an instance of ProgramOptions based on the arguments passed in
+ * @private
+ */
+function getProgramOptions(opt_attribs, opt_locations, opt_errorCallback) {
+ let transformFeedbackVaryings;
+ let transformFeedbackMode;
+ let callback;
+ if (typeof opt_locations === 'function') {
+ opt_errorCallback = opt_locations;
+ opt_locations = undefined;
+ }
+ if (typeof opt_attribs === 'function') {
+ opt_errorCallback = opt_attribs;
+ opt_attribs = undefined;
+ } else if (opt_attribs && !Array.isArray(opt_attribs)) {
+ const opt = opt_attribs;
+ opt_errorCallback = opt.errorCallback;
+ opt_attribs = opt.attribLocations;
+ transformFeedbackVaryings = opt.transformFeedbackVaryings;
+ transformFeedbackMode = opt.transformFeedbackMode;
+ callback = opt.callback;
+ }
+
+ const errorCallback = opt_errorCallback || error;
+ const errors = [];
+ const options = {
+ errorCallback(msg, ...args) {
+ errors.push(msg);
+ errorCallback(msg, ...args);
+ },
+ transformFeedbackVaryings,
+ transformFeedbackMode,
+ callback,
+ errors,
+ };
+
+ {
+ let attribLocations = {};
+ if (Array.isArray(opt_attribs)) {
+ opt_attribs.forEach(function(attrib, ndx) {
+ attribLocations[attrib] = opt_locations ? opt_locations[ndx] : ndx;
+ });
+ } else {
+ attribLocations = opt_attribs || {};
+ }
+ options.attribLocations = attribLocations;
+ }
+
+ return options;
+}
+
+const defaultShaderType = [
+ "VERTEX_SHADER",
+ "FRAGMENT_SHADER",
+];
+
+function getShaderTypeFromScriptType(gl, scriptType) {
+ if (scriptType.indexOf("frag") >= 0) {
+ return FRAGMENT_SHADER;
+ } else if (scriptType.indexOf("vert") >= 0) {
+ return VERTEX_SHADER;
+ }
+ return undefined;
+}
+
+function deleteProgramAndShaders(gl, program, notThese) {
+ const shaders = gl.getAttachedShaders(program);
+ for (const shader of shaders) {
+ if (notThese.has(shader)) {
+ gl.deleteShader(shader);
+ }
+ }
+ gl.deleteProgram(program);
+}
+
+const wait = (ms = 0) => new Promise(resolve => setTimeout(resolve, ms));
+
+function createProgramNoCheck(gl, shaders, programOptions) {
+ const program = gl.createProgram();
+ const {
+ attribLocations,
+ transformFeedbackVaryings,
+ transformFeedbackMode,
+ } = getProgramOptions(programOptions);
+
+ for (let ndx = 0; ndx < shaders.length; ++ndx) {
+ let shader = shaders[ndx];
+ if (typeof shader === 'string') {
+ const elem = getElementById(shader);
+ const src = elem ? elem.text : shader;
+ let type = gl[defaultShaderType[ndx]];
+ if (elem && elem.type) {
+ type = getShaderTypeFromScriptType(gl, elem.type) || type;
+ }
+ shader = gl.createShader(type);
+ gl.shaderSource(shader, prepShaderSource(src).shaderSource);
+ gl.compileShader(shader);
+ gl.attachShader(program, shader);
+ }
+ }
+
+ Object.entries(attribLocations).forEach(([attrib, loc]) => gl.bindAttribLocation(program, loc, attrib));
+
+ {
+ let varyings = transformFeedbackVaryings;
+ if (varyings) {
+ if (varyings.attribs) {
+ varyings = varyings.attribs;
+ }
+ if (!Array.isArray(varyings)) {
+ varyings = Object.keys(varyings);
+ }
+ gl.transformFeedbackVaryings(program, varyings, transformFeedbackMode || SEPARATE_ATTRIBS);
+ }
+ }
+
+ gl.linkProgram(program);
+ return program;
+}
+
+/**
+ * Creates a program, attaches (and/or compiles) shaders, binds attrib locations, links the
+ * program.
+ *
+ * NOTE: There are 4 signatures for this function
+ *
+ * twgl.createProgram(gl, [vs, fs], options);
+ * twgl.createProgram(gl, [vs, fs], opt_errFunc);
+ * twgl.createProgram(gl, [vs, fs], opt_attribs, opt_errFunc);
+ * twgl.createProgram(gl, [vs, fs], opt_attribs, opt_locations, opt_errFunc);
+ *
+ * @param {WebGLRenderingContext} gl The WebGLRenderingContext to use.
+ * @param {WebGLShader[]|string[]} shaders The shaders to attach, or element ids for their source, or strings that contain their source
+ * @param {module:twgl.ProgramOptions|string[]|module:twgl.ErrorCallback} [opt_attribs] Options for the program or an array of attribs names or an error callback. Locations will be assigned by index if not passed in
+ * @param {number[]} [opt_locations|module:twgl.ErrorCallback] The locations for the. A parallel array to opt_attribs letting you assign locations or an error callback.
+ * @param {module:twgl.ErrorCallback} [opt_errorCallback] callback for errors. By default it just prints an error to the console
+ * on error. If you want something else pass an callback. It's passed an error message.
+ * @return {WebGLProgram?} the created program or null if error of a callback was provided.
+ * @memberOf module:twgl/programs
+ */
+function createProgram(
+ gl, shaders, opt_attribs, opt_locations, opt_errorCallback) {
+ // This code is really convoluted, because it may or may not be async
+ // Maybe it would be better to have a separate function
+ const progOptions = getProgramOptions(opt_attribs, opt_locations, opt_errorCallback);
+ const shaderSet = new Set(shaders);
+ const program = createProgramNoCheck(gl, shaders, progOptions);
+
+ function hasErrors(gl, program) {
+ const errors = getProgramErrors(gl, program, progOptions.errorCallback);
+ if (errors) {
+ deleteProgramAndShaders(gl, program, shaderSet);
+ }
+ return errors;
+ }
+
+ if (progOptions.callback) {
+ waitForProgramLinkCompletionAsync(gl, program).then(() => {
+ const errors = hasErrors(gl, program);
+ progOptions.callback(errors, errors ? undefined : program);
+ });
+ return undefined;
+ }
+
+ return hasErrors(gl, program) ? undefined : program;
+}
+
+/**
+ * This only works because the functions it wraps the first 2 arguments
+ * are gl and any, followed by things that become programOptions
+ * @private
+ */
+function wrapCallbackFnToAsyncFn(fn) {
+ return function(gl, arg1, ...args) {
+ return new Promise((resolve, reject) => {
+ const programOptions = getProgramOptions(...args);
+ programOptions.callback = (err, program) => {
+ if (err) {
+ reject(err);
+ } else {
+ resolve(program);
+ }
+ };
+ fn(gl, arg1, programOptions);
+ });
+ };
+}
+
+/**
+ * Same as createProgram but returns a promise
+ *
+ * NOTE: There are 4 signatures for this function
+ *
+ * twgl.createProgramAsync(gl, [vs, fs], options);
+ * twgl.createProgramAsync(gl, [vs, fs], opt_errFunc);
+ * twgl.createProgramAsync(gl, [vs, fs], opt_attribs, opt_errFunc);
+ * twgl.createProgramAsync(gl, [vs, fs], opt_attribs, opt_locations, opt_errFunc);
+ *
+ * @function
+ * @param {WebGLRenderingContext} gl The WebGLRenderingContext to use.
+ * @param {WebGLShader[]|string[]} shaders The shaders to attach, or element ids for their source, or strings that contain their source
+ * @param {module:twgl.ProgramOptions|string[]|module:twgl.ErrorCallback} [opt_attribs] Options for the program or an array of attribs names or an error callback. Locations will be assigned by index if not passed in
+ * @param {number[]} [opt_locations|module:twgl.ErrorCallback] The locations for the. A parallel array to opt_attribs letting you assign locations or an error callback.
+ * @param {module:twgl.ErrorCallback} [opt_errorCallback] callback for errors. By default it just prints an error to the console
+ * on error. If you want something else pass an callback. It's passed an error message.
+ * @return {Promise} The created program
+ * @memberOf module:twgl/programs
+ */
+const createProgramAsync = wrapCallbackFnToAsyncFn(createProgram);
+
+/**
+ * Same as createProgramInfo but returns a promise
+ * @function
+ * @param {WebGLRenderingContext} gl The WebGLRenderingContext
+ * to use.
+ * @param {string[]} shaderSources Array of sources for the
+ * shaders or ids. The first is assumed to be the vertex shader,
+ * the second the fragment shader.
+ * @param {module:twgl.ProgramOptions|string[]|module:twgl.ErrorCallback} [opt_attribs] Options for the program or an array of attribs names or an error callback. Locations will be assigned by index if not passed in
+ * @param {number[]} [opt_locations|module:twgl.ErrorCallback] The locations for the. A parallel array to opt_attribs letting you assign locations or an error callback.
+ * @param {module:twgl.ErrorCallback} [opt_errorCallback] callback for errors. By default it just prints an error to the console
+ * on error. If you want something else pass an callback. It's passed an error message.
+ * @return {Promise} The created ProgramInfo
+ * @memberOf module:twgl/programs
+ */
+const createProgramInfoAsync = wrapCallbackFnToAsyncFn(createProgramInfo);
+
+async function waitForProgramLinkCompletionAsync(gl, program) {
+ const ext = gl.getExtension('KHR_parallel_shader_compile');
+ const checkFn = ext
+ ? (gl, program) => gl.getProgramParameter(program, ext.COMPLETION_STATUS_KHR)
+ : () => true;
+
+ let waitTime = 0;
+ do {
+ await wait(waitTime); // must wait at least once
+ waitTime = 1000 / 60;
+ } while (!checkFn(gl, program));
+}
+
+async function waitForAllProgramsLinkCompletionAsync(gl, programs) {
+ for (const program of Object.values(programs)) {
+ await waitForProgramLinkCompletionAsync(gl, program);
+ }
+}
+
+/**
+ * Check a program's link status
+ * @param {WebGLRenderingContext} gl The WebGLRenderingContext to use.
+ * @param {WebGLProgram} program Program to check
+ * @param {ErrorCallback} [errFn] func for errors
+ * @return {string?} errors if program is failed, else undefined
+ * @private
+ */
+function getProgramErrors(gl, program, errFn) {
+ errFn = errFn || error;
+ // Check the link status
+ const linked = gl.getProgramParameter(program, LINK_STATUS);
+ if (!linked) {
+ // something went wrong with the link
+ const lastError = gl.getProgramInfoLog(program);
+ errFn(`Error in program linking: ${lastError}`);
+ // print any errors from these shaders
+ const shaders = gl.getAttachedShaders(program);
+ const errors = shaders.map(shader => checkShaderStatus(gl, gl.getShaderParameter(shader, gl.SHADER_TYPE), shader, errFn));
+ return `${lastError}\n${errors.filter(_ => _).join('\n')}`;
+ }
+ return undefined;
+}
+
+/**
+ * Creates a program from 2 script tags.
+ *
+ * NOTE: There are 4 signatures for this function
+ *
+ * twgl.createProgramFromScripts(gl, [vs, fs], opt_options);
+ * twgl.createProgramFromScripts(gl, [vs, fs], opt_errFunc);
+ * twgl.createProgramFromScripts(gl, [vs, fs], opt_attribs, opt_errFunc);
+ * twgl.createProgramFromScripts(gl, [vs, fs], opt_attribs, opt_locations, opt_errFunc);
+ *
+ * @param {WebGLRenderingContext} gl The WebGLRenderingContext
+ * to use.
+ * @param {string[]} shaderScriptIds Array of ids of the script
+ * tags for the shaders. The first is assumed to be the
+ * vertex shader, the second the fragment shader.
+ * @param {module:twgl.ProgramOptions|string[]|module:twgl.ErrorCallback} [opt_attribs] Options for the program or an array of attribs names or an error callback. Locations will be assigned by index if not passed in
+ * @param {number[]} [opt_locations|module:twgl.ErrorCallback] The locations for the. A parallel array to opt_attribs letting you assign locations or an error callback.
+ * @param {module:twgl.ErrorCallback} [opt_errorCallback] callback for errors. By default it just prints an error to the console
+ * on error. If you want something else pass an callback. It's passed an error message.
+ * @return {WebGLProgram?} the created program or null if error or a callback was provided.
+ * @memberOf module:twgl/programs
+ */
+function createProgramFromScripts(
+ gl, shaderScriptIds, opt_attribs, opt_locations, opt_errorCallback) {
+ const progOptions = getProgramOptions(opt_attribs, opt_locations, opt_errorCallback);
+ const shaders = [];
+ for (const scriptId of shaderScriptIds) {
+ const shaderScript = getElementById(scriptId);
+ if (!shaderScript) {
+ return reportError(progOptions, `unknown script element: ${scriptId}`);
+ }
+ shaders.push(shaderScript.text);
+ }
+ return createProgram(gl, shaders, progOptions);
+}
+
+/**
+ * Creates a program from 2 sources.
+ *
+ * NOTE: There are 4 signatures for this function
+ *
+ * twgl.createProgramFromSource(gl, [vs, fs], opt_options);
+ * twgl.createProgramFromSource(gl, [vs, fs], opt_errFunc);
+ * twgl.createProgramFromSource(gl, [vs, fs], opt_attribs, opt_errFunc);
+ * twgl.createProgramFromSource(gl, [vs, fs], opt_attribs, opt_locations, opt_errFunc);
+ *
+ * @param {WebGLRenderingContext} gl The WebGLRenderingContext
+ * to use.
+ * @param {string[]} shaderSources Array of sources for the
+ * shaders. The first is assumed to be the vertex shader,
+ * the second the fragment shader.
+ * @param {module:twgl.ProgramOptions|string[]|module:twgl.ErrorCallback} [opt_attribs] Options for the program or an array of attribs names or an error callback. Locations will be assigned by index if not passed in
+ * @param {number[]} [opt_locations|module:twgl.ErrorCallback] The locations for the. A parallel array to opt_attribs letting you assign locations or an error callback.
+ * @param {module:twgl.ErrorCallback} [opt_errorCallback] callback for errors. By default it just prints an error to the console
+ * on error. If you want something else pass an callback. It's passed an error message.
+ * @return {WebGLProgram?} the created program or null if error or a callback was provided.
+ * @memberOf module:twgl/programs
+ */
+function createProgramFromSources(
+ gl, shaderSources, opt_attribs, opt_locations, opt_errorCallback) {
+ return createProgram(gl, shaderSources, opt_attribs, opt_locations, opt_errorCallback);
+}
+
+/**
+ * Returns true if attribute/uniform is a reserved/built in
+ *
+ * It makes no sense to me why GL returns these because it's
+ * illegal to call `gl.getUniformLocation` and `gl.getAttribLocation`
+ * with names that start with `gl_` (and `webgl_` in WebGL)
+ *
+ * I can only assume they are there because they might count
+ * when computing the number of uniforms/attributes used when you want to
+ * know if you are near the limit. That doesn't really make sense
+ * to me but the fact that these get returned are in the spec.
+ *
+ * @param {WebGLActiveInfo} info As returned from `gl.getActiveUniform` or
+ * `gl.getActiveAttrib`.
+ * @return {bool} true if it's reserved
+ * @private
+ */
+function isBuiltIn(info) {
+ const name = info.name;
+ return name.startsWith("gl_") || name.startsWith("webgl_");
+}
+
+const tokenRE = /(\.|\[|]|\w+)/g;
+const isDigit = s => s >= '0' && s <= '9';
+function addSetterToUniformTree(fullPath, setter, node, uniformSetters) {
+ const tokens = fullPath.split(tokenRE).filter(s => s !== '');
+ let tokenNdx = 0;
+ let path = '';
+
+ for (;;) {
+ const token = tokens[tokenNdx++]; // has to be name or number
+ path += token;
+ const isArrayIndex = isDigit(token[0]);
+ const accessor = isArrayIndex
+ ? parseInt(token)
+ : token;
+ if (isArrayIndex) {
+ path += tokens[tokenNdx++]; // skip ']'
+ }
+ const isLastToken = tokenNdx === tokens.length;
+ if (isLastToken) {
+ node[accessor] = setter;
+ break;
+ } else {
+ const token = tokens[tokenNdx++]; // has to be . or [
+ const isArray = token === '[';
+ const child = node[accessor] || (isArray ? [] : {});
+ node[accessor] = child;
+ node = child;
+ uniformSetters[path] = uniformSetters[path] || function(node) {
+ return function(value) {
+ setUniformTree(node, value);
+ };
+ }(child);
+ path += token;
+ }
+ }
+}
+
+/**
+ * Creates setter functions for all uniforms of a shader
+ * program.
+ *
+ * @see {@link module:twgl.setUniforms}
+ *
+ * @param {WebGLRenderingContext} gl The WebGLRenderingContext to use.
+ * @param {WebGLProgram} program the program to create setters for.
+ * @returns {Object.} an object with a setter by name for each uniform
+ * @memberOf module:twgl/programs
+ */
+function createUniformSetters(gl, program) {
+ let textureUnit = 0;
+
+ /**
+ * Creates a setter for a uniform of the given program with it's
+ * location embedded in the setter.
+ * @param {WebGLProgram} program
+ * @param {WebGLUniformInfo} uniformInfo
+ * @returns {function} the created setter.
+ */
+ function createUniformSetter(program, uniformInfo, location) {
+ const isArray = uniformInfo.name.endsWith("[0]");
+ const type = uniformInfo.type;
+ const typeInfo = typeMap[type];
+ if (!typeInfo) {
+ throw new Error(`unknown type: 0x${type.toString(16)}`); // we should never get here.
+ }
+ let setter;
+ if (typeInfo.bindPoint) {
+ // it's a sampler
+ const unit = textureUnit;
+ textureUnit += uniformInfo.size;
+ if (isArray) {
+ setter = typeInfo.arraySetter(gl, type, unit, location, uniformInfo.size);
+ } else {
+ setter = typeInfo.setter(gl, type, unit, location, uniformInfo.size);
+ }
+ } else {
+ if (typeInfo.arraySetter && isArray) {
+ setter = typeInfo.arraySetter(gl, location);
+ } else {
+ setter = typeInfo.setter(gl, location);
+ }
+ }
+ setter.location = location;
+ return setter;
+ }
+
+ const uniformSetters = {};
+ const uniformTree = {};
+ const numUniforms = gl.getProgramParameter(program, ACTIVE_UNIFORMS);
+
+ for (let ii = 0; ii < numUniforms; ++ii) {
+ const uniformInfo = gl.getActiveUniform(program, ii);
+ if (isBuiltIn(uniformInfo)) {
+ continue;
+ }
+ let name = uniformInfo.name;
+ // remove the array suffix.
+ if (name.endsWith("[0]")) {
+ name = name.substr(0, name.length - 3);
+ }
+ const location = gl.getUniformLocation(program, uniformInfo.name);
+ // the uniform will have no location if it's in a uniform block
+ if (location) {
+ const setter = createUniformSetter(program, uniformInfo, location);
+ uniformSetters[name] = setter;
+ addSetterToUniformTree(name, setter, uniformTree, uniformSetters);
+ }
+ }
+
+ return uniformSetters;
+}
+
+/**
+ * @typedef {Object} TransformFeedbackInfo
+ * @property {number} index index of transform feedback
+ * @property {number} type GL type
+ * @property {number} size 1 - 4
+ * @memberOf module:twgl
+ */
+
+/**
+ * Create TransformFeedbackInfo for passing to bindTransformFeedbackInfo.
+ * @param {WebGLRenderingContext} gl The WebGLRenderingContext to use.
+ * @param {WebGLProgram} program an existing WebGLProgram.
+ * @return {Object}
+ * @memberOf module:twgl
+ */
+function createTransformFeedbackInfo(gl, program) {
+ const info = {};
+ const numVaryings = gl.getProgramParameter(program, TRANSFORM_FEEDBACK_VARYINGS);
+ for (let ii = 0; ii < numVaryings; ++ii) {
+ const varying = gl.getTransformFeedbackVarying(program, ii);
+ info[varying.name] = {
+ index: ii,
+ type: varying.type,
+ size: varying.size,
+ };
+ }
+ return info;
+}
+
+/**
+ * Binds buffers for transform feedback.
+ *
+ * @param {WebGLRenderingContext} gl The WebGLRenderingContext to use.
+ * @param {(module:twgl.ProgramInfo|Object)} transformFeedbackInfo A ProgramInfo or TransformFeedbackInfo.
+ * @param {(module:twgl.BufferInfo|Object)} [bufferInfo] A BufferInfo or set of AttribInfos.
+ * @memberOf module:twgl
+ */
+function bindTransformFeedbackInfo(gl, transformFeedbackInfo, bufferInfo) {
+ if (transformFeedbackInfo.transformFeedbackInfo) {
+ transformFeedbackInfo = transformFeedbackInfo.transformFeedbackInfo;
+ }
+ if (bufferInfo.attribs) {
+ bufferInfo = bufferInfo.attribs;
+ }
+ for (const name in bufferInfo) {
+ const varying = transformFeedbackInfo[name];
+ if (varying) {
+ const buf = bufferInfo[name];
+ if (buf.offset) {
+ gl.bindBufferRange(TRANSFORM_FEEDBACK_BUFFER, varying.index, buf.buffer, buf.offset, buf.size);
+ } else {
+ gl.bindBufferBase(TRANSFORM_FEEDBACK_BUFFER, varying.index, buf.buffer);
+ }
+ }
+ }
+}
+
+/**
+ * Creates a transform feedback and sets the buffers
+ * @param {WebGLRenderingContext} gl The WebGLRenderingContext to use.
+ * @param {module:twgl.ProgramInfo} programInfo A ProgramInfo as returned from {@link module:twgl.createProgramInfo}
+ * @param {(module:twgl.BufferInfo|Object)} [bufferInfo] A BufferInfo or set of AttribInfos.
+ * @return {WebGLTransformFeedback} the created transform feedback
+ * @memberOf module:twgl
+ */
+function createTransformFeedback(gl, programInfo, bufferInfo) {
+ const tf = gl.createTransformFeedback();
+ gl.bindTransformFeedback(TRANSFORM_FEEDBACK, tf);
+ gl.useProgram(programInfo.program);
+ bindTransformFeedbackInfo(gl, programInfo, bufferInfo);
+ gl.bindTransformFeedback(TRANSFORM_FEEDBACK, null);
+ return tf;
+}
+
+/**
+ * @typedef {Object} UniformData
+ * @property {string} name The name of the uniform
+ * @property {number} type The WebGL type enum for this uniform
+ * @property {number} size The number of elements for this uniform
+ * @property {number} blockNdx The block index this uniform appears in
+ * @property {number} offset The byte offset in the block for this uniform's value
+ * @memberOf module:twgl
+ */
+
+/**
+ * The specification for one UniformBlockObject
+ *
+ * @typedef {Object} BlockSpec
+ * @property {number} index The index of the block.
+ * @property {number} size The size in bytes needed for the block
+ * @property {number[]} uniformIndices The indices of the uniforms used by the block. These indices
+ * correspond to entries in a UniformData array in the {@link module:twgl.UniformBlockSpec}.
+ * @property {bool} usedByVertexShader Self explanatory
+ * @property {bool} usedByFragmentShader Self explanatory
+ * @property {bool} used Self explanatory
+ * @memberOf module:twgl
+ */
+
+/**
+ * A `UniformBlockSpec` represents the data needed to create and bind
+ * UniformBlockObjects for a given program
+ *
+ * @typedef {Object} UniformBlockSpec
+ * @property {Object.} blockSpecs The BlockSpec for each block by block name
+ * @property {UniformData[]} uniformData An array of data for each uniform by uniform index.
+ * @memberOf module:twgl
+ */
+
+/**
+ * Creates a UniformBlockSpec for the given program.
+ *
+ * A UniformBlockSpec represents the data needed to create and bind
+ * UniformBlockObjects
+ *
+ * @param {WebGL2RenderingContext} gl A WebGL2 Rendering Context
+ * @param {WebGLProgram} program A WebGLProgram for a successfully linked program
+ * @return {module:twgl.UniformBlockSpec} The created UniformBlockSpec
+ * @memberOf module:twgl/programs
+ */
+function createUniformBlockSpecFromProgram(gl, program) {
+ const numUniforms = gl.getProgramParameter(program, ACTIVE_UNIFORMS);
+ const uniformData = [];
+ const uniformIndices = [];
+
+ for (let ii = 0; ii < numUniforms; ++ii) {
+ uniformIndices.push(ii);
+ uniformData.push({});
+ const uniformInfo = gl.getActiveUniform(program, ii);
+ uniformData[ii].name = uniformInfo.name;
+ }
+
+ [
+ [ "UNIFORM_TYPE", "type" ],
+ [ "UNIFORM_SIZE", "size" ], // num elements
+ [ "UNIFORM_BLOCK_INDEX", "blockNdx" ],
+ [ "UNIFORM_OFFSET", "offset", ],
+ ].forEach(function(pair) {
+ const pname = pair[0];
+ const key = pair[1];
+ gl.getActiveUniforms(program, uniformIndices, gl[pname]).forEach(function(value, ndx) {
+ uniformData[ndx][key] = value;
+ });
+ });
+
+ const blockSpecs = {};
+
+ const numUniformBlocks = gl.getProgramParameter(program, ACTIVE_UNIFORM_BLOCKS);
+ for (let ii = 0; ii < numUniformBlocks; ++ii) {
+ const name = gl.getActiveUniformBlockName(program, ii);
+ const blockSpec = {
+ index: gl.getUniformBlockIndex(program, name),
+ usedByVertexShader: gl.getActiveUniformBlockParameter(program, ii, UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER),
+ usedByFragmentShader: gl.getActiveUniformBlockParameter(program, ii, UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER),
+ size: gl.getActiveUniformBlockParameter(program, ii, UNIFORM_BLOCK_DATA_SIZE),
+ uniformIndices: gl.getActiveUniformBlockParameter(program, ii, UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES),
+ };
+ blockSpec.used = blockSpec.usedByVertexShader || blockSpec.usedByFragmentShader;
+ blockSpecs[name] = blockSpec;
+ }
+
+ return {
+ blockSpecs: blockSpecs,
+ uniformData: uniformData,
+ };
+}
+
+const arraySuffixRE = /\[\d+\]\.$/; // better way to check?
+
+const pad = (v, padding) => ((v + (padding - 1)) / padding | 0) * padding;
+
+function createUniformBlockUniformSetter(view, isArray, rows, cols) {
+ if (isArray || rows) {
+ cols = cols || 1;
+ const numElements = view.length;
+ const totalRows = numElements / 4;
+ return function(value) {
+ let dst = 0;
+ let src = 0;
+ for (let row = 0; row < totalRows; ++row) {
+ for (let col = 0; col < cols; ++col) {
+ view[dst++] = value[src++];
+ }
+ dst += 4 - cols;
+ }
+ };
+ } else {
+ return function(value) {
+ if (value.length) {
+ view.set(value);
+ } else {
+ view[0] = value;
+ }
+ };
+ }
+}
+
+/**
+ * Represents a UniformBlockObject including an ArrayBuffer with all the uniform values
+ * and a corresponding WebGLBuffer to hold those values on the GPU
+ *
+ * @typedef {Object} UniformBlockInfo
+ * @property {string} name The name of the block
+ * @property {ArrayBuffer} array The array buffer that contains the uniform values
+ * @property {Float32Array} asFloat A float view on the array buffer. This is useful
+ * inspecting the contents of the buffer in the debugger.
+ * @property {WebGLBuffer} buffer A WebGL buffer that will hold a copy of the uniform values for rendering.
+ * @property {number} [offset] offset into buffer
+ * @property {Object} uniforms A uniform name to ArrayBufferView map.
+ * each Uniform has a correctly typed `ArrayBufferView` into array at the correct offset
+ * and length of that uniform. So for example a float uniform would have a 1 float `Float32Array`
+ * view. A single mat4 would have a 16 element `Float32Array` view. An ivec2 would have an
+ * `Int32Array` view, etc.
+ * @property {Object} setters A setter for this uniform.
+ * The reason to use setters is elements of arrays are padded to vec4 sizes which
+ * means if you want to set an array of 4 floats you'd need to set 16 values
+ * (or set elements 0, 4, 8, 12). In other words
+ * `someBlockInfo.uniforms.some4FloatArrayUniform.set([0, , , , 1, , , , 2, , , , 3])`
+ * where as the setter handles just passing in [0, 1, 2, 3] either directly as in
+ * `someBlockInfo.setter.some4FloatArrayUniform.set([0, 1, 2, 3])` (not recommended)
+ * or via {@link module:twgl.setBlockUniforms}
+ * @memberOf module:twgl
+ */
+
+/**
+ * Creates a `UniformBlockInfo` for the specified block
+ *
+ * Note: **If the blockName matches no existing blocks a warning is printed to the console and a dummy
+ * `UniformBlockInfo` is returned**. This is because when debugging GLSL
+ * it is common to comment out large portions of a shader or for example set
+ * the final output to a constant. When that happens blocks get optimized out.
+ * If this function did not create dummy blocks your code would crash when debugging.
+ *
+ * @param {WebGL2RenderingContext} gl A WebGL2RenderingContext
+ * @param {WebGLProgram} program A WebGLProgram
+ * @param {module:twgl.UniformBlockSpec} uniformBlockSpec. A UniformBlockSpec as returned
+ * from {@link module:twgl.createUniformBlockSpecFromProgram}.
+ * @param {string} blockName The name of the block.
+ * @return {module:twgl.UniformBlockInfo} The created UniformBlockInfo
+ * @memberOf module:twgl/programs
+ */
+function createUniformBlockInfoFromProgram(gl, program, uniformBlockSpec, blockName) {
+ const blockSpecs = uniformBlockSpec.blockSpecs;
+ const uniformData = uniformBlockSpec.uniformData;
+ const blockSpec = blockSpecs[blockName];
+ if (!blockSpec) {
+ warn("no uniform block object named:", blockName);
+ return {
+ name: blockName,
+ uniforms: {},
+ };
+ }
+ const array = new ArrayBuffer(blockSpec.size);
+ const buffer = gl.createBuffer();
+ const uniformBufferIndex = blockSpec.index;
+ gl.bindBuffer(UNIFORM_BUFFER, buffer);
+ gl.uniformBlockBinding(program, blockSpec.index, uniformBufferIndex);
+
+ let prefix = blockName + ".";
+ if (arraySuffixRE.test(prefix)) {
+ prefix = prefix.replace(arraySuffixRE, ".");
+ }
+ const uniforms = {};
+ const setters = {};
+ const setterTree = {};
+ blockSpec.uniformIndices.forEach(function(uniformNdx) {
+ const data = uniformData[uniformNdx];
+ let name = data.name;
+ if (name.startsWith(prefix)) {
+ name = name.substr(prefix.length);
+ }
+ const isArray = name.endsWith('[0]');
+ if (isArray) {
+ name = name.substr(0, name.length - 3);
+ }
+ const typeInfo = typeMap[data.type];
+ const Type = typeInfo.Type;
+ const byteLength = isArray
+ ? pad(typeInfo.size, 16) * data.size
+ : typeInfo.size * data.size;
+ const uniformView = new Type(array, data.offset, byteLength / Type.BYTES_PER_ELEMENT);
+ uniforms[name] = uniformView;
+ // Note: I'm not sure what to do here. The original
+ // idea was to create TypedArray views into each part
+ // of the block. This is useful, for example if you have
+ // a block with { mat4: model; mat4 view; mat4 projection; }
+ // you'll get a Float32Array for each one suitable for
+ // passing to most JS math libraries including twgl's and glMatrix.js.
+ //
+ // But, if you have a an array of structures, especially if that
+ // array is large, you get a whole bunch of TypedArray views.
+ // Every one of them has overhead and switching between them all
+ // is probably a cache miss. In that case it would really be better
+ // to just have one view (asFloat) and have all the setters
+ // just reference the correct portion. But, then you can't easily
+ // treat a matrix, or a vec4, as a standalone thing like you can
+ // with all the views.
+ //
+ // Another problem with the views is they are not shared. With
+ // uniforms you have one set of setters. With UniformBlockInfo
+ // you have a set of setters *pre block instance*. That's because
+ // TypedArray views can't be mapped to different buffers.
+ //
+ // My gut right now is if you really want the speed and compactness
+ // then you should probably roll your own solution. TWGL's goal
+ // here is ease of use as AFAICT there is no simple generic efficient
+ // solution.
+ const setter = createUniformBlockUniformSetter(uniformView, isArray, typeInfo.rows, typeInfo.cols);
+ setters[name] = setter;
+ addSetterToUniformTree(name, setter, setterTree, setters);
+ });
+ return {
+ name: blockName,
+ array,
+ asFloat: new Float32Array(array), // for debugging
+ buffer,
+ uniforms,
+ setters,
+ };
+}
+
+/**
+ * Creates a `UniformBlockInfo` for the specified block
+ *
+ * Note: **If the blockName matches no existing blocks a warning is printed to the console and a dummy
+ * `UniformBlockInfo` is returned**. This is because when debugging GLSL
+ * it is common to comment out large portions of a shader or for example set
+ * the final output to a constant. When that happens blocks get optimized out.
+ * If this function did not create dummy blocks your code would crash when debugging.
+ *
+ * @param {WebGL2RenderingContext} gl A WebGL2RenderingContext
+ * @param {module:twgl.ProgramInfo} programInfo a `ProgramInfo`
+ * as returned from {@link module:twgl.createProgramInfo}
+ * @param {string} blockName The name of the block.
+ * @return {module:twgl.UniformBlockInfo} The created UniformBlockInfo
+ * @memberOf module:twgl/programs
+ */
+function createUniformBlockInfo(gl, programInfo, blockName) {
+ return createUniformBlockInfoFromProgram(gl, programInfo.program, programInfo.uniformBlockSpec, blockName);
+}
+
+/**
+ * Binds a uniform block to the matching uniform block point.
+ * Matches by blocks by name so blocks must have the same name not just the same
+ * structure.
+ *
+ * If you have changed any values and you upload the values into the corresponding WebGLBuffer
+ * call {@link module:twgl.setUniformBlock} instead.
+ *
+ * @param {WebGL2RenderingContext} gl A WebGL 2 rendering context.
+ * @param {(module:twgl.ProgramInfo|module:twgl.UniformBlockSpec)} programInfo a `ProgramInfo`
+ * as returned from {@link module:twgl.createProgramInfo} or or `UniformBlockSpec` as
+ * returned from {@link module:twgl.createUniformBlockSpecFromProgram}.
+ * @param {module:twgl.UniformBlockInfo} uniformBlockInfo a `UniformBlockInfo` as returned from
+ * {@link module:twgl.createUniformBlockInfo}.
+ * @return {bool} true if buffer was bound. If the programInfo has no block with the same block name
+ * no buffer is bound.
+ * @memberOf module:twgl/programs
+ */
+function bindUniformBlock(gl, programInfo, uniformBlockInfo) {
+ const uniformBlockSpec = programInfo.uniformBlockSpec || programInfo;
+ const blockSpec = uniformBlockSpec.blockSpecs[uniformBlockInfo.name];
+ if (blockSpec) {
+ const bufferBindIndex = blockSpec.index;
+ gl.bindBufferRange(UNIFORM_BUFFER, bufferBindIndex, uniformBlockInfo.buffer, uniformBlockInfo.offset || 0, uniformBlockInfo.array.byteLength);
+ return true;
+ }
+ return false;
+}
+
+/**
+ * Uploads the current uniform values to the corresponding WebGLBuffer
+ * and binds that buffer to the program's corresponding bind point for the uniform block object.
+ *
+ * If you haven't changed any values and you only need to bind the uniform block object
+ * call {@link module:twgl.bindUniformBlock} instead.
+ *
+ * @param {WebGL2RenderingContext} gl A WebGL 2 rendering context.
+ * @param {(module:twgl.ProgramInfo|module:twgl.UniformBlockSpec)} programInfo a `ProgramInfo`
+ * as returned from {@link module:twgl.createProgramInfo} or or `UniformBlockSpec` as
+ * returned from {@link module:twgl.createUniformBlockSpecFromProgram}.
+ * @param {module:twgl.UniformBlockInfo} uniformBlockInfo a `UniformBlockInfo` as returned from
+ * {@link module:twgl.createUniformBlockInfo}.
+ * @memberOf module:twgl/programs
+ */
+function setUniformBlock(gl, programInfo, uniformBlockInfo) {
+ if (bindUniformBlock(gl, programInfo, uniformBlockInfo)) {
+ gl.bufferData(UNIFORM_BUFFER, uniformBlockInfo.array, DYNAMIC_DRAW);
+ }
+}
+
+/**
+ * Sets values of a uniform block object
+ *
+ * @param {module:twgl.UniformBlockInfo} uniformBlockInfo A UniformBlockInfo as returned by {@link module:twgl.createUniformBlockInfo}.
+ * @param {Object.} values A uniform name to value map where the value is correct for the given
+ * type of uniform. So for example given a block like
+ *
+ * uniform SomeBlock {
+ * float someFloat;
+ * vec2 someVec2;
+ * vec3 someVec3Array[2];
+ * int someInt;
+ * }
+ *
+ * You can set the values of the uniform block with
+ *
+ * twgl.setBlockUniforms(someBlockInfo, {
+ * someFloat: 12.3,
+ * someVec2: [1, 2],
+ * someVec3Array: [1, 2, 3, 4, 5, 6],
+ * someInt: 5,
+ * }
+ *
+ * Arrays can be JavaScript arrays or typed arrays
+ *
+ * You can also fill out structure and array values either via
+ * shortcut. Example
+ *
+ * // -- in shader --
+ * struct Light {
+ * float intensity;
+ * vec4 color;
+ * float nearFar[2];
+ * };
+ * uniform Lights {
+ * Light lights[2];
+ * };
+ *
+ * // in JavaScript
+ *
+ * twgl.setBlockUniforms(someBlockInfo, {
+ * lights: [
+ * { intensity: 5.0, color: [1, 0, 0, 1], nearFar[0.1, 10] },
+ * { intensity: 2.0, color: [0, 0, 1, 1], nearFar[0.2, 15] },
+ * ],
+ * });
+ *
+ * or the more traditional way
+ *
+ * twgl.setBlockUniforms(someBlockInfo, {
+ * "lights[0].intensity": 5.0,
+ * "lights[0].color": [1, 0, 0, 1],
+ * "lights[0].nearFar": [0.1, 10],
+ * "lights[1].intensity": 2.0,
+ * "lights[1].color": [0, 0, 1, 1],
+ * "lights[1].nearFar": [0.2, 15],
+ * });
+ *
+ * You can also specify partial paths
+ *
+ * twgl.setBlockUniforms(someBlockInfo, {
+ * 'lights[1]': { intensity: 5.0, color: [1, 0, 0, 1], nearFar[0.2, 15] },
+ * });
+ *
+ * But you can not specify leaf array indices.
+ *
+ * twgl.setBlockUniforms(someBlockInfo, {
+ * 'lights[1].nearFar[1]': 15, // BAD! nearFar is a leaf
+ * 'lights[1].nearFar': [0.2, 15], // GOOD
+ * });
+ *
+ * **IMPORTANT!**, packing in a UniformBlock is unintuitive.
+ * For example the actual layout of `someVec3Array` above in memory
+ * is `1, 2, 3, unused, 4, 5, 6, unused`. twgl takes in 6 values
+ * as shown about and copies them, skipping the padding. This might
+ * be confusing if you're already familiar with Uniform blocks.
+ *
+ * If you want to deal with the padding yourself you can access the array
+ * buffer views directly. eg:
+ *
+ * someBlockInfo.someVec3Array.set([1, 2, 3, 0, 4, 5, 6, 0]);
+ *
+ * Any name that doesn't match will be ignored
+ * @memberOf module:twgl/programs
+ */
+function setBlockUniforms(uniformBlockInfo, values) {
+ const setters = uniformBlockInfo.setters;
+ for (const name in values) {
+ const setter = setters[name];
+ if (setter) {
+ const value = values[name];
+ setter(value);
+ }
+ }
+}
+
+function setUniformTree(tree, values) {
+ for (const name in values) {
+ const prop = tree[name];
+ if (typeof prop === 'function') {
+ prop(values[name]);
+ } else {
+ setUniformTree(tree[name], values[name]);
+ }
+ }
+}
+
+/**
+ * Set uniforms and binds related textures.
+ *
+ * example:
+ *
+ * const programInfo = createProgramInfo(
+ * gl, ["some-vs", "some-fs"]);
+ *
+ * const tex1 = gl.createTexture();
+ * const tex2 = gl.createTexture();
+ *
+ * ... assume we setup the textures with data ...
+ *
+ * const uniforms = {
+ * u_someSampler: tex1,
+ * u_someOtherSampler: tex2,
+ * u_someColor: [1,0,0,1],
+ * u_somePosition: [0,1,1],
+ * u_someMatrix: [
+ * 1,0,0,0,
+ * 0,1,0,0,
+ * 0,0,1,0,
+ * 0,0,0,0,
+ * ],
+ * };
+ *
+ * gl.useProgram(programInfo.program);
+ *
+ * This will automatically bind the textures AND set the
+ * uniforms.
+ *
+ * twgl.setUniforms(programInfo, uniforms);
+ *
+ * For the example above it is equivalent to
+ *
+ * let texUnit = 0;
+ * gl.activeTexture(gl.TEXTURE0 + texUnit);
+ * gl.bindTexture(gl.TEXTURE_2D, tex1);
+ * gl.uniform1i(u_someSamplerLocation, texUnit++);
+ * gl.activeTexture(gl.TEXTURE0 + texUnit);
+ * gl.bindTexture(gl.TEXTURE_2D, tex2);
+ * gl.uniform1i(u_someSamplerLocation, texUnit++);
+ * gl.uniform4fv(u_someColorLocation, [1, 0, 0, 1]);
+ * gl.uniform3fv(u_somePositionLocation, [0, 1, 1]);
+ * gl.uniformMatrix4fv(u_someMatrix, false, [
+ * 1,0,0,0,
+ * 0,1,0,0,
+ * 0,0,1,0,
+ * 0,0,0,0,
+ * ]);
+ *
+ * Note it is perfectly reasonable to call `setUniforms` multiple times. For example
+ *
+ * const uniforms = {
+ * u_someSampler: tex1,
+ * u_someOtherSampler: tex2,
+ * };
+ *
+ * const moreUniforms {
+ * u_someColor: [1,0,0,1],
+ * u_somePosition: [0,1,1],
+ * u_someMatrix: [
+ * 1,0,0,0,
+ * 0,1,0,0,
+ * 0,0,1,0,
+ * 0,0,0,0,
+ * ],
+ * };
+ *
+ * twgl.setUniforms(programInfo, uniforms);
+ * twgl.setUniforms(programInfo, moreUniforms);
+ *
+ * You can also add WebGLSamplers to uniform samplers as in
+ *
+ * const uniforms = {
+ * u_someSampler: {
+ * texture: someWebGLTexture,
+ * sampler: someWebGLSampler,
+ * },
+ * };
+ *
+ * In which case both the sampler and texture will be bound to the
+ * same unit.
+ *
+ * @param {(module:twgl.ProgramInfo|Object.)} setters a `ProgramInfo` as returned from `createProgramInfo` or the setters returned from
+ * `createUniformSetters`.
+ * @param {Object.} values an object with values for the
+ * uniforms.
+ * You can pass multiple objects by putting them in an array or by calling with more arguments.For example
+ *
+ * const sharedUniforms = {
+ * u_fogNear: 10,
+ * u_projection: ...
+ * ...
+ * };
+ *
+ * const localUniforms = {
+ * u_world: ...
+ * u_diffuseColor: ...
+ * };
+ *
+ * twgl.setUniforms(programInfo, sharedUniforms, localUniforms);
+ *
+ * // is the same as
+ *
+ * twgl.setUniforms(programInfo, [sharedUniforms, localUniforms]);
+ *
+ * // is the same as
+ *
+ * twgl.setUniforms(programInfo, sharedUniforms);
+ * twgl.setUniforms(programInfo, localUniforms};
+ *
+ * You can also fill out structure and array values either via
+ * shortcut. Example
+ *
+ * // -- in shader --
+ * struct Light {
+ * float intensity;
+ * vec4 color;
+ * float nearFar[2];
+ * };
+ * uniform Light lights[2];
+ *
+ * // in JavaScript
+ *
+ * twgl.setUniforms(programInfo, {
+ * lights: [
+ * { intensity: 5.0, color: [1, 0, 0, 1], nearFar[0.1, 10] },
+ * { intensity: 2.0, color: [0, 0, 1, 1], nearFar[0.2, 15] },
+ * ],
+ * });
+ *
+ * or the more traditional way
+ *
+ * twgl.setUniforms(programInfo, {
+ * "lights[0].intensity": 5.0,
+ * "lights[0].color": [1, 0, 0, 1],
+ * "lights[0].nearFar": [0.1, 10],
+ * "lights[1].intensity": 2.0,
+ * "lights[1].color": [0, 0, 1, 1],
+ * "lights[1].nearFar": [0.2, 15],
+ * });
+ *
+ * You can also specify partial paths
+ *
+ * twgl.setUniforms(programInfo, {
+ * 'lights[1]': { intensity: 5.0, color: [1, 0, 0, 1], nearFar[0.2, 15] },
+ * });
+ *
+ * But you can not specify leaf array indices
+ *
+ * twgl.setUniforms(programInfo, {
+ * 'lights[1].nearFar[1]': 15, // BAD! nearFar is a leaf
+ * 'lights[1].nearFar': [0.2, 15], // GOOD
+ * });
+ *
+ * @memberOf module:twgl/programs
+ */
+function setUniforms(setters, ...args) { // eslint-disable-line
+ const actualSetters = setters.uniformSetters || setters;
+ const numArgs = args.length;
+ for (let aNdx = 0; aNdx < numArgs; ++aNdx) {
+ const values = args[aNdx];
+ if (Array.isArray(values)) {
+ const numValues = values.length;
+ for (let ii = 0; ii < numValues; ++ii) {
+ setUniforms(actualSetters, values[ii]);
+ }
+ } else {
+ for (const name in values) {
+ const setter = actualSetters[name];
+ if (setter) {
+ setter(values[name]);
+ }
+ }
+ }
+ }
+}
+
+/**
+ * Alias for `setUniforms`
+ * @function
+ * @param {(module:twgl.ProgramInfo|Object.)} setters a `ProgramInfo` as returned from `createProgramInfo` or the setters returned from
+ * `createUniformSetters`.
+ * @param {Object.} values an object with values for the
+ * @memberOf module:twgl/programs
+ */
+const setUniformsAndBindTextures = setUniforms;
+
+/**
+ * Creates setter functions for all attributes of a shader
+ * program. You can pass this to {@link module:twgl.setBuffersAndAttributes} to set all your buffers and attributes.
+ *
+ * @see {@link module:twgl.setAttributes} for example
+ * @param {WebGLRenderingContext} gl The WebGLRenderingContext to use.
+ * @param {WebGLProgram} program the program to create setters for.
+ * @return {Object.} an object with a setter for each attribute by name.
+ * @memberOf module:twgl/programs
+ */
+function createAttributeSetters(gl, program) {
+ const attribSetters = {
+ };
+
+ const numAttribs = gl.getProgramParameter(program, ACTIVE_ATTRIBUTES);
+ for (let ii = 0; ii < numAttribs; ++ii) {
+ const attribInfo = gl.getActiveAttrib(program, ii);
+ if (isBuiltIn(attribInfo)) {
+ continue;
+ }
+ const index = gl.getAttribLocation(program, attribInfo.name);
+ const typeInfo = attrTypeMap[attribInfo.type];
+ const setter = typeInfo.setter(gl, index, typeInfo);
+ setter.location = index;
+ attribSetters[attribInfo.name] = setter;
+ }
+
+ return attribSetters;
+}
+
+/**
+ * Sets attributes and binds buffers (deprecated... use {@link module:twgl.setBuffersAndAttributes})
+ *
+ * Example:
+ *
+ * const program = createProgramFromScripts(
+ * gl, ["some-vs", "some-fs");
+ *
+ * const attribSetters = createAttributeSetters(program);
+ *
+ * const positionBuffer = gl.createBuffer();
+ * const texcoordBuffer = gl.createBuffer();
+ *
+ * const attribs = {
+ * a_position: {buffer: positionBuffer, numComponents: 3},
+ * a_texcoord: {buffer: texcoordBuffer, numComponents: 2},
+ * };
+ *
+ * gl.useProgram(program);
+ *
+ * This will automatically bind the buffers AND set the
+ * attributes.
+ *
+ * setAttributes(attribSetters, attribs);
+ *
+ * Properties of attribs. For each attrib you can add
+ * properties:
+ *
+ * * type: the type of data in the buffer. Default = gl.FLOAT
+ * * normalize: whether or not to normalize the data. Default = false
+ * * stride: the stride. Default = 0
+ * * offset: offset into the buffer. Default = 0
+ * * divisor: the divisor for instances. Default = undefined
+ *
+ * For example if you had 3 value float positions, 2 value
+ * float texcoord and 4 value uint8 colors you'd setup your
+ * attribs like this
+ *
+ * const attribs = {
+ * a_position: {buffer: positionBuffer, numComponents: 3},
+ * a_texcoord: {buffer: texcoordBuffer, numComponents: 2},
+ * a_color: {
+ * buffer: colorBuffer,
+ * numComponents: 4,
+ * type: gl.UNSIGNED_BYTE,
+ * normalize: true,
+ * },
+ * };
+ *
+ * @param {Object.} setters Attribute setters as returned from createAttributeSetters
+ * @param {Object.} buffers AttribInfos mapped by attribute name.
+ * @memberOf module:twgl/programs
+ * @deprecated use {@link module:twgl.setBuffersAndAttributes}
+ * @private
+ */
+function setAttributes(setters, buffers) {
+ for (const name in buffers) {
+ const setter = setters[name];
+ if (setter) {
+ setter(buffers[name]);
+ }
+ }
+}
+
+/**
+ * Sets attributes and buffers including the `ELEMENT_ARRAY_BUFFER` if appropriate
+ *
+ * Example:
+ *
+ * const programInfo = createProgramInfo(
+ * gl, ["some-vs", "some-fs");
+ *
+ * const arrays = {
+ * position: { numComponents: 3, data: [0, 0, 0, 10, 0, 0, 0, 10, 0, 10, 10, 0], },
+ * texcoord: { numComponents: 2, data: [0, 0, 0, 1, 1, 0, 1, 1], },
+ * };
+ *
+ * const bufferInfo = createBufferInfoFromArrays(gl, arrays);
+ *
+ * gl.useProgram(programInfo.program);
+ *
+ * This will automatically bind the buffers AND set the
+ * attributes.
+ *
+ * setBuffersAndAttributes(gl, programInfo, bufferInfo);
+ *
+ * For the example above it is equivalent to
+ *
+ * gl.bindBuffer(gl.ARRAY_BUFFER, positionBuffer);
+ * gl.enableVertexAttribArray(a_positionLocation);
+ * gl.vertexAttribPointer(a_positionLocation, 3, gl.FLOAT, false, 0, 0);
+ * gl.bindBuffer(gl.ARRAY_BUFFER, texcoordBuffer);
+ * gl.enableVertexAttribArray(a_texcoordLocation);
+ * gl.vertexAttribPointer(a_texcoordLocation, 4, gl.FLOAT, false, 0, 0);
+ *
+ * @param {WebGLRenderingContext} gl A WebGLRenderingContext.
+ * @param {(module:twgl.ProgramInfo|Object.)} setters A `ProgramInfo` as returned from {@link module:twgl.createProgramInfo} or Attribute setters as returned from {@link module:twgl.createAttributeSetters}
+ * @param {(module:twgl.BufferInfo|module:twgl.VertexArrayInfo)} buffers a `BufferInfo` as returned from {@link module:twgl.createBufferInfoFromArrays}.
+ * or a `VertexArrayInfo` as returned from {@link module:twgl.createVertexArrayInfo}
+ * @memberOf module:twgl/programs
+ */
+function setBuffersAndAttributes(gl, programInfo, buffers) {
+ if (buffers.vertexArrayObject) {
+ gl.bindVertexArray(buffers.vertexArrayObject);
+ } else {
+ setAttributes(programInfo.attribSetters || programInfo, buffers.attribs);
+ if (buffers.indices) {
+ gl.bindBuffer(ELEMENT_ARRAY_BUFFER$1, buffers.indices);
+ }
+ }
+}
+
+/**
+ * @typedef {Object} ProgramInfo
+ * @property {WebGLProgram} program A shader program
+ * @property {Object} uniformSetters object of setters as returned from createUniformSetters,
+ * @property {Object} attribSetters object of setters as returned from createAttribSetters,
+ * @property {module:twgl.UniformBlockSpec} [uniformBlockSpec] a uniform block spec for making UniformBlockInfos with createUniformBlockInfo etc..
+ * @property {Object} [transformFeedbackInfo] info for transform feedbacks
+ * @memberOf module:twgl
+ */
+
+/**
+ * Creates a ProgramInfo from an existing program.
+ *
+ * A ProgramInfo contains
+ *
+ * programInfo = {
+ * program: WebGLProgram,
+ * uniformSetters: object of setters as returned from createUniformSetters,
+ * attribSetters: object of setters as returned from createAttribSetters,
+ * }
+ *
+ * @param {WebGLRenderingContext} gl The WebGLRenderingContext
+ * to use.
+ * @param {WebGLProgram} program an existing WebGLProgram.
+ * @return {module:twgl.ProgramInfo} The created ProgramInfo.
+ * @memberOf module:twgl/programs
+ */
+function createProgramInfoFromProgram(gl, program) {
+ const uniformSetters = createUniformSetters(gl, program);
+ const attribSetters = createAttributeSetters(gl, program);
+ const programInfo = {
+ program,
+ uniformSetters,
+ attribSetters,
+ };
+
+ if (isWebGL2(gl)) {
+ programInfo.uniformBlockSpec = createUniformBlockSpecFromProgram(gl, program);
+ programInfo.transformFeedbackInfo = createTransformFeedbackInfo(gl, program);
+ }
+
+ return programInfo;
+}
+
+const notIdRE = /\s|{|}|;/;
+
+/**
+ * Creates a ProgramInfo from 2 sources.
+ *
+ * A ProgramInfo contains
+ *
+ * programInfo = {
+ * program: WebGLProgram,
+ * uniformSetters: object of setters as returned from createUniformSetters,
+ * attribSetters: object of setters as returned from createAttribSetters,
+ * }
+ *
+ * NOTE: There are 4 signatures for this function
+ *
+ * twgl.createProgramInfo(gl, [vs, fs], options);
+ * twgl.createProgramInfo(gl, [vs, fs], opt_errFunc);
+ * twgl.createProgramInfo(gl, [vs, fs], opt_attribs, opt_errFunc);
+ * twgl.createProgramInfo(gl, [vs, fs], opt_attribs, opt_locations, opt_errFunc);
+ *
+ * @param {WebGLRenderingContext} gl The WebGLRenderingContext
+ * to use.
+ * @param {string[]} shaderSources Array of sources for the
+ * shaders or ids. The first is assumed to be the vertex shader,
+ * the second the fragment shader.
+ * @param {module:twgl.ProgramOptions|string[]|module:twgl.ErrorCallback} [opt_attribs] Options for the program or an array of attribs names or an error callback. Locations will be assigned by index if not passed in
+ * @param {number[]} [opt_locations|module:twgl.ErrorCallback] The locations for the. A parallel array to opt_attribs letting you assign locations or an error callback.
+ * @param {module:twgl.ErrorCallback} [opt_errorCallback] callback for errors. By default it just prints an error to the console
+ * on error. If you want something else pass an callback. It's passed an error message.
+ * @return {module:twgl.ProgramInfo?} The created ProgramInfo or null if it failed to link or compile
+ * @memberOf module:twgl/programs
+ */
+function createProgramInfo(
+ gl, shaderSources, opt_attribs, opt_locations, opt_errorCallback) {
+ const progOptions = getProgramOptions(opt_attribs, opt_locations, opt_errorCallback);
+ const errors = [];
+ shaderSources = shaderSources.map(function(source) {
+ // Lets assume if there is no \n it's an id
+ if (!notIdRE.test(source)) {
+ const script = getElementById(source);
+ if (!script) {
+ const err = `no element with id: ${source}`;
+ progOptions.errorCallback(err);
+ errors.push(err);
+ } else {
+ source = script.text;
+ }
+ }
+ return source;
+ });
+
+ if (errors.length) {
+ return reportError(progOptions, '');
+ }
+
+ const origCallback = progOptions.callback;
+ if (origCallback) {
+ progOptions.callback = (err, program) => {
+ origCallback(err, err ? undefined : createProgramInfoFromProgram(gl, program));
+ };
+ }
+
+ const program = createProgramFromSources(gl, shaderSources, progOptions);
+ if (!program) {
+ return null;
+ }
+
+ return createProgramInfoFromProgram(gl, program);
+}
+
+function checkAllPrograms(gl, programs, programSpecs, noDeleteShadersSet, programOptions) {
+ // check errors for everything.
+ for (const [name, program] of Object.entries(programs)) {
+ const options = {...programOptions};
+ const spec = programSpecs[name];
+ if (!Array.isArray(spec)) {
+ Object.assign(options, spec);
+ }
+ const errors = getProgramErrors(gl, program, options.errorCallback);
+ if (errors) {
+ // delete everything we created
+ for (const program of Object.values(programs)) {
+ const shaders = gl.getAttachedShaders(program);
+ gl.deleteProgram(program);
+ for (const shader of shaders) {
+ // Don't delete it if we didn't create it.
+ if (!noDeleteShadersSet.has(shader)) {
+ gl.deleteShader(shader);
+ }
+ }
+ }
+ return errors;
+ }
+ }
+
+ return undefined;
+}
+
+/**
+ * Creates multiple programs
+ *
+ * Note: the reason this function exists is because the fastest way to create multiple
+ * programs in WebGL is to create and compile all shaders and link all programs and only
+ * afterwards check if they succeeded. In that way, giving all your shaders
+ *
+ * @see {@link module:twgl.createProgram}
+ *
+ * Example:
+ *
+ * const programs = twgl.createPrograms(gl, {
+ * lambert: [lambertVS, lambertFS],
+ * phong: [phongVS, phoneFS],
+ * particles: {
+ * shaders: [particlesVS, particlesFS],
+ * transformFeedbackVaryings: ['position', 'velocity'],
+ * },
+ * });
+ *
+ * @param {WebGLRenderingContext} gl the WebGLRenderingContext
+ * @param {Object.} programSpecs An object of ProgramSpecs, one per program.
+ * @param {module:twgl.ProgramOptions} [programOptions] options to apply to all programs
+ * @return {Object.?} the created programInfos by name
+ */
+function createPrograms(gl, programSpecs, programOptions = {}) {
+ // Remember existing shaders so that if there is an error we don't delete them
+ const noDeleteShadersSet = new Set();
+
+ // compile and link everything
+ const programs = Object.fromEntries(Object.entries(programSpecs).map(([name, spec]) => {
+ const options = {...programOptions};
+ const shaders = Array.isArray(spec) ? spec : spec.shaders;
+ if (!Array.isArray(spec)) {
+ Object.assign(options, spec);
+ }
+ shaders.forEach(noDeleteShadersSet.add, noDeleteShadersSet);
+ return [name, createProgramNoCheck(gl, shaders, options)];
+ }));
+
+ if (programOptions.callback) {
+ waitForAllProgramsLinkCompletionAsync(gl, programs).then(() => {
+ const errors = checkAllPrograms(gl, programs, programSpecs, noDeleteShadersSet, programOptions);
+ programOptions.callback(errors, errors ? undefined : programs);
+ });
+ return undefined;
+ }
+
+ const errors = checkAllPrograms(gl, programs, programSpecs, noDeleteShadersSet, programOptions);
+ return errors ? undefined : programs;
+}
+
+/**
+ * Creates multiple programInfos
+ *
+ * Note: the reason this function exists is because the fastest way to create multiple
+ * programs in WebGL is to create and compile all shaders and link all programs and only
+ * afterwards check if they succeeded. In that way, giving all your shaders
+ *
+ * @see {@link module:twgl.createProgramInfo}
+ *
+ * Examples:
+ *
+ * const programInfos = twgl.createProgramInfos(gl, {
+ * lambert: [lambertVS, lambertFS],
+ * phong: [phongVS, phoneFS],
+ * particles: {
+ * shaders: [particlesVS, particlesFS],
+ * transformFeedbackVaryings: ['position', 'velocity'],
+ * },
+ * });
+ *
+ * or
+ *
+ * const {lambert, phong, particles} = twgl.createProgramInfos(gl, {
+ * lambert: [lambertVS, lambertFS],
+ * phong: [phongVS, phoneFS],
+ * particles: {
+ * shaders: [particlesVS, particlesFS],
+ * transformFeedbackVaryings: ['position', 'velocity'],
+ * },
+ * });
+ *
+ *
+ * @param {WebGLRenderingContext} gl the WebGLRenderingContext
+ * @param {Object.} programSpecs An object of ProgramSpecs, one per program.
+ * @param {module:twgl.ProgramOptions} [programOptions] options to apply to all programs
+ * @return {Object.?} the created programInfos by name
+ */
+function createProgramInfos(gl, programSpecs, programOptions) {
+ programOptions = getProgramOptions(programOptions);
+
+ function createProgramInfosForPrograms(gl, programs) {
+ return Object.fromEntries(Object.entries(programs).map(([name, program]) =>
+ [name, createProgramInfoFromProgram(gl, program)]
+ ));
+ }
+
+ const origCallback = programOptions.callback;
+ if (origCallback) {
+ programOptions.callback = (err, programs) => {
+ origCallback(err, err ? undefined : createProgramInfosForPrograms(gl, programs));
+ };
+ }
+
+ const programs = createPrograms(gl, programSpecs, programOptions);
+ if (origCallback || !programs) {
+ return undefined;
+ }
+
+ return createProgramInfosForPrograms(gl, programs);
+}
+
+/**
+ * Creates multiple programs asynchronously
+ *
+ * @see {@link module:twgl.createProgramAsync}
+ *
+ * Example:
+ *
+ * const programs = await twgl.createProgramsAsync(gl, {
+ * lambert: [lambertVS, lambertFS],
+ * phong: [phongVS, phoneFS],
+ * particles: {
+ * shaders: [particlesVS, particlesFS],
+ * transformFeedbackVaryings: ['position', 'velocity'],
+ * },
+ * });
+ *
+ * @function
+ * @param {WebGLRenderingContext} gl the WebGLRenderingContext
+ * @param {Object.} programSpecs An object of ProgramSpecs, one per program.
+ * @param {module:twgl.ProgramOptions} [programOptions] options to apply to all programs
+ * @return {Object.?} the created programInfos by name
+ */
+const createProgramsAsync = wrapCallbackFnToAsyncFn(createPrograms);
+
+/**
+ * Creates multiple programInfos asynchronously
+ *
+ * @see {@link module:twgl.createProgramInfoAsync}
+ *
+ * Example:
+ *
+ * const programInfos = await twgl.createProgramInfosAsync(gl, {
+ * lambert: [lambertVS, lambertFS],
+ * phong: [phongVS, phoneFS],
+ * particles: {
+ * shaders: [particlesVS, particlesFS],
+ * transformFeedbackVaryings: ['position', 'velocity'],
+ * },
+ * });
+ *
+ * @function
+ * @param {WebGLRenderingContext} gl the WebGLRenderingContext
+ * @param {Object.} programSpecs An object of ProgramSpecs, one per program.
+ * @param {module:twgl.ProgramOptions} [programOptions] options to apply to all programs
+ * @return {Promise>} the created programInfos by name
+ */
+const createProgramInfosAsync = wrapCallbackFnToAsyncFn(createProgramInfos);
+
+var programs = /*#__PURE__*/Object.freeze({
+ __proto__: null,
+ createAttributeSetters: createAttributeSetters,
+ createProgram: createProgram,
+ createProgramAsync: createProgramAsync,
+ createPrograms: createPrograms,
+ createProgramsAsync: createProgramsAsync,
+ createProgramFromScripts: createProgramFromScripts,
+ createProgramFromSources: createProgramFromSources,
+ createProgramInfo: createProgramInfo,
+ createProgramInfoAsync: createProgramInfoAsync,
+ createProgramInfos: createProgramInfos,
+ createProgramInfosAsync: createProgramInfosAsync,
+ createProgramInfoFromProgram: createProgramInfoFromProgram,
+ createUniformSetters: createUniformSetters,
+ createUniformBlockSpecFromProgram: createUniformBlockSpecFromProgram,
+ createUniformBlockInfoFromProgram: createUniformBlockInfoFromProgram,
+ createUniformBlockInfo: createUniformBlockInfo,
+ createTransformFeedback: createTransformFeedback,
+ createTransformFeedbackInfo: createTransformFeedbackInfo,
+ bindTransformFeedbackInfo: bindTransformFeedbackInfo,
+ setAttributes: setAttributes,
+ setBuffersAndAttributes: setBuffersAndAttributes,
+ setUniforms: setUniforms,
+ setUniformsAndBindTextures: setUniformsAndBindTextures,
+ setUniformBlock: setUniformBlock,
+ setBlockUniforms: setBlockUniforms,
+ bindUniformBlock: bindUniformBlock
+});
+
+/*
+ * Copyright 2019 Gregg Tavares
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+const TRIANGLES = 0x0004;
+const UNSIGNED_SHORT = 0x1403;
+
+/**
+ * Drawing related functions
+ *
+ * For backward compatibility they are available at both `twgl.draw` and `twgl`
+ * itself
+ *
+ * See {@link module:twgl} for core functions
+ *
+ * @module twgl/draw
+ */
+
+/**
+ * Calls `gl.drawElements` or `gl.drawArrays`, whichever is appropriate
+ *
+ * normally you'd call `gl.drawElements` or `gl.drawArrays` yourself
+ * but calling this means if you switch from indexed data to non-indexed
+ * data you don't have to remember to update your draw call.
+ *
+ * @param {WebGLRenderingContext} gl A WebGLRenderingContext
+ * @param {(module:twgl.BufferInfo|module:twgl.VertexArrayInfo)} bufferInfo A BufferInfo as returned from {@link module:twgl.createBufferInfoFromArrays} or
+ * a VertexArrayInfo as returned from {@link module:twgl.createVertexArrayInfo}
+ * @param {number} [type] eg (gl.TRIANGLES, gl.LINES, gl.POINTS, gl.TRIANGLE_STRIP, ...). Defaults to `gl.TRIANGLES`
+ * @param {number} [count] An optional count. Defaults to bufferInfo.numElements
+ * @param {number} [offset] An optional offset. Defaults to 0.
+ * @param {number} [instanceCount] An optional instanceCount. if set then `drawArraysInstanced` or `drawElementsInstanced` will be called
+ * @memberOf module:twgl/draw
+ */
+function drawBufferInfo(gl, bufferInfo, type, count, offset, instanceCount) {
+ type = type === undefined ? TRIANGLES : type;
+ const indices = bufferInfo.indices;
+ const elementType = bufferInfo.elementType;
+ const numElements = count === undefined ? bufferInfo.numElements : count;
+ offset = offset === undefined ? 0 : offset;
+ if (elementType || indices) {
+ if (instanceCount !== undefined) {
+ gl.drawElementsInstanced(type, numElements, elementType === undefined ? UNSIGNED_SHORT : bufferInfo.elementType, offset, instanceCount);
+ } else {
+ gl.drawElements(type, numElements, elementType === undefined ? UNSIGNED_SHORT : bufferInfo.elementType, offset);
+ }
+ } else {
+ if (instanceCount !== undefined) {
+ gl.drawArraysInstanced(type, offset, numElements, instanceCount);
+ } else {
+ gl.drawArrays(type, offset, numElements);
+ }
+ }
+}
+
+/**
+ * A DrawObject is useful for putting objects in to an array and passing them to {@link module:twgl.drawObjectList}.
+ *
+ * You need either a `BufferInfo` or a `VertexArrayInfo`.
+ *
+ * @typedef {Object} DrawObject
+ * @property {boolean} [active] whether or not to draw. Default = `true` (must be `false` to be not true). In other words `undefined` = `true`
+ * @property {number} [type] type to draw eg. `gl.TRIANGLES`, `gl.LINES`, etc...
+ * @property {module:twgl.ProgramInfo} programInfo A ProgramInfo as returned from {@link module:twgl.createProgramInfo}
+ * @property {module:twgl.BufferInfo} [bufferInfo] A BufferInfo as returned from {@link module:twgl.createBufferInfoFromArrays}
+ * @property {module:twgl.VertexArrayInfo} [vertexArrayInfo] A VertexArrayInfo as returned from {@link module:twgl.createVertexArrayInfo}
+ * @property {Object} uniforms The values for the uniforms.
+ * You can pass multiple objects by putting them in an array. For example
+ *
+ * var sharedUniforms = {
+ * u_fogNear: 10,
+ * u_projection: ...
+ * ...
+ * };
+ *
+ * var localUniforms = {
+ * u_world: ...
+ * u_diffuseColor: ...
+ * };
+ *
+ * var drawObj = {
+ * ...
+ * uniforms: [sharedUniforms, localUniforms],
+ * };
+ *
+ * @property {number} [offset] the offset to pass to `gl.drawArrays` or `gl.drawElements`. Defaults to 0.
+ * @property {number} [count] the count to pass to `gl.drawArrays` or `gl.drawElements`. Defaults to bufferInfo.numElements.
+ * @property {number} [instanceCount] the number of instances. Defaults to undefined.
+ * @memberOf module:twgl
+ */
+
+/**
+ * Draws a list of objects
+ * @param {WebGLRenderingContext} gl A WebGLRenderingContext
+ * @param {DrawObject[]} objectsToDraw an array of objects to draw.
+ * @memberOf module:twgl/draw
+ */
+function drawObjectList(gl, objectsToDraw) {
+ let lastUsedProgramInfo = null;
+ let lastUsedBufferInfo = null;
+
+ objectsToDraw.forEach(function(object) {
+ if (object.active === false) {
+ return;
+ }
+
+ const programInfo = object.programInfo;
+ const bufferInfo = object.vertexArrayInfo || object.bufferInfo;
+ let bindBuffers = false;
+ const type = object.type === undefined ? TRIANGLES : object.type;
+
+ if (programInfo !== lastUsedProgramInfo) {
+ lastUsedProgramInfo = programInfo;
+ gl.useProgram(programInfo.program);
+
+ // We have to rebind buffers when changing programs because we
+ // only bind buffers the program uses. So if 2 programs use the same
+ // bufferInfo but the 1st one uses only positions the when the
+ // we switch to the 2nd one some of the attributes will not be on.
+ bindBuffers = true;
+ }
+
+ // Setup all the needed attributes.
+ if (bindBuffers || bufferInfo !== lastUsedBufferInfo) {
+ if (lastUsedBufferInfo && lastUsedBufferInfo.vertexArrayObject && !bufferInfo.vertexArrayObject) {
+ gl.bindVertexArray(null);
+ }
+ lastUsedBufferInfo = bufferInfo;
+ setBuffersAndAttributes(gl, programInfo, bufferInfo);
+ }
+
+ // Set the uniforms.
+ setUniforms(programInfo, object.uniforms);
+
+ // Draw
+ drawBufferInfo(gl, bufferInfo, type, object.count, object.offset, object.instanceCount);
+ });
+
+ if (lastUsedBufferInfo && lastUsedBufferInfo.vertexArrayObject) {
+ gl.bindVertexArray(null);
+ }
+}
+
+var draw = /*#__PURE__*/Object.freeze({
+ __proto__: null,
+ drawBufferInfo: drawBufferInfo,
+ drawObjectList: drawObjectList
+});
+
+/*
+ * Copyright 2019 Gregg Tavares
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+const FRAMEBUFFER = 0x8d40;
+const RENDERBUFFER = 0x8d41;
+const TEXTURE_2D = 0x0de1;
+
+const UNSIGNED_BYTE = 0x1401;
+
+/* PixelFormat */
+const DEPTH_COMPONENT = 0x1902;
+const RGBA = 0x1908;
+const DEPTH_COMPONENT24 = 0x81a6;
+const DEPTH_COMPONENT32F = 0x8cac;
+const DEPTH24_STENCIL8 = 0x88f0;
+const DEPTH32F_STENCIL8 = 0x8cad;
+
+/* Framebuffer Object. */
+const RGBA4 = 0x8056;
+const RGB5_A1 = 0x8057;
+const RGB565 = 0x8D62;
+const DEPTH_COMPONENT16 = 0x81A5;
+const STENCIL_INDEX = 0x1901;
+const STENCIL_INDEX8 = 0x8D48;
+const DEPTH_STENCIL = 0x84F9;
+const COLOR_ATTACHMENT0 = 0x8CE0;
+const DEPTH_ATTACHMENT = 0x8D00;
+const STENCIL_ATTACHMENT = 0x8D20;
+const DEPTH_STENCIL_ATTACHMENT = 0x821A;
+
+/* TextureWrapMode */
+const CLAMP_TO_EDGE = 0x812F;
+
+/* TextureMagFilter */
+const LINEAR = 0x2601;
+
+/**
+ * The options for a framebuffer attachment.
+ *
+ * Note: For a `format` that is a texture include all the texture
+ * options from {@link module:twgl.TextureOptions} for example
+ * `min`, `mag`, `clamp`, etc... Note that unlike {@link module:twgl.TextureOptions}
+ * `auto` defaults to `false` for attachment textures but `min` and `mag` default
+ * to `gl.LINEAR` and `wrap` defaults to `CLAMP_TO_EDGE`
+ *
+ * @typedef {Object} AttachmentOptions
+ * @property {number} [attachmentPoint] The attachment point. Defaults
+ * to `gl.COLOR_ATTACHMENT0 + ndx` unless type is a depth or stencil type
+ * then it's gl.DEPTH_ATTACHMENT or `gl.DEPTH_STENCIL_ATTACHMENT` depending
+ * on the format or attachment type.
+ * @property {number} [format] The format. If one of `gl.RGBA4`,
+ * `gl.RGB565`, `gl.RGB5_A1`, `gl.DEPTH_COMPONENT16`,
+ * `gl.STENCIL_INDEX8` or `gl.DEPTH_STENCIL` then will create a
+ * renderbuffer. Otherwise will create a texture. Default = `gl.RGBA`
+ * @property {number} [type] The type. Used for texture. Default = `gl.UNSIGNED_BYTE`.
+ * @property {number} [target] The texture target for `gl.framebufferTexture2D`.
+ * Defaults to `gl.TEXTURE_2D`. Set to appropriate face for cube maps.
+ * @property {number} [samples] The number of samples. Default = 1
+ * @property {number} [level] level for `gl.framebufferTexture2D`. Defaults to 0.
+ * @property {number} [layer] layer for `gl.framebufferTextureLayer`. Defaults to undefined.
+ * If set then `gl.framebufferTextureLayer` is called, if not then `gl.framebufferTexture2D`
+ * @property {(WebGLRenderbuffer | WebGLTexture)} [attachment] An existing renderbuffer or texture.
+ * If provided will attach this Object. This allows you to share
+ * attachments across framebuffers.
+ * @memberOf module:twgl
+ * @mixes module:twgl.TextureOptions
+ */
+
+const defaultAttachments = [
+ { format: RGBA, type: UNSIGNED_BYTE, min: LINEAR, wrap: CLAMP_TO_EDGE, },
+ { format: DEPTH_STENCIL, },
+];
+
+const attachmentsByFormat = {};
+attachmentsByFormat[DEPTH_STENCIL] = DEPTH_STENCIL_ATTACHMENT;
+attachmentsByFormat[STENCIL_INDEX] = STENCIL_ATTACHMENT;
+attachmentsByFormat[STENCIL_INDEX8] = STENCIL_ATTACHMENT;
+attachmentsByFormat[DEPTH_COMPONENT] = DEPTH_ATTACHMENT;
+attachmentsByFormat[DEPTH_COMPONENT16] = DEPTH_ATTACHMENT;
+attachmentsByFormat[DEPTH_COMPONENT24] = DEPTH_ATTACHMENT;
+attachmentsByFormat[DEPTH_COMPONENT32F] = DEPTH_ATTACHMENT;
+attachmentsByFormat[DEPTH24_STENCIL8] = DEPTH_STENCIL_ATTACHMENT;
+attachmentsByFormat[DEPTH32F_STENCIL8] = DEPTH_STENCIL_ATTACHMENT;
+
+function getAttachmentPointForFormat(format, internalFormat) {
+ return attachmentsByFormat[format] || attachmentsByFormat[internalFormat];
+}
+
+const renderbufferFormats = {};
+renderbufferFormats[RGBA4] = true;
+renderbufferFormats[RGB5_A1] = true;
+renderbufferFormats[RGB565] = true;
+renderbufferFormats[DEPTH_STENCIL] = true;
+renderbufferFormats[DEPTH_COMPONENT16] = true;
+renderbufferFormats[STENCIL_INDEX] = true;
+renderbufferFormats[STENCIL_INDEX8] = true;
+
+function isRenderbufferFormat(format) {
+ return renderbufferFormats[format];
+}
+
+const MAX_COLOR_ATTACHMENT_POINTS = 32; // even an 3090 only supports 8 but WebGL/OpenGL ES define constants for 32
+
+function isColorAttachmentPoint(attachmentPoint) {
+ return attachmentPoint >= COLOR_ATTACHMENT0 && attachmentPoint < COLOR_ATTACHMENT0 + MAX_COLOR_ATTACHMENT_POINTS;
+}
+
+/**
+ * @typedef {Object} FramebufferInfo
+ * @property {WebGLFramebuffer} framebuffer The WebGLFramebuffer for this framebufferInfo
+ * @property {Array.<(WebGLRenderbuffer | WebGLTexture)>} attachments The created attachments in the same order as passed in to {@link module:twgl.createFramebufferInfo}.
+ * @property {number} width The width of the framebuffer and its attachments
+ * @property {number} height The width of the framebuffer and its attachments
+ * @memberOf module:twgl
+ */
+
+/**
+ * Creates a framebuffer and attachments.
+ *
+ * This returns a {@link module:twgl.FramebufferInfo} because it needs to return the attachments as well as the framebuffer.
+ * It also leaves the framebuffer it just created as the currently bound `FRAMEBUFFER`.
+ * Note: If this is WebGL2 or if you called {@link module:twgl.addExtensionsToContext} then it will set the drawBuffers
+ * to `[COLOR_ATTACHMENT0, COLOR_ATTACHMENT1, ...]` for how ever many color attachments were created.
+ *
+ * The simplest usage
+ *
+ * // create an RGBA/UNSIGNED_BYTE texture and DEPTH_STENCIL renderbuffer
+ * const fbi = twgl.createFramebufferInfo(gl);
+ *
+ * More complex usage
+ *
+ * // create an RGB565 renderbuffer and a STENCIL_INDEX8 renderbuffer
+ * const attachments = [
+ * { format: RGB565, mag: NEAREST },
+ * { format: STENCIL_INDEX8 },
+ * ]
+ * const fbi = twgl.createFramebufferInfo(gl, attachments);
+ *
+ * Passing in a specific size
+ *
+ * const width = 256;
+ * const height = 256;
+ * const fbi = twgl.createFramebufferInfo(gl, attachments, width, height);
+ *
+ * **Note!!** It is up to you to check if the framebuffer is renderable by calling `gl.checkFramebufferStatus`.
+ * [WebGL1 only guarantees 3 combinations of attachments work](https://www.khronos.org/registry/webgl/specs/latest/1.0/#6.6).
+ *
+ * @param {WebGLRenderingContext} gl the WebGLRenderingContext
+ * @param {module:twgl.AttachmentOptions[]} [attachments] which attachments to create. If not provided the default is a framebuffer with an
+ * `RGBA`, `UNSIGNED_BYTE` texture `COLOR_ATTACHMENT0` and a `DEPTH_STENCIL` renderbuffer `DEPTH_STENCIL_ATTACHMENT`.
+ * @param {number} [width] the width for the attachments. Default = size of drawingBuffer
+ * @param {number} [height] the height for the attachments. Default = size of drawingBuffer
+ * @return {module:twgl.FramebufferInfo} the framebuffer and attachments.
+ * @memberOf module:twgl/framebuffers
+ */
+function createFramebufferInfo(gl, attachments, width, height) {
+ const target = FRAMEBUFFER;
+ const fb = gl.createFramebuffer();
+ gl.bindFramebuffer(target, fb);
+ width = width || gl.drawingBufferWidth;
+ height = height || gl.drawingBufferHeight;
+ attachments = attachments || defaultAttachments;
+ const usedColorAttachmentsPoints = [];
+ const framebufferInfo = {
+ framebuffer: fb,
+ attachments: [],
+ width: width,
+ height: height,
+ };
+
+ attachments.forEach(function(attachmentOptions, i) {
+ let attachment = attachmentOptions.attachment;
+ const samples = attachmentOptions.samples;
+ const format = attachmentOptions.format;
+ let attachmentPoint = attachmentOptions.attachmentPoint || getAttachmentPointForFormat(format, attachmentOptions.internalFormat);
+ if (!attachmentPoint) {
+ attachmentPoint = COLOR_ATTACHMENT0 + i;
+ }
+ if (isColorAttachmentPoint(attachmentPoint)) {
+ usedColorAttachmentsPoints.push(attachmentPoint);
+ }
+ if (!attachment) {
+ if (samples !== undefined || isRenderbufferFormat(format)) {
+ attachment = gl.createRenderbuffer();
+ gl.bindRenderbuffer(RENDERBUFFER, attachment);
+ if (samples > 1) {
+ gl.renderbufferStorageMultisample(RENDERBUFFER, samples, format, width, height);
+ } else {
+ gl.renderbufferStorage(RENDERBUFFER, format, width, height);
+ }
+ } else {
+ const textureOptions = Object.assign({}, attachmentOptions);
+ textureOptions.width = width;
+ textureOptions.height = height;
+ if (textureOptions.auto === undefined) {
+ textureOptions.auto = false;
+ textureOptions.min = textureOptions.min || textureOptions.minMag || LINEAR;
+ textureOptions.mag = textureOptions.mag || textureOptions.minMag || LINEAR;
+ textureOptions.wrapS = textureOptions.wrapS || textureOptions.wrap || CLAMP_TO_EDGE;
+ textureOptions.wrapT = textureOptions.wrapT || textureOptions.wrap || CLAMP_TO_EDGE;
+ }
+ attachment = createTexture(gl, textureOptions);
+ }
+ }
+ if (isRenderbuffer(gl, attachment)) {
+ gl.framebufferRenderbuffer(target, attachmentPoint, RENDERBUFFER, attachment);
+ } else if (isTexture(gl, attachment)) {
+ if (attachmentOptions.layer !== undefined) {
+ gl.framebufferTextureLayer(
+ target,
+ attachmentPoint,
+ attachment,
+ attachmentOptions.level || 0,
+ attachmentOptions.layer);
+ } else {
+ gl.framebufferTexture2D(
+ target,
+ attachmentPoint,
+ attachmentOptions.target || TEXTURE_2D,
+ attachment,
+ attachmentOptions.level || 0);
+ }
+ } else {
+ throw new Error('unknown attachment type');
+ }
+ framebufferInfo.attachments.push(attachment);
+ });
+ if (gl.drawBuffers) {
+ gl.drawBuffers(usedColorAttachmentsPoints);
+ }
+ return framebufferInfo;
+}
+
+/**
+ * Resizes the attachments of a framebuffer.
+ *
+ * You need to pass in the same `attachments` as you passed in {@link module:twgl.createFramebufferInfo}
+ * because TWGL has no idea the format/type of each attachment.
+ *
+ * The simplest usage
+ *
+ * // create an RGBA/UNSIGNED_BYTE texture and DEPTH_STENCIL renderbuffer
+ * const fbi = twgl.createFramebufferInfo(gl);
+ *
+ * ...
+ *
+ * function render() {
+ * if (twgl.resizeCanvasToDisplaySize(gl.canvas)) {
+ * // resize the attachments
+ * twgl.resizeFramebufferInfo(gl, fbi);
+ * }
+ *
+ * More complex usage
+ *
+ * // create an RGB565 renderbuffer and a STENCIL_INDEX8 renderbuffer
+ * const attachments = [
+ * { format: RGB565, mag: NEAREST },
+ * { format: STENCIL_INDEX8 },
+ * ]
+ * const fbi = twgl.createFramebufferInfo(gl, attachments);
+ *
+ * ...
+ *
+ * function render() {
+ * if (twgl.resizeCanvasToDisplaySize(gl.canvas)) {
+ * // resize the attachments to match
+ * twgl.resizeFramebufferInfo(gl, fbi, attachments);
+ * }
+ *
+ * @param {WebGLRenderingContext} gl the WebGLRenderingContext
+ * @param {module:twgl.FramebufferInfo} framebufferInfo a framebufferInfo as returned from {@link module:twgl.createFramebufferInfo}.
+ * @param {module:twgl.AttachmentOptions[]} [attachments] the same attachments options as passed to {@link module:twgl.createFramebufferInfo}.
+ * @param {number} [width] the width for the attachments. Default = size of drawingBuffer
+ * @param {number} [height] the height for the attachments. Default = size of drawingBuffer
+ * @memberOf module:twgl/framebuffers
+ */
+function resizeFramebufferInfo(gl, framebufferInfo, attachments, width, height) {
+ width = width || gl.drawingBufferWidth;
+ height = height || gl.drawingBufferHeight;
+ framebufferInfo.width = width;
+ framebufferInfo.height = height;
+ attachments = attachments || defaultAttachments;
+ attachments.forEach(function(attachmentOptions, ndx) {
+ const attachment = framebufferInfo.attachments[ndx];
+ const format = attachmentOptions.format;
+ const samples = attachmentOptions.samples;
+ if (samples !== undefined || isRenderbuffer(gl, attachment)) {
+ gl.bindRenderbuffer(RENDERBUFFER, attachment);
+ if (samples > 1) {
+ gl.renderbufferStorageMultisample(RENDERBUFFER, samples, format, width, height);
+ } else {
+ gl.renderbufferStorage(RENDERBUFFER, format, width, height);
+ }
+ } else if (isTexture(gl, attachment)) {
+ resizeTexture(gl, attachment, attachmentOptions, width, height);
+ } else {
+ throw new Error('unknown attachment type');
+ }
+ });
+}
+
+/**
+ * Binds a framebuffer
+ *
+ * This function pretty much solely exists because I spent hours
+ * trying to figure out why something I wrote wasn't working only
+ * to realize I forget to set the viewport dimensions.
+ * My hope is this function will fix that.
+ *
+ * It is effectively the same as
+ *
+ * gl.bindFramebuffer(gl.FRAMEBUFFER, someFramebufferInfo.framebuffer);
+ * gl.viewport(0, 0, someFramebufferInfo.width, someFramebufferInfo.height);
+ *
+ * @param {WebGLRenderingContext} gl the WebGLRenderingContext
+ * @param {module:twgl.FramebufferInfo|null} [framebufferInfo] a framebufferInfo as returned from {@link module:twgl.createFramebufferInfo}.
+ * If falsy will bind the canvas.
+ * @param {number} [target] The target. If not passed `gl.FRAMEBUFFER` will be used.
+ * @memberOf module:twgl/framebuffers
+ */
+
+function bindFramebufferInfo(gl, framebufferInfo, target) {
+ target = target || FRAMEBUFFER;
+ if (framebufferInfo) {
+ gl.bindFramebuffer(target, framebufferInfo.framebuffer);
+ gl.viewport(0, 0, framebufferInfo.width, framebufferInfo.height);
+ } else {
+ gl.bindFramebuffer(target, null);
+ gl.viewport(0, 0, gl.drawingBufferWidth, gl.drawingBufferHeight);
+ }
+}
+
+var framebuffers = /*#__PURE__*/Object.freeze({
+ __proto__: null,
+ bindFramebufferInfo: bindFramebufferInfo,
+ createFramebufferInfo: createFramebufferInfo,
+ resizeFramebufferInfo: resizeFramebufferInfo
+});
+
+/*
+ * Copyright 2019 Gregg Tavares
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+/**
+ * vertex array object related functions
+ *
+ * You should generally not need to use these functions. They are provided
+ * for those cases where you're doing something out of the ordinary
+ * and you need lower level access.
+ *
+ * For backward compatibility they are available at both `twgl.attributes` and `twgl`
+ * itself
+ *
+ * See {@link module:twgl} for core functions
+ *
+ * @module twgl/vertexArrays
+ */
+
+const ELEMENT_ARRAY_BUFFER = 0x8893;
+
+/**
+ * @typedef {Object} VertexArrayInfo
+ * @property {number} numElements The number of elements to pass to `gl.drawArrays` or `gl.drawElements`.
+ * @property {number} [elementType] The type of indices `UNSIGNED_BYTE`, `UNSIGNED_SHORT` etc..
+ * @property {WebGLVertexArrayObject} [vertexArrayObject] a vertex array object
+ * @memberOf module:twgl
+ */
+
+/**
+ * Creates a VertexArrayInfo from a BufferInfo and one or more ProgramInfos
+ *
+ * This can be passed to {@link module:twgl.setBuffersAndAttributes} and to
+ * {@link module:twgl:drawBufferInfo}.
+ *
+ * > **IMPORTANT:** Vertex Array Objects are **not** a direct analog for a BufferInfo. Vertex Array Objects
+ * assign buffers to specific attributes at creation time. That means they can only be used with programs
+ * who's attributes use the same attribute locations for the same purposes.
+ *
+ * > Bind your attribute locations by passing an array of attribute names to {@link module:twgl.createProgramInfo}
+ * or use WebGL 2's GLSL ES 3's `layout(location = )` to make sure locations match.
+ *
+ * also
+ *
+ * > **IMPORTANT:** After calling twgl.setBuffersAndAttribute with a BufferInfo that uses a Vertex Array Object
+ * that Vertex Array Object will be bound. That means **ANY MANIPULATION OF ELEMENT_ARRAY_BUFFER or ATTRIBUTES**
+ * will affect the Vertex Array Object state.
+ *
+ * > Call `gl.bindVertexArray(null)` to get back manipulating the global attributes and ELEMENT_ARRAY_BUFFER.
+ *
+ * @param {WebGLRenderingContext} gl A WebGLRenderingContext
+ * @param {module:twgl.ProgramInfo|module:twgl.ProgramInfo[]} programInfo a programInfo or array of programInfos
+ * @param {module:twgl.BufferInfo} bufferInfo BufferInfo as returned from createBufferInfoFromArrays etc...
+ *
+ * You need to make sure every attribute that will be used is bound. So for example assume shader 1
+ * uses attributes A, B, C and shader 2 uses attributes A, B, D. If you only pass in the programInfo
+ * for shader 1 then only attributes A, B, and C will have their attributes set because TWGL doesn't
+ * now attribute D's location.
+ *
+ * So, you can pass in both shader 1 and shader 2's programInfo
+ *
+ * @return {module:twgl.VertexArrayInfo} The created VertexArrayInfo
+ *
+ * @memberOf module:twgl/vertexArrays
+ */
+function createVertexArrayInfo(gl, programInfos, bufferInfo) {
+ const vao = gl.createVertexArray();
+ gl.bindVertexArray(vao);
+ if (!programInfos.length) {
+ programInfos = [programInfos];
+ }
+ programInfos.forEach(function(programInfo) {
+ setBuffersAndAttributes(gl, programInfo, bufferInfo);
+ });
+ gl.bindVertexArray(null);
+ return {
+ numElements: bufferInfo.numElements,
+ elementType: bufferInfo.elementType,
+ vertexArrayObject: vao,
+ };
+}
+
+/**
+ * Creates a vertex array object and then sets the attributes on it
+ *
+ * @param {WebGLRenderingContext} gl The WebGLRenderingContext to use.
+ * @param {Object.} setters Attribute setters as returned from createAttributeSetters
+ * @param {Object.} attribs AttribInfos mapped by attribute name.
+ * @param {WebGLBuffer} [indices] an optional ELEMENT_ARRAY_BUFFER of indices
+ *
+ * @return {WebGLVertexArrayObject|null} The created WebGLVertexArrayObject
+ *
+ * @memberOf module:twgl/vertexArrays
+ */
+function createVAOAndSetAttributes(gl, setters, attribs, indices) {
+ const vao = gl.createVertexArray();
+ gl.bindVertexArray(vao);
+ setAttributes(setters, attribs);
+ if (indices) {
+ gl.bindBuffer(ELEMENT_ARRAY_BUFFER, indices);
+ }
+ // We unbind this because otherwise any change to ELEMENT_ARRAY_BUFFER
+ // like when creating buffers for other stuff will mess up this VAO's binding
+ gl.bindVertexArray(null);
+ return vao;
+}
+
+/**
+ * Creates a vertex array object and then sets the attributes
+ * on it
+ *
+ * @param {WebGLRenderingContext} gl The WebGLRenderingContext
+ * to use.
+ * @param {Object.| module:twgl.ProgramInfo} programInfo as returned from createProgramInfo or Attribute setters as returned from createAttributeSetters
+ * @param {module:twgl.BufferInfo} bufferInfo BufferInfo as returned from createBufferInfoFromArrays etc...
+ * @param {WebGLBuffer} [indices] an optional ELEMENT_ARRAY_BUFFER of indices
+ *
+ * @return {WebGLVertexArrayObject|null} The created WebGLVertexArrayObject
+ *
+ * @memberOf module:twgl/vertexArrays
+ */
+function createVAOFromBufferInfo(gl, programInfo, bufferInfo) {
+ return createVAOAndSetAttributes(gl, programInfo.attribSetters || programInfo, bufferInfo.attribs, bufferInfo.indices);
+}
+
+var vertexArrays = /*#__PURE__*/Object.freeze({
+ __proto__: null,
+ createVertexArrayInfo: createVertexArrayInfo,
+ createVAOAndSetAttributes: createVAOAndSetAttributes,
+ createVAOFromBufferInfo: createVAOFromBufferInfo
+});
+
+/*
+ * Copyright 2019 Gregg Tavares
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+const defaults = {
+ addExtensionsToContext: true,
+};
+
+/**
+ * Various default settings for twgl.
+ *
+ * Note: You can call this any number of times. Example:
+ *
+ * twgl.setDefaults({ textureColor: [1, 0, 0, 1] });
+ * twgl.setDefaults({ attribPrefix: 'a_' });
+ *
+ * is equivalent to
+ *
+ * twgl.setDefaults({
+ * textureColor: [1, 0, 0, 1],
+ * attribPrefix: 'a_',
+ * });
+ *
+ * @typedef {Object} Defaults
+ * @property {string} [attribPrefix] The prefix to stick on attributes
+ *
+ * When writing shaders I prefer to name attributes with `a_`, uniforms with `u_` and varyings with `v_`
+ * as it makes it clear where they came from. But, when building geometry I prefer using un-prefixed names.
+ *
+ * In other words I'll create arrays of geometry like this
+ *
+ * const arrays = {
+ * position: ...
+ * normal: ...
+ * texcoord: ...
+ * };
+ *
+ * But need those mapped to attributes and my attributes start with `a_`.
+ *
+ * Default: `""`
+ *
+ * @property {number[]} [textureColor] Array of 4 values in the range 0 to 1
+ *
+ * The default texture color is used when loading textures from
+ * urls. Because the URL will be loaded async we'd like to be
+ * able to use the texture immediately. By putting a 1x1 pixel
+ * color in the texture we can start using the texture before
+ * the URL has loaded.
+ *
+ * Default: `[0.5, 0.75, 1, 1]`
+ *
+ * @property {string} [crossOrigin]
+ *
+ * If not undefined sets the crossOrigin attribute on images
+ * that twgl creates when downloading images for textures.
+ *
+ * Also see {@link module:twgl.TextureOptions}.
+ *
+ * @property {bool} [addExtensionsToContext]
+ *
+ * If true, then, when twgl will try to add any supported WebGL extensions
+ * directly to the context under their normal GL names. For example
+ * if ANGLE_instances_arrays exists then twgl would enable it,
+ * add the functions `vertexAttribDivisor`, `drawArraysInstanced`,
+ * `drawElementsInstanced`, and the constant `VERTEX_ATTRIB_ARRAY_DIVISOR`
+ * to the `WebGLRenderingContext`.
+ *
+ * @memberOf module:twgl
+ */
+
+/**
+ * Sets various defaults for twgl.
+ *
+ * In the interest of terseness which is kind of the point
+ * of twgl I've integrated a few of the older functions here
+ *
+ * @param {module:twgl.Defaults} newDefaults The default settings.
+ * @memberOf module:twgl
+ */
+function setDefaults(newDefaults) {
+ copyExistingProperties(newDefaults, defaults);
+ setDefaults$2(newDefaults); // eslint-disable-line
+ setDefaults$1(newDefaults); // eslint-disable-line
+}
+
+const prefixRE = /^(.*?)_/;
+function addExtensionToContext(gl, extensionName) {
+ glEnumToString(gl, 0);
+ const ext = gl.getExtension(extensionName);
+ if (ext) {
+ const enums = {};
+ const fnSuffix = prefixRE.exec(extensionName)[1];
+ const enumSuffix = '_' + fnSuffix;
+ for (const key in ext) {
+ const value = ext[key];
+ const isFunc = typeof (value) === 'function';
+ const suffix = isFunc ? fnSuffix : enumSuffix;
+ let name = key;
+ // examples of where this is not true are WEBGL_compressed_texture_s3tc
+ // and WEBGL_compressed_texture_pvrtc
+ if (key.endsWith(suffix)) {
+ name = key.substring(0, key.length - suffix.length);
+ }
+ if (gl[name] !== undefined) {
+ if (!isFunc && gl[name] !== value) {
+ warn$1(name, gl[name], value, key);
+ }
+ } else {
+ if (isFunc) {
+ gl[name] = function(origFn) {
+ return function() {
+ return origFn.apply(ext, arguments);
+ };
+ }(value);
+ } else {
+ gl[name] = value;
+ enums[name] = value;
+ }
+ }
+ }
+ // pass the modified enums to glEnumToString
+ enums.constructor = {
+ name: ext.constructor.name,
+ };
+ glEnumToString(enums, 0);
+ }
+ return ext;
+}
+
+/*
+ * If you're wondering why the code doesn't just iterate
+ * over all extensions using `gl.getExtensions` is that it's possible
+ * some future extension is incompatible with this code. Rather than
+ * have thing suddenly break it seems better to manually add to this
+ * list.
+ *
+ */
+const supportedExtensions = [
+ 'ANGLE_instanced_arrays',
+ 'EXT_blend_minmax',
+ 'EXT_color_buffer_float',
+ 'EXT_color_buffer_half_float',
+ 'EXT_disjoint_timer_query',
+ 'EXT_disjoint_timer_query_webgl2',
+ 'EXT_frag_depth',
+ 'EXT_sRGB',
+ 'EXT_shader_texture_lod',
+ 'EXT_texture_filter_anisotropic',
+ 'OES_element_index_uint',
+ 'OES_standard_derivatives',
+ 'OES_texture_float',
+ 'OES_texture_float_linear',
+ 'OES_texture_half_float',
+ 'OES_texture_half_float_linear',
+ 'OES_vertex_array_object',
+ 'WEBGL_color_buffer_float',
+ 'WEBGL_compressed_texture_atc',
+ 'WEBGL_compressed_texture_etc1',
+ 'WEBGL_compressed_texture_pvrtc',
+ 'WEBGL_compressed_texture_s3tc',
+ 'WEBGL_compressed_texture_s3tc_srgb',
+ 'WEBGL_depth_texture',
+ 'WEBGL_draw_buffers',
+];
+
+/**
+ * Attempts to enable all of the following extensions
+ * and add their functions and constants to the
+ * `WebGLRenderingContext` using their normal non-extension like names.
+ *
+ * ANGLE_instanced_arrays
+ * EXT_blend_minmax
+ * EXT_color_buffer_float
+ * EXT_color_buffer_half_float
+ * EXT_disjoint_timer_query
+ * EXT_disjoint_timer_query_webgl2
+ * EXT_frag_depth
+ * EXT_sRGB
+ * EXT_shader_texture_lod
+ * EXT_texture_filter_anisotropic
+ * OES_element_index_uint
+ * OES_standard_derivatives
+ * OES_texture_float
+ * OES_texture_float_linear
+ * OES_texture_half_float
+ * OES_texture_half_float_linear
+ * OES_vertex_array_object
+ * WEBGL_color_buffer_float
+ * WEBGL_compressed_texture_atc
+ * WEBGL_compressed_texture_etc1
+ * WEBGL_compressed_texture_pvrtc
+ * WEBGL_compressed_texture_s3tc
+ * WEBGL_compressed_texture_s3tc_srgb
+ * WEBGL_depth_texture
+ * WEBGL_draw_buffers
+ *
+ * For example if `ANGLE_instanced_arrays` exists then the functions
+ * `drawArraysInstanced`, `drawElementsInstanced`, `vertexAttribDivisor`
+ * and the constant `VERTEX_ATTRIB_ARRAY_DIVISOR` are added to the
+ * `WebGLRenderingContext`.
+ *
+ * Note that if you want to know if the extension exists you should
+ * probably call `gl.getExtension` for each extension. Alternatively
+ * you can check for the existence of the functions or constants that
+ * are expected to be added. For example
+ *
+ * if (gl.drawBuffers) {
+ * // Either WEBGL_draw_buffers was enabled OR you're running in WebGL2
+ * ....
+ *
+ * @param {WebGLRenderingContext} gl A WebGLRenderingContext
+ * @memberOf module:twgl
+ */
+function addExtensionsToContext(gl) {
+ for (let ii = 0; ii < supportedExtensions.length; ++ii) {
+ addExtensionToContext(gl, supportedExtensions[ii]);
+ }
+}
+
+/**
+ * Creates a webgl context.
+ * @param {HTMLCanvasElement} canvas The canvas tag to get
+ * context from. If one is not passed in one will be
+ * created.
+ * @return {WebGLRenderingContext} The created context.
+ * @private
+ */
+function create3DContext(canvas, opt_attribs) {
+ const names = ["webgl", "experimental-webgl"];
+ let context = null;
+ for (let ii = 0; ii < names.length; ++ii) {
+ context = canvas.getContext(names[ii], opt_attribs);
+ if (context) {
+ if (defaults.addExtensionsToContext) {
+ addExtensionsToContext(context);
+ }
+ break;
+ }
+ }
+ return context;
+}
+
+/**
+ * Gets a WebGL1 context.
+ *
+ * Note: Will attempt to enable Vertex Array Objects
+ * and add WebGL2 entry points. (unless you first set defaults with
+ * `twgl.setDefaults({enableVertexArrayObjects: false})`;
+ *
+ * @param {HTMLCanvasElement} canvas a canvas element.
+ * @param {WebGLContextAttributes} [opt_attribs] optional webgl context creation attributes
+ * @return {WebGLRenderingContext} The created context.
+ * @memberOf module:twgl
+ * @deprecated
+ * @private
+ */
+function getWebGLContext(canvas, opt_attribs) {
+ const gl = create3DContext(canvas, opt_attribs);
+ return gl;
+}
+
+/**
+ * Creates a webgl context.
+ *
+ * Will return a WebGL2 context if possible.
+ *
+ * You can check if it's WebGL2 with
+ *
+ * twgl.isWebGL2(gl);
+ *
+ * @param {HTMLCanvasElement} canvas The canvas tag to get
+ * context from. If one is not passed in one will be
+ * created.
+ * @return {WebGLRenderingContext} The created context.
+ */
+function createContext(canvas, opt_attribs) {
+ const names = ["webgl2", "webgl", "experimental-webgl"];
+ let context = null;
+ for (let ii = 0; ii < names.length; ++ii) {
+ context = canvas.getContext(names[ii], opt_attribs);
+ if (context) {
+ if (defaults.addExtensionsToContext) {
+ addExtensionsToContext(context);
+ }
+ break;
+ }
+ }
+ return context;
+}
+
+/**
+ * Gets a WebGL context. Will create a WebGL2 context if possible.
+ *
+ * You can check if it's WebGL2 with
+ *
+ * function isWebGL2(gl) {
+ * return gl.getParameter(gl.VERSION).indexOf("WebGL 2.0 ") == 0;
+ * }
+ *
+ * Note: For a WebGL1 context will attempt to enable Vertex Array Objects
+ * and add WebGL2 entry points. (unless you first set defaults with
+ * `twgl.setDefaults({enableVertexArrayObjects: false})`;
+ *
+ * @param {HTMLCanvasElement} canvas a canvas element.
+ * @param {WebGLContextAttributes} [opt_attribs] optional webgl context creation attributes
+ * @return {WebGLRenderingContext} The created context.
+ * @memberOf module:twgl
+ */
+function getContext(canvas, opt_attribs) {
+ const gl = createContext(canvas, opt_attribs);
+ return gl;
+}
+
+/**
+ * Resize a canvas to match the size it's displayed.
+ * @param {HTMLCanvasElement} canvas The canvas to resize.
+ * @param {number} [multiplier] So you can pass in `window.devicePixelRatio` or other scale value if you want to.
+ * @return {boolean} true if the canvas was resized.
+ * @memberOf module:twgl
+ */
+function resizeCanvasToDisplaySize(canvas, multiplier) {
+ multiplier = multiplier || 1;
+ multiplier = Math.max(0, multiplier);
+ const width = canvas.clientWidth * multiplier | 0;
+ const height = canvas.clientHeight * multiplier | 0;
+ if (canvas.width !== width || canvas.height !== height) {
+ canvas.width = width;
+ canvas.height = height;
+ return true;
+ }
+ return false;
+}
+
+export { addExtensionsToContext, attributes, bindFramebufferInfo, bindTransformFeedbackInfo, bindUniformBlock, canFilter, canGenerateMipmap, createAttribsFromArrays, createAttributeSetters, createBufferFromArray, createBufferFromTypedArray, createBufferInfoFromArrays, createBuffersFromArrays, createFramebufferInfo, createProgram, createProgramAsync, createProgramFromScripts, createProgramFromSources, createProgramInfo, createProgramInfoAsync, createProgramInfoFromProgram, createProgramInfos, createProgramInfosAsync, createPrograms, createProgramsAsync, createSampler, createSamplers, createTexture, createTextures, createTransformFeedback, createTransformFeedbackInfo, createUniformBlockInfo, createUniformBlockInfoFromProgram, createUniformBlockSpecFromProgram, createUniformSetters, createVAOAndSetAttributes, createVAOFromBufferInfo, createVertexArrayInfo, draw, drawBufferInfo, drawObjectList, framebuffers, getArray$1 as getArray_, getBytesPerElementForInternalFormat, getContext, getFormatAndTypeForInternalFormat, getGLTypeForTypedArray, getGLTypeForTypedArrayType, getNumComponentsForFormat, getNumComponents$1 as getNumComponents_, getTypedArrayTypeForGLType, getWebGLContext, glEnumToString, isArrayBuffer$1 as isArrayBuffer, isWebGL1, isWebGL2, loadTextureFromUrl, m4, primitives, programs, resizeCanvasToDisplaySize, resizeFramebufferInfo, resizeTexture, setAttribInfoBufferFromArray, setDefaults$2 as setAttributeDefaults_, setAttributePrefix, setAttributes, setBlockUniforms, setBuffersAndAttributes, setDefaultTextureColor, setDefaults, setEmptyTexture, setSamplerParameters, setDefaults$1 as setTextureDefaults_, setTextureFilteringForSize, setTextureFromArray, setTextureFromElement, setTextureParameters, setUniformBlock, setUniforms, setUniformsAndBindTextures, textures, typedarrays, utils, v3, vertexArrays };
diff --git a/examples/js/index/VSAEffect.js b/examples/js/index/VSAEffect.js
new file mode 100644
index 0000000..2761d0e
--- /dev/null
+++ b/examples/js/index/VSAEffect.js
@@ -0,0 +1,343 @@
+/* eslint-disable no-underscore-dangle */
+
+import * as twgl from '../../3rdParty/twgl-full.module.js';
+
+const m4 = twgl.m4;
+
+const kMaxCount = 100000;
+
+const s_vsHeader = `
+attribute float vertexId;
+
+uniform vec2 mouse;
+uniform vec2 resolution;
+uniform vec4 background;
+uniform float time;
+uniform float vertexCount;
+uniform sampler2D sound;
+uniform vec2 soundRes;
+uniform float _dontUseDirectly_pointSize;
+
+varying vec4 v_color;
+`;
+
+const s_fs = `
+precision mediump float;
+
+varying vec4 v_color;
+
+void main() {
+ gl_FragColor = v_color;
+}
+`;
+
+
+const s_historyVS = `
+attribute vec4 position;
+attribute vec2 texcoord;
+uniform mat4 u_matrix;
+varying vec2 v_texcoord;
+
+void main() {
+ gl_Position = u_matrix * position;
+ v_texcoord = texcoord;
+}
+`;
+
+const s_historyFS = `
+precision mediump float;
+
+uniform sampler2D u_texture;
+uniform float u_mix;
+uniform float u_mult;
+varying vec2 v_texcoord;
+
+void main() {
+ vec4 color = texture2D(u_texture, v_texcoord);
+ gl_FragColor = mix(color.aaaa, color.rgba, u_mix) * u_mult;
+}
+`;
+
+const s_rectVS = `
+attribute vec4 position;
+uniform mat4 u_matrix;
+
+void main() {
+ gl_Position = u_matrix * position;
+}
+`;
+
+const s_rectFS = `
+precision mediump float;
+
+uniform vec4 u_color;
+
+void main() {
+ gl_FragColor = u_color;
+}
+`;
+
+class HistoryTexture {
+ constructor(gl, options) {
+ this.gl = gl;
+ const _width = options.width;
+ const type = options.type || gl.UNSIGNED_BYTE;
+ const format = options.format || gl.RGBA;
+ const Ctor = twgl.getTypedArrayTypeForGLType(type);
+ const numComponents = twgl.getNumComponentsForFormat(format);
+ const size = _width * numComponents;
+ const _buffer = new Ctor(size);
+ const _texSpec = {
+ src: _buffer,
+ height: 1,
+ min: options.min || gl.LINEAR,
+ mag: options.mag || gl.LINEAR,
+ wrap: gl.CLAMP_TO_EDGE,
+ format: format,
+ auto: false, // don't set tex params or call genmipmap
+ };
+ const _tex = twgl.createTexture(gl, _texSpec);
+
+ const _length = options.length;
+ const _historyAttachments = [
+ {
+ format: options.historyFormat || gl.RGBA,
+ type: type,
+ mag: options.mag || gl.LINEAR,
+ min: options.min || gl.LINEAR,
+ wrap: gl.CLAMP_TO_EDGE,
+ },
+ ];
+
+ let _srcFBI = twgl.createFramebufferInfo(gl, _historyAttachments, _width, _length);
+ let _dstFBI = twgl.createFramebufferInfo(gl, _historyAttachments, _width, _length);
+
+ const _historyUniforms = {
+ u_mix: 0,
+ u_mult: 1,
+ u_matrix: m4.identity(),
+ u_texture: undefined,
+ };
+
+ this.buffer = _buffer;
+
+ this.update = (gl, historyProgramInfo, quadBufferInfo) => {
+ const temp = _srcFBI;
+ _srcFBI = _dstFBI;
+ _dstFBI = temp;
+
+ twgl.setTextureFromArray(gl, _tex, _texSpec.src, _texSpec);
+
+ gl.useProgram(historyProgramInfo.program);
+ twgl.bindFramebufferInfo(gl, _dstFBI);
+
+ // copy from historySrc to historyDst one pixel down
+ m4.translation([0, 2 / _length, 0], _historyUniforms.u_matrix);
+ _historyUniforms.u_mix = 1;
+ _historyUniforms.u_texture = _srcFBI.attachments[0];
+
+ twgl.setUniforms(historyProgramInfo, _historyUniforms);
+ twgl.drawBufferInfo(gl, quadBufferInfo);
+
+ // copy audio data into top row of historyDst
+ _historyUniforms.u_mix = format === gl.ALPHA ? 0 : 1;
+ _historyUniforms.u_texture = _tex;
+ m4.translation(
+ [0, -(_length - 0.5) / _length, 0],
+ _historyUniforms.u_matrix);
+ m4.scale(
+ _historyUniforms.u_matrix,
+ [1, 1 / _length, 1],
+ _historyUniforms.u_matrix);
+
+ twgl.setUniforms(historyProgramInfo, _historyUniforms);
+ twgl.drawBufferInfo(gl, quadBufferInfo);
+ };
+
+ this.getTexture = () => {
+ return _dstFBI.attachments[0];
+ };
+ }
+}
+
+const mainRE = /(void[ \t\n\r]+main[ \t\n\r]*\([ \t\n\r]*\)[ \t\n\r]\{)/g;
+function applyTemplateToShader(src) {
+ let vSrc = s_vsHeader + src;
+ vSrc = vSrc.replace(mainRE, function (m) {
+ return `${m}gl_PointSize=1.0;`;
+ });
+ const lastBraceNdx = vSrc.lastIndexOf('}');
+ if (lastBraceNdx >= 0) {
+ const before = vSrc.substr(0, lastBraceNdx);
+ const after = vSrc.substr(lastBraceNdx);
+ vSrc = `${before};gl_PointSize = max(0., gl_PointSize*_dontUseDirectly_pointSize);${after}`;
+ }
+ return vSrc;
+}
+
+export default class VSAEffect {
+ constructor(gl) {
+ this.gl = gl;
+ this.time = 0;
+ this.then = undefined;
+ this.rectProgramInfo = twgl.createProgramInfo(gl, [s_rectVS, s_rectFS]);
+ this.historyProgramInfo = twgl.createProgramInfo(gl, [s_historyVS, s_historyFS]);
+ }
+ #init(gl, analyser) {
+ if (this.init) {
+ return;
+ }
+ this.init = true;
+ const maxTextureSize = gl.getParameter(gl.MAX_TEXTURE_SIZE);
+ this.numSoundSamples = Math.min(maxTextureSize, analyser.frequencyBinCount);
+ this.numHistorySamples = 60 * 4; // 4 seconds;
+
+ this.soundHistory = new HistoryTexture(gl, {
+ width: this.numSoundSamples,
+ length: this.numHistorySamples,
+ format: gl.ALPHA,
+ });
+
+ const count = new Float32Array(kMaxCount);
+ for (let ii = 0; ii < count.length; ++ii) {
+ count[ii] = ii;
+ }
+ const arrays = {
+ vertexId: { data: count, numComponents: 1 },
+ };
+ this.countBufferInfo = twgl.createBufferInfoFromArrays(gl, arrays);
+ this.quadBufferInfo = twgl.createBufferInfoFromArrays(gl, {
+ position: { numComponents: 2, data: [-1, -1, 1, -1, -1, 1, 1, 1] },
+ texcoord: [0, 0, 1, 0, 0, 1, 1, 1],
+ indices: [0, 1, 2, 2, 1, 3],
+ });
+
+ this.uniforms = {
+ time: 0,
+ vertexCount: 0,
+ resolution: [1, 1],
+ background: [0, 0, 0, 1],
+ mouse: [0, 0],
+ sound: undefined,
+ floatSound: undefined,
+ soundRes: [this.numSoundSamples, this.numHistorySamples],
+ _dontUseDirectly_pointSize: 1,
+ };
+
+ this.historyUniforms = {
+ u_mix: 0,
+ u_matrix: m4.identity(),
+ u_texture: undefined,
+ };
+ }
+ async setSettings(vsa) {
+ try {
+ if (vsa === this.currentVsa) {
+ // It's the current URL
+ return;
+ }
+ if (vsa === this.pendingVsa) {
+ // It's the pending Url
+ return;
+ }
+ this.pendingVsa = vsa;
+ if (this.compiling) {
+ return;
+ }
+ // It doesn't matter if the URL is bad, we don't want to try again
+ this.currentVsa = this.pendingVsa;
+ this.pendingVsa = undefined;
+ this.compiling = true;
+ const gl = this.gl;
+ const vs = applyTemplateToShader(vsa.settings.shader);
+ const programInfo = await twgl.createProgramInfoAsync(gl, [vs, s_fs]);
+ this.programInfo = programInfo;
+ this.vsa = vsa;
+ } catch (e) {
+ console.error(e);
+ }
+ this.compiling = false;
+ if (this.pendingVsa) {
+ const nextVsa = this.pendingVsa;
+ this.pendingVsa = undefined;
+ this.setSettings(nextVsa);
+ }
+ }
+ reset(/*gl*/) {
+ }
+ resize() {
+ }
+
+ #updateSoundHistory(gl, analysers) {
+ // Copy audio data to Nx1 texture
+ analysers[0].getByteFrequencyData(this.soundHistory.buffer);
+
+ gl.disable(gl.DEPTH_TEST);
+ gl.disable(gl.BLEND);
+
+ twgl.setBuffersAndAttributes(gl, this.historyProgramInfo, this.quadBufferInfo);
+
+ this.soundHistory.update(gl, this.historyProgramInfo, this.quadBufferInfo);
+ }
+
+ #renderScene(gl, commonUniforms, soundHistoryTex, time) {
+ twgl.bindFramebufferInfo(gl);
+ const settings = this.vsa.settings;
+
+ const programInfo = this.programInfo;
+ if (!programInfo) {
+ return;
+ }
+
+ const { width, height, left, bottom } = commonUniforms;
+
+ gl.viewport(left, bottom, width, height);
+ gl.scissor(left, bottom, width, height);
+ gl.enable(gl.DEPTH_TEST);
+ gl.enable(gl.BLEND);
+ gl.enable(gl.SCISSOR_TEST);
+ gl.blendFunc(gl.ONE, gl.ONE_MINUS_SRC_ALPHA);
+ gl.clearColor(...settings.backgroundColor);
+ //gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);
+
+ const num = settings.num;
+ const mode = gl[settings.mode];
+ const uniforms = this.uniforms;
+ uniforms.time = time;
+ uniforms.vertexCount = num;
+ uniforms.resolution[0] = width;
+ uniforms.resolution[1] = height;
+ uniforms.background[0] = settings.backgroundColor[0];
+ uniforms.background[1] = settings.backgroundColor[1];
+ uniforms.background[2] = settings.backgroundColor[2];
+ uniforms.background[3] = settings.backgroundColor[3];
+ uniforms._dontUseDirectly_pointSize = 1;
+ uniforms.sound = soundHistoryTex;
+
+ gl.useProgram(programInfo.program);
+ twgl.setBuffersAndAttributes(gl, programInfo, this.countBufferInfo);
+ twgl.setUniforms(programInfo, uniforms);
+ twgl.setUniforms(programInfo, commonUniforms);
+ twgl.drawBufferInfo(gl, this.countBufferInfo, mode, num);
+
+ gl.disable(gl.DEPTH_TEST);
+ gl.disable(gl.BLEND);
+ gl.disable(gl.SCISSOR_TEST);
+ }
+
+ render(gl, commonUniforms, byteBeat, analyzers) {
+ if (!this.vsa || !this.programInfo) {
+ return;
+ }
+ this.#init(gl, analyzers[0]);
+ const now = byteBeat.getTime() / byteBeat.getDesiredSampleRate();
+ const deltaTime = (now - (this.then || now)) * (commonUniforms.speed === undefined ? 1 : commonUniforms.speed);
+ this.then = now;
+ this.time += deltaTime;
+
+ this.#updateSoundHistory(gl, analyzers, this.time);
+
+ const historyTex = this.soundHistory.getTexture();
+ this.#renderScene(gl, commonUniforms, historyTex, this.time);
+ }
+}
\ No newline at end of file
diff --git a/examples/js/index/effects.js b/examples/js/index/effects.js
new file mode 100644
index 0000000..0bd8f39
--- /dev/null
+++ b/examples/js/index/effects.js
@@ -0,0 +1,27 @@
+import admo from './effects/admo.js';
+import bwow from './effects/bwow.js';
+import codez from './effects/codez.js';
+import cyty from './effects/cyty.js';
+import discus from './effects/discus.js';
+import dottoChoukoukei from './effects/dotto-chouhoukei.js';
+import hexit2 from './effects/hexit2.js';
+import loopTest from './effects/loop-test.js';
+import pookymelon from './effects/pookymelon.js';
+import rollin from './effects/rollin.js';
+import starfield from './effects/starfield.js';
+import ung from './effects/ung.js';
+
+export default {
+ admo,
+ bwow,
+ codez,
+ cyty,
+ discus,
+ dottoChoukoukei,
+ hexit2,
+ loopTest,
+ pookymelon,
+ rollin,
+ starfield,
+ ung,
+};
diff --git a/examples/js/index/effects/admo.js b/examples/js/index/effects/admo.js
new file mode 100644
index 0000000..4af709f
--- /dev/null
+++ b/examples/js/index/effects/admo.js
@@ -0,0 +1,390 @@
+/* eslint-disable require-trailing-comma/require-trailing-comma */
+/* eslint-disable no-useless-escape */
+export default {
+ _id: "PkSbv7TufuWHiNRbd",
+ createdAt: "2017-01-28T04:48:49.529Z",
+ modifiedAt: "2017-01-28T05:56:37.779Z",
+ origId: "qjkP6BDvEFyD6CfZC",
+ name: "admo",
+ username: "gman",
+ avatarUrl: "https://secure.gravatar.com/avatar/dcc0309895c3d6db087631813efaa9d1?default=retro&size=200",
+ settings: {
+ num: 15360,
+ mode: "TRIANGLES",
+ sound: "https://soundcloud.com/beatsfar/grand-mas-mandoline",
+ lineSize: "NATIVE",
+ backgroundColor: [
+ 1,
+ 1,
+ 1,
+ 1
+ ],
+ shader: `/* 🌈 */
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+uniform float opacity;
+uniform vec3 color1;
+uniform vec3 color2;
+
+
+#define PI radians(180.)
+
+vec3 hsv2rgb(vec3 c) {
+ c = vec3(c.x, clamp(c.yz, 0.0, 1.0));
+ vec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);
+ vec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www);
+ return c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y);
+}
+
+vec3 rgb2hsv(vec3 c) {
+ vec4 K = vec4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0);
+ vec4 p = mix(vec4(c.bg, K.wz), vec4(c.gb, K.xy), step(c.b, c.g));
+ vec4 q = mix(vec4(p.xyw, c.r), vec4(c.r, p.yzx), step(p.x, c.r));
+
+ float d = q.x - min(q.w, q.y);
+ float e = 1.0e-10;
+ return vec3(abs(q.z + (q.w - q.y) / (6.0 * d + e)), d / (q.x + e), q.x);
+}
+
+mat4 rotX(float angleInRadians) {
+ float s = sin(angleInRadians);
+ float c = cos(angleInRadians);
+
+ return mat4(
+ 1, 0, 0, 0,
+ 0, c, s, 0,
+ 0, -s, c, 0,
+ 0, 0, 0, 1);
+}
+
+mat4 rotY(float angleInRadians) {
+ float s = sin(angleInRadians);
+ float c = cos(angleInRadians);
+
+ return mat4(
+ c, 0,-s, 0,
+ 0, 1, 0, 0,
+ s, 0, c, 0,
+ 0, 0, 0, 1);
+}
+
+mat4 rotZ(float angleInRadians) {
+ float s = sin(angleInRadians);
+ float c = cos(angleInRadians);
+
+ return mat4(
+ c,-s, 0, 0,
+ s, c, 0, 0,
+ 0, 0, 1, 0,
+ 0, 0, 0, 1);
+}
+
+mat4 trans(vec3 trans) {
+ return mat4(
+ 1, 0, 0, 0,
+ 0, 1, 0, 0,
+ 0, 0, 1, 0,
+ trans, 1);
+}
+
+mat4 ident() {
+ return mat4(
+ 1, 0, 0, 0,
+ 0, 1, 0, 0,
+ 0, 0, 1, 0,
+ 0, 0, 0, 1);
+}
+
+mat4 scale(vec3 s) {
+ return mat4(
+ s[0], 0, 0, 0,
+ 0, s[1], 0, 0,
+ 0, 0, s[2], 0,
+ 0, 0, 0, 1);
+}
+
+mat4 uniformScale(float s) {
+ return mat4(
+ s, 0, 0, 0,
+ 0, s, 0, 0,
+ 0, 0, s, 0,
+ 0, 0, 0, 1);
+}
+
+mat4 persp(float fov, float aspect, float zNear, float zFar) {
+ float f = tan(PI * 0.5 - 0.5 * fov);
+ float rangeInv = 1.0 / (zNear - zFar);
+
+ return mat4(
+ f / aspect, 0, 0, 0,
+ 0, f, 0, 0,
+ 0, 0, (zNear + zFar) * rangeInv, -1,
+ 0, 0, zNear * zFar * rangeInv * 2., 0);
+}
+
+mat4 trInv(mat4 m) {
+ mat3 i = mat3(
+ m[0][0], m[1][0], m[2][0],
+ m[0][1], m[1][1], m[2][1],
+ m[0][2], m[1][2], m[2][2]);
+ vec3 t = -i * m[3].xyz;
+
+ return mat4(
+ i[0], t[0],
+ i[1], t[1],
+ i[2], t[2],
+ 0, 0, 0, 1);
+}
+
+mat4 transpose(mat4 m) {
+ return mat4(
+ m[0][0], m[1][0], m[2][0], m[3][0],
+ m[0][1], m[1][1], m[2][1], m[3][1],
+ m[0][2], m[1][2], m[2][2], m[3][2],
+ m[0][3], m[1][3], m[2][3], m[3][3]);
+}
+
+mat4 lookAt(vec3 eye, vec3 target, vec3 up) {
+ vec3 zAxis = normalize(eye - target);
+ vec3 xAxis = normalize(cross(up, zAxis));
+ vec3 yAxis = cross(zAxis, xAxis);
+
+ return mat4(
+ xAxis, 0,
+ yAxis, 0,
+ zAxis, 0,
+ eye, 1);
+}
+
+mat4 inverse(mat4 m) {
+ float
+ a00 = m[0][0], a01 = m[0][1], a02 = m[0][2], a03 = m[0][3],
+ a10 = m[1][0], a11 = m[1][1], a12 = m[1][2], a13 = m[1][3],
+ a20 = m[2][0], a21 = m[2][1], a22 = m[2][2], a23 = m[2][3],
+ a30 = m[3][0], a31 = m[3][1], a32 = m[3][2], a33 = m[3][3],
+
+ b00 = a00 * a11 - a01 * a10,
+ b01 = a00 * a12 - a02 * a10,
+ b02 = a00 * a13 - a03 * a10,
+ b03 = a01 * a12 - a02 * a11,
+ b04 = a01 * a13 - a03 * a11,
+ b05 = a02 * a13 - a03 * a12,
+ b06 = a20 * a31 - a21 * a30,
+ b07 = a20 * a32 - a22 * a30,
+ b08 = a20 * a33 - a23 * a30,
+ b09 = a21 * a32 - a22 * a31,
+ b10 = a21 * a33 - a23 * a31,
+ b11 = a22 * a33 - a23 * a32,
+
+ det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;
+
+ return mat4(
+ a11 * b11 - a12 * b10 + a13 * b09,
+ a02 * b10 - a01 * b11 - a03 * b09,
+ a31 * b05 - a32 * b04 + a33 * b03,
+ a22 * b04 - a21 * b05 - a23 * b03,
+ a12 * b08 - a10 * b11 - a13 * b07,
+ a00 * b11 - a02 * b08 + a03 * b07,
+ a32 * b02 - a30 * b05 - a33 * b01,
+ a20 * b05 - a22 * b02 + a23 * b01,
+ a10 * b10 - a11 * b08 + a13 * b06,
+ a01 * b08 - a00 * b10 - a03 * b06,
+ a30 * b04 - a31 * b02 + a33 * b00,
+ a21 * b02 - a20 * b04 - a23 * b00,
+ a11 * b07 - a10 * b09 - a12 * b06,
+ a00 * b09 - a01 * b07 + a02 * b06,
+ a31 * b01 - a30 * b03 - a32 * b00,
+ a20 * b03 - a21 * b01 + a22 * b00) / det;
+}
+
+mat4 cameraLookAt(vec3 eye, vec3 target, vec3 up) {
+ #if 1
+ return inverse(lookAt(eye, target, up));
+ #else
+ vec3 zAxis = normalize(target - eye);
+ vec3 xAxis = normalize(cross(up, zAxis));
+ vec3 yAxis = cross(zAxis, xAxis);
+
+ return mat4(
+ xAxis, 0,
+ yAxis, 0,
+ zAxis, 0,
+ -dot(xAxis, eye), -dot(yAxis, eye), -dot(zAxis, eye), 1);
+ #endif
+
+}
+
+
+
+// hash function from https://www.shadertoy.com/view/4djSRW
+float hash(float p) {
+ vec2 p2 = fract(vec2(p * 5.3983, p * 5.4427));
+ p2 += dot(p2.yx, p2.xy + vec2(21.5351, 14.3137));
+ return fract(p2.x * p2.y * 95.4337);
+}
+
+// times 2 minus 1
+float t2m1(float v) {
+ return v * 2. - 1.;
+}
+
+// times .5 plus .5
+float t5p5(float v) {
+ return v * 0.5 + 0.5;
+}
+
+float inv(float v) {
+ return 1. - v;
+}
+
+void getCirclePoint(const float numEdgePointsPerCircle, const float id, const float inner, const float start, const float end, out vec3 pos) {
+ float outId = id - floor(id / 3.) * 2. - 1.; // 0 1 2 3 4 5 6 7 8 .. 0 1 2, 1 2 3, 2 3 4
+ float ux = floor(id / 6.) + mod(id, 2.);
+ float vy = mod(floor(id / 2.) + floor(id / 3.), 2.); // change that 3. for cool fx
+ float u = ux / numEdgePointsPerCircle;
+ float v = mix(inner, 1., vy);
+ float a = mix(start, end, u) * PI * 2. + PI * 0.0;
+ float s = sin(a);
+ float c = cos(a);
+ float x = c * v;
+ float y = s * v;
+ float z = 0.;
+ pos = vec3(x, y, z);
+}
+
+
+#define NUM_EDGE_POINTS_PER_CIRCLE 64.0
+#define NUM_POINTS_PER_CIRCLE (NUM_EDGE_POINTS_PER_CIRCLE * 6.0)
+#define NUM_CIRCLES_PER_GROUP 1.0
+void main() {
+ float circleId = floor(vertexId / NUM_POINTS_PER_CIRCLE);
+ float groupId = floor(circleId / NUM_CIRCLES_PER_GROUP);
+ float pointId = mod(vertexId, NUM_POINTS_PER_CIRCLE);
+ float sliceId = mod(floor(vertexId / 6.), 2.);
+ float side = mix(-1., 1., step(0.5, mod(circleId, 2.)));
+ float numCircles = floor(vertexCount / NUM_POINTS_PER_CIRCLE);
+ float numGroups = floor(numCircles / NUM_CIRCLES_PER_GROUP);
+ float cu = circleId / numCircles;
+ float gv = groupId / numGroups;
+ float cgId = mod(circleId, NUM_CIRCLES_PER_GROUP);
+ float cgv = cgId / NUM_CIRCLES_PER_GROUP;
+ float ncgv = 1. - cgv;
+
+
+ float tm = time - cgv * 0.2;
+
+ float su = mix(0.01, 0.2, abs(t2m1(cu)));
+ float sv = 0.;
+ float s = texture2D(sound, vec2(su, sv)).a;
+
+
+ vec3 pos;
+ float inner = 0.;
+ float start = 0.;
+ float end = 1.;
+ getCirclePoint(NUM_EDGE_POINTS_PER_CIRCLE, pointId, inner, start, end, pos);
+ pos.z = pos.x * -0.1 + pos.y * -0.1;//cu * 0.001;
+ pos.x *= cos(pos.y) * mix(.25, .75, abs(sin(time * 0.131)));
+
+ vec3 eye = vec3(sin(time * 0.), sin(time * 0.) * 0.25, 1.);
+ vec3 target = vec3(0);
+ vec3 up = vec3(0, 1, 0);
+
+// mat4 mat = persp(120. * PI / 180., resolution.x / resolution.y, 0.1, 10.);
+ mat4 mat = ident();
+ mat *= scale(0.25 * vec3(1, resolution.x / resolution.y, 1));
+ mat *= cameraLookAt(eye, target, up);
+ mat *= rotZ(time * 0.1 + t2m1(cu) * PI);// * sin(time* 0.1));
+ mat *= trans(vec3(t5p5(sin(time * 0.273)), mix(0.2, 1.5, t5p5(sin(time * 0.171))), 0));
+ mat *= rotZ(t5p5(sin(time * 0.147)));
+
+ gl_Position = mat * vec4(pos, 1);
+
+ float hue = 1. + cu;
+ float sat = mix(.3, 1., abs(sin(time * 0.213)));
+ float val = 1.;
+
+ float colorMix = abs(cu * 2.0 - 1.0);
+ //vec3 hsv1 = rgb2hsv(color1);
+ //vec3 hsv2 = rgb2hsv(color2);
+ //if (abs(hsv1.x - hsv2.x) > 0.5) {
+ // if (hsv1.x > hsv2.x) {
+ // hsv2.x += 1.0;
+ // } else {
+ // hsv1.x += 1.0;
+ // }
+ //}
+ //vec3 color = hsv2rgb(mix(hsv1, hsv2, colorMix));
+ vec3 color = mix(color1, color2, colorMix);
+
+ v_color = //vec4(hsv2rgb(vec3(hue, sat, val)), mix(0.01, 0.2, s));
+ vec4(color, 1.0);
+ v_color.a *= clamp(opacity * 2.0, 0.0, 1.0);
+ v_color.a += clamp((opacity - 0.5) * 2.0, 0.0, 1.0);
+ v_color.rgb *= v_color.a;
+
+ if (cu < 0.0 || cu > 1.0) {
+ v_color = vec4(0, 1, 1, 1);
+ }
+}
+
+`
+ },
+ revisionId: "vkzqvZawTQrJbA4HY",
+ revisionUrl: "https://www.vertexshaderart.com/art/PkSbv7TufuWHiNRbd/revision/vkzqvZawTQrJbA4HY",
+ artUrl: "https://www.vertexshaderart.com/art/undefined",
+ origUrl: "https://www.vertexshaderart.com/art/qjkP6BDvEFyD6CfZC"
+};
diff --git a/examples/js/index/effects/bwow.js b/examples/js/index/effects/bwow.js
new file mode 100644
index 0000000..3078a92
--- /dev/null
+++ b/examples/js/index/effects/bwow.js
@@ -0,0 +1,328 @@
+/* eslint-disable require-trailing-comma/require-trailing-comma */
+/* eslint-disable no-useless-escape */
+export default {
+ _id: "6Yx2A7TQ6NnyHhFPQ",
+ createdAt: "2016-09-02T17:38:52.975Z",
+ modifiedAt: "2016-09-18T04:57:25.845Z",
+ origId: "qjkP6BDvEFyD6CfZC",
+ name: "bwow",
+ username: "gman",
+ avatarUrl: "https://secure.gravatar.com/avatar/dcc0309895c3d6db087631813efaa9d1?default=retro&size=200",
+ settings: {
+ num: 10404,
+ mode: "TRIANGLES",
+ sound: "",
+ lineSize: "NATIVE",
+ backgroundColor: [
+ 1,
+ 1,
+ 1,
+ 1
+ ],
+ shader: `/*
+
+Challenge: 01
+
+*/
+
+
+
+
+#define PI radians(180.)
+
+vec3 hsv2rgb(vec3 c) {
+ c = vec3(c.x, clamp(c.yz, 0.0, 1.0));
+ vec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);
+ vec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www);
+ return c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y);
+}
+
+mat4 rotX(float angleInRadians) {
+ float s = sin(angleInRadians);
+ float c = cos(angleInRadians);
+
+ return mat4(
+ 1, 0, 0, 0,
+ 0, c, s, 0,
+ 0, -s, c, 0,
+ 0, 0, 0, 1);
+}
+
+mat4 rotY(float angleInRadians) {
+ float s = sin(angleInRadians);
+ float c = cos(angleInRadians);
+
+ return mat4(
+ c, 0,-s, 0,
+ 0, 1, 0, 0,
+ s, 0, c, 0,
+ 0, 0, 0, 1);
+}
+
+mat4 rotZ(float angleInRadians) {
+ float s = sin(angleInRadians);
+ float c = cos(angleInRadians);
+
+ return mat4(
+ c,-s, 0, 0,
+ s, c, 0, 0,
+ 0, 0, 1, 0,
+ 0, 0, 0, 1);
+}
+
+mat4 trans(vec3 trans) {
+ return mat4(
+ 1, 0, 0, 0,
+ 0, 1, 0, 0,
+ 0, 0, 1, 0,
+ trans, 1);
+}
+
+mat4 ident() {
+ return mat4(
+ 1, 0, 0, 0,
+ 0, 1, 0, 0,
+ 0, 0, 1, 0,
+ 0, 0, 0, 1);
+}
+
+mat4 scale(vec3 s) {
+ return mat4(
+ s[0], 0, 0, 0,
+ 0, s[1], 0, 0,
+ 0, 0, s[2], 0,
+ 0, 0, 0, 1);
+}
+
+mat4 uniformScale(float s) {
+ return mat4(
+ s, 0, 0, 0,
+ 0, s, 0, 0,
+ 0, 0, s, 0,
+ 0, 0, 0, 1);
+}
+
+mat4 persp(float fov, float aspect, float zNear, float zFar) {
+ float f = tan(PI * 0.5 - 0.5 * fov);
+ float rangeInv = 1.0 / (zNear - zFar);
+
+ return mat4(
+ f / aspect, 0, 0, 0,
+ 0, f, 0, 0,
+ 0, 0, (zNear + zFar) * rangeInv, -1,
+ 0, 0, zNear * zFar * rangeInv * 2., 0);
+}
+
+mat4 trInv(mat4 m) {
+ mat3 i = mat3(
+ m[0][0], m[1][0], m[2][0],
+ m[0][1], m[1][1], m[2][1],
+ m[0][2], m[1][2], m[2][2]);
+ vec3 t = -i * m[3].xyz;
+
+ return mat4(
+ i[0], t[0],
+ i[1], t[1],
+ i[2], t[2],
+ 0, 0, 0, 1);
+}
+
+mat4 transpose(mat4 m) {
+ return mat4(
+ m[0][0], m[1][0], m[2][0], m[3][0],
+ m[0][1], m[1][1], m[2][1], m[3][1],
+ m[0][2], m[1][2], m[2][2], m[3][2],
+ m[0][3], m[1][3], m[2][3], m[3][3]);
+}
+
+mat4 lookAt(vec3 eye, vec3 target, vec3 up) {
+ vec3 zAxis = normalize(eye - target);
+ vec3 xAxis = normalize(cross(up, zAxis));
+ vec3 yAxis = cross(zAxis, xAxis);
+
+ return mat4(
+ xAxis, 0,
+ yAxis, 0,
+ zAxis, 0,
+ eye, 1);
+}
+
+mat4 inverse(mat4 m) {
+ float
+ a00 = m[0][0], a01 = m[0][1], a02 = m[0][2], a03 = m[0][3],
+ a10 = m[1][0], a11 = m[1][1], a12 = m[1][2], a13 = m[1][3],
+ a20 = m[2][0], a21 = m[2][1], a22 = m[2][2], a23 = m[2][3],
+ a30 = m[3][0], a31 = m[3][1], a32 = m[3][2], a33 = m[3][3],
+
+ b00 = a00 * a11 - a01 * a10,
+ b01 = a00 * a12 - a02 * a10,
+ b02 = a00 * a13 - a03 * a10,
+ b03 = a01 * a12 - a02 * a11,
+ b04 = a01 * a13 - a03 * a11,
+ b05 = a02 * a13 - a03 * a12,
+ b06 = a20 * a31 - a21 * a30,
+ b07 = a20 * a32 - a22 * a30,
+ b08 = a20 * a33 - a23 * a30,
+ b09 = a21 * a32 - a22 * a31,
+ b10 = a21 * a33 - a23 * a31,
+ b11 = a22 * a33 - a23 * a32,
+
+ det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;
+
+ return mat4(
+ a11 * b11 - a12 * b10 + a13 * b09,
+ a02 * b10 - a01 * b11 - a03 * b09,
+ a31 * b05 - a32 * b04 + a33 * b03,
+ a22 * b04 - a21 * b05 - a23 * b03,
+ a12 * b08 - a10 * b11 - a13 * b07,
+ a00 * b11 - a02 * b08 + a03 * b07,
+ a32 * b02 - a30 * b05 - a33 * b01,
+ a20 * b05 - a22 * b02 + a23 * b01,
+ a10 * b10 - a11 * b08 + a13 * b06,
+ a01 * b08 - a00 * b10 - a03 * b06,
+ a30 * b04 - a31 * b02 + a33 * b00,
+ a21 * b02 - a20 * b04 - a23 * b00,
+ a11 * b07 - a10 * b09 - a12 * b06,
+ a00 * b09 - a01 * b07 + a02 * b06,
+ a31 * b01 - a30 * b03 - a32 * b00,
+ a20 * b03 - a21 * b01 + a22 * b00) / det;
+}
+
+mat4 cameraLookAt(vec3 eye, vec3 target, vec3 up) {
+ #if 1
+ return inverse(lookAt(eye, target, up));
+ #else
+ vec3 zAxis = normalize(target - eye);
+ vec3 xAxis = normalize(cross(up, zAxis));
+ vec3 yAxis = cross(zAxis, xAxis);
+
+ return mat4(
+ xAxis, 0,
+ yAxis, 0,
+ zAxis, 0,
+ -dot(xAxis, eye), -dot(yAxis, eye), -dot(zAxis, eye), 1);
+ #endif
+
+}
+
+
+
+// hash function from https://www.shadertoy.com/view/4djSRW
+float hash(float p) {
+ vec2 p2 = fract(vec2(p * 5.3983, p * 5.4427));
+ p2 += dot(p2.yx, p2.xy + vec2(21.5351, 14.3137));
+ return fract(p2.x * p2.y * 95.4337);
+}
+
+// times 2 minus 1
+float t2m1(float v) {
+ return v * 2. - 1.;
+}
+
+// times .5 plus .5
+float t5p5(float v) {
+ return v * 0.5 + 0.5;
+}
+
+float inv(float v) {
+ return 1. - v;
+}
+
+void getCirclePoint(const float numEdgePointsPerCircle, const float id, const float inner, const float start, const float end, out vec3 pos) {
+ float outId = id - floor(id / 3.) * 2. - 1.; // 0 1 2 3 4 5 6 7 8 .. 0 1 2, 1 2 3, 2 3 4
+ float ux = floor(id / 6.) + mod(id, 2.);
+ float vy = mod(floor(id / 2.) + floor(id / 3.), 2.); // change that 3. for cool fx
+ float u = ux / numEdgePointsPerCircle;
+ float v = mix(inner, 1., vy);
+ float a = mix(start, end, u) * PI * 2. + PI * 0.0;
+ float s = sin(a);
+ float c = cos(a);
+ float x = c * v;
+ float y = s * v;
+ float z = 0.;
+ pos = vec3(x, y, z);
+}
+
+
+#define CUBE_POINTS_PER_FACE 6.
+#define FACES_PER_CUBE 6.
+#define POINTS_PER_CUBE (CUBE_POINTS_PER_FACE * FACES_PER_CUBE)
+void getCubePoint(const float id, out vec3 position, out vec3 normal) {
+ float quadId = floor(mod(id, POINTS_PER_CUBE) / CUBE_POINTS_PER_FACE);
+ float sideId = mod(quadId, 3.);
+ float flip = mix(1., -1., step(2.5, quadId));
+ // 0 1 2 1 2 3
+ float facePointId = mod(id, CUBE_POINTS_PER_FACE);
+ float pointId = mod(facePointId - floor(facePointId / 3.0), 6.0);
+ float a = pointId * PI * 2. / 4. + PI * 0.25;
+ vec3 p = vec3(cos(a), 0.707106781, sin(a)) * flip;
+ vec3 n = vec3(0, 1, 0) * flip;
+ float lr = mod(sideId, 2.);
+ float ud = step(2., sideId);
+ mat4 mat = rotX(lr * PI * 0.5);
+ mat *= rotZ(ud * PI * 0.5);
+ position = (mat * vec4(p, 1)).xyz;
+ normal = (mat * vec4(n, 0)).xyz;
+}
+
+void main() {
+ float pointId = vertexId;
+
+ vec3 pos;
+ vec3 normal;
+ getCubePoint(pointId, pos, normal);
+ float cubeId = floor(pointId / 36.);
+ float faceId = mod(floor(pointId / 6.), 6.);
+ float numCubes = floor(vertexCount / 36.);
+ float down = floor(sqrt(numCubes));
+ float across = floor(numCubes / down);
+
+ float cx = mod(cubeId, across);
+ float cy = floor(cubeId / across);
+
+ float cu = cx / (across - 1.);
+ float cv = cy / (down - 1.);
+
+ float ca = cu * 2. - 1.;
+ float cd = cv * 2. - 1.;
+
+ float tm = PI * 1.75;time * 0.1;
+ mat4 mat = persp(radians(60.0), resolution.x / resolution.y, 0.1, 1000.0);
+ vec3 eye = vec3(cos(tm) * 1., sin(tm * 0.9) * .1 + 0.7, sin(tm) * 1.);
+ vec3 target = vec3(0);
+ vec3 up = vec3(0,1,0);
+
+ mat *= cameraLookAt(eye, target, up);
+ mat *= trans(vec3(ca, 0, cd) * .3);
+// mat *= rotX(time + abs(ca) * 5.);
+// mat *= rotZ(time + abs(cd) * 6.);
+ float d = length(vec2(ca, cd));
+ mat *= scale(vec3(
+ 1,
+ mix(2.,
+ 12.,
+ pow(sin(time * -2. + d * PI * 1.) * 0.5 + 0.5,
+ 1.5 + (1. - d) * 2.)),
+ 1));
+ mat *= uniformScale(0.03);
+
+
+ gl_Position = mat * vec4(pos, 1);
+ vec3 n = normalize((mat * vec4(normal, 0)).xyz);
+
+ vec3 lightDir = normalize(vec3(3.3, 0.4, -1));
+
+ float hue = .15 + mod(faceId + 2., 6.) * 0.17;
+ float sat = 0.3;
+ float val = 1.;
+ vec3 color = hsv2rgb(vec3(hue, sat, val)) * 1.125;
+ v_color = vec4(color * (dot(n, lightDir) * 0.5 + 0.5), 1);
+}
+
+`
+ },
+ revisionId: "vWR26Fhpcy3b2KLme",
+ revisionUrl: "https://www.vertexshaderart.com/art/6Yx2A7TQ6NnyHhFPQ/revision/vWR26Fhpcy3b2KLme",
+ artUrl: "https://www.vertexshaderart.com/art/undefined",
+ origUrl: "https://www.vertexshaderart.com/art/qjkP6BDvEFyD6CfZC"
+};
diff --git a/examples/js/index/effects/codez.js b/examples/js/index/effects/codez.js
new file mode 100644
index 0000000..28b2b97
--- /dev/null
+++ b/examples/js/index/effects/codez.js
@@ -0,0 +1,636 @@
+/* eslint-disable require-trailing-comma/require-trailing-comma */
+/* eslint-disable no-useless-escape */
+export default {
+ _id: "d7anES7ef6WrrDwsy",
+ createdAt: "2017-01-28T04:48:49.529Z",
+ modifiedAt: "2017-01-28T05:56:37.779Z",
+ origId: "d7anES7ef6WrrDwsy",
+ name: "codez",
+ username: "gman",
+ avatarUrl: "https://secure.gravatar.com/avatar/dcc0309895c3d6db087631813efaa9d1?default=retro&size=200",
+ settings: {
+ num: 100000,
+ mode: "TRIANGLES",
+ sound: "https://soundcloud.com/beatsfar/grand-mas-mandoline",
+ lineSize: "NATIVE",
+ backgroundColor: [
+ 1,
+ 0,
+ 0,
+ 1
+ ],
+ shader: `
+/*
+
+ ___ ___ _______ ________ _________ _______ ___ ___
+|\ \ / /|\ ___ \ |\ __ \|\___ ___|\ ___ \ |\ \ / /|
+\ \ \ / / \ \ __/|\ \ \|\ \|___ \ \_\ \ __/| \ \ \/ / /
+ \ \ \/ / / \ \ \_|/_\ \ _ _\ \ \ \ \ \ \_|/__ \ \ / /
+ \ \ / / \ \ \_|\ \ \ \\ \| \ \ \ \ \ \_|\ \ / \/
+ \ \__/ / \ \_______\ \__\\ _\ \ \__\ \ \_______\/ /\ \
+ \|__|/ \|_______|\|__|\|__| \|__| \|_______/__/ /\ __\
+ |__|/ \|__|
+
+
+ ________ ___ ___ ________ ________ _______ ________
+|\ ____\|\ \|\ \|\ __ \|\ ___ \|\ ___ \ |\ __ \
+\ \ \___|\ \ \\\ \ \ \|\ \ \ \_|\ \ \ __/|\ \ \|\ \
+ \ \_____ \ \ __ \ \ __ \ \ \ \\ \ \ \_|/_\ \ _ _\
+ \|____|\ \ \ \ \ \ \ \ \ \ \ \_\\ \ \ \_|\ \ \ \\ \|
+ ____\_\ \ \__\ \__\ \__\ \__\ \_______\ \_______\ \__\\ _\
+ |\_________\|__|\|__|\|__|\|__|\|_______|\|_______|\|__|\|__|
+ \|_________|
+
+
+ ________ ________ _________
+|\ __ \|\ __ \|\___ ___\
+\ \ \|\ \ \ \|\ \|___ \ \_|
+ \ \ __ \ \ _ _\ \ \ \
+ \ \ \ \ \ \ \\ \| \ \ \
+ \ \__\ \__\ \__\\ _\ \ \__\
+ \|__|\|__|\|__|\|__| \|__|
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+*/
+
+vec3 gSunColor = vec3(1.0, 1.2, 1.4) * 10.1;
+
+vec3 gSkyTop = vec3( 0.1, 0.2, 0.8 ) * 0.5;
+vec3 gSkyBottom = vec3( 0.5, 0.8, 1.0 ) * 1.5;
+
+vec3 gCubeColor = vec3(1.0, 1.0, 1.0);
+float gExposure = 0.3;
+
+float gCubeColorRandom = 0.0;
+
+#define MOVE_OUTWARDS
+
+float fAOAmount = 0.8;
+float gFloorHeight = -1.0;
+float g_cameraFar = 1000.0;
+
+#define PI radians( 180.0 )
+
+
+vec3 GetSunDir()
+{
+ return normalize( vec3( 20.0, 40.3, -10.4 ) );
+}
+
+struct SceneVertex
+{
+ vec3 vWorldPos;
+ vec3 vColor;
+ float fAlpha;
+};
+
+
+float GetCosSunRadius()
+{
+ return 0.01;
+}
+
+
+float GetSunIntensity()
+{
+ return 0.001;
+}
+
+
+vec3 GetSkyColor( vec3 vViewDir )
+{
+ return mix( gSkyBottom, gSkyTop, max( 0.0, vViewDir.y ) );
+}
+const float g_cubeFaces = 6.0;
+const float g_cubeVerticesPerFace = ( 2.0 * 3.0 );
+const float g_cubeVertexCount = ( g_cubeVerticesPerFace * g_cubeFaces );
+
+// 6 7
+// +----------+
+// /| /|
+// 2 / | 3/ |
+// +----------+ |
+// | | | |
+// Y Z | 4| | 5|
+// | +-------|--+
+// ^ / | / | /
+// |/ 0|/ 1|/
+// +--> X +----------+
+
+vec3 GetCubeVertex( float fVertexIndex )
+{
+ float f = fVertexIndex / 8.0;
+ return vec3(
+ mix(-1., 1., step(0.5, fract(f * 4.))),
+ mix(-1., 1., step(0.5, fract(f * 2.))),
+ mix(-1., 1., step(0.5, fract(f))));
+}
+
+
+void GetCubeVertex( const float vertexIndex, const mat4 mat, out vec3 vWorldPos, out vec3 vWorldNormal )
+{
+ float fFaceIndex = floor( vertexIndex / g_cubeFaces );
+
+ vec3 v0, v1, v2, v3;
+
+ if ( fFaceIndex < 0.5 )
+ {
+ v0 = GetCubeVertex( 0.0 );
+ v1 = GetCubeVertex( 2.0 );
+ v2 = GetCubeVertex( 3.0 );
+ v3 = GetCubeVertex( 1.0 );
+ }
+ else if ( fFaceIndex < 1.5 )
+ {
+ v0 = GetCubeVertex( 5.0 );
+ v1 = GetCubeVertex( 7.0 );
+ v2 = GetCubeVertex( 6.0 );
+ v3 = GetCubeVertex( 4.0 );
+ }
+ else if ( fFaceIndex < 2.5 )
+ {
+ v0 = GetCubeVertex( 1.0 );
+ v1 = GetCubeVertex( 3.0 );
+ v2 = GetCubeVertex( 7.0 );
+ v3 = GetCubeVertex( 5.0 );
+ }
+ else if ( fFaceIndex < 3.5 )
+ {
+ v0 = GetCubeVertex( 4.0 );
+ v1 = GetCubeVertex( 6.0 );
+ v2 = GetCubeVertex( 2.0 );
+ v3 = GetCubeVertex( 0.0 );
+ }
+ else if ( fFaceIndex < 4.5 )
+ {
+ v0 = GetCubeVertex( 2.0 );
+ v1 = GetCubeVertex( 6.0 );
+ v2 = GetCubeVertex( 7.0 );
+ v3 = GetCubeVertex( 3.0 );
+ }
+ else
+ {
+ v0 = GetCubeVertex( 1.0 );
+ v1 = GetCubeVertex( 5.0 );
+ v2 = GetCubeVertex( 4.0 );
+ v3 = GetCubeVertex( 0.0 );
+ }
+ v0 = (mat * vec4(v0, 1)).xyz;
+ v1 = (mat * vec4(v1, 1)).xyz;
+ v2 = (mat * vec4(v2, 1)).xyz;
+ v3 = (mat * vec4(v3, 1)).xyz;
+
+ float fFaceVertexIndex = mod( vertexIndex, 6.0 );
+
+ if ( fFaceVertexIndex < 0.5 )
+ {
+ vWorldPos = v0;
+ }
+ else if ( fFaceVertexIndex < 1.5 )
+ {
+ vWorldPos = v1;
+ }
+ else if ( fFaceVertexIndex < 2.5 )
+ {
+ vWorldPos = v2;
+ }
+ else if ( fFaceVertexIndex < 3.5 )
+ {
+ vWorldPos = v0;
+ }
+ else if ( fFaceVertexIndex < 4.5 )
+ {
+ vWorldPos = v2;
+ }
+ else
+ {
+ vWorldPos = v3;
+ }
+
+ vWorldNormal = normalize( cross( v1 - v0, v2 - v0 ) );
+}
+
+
+vec3 GetSunLighting( const vec3 vNormal )
+{
+ vec3 vLight = -GetSunDir();
+
+ float NdotL = max( 0.0, dot( vNormal, -vLight ) );
+
+ return gSunColor * NdotL;
+}
+
+
+vec3 GetSunSpec( const vec3 vPos, const vec3 vNormal, const vec3 vCameraPos )
+{
+ vec3 vLight = -GetSunDir();
+
+ vec3 vView = normalize( vCameraPos - vPos );
+
+ vec3 vH = normalize( vView - vLight );
+
+ float NdotH = max( 0.0, dot( vNormal, vH ) );
+ float NdotL = max( 0.0, dot( vNormal, -vLight ) );
+
+ float f = mix( 0.01, 1.0, pow( 1.0 - NdotL, 5.0 ) );
+
+ return gSunColor * pow( NdotH, 20.0 ) * NdotL * f * 4.0;
+}
+
+
+vec3 GetSkyLighting( const vec3 vNormal )
+{
+ vec3 vSkyLight = normalize( vec3( -1.0, -2.0, -0.5 ) );
+
+ float fSkyBlend = vNormal.y * 0.5 + 0.5;
+
+ return mix( gSkyBottom, gSkyTop, fSkyBlend );
+}
+
+
+void GenerateCubeVertex( const float vertexIndex, const mat4 mat, const vec3 vCubeCol, const vec3 vCameraPos, out SceneVertex outSceneVertex )
+{
+ vec3 vNormal;
+
+ GetCubeVertex( vertexIndex, mat, outSceneVertex.vWorldPos, vNormal );
+
+ outSceneVertex.vColor = vec3( 0.0 );
+
+ outSceneVertex.fAlpha = 1.0;
+
+ float h = outSceneVertex.vWorldPos.y - gFloorHeight;
+ outSceneVertex.vColor += GetSkyLighting( vNormal );
+ outSceneVertex.vColor *= mix( 1.0, fAOAmount, clamp( h, 0.0, 1.0 ) );
+
+ outSceneVertex.vColor += GetSunLighting( vNormal );
+
+ outSceneVertex.vColor *= vCubeCol;
+
+ outSceneVertex.vColor += GetSunSpec( outSceneVertex.vWorldPos, vNormal, vCameraPos );
+}
+
+
+
+// hash function from https://www.shadertoy.com/view/4djSRW
+float hash(float p)
+{
+ vec2 p2 = fract(vec2(p * 5.3983, p * 5.4427));
+ p2 += dot(p2.yx, p2.xy + vec2(21.5351, 14.3137));
+ return fract(p2.x * p2.y * 95.4337);
+}
+
+vec3 hsv2rgb(vec3 c) {
+ c = vec3(c.x, clamp(c.yz, 0.0, 1.0));
+ vec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);
+ vec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www);
+ return c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y);
+}
+
+
+mat4 rotY( float angle ) {
+ float s = sin( angle );
+ float c = cos( angle );
+
+ return mat4(
+ c, 0,-s, 0,
+ 0, 1, 0, 0,
+ s, 0, c, 0,
+ 0, 0, 0, 1);
+}
+
+
+mat4 rotZ( float angle ) {
+ float s = sin( angle );
+ float c = cos( angle );
+
+ return mat4(
+ c,-s, 0, 0,
+ s, c, 0, 0,
+ 0, 0, 1, 0,
+ 0, 0, 0, 1);
+}
+
+mat4 trans(vec3 trans) {
+ #if 0
+ return mat4(
+ 1, 0, 0, trans[0],
+ 0, 1, 0, trans[1],
+ 0, 0, 1, trans[2],
+ 0, 0, 0, 1);
+ #else
+ return mat4(
+ 1, 0, 0, 0,
+ 0, 1, 0, 0,
+ 0, 0, 1, 0,
+ trans, 1);
+ #endif
+}
+
+mat4 ident() {
+ return mat4(
+ 1, 0, 0, 0,
+ 0, 1, 0, 0,
+ 0, 0, 1, 0,
+ 0, 0, 0, 1);
+}
+
+mat4 uniformScale(float s) {
+ return mat4(
+ s, 0, 0, 0,
+ 0, s, 0, 0,
+ 0, 0, s, 0,
+ 0, 0, 0, 1);
+}
+
+mat4 scale(vec3 s) {
+ return mat4(
+ s[0], 0, 0, 0,
+ 0, s[1], 0, 0,
+ 0, 0, s[2], 0,
+ 0, 0, 0, 1);
+}
+
+mat4 persp(float fov, float aspect, float zNear, float zFar) {
+ float f = tan(PI * 0.5 - 0.5 * fov);
+ float rangeInv = 1.0 / (zNear - zFar);
+
+ return mat4(
+ f / aspect, 0, 0, 0,
+ 0, f, 0, 0,
+ 0, 0, (zNear + zFar) * rangeInv, -1,
+ 0, 0, zNear * zFar * rangeInv * 2., 0);
+}
+
+mat4 trInv(mat4 m) {
+ mat3 i = mat3(
+ m[0][0], m[1][0], m[2][0],
+ m[0][1], m[1][1], m[2][1],
+ m[0][2], m[1][2], m[2][2]);
+ vec3 t = -i * m[3].xyz;
+
+ return mat4(
+ i[0], t[0],
+ i[1], t[1],
+ i[2], t[2],
+ 0, 0, 0, 1);
+}
+
+mat4 transpose(mat4 m) {
+ return mat4(
+ m[0][0], m[1][0], m[2][0], m[3][0],
+ m[0][1], m[1][1], m[2][1], m[3][1],
+ m[0][2], m[1][2], m[2][2], m[3][2],
+ m[0][3], m[1][3], m[2][3], m[3][3]);
+}
+
+mat4 lookAt(vec3 eye, vec3 target, vec3 up) {
+ vec3 zAxis = normalize(eye - target);
+ vec3 xAxis = normalize(cross(up, zAxis));
+ vec3 yAxis = cross(zAxis, xAxis);
+
+ return mat4(
+ xAxis, 0,
+ yAxis, 0,
+ zAxis, 0,
+ eye, 1);
+}
+
+mat4 inverse(mat4 m) {
+ float
+ a00 = m[0][0], a01 = m[0][1], a02 = m[0][2], a03 = m[0][3],
+ a10 = m[1][0], a11 = m[1][1], a12 = m[1][2], a13 = m[1][3],
+ a20 = m[2][0], a21 = m[2][1], a22 = m[2][2], a23 = m[2][3],
+ a30 = m[3][0], a31 = m[3][1], a32 = m[3][2], a33 = m[3][3],
+
+ b00 = a00 * a11 - a01 * a10,
+ b01 = a00 * a12 - a02 * a10,
+ b02 = a00 * a13 - a03 * a10,
+ b03 = a01 * a12 - a02 * a11,
+ b04 = a01 * a13 - a03 * a11,
+ b05 = a02 * a13 - a03 * a12,
+ b06 = a20 * a31 - a21 * a30,
+ b07 = a20 * a32 - a22 * a30,
+ b08 = a20 * a33 - a23 * a30,
+ b09 = a21 * a32 - a22 * a31,
+ b10 = a21 * a33 - a23 * a31,
+ b11 = a22 * a33 - a23 * a32,
+
+ det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;
+
+ return mat4(
+ a11 * b11 - a12 * b10 + a13 * b09,
+ a02 * b10 - a01 * b11 - a03 * b09,
+ a31 * b05 - a32 * b04 + a33 * b03,
+ a22 * b04 - a21 * b05 - a23 * b03,
+ a12 * b08 - a10 * b11 - a13 * b07,
+ a00 * b11 - a02 * b08 + a03 * b07,
+ a32 * b02 - a30 * b05 - a33 * b01,
+ a20 * b05 - a22 * b02 + a23 * b01,
+ a10 * b10 - a11 * b08 + a13 * b06,
+ a01 * b08 - a00 * b10 - a03 * b06,
+ a30 * b04 - a31 * b02 + a33 * b00,
+ a21 * b02 - a20 * b04 - a23 * b00,
+ a11 * b07 - a10 * b09 - a12 * b06,
+ a00 * b09 - a01 * b07 + a02 * b06,
+ a31 * b01 - a30 * b03 - a32 * b00,
+ a20 * b03 - a21 * b01 + a22 * b00) / det;
+}
+
+mat4 cameraLookAt(vec3 eye, vec3 target, vec3 up) {
+ #if 1
+ return inverse(lookAt(eye, target, up));
+ #else
+ vec3 zAxis = normalize(target - eye);
+ vec3 xAxis = normalize(cross(up, zAxis));
+ vec3 yAxis = cross(zAxis, xAxis);
+
+ return mat4(
+ xAxis, 0,
+ yAxis, 0,
+ zAxis, 0,
+ -dot(xAxis, eye), -dot(yAxis, eye), -dot(zAxis, eye), 1);
+ #endif
+
+}
+
+
+float m1p1(float v) {
+ return v * 2. - 1.;
+}
+
+float p1m1(float v) {
+ return v * .5 + .5;
+}
+
+float inRange(float v, float minV, float maxV) {
+ return step(minV, v) * step(v, maxV);
+}
+
+float at(float v, float target) {
+ return inRange(v, target - 0.1, target + 0.1);
+}
+
+float easeInOutCubic(float pos) {
+ if (pos < 0.5) {
+ return 0.5 * pow(pos / 0.5, 3.);
+ }
+ pos -= 0.5;
+ pos /= 0.5;
+ pos = 1. - pos;
+ return (1. - pow(pos, 3.)) * 0.5 + 0.5;
+}
+
+float inOut(float v) {
+ float t = fract(v);
+ if (t < 0.5) {
+ return easeInOutCubic(t / 0.5);
+ }
+ return easeInOutCubic(2. - t * 2.);
+}
+
+const float perBlock = 4.;
+
+uniform vec3 color1;
+uniform vec3 color2;
+
+void GetCubePosition( float fCubeId, float numCubes, out mat4 mat, out vec4 vCubeCol )
+{
+ float fSeed = fCubeId;
+ float fPositionBase = fCubeId;
+ float fSize = 1.0;
+
+ vec3 vCubeOrigin = vec3( 0.0, 0.0, 0.0 );
+
+ float across = 48.;
+ float down = floor(numCubes / across);
+ float uId = mod(fCubeId, across);
+ float vId = floor(fCubeId / across);
+ float u = uId / (across);
+ float v = vId / down;
+ float bxId = floor(uId / perBlock);
+ float bzId = floor(vId / perBlock);
+ float numRows = floor(numCubes / across);
+ float numBlocks = floor(numRows / perBlock);
+
+ float uP = m1p1(u);
+ float vP = m1p1(v);
+
+ float ll = length(vec2(uP, vP * 1.5));
+ float snd = texture2D(sound, vec2(mix(0.001, 0.0199, uP), ll * 0.3)).a;
+ //float s2 = 0.;texture2D(sound, vec2(mix(0.02, 0.04, hash(u + v + 2.34)), hash(v) * 0.05)).a;
+
+ vCubeOrigin.x += uP * across * 1.2 + bxId * 0. ;
+ float vSpace = numRows * 1.4 + numBlocks * 0.;
+ float z = vP * down * 1.4 + bzId * 0.;
+ vCubeOrigin.z += z;
+ float height = 1.;
+ //vCubeOrigin.y += pow(sin(time + v * 9.), 1.) * pow(cos(time + u * 8.17), 1.) * 4. * inOut(time * 0.1);
+
+ mat = ident();
+ mat *= trans(vCubeOrigin);
+ mat *= rotZ(p1m1(snd) * 10.);
+ mat *= rotY(p1m1(snd) * 10.);
+ mat *= uniformScale(mix(0., 3.0, pow(clamp(mix(-0.5, 1., snd), 0., 1.), 7.)));
+
+ vec3 vRandCol;
+
+ float st = step(0.9, snd);
+ float h = 0. + floor(time * 0.0) * 0.1 + easeInOutCubic(fract(time * 0.1)) * 0.1;
+ //vCubeCol.rgb = hsv2rgb(vec3(mix(h, h + 0.5, st),
+ // st,//pow(snd, 0.),
+ // 1));
+ vCubeCol.rgb = color1;
+ //vCubeCol.rgb = mix(vCubeCol.rgb, vec3(1,0,0), step(0.9, snd));
+ vCubeCol.rgb = mix(vCubeCol.rgb, color2, step(0.98, snd));
+ vCubeCol.a = 0.;vCubeOrigin.z / vSpace;
+}
+
+float goop(float t) {
+ return sin(t) * sin(t * 0.27) * sin(t * 0.13) * sin(t * 0.73);
+}
+
+
+void main()
+{
+ SceneVertex sceneVertex;
+
+ float fov = 1.8;
+
+// vec3 vCameraTarget = vec3( 300, -400.6, 500.0 );
+// vec3 vCameraPos = vec3(-45.1, 20., -0.);
+
+ vec3 vCameraTarget = vec3( 0, 0., 0.0 );
+ vec3 vCameraPos = vCameraTarget + vec3(0, 100., 0);
+ float ca = 0.;
+
+ // get sick!
+ ca = time * 0.1;
+ vec3 vCameraUp = vec3( 1, 0, 0 );
+ // vec3 vCameraUp = vec3( 0, 0, 1 );
+
+ vec3 vCameraForwards = normalize(vCameraTarget - vCameraPos);
+
+ float vertexIndex = vertexId;
+
+
+ float fCubeId = floor( vertexIndex / g_cubeVertexCount );
+ float fCubeVertex = mod( vertexIndex, g_cubeVertexCount );
+ float fNumCubes = floor( vertexCount / g_cubeVertexCount );
+
+ mat4 mCube;
+ vec4 vCubeCol;
+
+ GetCubePosition( fCubeId, fNumCubes, mCube, vCubeCol );
+
+ GenerateCubeVertex( fCubeVertex, mCube, vCubeCol.xyz, vCameraPos, sceneVertex );
+
+ mat4 m = persp(radians(45.), resolution.x / resolution.y, 0.1, 1000.);
+ m *= cameraLookAt(vCameraPos, vCameraTarget, vCameraUp);
+ gl_Position = m * vec4(sceneVertex.vWorldPos, 1);
+
+ // Final output color
+ float fExposure = gExposure;// min( gExposure, time * 0.1 );
+ vec3 vFinalColor = sqrt( vec3(1.0) - exp2( sceneVertex.vColor * -fExposure ) );
+
+ v_color = mix(vec4(vFinalColor, 1), background, vCubeCol.a);
+
+}
+
+`
+ },
+ revisionId: "d7anES7ef6WrrDwsy",
+ revisionUrl: "https://www.vertexshaderart.com/art/d7anES7ef6WrrDwsy/revision/d7anES7ef6WrrDwsy",
+ artUrl: "https://www.vertexshaderart.com/art/d7anES7ef6WrrDwsy",
+ origUrl: "https://www.vertexshaderart.com/art/d7anES7ef6WrrDwsy"
+};
diff --git a/examples/js/index/effects/cyty.js b/examples/js/index/effects/cyty.js
new file mode 100644
index 0000000..b8e7620
--- /dev/null
+++ b/examples/js/index/effects/cyty.js
@@ -0,0 +1,675 @@
+/* eslint-disable require-trailing-comma/require-trailing-comma */
+/* eslint-disable no-useless-escape */
+export default {
+ _id: "bbsF39W6bJo3j4R3j",
+ createdAt: "2016-01-09T08:24:22.209Z",
+ modifiedAt: "2016-01-25T18:24:26.127Z",
+ origId: "xvg4vyvfWjCvKZQfW",
+ name: "cyty",
+ username: "gman",
+ avatarUrl: "https://secure.gravatar.com/avatar/dcc0309895c3d6db087631813efaa9d1?default=retro&size=200",
+ settings: {
+ num: 100000,
+ mode: "TRIANGLES",
+ sound: "https://soundcloud.com/stuart-king/kraftwerk-the-model-stuart",
+ lineSize: "NATIVE",
+ backgroundColor: [
+ 1,
+ 1,
+ 1,
+ 1
+ ],
+ shader: `/*
+
+ ___ ___ _______ ________ _________ _______ ___ ___
+|\ \ / /|\ ___ \ |\ __ \|\___ ___|\ ___ \ |\ \ / /|
+\ \ \ / / \ \ __/|\ \ \|\ \|___ \ \_\ \ __/| \ \ \/ / /
+ \ \ \/ / / \ \ \_|/_\ \ _ _\ \ \ \ \ \ \_|/__ \ \ / /
+ \ \ / / \ \ \_|\ \ \ \\ \| \ \ \ \ \ \_|\ \ / \/
+ \ \__/ / \ \_______\ \__\\ _\ \ \__\ \ \_______\/ /\ \
+ \|__|/ \|_______|\|__|\|__| \|__| \|_______/__/ /\ __\
+ |__|/ \|__|
+
+
+ ________ ___ ___ ________ ________ _______ ________
+|\ ____\|\ \|\ \|\ __ \|\ ___ \|\ ___ \ |\ __ \
+\ \ \___|\ \ \\\ \ \ \|\ \ \ \_|\ \ \ __/|\ \ \|\ \
+ \ \_____ \ \ __ \ \ __ \ \ \ \\ \ \ \_|/_\ \ _ _\
+ \|____|\ \ \ \ \ \ \ \ \ \ \ \_\\ \ \ \_|\ \ \ \\ \|
+ ____\_\ \ \__\ \__\ \__\ \__\ \_______\ \_______\ \__\\ _\
+ |\_________\|__|\|__|\|__|\|__|\|_______|\|_______|\|__|\|__|
+ \|_________|
+
+
+ ________ ________ _________
+|\ __ \|\ __ \|\___ ___\
+\ \ \|\ \ \ \|\ \|___ \ \_|
+ \ \ __ \ \ _ _\ \ \ \
+ \ \ \ \ \ \ \\ \| \ \ \
+ \ \__\ \__\ \__\\ _\ \ \__\
+ \|__|\|__|\|__|\|__| \|__|
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+*/
+
+vec3 gSunColor = vec3(1.0, 1.2, 1.4) * 10.;
+
+vec3 gSkyTop = vec3( 0.1, 0.2, 0.8 ) * 0.5;
+vec3 gSkyBottom = vec3( 0.5, 0.8, 1.0 ) * 1.5;
+
+vec3 gCubeColor = vec3(1.0, 1.0, 1.0);
+float gExposure = 0.3;
+
+float gCubeColorRandom = 0.0;
+
+#define MOVE_OUTWARDS
+
+float fAOAmount = 0.8;
+float gFloorHeight = -1.0;
+float g_cameraFar = 1000.0;
+
+#define PI radians( 180.0 )
+
+
+vec3 GetSunDir()
+{
+ return normalize( vec3( 20.0, 40.3, -10.4 ) );
+}
+
+
+void GetQuadInfo( const float vertexIndex, out vec2 quadVertId, out float quadId )
+{
+ float twoTriVertexIndex = mod( vertexIndex, 6.0 );
+ float triVertexIndex = mod( vertexIndex, 3.0 );
+
+ if ( twoTriVertexIndex < 0.5 ) quadVertId = vec2( 0.0, 0.0 );
+ else if ( twoTriVertexIndex < 1.5 ) quadVertId = vec2( 1.0, 0.0 );
+ else if ( twoTriVertexIndex < 2.5 ) quadVertId = vec2( 0.0, 1.0 );
+ else if ( twoTriVertexIndex < 3.5 ) quadVertId = vec2( 1.0, 0.0 );
+ else if ( twoTriVertexIndex < 4.5 ) quadVertId = vec2( 1.0, 1.0 );
+ else quadVertId = vec2( 0.0, 1.0 );
+
+ quadId = floor( vertexIndex / 6.0 );
+}
+
+
+void GetQuadTileInfo( const vec2 quadVertId, const float quadId, const vec2 vDim, out vec2 vQuadTileIndex, out vec2 vQuadUV )
+{
+ vQuadTileIndex.x = floor( mod( quadId, vDim.x ) );
+ vQuadTileIndex.y = floor( quadId / vDim.x );
+
+ vQuadUV.x = floor(quadVertId.x + vQuadTileIndex.x);
+ vQuadUV.y = floor(quadVertId.y + vQuadTileIndex.y);
+
+ vQuadUV = vQuadUV * (1.0 / vDim);
+}
+
+
+void GetQuadTileInfo( const float vertexIndex, const vec2 vDim, out vec2 vQuadTileIndex, out vec2 vQuadUV )
+{
+ vec2 quadVertId;
+ float quadId;
+ GetQuadInfo( vertexIndex, quadVertId, quadId );
+ GetQuadTileInfo( quadVertId, quadId, vDim, vQuadTileIndex, vQuadUV );
+}
+
+
+void GetMatrixFromZY( const vec3 vZ, const vec3 vY, out mat3 m )
+{
+ vec3 vX = normalize( cross( vY, vZ ) );
+ vec3 vOrthoY = normalize( cross( vZ, vX ) );
+ m[0] = vX;
+ m[1] = vOrthoY;
+ m[2] = vZ;
+}
+
+
+void GetMatrixFromZ( vec3 vZAxis, out mat3 m )
+{
+ vec3 vZ = normalize(vZAxis);
+ vec3 vY = vec3( 0.0, 1.0, 0.0 );
+ if ( abs(vZ.y) > 0.99 )
+ {
+ vY = vec3( 1.0, 0.0, 0.0 );
+ }
+ GetMatrixFromZY( vZ, vY, m );
+}
+
+
+struct SceneVertex
+{
+ vec3 vWorldPos;
+ vec3 vColor;
+ float fAlpha;
+};
+
+
+float GetCosSunRadius()
+{
+ return 0.01;
+}
+
+
+float GetSunIntensity()
+{
+ return 0.001;
+}
+
+
+vec3 GetSkyColor( vec3 vViewDir )
+{
+ return mix( gSkyBottom, gSkyTop, max( 0.0, vViewDir.y ) );
+}
+#define g_cubeFaces 6.0
+#define g_cubeVerticesPerFace ( 2.0 * 3.0 )
+#define g_cubeVertexCount ( g_cubeVerticesPerFace * g_cubeFaces )
+
+// 6 7
+// +----------+
+// /| /|
+// 2 / | 3/ |
+// +----------+ |
+// | | | |
+// Y Z | 4| | 5|
+// | +-------|--+
+// ^ / | / | /
+// |/ 0|/ 1|/
+// +--> X +----------+
+
+vec3 GetCubeVertex( float fVertexIndex )
+{
+ vec3 fResult = vec3( 1.0 );
+
+ float f = fVertexIndex / 8.0;
+ if ( fract( f * 4.0 ) < 0.5 )
+ {
+ fResult.x = -fResult.x;
+ }
+
+ if ( fract( f * 2.0 ) < 0.5 )
+ {
+ fResult.y = -fResult.y;
+ }
+
+ if ( fract( f ) < 0.5 )
+ {
+ fResult.z = -fResult.z;
+ }
+
+ return fResult;
+}
+
+
+void GetCubeVertex( const float vertexIndex, const mat4 mat, out vec3 vWorldPos, out vec3 vWorldNormal )
+{
+ float fFaceIndex = floor( vertexIndex / g_cubeFaces );
+
+ vec3 v0, v1, v2, v3;
+
+ if ( fFaceIndex < 0.5 )
+ {
+ v0 = GetCubeVertex( 0.0 );
+ v1 = GetCubeVertex( 2.0 );
+ v2 = GetCubeVertex( 3.0 );
+ v3 = GetCubeVertex( 1.0 );
+ }
+ else if ( fFaceIndex < 1.5 )
+ {
+ v0 = GetCubeVertex( 5.0 );
+ v1 = GetCubeVertex( 7.0 );
+ v2 = GetCubeVertex( 6.0 );
+ v3 = GetCubeVertex( 4.0 );
+ }
+ else if ( fFaceIndex < 2.5 )
+ {
+ v0 = GetCubeVertex( 1.0 );
+ v1 = GetCubeVertex( 3.0 );
+ v2 = GetCubeVertex( 7.0 );
+ v3 = GetCubeVertex( 5.0 );
+ }
+ else if ( fFaceIndex < 3.5 )
+ {
+ v0 = GetCubeVertex( 4.0 );
+ v1 = GetCubeVertex( 6.0 );
+ v2 = GetCubeVertex( 2.0 );
+ v3 = GetCubeVertex( 0.0 );
+ }
+ else if ( fFaceIndex < 4.5 )
+ {
+ v0 = GetCubeVertex( 2.0 );
+ v1 = GetCubeVertex( 6.0 );
+ v2 = GetCubeVertex( 7.0 );
+ v3 = GetCubeVertex( 3.0 );
+ }
+ else
+ {
+ v0 = GetCubeVertex( 1.0 );
+ v1 = GetCubeVertex( 5.0 );
+ v2 = GetCubeVertex( 4.0 );
+ v3 = GetCubeVertex( 0.0 );
+ }
+ #if 0
+ v0 = (vec4(v0, 1) * mat).xyz;
+ v1 = (vec4(v1, 1) * mat).xyz;
+ v2 = (vec4(v2, 1) * mat).xyz;
+ v3 = (vec4(v3, 1) * mat).xyz;
+ #else
+ v0 = (mat * vec4(v0, 1)).xyz;
+ v1 = (mat * vec4(v1, 1)).xyz;
+ v2 = (mat * vec4(v2, 1)).xyz;
+ v3 = (mat * vec4(v3, 1)).xyz;
+ #endif
+ float fFaceVertexIndex = mod( vertexIndex, 6.0 );
+
+ if ( fFaceVertexIndex < 0.5 )
+ {
+ vWorldPos = v0;
+ }
+ else if ( fFaceVertexIndex < 1.5 )
+ {
+ vWorldPos = v1;
+ }
+ else if ( fFaceVertexIndex < 2.5 )
+ {
+ vWorldPos = v2;
+ }
+ else if ( fFaceVertexIndex < 3.5 )
+ {
+ vWorldPos = v0;
+ }
+ else if ( fFaceVertexIndex < 4.5 )
+ {
+ vWorldPos = v2;
+ }
+ else
+ {
+ vWorldPos = v3;
+ }
+
+ vWorldNormal = normalize( cross( v1 - v0, v2 - v0 ) );
+}
+
+
+vec3 GetSunLighting( const vec3 vNormal )
+{
+ vec3 vLight = -GetSunDir();
+
+ float NdotL = max( 0.0, dot( vNormal, -vLight ) );
+
+ return gSunColor * NdotL;
+}
+
+
+vec3 GetSunSpec( const vec3 vPos, const vec3 vNormal, const vec3 vCameraPos )
+{
+ vec3 vLight = -GetSunDir();
+
+ vec3 vView = normalize( vCameraPos - vPos );
+
+ vec3 vH = normalize( vView - vLight );
+
+ float NdotH = max( 0.0, dot( vNormal, vH ) );
+ float NdotL = max( 0.0, dot( vNormal, -vLight ) );
+
+ float f = mix( 0.01, 1.0, pow( 1.0 - NdotL, 5.0 ) );
+
+ return gSunColor * pow( NdotH, 20.0 ) * NdotL * f * 4.0;
+}
+
+
+vec3 GetSkyLighting( const vec3 vNormal )
+{
+ vec3 vSkyLight = normalize( vec3( -1.0, -2.0, -0.5 ) );
+
+ float fSkyBlend = vNormal.y * 0.5 + 0.5;
+
+ return mix( gSkyBottom, gSkyTop, fSkyBlend );
+}
+
+
+void GenerateCubeVertex( const float vertexIndex, const mat4 mat, const vec3 vCubeCol, const vec3 vCameraPos, out SceneVertex outSceneVertex )
+{
+ vec3 vNormal;
+
+ GetCubeVertex( vertexIndex, mat, outSceneVertex.vWorldPos, vNormal );
+
+ outSceneVertex.vColor = vec3( 0.0 );
+
+ outSceneVertex.fAlpha = 1.0;
+
+ float h = outSceneVertex.vWorldPos.y - gFloorHeight;
+ outSceneVertex.vColor += GetSkyLighting( vNormal );
+ outSceneVertex.vColor *= mix( 1.0, fAOAmount, clamp( h, 0.0, 1.0 ) );
+
+ outSceneVertex.vColor += GetSunLighting( vNormal );
+
+ outSceneVertex.vColor *= vCubeCol;
+
+ outSceneVertex.vColor += GetSunSpec( outSceneVertex.vWorldPos, vNormal, vCameraPos );
+}
+
+
+
+// hash function from https://www.shadertoy.com/view/4djSRW
+float hash(float p)
+{
+ vec2 p2 = fract(vec2(p * 5.3983, p * 5.4427));
+ p2 += dot(p2.yx, p2.xy + vec2(21.5351, 14.3137));
+ return fract(p2.x * p2.y * 95.4337);
+}
+
+
+mat4 rotY( float angle ) {
+ float s = sin( angle );
+ float c = cos( angle );
+
+ return mat4(
+ c, 0,-s, 0,
+ 0, 1, 0, 0,
+ s, 0, c, 0,
+ 0, 0, 0, 1);
+}
+
+
+mat4 rotZ( float angle ) {
+ float s = sin( angle );
+ float c = cos( angle );
+
+ return mat4(
+ c,-s, 0, 0,
+ s, c, 0, 0,
+ 0, 0, 1, 0,
+ 0, 0, 0, 1);
+}
+
+mat4 trans(vec3 trans) {
+ #if 0
+ return mat4(
+ 1, 0, 0, trans[0],
+ 0, 1, 0, trans[1],
+ 0, 0, 1, trans[2],
+ 0, 0, 0, 1);
+ #else
+ return mat4(
+ 1, 0, 0, 0,
+ 0, 1, 0, 0,
+ 0, 0, 1, 0,
+ trans, 1);
+ #endif
+}
+
+mat4 ident() {
+ return mat4(
+ 1, 0, 0, 0,
+ 0, 1, 0, 0,
+ 0, 0, 1, 0,
+ 0, 0, 0, 1);
+}
+
+mat4 uniformScale(float s) {
+ return mat4(
+ s, 0, 0, 0,
+ 0, s, 0, 0,
+ 0, 0, s, 0,
+ 0, 0, 0, 1);
+}
+
+mat4 scale(vec3 s) {
+ return mat4(
+ s[0], 0, 0, 0,
+ 0, s[1], 0, 0,
+ 0, 0, s[2], 0,
+ 0, 0, 0, 1);
+}
+
+mat4 persp(float fov, float aspect, float zNear, float zFar) {
+ float f = tan(PI * 0.5 - 0.5 * fov);
+ float rangeInv = 1.0 / (zNear - zFar);
+
+ return mat4(
+ f / aspect, 0, 0, 0,
+ 0, f, 0, 0,
+ 0, 0, (zNear + zFar) * rangeInv, -1,
+ 0, 0, zNear * zFar * rangeInv * 2., 0);
+}
+
+mat4 trInv(mat4 m) {
+ mat3 i = mat3(
+ m[0][0], m[1][0], m[2][0],
+ m[0][1], m[1][1], m[2][1],
+ m[0][2], m[1][2], m[2][2]);
+ vec3 t = -i * m[3].xyz;
+
+ return mat4(
+ i[0], t[0],
+ i[1], t[1],
+ i[2], t[2],
+ 0, 0, 0, 1);
+}
+
+mat4 transpose(mat4 m) {
+ return mat4(
+ m[0][0], m[1][0], m[2][0], m[3][0],
+ m[0][1], m[1][1], m[2][1], m[3][1],
+ m[0][2], m[1][2], m[2][2], m[3][2],
+ m[0][3], m[1][3], m[2][3], m[3][3]);
+}
+
+mat4 lookAt(vec3 eye, vec3 target, vec3 up) {
+ vec3 zAxis = normalize(eye - target);
+ vec3 xAxis = normalize(cross(up, zAxis));
+ vec3 yAxis = cross(zAxis, xAxis);
+
+ return mat4(
+ xAxis, 0,
+ yAxis, 0,
+ zAxis, 0,
+ eye, 1);
+}
+
+mat4 inverse(mat4 m) {
+ float
+ a00 = m[0][0], a01 = m[0][1], a02 = m[0][2], a03 = m[0][3],
+ a10 = m[1][0], a11 = m[1][1], a12 = m[1][2], a13 = m[1][3],
+ a20 = m[2][0], a21 = m[2][1], a22 = m[2][2], a23 = m[2][3],
+ a30 = m[3][0], a31 = m[3][1], a32 = m[3][2], a33 = m[3][3],
+
+ b00 = a00 * a11 - a01 * a10,
+ b01 = a00 * a12 - a02 * a10,
+ b02 = a00 * a13 - a03 * a10,
+ b03 = a01 * a12 - a02 * a11,
+ b04 = a01 * a13 - a03 * a11,
+ b05 = a02 * a13 - a03 * a12,
+ b06 = a20 * a31 - a21 * a30,
+ b07 = a20 * a32 - a22 * a30,
+ b08 = a20 * a33 - a23 * a30,
+ b09 = a21 * a32 - a22 * a31,
+ b10 = a21 * a33 - a23 * a31,
+ b11 = a22 * a33 - a23 * a32,
+
+ det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;
+
+ return mat4(
+ a11 * b11 - a12 * b10 + a13 * b09,
+ a02 * b10 - a01 * b11 - a03 * b09,
+ a31 * b05 - a32 * b04 + a33 * b03,
+ a22 * b04 - a21 * b05 - a23 * b03,
+ a12 * b08 - a10 * b11 - a13 * b07,
+ a00 * b11 - a02 * b08 + a03 * b07,
+ a32 * b02 - a30 * b05 - a33 * b01,
+ a20 * b05 - a22 * b02 + a23 * b01,
+ a10 * b10 - a11 * b08 + a13 * b06,
+ a01 * b08 - a00 * b10 - a03 * b06,
+ a30 * b04 - a31 * b02 + a33 * b00,
+ a21 * b02 - a20 * b04 - a23 * b00,
+ a11 * b07 - a10 * b09 - a12 * b06,
+ a00 * b09 - a01 * b07 + a02 * b06,
+ a31 * b01 - a30 * b03 - a32 * b00,
+ a20 * b03 - a21 * b01 + a22 * b00) / det;
+}
+
+mat4 cameraLookAt(vec3 eye, vec3 target, vec3 up) {
+ #if 1
+ return inverse(lookAt(eye, target, up));
+ #else
+ vec3 zAxis = normalize(target - eye);
+ vec3 xAxis = normalize(cross(up, zAxis));
+ vec3 yAxis = cross(zAxis, xAxis);
+
+ return mat4(
+ xAxis, 0,
+ yAxis, 0,
+ zAxis, 0,
+ -dot(xAxis, eye), -dot(yAxis, eye), -dot(zAxis, eye), 1);
+ #endif
+
+}
+
+
+float m1p1(float v) {
+ return v * 2. - 1.;
+}
+
+float p1m1(float v) {
+ return v * .5 + .5;
+}
+
+float inRange(float v, float minV, float maxV) {
+ return step(minV, v) * step(v, maxV);
+}
+
+float at(float v, float target) {
+ return inRange(v, target - 0.1, target + 0.1);
+}
+
+
+const float perBlock = 4.;
+
+void GetCubePosition( float fCubeId, float numCubes, out mat4 mat, out vec4 vCubeCol )
+{
+ float fSeed = fCubeId;
+ float fPositionBase = fCubeId;
+ float fSize = 1.0;
+
+ vec3 vCubeOrigin = vec3( 0.0, 0.0, 0.0 );
+
+ float across = 48.;
+ float down = 32.;
+ float uId = mod(fCubeId, across);
+ float vId = floor(fCubeId / across);
+ float u = uId / (across - .1);
+ float v = vId / down;
+ float bxId = floor(uId / perBlock);
+ float bzId = floor(vId / perBlock);
+ float numRows = floor(numCubes / across);
+ float numBlocks = floor(numRows / perBlock);
+
+ float snd = texture2D(sound, vec2(mix(0.015, 0.015, u), v * 0.1)).a;
+ float s2 = texture2D(sound, vec2(mix(0.02, 0.04, hash(u + v + 2.34)), hash(v) * 0.05)).a;
+
+ vCubeOrigin.x += m1p1(u) * across * 1.05 + bxId;
+ float vSpace = numRows * 2.05 + numBlocks * 2.;
+ float z = v * down * 2.05 + bzId * 2.;
+ vCubeOrigin.z += fract(-time * 0.2 + z / vSpace) * vSpace;
+ float height = mix(0.1, 0.5, hash(fCubeId)) + smoothstep(0.75, 1., s2) * 1.;
+ vCubeOrigin.y += height;;
+
+ mat = ident();
+ mat *= trans(vCubeOrigin);
+ mat *= scale(vec3(1, height, 1));
+
+ vec3 vRandCol;
+
+
+ vCubeCol.rgb = vec3(1);//mix(vec3(0.5), vec3(1,1,1), pow(s2, 40.0));
+ vCubeCol.rgb = mix(vCubeCol.rgb, vec3(0,0.5,1), step(0.75,s2));
+ //vCubeCol.rgb = vec3(1. - pow(s2, 3.));
+ vCubeCol.a = vCubeOrigin.z / vSpace;
+}
+
+float goop(float t) {
+ return sin(t) * sin(t * 0.27) * sin(t * 0.13) * sin(t * 0.73);
+}
+
+
+void main()
+{
+ SceneVertex sceneVertex;
+
+ float fov = 1.8;
+
+ vec3 vCameraTarget = vec3( 10, 5.6, 1.0 );
+ vec3 vCameraPos = vec3(10.1, 6., -0.);
+ float ca = 0.;
+
+ // get sick!
+ // ca = time + sin(time) * 2.;
+ vec3 vCameraUp = vec3( sin(ca), cos(ca), 0.0 );
+
+ vec3 vCameraForwards = normalize(vCameraTarget - vCameraPos);
+
+ mat3 mCamera;
+ GetMatrixFromZY( vCameraForwards, normalize(vCameraUp), mCamera );
+
+ float vertexIndex = vertexId;
+
+
+ float fCubeId = floor( vertexIndex / g_cubeVertexCount );
+ float fCubeVertex = mod( vertexIndex, g_cubeVertexCount );
+ float fNumCubes = floor( vertexCount / g_cubeVertexCount );
+
+ mat4 mCube;
+ vec4 vCubeCol;
+
+ GetCubePosition( fCubeId, fNumCubes, mCube, vCubeCol );
+
+ GenerateCubeVertex( fCubeVertex, mCube, vCubeCol.xyz, vCameraPos, sceneVertex );
+
+ mat4 m = persp(radians(45.), resolution.x / resolution.y, 0.1, 1000.);
+ m *= cameraLookAt(vCameraPos, vCameraTarget, vCameraUp);
+ gl_Position = m * vec4(sceneVertex.vWorldPos, 1);
+
+ // Final output color
+ float fExposure = gExposure;// min( gExposure, time * 0.1 );
+ vec3 vFinalColor = sqrt( vec3(1.0) - exp2( sceneVertex.vColor * -fExposure ) );
+
+ v_color = mix(vec4(vFinalColor, 1), background, vCubeCol.a);
+
+}`
+ },
+ revisionId: "8z2whXqEmXfeJTPD8",
+ revisionUrl: "https://www.vertexshaderart.com/art/bbsF39W6bJo3j4R3j/revision/8z2whXqEmXfeJTPD8",
+ artUrl: "https://www.vertexshaderart.com/art/undefined",
+ origUrl: "https://www.vertexshaderart.com/art/xvg4vyvfWjCvKZQfW"
+};
diff --git a/examples/js/index/effects/discus.js b/examples/js/index/effects/discus.js
new file mode 100644
index 0000000..618f654
--- /dev/null
+++ b/examples/js/index/effects/discus.js
@@ -0,0 +1,247 @@
+/* eslint-disable require-trailing-comma/require-trailing-comma */
+/* eslint-disable no-useless-escape */
+export default {
+ _id: "yX9SGHv6RPPqcsXvh",
+ createdAt: "2017-01-28T04:48:49.529Z",
+ modifiedAt: "2017-01-28T05:56:37.779Z",
+ origId: "yX9SGHv6RPPqcsXvh",
+ name: "discus",
+ username: "gman",
+ avatarUrl: "https://secure.gravatar.com/avatar/dcc0309895c3d6db087631813efaa9d1?default=retro&size=200",
+ settings: {
+ num: 100000,
+ mode: "TRIANGLES",
+ sound: "https://soundcloud.com/beatsfar/grand-mas-mandoline",
+ lineSize: "NATIVE",
+ backgroundColor: [
+ 1,
+ 0,
+ 0,
+ 1
+ ],
+ shader: `
+
+
+#define PI radians(180.)
+
+vec3 hsv2rgb(vec3 c) {
+ c = vec3(c.x, clamp(c.yz, 0.0, 1.0));
+ vec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);
+ vec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www);
+ return c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y);
+}
+
+mat4 rotY( float angle ) {
+ float s = sin( angle );
+ float c = cos( angle );
+
+ return mat4(
+ c, 0,-s, 0,
+ 0, 1, 0, 0,
+ s, 0, c, 0,
+ 0, 0, 0, 1);
+}
+
+
+mat4 rotZ( float angle ) {
+ float s = sin( angle );
+ float c = cos( angle );
+
+ return mat4(
+ c,-s, 0, 0,
+ s, c, 0, 0,
+ 0, 0, 1, 0,
+ 0, 0, 0, 1);
+}
+
+mat4 trans(vec3 trans) {
+ return mat4(
+ 1, 0, 0, 0,
+ 0, 1, 0, 0,
+ 0, 0, 1, 0,
+ trans, 1);
+}
+
+mat4 ident() {
+ return mat4(
+ 1, 0, 0, 0,
+ 0, 1, 0, 0,
+ 0, 0, 1, 0,
+ 0, 0, 0, 1);
+}
+
+mat4 scale(vec3 s) {
+ return mat4(
+ s[0], 0, 0, 0,
+ 0, s[1], 0, 0,
+ 0, 0, s[2], 0,
+ 0, 0, 0, 1);
+}
+
+mat4 uniformScale(float s) {
+ return mat4(
+ s, 0, 0, 0,
+ 0, s, 0, 0,
+ 0, 0, s, 0,
+ 0, 0, 0, 1);
+}
+
+// hash function from https://www.shadertoy.com/view/4djSRW
+float hash(float p) {
+ vec2 p2 = fract(vec2(p * 5.3983, p * 5.4427));
+ p2 += dot(p2.yx, p2.xy + vec2(21.5351, 14.3137));
+ return fract(p2.x * p2.y * 95.4337);
+}
+
+float m1p1(float v) {
+ return v * 2. - 1.;
+}
+
+float p1m1(float v) {
+ return v * 0.5 + 0.5;
+}
+
+float inv(float v) {
+ return 1. - v;
+}
+
+uniform float numSides;
+#define NUM_EDGE_POINTS_PER_CIRCLE numSides
+#define NUM_POINTS_PER_CIRCLE (NUM_EDGE_POINTS_PER_CIRCLE * 6.)
+#define NUM_CIRCLES_PER_GROUP 2.
+void getCirclePoint(const float id, const float inner, const float start, const float end, out vec3 pos) {
+ float outId = id - floor(id / 3.) * 2. - 1.; // 0 1 2 3 4 5 6 7 8 .. 0 1 2, 1 2 3, 2 3 4
+ float ux = floor(id / 6.) + mod(id, 2.);
+ float vy = mod(floor(id / 2.) + floor(id / 3.), 2.); // change that 3. for cool fx
+ float u = ux / NUM_EDGE_POINTS_PER_CIRCLE;
+ float v = mix(inner, 1., vy);
+ float a = mix(start, end, u) * PI * 2. + PI * 0.0;
+ float s = sin(a);
+ float c = cos(a);
+ float x = c * v;
+ float y = s * v;
+ float z = 0.;
+ pos = vec3(x, y, z);
+}
+
+float goop(float t) {
+ return sin(t) + sin(t * 0.27) + sin(t * 0.13) + sin(t * 0.73);
+}
+
+float easeInOutSine(float t) {
+ return (-0.5 * (cos(PI * t) - 1.));
+}
+
+float mixer(float t, float timeOff, float duration) {
+ t = mod(t, duration * 2.0);
+ t = t - timeOff;
+ if (t > duration) {
+ t = duration + 1. - t;
+ }
+ return easeInOutSine(clamp(t, 0., 1.));
+}
+
+uniform float speed;
+uniform float brightness;
+uniform vec3 color1;
+uniform vec3 color2;
+uniform float rotation;
+uniform float split;
+
+void main() {
+ float circleId = floor(vertexId / NUM_POINTS_PER_CIRCLE);
+ float groupId = floor(circleId / NUM_CIRCLES_PER_GROUP);
+ float pointId = mod(vertexId, NUM_POINTS_PER_CIRCLE);
+ float sliceId = mod(floor(vertexId / 6.), 2.);
+ float side = mix(-1., 1., step(0.5, mod(circleId, 2.)));
+ float numCircles = floor(vertexCount / NUM_POINTS_PER_CIRCLE);
+ float numGroups = floor(numCircles / NUM_CIRCLES_PER_GROUP);
+ float cu = circleId / numCircles;
+ float gv = groupId / numGroups;
+ float cgId = mod(circleId, NUM_CIRCLES_PER_GROUP);
+ float cgv = cgId / NUM_CIRCLES_PER_GROUP;
+ float ncgv = 1. - cgv;
+
+
+ float tm = time - cgv * 0.2;
+ float su = hash(groupId);
+ float snd = texture2D(sound, vec2(mix(0.01, 0.14, su), gv * 0.05)).a;
+
+ //snd = pow(snd, mix(2., 0.5, su));
+
+
+ vec3 pos;
+ float inner = mix(0.0, 1. - pow(snd, 4.), cgId);
+ float start = 0.;//fract(hash(sideId * 0.33) + sin(time * 0.1 + sideId) * 1.1);
+ float end = 1.; //start + hash(sideId + 1.);
+ getCirclePoint(pointId, inner, start, end, pos);
+ pos.z = cgv;
+
+// float historyX = mix(0.01, 0.14, u);
+// snd = pow(snd, mix(2., 0.5, u));
+
+
+
+ // ----
+ float gDown = floor(sqrt(numGroups));
+ float gAcross = floor(numGroups / gDown);
+ vec3 offset0 = vec3(
+ mod(groupId, gAcross) - (gAcross - 1.) / 2.,
+ floor(groupId / gAcross) - (gDown - 1.) / 2.,
+ 0) * 0.2;
+
+ // ----
+ float ang = gv * 10.0;
+ vec3 offset1 = vec3(cos(ang), sin(ang), 0) * gv * 0.5;
+
+ // ----
+ vec3 offset2 = (vec3(hash(groupId), hash(groupId * 0.37), 0) * 2. - 1.) * 0.8;
+
+ // ----
+ ang = gv * 20.0;
+ float rad = floor(groupId / pow(2., gv + 3.));
+ vec3 offset3 = vec3(cos(ang), sin(ang), 0) * mix(0.3, 0.7, rad);
+
+ // 0-6
+ float m = 0.;tm; //mod(tm, 4. * 3.);
+ float mix01 = mixer(m, 0., 3.);
+ float mix23 = mixer(m, 0., 3.);
+ float mix0123 = mixer(m, 0., 6.);
+ vec3 offset =
+ mix(
+ mix(offset0, offset1, mix01),
+ mix(offset2, offset3, mix23),
+ mix0123);
+
+// vec3 offset = vec3(hash(groupId) * 0.8, m1p1(hash(groupId * 0.37)), cgv);
+// offset.x += m1p1(pow(snd, 5.0) + goop(groupId + time * 0.) * 0.1);
+// offset.y += goop(groupId + time * 0.) * 0.1;
+ vec3 aspect = vec3(1, resolution.x / resolution.y, 1);
+
+ mat4 mat = ident();
+ mat *= scale(aspect / gAcross * 12.);
+ mat *= trans(vec3(0.25,0,0));
+ mat *= rotZ(rotation);
+ mat *= trans(offset);
+ mat *= rotZ(offset.x * offset.y);
+ float sp = pow(snd, 5.0);
+
+ mat *= uniformScale(mix(sp, 1. - sp, cgId) * 0.1 + sliceId * 0.0);
+ gl_Position = vec4((mat * vec4(pos, 1)).xyz, 1);
+ gl_PointSize = 4.;
+
+ float hue = tm * 0.0 + mix(0., 20.2, hash(groupId * 0.23));
+ float sat = 1. - pow(snd, 5.);
+ float pump = step(snd, split); //pow(snd, 2.);
+ float val = pump * brightness;//ncgv;//1.;//mix(0.0, 0.0, fract(circleId * 0.79)) + sliceId * .65;
+// v_color = vec4(mix(color1, hsv2rgb(vec3(hue, sat, val)), pump), 1);
+ v_color = vec4(mix(color1, color2, pump), 1);
+ v_color.rgb *= v_color.a;
+}
+`
+ },
+ revisionId: "yX9SGHv6RPPqcsXvh",
+ revisionUrl: "https://www.vertexshaderart.com/art/yX9SGHv6RPPqcsXvh/revision/yX9SGHv6RPPqcsXvh",
+ artUrl: "https://www.vertexshaderart.com/art/yX9SGHv6RPPqcsXvh",
+ origUrl: "https://www.vertexshaderart.com/art/yX9SGHv6RPPqcsXvh"
+};
diff --git a/examples/js/index/effects/dotto-chouhoukei.js b/examples/js/index/effects/dotto-chouhoukei.js
new file mode 100644
index 0000000..04beb67
--- /dev/null
+++ b/examples/js/index/effects/dotto-chouhoukei.js
@@ -0,0 +1,391 @@
+/* eslint-disable require-trailing-comma/require-trailing-comma */
+/* eslint-disable no-useless-escape */
+export default {
+ _id: "JANswiNfyJnruo62E",
+ createdAt: "2017-07-07T14:54:01.007Z",
+ modifiedAt: "2017-07-11T03:19:45.238Z",
+ origId: "JRyewraYLfP9taa98",
+ name: "dotto-chouhoukei",
+ username: "gman",
+ avatarUrl: "https://secure.gravatar.com/avatar/dcc0309895c3d6db087631813efaa9d1?default=retro&size=200",
+ settings: {
+ num: 100000,
+ mode: "POINTS",
+ sound: "https://soundcloud.com/ambient_space/4-ali-khan-sol",
+ lineSize: "NATIVE",
+ backgroundColor: [
+ 0,
+ 0,
+ 0,
+ 1
+ ],
+ shader: `/*
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+*/
+
+
+
+
+#define PI radians(180.)
+
+vec3 hsv2rgb(vec3 c) {
+ c = vec3(c.x, clamp(c.yz, 0.0, 1.0));
+ vec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);
+ vec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www);
+ return c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y);
+}
+
+mat4 rotX(float angleInRadians) {
+ float s = sin(angleInRadians);
+ float c = cos(angleInRadians);
+
+ return mat4(
+ 1, 0, 0, 0,
+ 0, c, s, 0,
+ 0, -s, c, 0,
+ 0, 0, 0, 1);
+}
+
+mat4 rotY(float angleInRadians) {
+ float s = sin(angleInRadians);
+ float c = cos(angleInRadians);
+
+ return mat4(
+ c, 0,-s, 0,
+ 0, 1, 0, 0,
+ s, 0, c, 0,
+ 0, 0, 0, 1);
+}
+
+mat4 rotZ(float angleInRadians) {
+ float s = sin(angleInRadians);
+ float c = cos(angleInRadians);
+
+ return mat4(
+ c,-s, 0, 0,
+ s, c, 0, 0,
+ 0, 0, 1, 0,
+ 0, 0, 0, 1);
+}
+
+mat4 trans(vec3 trans) {
+ return mat4(
+ 1, 0, 0, 0,
+ 0, 1, 0, 0,
+ 0, 0, 1, 0,
+ trans, 1);
+}
+
+mat4 ident() {
+ return mat4(
+ 1, 0, 0, 0,
+ 0, 1, 0, 0,
+ 0, 0, 1, 0,
+ 0, 0, 0, 1);
+}
+
+mat4 scale(vec3 s) {
+ return mat4(
+ s[0], 0, 0, 0,
+ 0, s[1], 0, 0,
+ 0, 0, s[2], 0,
+ 0, 0, 0, 1);
+}
+
+mat4 uniformScale(float s) {
+ return mat4(
+ s, 0, 0, 0,
+ 0, s, 0, 0,
+ 0, 0, s, 0,
+ 0, 0, 0, 1);
+}
+
+mat4 persp(float fov, float aspect, float zNear, float zFar) {
+ float f = tan(PI * 0.5 - 0.5 * fov);
+ float rangeInv = 1.0 / (zNear - zFar);
+
+ return mat4(
+ f / aspect, 0, 0, 0,
+ 0, f, 0, 0,
+ 0, 0, (zNear + zFar) * rangeInv, -1,
+ 0, 0, zNear * zFar * rangeInv * 2., 0);
+}
+
+mat4 trInv(mat4 m) {
+ mat3 i = mat3(
+ m[0][0], m[1][0], m[2][0],
+ m[0][1], m[1][1], m[2][1],
+ m[0][2], m[1][2], m[2][2]);
+ vec3 t = -i * m[3].xyz;
+
+ return mat4(
+ i[0], t[0],
+ i[1], t[1],
+ i[2], t[2],
+ 0, 0, 0, 1);
+}
+
+mat4 transpose(mat4 m) {
+ return mat4(
+ m[0][0], m[1][0], m[2][0], m[3][0],
+ m[0][1], m[1][1], m[2][1], m[3][1],
+ m[0][2], m[1][2], m[2][2], m[3][2],
+ m[0][3], m[1][3], m[2][3], m[3][3]);
+}
+
+mat4 lookAt(vec3 eye, vec3 target, vec3 up) {
+ vec3 zAxis = normalize(eye - target);
+ vec3 xAxis = normalize(cross(up, zAxis));
+ vec3 yAxis = cross(zAxis, xAxis);
+
+ return mat4(
+ xAxis, 0,
+ yAxis, 0,
+ zAxis, 0,
+ eye, 1);
+}
+
+mat4 inverse(mat4 m) {
+ float
+ a00 = m[0][0], a01 = m[0][1], a02 = m[0][2], a03 = m[0][3],
+ a10 = m[1][0], a11 = m[1][1], a12 = m[1][2], a13 = m[1][3],
+ a20 = m[2][0], a21 = m[2][1], a22 = m[2][2], a23 = m[2][3],
+ a30 = m[3][0], a31 = m[3][1], a32 = m[3][2], a33 = m[3][3],
+
+ b00 = a00 * a11 - a01 * a10,
+ b01 = a00 * a12 - a02 * a10,
+ b02 = a00 * a13 - a03 * a10,
+ b03 = a01 * a12 - a02 * a11,
+ b04 = a01 * a13 - a03 * a11,
+ b05 = a02 * a13 - a03 * a12,
+ b06 = a20 * a31 - a21 * a30,
+ b07 = a20 * a32 - a22 * a30,
+ b08 = a20 * a33 - a23 * a30,
+ b09 = a21 * a32 - a22 * a31,
+ b10 = a21 * a33 - a23 * a31,
+ b11 = a22 * a33 - a23 * a32,
+
+ det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;
+
+ return mat4(
+ a11 * b11 - a12 * b10 + a13 * b09,
+ a02 * b10 - a01 * b11 - a03 * b09,
+ a31 * b05 - a32 * b04 + a33 * b03,
+ a22 * b04 - a21 * b05 - a23 * b03,
+ a12 * b08 - a10 * b11 - a13 * b07,
+ a00 * b11 - a02 * b08 + a03 * b07,
+ a32 * b02 - a30 * b05 - a33 * b01,
+ a20 * b05 - a22 * b02 + a23 * b01,
+ a10 * b10 - a11 * b08 + a13 * b06,
+ a01 * b08 - a00 * b10 - a03 * b06,
+ a30 * b04 - a31 * b02 + a33 * b00,
+ a21 * b02 - a20 * b04 - a23 * b00,
+ a11 * b07 - a10 * b09 - a12 * b06,
+ a00 * b09 - a01 * b07 + a02 * b06,
+ a31 * b01 - a30 * b03 - a32 * b00,
+ a20 * b03 - a21 * b01 + a22 * b00) / det;
+}
+
+mat4 cameraLookAt(vec3 eye, vec3 target, vec3 up) {
+ #if 1
+ return inverse(lookAt(eye, target, up));
+ #else
+ vec3 zAxis = normalize(target - eye);
+ vec3 xAxis = normalize(cross(up, zAxis));
+ vec3 yAxis = cross(zAxis, xAxis);
+
+ return mat4(
+ xAxis, 0,
+ yAxis, 0,
+ zAxis, 0,
+ -dot(xAxis, eye), -dot(yAxis, eye), -dot(zAxis, eye), 1);
+ #endif
+
+}
+
+
+
+// hash function from https://www.shadertoy.com/view/4djSRW
+float hash(float p) {
+ vec2 p2 = fract(vec2(p * 5.3983, p * 5.4427));
+ p2 += dot(p2.yx, p2.xy + vec2(21.5351, 14.3137));
+ return fract(p2.x * p2.y * 95.4337);
+}
+
+// times 2 minus 1
+float t2m1(float v) {
+ return v * 2. - 1.;
+}
+
+// times .5 plus .5
+float t5p5(float v) {
+ return v * 0.5 + 0.5;
+}
+
+float inv(float v) {
+ return 1. - v;
+}
+
+void getCirclePoint(const float numEdgePointsPerCircle, const float id, const float inner, const float start, const float end, out vec3 pos) {
+ float outId = id - floor(id / 3.) * 2. - 1.; // 0 1 2 3 4 5 6 7 8 .. 0 1 2, 1 2 3, 2 3 4
+ float ux = floor(id / 6.) + mod(id, 2.);
+ float vy = mod(floor(id / 2.) + floor(id / 3.), 2.); // change that 3. for cool fx
+ float u = ux / numEdgePointsPerCircle;
+ float v = mix(inner, 1., vy);
+ float a = mix(start, end, u) * PI * 2. + PI * 0.0;
+ float s = sin(a);
+ float c = cos(a);
+ float x = c * v;
+ float y = s * v;
+ float z = 0.;
+ pos = vec3(x, y, z);
+}
+
+
+#define CUBE_POINTS_PER_FACE 6.
+#define FACES_PER_CUBE 6.
+#define POINTS_PER_CUBE (CUBE_POINTS_PER_FACE * FACES_PER_CUBE)
+void getCubePoint(const float id, out vec3 position, out vec3 normal) {
+ float quadId = floor(mod(id, POINTS_PER_CUBE) / CUBE_POINTS_PER_FACE);
+ float sideId = mod(quadId, 3.);
+ float flip = mix(1., -1., step(2.5, quadId));
+ // 0 1 2 1 2 3
+ float facePointId = mod(id, CUBE_POINTS_PER_FACE);
+ float pointId = mod(facePointId - floor(facePointId / 3.0), 6.0);
+ float a = pointId * PI * 2. / 4. + PI * 0.25;
+ vec3 p = vec3(cos(a), 0.707106781, sin(a)) * flip;
+ vec3 n = vec3(0, 1, 0) * flip;
+ float lr = mod(sideId, 2.);
+ float ud = step(2., sideId);
+ mat4 mat = rotX(lr * PI * 0.5);
+ mat *= rotZ(ud * PI * 0.5);
+ position = (mat * vec4(p, 1)).xyz;
+ normal = (mat * vec4(n, 0)).xyz;
+}
+
+void main() {
+ float deep = floor(pow(vertexCount, 0.33333));
+ float down = floor(deep);
+ float across = floor(vertexCount / down / deep);
+
+ float cx = mod(vertexId, across);
+ float cy = mod(floor(vertexId / across), down);
+ float cz = floor(vertexId / across / down);
+ float cu = cx / (across - 1.);
+ float cv = cy / (down - 1.);
+ float cw = cz / (deep - 1.);
+
+ float ca = cu * 2. - 1.;
+ float cd = cv * 2. - 1.;
+ float ce = cw * 2. - 1.;
+
+ float tm = time * .1;
+ mat4 mat = persp(radians(60.0), resolution.x / resolution.y, .1, 1000.0);
+ float rad = 2.;
+ vec3 eye = vec3(cos(tm) * rad, sin(tm * 0.9) * rad * 1.1, sin(tm) * rad);
+ vec3 target = vec3(0);
+ vec3 up = vec3(0,1,0);
+
+ mat *= cameraLookAt(eye, target, up);
+ mat *= trans(vec3(ca, ce, cd) * 2.);
+
+ vec3 pos = vec3(0);
+
+ gl_Position = mat * vec4(pos, 1);
+
+ float sz = 1. - abs((gl_Position.z / gl_Position.w * .5 + .5));
+ float st = time; //-0.5 * PI * 10.;
+ float minRez = min(resolution.x, resolution.y);
+ gl_PointSize = mix(minRez / 8000., pow(sz, 1.) * 120. * minRez / 1000., sin(st * .2) * .5 + .5);
+ gl_PointSize = max(gl_PointSize, 1.0);
+
+ float z = gl_Position.w / gl_Position.z * .5 + .5;
+ float hue = 1.1;// + mix(.4, .9, sin(st * .1) * .5 + .5);
+ float sat = 1.;
+ float val = 1. ;
+
+ v_color = vec4(hsv2rgb(vec3(hue, sat, val)), 1);
+}
+
+`
+ },
+ revisionId: "qRsQkY9R9zMTgAdsN",
+ revisionUrl: "https://www.vertexshaderart.com/art/JANswiNfyJnruo62E/revision/qRsQkY9R9zMTgAdsN",
+ artUrl: "https://www.vertexshaderart.com/art/undefined",
+ origUrl: "https://www.vertexshaderart.com/art/JRyewraYLfP9taa98"
+};
diff --git a/examples/js/index/effects/hexit2.js b/examples/js/index/effects/hexit2.js
new file mode 100644
index 0000000..abe9fef
--- /dev/null
+++ b/examples/js/index/effects/hexit2.js
@@ -0,0 +1,224 @@
+/* eslint-disable require-trailing-comma/require-trailing-comma */
+/* eslint-disable no-useless-escape */
+export default {
+ _id: "d7anES7ef6WrrDwsy",
+ createdAt: "2017-01-28T04:48:49.529Z",
+ modifiedAt: "2017-01-28T05:56:37.779Z",
+ origId: "yey7qrMtmhZZhq2K6",
+ name: "hexit2",
+ username: "gman",
+ avatarUrl: "https://secure.gravatar.com/avatar/dcc0309895c3d6db087631813efaa9d1?default=retro&size=200",
+ settings: {
+ num: 100000,
+ mode: "TRIANGLES",
+ sound: "https://soundcloud.com/beatsfar/grand-mas-mandoline",
+ lineSize: "NATIVE",
+ backgroundColor: [
+ 1,
+ 0,
+ 0,
+ 1
+ ],
+ shader: `
+#define PI radians(180.0)
+
+vec3 hsv2rgb(vec3 c) {
+ c = vec3(c.x, clamp(c.yz, 0.0, 1.0));
+ vec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);
+ vec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www);
+ return c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y);
+}
+
+mat4 rotY( float angle ) {
+ float s = sin( angle );
+ float c = cos( angle );
+
+ return mat4(
+ c, 0,-s, 0,
+ 0, 1, 0, 0,
+ s, 0, c, 0,
+ 0, 0, 0, 1);
+}
+
+
+mat4 rotZ( float angle ) {
+ float s = sin( angle );
+ float c = cos( angle );
+
+ return mat4(
+ c,-s, 0, 0,
+ s, c, 0, 0,
+ 0, 0, 1, 0,
+ 0, 0, 0, 1);
+}
+
+mat4 trans(vec3 trans) {
+ return mat4(
+ 1, 0, 0, 0,
+ 0, 1, 0, 0,
+ 0, 0, 1, 0,
+ trans, 1);
+}
+
+mat4 ident() {
+ return mat4(
+ 1, 0, 0, 0,
+ 0, 1, 0, 0,
+ 0, 0, 1, 0,
+ 0, 0, 0, 1);
+}
+
+mat4 scale(vec3 s) {
+ return mat4(
+ s[0], 0, 0, 0,
+ 0, s[1], 0, 0,
+ 0, 0, s[2], 0,
+ 0, 0, 0, 1);
+}
+
+mat4 uniformScale(float s) {
+ return mat4(
+ s, 0, 0, 0,
+ 0, s, 0, 0,
+ 0, 0, s, 0,
+ 0, 0, 0, 1);
+}
+
+// hash function from https://www.shadertoy.com/view/4djSRW
+float hash(float p) {
+ vec2 p2 = fract(vec2(p * 5.3983, p * 5.4427));
+ p2 += dot(p2.yx, p2.xy + vec2(21.5351, 14.3137));
+ return fract(p2.x * p2.y * 95.4337);
+}
+
+float m1p1(float v) {
+ return v * 2. - 1.;
+}
+
+float p1m1(float v) {
+ return v * 0.5 + 0.5;
+}
+
+float inv(float v) {
+ return 1. - v;
+}
+
+uniform float numSides;
+
+#define NUM_EDGE_POINTS_PER_CIRCLE numSides
+#define NUM_POINTS_PER_CIRCLE (NUM_EDGE_POINTS_PER_CIRCLE * 6.)
+#define NUM_CIRCLES_PER_GROUP 1.
+void getCirclePoint(const float id, const float inner, const float start, const float end, out vec3 pos) {
+ float outId = id - floor(id / 3.) * 2. - 1.; // 0 1 2 3 4 5 6 7 8 .. 0 1 2, 1 2 3, 2 3 4
+ float ux = floor(id / 6.) + mod(id, 2.);
+ float vy = mod(floor(id / 2.) + floor(id / 3.), 2.); // change that 3. for cool fx
+ float u = ux / NUM_EDGE_POINTS_PER_CIRCLE;
+ float v = mix(inner, 1., vy);
+ float a = mix(start, end, u) * PI * 2. + PI * 0.0;
+ float s = sin(a);
+ float c = cos(a);
+ float x = c * v;
+ float y = s * v;
+ float z = 0.;
+ pos = vec3(x, y, z);
+}
+
+float goop(float t) {
+ return sin(t) + sin(t * 0.27) + sin(t * 0.13) + sin(t * 0.73);
+}
+
+float easeInOutSine(float t) {
+ return (-0.5 * (cos(PI * t) - 1.));
+}
+
+float mixer(float t, float timeOff, float duration) {
+ t = mod(t, duration * 2.0);
+ t = t - timeOff;
+ if (t > duration) {
+ t = duration + 1. - t;
+ }
+ return easeInOutSine(clamp(t, 0., 1.));
+}
+
+uniform float s1;
+uniform float s2;
+uniform float s3;
+uniform float s4;
+
+void main() {
+ float circleId = floor(vertexId / NUM_POINTS_PER_CIRCLE);
+ float groupId = floor(circleId / NUM_CIRCLES_PER_GROUP);
+ float pointId = mod(vertexId, NUM_POINTS_PER_CIRCLE);
+ float sliceId = mod(floor(vertexId / 6.), 2.);
+ float side = mix(-1., 1., step(0.5, mod(circleId, 2.)));
+ float numCircles = floor(vertexCount / NUM_POINTS_PER_CIRCLE);
+ float numGroups = floor(numCircles / NUM_CIRCLES_PER_GROUP);
+ float cu = circleId / numCircles;
+ float gv = groupId / numGroups;
+ float cgId = mod(circleId, NUM_CIRCLES_PER_GROUP);
+ float cgv = cgId / NUM_CIRCLES_PER_GROUP;
+ float ncgv = 1. - cgv;
+
+
+ //snd = pow(snd, mix(2., 0.5, su));
+
+
+ vec3 pos;
+ float inner = 0.;//mix(0.0, 1. - pow(snd, 4.), cgId);
+ float start = 0.;//fract(hash(sideId * 0.33) + sin(time * 0.1 + sideId) * 1.1);
+ float end = 1.; //start + hash(sideId + 1.);
+ getCirclePoint(pointId, inner, start, end, pos);
+ pos.z = cgv;
+
+// float historyX = mix(0.01, 0.14, u);
+// snd = pow(snd, mix(2., 0.5, u));
+
+
+
+ // ----
+ float gDown = floor(sqrt(numGroups));
+ float gAcross = floor(numGroups / gDown);
+ float gx = mod(groupId, gAcross);
+ float gy = floor(groupId / gAcross);
+ vec3 offset = vec3(
+ gx - (gAcross - 1.) / 2. + mod(gy, 2.) * 0.5,
+ gy - (gDown - 1.) / 2.,
+ 0) * 0.17;
+
+ float tm = time - cgv * 0.2;
+ float su = hash(groupId);
+ float snd = texture2D(sound, vec2(mix(0.001, 0.015, su), length(offset) * 0.125)).a;
+
+
+
+// vec3 offset = vec3(hash(groupId) * 0.8, m1p1(hash(groupId * 0.37)), cgv);
+// offset.x += m1p1(pow(snd, 5.0) + goop(groupId + time * 0.) * 0.1);
+// offset.y += goop(groupId + time * 0.) * 0.1;
+ vec3 aspect = vec3(1, resolution.x / resolution.y, 1);
+
+ mat4 mat = ident();
+ mat *= scale(aspect * (0.2 / 3.0) * numSides);
+ mat *= trans(vec3(0.25,0,0));
+ mat *= rotZ(-time * 0. + snd * .0);
+ mat *= trans(offset);
+ float sp = pow(snd, 5.0);
+
+ mat *= rotZ(time * 0.01 + sin(gx * s1 * 0.1) + cos(gy * s2 * 0.1));
+ mat *= uniformScale(0.1 * pow(snd, 0.));// + -sin((time + 0.5) * 6.) * 0.01);
+ //mat *= uniformScale(mix(sp, 1. - sp, cgId) * 0.1 + sliceId * 0.0);
+ gl_Position = vec4((mat * vec4(pos, 1)).xyz, 1);
+ gl_PointSize = 4.;
+
+ float hue = tm * 0.05 + fract(snd * 2.5) * 0.2 + 0.3 + mix(0., .02, length(offset));
+ float sat = pow(snd, 5.);
+ float val = mix(hash(groupId), 1.0, step(0.98, snd));//ncgv;//1.;//mix(0.0, 0.0, fract(circleId * 0.79)) + sliceId * .65;
+ v_color = vec4(hsv2rgb(vec3(hue, sat, val)), 1);
+ v_color.rgb *= v_color.a;
+}
+`
+ },
+ revisionId: "yey7qrMtmhZZhq2K6",
+ revisionUrl: "https://www.vertexshaderart.com/art/yey7qrMtmhZZhq2K6/revision/yey7qrMtmhZZhq2K6",
+ artUrl: "https://www.vertexshaderart.com/art/yey7qrMtmhZZhq2K6",
+ origUrl: "https://www.vertexshaderart.com/art/yey7qrMtmhZZhq2K6"
+};
diff --git a/examples/js/index/effects/loop-test.js b/examples/js/index/effects/loop-test.js
new file mode 100644
index 0000000..14f5b7d
--- /dev/null
+++ b/examples/js/index/effects/loop-test.js
@@ -0,0 +1,323 @@
+/* eslint-disable require-trailing-comma/require-trailing-comma */
+/* eslint-disable no-useless-escape */
+export default {
+ _id: "ZFSiQpx33DLDg9hmd",
+ createdAt: "2018-06-06T08:31:10.941Z",
+ modifiedAt: "2018-06-06T08:31:10.941Z",
+ origId: null,
+ name: "loop-test",
+ username: "gman",
+ avatarUrl: "https://secure.gravatar.com/avatar/dcc0309895c3d6db087631813efaa9d1?default=retro&size=200",
+ settings: {
+ num: 100000,
+ mode: "TRIANGLES",
+ sound: "https://soundcloud.com/greggman/testing-1-2-3",
+ lineSize: "NATIVE",
+ backgroundColor: [
+ 1,
+ 1,
+ 1,
+ 1
+ ],
+ shader: `/*
+
+VertexShaderArt Boilerplate Library
+
+*/
+
+
+
+
+#define PI radians(180.)
+
+vec3 hsv2rgb(vec3 c) {
+ c = vec3(c.x, clamp(c.yz, 0.0, 1.0));
+ vec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);
+ vec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www);
+ return c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y);
+}
+
+mat4 rotX(float angleInRadians) {
+ float s = sin(angleInRadians);
+ float c = cos(angleInRadians);
+
+ return mat4(
+ 1, 0, 0, 0,
+ 0, c, s, 0,
+ 0, -s, c, 0,
+ 0, 0, 0, 1);
+}
+
+mat4 rotY(float angleInRadians) {
+ float s = sin(angleInRadians);
+ float c = cos(angleInRadians);
+
+ return mat4(
+ c, 0,-s, 0,
+ 0, 1, 0, 0,
+ s, 0, c, 0,
+ 0, 0, 0, 1);
+}
+
+mat4 rotZ(float angleInRadians) {
+ float s = sin(angleInRadians);
+ float c = cos(angleInRadians);
+
+ return mat4(
+ c,-s, 0, 0,
+ s, c, 0, 0,
+ 0, 0, 1, 0,
+ 0, 0, 0, 1);
+}
+
+mat4 trans(vec3 trans) {
+ return mat4(
+ 1, 0, 0, 0,
+ 0, 1, 0, 0,
+ 0, 0, 1, 0,
+ trans, 1);
+}
+
+mat4 ident() {
+ return mat4(
+ 1, 0, 0, 0,
+ 0, 1, 0, 0,
+ 0, 0, 1, 0,
+ 0, 0, 0, 1);
+}
+
+mat4 scale(vec3 s) {
+ return mat4(
+ s[0], 0, 0, 0,
+ 0, s[1], 0, 0,
+ 0, 0, s[2], 0,
+ 0, 0, 0, 1);
+}
+
+mat4 uniformScale(float s) {
+ return mat4(
+ s, 0, 0, 0,
+ 0, s, 0, 0,
+ 0, 0, s, 0,
+ 0, 0, 0, 1);
+}
+
+mat4 persp(float fov, float aspect, float zNear, float zFar) {
+ float f = tan(PI * 0.5 - 0.5 * fov);
+ float rangeInv = 1.0 / (zNear - zFar);
+
+ return mat4(
+ f / aspect, 0, 0, 0,
+ 0, f, 0, 0,
+ 0, 0, (zNear + zFar) * rangeInv, -1,
+ 0, 0, zNear * zFar * rangeInv * 2., 0);
+}
+
+mat4 trInv(mat4 m) {
+ mat3 i = mat3(
+ m[0][0], m[1][0], m[2][0],
+ m[0][1], m[1][1], m[2][1],
+ m[0][2], m[1][2], m[2][2]);
+ vec3 t = -i * m[3].xyz;
+
+ return mat4(
+ i[0], t[0],
+ i[1], t[1],
+ i[2], t[2],
+ 0, 0, 0, 1);
+}
+
+mat4 transpose(mat4 m) {
+ return mat4(
+ m[0][0], m[1][0], m[2][0], m[3][0],
+ m[0][1], m[1][1], m[2][1], m[3][1],
+ m[0][2], m[1][2], m[2][2], m[3][2],
+ m[0][3], m[1][3], m[2][3], m[3][3]);
+}
+
+mat4 lookAt(vec3 eye, vec3 target, vec3 up) {
+ vec3 zAxis = normalize(eye - target);
+ vec3 xAxis = normalize(cross(up, zAxis));
+ vec3 yAxis = cross(zAxis, xAxis);
+
+ return mat4(
+ xAxis, 0,
+ yAxis, 0,
+ zAxis, 0,
+ eye, 1);
+}
+
+mat4 inverse(mat4 m) {
+ float
+ a00 = m[0][0], a01 = m[0][1], a02 = m[0][2], a03 = m[0][3],
+ a10 = m[1][0], a11 = m[1][1], a12 = m[1][2], a13 = m[1][3],
+ a20 = m[2][0], a21 = m[2][1], a22 = m[2][2], a23 = m[2][3],
+ a30 = m[3][0], a31 = m[3][1], a32 = m[3][2], a33 = m[3][3],
+
+ b00 = a00 * a11 - a01 * a10,
+ b01 = a00 * a12 - a02 * a10,
+ b02 = a00 * a13 - a03 * a10,
+ b03 = a01 * a12 - a02 * a11,
+ b04 = a01 * a13 - a03 * a11,
+ b05 = a02 * a13 - a03 * a12,
+ b06 = a20 * a31 - a21 * a30,
+ b07 = a20 * a32 - a22 * a30,
+ b08 = a20 * a33 - a23 * a30,
+ b09 = a21 * a32 - a22 * a31,
+ b10 = a21 * a33 - a23 * a31,
+ b11 = a22 * a33 - a23 * a32,
+
+ det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;
+
+ return mat4(
+ a11 * b11 - a12 * b10 + a13 * b09,
+ a02 * b10 - a01 * b11 - a03 * b09,
+ a31 * b05 - a32 * b04 + a33 * b03,
+ a22 * b04 - a21 * b05 - a23 * b03,
+ a12 * b08 - a10 * b11 - a13 * b07,
+ a00 * b11 - a02 * b08 + a03 * b07,
+ a32 * b02 - a30 * b05 - a33 * b01,
+ a20 * b05 - a22 * b02 + a23 * b01,
+ a10 * b10 - a11 * b08 + a13 * b06,
+ a01 * b08 - a00 * b10 - a03 * b06,
+ a30 * b04 - a31 * b02 + a33 * b00,
+ a21 * b02 - a20 * b04 - a23 * b00,
+ a11 * b07 - a10 * b09 - a12 * b06,
+ a00 * b09 - a01 * b07 + a02 * b06,
+ a31 * b01 - a30 * b03 - a32 * b00,
+ a20 * b03 - a21 * b01 + a22 * b00) / det;
+}
+
+mat4 cameraLookAt(vec3 eye, vec3 target, vec3 up) {
+ #if 1
+ return inverse(lookAt(eye, target, up));
+ #else
+ vec3 zAxis = normalize(target - eye);
+ vec3 xAxis = normalize(cross(up, zAxis));
+ vec3 yAxis = cross(zAxis, xAxis);
+
+ return mat4(
+ xAxis, 0,
+ yAxis, 0,
+ zAxis, 0,
+ -dot(xAxis, eye), -dot(yAxis, eye), -dot(zAxis, eye), 1);
+ #endif
+
+}
+
+
+
+// hash function from https://www.shadertoy.com/view/4djSRW
+float hash(float p) {
+ vec2 p2 = fract(vec2(p * 5.3983, p * 5.4427));
+ p2 += dot(p2.yx, p2.xy + vec2(21.5351, 14.3137));
+ return fract(p2.x * p2.y * 95.4337);
+}
+
+// times 2 minus 1
+float t2m1(float v) {
+ return v * 2. - 1.;
+}
+
+// times .5 plus .5
+float t5p5(float v) {
+ return v * 0.5 + 0.5;
+}
+
+float inv(float v) {
+ return 1. - v;
+}
+
+void getCirclePoint(const float numEdgePointsPerCircle, const float id, const float inner, const float start, const float end, out vec3 pos) {
+ float outId = id - floor(id / 3.) * 2. - 1.; // 0 1 2 3 4 5 6 7 8 .. 0 1 2, 1 2 3, 2 3 4
+ float ux = floor(id / 6.) + mod(id, 2.);
+ float vy = mod(floor(id / 2.) + floor(id / 3.), 2.); // change that 3. for cool fx
+ float u = ux / numEdgePointsPerCircle;
+ float v = mix(inner, 1., vy);
+ float a = mix(start, end, u) * PI * 2. + PI * 0.0;
+ float s = sin(a);
+ float c = cos(a);
+ float x = c * v;
+ float y = s * v;
+ float z = 0.;
+ pos = vec3(x, y, z);
+}
+
+
+#define CUBE_POINTS_PER_FACE 6.
+#define FACES_PER_CUBE 6.
+#define POINTS_PER_CUBE (CUBE_POINTS_PER_FACE * FACES_PER_CUBE)
+void getCubePoint(const float id, out vec3 position, out vec3 normal) {
+ float quadId = floor(mod(id, POINTS_PER_CUBE) / CUBE_POINTS_PER_FACE);
+ float sideId = mod(quadId, 3.);
+ float flip = mix(1., -1., step(2.5, quadId));
+ // 0 1 2 1 2 3
+ float facePointId = mod(id, CUBE_POINTS_PER_FACE);
+ float pointId = mod(facePointId - floor(facePointId / 3.0), 6.0);
+ float a = pointId * PI * 2. / 4. + PI * 0.25;
+ vec3 p = vec3(cos(a), 0.707106781, sin(a)) * flip;
+ vec3 n = vec3(0, 1, 0) * flip;
+ float lr = mod(sideId, 2.);
+ float ud = step(2., sideId);
+ mat4 mat = rotX(lr * PI * 0.5);
+ mat *= rotZ(ud * PI * 0.5);
+ position = (mat * vec4(p, 1)).xyz;
+ normal = (mat * vec4(n, 0)).xyz;
+}
+
+#if 1
+void main() {
+ float pointId = vertexId;
+
+ vec3 pos;
+ vec3 normal;
+ getCubePoint(pointId, pos, normal);
+ float cubeId = floor(pointId / 36.);
+ float numCubes = floor(vertexCount / 36.);
+ float down = floor(sqrt(numCubes));
+ float across = floor(numCubes / down);
+
+ float cx = mod(cubeId, across);
+ float cy = floor(cubeId / across);
+
+ float cu = cx / (across - 1.);
+ float cv = cy / (down - 1.);
+
+ float ca = cu * 2. - 1.;
+ float cd = cv * 2. - 1.;
+
+ float tm = time * 0.1;
+ mat4 mat = persp(radians(60.0), resolution.x / resolution.y, 0.1, 1000.0);
+ vec3 eye = vec3(cos(tm) * 1., sin(tm * 0.9) * .1 + 0.5, sin(tm) * 1.);
+ vec3 target = vec3(-eye.x, -1, -eye.z) * 5.5;
+ vec3 up = vec3(0,1,0);
+
+ mat *= cameraLookAt(eye, target, up);
+ mat *= trans(vec3(ca, 0, cd) * 2.);
+ mat *= rotX(time + abs(ca) * 5.);
+ mat *= rotZ(time + abs(cd) * 6.);
+ mat *= uniformScale(0.03);
+
+
+ gl_Position = mat * vec4(pos, 1);
+ vec3 n = normalize((mat * vec4(normal, 0)).xyz);
+
+ vec3 lightDir = normalize(vec3(0.3, 0.4, -1));
+
+ float snd = texture2D(sound, vec2(mix(0.1, 0.5, abs(atan(ca, cd)) / PI), length(vec2(ca,cd))) * .5).a;
+
+ float hue = abs(ca * cd) * 2.;
+ float sat = pow(snd, 5.);
+ float val = mix(1., 0.5, abs(cd));
+ vec3 color = hsv2rgb(vec3(hue, sat, val));
+ v_color = vec4(color * (dot(n, lightDir) * 0.5 + 0.5), pow(snd, 2.));
+ v_color.rgb *= v_color.a;
+}
+#endif
+
+`
+ },
+ revisionId: "2a6NsC49zwe5Z6NZ6",
+ revisionUrl: "https://www.vertexshaderart.com/art/ZFSiQpx33DLDg9hmd/revision/2a6NsC49zwe5Z6NZ6",
+ artUrl: "https://www.vertexshaderart.com/art/undefined"
+};
diff --git a/examples/js/index/effects/pookymelon.js b/examples/js/index/effects/pookymelon.js
new file mode 100644
index 0000000..597e610
--- /dev/null
+++ b/examples/js/index/effects/pookymelon.js
@@ -0,0 +1,388 @@
+/* eslint-disable require-trailing-comma/require-trailing-comma */
+/* eslint-disable no-useless-escape */
+export default {
+ _id: "A8Zc7NFQdTdeKQimv",
+ createdAt: "2017-09-30T17:14:27.900Z",
+ modifiedAt: "2017-09-30T17:14:27.900Z",
+ origId: "7TrYkuK4aHzLqvZ7r",
+ name: "pookymelon",
+ username: "gman",
+ avatarUrl: "https://secure.gravatar.com/avatar/dcc0309895c3d6db087631813efaa9d1?default=retro&size=200",
+ settings: {
+ num: 97200,
+ mode: "TRIANGLES",
+ sound: "https://soundcloud.com/mixmag-1/premiere-michael-klein-pan-pot-haze-effect",
+ lineSize: "NATIVE",
+ backgroundColor: [
+ 0,
+ 0,
+ 0,
+ 1
+ ],
+ shader: `/*
+
+┬ ┬┌─┐┬─┐┌┬┐┌─┐─┐ ┬┌─┐┬ ┬┌─┐┌┬┐┌─┐┬─┐┌─┐┬─┐┌┬┐
+└┐┌┘├┤ ├┬┘ │ ├┤ ┌┴┬┘└─┐├─┤├─┤ ││├┤ ├┬┘├─┤├┬┘ │
+ └┘ └─┘┴└─ ┴ └─┘┴ └─└─┘┴ ┴┴ ┴─┴┘└─┘┴└─┴ ┴┴└─ ┴
+
+*/
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+#define PI radians(180.0)
+
+vec3 hsv2rgb(vec3 c) {
+ c = vec3(c.x, clamp(c.yz, 0.0, 1.0));
+ vec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);
+ vec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www);
+ return c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y);
+}
+
+mat4 rotX(float angleInRadians) {
+ float s = sin(angleInRadians);
+ float c = cos(angleInRadians);
+
+ return mat4(
+ 1, 0, 0, 0,
+ 0, c, s, 0,
+ 0, -s, c, 0,
+ 0, 0, 0, 1);
+}
+
+mat4 rotY(float angleInRadians) {
+ float s = sin(angleInRadians);
+ float c = cos(angleInRadians);
+
+ return mat4(
+ c, 0,-s, 0,
+ 0, 1, 0, 0,
+ s, 0, c, 0,
+ 0, 0, 0, 1);
+}
+
+mat4 rotZ(float angleInRadians) {
+ float s = sin(angleInRadians);
+ float c = cos(angleInRadians);
+
+ return mat4(
+ c,-s, 0, 0,
+ s, c, 0, 0,
+ 0, 0, 1, 0,
+ 0, 0, 0, 1);
+}
+
+mat4 trans(vec3 trans) {
+ return mat4(
+ 1, 0, 0, 0,
+ 0, 1, 0, 0,
+ 0, 0, 1, 0,
+ trans, 1);
+}
+
+mat4 ident() {
+ return mat4(
+ 1, 0, 0, 0,
+ 0, 1, 0, 0,
+ 0, 0, 1, 0,
+ 0, 0, 0, 1);
+}
+
+mat4 scale(vec3 s) {
+ return mat4(
+ s[0], 0, 0, 0,
+ 0, s[1], 0, 0,
+ 0, 0, s[2], 0,
+ 0, 0, 0, 1);
+}
+
+mat4 uniformScale(float s) {
+ return mat4(
+ s, 0, 0, 0,
+ 0, s, 0, 0,
+ 0, 0, s, 0,
+ 0, 0, 0, 1);
+}
+
+mat4 persp(float fov, float aspect, float zNear, float zFar) {
+ float f = tan(PI * 0.5 - 0.5 * fov);
+ float rangeInv = 1.0 / (zNear - zFar);
+
+ return mat4(
+ f / aspect, 0, 0, 0,
+ 0, f, 0, 0,
+ 0, 0, (zNear + zFar) * rangeInv, -1,
+ 0, 0, zNear * zFar * rangeInv * 2., 0);
+}
+
+mat4 trInv(mat4 m) {
+ mat3 i = mat3(
+ m[0][0], m[1][0], m[2][0],
+ m[0][1], m[1][1], m[2][1],
+ m[0][2], m[1][2], m[2][2]);
+ vec3 t = -i * m[3].xyz;
+
+ return mat4(
+ i[0], t[0],
+ i[1], t[1],
+ i[2], t[2],
+ 0, 0, 0, 1);
+}
+
+mat4 transpose(mat4 m) {
+ return mat4(
+ m[0][0], m[1][0], m[2][0], m[3][0],
+ m[0][1], m[1][1], m[2][1], m[3][1],
+ m[0][2], m[1][2], m[2][2], m[3][2],
+ m[0][3], m[1][3], m[2][3], m[3][3]);
+}
+
+mat4 lookAt(vec3 eye, vec3 target, vec3 up) {
+ vec3 zAxis = normalize(eye - target);
+ vec3 xAxis = normalize(cross(up, zAxis));
+ vec3 yAxis = cross(zAxis, xAxis);
+
+ return mat4(
+ xAxis, 0,
+ yAxis, 0,
+ zAxis, 0,
+ eye, 1);
+}
+
+mat4 inverse(mat4 m) {
+ float
+ a00 = m[0][0], a01 = m[0][1], a02 = m[0][2], a03 = m[0][3],
+ a10 = m[1][0], a11 = m[1][1], a12 = m[1][2], a13 = m[1][3],
+ a20 = m[2][0], a21 = m[2][1], a22 = m[2][2], a23 = m[2][3],
+ a30 = m[3][0], a31 = m[3][1], a32 = m[3][2], a33 = m[3][3],
+
+ b00 = a00 * a11 - a01 * a10,
+ b01 = a00 * a12 - a02 * a10,
+ b02 = a00 * a13 - a03 * a10,
+ b03 = a01 * a12 - a02 * a11,
+ b04 = a01 * a13 - a03 * a11,
+ b05 = a02 * a13 - a03 * a12,
+ b06 = a20 * a31 - a21 * a30,
+ b07 = a20 * a32 - a22 * a30,
+ b08 = a20 * a33 - a23 * a30,
+ b09 = a21 * a32 - a22 * a31,
+ b10 = a21 * a33 - a23 * a31,
+ b11 = a22 * a33 - a23 * a32,
+
+ det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;
+
+ return mat4(
+ a11 * b11 - a12 * b10 + a13 * b09,
+ a02 * b10 - a01 * b11 - a03 * b09,
+ a31 * b05 - a32 * b04 + a33 * b03,
+ a22 * b04 - a21 * b05 - a23 * b03,
+ a12 * b08 - a10 * b11 - a13 * b07,
+ a00 * b11 - a02 * b08 + a03 * b07,
+ a32 * b02 - a30 * b05 - a33 * b01,
+ a20 * b05 - a22 * b02 + a23 * b01,
+ a10 * b10 - a11 * b08 + a13 * b06,
+ a01 * b08 - a00 * b10 - a03 * b06,
+ a30 * b04 - a31 * b02 + a33 * b00,
+ a21 * b02 - a20 * b04 - a23 * b00,
+ a11 * b07 - a10 * b09 - a12 * b06,
+ a00 * b09 - a01 * b07 + a02 * b06,
+ a31 * b01 - a30 * b03 - a32 * b00,
+ a20 * b03 - a21 * b01 + a22 * b00) / det;
+}
+
+mat4 cameraLookAt(vec3 eye, vec3 target, vec3 up) {
+ #if 1
+ return inverse(lookAt(eye, target, up));
+ #else
+ vec3 zAxis = normalize(target - eye);
+ vec3 xAxis = normalize(cross(up, zAxis));
+ vec3 yAxis = cross(zAxis, xAxis);
+
+ return mat4(
+ xAxis, 0,
+ yAxis, 0,
+ zAxis, 0,
+ -dot(xAxis, eye), -dot(yAxis, eye), -dot(zAxis, eye), 1);
+ #endif
+
+}
+
+
+
+// hash function from https://www.shadertoy.com/view/4djSRW
+float hash(float p) {
+ vec2 p2 = fract(vec2(p * 5.3983, p * 5.4427));
+ p2 += dot(p2.yx, p2.xy + vec2(21.5351, 14.3137));
+ return fract(p2.x * p2.y * 95.4337);
+}
+
+// times 2 minus 1
+float t2m1(float v) {
+ return v * 2. - 1.;
+}
+
+// times .5 plus .5
+float t5p5(float v) {
+ return v * 0.5 + 0.5;
+}
+
+float inv(float v) {
+ return 1. - v;
+}
+
+
+#define NUM_EDGE_POINTS_PER_CIRCLE 100.
+#define NUM_POINTS_PER_DIVISION (NUM_EDGE_POINTS_PER_CIRCLE * 6.)
+#define NUM_POINTS_PER_CIRCLE (NUM_SUBDIVISIONS_PER_CIRCLE * NUM_POINTS_PER_DIVISION)
+void getCirclePoint(const float id, const float inner, const float start, const float end, out vec3 pos, out vec4 uvf, out float snd) {
+ float NUM_SUBDIVISIONS_PER_CIRCLE = floor(vertexCount / NUM_POINTS_PER_DIVISION);
+ float edgeId = mod(id, NUM_POINTS_PER_DIVISION);
+ float ux = floor(edgeId / 6.) + mod(edgeId, 2.);
+ float vy = mod(floor(id / 2.) + floor(id / 3.), 2.); // change that 3. for cool fx
+ float sub = floor(id / NUM_POINTS_PER_DIVISION);
+ float subV = sub / (NUM_SUBDIVISIONS_PER_CIRCLE - 1.);
+ float level = subV + vy / (NUM_SUBDIVISIONS_PER_CIRCLE - 1.);
+ float u = ux / NUM_EDGE_POINTS_PER_CIRCLE;
+ float v = 1.;//mix(inner, 1., level);
+ float ringId = sub + vy;
+ float ringV = ringId / NUM_SUBDIVISIONS_PER_CIRCLE;
+ float numRings = vertexCount / NUM_SUBDIVISIONS_PER_CIRCLE;
+ float a = mix(start, end, u) * PI * 2. + PI * 0.0;
+ float skew = 1. - step(0.5, mod(ringId - 2., 3.));
+ float su = fract(abs(u * 2. - 1.) + time * 0.1);
+
+ a += 1. / NUM_EDGE_POINTS_PER_CIRCLE * PI * 2.;// * 20. * sin(time * 1.) + snd * 1.5;
+ float s = sin(a);
+ float c = cos(a);
+ float z = mix(inner, 2., level) - vy / NUM_SUBDIVISIONS_PER_CIRCLE * 0.;
+ float x = c * v * z;
+ float y = s * v * z;
+ pos = vec3(x, y, 0.);
+ uvf = vec4(floor(edgeId / 6.) / NUM_EDGE_POINTS_PER_CIRCLE, subV, floor(id / 6.), sub);
+}
+
+float goop(float t) {
+ return sin(t) + sin(t * 0.27) + sin(t * 0.13) + sin(t * 0.73);
+}
+
+float modStep(float count, float steps) {
+ return mod(count, steps) / steps;
+}
+
+
+void main() {
+ float numQuads = floor(vertexCount / 6.);
+ float around = 180.;
+ float down = numQuads / around;
+ float quadId = floor(vertexId / 6.);
+
+ float qx = mod(quadId, around);
+ float qy = floor(quadId / around);
+
+ // 0--1 3
+ // | / /|
+ // |/ / |
+ // 2 4--5
+ //
+ // 0 1 0 1 0 1
+ // 0 0 1 0 1 1
+
+ float edgeId = mod(vertexId, 6.);
+ float ux = mod(edgeId, 2.);
+ float vy = mod(floor(edgeId / 2.) + floor(edgeId / 3.), 2.);
+
+ float qu = (qx + ux) / around;
+ float qv = (qy + vy) / down;
+
+ float r = sin(qv * PI);
+ float x = cos(qu * PI * 2.) * r;
+ float z = sin(qu * PI * 2.) * r;
+
+ vec3 pos = vec3(x, cos(qv * PI), z);
+ vec3 nrm = vec3(
+ cos((qx + .5) / around * PI * 2.),
+ cos((qy + .5) / down * PI),
+ sin((qx + .5) / around * PI * 2.)
+ );
+
+ float tm = time * 1.1;
+ float rd = mix(2., 3.5, t5p5(sin(time * 0.11)));
+ mat4 mat = persp(PI * 0.25, resolution.x / resolution.y, 0.1, 100.);
+ vec3 eye = vec3(cos(tm) * rd, sin(tm * 0.9) * .0 + 0., sin(tm) * rd);
+ vec3 target = vec3(0);
+ vec3 up = vec3(0,sin(tm),cos(tm));
+
+ float s = texture2D(sound, vec2(mix(0.1, .25, abs(qu * 2. - 1.)), mix(0., .12, qv))).a;
+
+ mat *= cameraLookAt(eye, target, up);
+ mat *= uniformScale(mix(0.5, 2.5, pow(s + .15, 5.)));
+
+ gl_Position = mat * vec4(pos, 1);
+ gl_PointSize = 4.;
+
+ float odd = mod(floor(quadId / 2.), 2.);
+ float hue = time * .1 +s * .15;
+ float sat = mix(0., 3., pow(s, 5.));
+ float val = mix(0.1, 1., pow(s + .4, 15.));
+ v_color = vec4(hsv2rgb(vec3(hue, sat, val)), 1.);
+
+
+ v_color.rgb *= v_color.a;
+
+
+
+}`
+ },
+ revisionId: "8TbPNzy7gAKpNs7Hj",
+ revisionUrl: "https://www.vertexshaderart.com/art/A8Zc7NFQdTdeKQimv/revision/8TbPNzy7gAKpNs7Hj",
+ artUrl: "https://www.vertexshaderart.com/art/undefined",
+ origUrl: "https://www.vertexshaderart.com/art/7TrYkuK4aHzLqvZ7r"
+};
diff --git a/examples/js/index/effects/rollin.js b/examples/js/index/effects/rollin.js
new file mode 100644
index 0000000..576cbed
--- /dev/null
+++ b/examples/js/index/effects/rollin.js
@@ -0,0 +1,629 @@
+/* eslint-disable require-trailing-comma/require-trailing-comma */
+/* eslint-disable no-useless-escape */
+export default {
+ _id: "FPFBuCexgLQpriEoS",
+ createdAt: "2016-01-17T01:42:37.484Z",
+ modifiedAt: "2016-01-23T14:53:24.281Z",
+ origId: "bbsF39W6bJo3j4R3j",
+ name: "rollin",
+ username: "gman",
+ avatarUrl: "https://secure.gravatar.com/avatar/dcc0309895c3d6db087631813efaa9d1?default=retro&size=200",
+ settings: {
+ num: 100000,
+ mode: "TRIANGLES",
+ sound: "https://soundcloud.com/chill/ed-sheeran-i-see-fire-kalev-remix",
+ lineSize: "NATIVE",
+ backgroundColor: [
+ 1,
+ 1,
+ 1,
+ 1
+ ],
+ shader: `/*
+
+ ___ ___ _______ ________ _________ _______ ___ ___
+|\ \ / /|\ ___ \ |\ __ \|\___ ___|\ ___ \ |\ \ / /|
+\ \ \ / / \ \ __/|\ \ \|\ \|___ \ \_\ \ __/| \ \ \/ / /
+ \ \ \/ / / \ \ \_|/_\ \ _ _\ \ \ \ \ \ \_|/__ \ \ / /
+ \ \ / / \ \ \_|\ \ \ \\ \| \ \ \ \ \ \_|\ \ / \/
+ \ \__/ / \ \_______\ \__\\ _\ \ \__\ \ \_______\/ /\ \
+ \|__|/ \|_______|\|__|\|__| \|__| \|_______/__/ /\ __\
+ |__|/ \|__|
+
+
+ ________ ___ ___ ________ ________ _______ ________
+|\ ____\|\ \|\ \|\ __ \|\ ___ \|\ ___ \ |\ __ \
+\ \ \___|\ \ \\\ \ \ \|\ \ \ \_|\ \ \ __/|\ \ \|\ \
+ \ \_____ \ \ __ \ \ __ \ \ \ \\ \ \ \_|/_\ \ _ _\
+ \|____|\ \ \ \ \ \ \ \ \ \ \ \_\\ \ \ \_|\ \ \ \\ \|
+ ____\_\ \ \__\ \__\ \__\ \__\ \_______\ \_______\ \__\\ _\
+ |\_________\|__|\|__|\|__|\|__|\|_______|\|_______|\|__|\|__|
+ \|_________|
+
+
+ ________ ________ _________
+|\ __ \|\ __ \|\___ ___\
+\ \ \|\ \ \ \|\ \|___ \ \_|
+ \ \ __ \ \ _ _\ \ \ \
+ \ \ \ \ \ \ \\ \| \ \ \
+ \ \__\ \__\ \__\\ _\ \ \__\
+ \|__|\|__|\|__|\|__| \|__|
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+*/
+
+vec3 gSunColor = vec3(1.0, 1.2, 1.4) * 10.1;
+
+vec3 gSkyTop = vec3( 0.1, 0.2, 0.8 ) * 0.5;
+vec3 gSkyBottom = vec3( 0.5, 0.8, 1.0 ) * 1.5;
+
+vec3 gCubeColor = vec3(1.0, 1.0, 1.0);
+float gExposure = 0.3;
+
+float gCubeColorRandom = 0.0;
+
+#define MOVE_OUTWARDS
+
+float fAOAmount = 0.8;
+float gFloorHeight = -1.0;
+float g_cameraFar = 1000.0;
+
+#define PI radians( 180.0 )
+
+
+vec3 GetSunDir()
+{
+ return normalize( vec3( 20.0, 40.3, -10.4 ) );
+}
+
+struct SceneVertex
+{
+ vec3 vWorldPos;
+ vec3 vColor;
+ float fAlpha;
+};
+
+
+float GetCosSunRadius()
+{
+ return 0.01;
+}
+
+
+float GetSunIntensity()
+{
+ return 0.001;
+}
+
+
+vec3 GetSkyColor( vec3 vViewDir )
+{
+ return mix( gSkyBottom, gSkyTop, max( 0.0, vViewDir.y ) );
+}
+const float g_cubeFaces = 6.0;
+const float g_cubeVerticesPerFace = ( 2.0 * 3.0 );
+const float g_cubeVertexCount = ( g_cubeVerticesPerFace * g_cubeFaces );
+
+// 6 7
+// +----------+
+// /| /|
+// 2 / | 3/ |
+// +----------+ |
+// | | | |
+// Y Z | 4| | 5|
+// | +-------|--+
+// ^ / | / | /
+// |/ 0|/ 1|/
+// +--> X +----------+
+
+vec3 GetCubeVertex( float fVertexIndex )
+{
+ float f = fVertexIndex / 8.0;
+ return vec3(
+ mix(-1., 1., step(0.5, fract(f * 4.))),
+ mix(-1., 1., step(0.5, fract(f * 2.))),
+ mix(-1., 1., step(0.5, fract(f))));
+}
+
+
+void GetCubeVertex( const float vertexIndex, const mat4 mat, out vec3 vWorldPos, out vec3 vWorldNormal )
+{
+ float fFaceIndex = floor( vertexIndex / g_cubeFaces );
+
+ vec3 v0, v1, v2, v3;
+
+ if ( fFaceIndex < 0.5 )
+ {
+ v0 = GetCubeVertex( 0.0 );
+ v1 = GetCubeVertex( 2.0 );
+ v2 = GetCubeVertex( 3.0 );
+ v3 = GetCubeVertex( 1.0 );
+ }
+ else if ( fFaceIndex < 1.5 )
+ {
+ v0 = GetCubeVertex( 5.0 );
+ v1 = GetCubeVertex( 7.0 );
+ v2 = GetCubeVertex( 6.0 );
+ v3 = GetCubeVertex( 4.0 );
+ }
+ else if ( fFaceIndex < 2.5 )
+ {
+ v0 = GetCubeVertex( 1.0 );
+ v1 = GetCubeVertex( 3.0 );
+ v2 = GetCubeVertex( 7.0 );
+ v3 = GetCubeVertex( 5.0 );
+ }
+ else if ( fFaceIndex < 3.5 )
+ {
+ v0 = GetCubeVertex( 4.0 );
+ v1 = GetCubeVertex( 6.0 );
+ v2 = GetCubeVertex( 2.0 );
+ v3 = GetCubeVertex( 0.0 );
+ }
+ else if ( fFaceIndex < 4.5 )
+ {
+ v0 = GetCubeVertex( 2.0 );
+ v1 = GetCubeVertex( 6.0 );
+ v2 = GetCubeVertex( 7.0 );
+ v3 = GetCubeVertex( 3.0 );
+ }
+ else
+ {
+ v0 = GetCubeVertex( 1.0 );
+ v1 = GetCubeVertex( 5.0 );
+ v2 = GetCubeVertex( 4.0 );
+ v3 = GetCubeVertex( 0.0 );
+ }
+ v0 = (mat * vec4(v0, 1)).xyz;
+ v1 = (mat * vec4(v1, 1)).xyz;
+ v2 = (mat * vec4(v2, 1)).xyz;
+ v3 = (mat * vec4(v3, 1)).xyz;
+
+ float fFaceVertexIndex = mod( vertexIndex, 6.0 );
+
+ if ( fFaceVertexIndex < 0.5 )
+ {
+ vWorldPos = v0;
+ }
+ else if ( fFaceVertexIndex < 1.5 )
+ {
+ vWorldPos = v1;
+ }
+ else if ( fFaceVertexIndex < 2.5 )
+ {
+ vWorldPos = v2;
+ }
+ else if ( fFaceVertexIndex < 3.5 )
+ {
+ vWorldPos = v0;
+ }
+ else if ( fFaceVertexIndex < 4.5 )
+ {
+ vWorldPos = v2;
+ }
+ else
+ {
+ vWorldPos = v3;
+ }
+
+ vWorldNormal = normalize( cross( v1 - v0, v2 - v0 ) );
+}
+
+
+vec3 GetSunLighting( const vec3 vNormal )
+{
+ vec3 vLight = -GetSunDir();
+
+ float NdotL = max( 0.0, dot( vNormal, -vLight ) );
+
+ return gSunColor * NdotL;
+}
+
+
+vec3 GetSunSpec( const vec3 vPos, const vec3 vNormal, const vec3 vCameraPos )
+{
+ vec3 vLight = -GetSunDir();
+
+ vec3 vView = normalize( vCameraPos - vPos );
+
+ vec3 vH = normalize( vView - vLight );
+
+ float NdotH = max( 0.0, dot( vNormal, vH ) );
+ float NdotL = max( 0.0, dot( vNormal, -vLight ) );
+
+ float f = mix( 0.01, 1.0, pow( 1.0 - NdotL, 5.0 ) );
+
+ return gSunColor * pow( NdotH, 20.0 ) * NdotL * f * 4.0;
+}
+
+
+vec3 GetSkyLighting( const vec3 vNormal )
+{
+ vec3 vSkyLight = normalize( vec3( -1.0, -2.0, -0.5 ) );
+
+ float fSkyBlend = vNormal.y * 0.5 + 0.5;
+
+ return mix( gSkyBottom, gSkyTop, fSkyBlend );
+}
+
+
+void GenerateCubeVertex( const float vertexIndex, const mat4 mat, const vec3 vCubeCol, const vec3 vCameraPos, out SceneVertex outSceneVertex )
+{
+ vec3 vNormal;
+
+ GetCubeVertex( vertexIndex, mat, outSceneVertex.vWorldPos, vNormal );
+
+ outSceneVertex.vColor = vec3( 0.0 );
+
+ outSceneVertex.fAlpha = 1.0;
+
+ float h = outSceneVertex.vWorldPos.y - gFloorHeight;
+ outSceneVertex.vColor += GetSkyLighting( vNormal );
+ outSceneVertex.vColor *= mix( 1.0, fAOAmount, clamp( h, 0.0, 1.0 ) );
+
+ outSceneVertex.vColor += GetSunLighting( vNormal );
+
+ outSceneVertex.vColor *= vCubeCol;
+
+ outSceneVertex.vColor += GetSunSpec( outSceneVertex.vWorldPos, vNormal, vCameraPos );
+}
+
+
+
+// hash function from https://www.shadertoy.com/view/4djSRW
+float hash(float p)
+{
+ vec2 p2 = fract(vec2(p * 5.3983, p * 5.4427));
+ p2 += dot(p2.yx, p2.xy + vec2(21.5351, 14.3137));
+ return fract(p2.x * p2.y * 95.4337);
+}
+
+vec3 hsv2rgb(vec3 c) {
+ c = vec3(c.x, clamp(c.yz, 0.0, 1.0));
+ vec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);
+ vec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www);
+ return c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y);
+}
+
+
+mat4 rotY( float angle ) {
+ float s = sin( angle );
+ float c = cos( angle );
+
+ return mat4(
+ c, 0,-s, 0,
+ 0, 1, 0, 0,
+ s, 0, c, 0,
+ 0, 0, 0, 1);
+}
+
+
+mat4 rotZ( float angle ) {
+ float s = sin( angle );
+ float c = cos( angle );
+
+ return mat4(
+ c,-s, 0, 0,
+ s, c, 0, 0,
+ 0, 0, 1, 0,
+ 0, 0, 0, 1);
+}
+
+mat4 trans(vec3 trans) {
+ #if 0
+ return mat4(
+ 1, 0, 0, trans[0],
+ 0, 1, 0, trans[1],
+ 0, 0, 1, trans[2],
+ 0, 0, 0, 1);
+ #else
+ return mat4(
+ 1, 0, 0, 0,
+ 0, 1, 0, 0,
+ 0, 0, 1, 0,
+ trans, 1);
+ #endif
+}
+
+mat4 ident() {
+ return mat4(
+ 1, 0, 0, 0,
+ 0, 1, 0, 0,
+ 0, 0, 1, 0,
+ 0, 0, 0, 1);
+}
+
+mat4 uniformScale(float s) {
+ return mat4(
+ s, 0, 0, 0,
+ 0, s, 0, 0,
+ 0, 0, s, 0,
+ 0, 0, 0, 1);
+}
+
+mat4 scale(vec3 s) {
+ return mat4(
+ s[0], 0, 0, 0,
+ 0, s[1], 0, 0,
+ 0, 0, s[2], 0,
+ 0, 0, 0, 1);
+}
+
+mat4 persp(float fov, float aspect, float zNear, float zFar) {
+ float f = tan(PI * 0.5 - 0.5 * fov);
+ float rangeInv = 1.0 / (zNear - zFar);
+
+ return mat4(
+ f / aspect, 0, 0, 0,
+ 0, f, 0, 0,
+ 0, 0, (zNear + zFar) * rangeInv, -1,
+ 0, 0, zNear * zFar * rangeInv * 2., 0);
+}
+
+mat4 trInv(mat4 m) {
+ mat3 i = mat3(
+ m[0][0], m[1][0], m[2][0],
+ m[0][1], m[1][1], m[2][1],
+ m[0][2], m[1][2], m[2][2]);
+ vec3 t = -i * m[3].xyz;
+
+ return mat4(
+ i[0], t[0],
+ i[1], t[1],
+ i[2], t[2],
+ 0, 0, 0, 1);
+}
+
+mat4 transpose(mat4 m) {
+ return mat4(
+ m[0][0], m[1][0], m[2][0], m[3][0],
+ m[0][1], m[1][1], m[2][1], m[3][1],
+ m[0][2], m[1][2], m[2][2], m[3][2],
+ m[0][3], m[1][3], m[2][3], m[3][3]);
+}
+
+mat4 lookAt(vec3 eye, vec3 target, vec3 up) {
+ vec3 zAxis = normalize(eye - target);
+ vec3 xAxis = normalize(cross(up, zAxis));
+ vec3 yAxis = cross(zAxis, xAxis);
+
+ return mat4(
+ xAxis, 0,
+ yAxis, 0,
+ zAxis, 0,
+ eye, 1);
+}
+
+mat4 inverse(mat4 m) {
+ float
+ a00 = m[0][0], a01 = m[0][1], a02 = m[0][2], a03 = m[0][3],
+ a10 = m[1][0], a11 = m[1][1], a12 = m[1][2], a13 = m[1][3],
+ a20 = m[2][0], a21 = m[2][1], a22 = m[2][2], a23 = m[2][3],
+ a30 = m[3][0], a31 = m[3][1], a32 = m[3][2], a33 = m[3][3],
+
+ b00 = a00 * a11 - a01 * a10,
+ b01 = a00 * a12 - a02 * a10,
+ b02 = a00 * a13 - a03 * a10,
+ b03 = a01 * a12 - a02 * a11,
+ b04 = a01 * a13 - a03 * a11,
+ b05 = a02 * a13 - a03 * a12,
+ b06 = a20 * a31 - a21 * a30,
+ b07 = a20 * a32 - a22 * a30,
+ b08 = a20 * a33 - a23 * a30,
+ b09 = a21 * a32 - a22 * a31,
+ b10 = a21 * a33 - a23 * a31,
+ b11 = a22 * a33 - a23 * a32,
+
+ det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;
+
+ return mat4(
+ a11 * b11 - a12 * b10 + a13 * b09,
+ a02 * b10 - a01 * b11 - a03 * b09,
+ a31 * b05 - a32 * b04 + a33 * b03,
+ a22 * b04 - a21 * b05 - a23 * b03,
+ a12 * b08 - a10 * b11 - a13 * b07,
+ a00 * b11 - a02 * b08 + a03 * b07,
+ a32 * b02 - a30 * b05 - a33 * b01,
+ a20 * b05 - a22 * b02 + a23 * b01,
+ a10 * b10 - a11 * b08 + a13 * b06,
+ a01 * b08 - a00 * b10 - a03 * b06,
+ a30 * b04 - a31 * b02 + a33 * b00,
+ a21 * b02 - a20 * b04 - a23 * b00,
+ a11 * b07 - a10 * b09 - a12 * b06,
+ a00 * b09 - a01 * b07 + a02 * b06,
+ a31 * b01 - a30 * b03 - a32 * b00,
+ a20 * b03 - a21 * b01 + a22 * b00) / det;
+}
+
+mat4 cameraLookAt(vec3 eye, vec3 target, vec3 up) {
+ #if 1
+ return inverse(lookAt(eye, target, up));
+ #else
+ vec3 zAxis = normalize(target - eye);
+ vec3 xAxis = normalize(cross(up, zAxis));
+ vec3 yAxis = cross(zAxis, xAxis);
+
+ return mat4(
+ xAxis, 0,
+ yAxis, 0,
+ zAxis, 0,
+ -dot(xAxis, eye), -dot(yAxis, eye), -dot(zAxis, eye), 1);
+ #endif
+
+}
+
+
+float m1p1(float v) {
+ return v * 2. - 1.;
+}
+
+float p1m1(float v) {
+ return v * .5 + .5;
+}
+
+float inRange(float v, float minV, float maxV) {
+ return step(minV, v) * step(v, maxV);
+}
+
+float at(float v, float target) {
+ return inRange(v, target - 0.1, target + 0.1);
+}
+
+float easeInOutCubic(float pos) {
+ if (pos < 0.5) {
+ return 0.5 * pow(pos / 0.5, 3.);
+ }
+ pos -= 0.5;
+ pos /= 0.5;
+ pos = 1. - pos;
+ return (1. - pow(pos, 3.)) * 0.5 + 0.5;
+}
+
+float inOut(float v) {
+ float t = fract(v);
+ if (t < 0.5) {
+ return easeInOutCubic(t / 0.5);
+ }
+ return easeInOutCubic(2. - t * 2.);
+}
+
+const float perBlock = 4.;
+
+uniform vec3 baseColor;
+uniform float heightMult;
+uniform float period1;
+uniform float period2;
+uniform float p1;
+uniform float p2;
+
+float spow(float v, float p) {
+ return pow(abs(v), p) * sign(v);
+}
+
+void GetCubePosition( float fCubeId, float numCubes, out mat4 mat, out vec4 vCubeCol )
+{
+ float fSeed = fCubeId;
+ float fPositionBase = fCubeId;
+ float fSize = 1.0;
+
+ vec3 vCubeOrigin = vec3( 0.0, 0.0, 0.0 );
+
+ float across = 48.;
+ float down = 32.;
+ float uId = mod(fCubeId, across);
+ float vId = floor(fCubeId / across);
+ float u = uId / (across);
+ float v = vId / down;
+ float bxId = floor(uId / perBlock);
+ float bzId = floor(vId / perBlock);
+ float numRows = floor(numCubes / across);
+ float numBlocks = floor(numRows / perBlock);
+
+ float snd = 1.;texture2D(sound, vec2(mix(0.015, 0.015, u), v * 0.1)).a;
+ float s2 = 0.;texture2D(sound, vec2(mix(0.02, 0.04, hash(u + v + 2.34)), hash(v) * 0.05)).a;
+
+ vCubeOrigin.x += m1p1(u) * across * 1.0 + bxId * 0. ;
+ float vSpace = numRows * 2.0 + numBlocks * 0.;
+ float z = v * down * 2.0 + bzId * 0.;
+ vCubeOrigin.z += z;
+ float height = 1.;
+ vCubeOrigin.y += spow(sin(time + v * period1), p1) * spow(cos(time + u * period2), p2) * heightMult * inOut(time * 0.1);
+
+ mat = ident();
+ mat *= trans(vCubeOrigin);
+ mat *= scale(vec3(1, height, 1) * snd);
+
+ vec3 vRandCol;
+
+
+ vCubeCol.rgb = hsv2rgb(vec3(
+ 0.2 + floor(time * 0.1) * 0.1 + easeInOutCubic(fract(time * 0.1)) * 0.1,
+ 0.95,
+ 1));
+ vCubeCol.rgb = baseColor;
+ vCubeCol.a = vCubeOrigin.z / vSpace;
+}
+
+float goop(float t) {
+ return sin(t) * sin(t * 0.27) * sin(t * 0.13) * sin(t * 0.73);
+}
+
+
+void main()
+{
+ SceneVertex sceneVertex;
+
+ float fov = 1.8;
+
+ vec3 vCameraTarget = vec3( 600, -400.6, 1000.0 );
+ vec3 vCameraPos = vec3(-45.1, 6., -0.);
+ float ca = 0.;
+
+ // get sick!
+ // ca = time + sin(time) * 2.;
+ vec3 vCameraUp = vec3( sin(ca), cos(ca), 0.0 );
+
+ vec3 vCameraForwards = normalize(vCameraTarget - vCameraPos);
+
+ float vertexIndex = vertexId;
+
+
+ float fCubeId = floor( vertexIndex / g_cubeVertexCount );
+ float fCubeVertex = mod( vertexIndex, g_cubeVertexCount );
+ float fNumCubes = floor( vertexCount / g_cubeVertexCount );
+
+ mat4 mCube;
+ vec4 vCubeCol;
+
+ GetCubePosition( fCubeId, fNumCubes, mCube, vCubeCol );
+
+ GenerateCubeVertex( fCubeVertex, mCube, vCubeCol.xyz, vCameraPos, sceneVertex );
+
+ mat4 m = persp(radians(45.), resolution.x / resolution.y, 0.1, 1000.);
+ m *= cameraLookAt(vCameraPos, vCameraTarget, vCameraUp);
+ gl_Position = m * vec4(sceneVertex.vWorldPos, 1);
+
+ // Final output color
+ float fExposure = gExposure;// min( gExposure, time * 0.1 );
+ vec3 vFinalColor = sqrt( vec3(1.0) - exp2( sceneVertex.vColor * -fExposure ) );
+
+ v_color = mix(vec4(vFinalColor, 1), background, vCubeCol.a);
+
+}`
+ },
+ revisionId: "rThcGALqhF88J2BET",
+ revisionUrl: "https://www.vertexshaderart.com/art/FPFBuCexgLQpriEoS/revision/rThcGALqhF88J2BET",
+ artUrl: "https://www.vertexshaderart.com/art/undefined",
+ origUrl: "https://www.vertexshaderart.com/art/bbsF39W6bJo3j4R3j"
+};
diff --git a/examples/js/index/effects/starfield.js b/examples/js/index/effects/starfield.js
new file mode 100644
index 0000000..20cdb36
--- /dev/null
+++ b/examples/js/index/effects/starfield.js
@@ -0,0 +1,317 @@
+/* eslint-disable require-trailing-comma/require-trailing-comma */
+/* eslint-disable no-useless-escape */
+export default {
+ _id: "pfa9757K3NJx6euhN",
+ createdAt: "2019-02-21T11:38:22.742Z",
+ modifiedAt: "2019-02-26T06:41:10.489Z",
+ origId: null,
+ name: "starfield",
+ username: "gman",
+ avatarUrl: "https://secure.gravatar.com/avatar/dcc0309895c3d6db087631813efaa9d1?default=retro&size=200",
+ settings: {
+ num: 100000,
+ mode: "POINTS",
+ sound: "",
+ lineSize: "NATIVE",
+ backgroundColor: [
+ 0,
+ 0,
+ 0,
+ 1
+ ],
+ shader: `#define PI radians(180.0)
+
+vec3 hsv2rgb(vec3 c) {
+ c = vec3(c.x, clamp(c.yz, 0.0, 1.0));
+ vec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);
+ vec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www);
+ return c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y);
+}
+
+
+mat4 rotX(float angleInRadians) {
+ float s = sin(angleInRadians);
+ float c = cos(angleInRadians);
+
+ return mat4(
+ 1, 0, 0, 0,
+ 0, c, s, 0,
+ 0, -s, c, 0,
+ 0, 0, 0, 1);
+}
+
+mat4 rotY(float angleInRadians) {
+ float s = sin(angleInRadians);
+ float c = cos(angleInRadians);
+
+ return mat4(
+ c, 0,-s, 0,
+ 0, 1, 0, 0,
+ s, 0, c, 0,
+ 0, 0, 0, 1);
+}
+
+mat4 rotZ(float angleInRadians) {
+ float s = sin(angleInRadians);
+ float c = cos(angleInRadians);
+
+ return mat4(
+ c,-s, 0, 0,
+ s, c, 0, 0,
+ 0, 0, 1, 0,
+ 0, 0, 0, 1);
+}
+
+mat4 trans(vec3 trans) {
+ return mat4(
+ 1, 0, 0, 0,
+ 0, 1, 0, 0,
+ 0, 0, 1, 0,
+ trans, 1);
+}
+
+mat4 ident() {
+ return mat4(
+ 1, 0, 0, 0,
+ 0, 1, 0, 0,
+ 0, 0, 1, 0,
+ 0, 0, 0, 1);
+}
+
+mat4 scale(vec3 s) {
+ return mat4(
+ s[0], 0, 0, 0,
+ 0, s[1], 0, 0,
+ 0, 0, s[2], 0,
+ 0, 0, 0, 1);
+}
+
+mat4 uniformScale(float s) {
+ return mat4(
+ s, 0, 0, 0,
+ 0, s, 0, 0,
+ 0, 0, s, 0,
+ 0, 0, 0, 1);
+}
+
+mat4 persp(float fov, float aspect, float zNear, float zFar) {
+ float f = tan(PI * 0.5 - 0.5 * fov);
+ float rangeInv = 1.0 / (zNear - zFar);
+
+ return mat4(
+ f / aspect, 0, 0, 0,
+ 0, f, 0, 0,
+ 0, 0, (zNear + zFar) * rangeInv, -1,
+ 0, 0, zNear * zFar * rangeInv * 2., 0);
+}
+
+mat4 trInv(mat4 m) {
+ mat3 i = mat3(
+ m[0][0], m[1][0], m[2][0],
+ m[0][1], m[1][1], m[2][1],
+ m[0][2], m[1][2], m[2][2]);
+ vec3 t = -i * m[3].xyz;
+
+ return mat4(
+ i[0], t[0],
+ i[1], t[1],
+ i[2], t[2],
+ 0, 0, 0, 1);
+}
+
+mat4 transpose(mat4 m) {
+ return mat4(
+ m[0][0], m[1][0], m[2][0], m[3][0],
+ m[0][1], m[1][1], m[2][1], m[3][1],
+ m[0][2], m[1][2], m[2][2], m[3][2],
+ m[0][3], m[1][3], m[2][3], m[3][3]);
+}
+
+mat4 lookAt(vec3 eye, vec3 target, vec3 up) {
+ vec3 zAxis = normalize(eye - target);
+ vec3 xAxis = normalize(cross(up, zAxis));
+ vec3 yAxis = cross(zAxis, xAxis);
+
+ return mat4(
+ xAxis, 0,
+ yAxis, 0,
+ zAxis, 0,
+ eye, 1);
+}
+
+mat4 inverse(mat4 m) {
+ float
+ a00 = m[0][0], a01 = m[0][1], a02 = m[0][2], a03 = m[0][3],
+ a10 = m[1][0], a11 = m[1][1], a12 = m[1][2], a13 = m[1][3],
+ a20 = m[2][0], a21 = m[2][1], a22 = m[2][2], a23 = m[2][3],
+ a30 = m[3][0], a31 = m[3][1], a32 = m[3][2], a33 = m[3][3],
+
+ b00 = a00 * a11 - a01 * a10,
+ b01 = a00 * a12 - a02 * a10,
+ b02 = a00 * a13 - a03 * a10,
+ b03 = a01 * a12 - a02 * a11,
+ b04 = a01 * a13 - a03 * a11,
+ b05 = a02 * a13 - a03 * a12,
+ b06 = a20 * a31 - a21 * a30,
+ b07 = a20 * a32 - a22 * a30,
+ b08 = a20 * a33 - a23 * a30,
+ b09 = a21 * a32 - a22 * a31,
+ b10 = a21 * a33 - a23 * a31,
+ b11 = a22 * a33 - a23 * a32,
+
+ det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;
+
+ return mat4(
+ a11 * b11 - a12 * b10 + a13 * b09,
+ a02 * b10 - a01 * b11 - a03 * b09,
+ a31 * b05 - a32 * b04 + a33 * b03,
+ a22 * b04 - a21 * b05 - a23 * b03,
+ a12 * b08 - a10 * b11 - a13 * b07,
+ a00 * b11 - a02 * b08 + a03 * b07,
+ a32 * b02 - a30 * b05 - a33 * b01,
+ a20 * b05 - a22 * b02 + a23 * b01,
+ a10 * b10 - a11 * b08 + a13 * b06,
+ a01 * b08 - a00 * b10 - a03 * b06,
+ a30 * b04 - a31 * b02 + a33 * b00,
+ a21 * b02 - a20 * b04 - a23 * b00,
+ a11 * b07 - a10 * b09 - a12 * b06,
+ a00 * b09 - a01 * b07 + a02 * b06,
+ a31 * b01 - a30 * b03 - a32 * b00,
+ a20 * b03 - a21 * b01 + a22 * b00) / det;
+}
+
+mat4 cameraLookAt(vec3 eye, vec3 target, vec3 up) {
+ #if 1
+ return inverse(lookAt(eye, target, up));
+ #else
+ vec3 zAxis = normalize(target - eye);
+ vec3 xAxis = normalize(cross(up, zAxis));
+ vec3 yAxis = cross(zAxis, xAxis);
+
+ return mat4(
+ xAxis, 0,
+ yAxis, 0,
+ zAxis, 0,
+ -dot(xAxis, eye), -dot(yAxis, eye), -dot(zAxis, eye), 1);
+ #endif
+
+}
+
+
+
+// hash function from https://www.shadertoy.com/view/4djSRW
+float hash(float p) {
+ vec2 p2 = fract(vec2(p * 5.3983, p * 5.4427));
+ p2 += dot(p2.yx, p2.xy + vec2(21.5351, 14.3137));
+ return fract(p2.x * p2.y * 95.4337);
+}
+
+// times 2 minus 1
+float t2m1(float v) {
+ return v * 2. - 1.;
+}
+
+// times .5 plus .5
+float t5p5(float v) {
+ return v * 0.5 + 0.5;
+}
+
+float inv(float v) {
+ return 1. - v;
+}
+
+
+void main() {
+
+ float near = 0.01;
+ float far = 25.0;
+ mat4 pmat = persp(radians(60.0), resolution.x / resolution.y, near, far);
+ mat4 cmat = ident();
+ cmat *= rotX(mouse.y * PI);
+ cmat *= rotY(mouse.x * -PI);
+ mat4 vmat = inverse(cmat);
+
+ vec3 pos = vec3(
+ hash(vertexId * 0.123),
+ hash(vertexId * 0.357),
+ // fract(hash(vertexId * 0.531) - time * .01)) * vec3(2, 2, -40) - vec3(1, 1, -20);
+ fract(hash(vertexId * 0.531) + time * .05)) * 2. - 1.;
+ float d = length(pos);
+ pos *= vec3(2);
+
+ vec3 boxMin = (cmat * vec4(-1, -1, 0, 1)).xyz;
+ vec3 boxMax = (cmat * vec4(1, 1, -20, 1)).xyz;
+
+
+
+
+ /*
+
+ +--------+--------+--------+--------+
+ | | | | |
+ | |\ | | |
+ | | \ | | |
+ | | \ | | |
+ +--------+--------+--------+--------+
+ | | \ | | |
+ | | \ | | |
+ | | \ | | |
+ | | \| | |
+ +--------+--------c--------+--------+
+ | | /| | |
+ | | / | | |
+ | | / | | |
+ | | / | | |
+ +--------+--------+--------+--------+
+ | | / | | |
+ | | / | | |
+ | |/ | | |
+ | | | | |
+ +--------+--------+--------+--------+
+
+ */
+
+
+ //mat[2][2] /= far;
+ //mat[2][3] /= far;
+
+ gl_Position = pmat * vmat * vec4(pos, 1);
+ // gl_Position.z = gl_Position.z * gl_Position.w / far;
+
+
+ /*
+mat4 persp(float fov, float aspect, float zNear, float zFar) {
+ float f = tan(PI * 0.5 - 0.5 * fov);
+ float rangeInv = 1.0 / (zNear - zFar);
+
+ return mat4(
+ f / aspect, 0, 0, 0,
+ 0, f, 0, 0,
+ 0, 0, (zNear + zFar) * rangeInv, -1,
+ 0, 0, zNear * zFar * rangeInv * 2., 0);
+}
+
+ rangeInv = 1.0 / (near - far)
+ rangnInv = 1.0 / (0.01 - 25.0)
+ rangeInv = 1.0 / -24.99
+ rangeInv = -0.040016006402561027
+
+ -0.1 * (0.1 + 25.0) * -0.04001 + 1 * (0.1 * 25.0 * -0.04001) * 2 = -0.000996
+ -20 * (0.1 + 25.0) * -0.04001 + 1 * (0.1 * 25.0 * -0.04001) * 2 = 0.1988
+
+
+ */
+
+ vec4 f = gl_Position;
+ float depth = f.z * .5 + .5;
+
+ gl_PointSize = mix(10.0, 1.0, depth);
+ v_color = vec4(hsv2rgb(vec3(hash(vertexId * 0.237), 0.25, 1)), 1. - d);
+ v_color.rgb *= v_color.a;
+// v_color = vec4(hsv2rgb(vec3(depth, 1, 1)), 1);
+}`
+ },
+ revisionId: "oTpAmrwEQsSFL3L3y",
+ revisionUrl: "https://www.vertexshaderart.com/art/pfa9757K3NJx6euhN/revision/oTpAmrwEQsSFL3L3y",
+ artUrl: "https://www.vertexshaderart.com/art/undefined"
+};
diff --git a/examples/js/index/effects/ung.js b/examples/js/index/effects/ung.js
new file mode 100644
index 0000000..f68da90
--- /dev/null
+++ b/examples/js/index/effects/ung.js
@@ -0,0 +1,621 @@
+/* eslint-disable require-trailing-comma/require-trailing-comma */
+/* eslint-disable no-useless-escape */
+export default {
+ _id: "9mqwFjEipb8pPtcPw",
+ createdAt: "2016-01-25T18:48:08.828Z",
+ modifiedAt: "2018-03-30T01:58:37.742Z",
+ origId: "FPFBuCexgLQpriEoS",
+ name: "ung",
+ username: "gman",
+ avatarUrl: "https://secure.gravatar.com/avatar/dcc0309895c3d6db087631813efaa9d1?default=retro&size=200",
+ settings: {
+ num: 100000,
+ mode: "TRIANGLES",
+ sound: "https://soundcloud.com/substruk-records/sub032-sixis-orbital-substruk",
+ lineSize: "NATIVE",
+ backgroundColor: [
+ 1,
+ 1,
+ 1,
+ 1
+ ],
+ shader: `/*
+
+ ___ ___ _______ ________ _________ _______ ___ ___
+|\ \ / /|\ ___ \ |\ __ \|\___ ___|\ ___ \ |\ \ / /|
+\ \ \ / / \ \ __/|\ \ \|\ \|___ \ \_\ \ __/| \ \ \/ / /
+ \ \ \/ / / \ \ \_|/_\ \ _ _\ \ \ \ \ \ \_|/__ \ \ / /
+ \ \ / / \ \ \_|\ \ \ \\ \| \ \ \ \ \ \_|\ \ / \/
+ \ \__/ / \ \_______\ \__\\ _\ \ \__\ \ \_______\/ /\ \
+ \|__|/ \|_______|\|__|\|__| \|__| \|_______/__/ /\ __\
+ |__|/ \|__|
+
+
+ ________ ___ ___ ________ ________ _______ ________
+|\ ____\|\ \|\ \|\ __ \|\ ___ \|\ ___ \ |\ __ \
+\ \ \___|\ \ \\\ \ \ \|\ \ \ \_|\ \ \ __/|\ \ \|\ \
+ \ \_____ \ \ __ \ \ __ \ \ \ \\ \ \ \_|/_\ \ _ _\
+ \|____|\ \ \ \ \ \ \ \ \ \ \ \_\\ \ \ \_|\ \ \ \\ \|
+ ____\_\ \ \__\ \__\ \__\ \__\ \_______\ \_______\ \__\\ _\
+ |\_________\|__|\|__|\|__|\|__|\|_______|\|_______|\|__|\|__|
+ \|_________|
+
+
+ ________ ________ _________
+|\ __ \|\ __ \|\___ ___\
+\ \ \|\ \ \ \|\ \|___ \ \_|
+ \ \ __ \ \ _ _\ \ \ \
+ \ \ \ \ \ \ \\ \| \ \ \
+ \ \__\ \__\ \__\\ _\ \ \__\
+ \|__|\|__|\|__|\|__| \|__|
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+*/
+
+vec3 gSunColor = vec3(1.0, 1.2, 1.4) * 10.;
+
+vec3 gSkyTop = vec3( 0.1, 0.2, 0.8 ) * 0.5;
+vec3 gSkyBottom = vec3( 0.5, 0.8, 1.0 ) * 1.5;
+
+vec3 gCubeColor = vec3(1.0, 1.0, 1.0);
+float gExposure = 0.3;
+
+float gCubeColorRandom = 0.0;
+
+#define MOVE_OUTWARDS
+
+float fAOAmount = 0.8;
+float gFloorHeight = -1.0;
+float g_cameraFar = 1000.0;
+
+#define PI radians( 180.0 )
+
+
+vec3 GetSunDir()
+{
+ return normalize( vec3( 20.0, 40.3, -10.4 ) );
+}
+
+struct SceneVertex
+{
+ vec3 vWorldPos;
+ vec3 vColor;
+ float fAlpha;
+};
+
+
+float GetCosSunRadius()
+{
+ return 0.01;
+}
+
+
+float GetSunIntensity()
+{
+ return 0.001;
+}
+
+
+vec3 GetSkyColor( vec3 vViewDir )
+{
+ return mix( gSkyBottom, gSkyTop, max( 0.0, vViewDir.y ) );
+}
+const float g_cubeFaces = 6.0;
+const float g_cubeVerticesPerFace = ( 2.0 * 3.0 );
+const float g_cubeVertexCount = ( g_cubeVerticesPerFace * g_cubeFaces );
+
+// 6 7
+// +----------+
+// /| /|
+// 2 / | 3/ |
+// +----------+ |
+// | | | |
+// Y Z | 4| | 5|
+// | +-------|--+
+// ^ / | / | /
+// |/ 0|/ 1|/
+// +--> X +----------+
+
+vec3 GetCubeVertex( float fVertexIndex )
+{
+ float f = fVertexIndex / 8.0;
+ return vec3(
+ mix(-1., 1., step(0.5, fract(f * 4.))),
+ mix(-1., 1., step(0.5, fract(f * 2.))),
+ mix(-1., 1., step(0.5, fract(f))));
+}
+
+
+void GetCubeVertex( const float vertexIndex, const mat4 mat, out vec3 vWorldPos, out vec3 vWorldNormal )
+{
+ float fFaceIndex = floor( vertexIndex / g_cubeFaces );
+
+ vec3 v0, v1, v2, v3;
+
+ if ( fFaceIndex < 0.5 )
+ {
+ v0 = GetCubeVertex( 0.0 );
+ v1 = GetCubeVertex( 2.0 );
+ v2 = GetCubeVertex( 3.0 );
+ v3 = GetCubeVertex( 1.0 );
+ }
+ else if ( fFaceIndex < 1.5 )
+ {
+ v0 = GetCubeVertex( 5.0 );
+ v1 = GetCubeVertex( 7.0 );
+ v2 = GetCubeVertex( 6.0 );
+ v3 = GetCubeVertex( 4.0 );
+ }
+ else if ( fFaceIndex < 2.5 )
+ {
+ v0 = GetCubeVertex( 1.0 );
+ v1 = GetCubeVertex( 3.0 );
+ v2 = GetCubeVertex( 7.0 );
+ v3 = GetCubeVertex( 5.0 );
+ }
+ else if ( fFaceIndex < 3.5 )
+ {
+ v0 = GetCubeVertex( 4.0 );
+ v1 = GetCubeVertex( 6.0 );
+ v2 = GetCubeVertex( 2.0 );
+ v3 = GetCubeVertex( 0.0 );
+ }
+ else if ( fFaceIndex < 4.5 )
+ {
+ v0 = GetCubeVertex( 2.0 );
+ v1 = GetCubeVertex( 6.0 );
+ v2 = GetCubeVertex( 7.0 );
+ v3 = GetCubeVertex( 3.0 );
+ }
+ else
+ {
+ v0 = GetCubeVertex( 1.0 );
+ v1 = GetCubeVertex( 5.0 );
+ v2 = GetCubeVertex( 4.0 );
+ v3 = GetCubeVertex( 0.0 );
+ }
+ v0 = (mat * vec4(v0, 1)).xyz;
+ v1 = (mat * vec4(v1, 1)).xyz;
+ v2 = (mat * vec4(v2, 1)).xyz;
+ v3 = (mat * vec4(v3, 1)).xyz;
+
+ float fFaceVertexIndex = mod( vertexIndex, 6.0 );
+
+ if ( fFaceVertexIndex < 0.5 )
+ {
+ vWorldPos = v0;
+ }
+ else if ( fFaceVertexIndex < 1.5 )
+ {
+ vWorldPos = v1;
+ }
+ else if ( fFaceVertexIndex < 2.5 )
+ {
+ vWorldPos = v2;
+ }
+ else if ( fFaceVertexIndex < 3.5 )
+ {
+ vWorldPos = v0;
+ }
+ else if ( fFaceVertexIndex < 4.5 )
+ {
+ vWorldPos = v2;
+ }
+ else
+ {
+ vWorldPos = v3;
+ }
+
+ vWorldNormal = normalize( cross( v1 - v0, v2 - v0 ) );
+}
+
+
+vec3 GetSunLighting( const vec3 vNormal )
+{
+ vec3 vLight = -GetSunDir();
+
+ float NdotL = max( 0.0, dot( vNormal, -vLight ) );
+
+ return gSunColor * NdotL;
+}
+
+
+vec3 GetSunSpec( const vec3 vPos, const vec3 vNormal, const vec3 vCameraPos )
+{
+ vec3 vLight = -GetSunDir();
+
+ vec3 vView = normalize( vCameraPos - vPos );
+
+ vec3 vH = normalize( vView - vLight );
+
+ float NdotH = max( 0.0, dot( vNormal, vH ) );
+ float NdotL = max( 0.0, dot( vNormal, -vLight ) );
+
+ float f = mix( 0.01, 1.0, pow( 1.0 - NdotL, 5.0 ) );
+
+ return gSunColor * pow( NdotH, 20.0 ) * NdotL * f * 4.0;
+}
+
+
+vec3 GetSkyLighting( const vec3 vNormal )
+{
+ vec3 vSkyLight = normalize( vec3( -1.0, -2.0, -0.5 ) );
+
+ float fSkyBlend = vNormal.y * 0.5 + 0.5;
+
+ return mix( gSkyBottom, gSkyTop, fSkyBlend );
+}
+
+
+void GenerateCubeVertex( const float vertexIndex, const mat4 mat, const vec3 vCubeCol, const vec3 vCameraPos, out SceneVertex outSceneVertex )
+{
+ vec3 vNormal;
+
+ GetCubeVertex( vertexIndex, mat, outSceneVertex.vWorldPos, vNormal );
+
+ outSceneVertex.vColor = vec3( 0.0 );
+
+ outSceneVertex.fAlpha = 1.0;
+
+ float h = outSceneVertex.vWorldPos.y - gFloorHeight;
+ outSceneVertex.vColor += GetSkyLighting( vNormal );
+ outSceneVertex.vColor *= mix( 1.0, fAOAmount, clamp( h, 0.0, 1.0 ) );
+
+ outSceneVertex.vColor += GetSunLighting( vNormal );
+
+ outSceneVertex.vColor *= vCubeCol;
+
+ outSceneVertex.vColor += GetSunSpec( outSceneVertex.vWorldPos, vNormal, vCameraPos );
+}
+
+
+
+// hash function from https://www.shadertoy.com/view/4djSRW
+float hash(float p)
+{
+ vec2 p2 = fract(vec2(p * 5.3983, p * 5.4427));
+ p2 += dot(p2.yx, p2.xy + vec2(21.5351, 14.3137));
+ return fract(p2.x * p2.y * 95.4337);
+}
+
+vec3 hsv2rgb(vec3 c) {
+ c = vec3(c.x, clamp(c.yz, 0.0, 1.0));
+ vec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);
+ vec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www);
+ return c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y);
+}
+
+
+mat4 rotY( float angle ) {
+ float s = sin( angle );
+ float c = cos( angle );
+
+ return mat4(
+ c, 0,-s, 0,
+ 0, 1, 0, 0,
+ s, 0, c, 0,
+ 0, 0, 0, 1);
+}
+
+
+mat4 rotZ( float angle ) {
+ float s = sin( angle );
+ float c = cos( angle );
+
+ return mat4(
+ c,-s, 0, 0,
+ s, c, 0, 0,
+ 0, 0, 1, 0,
+ 0, 0, 0, 1);
+}
+
+mat4 trans(vec3 trans) {
+ #if 0
+ return mat4(
+ 1, 0, 0, trans[0],
+ 0, 1, 0, trans[1],
+ 0, 0, 1, trans[2],
+ 0, 0, 0, 1);
+ #else
+ return mat4(
+ 1, 0, 0, 0,
+ 0, 1, 0, 0,
+ 0, 0, 1, 0,
+ trans, 1);
+ #endif
+}
+
+mat4 ident() {
+ return mat4(
+ 1, 0, 0, 0,
+ 0, 1, 0, 0,
+ 0, 0, 1, 0,
+ 0, 0, 0, 1);
+}
+
+mat4 uniformScale(float s) {
+ return mat4(
+ s, 0, 0, 0,
+ 0, s, 0, 0,
+ 0, 0, s, 0,
+ 0, 0, 0, 1);
+}
+
+mat4 scale(vec3 s) {
+ return mat4(
+ s[0], 0, 0, 0,
+ 0, s[1], 0, 0,
+ 0, 0, s[2], 0,
+ 0, 0, 0, 1);
+}
+
+mat4 persp(float fov, float aspect, float zNear, float zFar) {
+ float f = tan(PI * 0.5 - 0.5 * fov);
+ float rangeInv = 1.0 / (zNear - zFar);
+
+ return mat4(
+ f / aspect, 0, 0, 0,
+ 0, f, 0, 0,
+ 0, 0, (zNear + zFar) * rangeInv, -1,
+ 0, 0, zNear * zFar * rangeInv * 2., 0);
+}
+
+mat4 trInv(mat4 m) {
+ mat3 i = mat3(
+ m[0][0], m[1][0], m[2][0],
+ m[0][1], m[1][1], m[2][1],
+ m[0][2], m[1][2], m[2][2]);
+ vec3 t = -i * m[3].xyz;
+
+ return mat4(
+ i[0], t[0],
+ i[1], t[1],
+ i[2], t[2],
+ 0, 0, 0, 1);
+}
+
+mat4 transpose(mat4 m) {
+ return mat4(
+ m[0][0], m[1][0], m[2][0], m[3][0],
+ m[0][1], m[1][1], m[2][1], m[3][1],
+ m[0][2], m[1][2], m[2][2], m[3][2],
+ m[0][3], m[1][3], m[2][3], m[3][3]);
+}
+
+mat4 lookAt(vec3 eye, vec3 target, vec3 up) {
+ vec3 zAxis = normalize(eye - target);
+ vec3 xAxis = normalize(cross(up, zAxis));
+ vec3 yAxis = cross(zAxis, xAxis);
+
+ return mat4(
+ xAxis, 0,
+ yAxis, 0,
+ zAxis, 0,
+ eye, 1);
+}
+
+mat4 inverse(mat4 m) {
+ float
+ a00 = m[0][0], a01 = m[0][1], a02 = m[0][2], a03 = m[0][3],
+ a10 = m[1][0], a11 = m[1][1], a12 = m[1][2], a13 = m[1][3],
+ a20 = m[2][0], a21 = m[2][1], a22 = m[2][2], a23 = m[2][3],
+ a30 = m[3][0], a31 = m[3][1], a32 = m[3][2], a33 = m[3][3],
+
+ b00 = a00 * a11 - a01 * a10,
+ b01 = a00 * a12 - a02 * a10,
+ b02 = a00 * a13 - a03 * a10,
+ b03 = a01 * a12 - a02 * a11,
+ b04 = a01 * a13 - a03 * a11,
+ b05 = a02 * a13 - a03 * a12,
+ b06 = a20 * a31 - a21 * a30,
+ b07 = a20 * a32 - a22 * a30,
+ b08 = a20 * a33 - a23 * a30,
+ b09 = a21 * a32 - a22 * a31,
+ b10 = a21 * a33 - a23 * a31,
+ b11 = a22 * a33 - a23 * a32,
+
+ det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;
+
+ return mat4(
+ a11 * b11 - a12 * b10 + a13 * b09,
+ a02 * b10 - a01 * b11 - a03 * b09,
+ a31 * b05 - a32 * b04 + a33 * b03,
+ a22 * b04 - a21 * b05 - a23 * b03,
+ a12 * b08 - a10 * b11 - a13 * b07,
+ a00 * b11 - a02 * b08 + a03 * b07,
+ a32 * b02 - a30 * b05 - a33 * b01,
+ a20 * b05 - a22 * b02 + a23 * b01,
+ a10 * b10 - a11 * b08 + a13 * b06,
+ a01 * b08 - a00 * b10 - a03 * b06,
+ a30 * b04 - a31 * b02 + a33 * b00,
+ a21 * b02 - a20 * b04 - a23 * b00,
+ a11 * b07 - a10 * b09 - a12 * b06,
+ a00 * b09 - a01 * b07 + a02 * b06,
+ a31 * b01 - a30 * b03 - a32 * b00,
+ a20 * b03 - a21 * b01 + a22 * b00) / det;
+}
+
+mat4 cameraLookAt(vec3 eye, vec3 target, vec3 up) {
+ #if 1
+ return inverse(lookAt(eye, target, up));
+ #else
+ vec3 zAxis = normalize(target - eye);
+ vec3 xAxis = normalize(cross(up, zAxis));
+ vec3 yAxis = cross(zAxis, xAxis);
+
+ return mat4(
+ xAxis, 0,
+ yAxis, 0,
+ zAxis, 0,
+ -dot(xAxis, eye), -dot(yAxis, eye), -dot(zAxis, eye), 1);
+ #endif
+
+}
+
+
+float m1p1(float v) {
+ return v * 2. - 1.;
+}
+
+float p1m1(float v) {
+ return v * .5 + .5;
+}
+
+float inRange(float v, float minV, float maxV) {
+ return step(minV, v) * step(v, maxV);
+}
+
+float at(float v, float target) {
+ return inRange(v, target - 0.1, target + 0.1);
+}
+
+float easeInOutCubic(float pos) {
+ if (pos < 0.5) {
+ return 0.5 * pow(pos / 0.5, 3.);
+ }
+ pos -= 0.5;
+ pos /= 0.5;
+ pos = 1. - pos;
+ return (1. - pow(pos, 3.)) * 0.5 + 0.5;
+}
+
+float inOut(float v) {
+ float t = fract(v);
+ if (t < 0.5) {
+ return easeInOutCubic(t / 0.5);
+ }
+ return easeInOutCubic(2. - t * 2.);
+}
+
+const float perBlock = 4.;
+
+void GetCubePosition( float fCubeId, float numCubes, out mat4 mat, out vec4 vCubeCol )
+{
+ float fSeed = fCubeId;
+ float fPositionBase = fCubeId;
+ float fSize = 1.0;
+
+ vec3 vCubeOrigin = vec3( 0.0, 0.0, 0.0 );
+
+ float across = 48.;
+ float down = 32.;
+ float uId = mod(fCubeId, across);
+ float vId = floor(fCubeId / across);
+ float u = uId / (across);
+ float v = vId / down;
+ float bxId = floor(uId / perBlock);
+ float bzId = floor(vId / perBlock);
+ float numRows = floor(numCubes / across);
+ float numBlocks = floor(numRows / perBlock);
+
+ float a = atan(u - 0.5, v - .5);
+ float r = length(vec2(u - 0.5, v - .5));
+ float snd = texture2D(sound, vec2(mix(0.0, 0.0135, abs(a / PI)), r * 0.3)).a;
+ float s2 = 0.;texture2D(sound, vec2(mix(0.02, 0.04, hash(u + v + 2.34)), hash(v) * 0.05)).a;
+
+ vCubeOrigin.x += m1p1(u) * across * 1.0 + bxId * 0. ;
+ float vSpace = numRows * 2.0 + numBlocks * 0.;
+ float z = v * down * 2.0 + bzId * 0.;
+ vCubeOrigin.z += z;
+ float height = 0.1 + pow(snd, 5.) * 7.0;
+ vCubeOrigin.y += height;pow(sin(time + v * 9.), 1.) * pow(cos(time + u * 8.17), 1.) * 4. * inOut(time * 0.1);
+
+ mat = ident();
+ mat *= trans(vCubeOrigin);
+ mat *= scale(vec3(1, height, 1));
+
+ vec3 vRandCol;
+
+
+ vCubeCol.rgb = mix(
+ hsv2rgb(vec3(time * 0.1,0.7,0.8)), hsv2rgb(vec3(time * 0.1 + 0.5,1,1)), smoothstep(0.50,1., snd));
+ // hsv2rgb(vec3(
+ // mix(1., 1.5, pow(snd, 5.)) + fract(time * 0.1), // + 0.2 + floor(time * 0.1) * 0.1 + easeInOutCubic(fract(time * 0.1)) * 0.1,
+ // 0.5 + snd * 0.5,
+ // 1));
+ vCubeCol.a = vCubeOrigin.z / vSpace;
+}
+
+float goop(float t) {
+ return sin(t) * sin(t * 0.27) * sin(t * 0.13) * sin(t * 0.73);
+}
+
+
+void main()
+{
+ SceneVertex sceneVertex;
+
+ float fov = 1.8;
+
+ vec3 vCameraTarget = vec3( sin(time) * 700., -600.6 + cos(time) * 100., 1000.0 );
+ vec3 vCameraPos = vec3(sin(time) * -45.1, 40., -10.);
+ float ca = 0.;
+
+ // get sick!
+ // ca = time + sin(time) * 2.;
+ vec3 vCameraUp = vec3( sin(ca), cos(ca), 0.0 );
+
+ vec3 vCameraForwards = normalize(vCameraTarget - vCameraPos);
+
+ float vertexIndex = vertexId;
+
+
+ float fCubeId = floor( vertexIndex / g_cubeVertexCount );
+ float fCubeVertex = mod( vertexIndex, g_cubeVertexCount );
+ float fNumCubes = floor( vertexCount / g_cubeVertexCount );
+
+ mat4 mCube;
+ vec4 vCubeCol;
+
+ GetCubePosition( fCubeId, fNumCubes, mCube, vCubeCol );
+
+ GenerateCubeVertex( fCubeVertex, mCube, vCubeCol.xyz, vCameraPos, sceneVertex );
+
+ mat4 m = persp(radians(45.), resolution.x / resolution.y, 0.1, 1000.);
+ m *= cameraLookAt(vCameraPos, vCameraTarget, vCameraUp);
+ gl_Position = m * vec4(sceneVertex.vWorldPos, 1);
+
+ // Final output color
+ float fExposure = gExposure;// min( gExposure, time * 0.1 );
+ vec3 vFinalColor = sqrt( vec3(1.0) - exp2( sceneVertex.vColor * -fExposure ) );
+
+ v_color = mix(vec4(vFinalColor, 1), background, vCubeCol.a);
+
+}`
+ },
+ revisionId: "bF76cKMgYSz9qXQGS",
+ revisionUrl: "https://www.vertexshaderart.com/art/9mqwFjEipb8pPtcPw/revision/bF76cKMgYSz9qXQGS",
+ artUrl: "https://www.vertexshaderart.com/art/undefined",
+ origUrl: "https://www.vertexshaderart.com/art/FPFBuCexgLQpriEoS"
+};
diff --git a/examples/js/index/index.js b/examples/js/index/index.js
new file mode 100644
index 0000000..2620286
--- /dev/null
+++ b/examples/js/index/index.js
@@ -0,0 +1,293 @@
+import * as twgl from '../../3rdParty/twgl-full.module.js';
+import VSAEffect from './VSAEffect.js';
+import effects from './effects.js';
+// eslint-disable-next-line @typescript-eslint/no-unused-vars
+import GUI, { helpers, Direction, TextNumber } from '../../../src/esm.js';
+
+const canvas = document.querySelector('#bg');
+const gl = canvas.getContext('webgl');
+
+const elements = [];
+
+function render(time) {
+ time *= 0.001;
+
+ twgl.resizeCanvasToDisplaySize(canvas);
+
+ canvas.style.transform = `translateX(${window.scrollX}px) translateY(${window.scrollY}px)`;
+
+ for (const {render, elem} of elements) {
+ const rect = elem.getBoundingClientRect();
+ if (rect.bottom < 0 || rect.top > gl.canvas.clientHeight ||
+ rect.right < 0 || rect.left > gl.canvas.clientWidth) {
+ continue; // it's off screen
+ }
+
+ const width = rect.right - rect.left;
+ const height = rect.bottom - rect.top;
+ const left = rect.left;
+ const bottom = gl.canvas.clientHeight - rect.bottom;
+
+ render(gl, {
+ time,
+ width,
+ height,
+ left,
+ bottom,
+ });
+ }
+ requestAnimationFrame(render);
+}
+requestAnimationFrame(render);
+
+//const eff = Object.values(effects);
+// eslint-disable-next-line no-underscore-dangle
+//console.log(eff.map(e => `https://www.vertexshaderart.com/art/${e._id}`).join(' '));
+
+const sections = {
+ basic({uiElem}) {
+ const gui = new GUI(uiElem);
+ const vsaEffect = new VSAEffect(gl);
+ const vsa = effects.discus;
+
+ const settings = {
+ numSides: 4,
+ speed: 0,
+ brightness: 0.1,
+ opacity: 1,
+ run: true,
+ rotation: 0,
+ split: 0.96,
+ s1: 1,
+ s2: 1,
+ s3: 10,
+ s4: 10,
+ color1: [0.439, 0.463, 0.78],
+ color2: [1, 1, 0],
+ };
+ gui.add(settings, 'run');
+ gui.add(settings, 'numSides', {
+ keyValues: {
+ '△ triangle': 3,
+ '□ square': 4,
+ '⭔ pentagon': 5,
+ '⬡ hexagon': 6,
+ '○ circle': 48,
+ },
+ }).name('shape');
+ //gui.add(settings, 'brightness', 0, 1);
+ //gui.add(settings, 's1', 0, 1);
+ //gui.add(settings, 's2', 0, 1);
+ //gui.add(settings, 's3', 0, 50);
+ //gui.add(settings, 's4', 0, 50);
+ const degToRad = d => d * Math.PI / 180;
+ const radToDeg = r => r * 180 / Math.PI;
+ //gui.add(new Direction(settings, 'rotation', {
+ // converters: {
+ // to: v => { return radToDeg(v); },
+ // from: v => { const outV = degToRad(v); console.log(outV); return [true, outV]; },
+ // },
+ //}));
+ gui.add(settings, 'rotation', {
+ min: -180,
+ max: 180,
+ converters: {
+ to: radToDeg,
+ from: v => [true, degToRad(v)],
+ },
+ });
+ gui.add(settings, 'split', 0, 1);
+ //gui.add(settings, 'count', 1, 100, 1);
+ gui.addColor(settings, 'color1');
+ gui.addColor(settings, 'color2');
+
+ vsaEffect.setSettings(vsa);
+
+ let time = 0;
+ let then = 0;
+ return function (gl, inputs) {
+ const deltaTime = settings.run ? (inputs.time - then) : 0;
+ then = inputs.time;
+ time += deltaTime;
+ vsaEffect.render(gl, {
+ ...inputs,
+ ...settings,
+ time,
+ }, {
+ getTime() {
+ return time * 44100 | 0;
+ },
+ getDesiredSampleRate() {
+ return 44100;
+ },
+ }, [
+ {
+ frequencyBinCount: 4096,
+ getByteFrequencyData(b) {
+ const {s1, s2, s3, s4} = settings;
+ for (let i = 0; i < b.length; ++i) {
+ b[i] = (Math.sin(time * s1 + i * s3) + Math.sin(time * s2 + i * s4)) * 0.5 * 127 + 127;
+ }
+ },
+ },
+ ]);
+ };
+ },
+ float({uiElem}) {
+ const gui = new GUI(uiElem);
+ gui.setTheme('float');
+ const vsaEffect = new VSAEffect(gl);
+ const vsa = effects.rollin;
+
+ const settings = {
+ period1: 9,
+ period2: 8.17,
+ p1: 1,
+ p2: 1,
+ heightMult: 4,
+ baseColor: [0.02, 0.396, 1],
+ };
+ gui.add(settings, 'period1', 0.1, 20);
+ gui.add(settings, 'period2', 0.1, 20);
+ gui.add(settings, 'p1', 0.1, 20);
+ gui.add(settings, 'p2', 0.1, 20);
+ gui.add(settings, 'heightMult', 1, 10);
+ gui.addColor(settings, 'baseColor');
+
+ vsaEffect.setSettings(vsa);
+
+ return function (gl, inputs) {
+ vsaEffect.render(gl, {
+ ...inputs,
+ ...settings,
+ }, {
+ getTime() {
+ return inputs.time * 44100 | 0;
+ },
+ getDesiredSampleRate() {
+ return 44100;
+ },
+ }, [
+ {
+ frequencyBinCount: 4096,
+ getByteFrequencyData(b) {
+ for (let i = 0; i < b.length; ++i) {
+ b[i] = Math.sin(inputs.time * 10 + i * 0.1) * 0.2 * 127 + 127;
+ }
+ },
+ },
+ ]);
+ };
+ },
+ form({uiElem}) {
+ const s = {
+ name: "Jane Cheng",
+ address1: "B 1, No. 5, Xuzhou R",
+ address2: "Taipei 100218",
+ email: "jane_c@notreally.notcom",
+ receipt: true,
+ currency: '$',
+ };
+
+ const gui = new GUI(uiElem).name('');
+ gui.setTheme('form');
+ gui.add(s, 'name');
+ gui.add(s, 'address1');
+ gui.add(s, 'address2');
+ gui.add(s, 'email');
+ gui.add(s, 'receipt');
+ gui.add(s, 'currency', ['$', '¥', '€', '£', '₣']);
+ gui.addButton('submit', () => {});
+ },
+};
+
+document.querySelectorAll('[data-section]').forEach(elem => {
+ const uiElem = elem.querySelector('.ui');
+ const effectElem = elem.querySelector('.effect');
+ const fn = sections[elem.dataset.section];
+ if (!fn) {
+ console.error(`no effect: '${elem.dataset.section}'`);
+ return;
+ }
+ const render = fn({elem, uiElem, effectElem});
+ if (render) {
+ elements.push({
+ elem: effectElem,
+ render,
+ });
+ }
+});
+
+const getNextId = (() => {
+ let nextId = 0;
+ return function getNextId() {
+ return `gui-${nextId++}`;
+ };
+})();
+
+window.GUI = GUI;
+window.TextNumber = TextNumber;
+window.randElem = (arr) => arr[Math.random() * arr.length | 0];
+window.helpers = helpers;
+
+function getSupportCode({logId, code}) {
+ return `
+${code}
+
+function log(...args) {
+ const logElem = document.querySelector('#${logId}');
+ logElem.className = 'log';
+ const lineNo = parseInt(logElem.dataset.lineNo || 1);
+ const lines = logElem.textContent.split('\\n');
+ lines.push(\`\${lineNo}: \${args.join(' ')}\`);
+ if (lines.length > 3) {
+ lines.shift();
+ }
+ logElem.textContent = lines.join('\\n');
+ logElem.dataset.lineNo = lineNo + 1;
+}
+`;
+}
+
+document.querySelectorAll('[data-example]').forEach(elem => {
+ const pre = elem.querySelector('pre');
+ const div = document.createElement('div');
+ const id = getNextId();
+ div.id = id;
+ div.className = 'ui';
+ elem.appendChild(div);
+
+ const logElem = document.createElement('pre');
+ const logId = getNextId();
+ logElem.id = logId;
+ elem.appendChild(logElem);
+
+ const extra = elem.dataset.extraCode || '';
+ const code = elem.querySelector('code').textContent
+ .replace('GUI()', `GUI(document.querySelector('#${id}'))`)
+ .replace(/import(.*?)'(\/.*?)'/g, `import$1'${window.location.origin}$2'`);
+ const script = document.createElement('script');
+ script.type = 'module';
+ script.text = getSupportCode({logId, code: `${code}\n${extra}`});
+ pre.appendChild(script);
+});
+
+/* global hljs */
+document.querySelectorAll('pre>code').forEach(elem => {
+ elem.textContent = elem.textContent.trim();
+});
+hljs.highlightAll();
+
+// show min/max
+
+// show slider
+// show direction
+// show vec2
+// show folder
+// show onChange
+ // show onChange of folder
+// make button function so no need for prop
+
+// save/restore?
+// show float
+// show form
diff --git a/examples/js/index-umd.js b/examples/js/lots-umd.js
similarity index 67%
rename from examples/js/index-umd.js
rename to examples/js/lots-umd.js
index 6033f92..69d0d6c 100644
--- a/examples/js/index-umd.js
+++ b/examples/js/lots-umd.js
@@ -1,5 +1,6 @@
-
-import {cube} from './cube.js';
+/* eslint-disable no-constant-condition */
+/* global GUI */
+import {model} from './model.js';
import Logger from './logger.js';
import {
getCSSRulesBySelector,
@@ -13,9 +14,11 @@ const ColorChooser = GUI.ColorChooser; // from '../../src/controllers/ColorChoos
const RadioGrid = GUI.RadioGrid; // from '../../src/controllers/RadioGrid.js';
const Slider = GUI.Slider; // from '../../src/controllers/Slider.js';
const Select = GUI.Select; // from '../../src/controllers/Select.js';
-const Range = GUI.Range; // from '../../src/controllers/Range.js';
+//const Range = GUI.Range; // from '../../src/controllers/Range.js';
const TextNumber = GUI.TextNumber; // from '../../src/controllers/TextNumber.js';
+/* cut-here */
+
const uiElem = document.querySelector('#ui');
const logElem = document.querySelector('#log');
@@ -33,17 +36,18 @@ const log = (...args) => logImpl('inherit', ...args);
// Using an invisible GUI to get the colors
// In a real app we'd just use the GUI we created
// but I don't want to clutter the other examples.
-let uiColors;
-const updateUIColors = (() => {
+let uiCSSColorVariableNames;
+const getListOfUIColorCSSVariableNames = (() => {
const div = document.createElement('div');
uiElem.appendChild(div);
const gui = new GUI(div).hide();
return function updateUIColors() {
- uiColors = gui.getColors();
+ uiCSSColorVariableNames = gui.getColors();
};
})();
-updateUIColors();
+getListOfUIColorCSSVariableNames();
+// eslint-disable-next-line no-constant-condition
if (false) {
const s = {
speed: 0.5,
@@ -56,8 +60,9 @@ if (false) {
gui.addColor(s, 'color');
}
-if (true) {
-{
+// eslint-disable-next-line no-constant-condition
+const showUI = true;
+if (showUI) {
const s = {
speed: 0.5,
direction: 45,
@@ -131,7 +136,6 @@ if (true) {
thicksColor: 'transparent',
}));
-
gui.addDivider();
gui.add(s, 'run');
gui.addLabel('Pet');
@@ -143,6 +147,7 @@ if (true) {
document.body.style.backgroundColor = v;
}).listen();
gui.add(s, 'show', {name: 'Show Current Values'});
+ gui.add({updateDisplay: () => gui.updateDisplay()}, 'updateDisplay');
if (i === 2) {
gui.name('Disabled');
@@ -157,34 +162,37 @@ if (true) {
f.add(s, 'hobby').onFinishChange(e => log(new Date(), e.value));
f.add(s, 'propertyWithLongName', ['longNamedEnumThatWillPushSizeTooFar']);
f.addController(new Direction(s, 'direction')).listen();
- f.addController(new Direction(s, 'hour', {step: 360 / 12, conversion: {
- to: v => {
- const newV = (v - 3) * 360 / 12;
- console.log('to:', v, newV);
- return newV;
- },
- from: v => {
- const newV = v * 12 / 360 + 3;
- console.log('from:', v, newV);
- return [true, newV];
+ f.addController(new Direction(s, 'hour', {
+ step: 360 / 12, conversion: {
+ to: v => {
+ const newV = (v - 3) * 360 / 12;
+ console.log('to:', v, newV);
+ return newV;
+ },
+ from: v => {
+ const newV = v * 12 / 360 + 3;
+ console.log('from:', v, newV);
+ return [true, newV];
+ },
},
- }})).listen();
+ })).listen();
f.addController(new Vec2(s, 'vec', {range: 100})).listen();
- f.addController(new ColorChooser(s, 'c2')).listen();
+ f.addController(new ColorChooser(s, 'c2'));//.listen();
const ctx = c.canvas.getContext('2d');
let lastY = 0;
let lTime1 = 0;
let lTime2 = 0;
let then = 0;
- function draw(now) {
+ // eslint-disable-next-line no-loop-func
+ const draw = (now) => {
const elapsedTime = now - then;
then = now;
lTime1 += elapsedTime * s.period1;
lTime2 += elapsedTime * s.period2;
const res = 2;
resizeCanvasToDisplaySize(ctx.canvas, res);
-
+
const width = ctx.canvas.width;
const height = ctx.canvas.height;
if (width && height) {
@@ -196,7 +204,7 @@ if (true) {
0, 0, width - res, height);
ctx.clearRect(width - res, 0, res, height);
ctx.globalCompositeOperation = 'source-over';
- ctx.strokeStyle = uiColors.color;
+ ctx.strokeStyle = uiCSSColorVariableNames.color;
const s1 = Math.sin(lTime1 * 0.01);
const s2 = Math.sin(lTime2 * 0.01);
const newY = height / 2 + (s1 + s2) * (height - 1) / 4;
@@ -207,13 +215,13 @@ if (true) {
lastY = newY;
}
requestAnimationFrame(draw);
- }
+ };
requestAnimationFrame(draw);
}
}
// Using Sliders
-{
+if (showUI) {
const div = document.createElement('div');
uiElem.appendChild(div);
const gui = new GUI({parent: div, title: 'Sliders'});
@@ -254,7 +262,7 @@ if (true) {
}
// Using TextNumber
-{
+if (showUI) {
const div = document.createElement('div');
uiElem.appendChild(div);
const gui = new GUI({parent: div, title: 'Numbers'});
@@ -296,7 +304,7 @@ if (true) {
logger.setController(gui.addLabel(''));
}
-{
+if (showUI) {
const div = document.createElement('div');
uiElem.appendChild(div);
const gui = new GUI({parent: div, title: 'Callbacks'});
@@ -319,7 +327,7 @@ if (true) {
gui.add({func() {}}, 'func').onChange(change).onFinishChange(finishChange);
}
-{
+if (showUI) {
const div = document.createElement('div');
uiElem.appendChild(div);
const gui = new GUI(div).name('Colors');
@@ -341,7 +349,7 @@ if (true) {
addColor('"RGB"', '8F8');
addColor('"rgb(r, g, b)"', 'rgb(170,68,240)');
addColor('"hsl(h, s, l)"', 'hsl(170,100%,50%)');
- addColor('0xRRGGBB', 0xFEA956, undefined, v => `0x${v.toString(16).padStart(6, '0')}`);
+ addColor('0xRRGGBB', 0xFEA956, 'uint32-rgb', v => `0x${v.toString(16).padStart(6, '0')}`);
addColor('[r(u8), b(u8), c(u8)]', [255, 192, 255], 'uint8-rgb');
addColor('Uint8Array(3)', new Uint8Array([75, 150, 225]), undefined, v => `[${v.join(', ')}]`);
// note: Because it's Float32Array, if we just use map it won't work because
@@ -350,15 +358,20 @@ if (true) {
addColor('Float32Array(3)', new Float32Array([0.9, 0.7, 0.5]), undefined, v => `[${Array.from(v).map(v => f3(v)).join(', ')}]`);
addColor('[r(f), g(f), b(f)]', [0.2, 0.9, 0.5], undefined, v => `[${v.map(v => f3(v))}]`);
addColor('{r, g, b}', {r: 0, g: 0, b: 1}, undefined, v => `{r: ${f3(v.r)}, g: ${f3(v.g)}, b: ${f3(v.b)}}`);
+ gui.addLabel('rgba');
+ addColor('#RRGGBBAA', '#5438a180');
+ addColor('0xRRGGBBAA', 0xEF569A80, 'uint32-rgba');
+ addColor('rgba(r, g, b, a)', 'rgba(64, 128, 255, 0.25)');
+ addColor('hsl(h, s, l / a)', 'hsl(180 100% 50% / 0.75)');
logger.setController(gui.addLabel(''));
}
-{
+if (showUI) {
const div = document.createElement('div');
uiElem.appendChild(div);
const gui = new GUI(div).name('Material');
- const s = cube(gui.addCanvas('canvas').canvas);
+ const s = model(gui.addCanvas('canvas').canvas);
gui.addColor(s.material, 'color').name('material color');
gui.add(s.material, 'shininess', {min: 0, max: 300});
gui.addColor(s.light, 'color').name('light color');
@@ -366,7 +379,7 @@ if (true) {
gui.add(s.camera, 'fov', {min: 1, max: 179}).name('field of view');
}
-{
+if (showUI) {
const div = document.createElement('div');
uiElem.appendChild(div);
const gui = new GUI({parent: div, title: 'Add/Remove'});
@@ -374,19 +387,19 @@ if (true) {
const controllers = [];
const periods = [];
- function addRow() {
+ const addRow = () => {
const id = controllers.length;
periods.push(Math.random() * 2.5 + 0.5);
controllers.push(gui.add(periods, id, 0, 3).name(`input ${id + 1}`));
- }
+ };
- function delRow() {
+ const delRow = () => {
const row = controllers.pop();
if (row) {
periods.pop();
gui.remove(row);
}
- }
+ };
const s = {separate: true};
gui.add(s, 'separate');
@@ -402,7 +415,7 @@ if (true) {
const lastYs = [];
const times = [];
- function draw(now) {
+ const draw = (now) => {
++ticks;
const elapsedTime = now - then;
then = now;
@@ -426,9 +439,9 @@ if (true) {
0, 0, width - res, height);
ctx.globalCompositeOperation = 'source-over';
const x = width - res;
- ctx.fillStyle = ticks % 16 === 0 ? uiColors.menuSepColor : uiColors.menuBgColor;
+ ctx.fillStyle = ticks % 16 === 0 ? uiCSSColorVariableNames.menuSepColor : uiCSSColorVariableNames.menuBgColor;
ctx.fillRect(x, 0, res, height);
- ctx.fillStyle = uiColors.menuSepColor;
+ ctx.fillStyle = uiCSSColorVariableNames.menuSepColor;
for (let y = 8; y < height; y += 16) {
ctx.fillRect(x, y, 1, 1);
}
@@ -457,18 +470,18 @@ if (true) {
}
}
requestAnimationFrame(draw);
- }
+ };
requestAnimationFrame(draw);
}
-{
- function makeGUI(title, num) {
+if (showUI) {
+ const makeGUI = (title, num) => {
const gui = new GUI({title}).hide();
for (let i = 0; i < num; ++i) {
gui.add([Math.random()], '0', {min: 0, max: 1}).name(`value ${i}`);
}
return gui;
- }
+ };
const guis = {
short: makeGUI('Short', 5),
@@ -486,22 +499,42 @@ if (true) {
});
}
-const updateAppearance = function() {
-
- const themeElem = document.createElement('style');
- document.head.appendChild(themeElem);
- const styleElem = document.createElement('style');
- document.head.appendChild(styleElem);
-
+{
+ const pageCSS = `
+ #ui-helper {
+ display: grid;
+ grid-template-columns: repeat(auto-fit, 250px); /* as as column width */
+ gap: 10px; /* same as column gap */
+ }
+ #ui {
+ columns: 250px;
+ column-gap: 10px;
+ orphans: 1;
+ widows: 1;
+ grid-column: 1 / -1; /* take all the columns of the grid*/
+ }
+ #ui>div {
+ break-inside: avoid-column;
+ margin-bottom: 1em;
+ display: inline-block;
+ }
+ `;
const themes = {
- default: '',
- 'default-mono': `
+ default: {
+ muigui: '/* empty */',
+ page: '',
+ },
+ 'default-mono': {
+ muigui: `
.muigui {
--font-family: Menlo, Monaco, Consolas, "Droid Sans Mono", monospace;
}
- `,
- light: `
- .muigui {
+ `,
+ page: pageCSS,
+ },
+ light: {
+ muigui: `
+ .muigui-colors {
--bg-color: #f6f6f6;
--color: #3d3d3d;
--value-color: #2b95a1;
@@ -513,9 +546,12 @@ const updateAppearance = function() {
--invalid-color: #FF0000;
--selected-color: rgba(0, 0, 0, 0.1);
}
- `,
- 'solarized-light': `
- .muigui {
+ `,
+ page: '',
+ },
+ 'solarized-light': {
+ muigui: `
+ .muigui-colors {
--bg-color: #fdf6e3;
--color: #657b83;
--value-color: #2aa0f3;
@@ -527,9 +563,12 @@ const updateAppearance = function() {
--invalid-color: #FF0000;
--selected-color: rgba(0, 0, 0, 0.1);
}
- `,
- 'solarized-dark': `
- .muigui {
+ `,
+ page: pageCSS,
+ },
+ 'solarized-dark': {
+ muigui: `
+ .muigui-colors {
--bg-color: #002b36;
--color: #b2c2c2;
--value-color: #5abaff;
@@ -540,13 +579,93 @@ const updateAppearance = function() {
--hover-bg-color: #0a6277;
--invalid-color: #FF6666;
}
- `,
- 'bubble-dark': `
+ `,
+ page: '',
+ },
+ 'bubble-dark': {
+ muigui: `
.muigui {
--border-radius: 1em;
}
- `,
- 'form': `
+ `,
+ page: pageCSS,
+ },
+ 'float': {
+ muigui: `
+ :root {
+ color-scheme: light dark,
+ }
+
+ .muigui {
+ --width: 400px;
+ --bg-color: inherit;
+ --color: inherit;
+ --label-width: 25%;
+ }
+
+ input {
+ text-shadow:
+ -1px -1px 0 #FFF,
+ 1px -1px 0 #FFF,
+ -1px 1px 0 #FFF,
+ 1px 1px 0 #FFF;
+ }
+ .muigui-label-controller>label {
+ text-shadow:
+ -1px -1px 0 #000,
+ 1px -1px 0 #000,
+ -1px 1px 0 #000,
+ 1px 1px 0 #000;
+ }
+
+ .muigui-root>*:nth-child(1) {
+ display: none;
+ }
+
+ .muigui-range input[type=range]::-webkit-slider-thumb {
+ border-radius: 1em;
+ }
+
+ .muigui-range input[type=range]::-webkit-slider-runnable-track {
+ -webkit-appearance: initial;
+ appearance: none;
+ border: 1px solid rgba(0, 0, 0, 0.25);
+ height: 2px;
+ }
+
+ .muigui-colors {
+ --value-color: #000000;
+ --value-bg-color: rgba(0, 0, 0, 0.1);
+ --disabled-color: #cccccc;
+ --menu-bg-color: rgba(0, 0, 0, 0.1);
+ --menu-sep-color: #bbbbbb;
+ --hover-bg-color: rgba(0, 0, 0, 0);
+ --invalid-color: #FF0000;
+ --selected-color: rgba(0, 0, 0, 0.3);
+ --range-color: rgba(0, 0, 0, 0.125);
+ }
+ `,
+ page: `
+ #ui-helper {
+ display: block;
+ }
+ #ui {
+ columns: none;
+ }
+ #ui>div {
+ break-inside: avoid-column;
+ margin-bottom: 1em;
+ display: block;
+ }
+
+ body {
+ background: rgb(34,193,195);
+ background: linear-gradient(209deg, rgba(34,193,195,1) 0%, rgba(253,187,45,1) 100%);
+ }
+ `,
+ },
+ 'form': {
+ muigui: `
:root {
color-scheme: light dark,
}
@@ -558,7 +677,9 @@ const updateAppearance = function() {
--font-size-mono: medium;
--bg-color: inherit;
--color: inherit;
+ }
+ .muigui-colors {
--value-color: #2b95a1;
--value-bg-color: #e8e8e8;
--disabled-color: #cccccc;
@@ -567,81 +688,120 @@ const updateAppearance = function() {
--hover-bg-color: #f0f0f0;
--invalid-color: #FF0000;
--selected-color: rgba(0, 0, 0, 0.1);
-
}
- `,
+ `,
+ page: pageCSS,
+ },
};
+ const cssColorRE = /^\s*(#|rgb|hsl|lab|hwb|lab|lch|oklch|oklab)/;
+ const looksLikeCSSColor = s => cssColorRE.test(s);
+
+ const cssColorToRGBA8 = (() => {
+ const canvas = document.createElement('canvas');
+ canvas.width = 1;
+ canvas.height = 1;
+ const ctx = canvas.getContext('2d', {willReadFrequently: true});
+ return cssColor => {
+ ctx.clearRect(0, 0, 1, 1);
+ ctx.fillStyle = cssColor;
+ ctx.fillRect(0, 0, 1, 1);
+ return Array.from(ctx.getImageData(0, 0, 1, 1).data);
+ };
+ })();
+
+ const cssStringToHexColor = s => `#${cssColorToRGBA8(s).slice(0, 3).map(v => v.toString(16).padStart(2, '0')).join('')}`;
+
+
+ // --------------- [ get list of CSS variables that affect GUI ] -----------------
+ const selectors = ['.muigui', '.muigui-colors'];
+ const varNamesBySelector = selectors.map(selector => ({
+ selector,
+ vars: getCSSRulesBySelector(selector, GUI.getBaseStyleSheet())
+ .map(rule => Object.values(rule.style)
+ .filter(s => s.startsWith('--') && !rule.style.getPropertyValue(s).trim().startsWith('var'))
+ .map(s => ({key: s, rule}))).flat(),
+ }));
+
+ const showStyles = false;
+
const div = document.createElement('div');
uiElem.appendChild(div);
const gui = new GUI(div).name('Appearance');
gui.addController(new Select({theme: 'default'}, 'theme', {keyValues: [...Object.keys(themes)]})).onChange(v => {
- themeElem.textContent = themes[v];
- styleElem.textContent = '';
- updateAppearance();
+ GUI.setUserStyles(themes[v].muigui);
+ document.querySelector('#theme').innerText = themes[v].page;
+ if (showStyles) {
+ updateGUIValuesWithCurrentCSSValues();
+ }
});
- const cssStringToHexColor = s => s.length === 7
- ? s
- : `#${s[1]}${s[1]}${s[2]}${s[2]}${s[3]}${s[3]}`;
-
- const fns = {
- '--width': (v) => {
- uiElem.style.columnWidth = v;
- uiElem.parentElement.style.gridTemplateColumns = `repeat(auto-fit, ${v})`;
- },
- };
-
- const folder = gui.addFolder('Style');
- const rule = getCSSRulesBySelector('.muigui')[0]; // assuming the first one
- const varNames = Object.values(rule.style).filter(s => s.startsWith('--'));
- const obj = {};
const controllersByKey = {};
+ if (showStyles) {
+ const fns = {
+ '--width': (v) => {
+ uiElem.style.columnWidth = v;
+ uiElem.parentElement.style.gridTemplateColumns = `repeat(auto-fit, ${v})`;
+ },
+ };
- const updateStyles = () => {
- styleElem.textContent = `.muigui {\n${
- [...Object.entries(obj)].map(([key, value]) => {
- return `${key}: ${value};`;
- }).join('\n')}\n}`;
- updateUIColors();
- };
+ // --------------- [ make a GUI for each CSS variable that affects GUI ] -----------------
+ const obj = {};
- for (const key of varNames) {
- const value = rule.style.getPropertyValue(key).trim();
- if (value.startsWith('#')) {
- obj[key] = cssStringToHexColor(value);
- controllersByKey[key] = folder.addColor(obj, key).onChange(updateStyles);
- } else if (!value.startsWith('var')){
- obj[key] = value;
- controllersByKey[key] = folder.add(obj, key).onChange(v => {
- const fn = fns[key];
- if (fn) {
- fn(v);
+ const folder = gui.addFolder('Style');
+ for (const {vars} of varNamesBySelector) {
+ for (const {key, rule} of vars) {
+ const value = rule.style.getPropertyValue(key).trim();
+ if (looksLikeCSSColor(value)) {
+ obj[key] = cssStringToHexColor(value);
+ controllersByKey[key] = folder.addColor(obj, key).onChange(updateMuiguiCSSStyles);
+ } else if (!value.startsWith('var')){
+ obj[key] = value;
+ controllersByKey[key] = folder.add(obj, key).onChange(v => {
+ const fn = fns[key];
+ if (fn) {
+ fn(v);
+ }
+ updateMuiguiCSSStyles();
+ });
}
- updateStyles();
- });
+ }
}
+
+ // --------------
+
+ const updateMuiguiCSSStyles = () => {
+ const css = varNamesBySelector.map(({selector, vars}) => `
+ ${selector} {
+ ${
+ vars.map(({key}) => `${key}: ${obj[key]};`).join('\n')
+ }
+ }
+ `).join('\n');
+ GUI.setUserStyles(css);
+ };
}
- return function() {
+ // --------------
+ const updateGUIValuesWithCurrentCSSValues = () => {
const map = new Map();
- for (const rule of getCSSRulesBySelector('.muigui')) {
- const varNames = Object.values(rule.style).filter(s => s.startsWith('--'));
- for (const key of varNames) {
- const value = rule.style.getPropertyValue(key).trim();
- map.set(key, value);
+ for (const selector of selectors) {
+ for (const rule of getCSSRulesBySelector(selector, GUI.getBaseStyleSheet())) {
+ const varNames = Object.values(rule.style).filter(s => s.startsWith('--'));
+ for (const key of varNames) {
+ const value = rule.style.getPropertyValue(key).trim();
+ map.set(key, value);
+ }
}
+ map.forEach((value, key) => {
+ const controller = controllersByKey[key];
+ if (controller) {
+ controller.setValue(looksLikeCSSColor(value) ? cssStringToHexColor(value) : value);
+ } else {
+ console.warn(`no setting in this theme for: ${key}`);
+ }
+ });
}
- map.forEach((value, key) => {
- const controller = controllersByKey[key];
- if (controller) {
- controller.setValue(value);
- } else {
- console.warn(`no setting in this theme for: ${key}`);
- }
- });
- updateUIColors();
+ getListOfUIColorCSSVariableNames();
};
-}();
-
}
diff --git a/examples/js/index.js b/examples/js/lots.js
similarity index 97%
rename from examples/js/index.js
rename to examples/js/lots.js
index 263e0b3..4592881 100644
--- a/examples/js/index.js
+++ b/examples/js/lots.js
@@ -1,6 +1,6 @@
import {GUI} from '../../src/muigui.js';
-import {cube} from './cube.js';
+import {model} from './model.js';
import Logger from './logger.js';
import {
getCSSRulesBySelector,
@@ -17,6 +17,8 @@ import Select from '../../src/controllers/Select.js';
// import Range from '../../src/controllers/Range.js';
import TextNumber from '../../src/controllers/TextNumber.js';
+/* cut-here */
+
const uiElem = document.querySelector('#ui');
const logElem = document.querySelector('#log');
@@ -182,7 +184,8 @@ if (showUI) {
let lTime1 = 0;
let lTime2 = 0;
let then = 0;
- function draw(now) {
+ // eslint-disable-next-line no-loop-func
+ const draw = (now) => {
const elapsedTime = now - then;
then = now;
lTime1 += elapsedTime * s.period1;
@@ -212,7 +215,7 @@ if (showUI) {
lastY = newY;
}
requestAnimationFrame(draw);
- }
+ };
requestAnimationFrame(draw);
}
}
@@ -228,6 +231,7 @@ if (showUI) {
angleDeg: 180,
tempC: 20,
tempF: 72,
+ ticks: 7,
};
const logger = new Logger(3);
const log = logger.log;
@@ -254,7 +258,6 @@ if (showUI) {
gui.add(s, 'tempF', {min: 0, max: 100, step: 0.1, converters: {to: fToC, from: v => [true, cToF(v)]}})
.name('F° ↔ C°')
.onChange(v => log(`${v}F°`));
-
logger.setController(gui.addLabel(''));
}
@@ -308,7 +311,10 @@ if (showUI) {
const changes = { onChange: 0, onFinishChange: 0 };
const change = () => changes.onChange++;
- const finishChange = () => changes.onFinishChange++;
+ const finishChange = () => {
+ console.log('fiinsh change');
+ changes.onFinishChange++;
+ };
const folder = gui.addFolder('Counts');
folder.add(changes, 'onChange').disable().listen();
@@ -368,7 +374,7 @@ if (showUI) {
uiElem.appendChild(div);
const gui = new GUI(div).name('Material');
- const s = cube(gui.addCanvas('canvas').canvas);
+ const s = model(gui.addCanvas('canvas').canvas);
gui.addColor(s.material, 'color').name('material color');
gui.add(s.material, 'shininess', {min: 0, max: 300});
gui.addColor(s.light, 'color').name('light color');
@@ -384,19 +390,19 @@ if (showUI) {
const controllers = [];
const periods = [];
- function addRow() {
+ const addRow = () => {
const id = controllers.length;
periods.push(Math.random() * 2.5 + 0.5);
controllers.push(gui.add(periods, id, 0, 3).name(`input ${id + 1}`));
- }
+ };
- function delRow() {
+ const delRow = () => {
const row = controllers.pop();
if (row) {
periods.pop();
gui.remove(row);
}
- }
+ };
const s = {separate: true};
gui.add(s, 'separate');
@@ -412,7 +418,7 @@ if (showUI) {
const lastYs = [];
const times = [];
- function draw(now) {
+ const draw = (now) => {
++ticks;
const elapsedTime = now - then;
then = now;
@@ -467,18 +473,18 @@ if (showUI) {
}
}
requestAnimationFrame(draw);
- }
+ };
requestAnimationFrame(draw);
}
if (showUI) {
- function makeGUI(title, num) {
+ const makeGUI = (title, num) => {
const gui = new GUI({title}).hide();
for (let i = 0; i < num; ++i) {
gui.add([Math.random()], '0', {min: 0, max: 1}).name(`value ${i}`);
}
return gui;
- }
+ };
const guis = {
short: makeGUI('Short', 5),
@@ -767,7 +773,7 @@ if (showUI) {
// --------------
- function updateMuiguiCSSStyles() {
+ const updateMuiguiCSSStyles = () => {
const css = varNamesBySelector.map(({selector, vars}) => `
${selector} {
${
@@ -776,11 +782,11 @@ if (showUI) {
}
`).join('\n');
GUI.setUserStyles(css);
- }
+ };
}
// --------------
- function updateGUIValuesWithCurrentCSSValues() {
+ const updateGUIValuesWithCurrentCSSValues = () => {
const map = new Map();
for (const selector of selectors) {
for (const rule of getCSSRulesBySelector(selector, GUI.getBaseStyleSheet())) {
@@ -800,5 +806,5 @@ if (showUI) {
});
}
getListOfUIColorCSSVariableNames();
- }
+ };
}
diff --git a/examples/js/cube.js b/examples/js/model.js
similarity index 95%
rename from examples/js/cube.js
rename to examples/js/model.js
index c1bb760..c1f49e3 100644
--- a/examples/js/cube.js
+++ b/examples/js/model.js
@@ -1,7 +1,8 @@
+/* eslint-disable no-constant-condition */
import * as THREE from '../3rdParty/threejs/build/three.module.js';
import {TrackballControls} from '../3rdParty/threejs/examples/jsm/controls/TrackballControls.js';
-export function cube(canvas) {
+export function model(canvas) {
const renderer = new THREE.WebGLRenderer({canvas, alpha: true});
const scene = new THREE.Scene();
@@ -30,7 +31,7 @@ export function cube(canvas) {
const meshes = [];
const material = new THREE.MeshPhongMaterial({
- color: 'red',
+ color: 'red',
shininess: 150,
flatShading: true,
});
@@ -43,7 +44,7 @@ export function cube(canvas) {
meshes.push(mesh);
}
- if(0){
+ if (0) {
const geometry = new THREE.SphereGeometry(0.8, 12, 6);
const mesh = new THREE.Mesh(geometry, material);
mesh.position.x = -1.5;
@@ -51,7 +52,7 @@ export function cube(canvas) {
meshes.push(mesh);
}
- if(0){
+ if (0) {
const geometry = new THREE.TorusGeometry(0.4, 0.3, 6, 12);
const mesh = new THREE.Mesh(geometry, material);
mesh.position.x = 1.5;
@@ -68,7 +69,7 @@ export function cube(canvas) {
controls.handleResize();
controls.update();
renderer.render(scene, camera);
- };
+ }
function resizeRendererToDisplaySize(renderer, mult = 1) {
const canvas = renderer.domElement;
diff --git a/examples/layout/layout.js b/examples/layout/layout.js
index 4c7ac32..2976792 100644
--- a/examples/layout/layout.js
+++ b/examples/layout/layout.js
@@ -1,17 +1,17 @@
-import {
- Column,
- Frame,
- Grid,
- Row,
-} from '../../src/muigui.js';
-
-const elem = document.querySelector('#ui');
-
-
-const root = new Column();
-const topRow = root.add(new Row());
-const midRow = root.add(new Row());
-const botRow = root.add(new Row());
+//import {
+// Column,
+// Frame,
+// Grid,
+// Row,
+//} from '../../src/muigui.js';
+//
+//const elem = document.querySelector('#ui');
+//
+//
+//const root = new Column();
+//const topRow = root.add(new Row());
+//const midRow = root.add(new Row());
+//const botRow = root.add(new Row());
/*
@@ -19,7 +19,7 @@ const botRow = root.add(new Row());
|+-[Row]------------------------
||+-[Frame(fixed)]-++-[Frame(stretch-h)]-
||| ||
-||+--
+||+--
|
+---
diff --git a/index-umd.html b/examples/lots-umd.html
similarity index 95%
rename from index-umd.html
rename to examples/lots-umd.html
index 9778b2a..efd8e7e 100644
--- a/index-umd.html
+++ b/examples/lots-umd.html
@@ -89,10 +89,10 @@ muigui
-
+