@oliversalzburg/js-utils 0.0.27-dev.0 → 0.0.27-dev.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -2,6 +2,20 @@
|
|
|
2
2
|
import { Random } from "../random.js";
|
|
3
3
|
import { Canvas } from "./canvas.js";
|
|
4
4
|
import { RenderLoop } from "./render-loop.js";
|
|
5
|
+
/**
|
|
6
|
+
* Provides the input as-is.
|
|
7
|
+
*
|
|
8
|
+
* This method exists only to make use of the template string tag in code,
|
|
9
|
+
* which allows us to use in-IDE support for CSS, even if there is no build
|
|
10
|
+
* process to interpret the tag.
|
|
11
|
+
* {@link https://lit.dev/docs/components/styles/ | Lit styles}.
|
|
12
|
+
* @param input - The CSS code.
|
|
13
|
+
* @returns The CSS code as-is.
|
|
14
|
+
* @group Strings
|
|
15
|
+
* @group Tags
|
|
16
|
+
* @group Graphics
|
|
17
|
+
*/
|
|
18
|
+
export declare const css: (input: TemplateStringsArray) => string;
|
|
5
19
|
/**
|
|
6
20
|
* The CSS we inject into the document, if requested.
|
|
7
21
|
* @group Graphics
|
|
@@ -4,13 +4,18 @@ import { nextPalette } from "./core.js";
|
|
|
4
4
|
import { RenderLoop } from "./render-loop.js";
|
|
5
5
|
/**
|
|
6
6
|
* Provides the input as-is.
|
|
7
|
-
*
|
|
8
|
-
*
|
|
7
|
+
*
|
|
8
|
+
* This method exists only to make use of the template string tag in code,
|
|
9
|
+
* which allows us to use in-IDE support for CSS, even if there is no build
|
|
10
|
+
* process to interpret the tag.
|
|
9
11
|
* {@link https://lit.dev/docs/components/styles/ | Lit styles}.
|
|
10
12
|
* @param input - The CSS code.
|
|
11
13
|
* @returns The CSS code as-is.
|
|
14
|
+
* @group Strings
|
|
15
|
+
* @group Tags
|
|
16
|
+
* @group Graphics
|
|
12
17
|
*/
|
|
13
|
-
const css = (input) => input.join("");
|
|
18
|
+
export const css = (input) => input.join("");
|
|
14
19
|
/**
|
|
15
20
|
* The CSS we inject into the document, if requested.
|
|
16
21
|
* @group Graphics
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"canvas-sandbox.js","sourceRoot":"","sources":["../../source/graphics/canvas-sandbox.ts"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,OAAO,EAAE,0BAA0B,EAAE,MAAM,gBAAgB,CAAC;AAG5D,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C
|
|
1
|
+
{"version":3,"file":"canvas-sandbox.js","sourceRoot":"","sources":["../../source/graphics/canvas-sandbox.ts"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,OAAO,EAAE,0BAA0B,EAAE,MAAM,gBAAgB,CAAC;AAG5D,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,MAAM,GAAG,GAAG,CAAC,KAA2B,EAAU,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AAE3E;;;GAGG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAG,UAAU,CAAC,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoDvD,CAAC;AAqFF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsEG;AACH,MAAM,OAAO,aAAa;IAIxB;;OAEG;IACM,MAAM,CAAS;IAExB;;OAEG;IACM,QAAQ,CAAW;IAE5B;;OAEG;IACM,WAAW,CAAyD;IAE7E;;OAEG;IACM,UAAU,CAAoB;IAEvC;;;OAGG;IACM,MAAM,CAAU;IAEzB;;OAEG;IACM,UAAU,CAAa;IAEhC;;OAEG;IACH,eAAe,GAAkB,IAAI,CAA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;QACT,IAAI,CAAC,uBAAuB,CAAC;YAC3B,QAAQ,EAAE,KAAK;SACgB,CAAC,CAAC;QACnC,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;QACzC,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;IAC7C,CAAC;CACF"}
|
package/graphics/shader.d.ts
CHANGED
|
@@ -1,22 +1,32 @@
|
|
|
1
1
|
/// <reference types="@types/web" />
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
4
|
-
*
|
|
3
|
+
* Provides the input as-is.
|
|
4
|
+
*
|
|
5
|
+
* This method exists only to make use of the template string tag in code,
|
|
6
|
+
* which allows us to use in-IDE support for GLSL, even if there is no build
|
|
7
|
+
* process to interpret the tag.
|
|
5
8
|
* @param input - Should only be the source of a fragment shader.
|
|
6
9
|
* @returns The fragment shader as-is.
|
|
7
10
|
* @group Graphics
|
|
8
11
|
* @group GLSL
|
|
9
12
|
* @group WebGL
|
|
13
|
+
* @group Tags
|
|
14
|
+
* @group Strings
|
|
10
15
|
*/
|
|
11
16
|
export declare const frag: (input: TemplateStringsArray) => string;
|
|
12
17
|
/**
|
|
13
|
-
*
|
|
14
|
-
*
|
|
18
|
+
* Provides the input as-is.
|
|
19
|
+
*
|
|
20
|
+
* This method exists only to make use of the template string tag in code,
|
|
21
|
+
* which allows us to use in-IDE support for GLSL, even if there is no build
|
|
22
|
+
* process to interpret the tag.
|
|
15
23
|
* @param input - Should only be the source of a vertex shader.
|
|
16
24
|
* @returns The vertex shader as-is.
|
|
17
25
|
* @group Graphics
|
|
18
26
|
* @group GLSL
|
|
19
27
|
* @group WebGL
|
|
28
|
+
* @group Tags
|
|
29
|
+
* @group Strings
|
|
20
30
|
*/
|
|
21
31
|
export declare const vert: (input: TemplateStringsArray) => string;
|
|
22
32
|
/**
|
package/graphics/shader.js
CHANGED
|
@@ -1,23 +1,33 @@
|
|
|
1
1
|
import { InvalidOperationError } from "../errors/InvalidOperationError.js";
|
|
2
2
|
import { mustExist } from "../nil.js";
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
5
|
-
*
|
|
4
|
+
* Provides the input as-is.
|
|
5
|
+
*
|
|
6
|
+
* This method exists only to make use of the template string tag in code,
|
|
7
|
+
* which allows us to use in-IDE support for GLSL, even if there is no build
|
|
8
|
+
* process to interpret the tag.
|
|
6
9
|
* @param input - Should only be the source of a fragment shader.
|
|
7
10
|
* @returns The fragment shader as-is.
|
|
8
11
|
* @group Graphics
|
|
9
12
|
* @group GLSL
|
|
10
13
|
* @group WebGL
|
|
14
|
+
* @group Tags
|
|
15
|
+
* @group Strings
|
|
11
16
|
*/
|
|
12
17
|
export const frag = (input) => input.join();
|
|
13
18
|
/**
|
|
14
|
-
*
|
|
15
|
-
*
|
|
19
|
+
* Provides the input as-is.
|
|
20
|
+
*
|
|
21
|
+
* This method exists only to make use of the template string tag in code,
|
|
22
|
+
* which allows us to use in-IDE support for GLSL, even if there is no build
|
|
23
|
+
* process to interpret the tag.
|
|
16
24
|
* @param input - Should only be the source of a vertex shader.
|
|
17
25
|
* @returns The vertex shader as-is.
|
|
18
26
|
* @group Graphics
|
|
19
27
|
* @group GLSL
|
|
20
28
|
* @group WebGL
|
|
29
|
+
* @group Tags
|
|
30
|
+
* @group Strings
|
|
21
31
|
*/
|
|
22
32
|
export const vert = (input) => input.join();
|
|
23
33
|
/**
|
package/graphics/shader.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shader.js","sourceRoot":"","sources":["../../source/graphics/shader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAC;AAC3E,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAEtC
|
|
1
|
+
{"version":3,"file":"shader.js","sourceRoot":"","sources":["../../source/graphics/shader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MA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