angular-three 2.0.0-beta.301 → 2.0.0-beta.302

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "angular-three",
3
- "version": "2.0.0-beta.301",
3
+ "version": "2.0.0-beta.302",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -83,4 +83,4 @@
83
83
  }
84
84
  },
85
85
  "sideEffects": false
86
- }
86
+ }
@@ -10,11 +10,6 @@
10
10
  "factory": "./src/generators/add-soba/generator",
11
11
  "schema": "./src/generators/add-soba/schema.json",
12
12
  "description": "Add angular-three-soba to your project"
13
- },
14
- "gltf": {
15
- "factory": "./src/generators/gltf/generator",
16
- "schema": "./src/generators/gltf/schema.json",
17
- "description": "gltf generator"
18
13
  }
19
14
  },
20
15
  "schematics": {
@@ -27,11 +22,6 @@
27
22
  "factory": "./src/generators/add-soba/compat",
28
23
  "schema": "./src/generators/add-soba/schema.json",
29
24
  "description": "Add angular-three-soba to your project"
30
- },
31
- "gltf": {
32
- "factory": "./src/generators/gltf/compat",
33
- "schema": "./src/generators/gltf/schema.json",
34
- "description": "gltf generator"
35
- }
25
+ }
36
26
  }
37
27
  }
@@ -1,2 +0,0 @@
1
- declare const _default: (generatorOptions: import("./generator").GltfGeneratorSchema) => (tree: any, context: any) => Promise<any>;
2
- export default _default;
@@ -1,6 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const devkit_1 = require("@nx/devkit");
4
- const generator_1 = require("./generator");
5
- exports.default = (0, devkit_1.convertNxGenerator)(generator_1.default);
6
- //# sourceMappingURL=compat.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"compat.js","sourceRoot":"","sources":["../../../../../../../libs/plugin/src/generators/gltf/compat.ts"],"names":[],"mappings":";;AAAA,uCAAgD;AAChD,2CAAwC;AAExC,kBAAe,IAAA,2BAAkB,EAAC,mBAAa,CAAC,CAAC"}
@@ -1,36 +0,0 @@
1
- import { CUSTOM_ELEMENTS_SCHEMA, Component, ChangeDetectionStrategy } from '@angular/core';
2
- import { extend, NgtGroup } from 'angular-three';
3
- import { injectGLTF } from 'angular-three-soba/loaders';
4
- import * as THREE from 'three';
5
- import { GLTF } from 'three-stdlib';
6
-
7
- interface <%= className %>GLTFResult extends GLTF {
8
- nodes: {},
9
- materials: {}
10
- }
11
-
12
- interface <%= className %>Options extends Partial<NgtGroup> {
13
- /* more options */
14
- }
15
-
16
- @Component({
17
- selector: '<%= selector %>',
18
- standalone: true,
19
- template: `
20
- @if (gltf(); as gltf) {
21
- <ngt-group [dispose]="null" [parameters]="options()">
22
- </ngt-group>
23
- }
24
- `,
25
- schemas: [CUSTOM_ELEMENTS_SCHEMA],
26
- changeDetection: ChangeDetectionStrategy.OnPush,
27
- })
28
- export class <%= className %> {
29
- options = input({} as <%= className %>Options);
30
-
31
- gltf = injectGLTF(() => '<%= runtimeGltfPath %>') as Signal<<%= className %>GLTFResult | null>;
32
-
33
- constructor() {
34
- extend({ Group: THREE.Group });
35
- }
36
- }
@@ -1,11 +0,0 @@
1
- import { Tree } from '@nx/devkit';
2
- export interface GltfGeneratorSchema {
3
- gltfPath: string;
4
- console: boolean;
5
- modelName: string;
6
- meshopt: boolean;
7
- outputPath?: string;
8
- draco?: boolean | string;
9
- }
10
- export declare function gltfGenerator(tree: Tree, options: GltfGeneratorSchema): Promise<void>;
11
- export default gltfGenerator;
@@ -1,105 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.gltfGenerator = gltfGenerator;
4
- const devkit_1 = require("@nx/devkit");
5
- const enquirer_1 = require("enquirer");
6
- const node_path_1 = require("node:path");
7
- const generator_1 = require("../add-soba/generator");
8
- const utils_1 = require("./utils");
9
- function normalizeOptions(options) {
10
- let { gltfPath, console, modelName, outputPath, draco, meshopt } = options;
11
- if (draco == null) {
12
- draco = true;
13
- }
14
- return { gltfPath, console, modelName, outputPath, draco, meshopt };
15
- }
16
- function buildSelector(fileName, prefix) {
17
- return `${prefix}-${fileName}`;
18
- }
19
- async function gltfGenerator(tree, options) {
20
- const packageJson = (0, devkit_1.readJson)(tree, 'package.json');
21
- const hasAngularThreeSoba = packageJson['dependencies']['angular-three-soba'] || packageJson['devDependencies']['angular-three-soba'];
22
- if (!hasAngularThreeSoba) {
23
- devkit_1.logger.warn(`[NGT] angular-three-soba must be installed to use the GLTF generator`);
24
- const { initSoba } = await (0, enquirer_1.prompt)({
25
- type: 'confirm',
26
- name: 'initSoba',
27
- message: 'Would you like to initialize angular-three-soba?',
28
- initial: true,
29
- });
30
- if (!initSoba)
31
- return;
32
- await (0, generator_1.addSobaGenerator)(tree);
33
- }
34
- const projects = (0, devkit_1.getProjects)(tree);
35
- const applicationProjects = Array.from(projects.entries()).reduce((acc, [projectName, project]) => {
36
- if (project.projectType === 'application') {
37
- acc.push(projectName);
38
- }
39
- return acc;
40
- }, []);
41
- let { project } = await (0, enquirer_1.prompt)({
42
- type: 'select',
43
- name: 'project',
44
- message: 'What project would you like to generate the model component for?',
45
- choices: [...applicationProjects, 'custom'],
46
- required: true,
47
- });
48
- if (project === 'custom') {
49
- const { projectName } = await (0, enquirer_1.prompt)({
50
- type: 'input',
51
- name: 'projectName',
52
- message: 'What is the name of the project to generate the model component for?',
53
- required: true,
54
- });
55
- project = projectName;
56
- }
57
- const projectConfig = (0, devkit_1.readProjectConfiguration)(tree, project);
58
- if (!projectConfig) {
59
- devkit_1.logger.error(`[NGT] ${project} is not a project`);
60
- return;
61
- }
62
- try {
63
- const { gltfPath, console: toConsole, modelName, outputPath, draco, meshopt } = normalizeOptions(options);
64
- let runtimeGltfPath;
65
- if (!gltfPath.startsWith('http')) {
66
- const { path } = await (0, enquirer_1.prompt)({
67
- type: 'input',
68
- name: 'path',
69
- message: 'What is the path to the asset file to be used at runtime with injectGLTF?',
70
- required: true,
71
- });
72
- runtimeGltfPath = path;
73
- }
74
- else {
75
- runtimeGltfPath = (0, node_path_1.join)(devkit_1.workspaceRoot, gltfPath);
76
- }
77
- const data = await (0, utils_1.parse)(runtimeGltfPath, draco, meshopt);
78
- console.log(data);
79
- const modelNames = (0, devkit_1.names)(modelName);
80
- const tmpPath = `${devkit_1.workspaceRoot}/tmp/ngt-gltf/${modelNames.fileName}`;
81
- const output = toConsole ? tmpPath : (outputPath ?? (projectConfig.sourceRoot || `${projectConfig.root}/src`));
82
- // NOTE: even if user passes in "console", we still generate the files.
83
- // But we generate them to a temporary destination then we'll remove them printing to console.
84
- // generateFiles(tree, 'files', output, {
85
- // tmpl: '',
86
- // fileName: modelNames.fileName,
87
- // className: modelNames.className,
88
- // selector: buildSelector(
89
- // modelNames.fileName,
90
- // 'prefix' in projectConfig && typeof projectConfig.prefix === 'string' ? projectConfig.prefix : 'app',
91
- // ),
92
- // runtimeGltfPath,
93
- // });
94
- await (0, devkit_1.formatFiles)(tree);
95
- if (toConsole) {
96
- // print to console
97
- // delete the files in tmp
98
- }
99
- }
100
- catch (e) {
101
- devkit_1.logger.error(`[NGT] Error generating GLTF files: ${e}`);
102
- }
103
- }
104
- exports.default = gltfGenerator;
105
- //# sourceMappingURL=generator.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"generator.js","sourceRoot":"","sources":["../../../../../../../libs/plugin/src/generators/gltf/generator.ts"],"names":[],"mappings":";;AAsCA,sCAiGC;AAvID,uCASoB;AACpB,uCAAkC;AAClC,yCAAiC;AACjC,qDAAyD;AACzD,mCAAgC;AAWhC,SAAS,gBAAgB,CAAC,OAA4B;IACrD,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC;IAE3E,IAAI,KAAK,IAAI,IAAI,EAAE,CAAC;QACnB,KAAK,GAAG,IAAI,CAAC;IACd,CAAC;IAED,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,SAAS,EAAE,UAAU,EA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G,MAAM,IAAA,aAAK,EAAC,eAAe,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;QAE1D,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QAElB,MAAM,UAAU,GAAG,IAAA,cAAK,EAAC,SAAS,CAAC,CAAC;QACpC,MAAM,OAAO,GAAG,GAAG,sBAAa,iBAAiB,UAAU,CAAC,QAAQ,EAAE,CAAC;QACvE,MAAM,MAAM,GAAG,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,UAAU,IAAI,CAAC,aAAa,CAAC,UAAU,IAAI,GAAG,aAAa,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC;QAE/G,uEAAuE;QACvE,+FAA+F;QAC/F,yCAAyC;QACzC,aAAa;QACb,kCAAkC;QAClC,oCAAoC;QACpC,4BAA4B;QAC5B,yBAAyB;QACzB,0GAA0G;QAC1G,MAAM;QACN,oBAAoB;QACpB,MAAM;QAEN,MAAM,IAAA,oBAAW,EAAC,IAAI,CAAC,CAAC;QAExB,IAAI,SAAS,EAAE,CAAC;YACf,mBAAmB;YACnB,0BAA0B;QAC3B,CAAC;IACF,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACZ,eAAM,CAAC,KAAK,CAAC,sCAAsC,CAAC,EAAE,CAAC,CAAC;IACzD,CAAC;AACF,CAAC;AAED,kBAAe,aAAa,CAAC"}
@@ -1,49 +0,0 @@
1
- {
2
- "$id": "Gltf",
3
- "title": "",
4
- "type": "object",
5
- "properties": {
6
- "gltfPath": {
7
- "type": "string",
8
- "description": "",
9
- "$default": {
10
- "$source": "argv",
11
- "index": 0
12
- },
13
- "x-prompt": "Where is your gltf file located?"
14
- },
15
- "console": {
16
- "type": "boolean",
17
- "description": "Print to console instead of writing to file",
18
- "default": false
19
- },
20
- "modelName": {
21
- "type": "string",
22
- "description": "Name of the model",
23
- "default": "Model"
24
- },
25
- "outputPath": {
26
- "type": "string",
27
- "description": "The output path of the generated component",
28
- "alias": ["o", "output"]
29
- },
30
- "draco": {
31
- "oneOf": [
32
- {
33
- "type": "boolean",
34
- "description": "Use Draco compression"
35
- },
36
- {
37
- "type": "string",
38
- "description": "Use Draco compression with a specific path"
39
- }
40
- ]
41
- },
42
- "meshopt": {
43
- "type": "boolean",
44
- "description": "Use Meshopt compression",
45
- "default": true
46
- }
47
- },
48
- "required": ["gltfPath", "project"]
49
- }
@@ -1 +0,0 @@
1
- export declare function parse(input: string, draco: boolean | string, meshopt: boolean): Promise<unknown>;
@@ -1,43 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.parse = parse;
4
- const node_three_gltf_1 = require("node-three-gltf");
5
- const node_fs_1 = require("node:fs");
6
- const three_stdlib_1 = require("three-stdlib");
7
- function toArrayBuffer(buf) {
8
- const ab = new ArrayBuffer(buf.length);
9
- const view = new Uint8Array(ab);
10
- for (let i = 0; i < buf.length; ++i)
11
- view[i] = buf[i];
12
- return ab;
13
- }
14
- let dracoLoader = null;
15
- let decoderPath = 'https://www.gstatic.com/draco/versioned/decoders/1.5.5/';
16
- const loader = new node_three_gltf_1.GLTFLoader();
17
- function parse(input, draco, meshopt) {
18
- if (draco) {
19
- if (!dracoLoader) {
20
- dracoLoader = new node_three_gltf_1.DRACOLoader();
21
- }
22
- dracoLoader.decoderPath = typeof draco === 'string' ? draco : decoderPath;
23
- loader.setDRACOLoader(dracoLoader);
24
- }
25
- if (meshopt) {
26
- loader.setMeshoptDecoder(typeof three_stdlib_1.MeshoptDecoder === 'function' ? (0, three_stdlib_1.MeshoptDecoder)() : three_stdlib_1.MeshoptDecoder);
27
- }
28
- const data = input.startsWith('http')
29
- ? null
30
- : (() => {
31
- const fileContent = (0, node_fs_1.readFileSync)(input);
32
- return toArrayBuffer(fileContent);
33
- })();
34
- const operation = (onLoad, onError) => {
35
- return input.startsWith('http')
36
- ? loader.load.call(loader, input, onLoad, () => { }, onError)
37
- : loader.parse.call(loader, data, input, onLoad, onError);
38
- };
39
- return new Promise((resolve, reject) => {
40
- operation(resolve, reject);
41
- });
42
- }
43
- //# sourceMappingURL=utils.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../../../../libs/plugin/src/generators/gltf/utils.ts"],"names":[],"mappings":";;AAgBA,sBA8BC;AA9CD,qDAA0D;AAC1D,qCAAuC;AACvC,+CAA8C;AAE9C,SAAS,aAAa,CAAC,GAAW;IACjC,MAAM,EAAE,GAAG,IAAI,WAAW,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IACvC,MAAM,IAAI,GAAG,IAAI,UAAU,CAAC,EAAE,CAAC,CAAC;IAChC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,GAAG,CAAC,MAAM,EAAE,EAAE,CAAC;QAAE,IAAI,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC;IACtD,OAAO,EAAE,CAAC;AACX,CAAC;AAED,IAAI,WAAW,GAAuB,IAAI,CAAC;AAC3C,IAAI,WAAW,GAAG,yDAAyD,CAAC;AAE5E,MAAM,MAAM,GAAG,IAAI,4BAAU,EAAE,CAAC;AAEhC,SAAgB,KAAK,CAAC,KAAa,EAAE,KAAuB,EAAE,OAAgB;IAC7E,IAAI,KAAK,EAAE,CAAC;QACX,IAAI,CAAC,WAAW,EAAE,CAAC;YAClB,WAAW,GAAG,IAAI,6BAAW,EAAE,CAAC;QACjC,CAAC;QAED,WAAW,CAAC,WAAW,GAAG,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,WAAW,CAAC;QACzE,MAAqB,CAAC,cAAc,CAAC,WAAW,CAAC,CAAC;IACpD,CAAC;IAED,IAAI,OAAO,EAAE,CAAC;QACZ,MAAqB,CAAC,iBAAiB,CAAC,OAAO,6BAAc,KAAK,UAAU,CAAC,CAAC,CAAC,IAAA,6BAAc,GAAE,CAAC,CAAC,CAAC,6BAAc,CAAC,C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