visualcopium 1.0.2 → 1.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/dom.d.ts +33 -4
- package/dist/dom.d.ts.map +1 -1
- package/dist/dom.js +53 -27
- package/dist/dom.js.map +1 -1
- package/dist/index.d.ts +50 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +56 -2
- package/dist/index.js.map +1 -1
- package/dist/typing.d.ts +16 -3
- package/dist/typing.d.ts.map +1 -1
- package/dist/typing.js +1 -2
- package/dist/typing.js.map +1 -1
- package/package.json +2 -1
package/dist/dom.d.ts
CHANGED
|
@@ -1,11 +1,40 @@
|
|
|
1
|
-
import type { Vec2n
|
|
1
|
+
import type { Vec2n } from "./typing.js";
|
|
2
2
|
export type BrowserKey = "a" | "b" | "c" | "d" | "e" | "f" | "g" | "h" | "i" | "j" | "k" | "l" | "m" | "n" | "o" | "p" | "q" | "r" | "s" | "t" | "u" | "v" | "w" | "x" | "y" | "z" | "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" | "Space" | "Enter" | "Backspace" | "Tab" | "Escape" | "Shift" | "Ctrl" | "Alt" | "Up Arrow" | "Down Arrow" | "Left Arrow" | "Right Arrow" | "Caps Lock" | "Delete" | "Home" | "End" | "Page Up" | "Page Down" | "Insert" | "F1" | "F2" | "F3" | "F4" | "F5" | "F6" | "F7" | "F8" | "F9" | "F10" | "F11" | "F12" | "`" | "-" | "=" | "[" | "]" | "\\" | ";" | "'" | "," | "." | "/";
|
|
3
|
+
/**
|
|
4
|
+
* Code will run once the page finishes loading.
|
|
5
|
+
* @param callback Code block/function
|
|
6
|
+
*/
|
|
3
7
|
export declare function WhenFlagClicked(callback: () => void): void;
|
|
8
|
+
/**
|
|
9
|
+
* Code will run when a specific key is pressed.
|
|
10
|
+
* @param key Key to look for
|
|
11
|
+
* @param callback Code block/function
|
|
12
|
+
*/
|
|
4
13
|
export declare function WhenKeyPressed(key: BrowserKey, callback: () => void): void;
|
|
5
|
-
|
|
6
|
-
|
|
14
|
+
/**
|
|
15
|
+
* Returns whether a specific key is pressed.
|
|
16
|
+
* @param key Key to look for
|
|
17
|
+
* @returns Whether a specific key is pressed
|
|
18
|
+
*/
|
|
19
|
+
export declare function KeyPressed(key: BrowserKey): boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Returns whether the mouse is pressed down.
|
|
22
|
+
* @returns Whether the mouse is pressed down
|
|
23
|
+
*/
|
|
24
|
+
export declare function MouseDown(): boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Returns the mouse's position as a vector object. Use `MouseX();` and `MouseY();` for simplified return values!
|
|
27
|
+
* @returns Mouse's position (Vec2n)
|
|
28
|
+
*/
|
|
7
29
|
export declare function MousePosition(): Vec2n;
|
|
30
|
+
/**
|
|
31
|
+
* Return's the mouse's X position.
|
|
32
|
+
* @returns Mouse's X position
|
|
33
|
+
*/
|
|
8
34
|
export declare function MouseX(): number;
|
|
35
|
+
/**
|
|
36
|
+
* Return's the mouse's Y position.
|
|
37
|
+
* @returns Mouse's Y position
|
|
38
|
+
*/
|
|
9
39
|
export declare function MouseY(): number;
|
|
10
|
-
export declare function Ask(message: string): string;
|
|
11
40
|
//# sourceMappingURL=dom.d.ts.map
|
package/dist/dom.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dom.d.ts","sourceRoot":"","sources":["../src/dom.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"dom.d.ts","sourceRoot":"","sources":["../src/dom.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAA;AAExC,MAAM,MAAM,UAAU,GACnB,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG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dom.js
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Code will run once the page finishes loading.
|
|
3
|
+
* @param callback Code block/function
|
|
4
|
+
*/
|
|
2
5
|
export function WhenFlagClicked(callback) {
|
|
3
6
|
document.addEventListener("DOMContentLoaded", callback);
|
|
4
7
|
}
|
|
@@ -9,6 +12,11 @@ window.addEventListener("keypress", event => {
|
|
|
9
12
|
for (const listener of window.VC_keyPressListeners.get(event.key))
|
|
10
13
|
listener();
|
|
11
14
|
});
|
|
15
|
+
/**
|
|
16
|
+
* Code will run when a specific key is pressed.
|
|
17
|
+
* @param key Key to look for
|
|
18
|
+
* @param callback Code block/function
|
|
19
|
+
*/
|
|
12
20
|
export function WhenKeyPressed(key, callback) {
|
|
13
21
|
let domKey = "";
|
|
14
22
|
switch (key) {
|
|
@@ -62,67 +70,85 @@ export function WhenKeyPressed(key, callback) {
|
|
|
62
70
|
window.VC_pressedKeys = new Set();
|
|
63
71
|
window.addEventListener("keydown", event => window.VC_pressedKeys.add(event.key));
|
|
64
72
|
window.addEventListener("keyup", event => window.VC_pressedKeys.delete(event.key));
|
|
73
|
+
/**
|
|
74
|
+
* Returns whether a specific key is pressed.
|
|
75
|
+
* @param key Key to look for
|
|
76
|
+
* @returns Whether a specific key is pressed
|
|
77
|
+
*/
|
|
65
78
|
export function KeyPressed(key) {
|
|
66
79
|
switch (key) {
|
|
67
80
|
case "Space":
|
|
68
|
-
return window.VC_pressedKeys.has(" ")
|
|
81
|
+
return window.VC_pressedKeys.has(" ");
|
|
69
82
|
case "Enter":
|
|
70
|
-
return window.VC_pressedKeys.has("Enter")
|
|
83
|
+
return window.VC_pressedKeys.has("Enter");
|
|
71
84
|
case "Backspace":
|
|
72
|
-
return window.VC_pressedKeys.has("Backspace")
|
|
85
|
+
return window.VC_pressedKeys.has("Backspace");
|
|
73
86
|
case "Tab":
|
|
74
|
-
return window.VC_pressedKeys.has("Tab")
|
|
87
|
+
return window.VC_pressedKeys.has("Tab");
|
|
75
88
|
case "Escape":
|
|
76
|
-
return window.VC_pressedKeys.has("Escape")
|
|
89
|
+
return window.VC_pressedKeys.has("Escape");
|
|
77
90
|
case "Shift":
|
|
78
|
-
return window.VC_pressedKeys.has("Shift")
|
|
91
|
+
return window.VC_pressedKeys.has("Shift");
|
|
79
92
|
case "Ctrl":
|
|
80
|
-
return window.VC_pressedKeys.has("Control")
|
|
93
|
+
return window.VC_pressedKeys.has("Control");
|
|
81
94
|
case "Alt":
|
|
82
|
-
return window.VC_pressedKeys.has("Alt")
|
|
95
|
+
return window.VC_pressedKeys.has("Alt");
|
|
83
96
|
case "Up Arrow":
|
|
84
|
-
return window.VC_pressedKeys.has("ArrowUp")
|
|
97
|
+
return window.VC_pressedKeys.has("ArrowUp");
|
|
85
98
|
case "Down Arrow":
|
|
86
|
-
return window.VC_pressedKeys.has("ArrowDown")
|
|
99
|
+
return window.VC_pressedKeys.has("ArrowDown");
|
|
87
100
|
case "Left Arrow":
|
|
88
|
-
return window.VC_pressedKeys.has("ArrowLeft")
|
|
101
|
+
return window.VC_pressedKeys.has("ArrowLeft");
|
|
89
102
|
case "Right Arrow":
|
|
90
|
-
return window.VC_pressedKeys.has("ArrowRight")
|
|
103
|
+
return window.VC_pressedKeys.has("ArrowRight");
|
|
91
104
|
case "Caps Lock":
|
|
92
|
-
return window.VC_pressedKeys.has("CapsLock")
|
|
105
|
+
return window.VC_pressedKeys.has("CapsLock");
|
|
93
106
|
case "Delete":
|
|
94
|
-
return window.VC_pressedKeys.has("Delete")
|
|
107
|
+
return window.VC_pressedKeys.has("Delete");
|
|
95
108
|
case "Home":
|
|
96
|
-
return window.VC_pressedKeys.has("Home")
|
|
109
|
+
return window.VC_pressedKeys.has("Home");
|
|
97
110
|
case "End":
|
|
98
|
-
return window.VC_pressedKeys.has("End")
|
|
111
|
+
return window.VC_pressedKeys.has("End");
|
|
99
112
|
case "Page Up":
|
|
100
|
-
return window.VC_pressedKeys.has("PageUp")
|
|
113
|
+
return window.VC_pressedKeys.has("PageUp");
|
|
101
114
|
case "Page Down":
|
|
102
|
-
return window.VC_pressedKeys.has("PageDown")
|
|
115
|
+
return window.VC_pressedKeys.has("PageDown");
|
|
103
116
|
case "Insert":
|
|
104
|
-
return window.VC_pressedKeys.has("Insert")
|
|
117
|
+
return window.VC_pressedKeys.has("Insert");
|
|
105
118
|
default:
|
|
106
|
-
return window.VC_pressedKeys.has(key)
|
|
119
|
+
return window.VC_pressedKeys.has(key);
|
|
107
120
|
}
|
|
108
121
|
}
|
|
109
|
-
window.VC_mouseDown =
|
|
110
|
-
window.addEventListener("mousedown", () => (window.VC_mouseDown =
|
|
111
|
-
window.addEventListener("mouseup", () => (window.VC_mouseDown =
|
|
122
|
+
window.VC_mouseDown = false;
|
|
123
|
+
window.addEventListener("mousedown", () => (window.VC_mouseDown = true));
|
|
124
|
+
window.addEventListener("mouseup", () => (window.VC_mouseDown = false));
|
|
125
|
+
/**
|
|
126
|
+
* Returns whether the mouse is pressed down.
|
|
127
|
+
* @returns Whether the mouse is pressed down
|
|
128
|
+
*/
|
|
112
129
|
export function MouseDown() {
|
|
113
130
|
return window.VC_mouseDown;
|
|
114
131
|
}
|
|
115
132
|
const mouse_position = { x: 0, y: 0 };
|
|
133
|
+
/**
|
|
134
|
+
* Returns the mouse's position as a vector object. Use `MouseX();` and `MouseY();` for simplified return values!
|
|
135
|
+
* @returns Mouse's position (Vec2n)
|
|
136
|
+
*/
|
|
116
137
|
export function MousePosition() {
|
|
117
138
|
return { ...mouse_position };
|
|
118
139
|
}
|
|
140
|
+
/**
|
|
141
|
+
* Return's the mouse's X position.
|
|
142
|
+
* @returns Mouse's X position
|
|
143
|
+
*/
|
|
119
144
|
export function MouseX() {
|
|
120
145
|
return mouse_position.x;
|
|
121
146
|
}
|
|
147
|
+
/**
|
|
148
|
+
* Return's the mouse's Y position.
|
|
149
|
+
* @returns Mouse's Y position
|
|
150
|
+
*/
|
|
122
151
|
export function MouseY() {
|
|
123
152
|
return mouse_position.y;
|
|
124
153
|
}
|
|
125
|
-
export function Ask(message) {
|
|
126
|
-
return prompt(message, "");
|
|
127
|
-
}
|
|
128
154
|
//# sourceMappingURL=dom.js.map
|
package/dist/dom.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dom.js","sourceRoot":"","sources":["../src/dom.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"dom.js","sourceRoot":"","sources":["../src/dom.ts"],"names":[],"mappings":"AAkFA;;;GAGG;AACH,MAAM,UAAU,eAAe,CAAC,QAAoB;IACnD,QAAQ,CAAC,gBAAgB,CAAC,kBAAkB,EAAE,QAAQ,CAAC,CAAA;AACxD,CAAC;AAED,MAAM,CAAC,oBAAoB,GAAG,IAAI,GAAG,EAAE,CAAA;AACvC,MAAM,CAAC,gBAAgB,CAAC,UAAU,EAAE,KAAK,CAAC,EAAE;IAC3C,IAAI,CAAC,MAAM,CAAC,oBAAoB,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC;QAAE,OAAM;IACvD,KAAK,MAAM,QAAQ,IAAI,MAAM,CAAC,oBAAoB,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAE;QAAE,QAAQ,EAAE,CAAA;AAC/E,CAAC,CAAC,CAAA;AAEF;;;;GAIG;AACH,MAAM,UAAU,cAAc,CAAC,GAAe,EAAE,QAAoB;IACnE,IAAI,MAAM,GAAG,EAAE,CAAA;IACf,QAAQ,GAAG,EAAE,CAAC;QACb,KAAK,OAAO;YACX,MAAM,GAAG,GAAG,CAAA;QACb,KAAK,OAAO;YACX,MAAM,GAAG,OAAO,CAAA;QACjB,KAAK,WAAW;YACf,MAAM,GAAG,WAAW,CAAA;QACrB,KAAK,KAAK;YACT,MAAM,GAAG,KAAK,CAAA;QACf,KAAK,QAAQ;YACZ,MAAM,GAAG,QAAQ,CAAA;QAClB,KAAK,OAAO;YACX,MAAM,GAAG,OAAO,CAAA;QACjB,KAAK,M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UAAU,MAAM;IACrB,OAAO,cAAc,CAAC,CAAC,CAAA;AACxB,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,MAAM;IACrB,OAAO,cAAc,CAAC,CAAC,CAAA;AACxB,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,14 +1,60 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { Condition } from "./typing.js";
|
|
2
2
|
declare global {
|
|
3
3
|
interface Window {
|
|
4
4
|
VC_pressedKeys: Set<String>;
|
|
5
5
|
VC_keyPressListeners: Map<string, (() => void)[]>;
|
|
6
|
-
VC_mouseDown:
|
|
6
|
+
VC_mouseDown: boolean;
|
|
7
7
|
}
|
|
8
8
|
}
|
|
9
|
+
/**
|
|
10
|
+
* Repeats the code block/function a number of times.
|
|
11
|
+
* @param times Number of times to repeat
|
|
12
|
+
* @param callback Code block/function
|
|
13
|
+
*/
|
|
9
14
|
export declare function Repeat(times: number, callback: () => void): void;
|
|
10
|
-
|
|
11
|
-
|
|
15
|
+
/**
|
|
16
|
+
* Repeats the code block/function until a condition is finally true.
|
|
17
|
+
* @param condition Either a code block/function that returns a boolean or an expression that evaluates to one.
|
|
18
|
+
* @param callback Code block/function
|
|
19
|
+
*/
|
|
20
|
+
export declare function RepeatUntil(condition: Condition, callback: () => void): void;
|
|
21
|
+
/**
|
|
22
|
+
* Repeats the code block/function until a condition is no longer true.
|
|
23
|
+
* @param condition Either a code block/function that returns a boolean or an expression that evaluates to one.
|
|
24
|
+
* @param callback Code block/function
|
|
25
|
+
*/
|
|
26
|
+
export declare function RepeatWhile(condition: Condition, callback: () => void): void;
|
|
27
|
+
/**
|
|
28
|
+
* Repeats the code block/function forever. Use sparingly! Not recommended for browser use, will lag crazily. This is something we cannot fix.
|
|
29
|
+
* @param callback Code block/function
|
|
30
|
+
*/
|
|
12
31
|
export declare function Forever(callback: () => void): void;
|
|
32
|
+
/**
|
|
33
|
+
* Picks random integer between a minimum and maximum (inclusive)
|
|
34
|
+
* @param minimum Minimum integer
|
|
35
|
+
* @param maximum Maximum integer
|
|
36
|
+
* @returns Random integer
|
|
37
|
+
*/
|
|
13
38
|
export declare function PickRandom(minimum: number, maximum: number): number;
|
|
39
|
+
/**
|
|
40
|
+
* Asks the user a question and waits for a response.
|
|
41
|
+
* @param message Question/message to ask
|
|
42
|
+
* @returns User's response
|
|
43
|
+
*/
|
|
44
|
+
export declare function Ask(message: string): string;
|
|
45
|
+
/**
|
|
46
|
+
* Says a message.
|
|
47
|
+
* @param message Message to say
|
|
48
|
+
*/
|
|
49
|
+
export declare function Say(message: string): void;
|
|
50
|
+
/**
|
|
51
|
+
* Says a message in the form of a warning.
|
|
52
|
+
* @param warning Warning message to say
|
|
53
|
+
*/
|
|
54
|
+
export declare function SayWarning(warning: string): void;
|
|
55
|
+
/**
|
|
56
|
+
* Says a message in the form of an error.
|
|
57
|
+
* @param error Error message to say
|
|
58
|
+
*/
|
|
59
|
+
export declare function SayError(error: string): void;
|
|
14
60
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAE5C,OAAO,CAAC,MAAM,CAAC;IACd,UAAU,MAAM;QACf,cAAc,EAAE,GAAG,CAAC,MAAM,CAAC,CAAA;QAC3B,oBAAoB,EAAE,GAAG,CAAC,MAAM,EAAE,CAAC,MAAM,IAAI,CAAC,EAAE,CAAC,CAAA;QACjD,YAAY,EAAE,OAAO,CAAA;KACrB;CACD;AAID;;;;GAIG;AACH,wBAAgB,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,IAAI,GAAG,IAAI,CAEhE;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,SAAS,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,IAAI,GAAG,IAAI,CAE5E;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,SAAS,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,IAAI,GAAG,IAAI,CAE5E;AAED;;;GAGG;AACH,wBAAgB,OAAO,CAAC,QAAQ,EAAE,MAAM,IAAI,GAAG,IAAI,CAElD;AAID;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAGnE;AAID;;;;GAIG;AACH,wBAAgB,GAAG,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAE3C;AAED;;;GAGG;AACH,wBAAgB,GAAG,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAEzC;AAED;;;GAGG;AACH,wBAAgB,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAEhD;AAED;;;GAGG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAE5C"}
|
package/dist/index.js
CHANGED
|
@@ -1,24 +1,78 @@
|
|
|
1
|
-
import { btrue, bfalse } from "./typing.js";
|
|
2
1
|
// Control
|
|
2
|
+
/**
|
|
3
|
+
* Repeats the code block/function a number of times.
|
|
4
|
+
* @param times Number of times to repeat
|
|
5
|
+
* @param callback Code block/function
|
|
6
|
+
*/
|
|
3
7
|
export function Repeat(times, callback) {
|
|
4
8
|
for (let i = 0; i < times; i++)
|
|
5
9
|
callback();
|
|
6
10
|
}
|
|
11
|
+
/**
|
|
12
|
+
* Repeats the code block/function until a condition is finally true.
|
|
13
|
+
* @param condition Either a code block/function that returns a boolean or an expression that evaluates to one.
|
|
14
|
+
* @param callback Code block/function
|
|
15
|
+
*/
|
|
7
16
|
export function RepeatUntil(condition, callback) {
|
|
8
17
|
while (!condition())
|
|
9
18
|
callback();
|
|
10
19
|
}
|
|
20
|
+
/**
|
|
21
|
+
* Repeats the code block/function until a condition is no longer true.
|
|
22
|
+
* @param condition Either a code block/function that returns a boolean or an expression that evaluates to one.
|
|
23
|
+
* @param callback Code block/function
|
|
24
|
+
*/
|
|
11
25
|
export function RepeatWhile(condition, callback) {
|
|
12
26
|
while (condition())
|
|
13
27
|
callback();
|
|
14
28
|
}
|
|
29
|
+
/**
|
|
30
|
+
* Repeats the code block/function forever. Use sparingly! Not recommended for browser use, will lag crazily. This is something we cannot fix.
|
|
31
|
+
* @param callback Code block/function
|
|
32
|
+
*/
|
|
15
33
|
export function Forever(callback) {
|
|
16
|
-
while (
|
|
34
|
+
while (true)
|
|
17
35
|
callback();
|
|
18
36
|
}
|
|
19
37
|
// Math
|
|
38
|
+
/**
|
|
39
|
+
* Picks random integer between a minimum and maximum (inclusive)
|
|
40
|
+
* @param minimum Minimum integer
|
|
41
|
+
* @param maximum Maximum integer
|
|
42
|
+
* @returns Random integer
|
|
43
|
+
*/
|
|
20
44
|
export function PickRandom(minimum, maximum) {
|
|
21
45
|
const min = Math.ceil(minimum);
|
|
22
46
|
return Math.floor(Math.random() * (Math.floor(maximum) - min + 1)) + min;
|
|
23
47
|
}
|
|
48
|
+
// I/O
|
|
49
|
+
/**
|
|
50
|
+
* Asks the user a question and waits for a response.
|
|
51
|
+
* @param message Question/message to ask
|
|
52
|
+
* @returns User's response
|
|
53
|
+
*/
|
|
54
|
+
export function Ask(message) {
|
|
55
|
+
return prompt(message, "");
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Says a message.
|
|
59
|
+
* @param message Message to say
|
|
60
|
+
*/
|
|
61
|
+
export function Say(message) {
|
|
62
|
+
console.log(message);
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Says a message in the form of a warning.
|
|
66
|
+
* @param warning Warning message to say
|
|
67
|
+
*/
|
|
68
|
+
export function SayWarning(warning) {
|
|
69
|
+
console.warn(warning);
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Says a message in the form of an error.
|
|
73
|
+
* @param error Error message to say
|
|
74
|
+
*/
|
|
75
|
+
export function SayError(error) {
|
|
76
|
+
console.error(error);
|
|
77
|
+
}
|
|
24
78
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAUA,UAAU;AAEV;;;;GAIG;AACH,MAAM,UAAU,MAAM,CAAC,KAAa,EAAE,QAAoB;IACzD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,EAAE,CAAC,EAAE;QAAE,QAAQ,EAAE,CAAA;AAC3C,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,WAAW,CAAC,SAAoB,EAAE,QAAoB;IACrE,OAAO,CAAC,SAAS,EAAE;QAAE,QAAQ,EAAE,CAAA;AAChC,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,WAAW,CAAC,SAAoB,EAAE,QAAoB;IACrE,OAAO,SAAS,EAAE;QAAE,QAAQ,EAAE,CAAA;AAC/B,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,OAAO,CAAC,QAAoB;IAC3C,OAAO,IAAI;QAAE,QAAQ,EAAE,CAAA;AACxB,CAAC;AAED,OAAO;AAEP;;;;;GAKG;AACH,MAAM,UAAU,UAAU,CAAC,OAAe,EAAE,OAAe;IAC1D,MAAM,GAAG,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;IAC9B,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,GAAG,GAAG,CAAC,CAAC,CAAC,GAAG,GAAG,CAAA;AACzE,CAAC;AAED,MAAM;AAEN;;;;GAIG;AACH,MAAM,UAAU,GAAG,CAAC,OAAe;IAClC,OAAO,MAAM,CAAC,OAAO,EAAE,EAAE,CAAE,CAAA;AAC5B,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,GAAG,CAAC,OAAe;IAClC,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAA;AACrB,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,UAAU,CAAC,OAAe;IACzC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;AACtB,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,QAAQ,CAAC,KAAa;IACrC,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAA;AACrB,CAAC"}
|
package/dist/typing.d.ts
CHANGED
|
@@ -1,14 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Defines either a code block/function that returns a boolean or an expression that evaluates to one.
|
|
3
|
+
*/
|
|
4
|
+
export type Condition = () => boolean | boolean | 0 | 1;
|
|
5
|
+
/**
|
|
6
|
+
* Defines a generic object type which can store two values of the same type. Look into `Vec2n` for the strictly numerical variant!
|
|
7
|
+
*/
|
|
1
8
|
export type Vec2<T> = {
|
|
2
9
|
x: T;
|
|
3
10
|
y: T;
|
|
4
11
|
};
|
|
12
|
+
/**
|
|
13
|
+
* Defines an object type containing two numbers.
|
|
14
|
+
*/
|
|
5
15
|
export type Vec2n = Vec2<number>;
|
|
16
|
+
/**
|
|
17
|
+
* Defines a generic object type which can store three values of the same type. Look into `Vec3n` for the strictly numerical variant!
|
|
18
|
+
*/
|
|
6
19
|
export type Vec3<T> = {
|
|
7
20
|
x: T;
|
|
8
21
|
y: T;
|
|
9
22
|
};
|
|
23
|
+
/**
|
|
24
|
+
* Defines an object type containing three numbers.
|
|
25
|
+
*/
|
|
10
26
|
export type Vec3n = Vec2<number>;
|
|
11
|
-
export type bboolean = 1 | 0;
|
|
12
|
-
export declare const btrue: bboolean;
|
|
13
|
-
export declare const bfalse: bboolean;
|
|
14
27
|
//# sourceMappingURL=typing.d.ts.map
|
package/dist/typing.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"typing.d.ts","sourceRoot":"","sources":["../src/typing.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,IAAI,CAAC,CAAC,IAAI;IAAE,CAAC,EAAE,CAAC,CAAC;IAAC,CAAC,EAAE,CAAC,CAAA;CAAE,CAAA;AAEpC,MAAM,MAAM,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC,CAAA;AAEhC,MAAM,MAAM,IAAI,CAAC,CAAC,IAAI;IAAE,CAAC,EAAE,CAAC,CAAC;IAAC,CAAC,EAAE,CAAC,CAAA;CAAE,CAAA;AAEpC,MAAM,MAAM,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC,CAAA
|
|
1
|
+
{"version":3,"file":"typing.d.ts","sourceRoot":"","sources":["../src/typing.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,MAAM,SAAS,GAAG,MAAM,OAAO,GAAG,OAAO,GAAG,CAAC,GAAG,CAAC,CAAA;AAEvD;;GAEG;AACH,MAAM,MAAM,IAAI,CAAC,CAAC,IAAI;IAAE,CAAC,EAAE,CAAC,CAAC;IAAC,CAAC,EAAE,CAAC,CAAA;CAAE,CAAA;AAEpC;;GAEG;AACH,MAAM,MAAM,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC,CAAA;AAEhC;;GAEG;AACH,MAAM,MAAM,IAAI,CAAC,CAAC,IAAI;IAAE,CAAC,EAAE,CAAC,CAAC;IAAC,CAAC,EAAE,CAAC,CAAA;CAAE,CAAA;AAEpC;;GAEG;AACH,MAAM,MAAM,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC,CAAA"}
|
package/dist/typing.js
CHANGED
package/dist/typing.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"typing.js","sourceRoot":"","sources":["../src/typing.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"typing.js","sourceRoot":"","sources":["../src/typing.ts"],"names":[],"mappings":""}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "visualcopium",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.4",
|
|
4
4
|
"author": {
|
|
5
5
|
"url": "https://github.com/boyninja1555",
|
|
6
6
|
"email": "flappyfloorg@gmail.com",
|
|
@@ -42,6 +42,7 @@
|
|
|
42
42
|
"prepublish": "npm run build"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
|
+
"@types/node": "^26.5.1",
|
|
45
46
|
"typescript": "^7.0.2"
|
|
46
47
|
}
|
|
47
48
|
}
|