create-playcanvas 0.11.0 → 0.12.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.
Files changed (95) hide show
  1. package/README.md +21 -4
  2. package/dist/index.mjs +41 -39
  3. package/package.json +5 -2
  4. package/templates/_common/CLAUDE.md +1 -0
  5. package/templates/_features/physics/assets/public/ammo/SOURCE.md +4 -1
  6. package/templates/{react/interactive-sphere/src/App.css → _shared/interactive-sphere/src/counter.css} +0 -6
  7. package/templates/_shared/web-lens/AGENTS.md +10 -0
  8. package/templates/engine/base/AGENTS.md +37 -0
  9. package/templates/engine/base/README.md +15 -11
  10. package/templates/engine/base/package.json +1 -1
  11. package/templates/engine/base/vite.config.ts +8 -0
  12. package/templates/engine/first-person-controller/src/main.ts +2 -3
  13. package/templates/engine/interactive-sphere/src/App.ts +1 -1
  14. package/templates/engine/interactive-sphere/src/main.ts +3 -5
  15. package/templates/engine/model-viewer/src/main.ts +3 -3
  16. package/templates/engine/physics-playground/src/main.ts +2 -3
  17. package/templates/engine/spinning-cube/src/main.ts +1 -1
  18. package/templates/engine/splat-viewer/src/main.ts +1 -1
  19. package/templates/engine/third-person-controller/src/main.ts +2 -3
  20. package/templates/engine/web-lens/vite.config.ts +4 -1
  21. package/templates/react/base/AGENTS.md +41 -0
  22. package/templates/react/base/README.md +15 -11
  23. package/templates/react/base/package.json +1 -1
  24. package/templates/react/base/vite.config.ts +8 -0
  25. package/templates/react/interactive-sphere/src/App.tsx +5 -6
  26. package/templates/react/interactive-sphere/src/Scene.tsx +1 -1
  27. package/templates/react/model-viewer/src/App.tsx +4 -2
  28. package/templates/react/spinning-cube/src/App.tsx +2 -0
  29. package/templates/react/splat-viewer/src/App.tsx +2 -0
  30. package/templates/react/web-lens/vite.config.ts +4 -1
  31. package/templates/web-components/base/AGENTS.md +39 -0
  32. package/templates/web-components/base/README.md +15 -11
  33. package/templates/web-components/base/package.json +2 -2
  34. package/templates/web-components/base/vite.config.ts +8 -0
  35. package/templates/web-components/first-person-controller/index.html +1 -6
  36. package/templates/web-components/interactive-sphere/src/main.ts +2 -2
  37. package/templates/web-components/model-viewer/index.html +2 -2
  38. package/templates/web-components/model-viewer/src/main.ts +0 -1
  39. package/templates/web-components/physics-playground/index.html +1 -6
  40. package/templates/web-components/spinning-cube/src/main.ts +0 -1
  41. package/templates/web-components/splat-viewer/src/main.ts +0 -1
  42. package/templates/web-components/third-person-controller/index.html +1 -6
  43. package/templates/web-components/web-lens/vite.config.ts +4 -1
  44. package/templates/_features/physics/assets/public/ammo/ammo.js +0 -973
  45. package/templates/engine/interactive-sphere/index.html +0 -13
  46. package/templates/engine/interactive-sphere/src/style.css +0 -28
  47. package/templates/engine/model-viewer/index.html +0 -13
  48. package/templates/engine/model-viewer/src/style.css +0 -8
  49. package/templates/engine/spinning-cube/index.html +0 -13
  50. package/templates/engine/spinning-cube/src/style.css +0 -8
  51. package/templates/engine/splat-viewer/index.html +0 -13
  52. package/templates/engine/splat-viewer/src/style.css +0 -8
  53. package/templates/react/base/.prettierignore +0 -3
  54. package/templates/react/base/_gitignore +0 -24
  55. package/templates/react/base/_npmrc +0 -1
  56. package/templates/react/base/prettier.config.mjs +0 -1
  57. package/templates/react/base/src/assets/playcanvas.png +0 -0
  58. package/templates/react/base/src/inspector.css +0 -33
  59. package/templates/react/base/src/inspector.ts +0 -38
  60. package/templates/react/base/src/starter.css +0 -104
  61. package/templates/react/base/src/vite-env.d.ts +0 -19
  62. package/templates/react/interactive-sphere/index.html +0 -13
  63. package/templates/react/interactive-sphere/src/index.css +0 -4
  64. package/templates/react/interactive-sphere/src/main.tsx +0 -11
  65. package/templates/react/model-viewer/index.html +0 -13
  66. package/templates/react/model-viewer/src/index.css +0 -9
  67. package/templates/react/model-viewer/src/main.tsx +0 -11
  68. package/templates/react/spinning-cube/index.html +0 -13
  69. package/templates/react/spinning-cube/src/index.css +0 -9
  70. package/templates/react/spinning-cube/src/main.tsx +0 -11
  71. package/templates/react/splat-viewer/index.html +0 -13
  72. package/templates/react/splat-viewer/src/index.css +0 -9
  73. package/templates/react/splat-viewer/src/main.tsx +0 -11
  74. package/templates/web-components/base/.prettierignore +0 -3
  75. package/templates/web-components/base/_gitignore +0 -24
  76. package/templates/web-components/base/_npmrc +0 -1
  77. package/templates/web-components/base/prettier.config.mjs +0 -1
  78. package/templates/web-components/base/src/assets/playcanvas.png +0 -0
  79. package/templates/web-components/base/src/inspector.css +0 -33
  80. package/templates/web-components/base/src/inspector.ts +0 -38
  81. package/templates/web-components/base/src/starter.css +0 -104
  82. package/templates/web-components/base/src/vite-env.d.ts +0 -19
  83. package/templates/web-components/interactive-sphere/src/style.css +0 -53
  84. package/templates/web-components/model-viewer/src/style.css +0 -8
  85. package/templates/web-components/spinning-cube/src/style.css +0 -8
  86. package/templates/web-components/splat-viewer/src/style.css +0 -8
  87. /package/templates/{engine/base → _common}/.prettierignore +0 -0
  88. /package/templates/{engine/base → _common}/_gitignore +0 -0
  89. /package/templates/{engine/base → _common}/_npmrc +0 -0
  90. /package/templates/{engine/base → _common}/prettier.config.mjs +0 -0
  91. /package/templates/{engine/base → _common}/src/assets/playcanvas.png +0 -0
  92. /package/templates/{engine/base → _common}/src/inspector.css +0 -0
  93. /package/templates/{engine/base → _common}/src/inspector.ts +0 -0
  94. /package/templates/{engine/base → _common}/src/starter.css +0 -0
  95. /package/templates/{engine/base → _common}/src/vite-env.d.ts +0 -0
@@ -1,13 +0,0 @@
1
- <!doctype html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="UTF-8" />
5
- <link rel="icon" type="image/png" href="/src/assets/playcanvas.png" />
6
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
- <title>PlayCanvas + TS</title>
8
- </head>
9
- <body>
10
- <div id="root"></div>
11
- <script type="module" src="/src/main.ts"></script>
12
- </body>
13
- </html>
@@ -1,28 +0,0 @@
1
- body {
2
- margin: 0;
3
- overflow: hidden;
4
- font-family: Inter, ui-sans-serif, system-ui, sans-serif;
5
- }
6
-
7
- canvas {
8
- display: block;
9
- width: 100vw;
10
- height: 100vh;
11
- }
12
-
13
- .counter {
14
- position: fixed;
15
- bottom: 22px;
16
- left: 50%;
17
- z-index: 2;
18
- margin: 0;
19
- padding: 9px 13px;
20
- border: 1px solid #ffffff24;
21
- border-radius: 999px;
22
- background: #07101bd9;
23
- color: #f8fafc;
24
- font-size: 12px;
25
- font-weight: 650;
26
- translate: -50% 0;
27
- backdrop-filter: blur(10px);
28
- }
@@ -1,13 +0,0 @@
1
- <!doctype html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="UTF-8" />
5
- <link rel="icon" type="image/png" href="/src/assets/playcanvas.png" />
6
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
- <title>PlayCanvas + TS</title>
8
- </head>
9
- <body>
10
- <canvas id="application-canvas"></canvas>
11
- <script type="module" src="/src/main.ts"></script>
12
- </body>
13
- </html>
@@ -1,8 +0,0 @@
1
- body {
2
- margin: 0;
3
- overflow: hidden;
4
- }
5
-
6
- canvas {
7
- display: block;
8
- }
@@ -1,13 +0,0 @@
1
- <!doctype html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="UTF-8" />
5
- <link rel="icon" type="image/png" href="/src/assets/playcanvas.png" />
6
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
- <title>PlayCanvas + TS</title>
8
- </head>
9
- <body>
10
- <canvas id="application-canvas"></canvas>
11
- <script type="module" src="/src/main.ts"></script>
12
- </body>
13
- </html>
@@ -1,8 +0,0 @@
1
- body {
2
- margin: 0;
3
- overflow: hidden;
4
- }
5
-
6
- canvas {
7
- display: block;
8
- }
@@ -1,13 +0,0 @@
1
- <!doctype html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="UTF-8" />
5
- <link rel="icon" type="image/png" href="/src/assets/playcanvas.png" />
6
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
- <title>PlayCanvas + TS</title>
8
- </head>
9
- <body>
10
- <canvas id="application-canvas"></canvas>
11
- <script type="module" src="/src/main.ts"></script>
12
- </body>
13
- </html>
@@ -1,8 +0,0 @@
1
- body {
2
- margin: 0;
3
- overflow: hidden;
4
- }
5
-
6
- canvas {
7
- display: block;
8
- }
@@ -1,3 +0,0 @@
1
- .claude
2
- .agents
3
- public/ammo
@@ -1,24 +0,0 @@
1
- # Logs
2
- logs
3
- *.log
4
- npm-debug.log*
5
- yarn-debug.log*
6
- yarn-error.log*
7
- pnpm-debug.log*
8
- lerna-debug.log*
9
-
10
- node_modules
11
- dist
12
- dist-ssr
13
- *.local
14
-
15
- # Editor directories and files
16
- .vscode/*
17
- !.vscode/extensions.json
18
- .idea
19
- .DS_Store
20
- *.suo
21
- *.ntvs*
22
- *.njsproj
23
- *.sln
24
- *.sw?
@@ -1 +0,0 @@
1
- registry=https://registry.npmjs.org/
@@ -1 +0,0 @@
1
- export { default } from '@playcanvas/eslint-config/prettier';
@@ -1,33 +0,0 @@
1
- /* Inspector key hint, added on the dev server only by src/inspector.ts. Styled like the starter panels */
2
- .inspector-hint {
3
- position: fixed;
4
- bottom: 20px;
5
- left: 20px;
6
- z-index: 10;
7
- margin: 0;
8
- padding: 8px 12px;
9
- border: 1px solid #ffffff24;
10
- border-radius: 10px;
11
- background: #0b1019d9;
12
- box-shadow: 0 12px 40px #0008;
13
- color: #aeb8c8;
14
- font:
15
- 12px/1.6 Inter,
16
- ui-sans-serif,
17
- system-ui,
18
- sans-serif;
19
- backdrop-filter: blur(12px);
20
- pointer-events: none;
21
- }
22
-
23
- .inspector-hint kbd {
24
- padding: 1px 5px;
25
- border-radius: 4px;
26
- background: #263247;
27
- color: #f8fafc;
28
- font:
29
- 11px ui-monospace,
30
- SFMono-Regular,
31
- Menlo,
32
- monospace;
33
- }
@@ -1,38 +0,0 @@
1
- // Loaded by the dev server only (see vite.config.ts), so production builds never include it
2
- import { Inspector } from '@playcanvas/inspector';
3
- import type { AppBase } from 'playcanvas';
4
-
5
- import './inspector.css';
6
-
7
- type Hook = {
8
- register?(app: AppBase, info: object): void;
9
- unregister?(app: AppBase): void;
10
- };
11
-
12
- // Every app announces itself to this hook as it starts, whichever format created it
13
- const KEY = Symbol.for('playcanvas.inspector');
14
- const scope = globalThis as unknown as Record<symbol, Hook | undefined>;
15
-
16
- // Keep a hook installed earlier, such as a devtools extension's
17
- const prev = scope[KEY];
18
-
19
- scope[KEY] = {
20
- register(app, info) {
21
- prev?.register?.(app, info);
22
-
23
- // Skip headless apps, such as the null apps @playcanvas/react creates for validation. Each
24
- // panel destroys itself with its app
25
- if (!app.graphicsDevice.isNull) new Inspector(app, { visible: false });
26
- },
27
- unregister(app) {
28
- prev?.unregister?.(app);
29
- }
30
- };
31
-
32
- console.info('PlayCanvas Inspector: press ` to toggle');
33
-
34
- // Key hint, a separate corner chip so the starter's own UI stays untouched
35
- const hint = document.createElement('p');
36
- hint.className = 'inspector-hint';
37
- hint.innerHTML = '<kbd>`</kbd> inspector · <kbd>F9</kbd> pause · <kbd>F10</kbd> step';
38
- document.body.append(hint);
@@ -1,104 +0,0 @@
1
- * {
2
- box-sizing: border-box;
3
- }
4
-
5
- html,
6
- body,
7
- #root,
8
- #application,
9
- pc-app,
10
- canvas {
11
- width: 100%;
12
- height: 100%;
13
- margin: 0;
14
- overflow: hidden;
15
- }
16
-
17
- body {
18
- background: #11151c;
19
- color: #f8fafc;
20
- font-family: Inter, ui-sans-serif, system-ui, sans-serif;
21
- }
22
-
23
- canvas,
24
- pc-app {
25
- display: block;
26
- }
27
-
28
- .hud {
29
- position: fixed;
30
- inset: 0;
31
- z-index: 10;
32
- padding: 20px;
33
- pointer-events: none;
34
- }
35
-
36
- .panel {
37
- width: min(360px, calc(100vw - 40px));
38
- padding: 16px;
39
- border: 1px solid #ffffff24;
40
- border-radius: 14px;
41
- background: #0b1019d9;
42
- box-shadow: 0 12px 40px #0008;
43
- backdrop-filter: blur(12px);
44
- pointer-events: auto;
45
- }
46
-
47
- h1 {
48
- margin: 0 0 6px;
49
- font-size: 18px;
50
- }
51
-
52
- p {
53
- margin: 6px 0 0;
54
- color: #aeb8c8;
55
- font-size: 13px;
56
- line-height: 1.45;
57
- }
58
-
59
- .controls {
60
- display: flex;
61
- flex-wrap: wrap;
62
- gap: 8px;
63
- margin-top: 14px;
64
- }
65
-
66
- button {
67
- padding: 8px 11px;
68
- border: 1px solid #ffffff24;
69
- border-radius: 9px;
70
- background: #263247;
71
- color: inherit;
72
- cursor: pointer;
73
- }
74
-
75
- button:hover,
76
- button[aria-pressed='true'] {
77
- border-color: #41b6e6;
78
- background: #334867;
79
- }
80
-
81
- button:disabled {
82
- cursor: not-allowed;
83
- opacity: 0.5;
84
- }
85
-
86
- .swatch {
87
- width: 32px;
88
- height: 32px;
89
- padding: 0;
90
- border-radius: 50%;
91
- background: var(--color);
92
- }
93
-
94
- .crosshair {
95
- position: fixed;
96
- top: 50%;
97
- left: 50%;
98
- width: 16px;
99
- height: 16px;
100
- border: 2px solid #fff;
101
- border-radius: 50%;
102
- translate: -50% -50%;
103
- box-shadow: 0 0 4px #000;
104
- }
@@ -1,19 +0,0 @@
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
- }
14
-
15
- declare module 'playcanvas/scripts/esm/sky/procedural-sky.mjs' {
16
- import type { Script } from 'playcanvas';
17
-
18
- export const ProceduralSky: typeof Script & (new () => Script);
19
- }
@@ -1,13 +0,0 @@
1
- <!doctype html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="UTF-8" />
5
- <link rel="icon" type="image/png" href="/src/assets/playcanvas.png" />
6
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
- <title>PlayCanvas + React + TS</title>
8
- </head>
9
- <body>
10
- <div id="root"></div>
11
- <script type="module" src="/src/main.tsx"></script>
12
- </body>
13
- </html>
@@ -1,4 +0,0 @@
1
- body {
2
- margin: 0;
3
- overflow: hidden;
4
- }
@@ -1,11 +0,0 @@
1
- import { StrictMode } from 'react';
2
- import { createRoot } from 'react-dom/client';
3
-
4
- import './index.css';
5
- import App from './App.tsx';
6
-
7
- createRoot(document.getElementById('root')!).render(
8
- <StrictMode>
9
- <App />
10
- </StrictMode>
11
- );
@@ -1,13 +0,0 @@
1
- <!doctype html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="UTF-8" />
5
- <link rel="icon" type="image/png" href="/src/assets/playcanvas.png" />
6
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
- <title>PlayCanvas + React</title>
8
- </head>
9
- <body>
10
- <div id="root"></div>
11
- <script type="module" src="/src/main.tsx"></script>
12
- </body>
13
- </html>
@@ -1,9 +0,0 @@
1
- body {
2
- margin: 0;
3
- overflow: hidden;
4
- }
5
-
6
- #root {
7
- width: 100vw;
8
- height: 100vh;
9
- }
@@ -1,11 +0,0 @@
1
- import { StrictMode } from 'react';
2
- import { createRoot } from 'react-dom/client';
3
-
4
- import './index.css';
5
- import App from './App.tsx';
6
-
7
- createRoot(document.getElementById('root')!).render(
8
- <StrictMode>
9
- <App />
10
- </StrictMode>
11
- );
@@ -1,13 +0,0 @@
1
- <!doctype html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="UTF-8" />
5
- <link rel="icon" type="image/png" href="/src/assets/playcanvas.png" />
6
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
- <title>PlayCanvas + React</title>
8
- </head>
9
- <body>
10
- <div id="root"></div>
11
- <script type="module" src="/src/main.tsx"></script>
12
- </body>
13
- </html>
@@ -1,9 +0,0 @@
1
- body {
2
- margin: 0;
3
- overflow: hidden;
4
- }
5
-
6
- #root {
7
- width: 100vw;
8
- height: 100vh;
9
- }
@@ -1,11 +0,0 @@
1
- import { StrictMode } from 'react';
2
- import { createRoot } from 'react-dom/client';
3
-
4
- import './index.css';
5
- import App from './App.tsx';
6
-
7
- createRoot(document.getElementById('root')!).render(
8
- <StrictMode>
9
- <App />
10
- </StrictMode>
11
- );
@@ -1,13 +0,0 @@
1
- <!doctype html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="UTF-8" />
5
- <link rel="icon" type="image/png" href="/src/assets/playcanvas.png" />
6
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
- <title>PlayCanvas + React</title>
8
- </head>
9
- <body>
10
- <div id="root"></div>
11
- <script type="module" src="/src/main.tsx"></script>
12
- </body>
13
- </html>
@@ -1,9 +0,0 @@
1
- body {
2
- margin: 0;
3
- overflow: hidden;
4
- }
5
-
6
- #root {
7
- width: 100vw;
8
- height: 100vh;
9
- }
@@ -1,11 +0,0 @@
1
- import { StrictMode } from 'react';
2
- import { createRoot } from 'react-dom/client';
3
-
4
- import './index.css';
5
- import App from './App.tsx';
6
-
7
- createRoot(document.getElementById('root')!).render(
8
- <StrictMode>
9
- <App />
10
- </StrictMode>
11
- );
@@ -1,3 +0,0 @@
1
- .claude
2
- .agents
3
- public/ammo
@@ -1,24 +0,0 @@
1
- # Logs
2
- logs
3
- *.log
4
- npm-debug.log*
5
- yarn-debug.log*
6
- yarn-error.log*
7
- pnpm-debug.log*
8
- lerna-debug.log*
9
-
10
- node_modules
11
- dist
12
- dist-ssr
13
- *.local
14
-
15
- # Editor directories and files
16
- .vscode/*
17
- !.vscode/extensions.json
18
- .idea
19
- .DS_Store
20
- *.suo
21
- *.ntvs*
22
- *.njsproj
23
- *.sln
24
- *.sw?
@@ -1 +0,0 @@
1
- registry=https://registry.npmjs.org/
@@ -1 +0,0 @@
1
- export { default } from '@playcanvas/eslint-config/prettier';
@@ -1,33 +0,0 @@
1
- /* Inspector key hint, added on the dev server only by src/inspector.ts. Styled like the starter panels */
2
- .inspector-hint {
3
- position: fixed;
4
- bottom: 20px;
5
- left: 20px;
6
- z-index: 10;
7
- margin: 0;
8
- padding: 8px 12px;
9
- border: 1px solid #ffffff24;
10
- border-radius: 10px;
11
- background: #0b1019d9;
12
- box-shadow: 0 12px 40px #0008;
13
- color: #aeb8c8;
14
- font:
15
- 12px/1.6 Inter,
16
- ui-sans-serif,
17
- system-ui,
18
- sans-serif;
19
- backdrop-filter: blur(12px);
20
- pointer-events: none;
21
- }
22
-
23
- .inspector-hint kbd {
24
- padding: 1px 5px;
25
- border-radius: 4px;
26
- background: #263247;
27
- color: #f8fafc;
28
- font:
29
- 11px ui-monospace,
30
- SFMono-Regular,
31
- Menlo,
32
- monospace;
33
- }
@@ -1,38 +0,0 @@
1
- // Loaded by the dev server only (see vite.config.ts), so production builds never include it
2
- import { Inspector } from '@playcanvas/inspector';
3
- import type { AppBase } from 'playcanvas';
4
-
5
- import './inspector.css';
6
-
7
- type Hook = {
8
- register?(app: AppBase, info: object): void;
9
- unregister?(app: AppBase): void;
10
- };
11
-
12
- // Every app announces itself to this hook as it starts, whichever format created it
13
- const KEY = Symbol.for('playcanvas.inspector');
14
- const scope = globalThis as unknown as Record<symbol, Hook | undefined>;
15
-
16
- // Keep a hook installed earlier, such as a devtools extension's
17
- const prev = scope[KEY];
18
-
19
- scope[KEY] = {
20
- register(app, info) {
21
- prev?.register?.(app, info);
22
-
23
- // Skip headless apps, such as the null apps @playcanvas/react creates for validation. Each
24
- // panel destroys itself with its app
25
- if (!app.graphicsDevice.isNull) new Inspector(app, { visible: false });
26
- },
27
- unregister(app) {
28
- prev?.unregister?.(app);
29
- }
30
- };
31
-
32
- console.info('PlayCanvas Inspector: press ` to toggle');
33
-
34
- // Key hint, a separate corner chip so the starter's own UI stays untouched
35
- const hint = document.createElement('p');
36
- hint.className = 'inspector-hint';
37
- hint.innerHTML = '<kbd>`</kbd> inspector · <kbd>F9</kbd> pause · <kbd>F10</kbd> step';
38
- document.body.append(hint);