angular-three 2.0.0-beta.7 → 2.0.0-beta.9
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 +4 -147
- package/esm2022/angular-three.mjs +1 -1
- package/esm2022/index.mjs +10 -9
- package/esm2022/lib/before-render.mjs +13 -0
- package/esm2022/lib/canvas.mjs +129 -161
- package/esm2022/lib/directives/args.mjs +14 -12
- package/esm2022/lib/directives/common.mjs +28 -27
- package/esm2022/lib/directives/key.mjs +29 -0
- package/esm2022/lib/directives/parent.mjs +13 -11
- package/esm2022/lib/directives/repeat.mjs +5 -6
- package/esm2022/lib/dom/events.mjs +6 -1
- package/esm2022/lib/events.mjs +75 -58
- package/esm2022/lib/instance.mjs +65 -0
- package/esm2022/lib/loader.mjs +17 -20
- package/esm2022/lib/loop.mjs +6 -3
- package/esm2022/lib/portal.mjs +103 -112
- package/esm2022/lib/ref.mjs +48 -0
- package/esm2022/lib/renderer/catalogue.mjs +7 -0
- package/esm2022/lib/renderer/constants.mjs +21 -0
- package/esm2022/lib/renderer/index.mjs +409 -0
- package/esm2022/lib/renderer/store.mjs +62 -39
- package/esm2022/lib/renderer/utils.mjs +26 -43
- package/esm2022/lib/roots.mjs +249 -0
- package/esm2022/lib/routed-scene.mjs +6 -7
- package/esm2022/lib/store.mjs +207 -0
- package/esm2022/lib/three-types.mjs +1 -1
- package/esm2022/lib/types.mjs +1 -1
- package/esm2022/lib/utils/apply-props.mjs +14 -8
- package/esm2022/lib/utils/assert-injection-context.mjs +14 -0
- package/esm2022/lib/utils/attach.mjs +2 -2
- package/esm2022/lib/utils/create-injection-token.mjs +47 -0
- package/esm2022/lib/utils/is.mjs +1 -1
- package/esm2022/lib/utils/make.mjs +1 -1
- package/esm2022/lib/utils/safe-detect-changes.mjs +15 -13
- package/esm2022/lib/utils/signal-store.mjs +91 -0
- package/esm2022/lib/utils/update.mjs +1 -1
- package/fesm2022/angular-three.mjs +1580 -1430
- package/fesm2022/angular-three.mjs.map +1 -1
- package/index.d.ts +10 -8
- package/lib/{di/before-render.d.ts → before-render.d.ts} +1 -1
- package/lib/canvas.d.ts +81 -11
- package/lib/directives/args.d.ts +2 -2
- package/lib/directives/common.d.ts +5 -1
- package/lib/directives/key.d.ts +10 -0
- package/lib/directives/parent.d.ts +5 -5
- package/lib/dom/events.d.ts +3 -2
- package/lib/events.d.ts +78 -2
- package/lib/instance.d.ts +36 -0
- package/lib/loader.d.ts +13 -2
- package/lib/loop.d.ts +64 -6
- package/lib/portal.d.ts +21 -12
- package/lib/{di/ref.d.ts → ref.d.ts} +3 -2
- package/lib/renderer/catalogue.d.ts +9 -0
- package/lib/renderer/constants.d.ts +20 -0
- package/lib/renderer/index.d.ts +5 -0
- package/lib/renderer/store.d.ts +21 -15
- package/lib/renderer/utils.d.ts +29 -19
- package/lib/roots.d.ts +11 -0
- package/lib/routed-scene.d.ts +1 -1
- package/lib/store.d.ts +143 -0
- package/lib/three-types.d.ts +5 -5
- package/lib/types.d.ts +1 -310
- package/lib/utils/apply-props.d.ts +4 -2
- package/lib/utils/attach.d.ts +4 -2
- package/lib/utils/create-injection-token.d.ts +27 -0
- package/lib/utils/is.d.ts +3 -2
- package/lib/utils/make.d.ts +12 -1
- package/lib/utils/safe-detect-changes.d.ts +2 -2
- package/lib/utils/signal-store.d.ts +17 -0
- package/lib/utils/update.d.ts +1 -1
- package/metadata.json +1 -0
- package/package.json +4 -4
- package/plugin/README.md +11 -0
- package/plugin/generators.json +49 -0
- package/plugin/package.json +6 -0
- package/plugin/src/generators/init/compat.d.ts +2 -0
- package/plugin/src/generators/init/compat.js +6 -0
- package/plugin/src/generators/init/compat.js.map +1 -0
- package/plugin/src/generators/init/generator.d.ts +2 -0
- package/plugin/src/generators/init/generator.js +48 -0
- package/plugin/src/generators/init/generator.js.map +1 -0
- package/plugin/src/generators/init/schema.json +6 -0
- package/plugin/src/generators/init-cannon/compat.d.ts +2 -0
- package/plugin/src/generators/init-cannon/compat.js +6 -0
- package/plugin/src/generators/init-cannon/compat.js.map +1 -0
- package/plugin/src/generators/init-cannon/generator.d.ts +2 -0
- package/plugin/src/generators/init-cannon/generator.js +22 -0
- package/plugin/src/generators/init-cannon/generator.js.map +1 -0
- package/plugin/src/generators/init-cannon/schema.json +6 -0
- package/plugin/src/generators/init-postprocessing/compat.d.ts +2 -0
- package/plugin/src/generators/init-postprocessing/compat.js +6 -0
- package/plugin/src/generators/init-postprocessing/compat.js.map +1 -0
- package/plugin/src/generators/init-postprocessing/generator.d.ts +2 -0
- package/plugin/src/generators/init-postprocessing/generator.js +20 -0
- package/plugin/src/generators/init-postprocessing/generator.js.map +1 -0
- package/plugin/src/generators/init-postprocessing/schema.json +6 -0
- package/plugin/src/generators/init-soba/compat.d.ts +2 -0
- package/plugin/src/generators/init-soba/compat.js +6 -0
- package/plugin/src/generators/init-soba/compat.js.map +1 -0
- package/plugin/src/generators/init-soba/generator.d.ts +2 -0
- package/plugin/src/generators/init-soba/generator.js +24 -0
- package/plugin/src/generators/init-soba/generator.js.map +1 -0
- package/plugin/src/generators/init-soba/schema.json +6 -0
- package/plugin/src/generators/versions.d.ts +12 -0
- package/plugin/src/generators/versions.js +16 -0
- package/plugin/src/generators/versions.js.map +1 -0
- package/plugin/src/index.d.ts +3 -0
- package/plugin/src/index.js +10 -0
- package/plugin/src/index.js.map +1 -0
- package/web-types.json +1 -0
- package/esm2022/lib/di/before-render.mjs +0 -13
- package/esm2022/lib/di/catalogue.mjs +0 -7
- package/esm2022/lib/di/ref.mjs +0 -54
- package/esm2022/lib/renderer/di.mjs +0 -3
- package/esm2022/lib/renderer/enums.mjs +0 -2
- package/esm2022/lib/renderer/provider.mjs +0 -18
- package/esm2022/lib/renderer/renderer.mjs +0 -368
- package/esm2022/lib/stores/signal.store.mjs +0 -78
- package/esm2022/lib/stores/store.mjs +0 -420
- package/esm2022/lib/utils/assert-in-injection-context.mjs +0 -14
- package/esm2022/lib/utils/instance.mjs +0 -67
- package/esm2022/lib/utils/timing.mjs +0 -9
- package/lib/di/catalogue.d.ts +0 -3
- package/lib/renderer/di.d.ts +0 -2
- package/lib/renderer/enums.d.ts +0 -26
- package/lib/renderer/provider.d.ts +0 -8
- package/lib/renderer/renderer.d.ts +0 -49
- package/lib/stores/signal.store.d.ts +0 -21
- package/lib/stores/store.d.ts +0 -13
- package/lib/utils/instance.d.ts +0 -4
- package/lib/utils/timing.d.ts +0 -2
- /package/lib/utils/{assert-in-injection-context.d.ts → assert-injection-context.d.ts} +0 -0
package/README.md
CHANGED
|
@@ -1,150 +1,7 @@
|
|
|
1
|
-
#
|
|
1
|
+
# core
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
This library was generated with [Nx](https://nx.dev).
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
## Running unit tests
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
### Angular CLI
|
|
10
|
-
|
|
11
|
-
```shell
|
|
12
|
-
npx ng add angular-three
|
|
13
|
-
```
|
|
14
|
-
|
|
15
|
-
### Nx
|
|
16
|
-
|
|
17
|
-
```shell
|
|
18
|
-
npm i angular-three
|
|
19
|
-
npx nx g angular-three:init
|
|
20
|
-
```
|
|
21
|
-
|
|
22
|
-
### Manual
|
|
23
|
-
|
|
24
|
-
```shell
|
|
25
|
-
npm i angular-three three
|
|
26
|
-
```
|
|
27
|
-
|
|
28
|
-
```shell
|
|
29
|
-
npm i -D @types/three
|
|
30
|
-
```
|
|
31
|
-
|
|
32
|
-
- Adjust `tsconfig.json` (or `tsconfig.base.json`) to include `skipTypeCheck: false`
|
|
33
|
-
|
|
34
|
-
> Typically, we'd want to keep `three` and `@types/three` on the same minor version. Eg: `0.147`, `0.148` etc..
|
|
35
|
-
|
|
36
|
-
## Type
|
|
37
|
-
|
|
38
|
-
### VSCode
|
|
39
|
-
|
|
40
|
-
- If you use `ng add` or `nx generate` command, this is setup for you.
|
|
41
|
-
- If you install `angular-three` manually, you can do the following steps to enable typings
|
|
42
|
-
- Open `.vscode/settings.json`, or create one if you do not have it
|
|
43
|
-
- Add `html.customData` property with the value of `["./node_modules/angular-three/metadata.json"]`. If `html.customData` exists, simply add `"./node_modules/angular-three/metadata.json"` to the array
|
|
44
|
-
|
|
45
|
-
### WebStorm/IntelliJ
|
|
46
|
-
|
|
47
|
-
- You **should not** need to do anything here but if things do not work, you can add `web-types` property to `package.json` with the value of `"./node_modules/angular-three/web-types.json"`
|
|
48
|
-
|
|
49
|
-
### NeoVim
|
|
50
|
-
|
|
51
|
-
Setup will vary depending on your current NeoVim configuration. However, I'd expect the **required** steps to be the same
|
|
52
|
-
|
|
53
|
-
- `neovim/nvim-lspconfig` needs to be configured for `html` LSP
|
|
54
|
-
- `init_options.dataPaths` needs to include the path to `node_modules/angular-three/metadata.json`
|
|
55
|
-
- Setup a `html/customDataContent` handler (`handlers = {["html/customDataContent"] = function() ... end}` for Lua syntax)
|
|
56
|
-
and return the content of the `init_options.dataPaths`
|
|
57
|
-
|
|
58
|
-
Here's an example setup for [LazyVim](https://www.lazyvim.org/)
|
|
59
|
-
|
|
60
|
-
```lua
|
|
61
|
-
return {
|
|
62
|
-
{
|
|
63
|
-
"neovim/nvim-lspconfig",
|
|
64
|
-
---@class PluginLspOpts
|
|
65
|
-
opts = {
|
|
66
|
-
---@type table<string, fun(server:string, opts:_.lspconfig.options):boolean?>
|
|
67
|
-
setup = {
|
|
68
|
-
html = function(_, opts)
|
|
69
|
-
opts.init_options = {
|
|
70
|
-
dataPaths = {
|
|
71
|
-
vim.fn.getcwd() .. "/node_modules/angular-three/metadata.json",
|
|
72
|
-
},
|
|
73
|
-
configurationSection = { "html", "css", "javascript" },
|
|
74
|
-
embeddedLanguages = {
|
|
75
|
-
css = true,
|
|
76
|
-
javascript = true,
|
|
77
|
-
},
|
|
78
|
-
provideFormatter = true,
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
opts.handlers = {
|
|
82
|
-
["html/customDataContent"] = function(err, result, ctx, config)
|
|
83
|
-
local function exists(name)
|
|
84
|
-
if type(name) ~= "string" then
|
|
85
|
-
return false
|
|
86
|
-
end
|
|
87
|
-
return os.execute("test -e " .. name)
|
|
88
|
-
end
|
|
89
|
-
|
|
90
|
-
if not vim.tbl_isempty(result) and #result == 1 then
|
|
91
|
-
if not exists(result[1]) then
|
|
92
|
-
return ""
|
|
93
|
-
end
|
|
94
|
-
local content = vim.fn.join(vim.fn.readfile(result[1]), "\n")
|
|
95
|
-
return content
|
|
96
|
-
end
|
|
97
|
-
return ""
|
|
98
|
-
end,
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
return false
|
|
102
|
-
end,
|
|
103
|
-
},
|
|
104
|
-
},
|
|
105
|
-
},
|
|
106
|
-
}
|
|
107
|
-
```
|
|
108
|
-
|
|
109
|
-
## Documentations
|
|
110
|
-
|
|
111
|
-
Read more about Angular Three usages in [Documentations](https://angular-three-backupjs.netlify.app)
|
|
112
|
-
|
|
113
|
-
## Simple usage
|
|
114
|
-
|
|
115
|
-
1. Create a `Scene` component as a Standalone Component
|
|
116
|
-
|
|
117
|
-
```ts
|
|
118
|
-
import { extend } from 'angular-three';
|
|
119
|
-
import { Mesh, BoxGeometry, MeshBasicMaterial } from 'three';
|
|
120
|
-
|
|
121
|
-
extend({ Mesh, BoxGeometry, MeshBasicMaterial });
|
|
122
|
-
|
|
123
|
-
@Component({
|
|
124
|
-
standalone: true,
|
|
125
|
-
template: `
|
|
126
|
-
<ngt-mesh>
|
|
127
|
-
<ngt-box-geometry />
|
|
128
|
-
<ngt-mesh-basic-material color="darkred" />
|
|
129
|
-
</ngt-mesh>
|
|
130
|
-
`,
|
|
131
|
-
schemas: [CUSTOM_ELEMENTS_SCHEMA],
|
|
132
|
-
})
|
|
133
|
-
export class Scene {}
|
|
134
|
-
```
|
|
135
|
-
|
|
136
|
-
- `extend` will add the THREE entities to `angular-three` catalogue which allows the renderer to recognize the custom tags: `ngt-mesh`, `ngt-box-geometry` etc..
|
|
137
|
-
- Custom Element tags follow this rule: `ngt-` + THREE classes in **kebab-case**. `Mesh` -> `ngt-mesh`
|
|
138
|
-
- `schemas: [CUSTOM_ELEMENTS_SCHEMA]` allows us to use custom tags on the template. This is Angular's limitation at the moment
|
|
139
|
-
|
|
140
|
-
2. Render `<ngt-canvas>` component, use `Scene` component above to pass into `[sceneGraph]` input on `<ngt-canvas>`
|
|
141
|
-
|
|
142
|
-
```html
|
|
143
|
-
<ngt-canvas [sceneGraph]="Scene" />
|
|
144
|
-
```
|
|
145
|
-
|
|
146
|
-
- `ngt-canvas` creates the basic building blocks of THREE.js: a default `WebGLRenderer`, a default `Scene`, and a default `PerspectiveCamera`
|
|
147
|
-
|
|
148
|
-
## Contributions
|
|
149
|
-
|
|
150
|
-
Contributions are welcomed
|
|
7
|
+
Run `nx test core` to execute the unit tests.
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
* Generated bundle index. Do not edit.
|
|
3
3
|
*/
|
|
4
4
|
export * from './index';
|
|
5
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
5
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYW5ndWxhci10aHJlZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL2xpYnMvY29yZS9zcmMvYW5ndWxhci10aHJlZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQTs7R0FFRztBQUVILGNBQWMsU0FBUyxDQUFDIiwic291cmNlc0NvbnRlbnQiOlsiLyoqXG4gKiBHZW5lcmF0ZWQgYnVuZGxlIGluZGV4LiBEbyBub3QgZWRpdC5cbiAqL1xuXG5leHBvcnQgKiBmcm9tICcuL2luZGV4JztcbiJdfQ==
|
package/esm2022/index.mjs
CHANGED
|
@@ -1,25 +1,26 @@
|
|
|
1
|
+
export * from './lib/before-render';
|
|
1
2
|
export * from './lib/canvas';
|
|
2
|
-
export * from './lib/di/before-render';
|
|
3
|
-
export * from './lib/di/catalogue';
|
|
4
|
-
export * from './lib/di/ref';
|
|
5
3
|
export * from './lib/directives/args';
|
|
4
|
+
export * from './lib/directives/key';
|
|
6
5
|
export * from './lib/directives/parent';
|
|
7
6
|
export * from './lib/directives/repeat';
|
|
7
|
+
export * from './lib/instance';
|
|
8
8
|
export * from './lib/loader';
|
|
9
9
|
export { addAfterEffect, addEffect, addTail } from './lib/loop';
|
|
10
10
|
export { NgtPortal, NgtPortalContent } from './lib/portal';
|
|
11
|
+
export * from './lib/ref';
|
|
12
|
+
export * from './lib/renderer';
|
|
11
13
|
export * from './lib/routed-scene';
|
|
12
|
-
export * from './lib/
|
|
13
|
-
export * from './lib/stores/store';
|
|
14
|
+
export * from './lib/store';
|
|
14
15
|
export * from './lib/three-types';
|
|
15
16
|
export * from './lib/types';
|
|
16
17
|
export * from './lib/utils/apply-props';
|
|
17
|
-
export * from './lib/utils/assert-
|
|
18
|
+
export * from './lib/utils/assert-injection-context';
|
|
18
19
|
export { createAttachFunction } from './lib/utils/attach';
|
|
19
|
-
export * from './lib/utils/
|
|
20
|
+
export * from './lib/utils/create-injection-token';
|
|
20
21
|
export * from './lib/utils/is';
|
|
21
22
|
export * from './lib/utils/make';
|
|
22
23
|
export * from './lib/utils/safe-detect-changes';
|
|
23
|
-
export * from './lib/utils/
|
|
24
|
+
export * from './lib/utils/signal-store';
|
|
24
25
|
export * from './lib/utils/update';
|
|
25
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
26
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi9saWJzL2NvcmUvc3JjL2luZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLGNBQWMscUJBQXFCLENBQUM7QUFDcEMsY0FBYyxjQUFjLENBQUM7QUFDN0IsY0FBYyx1QkFBdUIsQ0FBQztBQUN0QyxjQUFjL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ZXMnO1xuZXhwb3J0ICogZnJvbSAnLi9saWIvdXRpbHMvc2lnbmFsLXN0b3JlJztcbmV4cG9ydCAqIGZyb20gJy4vbGliL3V0aWxzL3VwZGF0ZSc7XG4iXX0=
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { DestroyRef, inject, runInInjectionContext } from '@angular/core';
|
|
2
|
+
import { injectNgtStore } from './store';
|
|
3
|
+
import { assertInjectionContext } from './utils/assert-injection-context';
|
|
4
|
+
export function injectBeforeRender(cb, { priority = 0, injector } = {}) {
|
|
5
|
+
injector = assertInjectionContext(injectBeforeRender, injector);
|
|
6
|
+
return runInInjectionContext(injector, () => {
|
|
7
|
+
const store = injectNgtStore();
|
|
8
|
+
const sub = store.get('internal').subscribe(cb, priority, store);
|
|
9
|
+
inject(DestroyRef).onDestroy(() => void sub());
|
|
10
|
+
return sub;
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYmVmb3JlLXJlbmRlci5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uL2xpYnMvY29yZS9zcmMvbGliL2JlZm9yZS1yZW5kZXIudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLFVBQVUsRUFBWSxNQUFNLEVBQUUscUJBQXFCLEVBQUUsTUFBTSxlQUFlLENBQUM7QUFDcEYsT0FBTyxFQUFFLGNBQWMsRUFBOEIsTUFBTSxTQUFTLENBQUM7QUFDckUsT0FBTyxFQUFFLHNCQUFzQixFQUFFLE1BQU0sa0NBQWtDLENBQUM7QUFFMUUsTUFBTSxVQUFVLGtCQUFrQixDQUNqQyxFQUFxQyxFQUNyQyxFQUFFLFFBQVEsR0FBRyxDQUFDLEVBQUUsUUFBUSxLQUFpRCxFQUFFO0lBRTNFLFFBQVEsR0FBRyxzQkFBc0IsQ0FBQyxr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