create-playcanvas 0.2.5 → 0.3.0
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/README.md +39 -47
- package/dist/index.mjs +51 -45
- package/package.json +53 -49
- package/templates/index.ts +15 -57
- package/templates/react-ts/README.md +32 -59
- package/templates/react-ts/eslint.config.mjs +14 -0
- package/templates/react-ts/index.html +10 -10
- package/templates/react-ts/package.json +34 -27
- package/templates/react-ts/prettier.config.mjs +1 -0
- package/templates/react-ts/src/App.css +37 -49
- package/templates/react-ts/src/App.tsx +38 -41
- package/templates/react-ts/src/Scene.tsx +50 -50
- package/templates/react-ts/src/index.css +30 -52
- package/templates/react-ts/src/main.tsx +9 -8
- package/templates/react-ts/src/vite-env.d.ts +12 -0
- package/templates/react-ts/tsconfig.json +24 -5
- package/templates/react-ts/vite.config.ts +4 -4
- package/templates/vanilla-ts/README.md +31 -91
- package/templates/vanilla-ts/eslint.config.mjs +3 -0
- package/templates/vanilla-ts/index.html +10 -10
- package/templates/vanilla-ts/package.json +28 -21
- package/templates/vanilla-ts/prettier.config.mjs +1 -0
- package/templates/vanilla-ts/src/App.ts +149 -151
- package/templates/vanilla-ts/src/main.ts +7 -7
- package/templates/vanilla-ts/src/style.css +60 -93
- package/templates/vanilla-ts/src/utils.ts +9 -8
- package/templates/vanilla-ts/src/vite-env.d.ts +12 -0
- package/templates/vanilla-ts/tsconfig.json +22 -22
- package/index.js +0 -3
- package/templates/react-ts/scripts/ensure-node-version.cjs +0 -12
- package/templates/react-ts/tsconfig.app.json +0 -27
- package/templates/react-ts/tsconfig.node.json +0 -25
- package/templates/vanilla-ts/scripts/ensure-node-version.cjs +0 -12
|
@@ -1,140 +1,107 @@
|
|
|
1
1
|
:root {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
font-family: system-ui, Avenir, Helvetica, Arial, sans-serif;
|
|
3
|
+
line-height: 1.5;
|
|
4
|
+
font-weight: 400;
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
color-scheme: light dark;
|
|
7
|
+
color: rgba(255, 255, 255, 0.87);
|
|
8
|
+
background-color: #242424;
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
font-synthesis: none;
|
|
11
|
+
text-rendering: optimizeLegibility;
|
|
12
|
+
-webkit-font-smoothing: antialiased;
|
|
13
|
+
-moz-osx-font-smoothing: grayscale;
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
header {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
17
|
+
display: flex;
|
|
18
|
+
flex-direction: row;
|
|
19
|
+
align-items: center;
|
|
20
|
+
padding: 2rem;
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
a {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
24
|
+
font-weight: 500;
|
|
25
|
+
color: #646cff;
|
|
26
|
+
pointer-events: auto;
|
|
27
|
+
text-decoration: inherit;
|
|
28
28
|
}
|
|
29
29
|
a:hover {
|
|
30
|
-
|
|
30
|
+
color: #535bf2;
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
body {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
34
|
+
width: 100%;
|
|
35
|
+
height: 100%;
|
|
36
|
+
padding: 0;
|
|
37
|
+
margin: 0;
|
|
38
|
+
overflow: hidden;
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
h1 {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
#app {
|
|
48
|
-
max-width: 1280px;
|
|
49
|
-
margin: 0 auto;
|
|
50
|
-
padding: 2rem;
|
|
51
|
-
text-align: center;
|
|
42
|
+
font-size: 2.4em;
|
|
43
|
+
line-height: 1.1;
|
|
44
|
+
opacity: 0.85;
|
|
52
45
|
}
|
|
53
46
|
|
|
54
47
|
.logo {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
48
|
+
height: 2em;
|
|
49
|
+
padding: 0.5em;
|
|
50
|
+
will-change: filter;
|
|
51
|
+
transition: filter 300ms;
|
|
59
52
|
}
|
|
60
53
|
|
|
61
54
|
.playcanvas-logo {
|
|
62
|
-
|
|
55
|
+
border-radius: 100%;
|
|
63
56
|
}
|
|
64
57
|
|
|
65
58
|
.logo:hover {
|
|
66
|
-
|
|
59
|
+
filter: drop-shadow(0 0 2em #646cffaa);
|
|
67
60
|
}
|
|
68
61
|
|
|
69
62
|
.logo.vanilla:hover {
|
|
70
|
-
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
.card {
|
|
74
|
-
padding: 2em;
|
|
63
|
+
filter: drop-shadow(0 0 2em #3178c6aa);
|
|
75
64
|
}
|
|
76
65
|
|
|
77
66
|
.read-the-docs {
|
|
78
|
-
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
button {
|
|
82
|
-
border-radius: 8px;
|
|
83
|
-
border: 1px solid transparent;
|
|
84
|
-
padding: 0.6em 1.2em;
|
|
85
|
-
font-size: 1em;
|
|
86
|
-
font-weight: 500;
|
|
87
|
-
font-family: inherit;
|
|
88
|
-
background-color: #1a1a1a;
|
|
89
|
-
cursor: pointer;
|
|
90
|
-
transition: border-color 0.25s;
|
|
91
|
-
}
|
|
92
|
-
button:hover {
|
|
93
|
-
border-color: #646cff;
|
|
94
|
-
}
|
|
95
|
-
button:focus,
|
|
96
|
-
button:focus-visible {
|
|
97
|
-
outline: 4px auto -webkit-focus-ring-color;
|
|
67
|
+
color: #888;
|
|
98
68
|
}
|
|
99
69
|
|
|
100
70
|
@media (prefers-color-scheme: light) {
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
button {
|
|
109
|
-
background-color: #f9f9f9;
|
|
110
|
-
}
|
|
71
|
+
:root {
|
|
72
|
+
color: #213547;
|
|
73
|
+
background-color: #ffffff;
|
|
74
|
+
}
|
|
75
|
+
a:hover {
|
|
76
|
+
color: #747bff;
|
|
77
|
+
}
|
|
111
78
|
}
|
|
112
79
|
|
|
113
80
|
.overlay {
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
81
|
+
margin: 0 auto;
|
|
82
|
+
text-align: center;
|
|
83
|
+
display: flex;
|
|
84
|
+
flex-direction: column;
|
|
85
|
+
align-items: center;
|
|
86
|
+
justify-content: stretch;
|
|
87
|
+
width: 100vw;
|
|
88
|
+
height: 100vh;
|
|
89
|
+
pointer-events: none;
|
|
123
90
|
}
|
|
124
91
|
|
|
125
92
|
.overlay > .grow {
|
|
126
|
-
|
|
93
|
+
flex-grow: 1;
|
|
127
94
|
}
|
|
128
95
|
|
|
129
96
|
.absolute {
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
97
|
+
position: absolute;
|
|
98
|
+
top: 0;
|
|
99
|
+
left: 0;
|
|
133
100
|
}
|
|
134
101
|
|
|
135
102
|
.pill {
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
}
|
|
103
|
+
background-color: #000;
|
|
104
|
+
color: #fff;
|
|
105
|
+
padding: 0.5rem 1rem;
|
|
106
|
+
border-radius: 0.5rem;
|
|
107
|
+
}
|
|
@@ -4,13 +4,14 @@
|
|
|
4
4
|
* @param interval - The interval in milliseconds
|
|
5
5
|
* @returns A throttled function
|
|
6
6
|
*/
|
|
7
|
-
export
|
|
7
|
+
export const throttle = <T extends unknown[]>(fn: (...args: T) => void, interval = 100) => {
|
|
8
|
+
// interval in ms
|
|
8
9
|
let last = 0;
|
|
9
|
-
return (...args:
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
10
|
+
return (...args: T) => {
|
|
11
|
+
const now = Date.now();
|
|
12
|
+
if (now - last >= interval) {
|
|
13
|
+
last = now;
|
|
14
|
+
fn(...args);
|
|
15
|
+
}
|
|
15
16
|
};
|
|
16
|
-
|
|
17
|
+
};
|
|
@@ -1 +1,13 @@
|
|
|
1
1
|
/// <reference types="vite/client" />
|
|
2
|
+
|
|
3
|
+
declare module 'playcanvas/scripts/esm/camera-controls.mjs' {
|
|
4
|
+
import type { Script } from 'playcanvas';
|
|
5
|
+
|
|
6
|
+
export const CameraControls: typeof Script & (new () => Script);
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
declare module 'playcanvas/scripts/esm/grid.mjs' {
|
|
10
|
+
import type { Script } from 'playcanvas';
|
|
11
|
+
|
|
12
|
+
export const Grid: typeof Script & (new () => Script);
|
|
13
|
+
}
|
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2022",
|
|
4
|
+
"useDefineForClassFields": true,
|
|
5
|
+
"module": "ESNext",
|
|
6
|
+
"lib": ["ES2022", "DOM", "DOM.Iterable"],
|
|
7
|
+
"skipLibCheck": true,
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
9
|
+
/* Bundler mode */
|
|
10
|
+
"moduleResolution": "bundler",
|
|
11
|
+
"allowImportingTsExtensions": true,
|
|
12
|
+
"verbatimModuleSyntax": true,
|
|
13
|
+
"moduleDetection": "force",
|
|
14
|
+
"noEmit": true,
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
}
|
|
16
|
+
/* Linting */
|
|
17
|
+
"strict": true,
|
|
18
|
+
"noUnusedLocals": true,
|
|
19
|
+
"noUnusedParameters": true,
|
|
20
|
+
"erasableSyntaxOnly": true,
|
|
21
|
+
"noFallthroughCasesInSwitch": true,
|
|
22
|
+
"noUncheckedSideEffectImports": true
|
|
23
|
+
},
|
|
24
|
+
"include": ["src"]
|
|
25
|
+
}
|
package/index.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
const semver = require('semver');
|
|
2
|
-
const pkg = require('../package.json');
|
|
3
|
-
|
|
4
|
-
const requiredVersion = pkg.engines.node;
|
|
5
|
-
const currentVersion = process.version;
|
|
6
|
-
|
|
7
|
-
if (!semver.satisfies(currentVersion, requiredVersion)) {
|
|
8
|
-
console.error(`\n❌ Unsupported Node.js version: ${currentVersion}`);
|
|
9
|
-
console.error(`Required: ${requiredVersion}`);
|
|
10
|
-
console.error('Please upgrade your Node.js to continue.\n');
|
|
11
|
-
process.exit(1);
|
|
12
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
|
|
4
|
-
"target": "ES2022",
|
|
5
|
-
"useDefineForClassFields": true,
|
|
6
|
-
"lib": ["ES2022", "DOM", "DOM.Iterable"],
|
|
7
|
-
"module": "ESNext",
|
|
8
|
-
"skipLibCheck": true,
|
|
9
|
-
|
|
10
|
-
/* Bundler mode */
|
|
11
|
-
"moduleResolution": "bundler",
|
|
12
|
-
"allowImportingTsExtensions": true,
|
|
13
|
-
"verbatimModuleSyntax": true,
|
|
14
|
-
"moduleDetection": "force",
|
|
15
|
-
"noEmit": true,
|
|
16
|
-
"jsx": "react-jsx",
|
|
17
|
-
|
|
18
|
-
/* Linting */
|
|
19
|
-
"strict": true,
|
|
20
|
-
"noUnusedLocals": true,
|
|
21
|
-
"noUnusedParameters": true,
|
|
22
|
-
"erasableSyntaxOnly": true,
|
|
23
|
-
"noFallthroughCasesInSwitch": true,
|
|
24
|
-
"noUncheckedSideEffectImports": true
|
|
25
|
-
},
|
|
26
|
-
"include": ["src"]
|
|
27
|
-
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo",
|
|
4
|
-
"target": "ES2023",
|
|
5
|
-
"lib": ["ES2023"],
|
|
6
|
-
"module": "ESNext",
|
|
7
|
-
"skipLibCheck": true,
|
|
8
|
-
|
|
9
|
-
/* Bundler mode */
|
|
10
|
-
"moduleResolution": "bundler",
|
|
11
|
-
"allowImportingTsExtensions": true,
|
|
12
|
-
"verbatimModuleSyntax": true,
|
|
13
|
-
"moduleDetection": "force",
|
|
14
|
-
"noEmit": true,
|
|
15
|
-
|
|
16
|
-
/* Linting */
|
|
17
|
-
"strict": true,
|
|
18
|
-
"noUnusedLocals": true,
|
|
19
|
-
"noUnusedParameters": true,
|
|
20
|
-
"erasableSyntaxOnly": true,
|
|
21
|
-
"noFallthroughCasesInSwitch": true,
|
|
22
|
-
"noUncheckedSideEffectImports": true
|
|
23
|
-
},
|
|
24
|
-
"include": ["vite.config.ts"]
|
|
25
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
const semver = require('semver');
|
|
2
|
-
const pkg = require('../package.json');
|
|
3
|
-
|
|
4
|
-
const requiredVersion = pkg.engines.node;
|
|
5
|
-
const currentVersion = process.version;
|
|
6
|
-
|
|
7
|
-
if (!semver.satisfies(currentVersion, requiredVersion)) {
|
|
8
|
-
console.error(`\n❌ Unsupported Node.js version: ${currentVersion}`);
|
|
9
|
-
console.error(`Required: ${requiredVersion}`);
|
|
10
|
-
console.error('Please upgrade your Node.js to continue.\n');
|
|
11
|
-
process.exit(1);
|
|
12
|
-
}
|