angular-three 2.0.0-beta.2 → 2.0.0-beta.21
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 +11 -10
- package/esm2022/lib/before-render.mjs +13 -0
- package/esm2022/lib/canvas.mjs +130 -161
- package/esm2022/lib/directives/args.mjs +13 -11
- package/esm2022/lib/directives/common.mjs +29 -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 +30 -37
- package/esm2022/lib/loop.mjs +6 -3
- package/esm2022/lib/portal.mjs +91 -102
- 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 +419 -0
- package/esm2022/lib/renderer/store.mjs +144 -108
- package/esm2022/lib/renderer/utils.mjs +63 -48
- package/esm2022/lib/roots.mjs +249 -0
- package/esm2022/lib/routed-scene.mjs +11 -8
- package/esm2022/lib/store.mjs +207 -0
- package/esm2022/lib/three-types.mjs +2 -2
- package/esm2022/lib/types.mjs +1 -1
- package/esm2022/lib/utils/apply-props.mjs +23 -11
- 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 +1770 -1589
- package/fesm2022/angular-three.mjs.map +1 -1
- package/index.d.ts +10 -9
- 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 +20 -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 +19 -15
- package/lib/renderer/utils.d.ts +28 -18
- 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 +6 -6
- package/lib/types.d.ts +1 -309
- package/lib/utils/apply-props.d.ts +4 -2
- package/lib/utils/attach.d.ts +5 -3
- package/lib/utils/create-injection-token.d.ts +27 -0
- package/lib/utils/is.d.ts +4 -3
- 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 -1
- package/package.json +5 -4
- package/plugin/generators.json +47 -17
- package/plugin/package.json +2 -5
- package/plugin/src/generators/init/compat.d.ts +3 -1
- package/plugin/src/generators/init/compat.js +2 -2
- package/plugin/src/generators/init/compat.js.map +1 -1
- package/plugin/src/generators/init/files/experience/experience.component.html.__tmpl__ +4 -0
- package/plugin/src/generators/init/files/experience/experience.component.ts.__tmpl__ +17 -0
- package/plugin/src/generators/init/generator.d.ts +6 -0
- package/plugin/src/generators/init/generator.js +144 -0
- package/plugin/src/generators/init/generator.js.map +1 -0
- package/plugin/src/generators/init/schema.json +15 -4
- 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 +26 -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/utils.d.ts +2 -0
- package/plugin/src/generators/utils.js +34 -0
- package/plugin/src/generators/utils.js.map +1 -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 -1
- package/plugin/src/index.js +7 -3
- package/plugin/src/index.js.map +1 -1
- package/web-types.json +1 -1
- package/esm2022/lib/di/before-render.mjs +0 -13
- package/esm2022/lib/di/catalogue.mjs +0 -7
- package/esm2022/lib/di/ref.mjs +0 -49
- 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 -365
- package/esm2022/lib/stores/signal.store.mjs +0 -81
- package/esm2022/lib/stores/store.mjs +0 -423
- package/esm2022/lib/utils/assert-in-injection-context.mjs +0 -14
- package/esm2022/lib/utils/instance.mjs +0 -63
- package/esm2022/lib/utils/signal.mjs +0 -24
- package/esm2022/lib/utils/timing.mjs +0 -21
- 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 -20
- package/lib/stores/store.d.ts +0 -13
- package/lib/utils/instance.d.ts +0 -4
- package/lib/utils/signal.d.ts +0 -2
- package/lib/utils/timing.d.ts +0 -4
- package/plugin/src/generators/init/init.d.ts +0 -5
- package/plugin/src/generators/init/init.js +0 -56
- package/plugin/src/generators/init/init.js.map +0 -1
- /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,26 +1,27 @@
|
|
|
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/events';
|
|
8
|
+
export * from './lib/instance';
|
|
8
9
|
export * from './lib/loader';
|
|
9
10
|
export { addAfterEffect, addEffect, addTail } from './lib/loop';
|
|
10
11
|
export { NgtPortal, NgtPortalContent } from './lib/portal';
|
|
12
|
+
export * from './lib/ref';
|
|
13
|
+
export * from './lib/renderer';
|
|
11
14
|
export * from './lib/routed-scene';
|
|
12
|
-
export * from './lib/
|
|
13
|
-
export * from './lib/stores/store';
|
|
15
|
+
export * from './lib/store';
|
|
14
16
|
export * from './lib/three-types';
|
|
15
17
|
export * from './lib/types';
|
|
16
18
|
export * from './lib/utils/apply-props';
|
|
17
|
-
export * from './lib/utils/assert-
|
|
19
|
+
export * from './lib/utils/assert-injection-context';
|
|
18
20
|
export { createAttachFunction } from './lib/utils/attach';
|
|
19
|
-
export * from './lib/utils/
|
|
21
|
+
export * from './lib/utils/create-injection-token';
|
|
20
22
|
export * from './lib/utils/is';
|
|
21
23
|
export * from './lib/utils/make';
|
|
22
24
|
export * from './lib/utils/safe-detect-changes';
|
|
23
|
-
export * from './lib/utils/signal';
|
|
24
|
-
export * from './lib/utils/timing';
|
|
25
|
+
export * from './lib/utils/signal-store';
|
|
25
26
|
export * from './lib/utils/update';
|
|
26
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G9ydCAqIGZyb20gJy4vbGliL3V0aWxzL2Fzc2VydC1pbmplY3Rpb24tY29udGV4dCc7XG5leHBvcnQgeyBjcmVhdGVBdHRhY2hGdW5jdGlvbiB9IGZyb20gJy4vbGliL3V0aWxzL2F0dGFjaCc7XG5leHBvcnQgKiBmcm9tICcuL2xpYi91dGlscy9jcmVhdGUtaW5qZWN0aW9uLXRva2VuJztcbmV4cG9ydCAqIGZyb20gJy4vbGliL3V0aWxzL2lzJztcbmV4cG9ydCAqIGZyb20gJy4vbGliL3V0aWxzL21ha2UnO1xuZXhwb3J0ICogZnJvbSAnLi9saWIvdXRpbHMvc2FmZS1kZXRlY3QtY2hhbmdlcyc7XG5leHBvcnQgKiBmcm9tICcuL2xpYi91dGlscy9zaWduYWwtc3RvcmUnO1xuZXhwb3J0ICogZnJvbSAnLi9saWIvdXRpbHMvdXBkYXRlJztcbiJdfQ==
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { DestroyRef, Injector, 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,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYmVmb3JlLXJlbmRlci5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uL2xpYnMvY29yZS9zcmMvbGliL2JlZm9yZS1yZW5kZXIudHMiXSwibmFtZXMiOltdLCJtYXBwa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