@n3rdw1z4rd/core 0.16.0 → 0.16.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/css/index.ts +2 -0
- package/dist/css/main.css +45 -0
- package/dist/css/reset.css +90 -0
- package/dist/index.d.mts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +23 -1
- package/dist/index.mjs +23 -1
- package/package.json +10 -12
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
@import './reset.css';
|
|
2
|
+
/* @import url('./reset.css'); */
|
|
3
|
+
|
|
4
|
+
:root {
|
|
5
|
+
/* Colors */
|
|
6
|
+
--color-foreground: lightgray;
|
|
7
|
+
--color-background: #111;
|
|
8
|
+
--color-border: #444;
|
|
9
|
+
|
|
10
|
+
/* Common Variables */
|
|
11
|
+
--border-width: 1px;
|
|
12
|
+
--border-radius: 4px;
|
|
13
|
+
--padding-small: 4px;
|
|
14
|
+
--padding-medium: 8px;
|
|
15
|
+
--padding-large: 16px;
|
|
16
|
+
--margin-small: 4px;
|
|
17
|
+
--margin-medium: 8px;
|
|
18
|
+
--margin-large: 16px;
|
|
19
|
+
--border-style: var(--border-width) dashed var(--color-border);
|
|
20
|
+
|
|
21
|
+
/* Transparency Levels */
|
|
22
|
+
--background-opacity-light: rgba(0, 0, 0, 0.1);
|
|
23
|
+
--background-opacity-medium: rgba(0, 0, 0, 0.5);
|
|
24
|
+
--background-opacity-dark: rgba(0, 0, 0, 0.8);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
* {
|
|
28
|
+
font: 14px monospace;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
html {
|
|
32
|
+
color: var(--color-foreground);
|
|
33
|
+
background-color: var(--color-background);
|
|
34
|
+
width: 100%;
|
|
35
|
+
height: 100%;
|
|
36
|
+
overflow: hidden;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
body,
|
|
40
|
+
#root {
|
|
41
|
+
width: 100%;
|
|
42
|
+
height: 100%;
|
|
43
|
+
margin: 0;
|
|
44
|
+
padding: 0;
|
|
45
|
+
}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/* Box sizing rules */
|
|
2
|
+
*,
|
|
3
|
+
*::before,
|
|
4
|
+
*::after {
|
|
5
|
+
box-sizing: border-box;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
/* Prevent font size inflation */
|
|
9
|
+
html {
|
|
10
|
+
-moz-text-size-adjust: none;
|
|
11
|
+
-webkit-text-size-adjust: none;
|
|
12
|
+
text-size-adjust: none;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/* Remove default margin in favour of better control in authored CSS */
|
|
16
|
+
body,
|
|
17
|
+
h1,
|
|
18
|
+
h2,
|
|
19
|
+
h3,
|
|
20
|
+
h4,
|
|
21
|
+
p,
|
|
22
|
+
figure,
|
|
23
|
+
blockquote,
|
|
24
|
+
dl,
|
|
25
|
+
dd {
|
|
26
|
+
margin-block-end: 0;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/* Remove list styles on ul, ol elements with a list role, which suggests default styling will be removed */
|
|
30
|
+
ul[role='list'],
|
|
31
|
+
ol[role='list'] {
|
|
32
|
+
list-style: none;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/* Set core body defaults */
|
|
36
|
+
body {
|
|
37
|
+
min-height: 100vh;
|
|
38
|
+
line-height: 1.5;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/* Set shorter line heights on headings and interactive elements */
|
|
42
|
+
h1,
|
|
43
|
+
h2,
|
|
44
|
+
h3,
|
|
45
|
+
h4,
|
|
46
|
+
button,
|
|
47
|
+
input,
|
|
48
|
+
label {
|
|
49
|
+
line-height: 1.1;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/* Balance text wrapping on headings */
|
|
53
|
+
h1,
|
|
54
|
+
h2,
|
|
55
|
+
h3,
|
|
56
|
+
h4 {
|
|
57
|
+
text-wrap: balance;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/* A elements that don't have a class get default styles */
|
|
61
|
+
a:not([class]) {
|
|
62
|
+
text-decoration-skip-ink: auto;
|
|
63
|
+
color: currentColor;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/* Make images easier to work with */
|
|
67
|
+
img,
|
|
68
|
+
picture {
|
|
69
|
+
max-width: 100%;
|
|
70
|
+
display: block;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/* Inherit fonts for inputs and buttons */
|
|
74
|
+
input,
|
|
75
|
+
button,
|
|
76
|
+
textarea,
|
|
77
|
+
select {
|
|
78
|
+
font-family: inherit;
|
|
79
|
+
font-size: inherit;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/* Make sure textareas without a rows attribute are not tiny */
|
|
83
|
+
textarea:not([rows]) {
|
|
84
|
+
min-height: 10em;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/* Anything that has been anchored to should have extra scroll margin */
|
|
88
|
+
:target {
|
|
89
|
+
scroll-margin-block: 5ex;
|
|
90
|
+
}
|
package/dist/index.d.mts
CHANGED
|
@@ -408,6 +408,8 @@ declare class RandomNumberGenerator {
|
|
|
408
408
|
get nexti(): number;
|
|
409
409
|
range(min: number, max?: number): number;
|
|
410
410
|
randomUnitVector(): [number, number];
|
|
411
|
+
pointInUnitCircle(radius?: number, floored?: boolean): [x: number, y: number];
|
|
412
|
+
pointInUnitSphere(radius?: number, floored?: boolean): [x: number, y: number, z: number];
|
|
411
413
|
parkMillerNormal(): number;
|
|
412
414
|
choose(...args: any[]): any;
|
|
413
415
|
shuffle(value: Array<any> | string): Array<any> | string;
|
package/dist/index.d.ts
CHANGED
|
@@ -408,6 +408,8 @@ declare class RandomNumberGenerator {
|
|
|
408
408
|
get nexti(): number;
|
|
409
409
|
range(min: number, max?: number): number;
|
|
410
410
|
randomUnitVector(): [number, number];
|
|
411
|
+
pointInUnitCircle(radius?: number, floored?: boolean): [x: number, y: number];
|
|
412
|
+
pointInUnitSphere(radius?: number, floored?: boolean): [x: number, y: number, z: number];
|
|
411
413
|
parkMillerNormal(): number;
|
|
412
414
|
choose(...args: any[]): any;
|
|
413
415
|
shuffle(value: Array<any> | string): Array<any> | string;
|
package/dist/index.js
CHANGED
|
@@ -610,6 +610,28 @@ var RandomNumberGenerator = class {
|
|
|
610
610
|
const theta = this.nextf * 2 * PI;
|
|
611
611
|
return [cos(theta), sin(theta)];
|
|
612
612
|
}
|
|
613
|
+
pointInUnitCircle(radius = 1, floored = false) {
|
|
614
|
+
const theta = this.nextf * 2 * PI;
|
|
615
|
+
const r = sqrt(this.nextf) * radius;
|
|
616
|
+
const x = r * cos(theta);
|
|
617
|
+
const y = r * sin(theta);
|
|
618
|
+
return !floored ? [x, y] : [floor(x), floor(y)];
|
|
619
|
+
}
|
|
620
|
+
pointInUnitSphere(radius = 1, floored = false) {
|
|
621
|
+
var u = this.nextf;
|
|
622
|
+
var v = this.nextf;
|
|
623
|
+
var theta = u * 2 * PI;
|
|
624
|
+
var phi = Math.acos(2 * v - 1);
|
|
625
|
+
var r = radius * Math.cbrt(rng.nextf);
|
|
626
|
+
var sinTheta = sin(theta);
|
|
627
|
+
var cosTheta = cos(theta);
|
|
628
|
+
var sinPhi = sin(phi);
|
|
629
|
+
var cosPhi = cos(phi);
|
|
630
|
+
var x = r * sinPhi * cosTheta;
|
|
631
|
+
var y = r * sinPhi * sinTheta;
|
|
632
|
+
var z = r * cosPhi;
|
|
633
|
+
return !floored ? [x, y, z] : [floor(x), floor(y), floor(z)];
|
|
634
|
+
}
|
|
613
635
|
parkMillerNormal() {
|
|
614
636
|
const mean = 1 / 2;
|
|
615
637
|
const stddev = 1 / 6;
|
|
@@ -954,7 +976,7 @@ var Input = class extends Emitter {
|
|
|
954
976
|
this.emit("button_clicked", code, ev);
|
|
955
977
|
}
|
|
956
978
|
});
|
|
957
|
-
window.addEventListener("
|
|
979
|
+
window.addEventListener("pointermove", (ev) => {
|
|
958
980
|
const { offsetX, offsetY, movementX, movementY } = ev;
|
|
959
981
|
this._pointerPosition.x = offsetX;
|
|
960
982
|
this._pointerPosition.y = offsetY;
|
package/dist/index.mjs
CHANGED
|
@@ -482,6 +482,28 @@ var RandomNumberGenerator = class {
|
|
|
482
482
|
const theta = this.nextf * 2 * PI;
|
|
483
483
|
return [cos(theta), sin(theta)];
|
|
484
484
|
}
|
|
485
|
+
pointInUnitCircle(radius = 1, floored = false) {
|
|
486
|
+
const theta = this.nextf * 2 * PI;
|
|
487
|
+
const r = sqrt(this.nextf) * radius;
|
|
488
|
+
const x = r * cos(theta);
|
|
489
|
+
const y = r * sin(theta);
|
|
490
|
+
return !floored ? [x, y] : [floor(x), floor(y)];
|
|
491
|
+
}
|
|
492
|
+
pointInUnitSphere(radius = 1, floored = false) {
|
|
493
|
+
var u = this.nextf;
|
|
494
|
+
var v = this.nextf;
|
|
495
|
+
var theta = u * 2 * PI;
|
|
496
|
+
var phi = Math.acos(2 * v - 1);
|
|
497
|
+
var r = radius * Math.cbrt(rng.nextf);
|
|
498
|
+
var sinTheta = sin(theta);
|
|
499
|
+
var cosTheta = cos(theta);
|
|
500
|
+
var sinPhi = sin(phi);
|
|
501
|
+
var cosPhi = cos(phi);
|
|
502
|
+
var x = r * sinPhi * cosTheta;
|
|
503
|
+
var y = r * sinPhi * sinTheta;
|
|
504
|
+
var z = r * cosPhi;
|
|
505
|
+
return !floored ? [x, y, z] : [floor(x), floor(y), floor(z)];
|
|
506
|
+
}
|
|
485
507
|
parkMillerNormal() {
|
|
486
508
|
const mean = 1 / 2;
|
|
487
509
|
const stddev = 1 / 6;
|
|
@@ -826,7 +848,7 @@ var Input = class extends Emitter {
|
|
|
826
848
|
this.emit("button_clicked", code, ev);
|
|
827
849
|
}
|
|
828
850
|
});
|
|
829
|
-
window.addEventListener("
|
|
851
|
+
window.addEventListener("pointermove", (ev) => {
|
|
830
852
|
const { offsetX, offsetY, movementX, movementY } = ev;
|
|
831
853
|
this._pointerPosition.x = offsetX;
|
|
832
854
|
this._pointerPosition.y = offsetY;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@n3rdw1z4rd/core",
|
|
3
|
-
"version": "0.16.
|
|
3
|
+
"version": "0.16.2",
|
|
4
4
|
"description": "core library",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -9,8 +9,7 @@
|
|
|
9
9
|
"dist"
|
|
10
10
|
],
|
|
11
11
|
"scripts": {
|
|
12
|
-
"build
|
|
13
|
-
"build": "tsup",
|
|
12
|
+
"build": "tsup && shx cp -r ./src/css ./dist/",
|
|
14
13
|
"dev": "tsup --watch",
|
|
15
14
|
"test": "npx ts-node src/test"
|
|
16
15
|
},
|
|
@@ -44,20 +43,19 @@
|
|
|
44
43
|
},
|
|
45
44
|
"homepage": "https://github.com/n3rdw1z4rd/core#readme",
|
|
46
45
|
"dependencies": {
|
|
47
|
-
"heap-js": "
|
|
46
|
+
"heap-js": "^2.7.1"
|
|
48
47
|
},
|
|
49
48
|
"peerDependencies": {
|
|
50
|
-
"simplex-noise": "
|
|
51
|
-
"three": "
|
|
49
|
+
"simplex-noise": "^4.0.3",
|
|
50
|
+
"three": "^0.185.1"
|
|
52
51
|
},
|
|
53
52
|
"devDependencies": {
|
|
54
|
-
"@types/three": "
|
|
55
|
-
"shx": "
|
|
56
|
-
"tsup": "
|
|
57
|
-
"typescript": "
|
|
53
|
+
"@types/three": "^0.185.1",
|
|
54
|
+
"shx": "^0.4.0",
|
|
55
|
+
"tsup": "^8.5.1",
|
|
56
|
+
"typescript": "^5.9.3"
|
|
58
57
|
},
|
|
59
58
|
"allowScripts": {
|
|
60
|
-
"esbuild@0.27.7": true
|
|
61
|
-
"fsevents@2.3.3": true
|
|
59
|
+
"esbuild@0.27.7": true
|
|
62
60
|
}
|
|
63
61
|
}
|