@benjos/create-boilerplate 1.0.3 → 1.3.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/README.md +24 -12
- package/dist/index.js +8 -6
- package/dist/index.js.map +1 -1
- package/package.json +10 -9
- package/template-react/.prettierignore +6 -0
- package/template-react/.prettierrc +10 -0
- package/template-react/assets_source/.gitkeep +0 -0
- package/template-react/eslint.config.js +23 -0
- package/template-react/index.html +17 -0
- package/template-react/package-lock.json +4470 -0
- package/template-react/package.json +46 -0
- package/template-react/public/assets/fonts/LICENSE +13 -0
- package/template-react/public/assets/fonts/template.typeface.json +1 -0
- package/template-react/public/assets/hdrs/template.hdr +0 -0
- package/template-react/public/assets/icons/benjosLogoBlack.svg +5 -0
- package/template-react/public/assets/loaders/draco/README.md +32 -0
- package/template-react/public/assets/loaders/draco/draco_decoder.js +34 -0
- package/template-react/public/assets/loaders/draco/draco_decoder.wasm +0 -0
- package/template-react/public/assets/loaders/draco/draco_encoder.js +33 -0
- package/template-react/public/assets/loaders/draco/draco_wasm_wrapper.js +117 -0
- package/template-react/public/assets/loaders/draco/gltf/draco_decoder.js +33 -0
- package/template-react/public/assets/loaders/draco/gltf/draco_decoder.wasm +0 -0
- package/template-react/public/assets/loaders/draco/gltf/draco_encoder.js +33 -0
- package/template-react/public/assets/loaders/draco/gltf/draco_wasm_wrapper.js +116 -0
- package/template-react/public/assets/models/template.glb +0 -0
- package/template-react/public/assets/textures/template.jpg +0 -0
- package/template-react/readme.md +31 -0
- package/template-react/src/App.css +42 -0
- package/template-react/src/App.tsx +14 -0
- package/template-react/src/index.css +68 -0
- package/template-react/src/main.tsx +10 -0
- package/template-react/tsconfig.app.json +34 -0
- package/template-react/tsconfig.json +7 -0
- package/template-react/tsconfig.node.json +26 -0
- package/template-react/vite.config.ts +29 -0
- package/template-vanilla/eslint.config.js +10 -0
- package/template-vanilla/package-lock.json +3735 -3739
- package/template-vanilla/package.json +12 -11
- package/template-vanilla/readme.md +2 -20
- package/template-vanilla/src/experiences/Experience.ts +7 -0
- package/template-vanilla/src/experiences/cameras/threes/DebugThreeCameraController.ts +2 -2
- package/template-vanilla/src/experiences/commands/InitCommand.ts +10 -5
- package/template-vanilla/src/experiences/constants/experiences/ViewType.ts +6 -0
- package/template-vanilla/src/experiences/engines/threes/MainThree.ts +8 -8
- package/template-vanilla/src/experiences/managers/DebugManager.ts +3 -3
- package/template-vanilla/src/experiences/managers/KeyboardManager.ts +2 -2
- package/template-vanilla/src/experiences/managers/LoaderManager.ts +1 -1
- package/template-vanilla/src/experiences/managers/MouseManager.ts +2 -2
- package/template-vanilla/src/experiences/managers/ResizeManager.ts +1 -1
- package/template-vanilla/src/experiences/managers/threes/ThreeAssetsManager.ts +5 -6
- package/template-vanilla/src/experiences/managers/threes/ThreeCameraControllerManager.ts +1 -1
- package/template-vanilla/src/experiences/proxies/ViewProxy.ts +15 -0
- package/template-vanilla/src/experiences/types/global.d.ts +3 -2
- package/template-vanilla/src/experiences/views/bases/ViewBase.ts +14 -3
- package/template-vanilla/src/experiences/views/htmls/bases/HTMLViewBase.ts +5 -4
- package/template-vanilla/src/experiences/views/htmls/loaders/LoaderHTMLView.ts +3 -3
- package/template-vanilla/src/experiences/views/threes/bases/ThreeViewBase.ts +2 -1
- package/template-vanilla/src/experiences/views/threes/loaders/LoaderThreeView.ts +1 -0
- package/template-vanilla/docs/PUBLISHING.md +0 -30
- package/template-vanilla/src/experiences/constants/doms/DomEvent.ts +0 -100
- package/template-vanilla/src/experiences/constants/doms/KeyboardConstant.ts +0 -250
- package/template-vanilla/src/experiences/proxies/bases/PoolProxyBase.ts +0 -61
- package/template-vanilla/src/experiences/tools/Action.ts +0 -23
- package/template-vanilla/src/experiences/tools/Point.ts +0 -56
- package/template-vanilla/src/experiences/utils/AssetUtils.ts +0 -6
- package/template-vanilla/src/experiences/utils/DomUtils.ts +0 -28
- package/template-vanilla/tsconfig.json +0 -24
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
|
-
"name": "
|
|
2
|
+
"name": "template-vanilla",
|
|
3
3
|
"private": true,
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.3.4",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"dev": "vite",
|
|
@@ -13,26 +13,27 @@
|
|
|
13
13
|
"format:check": "prettier --check ."
|
|
14
14
|
},
|
|
15
15
|
"devDependencies": {
|
|
16
|
-
"@eslint/js": "^9.39.
|
|
17
|
-
"@types/eslint__js": "^8.42.3",
|
|
16
|
+
"@eslint/js": "^9.39.2",
|
|
18
17
|
"@types/howler": "^2.2.12",
|
|
19
|
-
"@types/three": "^0.
|
|
20
|
-
"eslint": "^9.39.
|
|
18
|
+
"@types/three": "^0.182.0",
|
|
19
|
+
"eslint": "^9.39.2",
|
|
21
20
|
"eslint-config-prettier": "^10.1.8",
|
|
22
21
|
"eslint-plugin-prettier": "^5.5.4",
|
|
23
22
|
"prettier": "^3.7.4",
|
|
24
|
-
"sass-embedded": "^1.
|
|
23
|
+
"sass-embedded": "^1.97.1",
|
|
25
24
|
"three-perf": "^1.0.11",
|
|
26
25
|
"typescript": "~5.9.3",
|
|
27
|
-
"typescript-eslint": "^8.
|
|
28
|
-
"vite": "^7.
|
|
26
|
+
"typescript-eslint": "^8.50.1",
|
|
27
|
+
"vite": "^7.3.0",
|
|
29
28
|
"vite-plugin-glsl": "^1.5.5"
|
|
30
29
|
},
|
|
31
30
|
"dependencies": {
|
|
31
|
+
"@benjos/cookware": "^1.0.0",
|
|
32
|
+
"@benjos/spices": "^1.0.1",
|
|
32
33
|
"@dimforge/rapier3d": "^0.19.3",
|
|
33
|
-
"gsap": "^3.14.
|
|
34
|
+
"gsap": "^3.14.2",
|
|
34
35
|
"howler": "^2.2.4",
|
|
35
36
|
"lil-gui": "^0.21.0",
|
|
36
|
-
"three": "^0.
|
|
37
|
+
"three": "^0.182.0"
|
|
37
38
|
}
|
|
38
39
|
}
|
|
@@ -5,7 +5,8 @@ Custom boilerplate for Three.js projects with CLI scaffolding.
|
|
|
5
5
|
## 🚀 Quick Start
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
|
-
npm
|
|
8
|
+
npm i
|
|
9
|
+
npm run dev
|
|
9
10
|
```
|
|
10
11
|
|
|
11
12
|
## ✨ Features
|
|
@@ -16,19 +17,6 @@ npm create @benjos/boilerplate@latest
|
|
|
16
17
|
- Manager-based architecture
|
|
17
18
|
- ESLint + Prettier
|
|
18
19
|
|
|
19
|
-
## 📦 Usage
|
|
20
|
-
|
|
21
|
-
```bash
|
|
22
|
-
# Interactive
|
|
23
|
-
npm create @benjos/boilerplate@latest
|
|
24
|
-
|
|
25
|
-
# With name
|
|
26
|
-
npm create @benjos/boilerplate@latest my-project
|
|
27
|
-
|
|
28
|
-
# Current directory
|
|
29
|
-
npm create @benjos/boilerplate@latest .
|
|
30
|
-
```
|
|
31
|
-
|
|
32
20
|
## 🐛 Debug Mode
|
|
33
21
|
|
|
34
22
|
Add `#debug` to URL: `http://localhost:5173/#debug`
|
|
@@ -38,12 +26,6 @@ Add `#debug` to URL: `http://localhost:5173/#debug`
|
|
|
38
26
|
- `Shift + W` → Wireframe
|
|
39
27
|
- `Ctrl + Click` → Center on object
|
|
40
28
|
|
|
41
|
-
## 🛠️ Development
|
|
42
|
-
|
|
43
|
-
CLI development: [packages/cli/README.md](packages/cli/README.md)
|
|
44
|
-
|
|
45
|
-
Publishing: [docs/PUBLISHING.md](docs/PUBLISHING.md)
|
|
46
|
-
|
|
47
29
|
## 📄 License
|
|
48
30
|
|
|
49
31
|
MIT
|
|
@@ -6,7 +6,14 @@ import MainThree from './engines/threes/MainThree';
|
|
|
6
6
|
import LoaderManager from './managers/LoaderManager';
|
|
7
7
|
|
|
8
8
|
export default class Experience {
|
|
9
|
+
private static _isInitialized = false;
|
|
10
|
+
|
|
9
11
|
public static Init(): void {
|
|
12
|
+
if (Experience._isInitialized) {
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
Experience._isInitialized = true;
|
|
16
|
+
|
|
10
17
|
InitCommand.Init();
|
|
11
18
|
MainHTML.Init();
|
|
12
19
|
MainThree.Init();
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { KeyboardConstant } from '@benjos/spices';
|
|
1
2
|
import { Vector3 } from 'three';
|
|
2
3
|
import { OrbitControls } from 'three/examples/jsm/Addons.js';
|
|
3
|
-
import { KeyboardConstant } from '../../constants/doms/KeyboardConstant';
|
|
4
4
|
import { CameraId } from '../../constants/experiences/CameraId';
|
|
5
5
|
import { CameraType } from '../../constants/experiences/CameraType';
|
|
6
6
|
import MainThree from '../../engines/threes/MainThree';
|
|
@@ -21,7 +21,7 @@ export default class DebugThreeCameraController extends ThreeCameraControllerBas
|
|
|
21
21
|
};
|
|
22
22
|
private static readonly _DEFAULT_CAMERA_POSITION: Vector3 = new Vector3(0, 1.5, 3);
|
|
23
23
|
private static readonly _CONTROLS_DAMPING_FACTOR: number = 0.05;
|
|
24
|
-
private static readonly _CONTROLS_CENTER_KEY: string = KeyboardConstant.
|
|
24
|
+
private static readonly _CONTROLS_CENTER_KEY: string = KeyboardConstant.CODES.CONTROL_LEFT;
|
|
25
25
|
//
|
|
26
26
|
//#endregion
|
|
27
27
|
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { AssetUtils } from '@benjos/cookware';
|
|
1
2
|
import { AssetId } from '../constants/experiences/AssetId';
|
|
2
3
|
import DebugManager from '../managers/DebugManager';
|
|
3
4
|
import { KeyboardManager } from '../managers/KeyboardManager';
|
|
@@ -9,16 +10,20 @@ import ThreeCameraControllerManager from '../managers/threes/ThreeCameraControll
|
|
|
9
10
|
import ThreeRaycasterManager from '../managers/threes/ThreeRaycasterManager';
|
|
10
11
|
import TickerManager from '../managers/TickerManager';
|
|
11
12
|
import ViewProxy from '../proxies/ViewProxy';
|
|
12
|
-
import AssetUtils from '../utils/AssetUtils';
|
|
13
13
|
|
|
14
14
|
export default class InitCommand {
|
|
15
15
|
public static Init(): void {
|
|
16
|
+
InitCommand._InitUtils();
|
|
16
17
|
InitCommand._InitProxies();
|
|
17
18
|
InitCommand._InitManagers();
|
|
18
19
|
InitCommand._InitCommon();
|
|
19
20
|
InitCommand._InitThree();
|
|
20
21
|
}
|
|
21
22
|
|
|
23
|
+
private static _InitUtils(): void {
|
|
24
|
+
AssetUtils.init();
|
|
25
|
+
}
|
|
26
|
+
|
|
22
27
|
private static _InitProxies(): void {
|
|
23
28
|
ViewProxy.Init();
|
|
24
29
|
}
|
|
@@ -40,9 +45,9 @@ export default class InitCommand {
|
|
|
40
45
|
}
|
|
41
46
|
|
|
42
47
|
private static _InitThree(): void {
|
|
43
|
-
ThreeAssetsManager.AddHDR(AssetId.THREE_HDR_TEMPLATE, AssetUtils.
|
|
44
|
-
ThreeAssetsManager.AddModel(AssetId.THREE_GLTF_TEMPLATE, AssetUtils.
|
|
45
|
-
ThreeAssetsManager.AddTexture(AssetId.THREE_TEXTURE_TEMPLATE, AssetUtils.
|
|
46
|
-
ThreeAssetsManager.AddFont(AssetId.THREE_FONT_TEMPLATE, AssetUtils.
|
|
48
|
+
ThreeAssetsManager.AddHDR(AssetId.THREE_HDR_TEMPLATE, AssetUtils.getPath('hdrs/template.hdr'));
|
|
49
|
+
ThreeAssetsManager.AddModel(AssetId.THREE_GLTF_TEMPLATE, AssetUtils.getPath('models/template.glb'));
|
|
50
|
+
ThreeAssetsManager.AddTexture(AssetId.THREE_TEXTURE_TEMPLATE, AssetUtils.getPath('textures/template.jpg'));
|
|
51
|
+
ThreeAssetsManager.AddFont(AssetId.THREE_FONT_TEMPLATE, AssetUtils.getPath('fonts/template.typeface.json'));
|
|
47
52
|
}
|
|
48
53
|
}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
import { DomUtils } from '@benjos/cookware';
|
|
2
|
+
import { KeyboardConstant } from '@benjos/spices';
|
|
1
3
|
import { MeshStandardMaterial, Scene } from 'three';
|
|
2
4
|
import type ThreeCameraControllerBase from '../../cameras/threes/bases/ThreeCameraControllerBase';
|
|
3
5
|
import DebugThreeCameraController from '../../cameras/threes/DebugThreeCameraController';
|
|
4
6
|
import LoaderThreeCameraController from '../../cameras/threes/LoaderThreeCameraController';
|
|
5
7
|
import MainThreeCameraController from '../../cameras/threes/MainThreeCameraController';
|
|
6
|
-
import { KeyboardConstant } from '../../constants/doms/KeyboardConstant';
|
|
7
8
|
import { CameraId } from '../../constants/experiences/CameraId';
|
|
8
9
|
import { ViewId } from '../../constants/experiences/ViewId';
|
|
9
10
|
import DebugManager from '../../managers/DebugManager';
|
|
@@ -15,7 +16,6 @@ import ViewProxy from '../../proxies/ViewProxy';
|
|
|
15
16
|
import WebGLRendererBase from '../../renderers/threes/bases/WebGLRendererBase';
|
|
16
17
|
import LoaderRenderer from '../../renderers/threes/LoaderRenderer';
|
|
17
18
|
import Renderer from '../../renderers/threes/Renderer';
|
|
18
|
-
import DomUtils from '../../utils/DomUtils';
|
|
19
19
|
import LoaderThreeView from '../../views/threes/loaders/LoaderThreeView';
|
|
20
20
|
import WorldThreeView from '../../views/threes/worlds/WorldThreeView';
|
|
21
21
|
|
|
@@ -33,12 +33,12 @@ export default class MainThree {
|
|
|
33
33
|
//
|
|
34
34
|
private static readonly _DEBUG_WIREFRAME_MATERIAL_COLOR: number = 0x3f79f3;
|
|
35
35
|
private static readonly _TOGGLE_SWITCH_TO_DEBUG_CAMERA_KEYS: string[] = [
|
|
36
|
-
KeyboardConstant.
|
|
37
|
-
KeyboardConstant.
|
|
36
|
+
KeyboardConstant.CODES.SHIFT_LEFT,
|
|
37
|
+
KeyboardConstant.CODES.KEY_C,
|
|
38
38
|
];
|
|
39
39
|
private static readonly _TOGGLE_WIREFRAME_KEYS: string[] = [
|
|
40
|
-
KeyboardConstant.
|
|
41
|
-
KeyboardConstant.
|
|
40
|
+
KeyboardConstant.CODES.SHIFT_LEFT,
|
|
41
|
+
KeyboardConstant.CODES.KEY_W,
|
|
42
42
|
];
|
|
43
43
|
//
|
|
44
44
|
//#endregion
|
|
@@ -46,8 +46,8 @@ export default class MainThree {
|
|
|
46
46
|
public static Init(): void {
|
|
47
47
|
TickerManager.Add(MainThree.Update);
|
|
48
48
|
|
|
49
|
-
MainThree._DomElementContainer = DomUtils.
|
|
50
|
-
MainThree._LoaderDomElementContainer = DomUtils.
|
|
49
|
+
MainThree._DomElementContainer = DomUtils.getApp();
|
|
50
|
+
MainThree._LoaderDomElementContainer = DomUtils.getLoader();
|
|
51
51
|
|
|
52
52
|
MainThree._GenerateScenes();
|
|
53
53
|
MainThree._GenerateCameras();
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { KeyboardConstant } from '@benjos/spices';
|
|
1
2
|
import GUI from 'lil-gui';
|
|
2
3
|
import { ThreePerf } from 'three-perf';
|
|
3
|
-
import { KeyboardConstant } from '../constants/doms/KeyboardConstant';
|
|
4
4
|
import MainThree from '../engines/threes/MainThree';
|
|
5
5
|
import { KeyboardManager } from './KeyboardManager';
|
|
6
6
|
|
|
@@ -16,8 +16,8 @@ export default class DebugManager {
|
|
|
16
16
|
private static readonly _THREE_PERF_ANCHOR_X: 'left' | 'right' = 'left';
|
|
17
17
|
private static readonly _THREE_PERF_ANCHOR_Y: 'top' | 'bottom' = 'bottom';
|
|
18
18
|
private static readonly _TOGGLE_HIDDEN_KEYS: string[] = [
|
|
19
|
-
KeyboardConstant.
|
|
20
|
-
KeyboardConstant.
|
|
19
|
+
KeyboardConstant.CODES.SHIFT_LEFT,
|
|
20
|
+
KeyboardConstant.CODES.KEY_H,
|
|
21
21
|
];
|
|
22
22
|
//
|
|
23
23
|
//#endregion
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
1
|
+
import { Action } from '@benjos/cookware';
|
|
2
|
+
import { DomEvent } from '@benjos/spices';
|
|
3
3
|
|
|
4
4
|
export class KeyboardManager {
|
|
5
5
|
private static readonly _KeyDownsMap = new Map<string, boolean>();
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Action, AssetUtils } from '@benjos/cookware';
|
|
1
2
|
import {
|
|
2
3
|
DataTexture,
|
|
3
4
|
EquirectangularRefractionMapping,
|
|
@@ -12,8 +13,6 @@ import {
|
|
|
12
13
|
import { DRACOLoader, Font, FontLoader, GLTFLoader, HDRLoader, type GLTF } from 'three/examples/jsm/Addons.js';
|
|
13
14
|
import type { AssetId } from '../../constants/experiences/AssetId';
|
|
14
15
|
import { AssetType } from '../../constants/experiences/AssetType';
|
|
15
|
-
import Action from '../../tools/Action';
|
|
16
|
-
import AssetUtils from '../../utils/AssetUtils';
|
|
17
16
|
import LoaderManager from '../LoaderManager';
|
|
18
17
|
|
|
19
18
|
export interface IThreeAssetToLoad {
|
|
@@ -25,7 +24,7 @@ export interface IThreeAssetToLoad {
|
|
|
25
24
|
totalSize: number;
|
|
26
25
|
}
|
|
27
26
|
|
|
28
|
-
export interface IThreeAssetOption {}
|
|
27
|
+
export interface IThreeAssetOption { }
|
|
29
28
|
|
|
30
29
|
export interface IThreeTextureOption extends IThreeAssetOption {
|
|
31
30
|
colorSpace?: ColorSpace;
|
|
@@ -41,9 +40,9 @@ export interface IThreeHDROption extends IThreeAssetOption {
|
|
|
41
40
|
colorSpace?: ColorSpace;
|
|
42
41
|
}
|
|
43
42
|
|
|
44
|
-
export interface IThreeModelOption extends IThreeAssetOption {}
|
|
43
|
+
export interface IThreeModelOption extends IThreeAssetOption { }
|
|
45
44
|
|
|
46
|
-
export interface IThreeFontOption extends IThreeAssetOption {}
|
|
45
|
+
export interface IThreeFontOption extends IThreeAssetOption { }
|
|
47
46
|
|
|
48
47
|
export default class ThreeAssetsManager {
|
|
49
48
|
private static readonly _Assets: Map<string, Texture | DataTexture | GLTF | Font> = new Map<
|
|
@@ -80,7 +79,7 @@ export default class ThreeAssetsManager {
|
|
|
80
79
|
//#endregion
|
|
81
80
|
|
|
82
81
|
public static Init(): void {
|
|
83
|
-
ThreeAssetsManager._DracoLoader.setDecoderPath(AssetUtils.
|
|
82
|
+
ThreeAssetsManager._DracoLoader.setDecoderPath(AssetUtils.getPath(ThreeAssetsManager._DRACO_LOADER_PATH));
|
|
84
83
|
ThreeAssetsManager._GltfLoader.setDRACOLoader(ThreeAssetsManager._DracoLoader);
|
|
85
84
|
ThreeAssetsManager._AddCallbacks();
|
|
86
85
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { Action } from '@benjos/cookware';
|
|
1
2
|
import type ThreeCameraControllerBase from '../../cameras/threes/bases/ThreeCameraControllerBase';
|
|
2
3
|
import type { CameraId } from '../../constants/experiences/CameraId';
|
|
3
|
-
import Action from '../../tools/Action';
|
|
4
4
|
|
|
5
5
|
export default class ThreeCameraControllerManager {
|
|
6
6
|
private static readonly _ThreeCameraControllers = new Map<CameraId, ThreeCameraControllerBase>();
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { ViewId } from '../constants/experiences/ViewId';
|
|
2
|
+
import { ViewType } from '../constants/experiences/ViewType';
|
|
2
3
|
import type ViewBase from '../views/bases/ViewBase';
|
|
3
4
|
|
|
4
5
|
type ViewConstructor<T extends ViewBase> = new (id: ViewId) => T;
|
|
@@ -27,4 +28,18 @@ export default class ViewProxy {
|
|
|
27
28
|
public static Has(viewId: ViewId): boolean {
|
|
28
29
|
return ViewProxy._Views.has(viewId);
|
|
29
30
|
}
|
|
31
|
+
|
|
32
|
+
public static GetAll<T extends ViewBase>(type?: ViewType): T[] {
|
|
33
|
+
const views: T[] = [];
|
|
34
|
+
|
|
35
|
+
ViewProxy._Views.forEach((view) => {
|
|
36
|
+
if (type && type === view.type) {
|
|
37
|
+
views.push(view as T);
|
|
38
|
+
} else {
|
|
39
|
+
views.push(view as T);
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
return views;
|
|
44
|
+
}
|
|
30
45
|
}
|
|
@@ -1,18 +1,23 @@
|
|
|
1
1
|
import type { ViewId } from '../../constants/experiences/ViewId';
|
|
2
|
+
import type { ViewType } from '../../constants/experiences/ViewType';
|
|
2
3
|
|
|
3
4
|
export default class ViewBase {
|
|
4
5
|
private readonly _id: ViewId;
|
|
6
|
+
private readonly _type: ViewType;
|
|
7
|
+
protected _isVisible: boolean;
|
|
5
8
|
|
|
6
|
-
constructor(id: ViewId) {
|
|
9
|
+
constructor(id: ViewId, type: ViewType) {
|
|
7
10
|
this._id = id;
|
|
11
|
+
this._type = type;
|
|
12
|
+
this._isVisible = false;
|
|
8
13
|
}
|
|
9
14
|
|
|
10
15
|
protected _show(): void {
|
|
11
|
-
|
|
16
|
+
this._isVisible = true;
|
|
12
17
|
}
|
|
13
18
|
|
|
14
19
|
protected _hide(): void {
|
|
15
|
-
|
|
20
|
+
this._isVisible = false;
|
|
16
21
|
}
|
|
17
22
|
|
|
18
23
|
//#region Getters
|
|
@@ -20,6 +25,12 @@ export default class ViewBase {
|
|
|
20
25
|
public get id(): ViewId {
|
|
21
26
|
return this._id;
|
|
22
27
|
}
|
|
28
|
+
public get type(): ViewType {
|
|
29
|
+
return this._type;
|
|
30
|
+
}
|
|
31
|
+
public get isVisible(): boolean {
|
|
32
|
+
return this._isVisible;
|
|
33
|
+
}
|
|
23
34
|
//
|
|
24
35
|
//#endregion
|
|
25
36
|
}
|
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { DomUtils } from '@benjos/cookware';
|
|
2
|
+
import { DomEvent } from '@benjos/spices';
|
|
2
3
|
import type { ViewId } from '../../../constants/experiences/ViewId';
|
|
3
|
-
import
|
|
4
|
+
import { ViewType } from '../../../constants/experiences/ViewType';
|
|
4
5
|
import ViewBase from '../../bases/ViewBase';
|
|
5
6
|
|
|
6
7
|
export default abstract class HTMLViewBase extends ViewBase {
|
|
7
8
|
private readonly _parentElement: HTMLElement;
|
|
8
9
|
protected readonly _htmlContainer: HTMLDivElement;
|
|
9
10
|
|
|
10
|
-
constructor(id: ViewId, parentElement: HTMLElement = DomUtils.
|
|
11
|
-
super(id);
|
|
11
|
+
constructor(id: ViewId, parentElement: HTMLElement = DomUtils.getApp()) {
|
|
12
|
+
super(id, ViewType.HTML);
|
|
12
13
|
this._parentElement = parentElement;
|
|
13
14
|
this._htmlContainer = document.createElement('div');
|
|
14
15
|
this._htmlContainer.classList.add('view-html-container');
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { DomUtils } from '@benjos/cookware';
|
|
1
2
|
import { ViewId } from '../../../constants/experiences/ViewId';
|
|
2
3
|
import LoaderManager from '../../../managers/LoaderManager';
|
|
3
|
-
import DomUtils from '../../../utils/DomUtils';
|
|
4
4
|
import HTMLViewBase from '../bases/HTMLViewBase';
|
|
5
5
|
import HTMLTemplateLoader from './components/HTMLTemplateLoader';
|
|
6
6
|
|
|
@@ -8,7 +8,7 @@ export default class LoaderHTMLView extends HTMLViewBase {
|
|
|
8
8
|
declare private _htmlLoader: HTMLTemplateLoader;
|
|
9
9
|
|
|
10
10
|
constructor(id: ViewId) {
|
|
11
|
-
super(id, DomUtils.
|
|
11
|
+
super(id, DomUtils.getLoader());
|
|
12
12
|
|
|
13
13
|
this._generateLoader();
|
|
14
14
|
|
|
@@ -19,7 +19,7 @@ export default class LoaderHTMLView extends HTMLViewBase {
|
|
|
19
19
|
private _generateLoader(): void {
|
|
20
20
|
this._htmlLoader = new HTMLTemplateLoader();
|
|
21
21
|
this._htmlContainer.appendChild(this._htmlLoader.htmlElement);
|
|
22
|
-
DomUtils.
|
|
22
|
+
DomUtils.getLoader().appendChild(this._htmlContainer);
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
private readonly _onBeginLoad = (): void => {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Object3D, Scene } from 'three';
|
|
2
2
|
import type { ViewId } from '../../../constants/experiences/ViewId';
|
|
3
|
+
import { ViewType } from '../../../constants/experiences/ViewType';
|
|
3
4
|
import MainThree from '../../../engines/threes/MainThree';
|
|
4
5
|
import ViewBase from '../../bases/ViewBase';
|
|
5
6
|
|
|
@@ -8,7 +9,7 @@ export default abstract class ThreeViewBase extends ViewBase {
|
|
|
8
9
|
protected _container: Object3D;
|
|
9
10
|
|
|
10
11
|
constructor(id: ViewId, scene: Scene = MainThree.Scene) {
|
|
11
|
-
super(id);
|
|
12
|
+
super(id, ViewType.THREE);
|
|
12
13
|
|
|
13
14
|
this._scene = scene;
|
|
14
15
|
this._container = new Object3D();
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
# 📦 Publishing Guide
|
|
2
|
-
|
|
3
|
-
## First Publish
|
|
4
|
-
|
|
5
|
-
```bash
|
|
6
|
-
npm login
|
|
7
|
-
cd packages/cli
|
|
8
|
-
npm run build
|
|
9
|
-
npm publish --access public
|
|
10
|
-
```
|
|
11
|
-
|
|
12
|
-
## Updates
|
|
13
|
-
|
|
14
|
-
```bash
|
|
15
|
-
cd packages/cli
|
|
16
|
-
npm version patch # or minor/major
|
|
17
|
-
npm publish --access public
|
|
18
|
-
```
|
|
19
|
-
|
|
20
|
-
## Version Types
|
|
21
|
-
|
|
22
|
-
- `patch` → 1.0.0 → 1.0.1 (bug fixes)
|
|
23
|
-
- `minor` → 1.0.0 → 1.1.0 (new features)
|
|
24
|
-
- `major` → 1.0.0 → 2.0.0 (breaking changes)
|
|
25
|
-
|
|
26
|
-
## Test Before Publishing
|
|
27
|
-
|
|
28
|
-
```bash
|
|
29
|
-
npm pack --dry-run
|
|
30
|
-
```
|
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
export const DomEvent = {
|
|
2
|
-
// Mouse Events
|
|
3
|
-
CLICK: 'click',
|
|
4
|
-
DOUBLE_CLICK: 'dblclick',
|
|
5
|
-
MOUSE_DOWN: 'mousedown',
|
|
6
|
-
MOUSE_UP: 'mouseup',
|
|
7
|
-
MOUSE_MOVE: 'mousemove',
|
|
8
|
-
MOUSE_ENTER: 'mouseenter',
|
|
9
|
-
MOUSE_LEAVE: 'mouseleave',
|
|
10
|
-
MOUSE_WHEEL: 'wheel',
|
|
11
|
-
CONTEXT_MENU: 'contextmenu',
|
|
12
|
-
|
|
13
|
-
// Pointer Events
|
|
14
|
-
POINTER_DOWN: 'pointerdown',
|
|
15
|
-
POINTER_MOVE: 'pointermove',
|
|
16
|
-
POINTER_UP: 'pointerup',
|
|
17
|
-
POINTER_ENTER: 'pointerenter',
|
|
18
|
-
POINTER_LEAVE: 'pointerleave',
|
|
19
|
-
POINTER_CANCEL: 'pointercancel',
|
|
20
|
-
|
|
21
|
-
// Touch Events
|
|
22
|
-
TOUCH_START: 'touchstart',
|
|
23
|
-
TOUCH_MOVE: 'touchmove',
|
|
24
|
-
TOUCH_END: 'touchend',
|
|
25
|
-
TOUCH_CANCEL: 'touchcancel',
|
|
26
|
-
|
|
27
|
-
// Keyboard Events
|
|
28
|
-
KEY_DOWN: 'keydown',
|
|
29
|
-
KEY_UP: 'keyup',
|
|
30
|
-
KEY_PRESS: 'keypress',
|
|
31
|
-
|
|
32
|
-
// Focus Events
|
|
33
|
-
FOCUS: 'focus',
|
|
34
|
-
BLUR: 'blur',
|
|
35
|
-
FOCUS_IN: 'focusin',
|
|
36
|
-
FOCUS_OUT: 'focusout',
|
|
37
|
-
|
|
38
|
-
// Form Events
|
|
39
|
-
CHANGE: 'change',
|
|
40
|
-
INPUT: 'input',
|
|
41
|
-
SUBMIT: 'submit',
|
|
42
|
-
RESET: 'reset',
|
|
43
|
-
|
|
44
|
-
// Document Events
|
|
45
|
-
FULLSCREEN_CHANGE: 'fullscreenchange',
|
|
46
|
-
FULLSCREEN_ERROR: 'fullscreenerror',
|
|
47
|
-
VISIBILITY_CHANGE: 'visibilitychange',
|
|
48
|
-
|
|
49
|
-
// Window Events
|
|
50
|
-
DOM_CONTENT_LOADED: 'DOMContentLoaded',
|
|
51
|
-
READY_STATE_CHANGE: 'readystatechange',
|
|
52
|
-
ERROR: 'error',
|
|
53
|
-
LOAD: 'load',
|
|
54
|
-
UNLOAD: 'unload',
|
|
55
|
-
BEFORE_UNLOAD: 'beforeunload',
|
|
56
|
-
RESIZE: 'resize',
|
|
57
|
-
SCROLL: 'scroll',
|
|
58
|
-
|
|
59
|
-
// Clipboard Events
|
|
60
|
-
CUT: 'cut',
|
|
61
|
-
COPY: 'copy',
|
|
62
|
-
PASTE: 'paste',
|
|
63
|
-
|
|
64
|
-
// Drag and Drop Events
|
|
65
|
-
DRAG: 'drag',
|
|
66
|
-
DRAG_START: 'dragstart',
|
|
67
|
-
DRAG_END: 'dragend',
|
|
68
|
-
DRAG_ENTER: 'dragenter',
|
|
69
|
-
DRAG_LEAVE: 'dragleave',
|
|
70
|
-
DRAG_OVER: 'dragover',
|
|
71
|
-
DROP: 'drop',
|
|
72
|
-
|
|
73
|
-
// Media Events
|
|
74
|
-
PLAY: 'play',
|
|
75
|
-
PAUSE: 'pause',
|
|
76
|
-
ENDED: 'ended',
|
|
77
|
-
CAN_PLAY: 'canplay',
|
|
78
|
-
TIME_UPDATE: 'timeupdate',
|
|
79
|
-
|
|
80
|
-
// Animation Events
|
|
81
|
-
ANIMATION_START: 'animationstart',
|
|
82
|
-
ANIMATION_END: 'animationend',
|
|
83
|
-
ANIMATION_ITERATION: 'animationiteration',
|
|
84
|
-
|
|
85
|
-
// Transition Events
|
|
86
|
-
TRANSITION_START: 'transitionstart',
|
|
87
|
-
TRANSITION_END: 'transitionend',
|
|
88
|
-
TRANSITION_CANCEL: 'transitioncancel',
|
|
89
|
-
|
|
90
|
-
// Other Events
|
|
91
|
-
BEFORE_PRINT: 'beforeprint',
|
|
92
|
-
AFTER_PRINT: 'afterprint',
|
|
93
|
-
HASH_CHANGE: 'hashchange',
|
|
94
|
-
POP_STATE: 'popstate',
|
|
95
|
-
STORAGE: 'storage',
|
|
96
|
-
ONLINE: 'online',
|
|
97
|
-
OFFLINE: 'offline',
|
|
98
|
-
} as const;
|
|
99
|
-
|
|
100
|
-
export type DomEvent = (typeof DomEvent)[keyof typeof DomEvent];
|