@configura/web-core 2.1.0-alpha.0 → 2.1.0-alpha.2

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 (173) hide show
  1. package/.eslintrc.json +5 -5
  2. package/LICENSE +201 -201
  3. package/README.md +1 -1
  4. package/dist/cm/basic/Color.d.ts +16 -16
  5. package/dist/cm/basic/Color.js +18 -18
  6. package/dist/cm/basic/ColorF.d.ts +9 -9
  7. package/dist/cm/basic/ColorF.js +10 -10
  8. package/dist/cm/basic/boolean.d.ts +2 -2
  9. package/dist/cm/basic/boolean.js +11 -11
  10. package/dist/cm/basic/number.d.ts +3 -3
  11. package/dist/cm/basic/number.js +18 -18
  12. package/dist/cm/basic/string.d.ts +2 -2
  13. package/dist/cm/basic/string.js +11 -11
  14. package/dist/cm/core3D/ATriMeshF.d.ts +96 -96
  15. package/dist/cm/core3D/ATriMeshF.js +197 -197
  16. package/dist/cm/core3D/GMaterial3D.d.ts +62 -62
  17. package/dist/cm/core3D/GMaterial3D.js +112 -112
  18. package/dist/cm/core3D/GMaterialClassic.d.ts +55 -55
  19. package/dist/cm/core3D/GMaterialClassic.js +171 -171
  20. package/dist/cm/core3D/GMaterialPBR.d.ts +73 -73
  21. package/dist/cm/core3D/GMaterialPBR.js +314 -314
  22. package/dist/cm/core3D/MultiGMaterial3D.d.ts +8 -8
  23. package/dist/cm/core3D/MultiGMaterial3D.js +17 -17
  24. package/dist/cm/core3D/uvmapper/UVMapEnv.d.ts +19 -19
  25. package/dist/cm/core3D/uvmapper/UVMapEnv.js +47 -47
  26. package/dist/cm/core3D/uvmapper/UVMapper.d.ts +41 -41
  27. package/dist/cm/core3D/uvmapper/UVMapper.js +94 -94
  28. package/dist/cm/core3D/uvmapper/UVMapperBox.d.ts +4 -4
  29. package/dist/cm/core3D/uvmapper/UVMapperBox.js +181 -181
  30. package/dist/cm/core3D/uvmapper/UVMapperCylinder.d.ts +9 -9
  31. package/dist/cm/core3D/uvmapper/UVMapperCylinder.js +96 -96
  32. package/dist/cm/core3D/uvmapper/UVMapperPlane.d.ts +3 -3
  33. package/dist/cm/core3D/uvmapper/UVMapperPlane.js +84 -84
  34. package/dist/cm/core3D/uvmapper/UVTransformer.d.ts +5 -5
  35. package/dist/cm/core3D/uvmapper/UVTransformer.js +5 -5
  36. package/dist/cm/core3D/uvmapper/instantiateUVMapper.d.ts +3 -3
  37. package/dist/cm/core3D/uvmapper/instantiateUVMapper.js +4 -4
  38. package/dist/cm/format/cmsym/InvalidationEnv.d.ts +9 -9
  39. package/dist/cm/format/cmsym/InvalidationEnv.js +13 -13
  40. package/dist/cm/format/cmsym/SymImportEnv.d.ts +9 -9
  41. package/dist/cm/format/cmsym/SymImportEnv.js +9 -9
  42. package/dist/cm/format/cmsym/SymInv.d.ts +8 -8
  43. package/dist/cm/format/cmsym/SymInv.js +17 -17
  44. package/dist/cm/format/cmsym/SymNode.d.ts +94 -94
  45. package/dist/cm/format/cmsym/SymNode.js +652 -652
  46. package/dist/cm/format/cmsym/components/SymBox.d.ts +15 -15
  47. package/dist/cm/format/cmsym/components/SymBox.js +39 -39
  48. package/dist/cm/format/cmsym/components/SymComponent.d.ts +29 -29
  49. package/dist/cm/format/cmsym/components/SymComponent.js +56 -56
  50. package/dist/cm/format/cmsym/components/SymConnector.d.ts +5 -5
  51. package/dist/cm/format/cmsym/components/SymConnector.js +10 -10
  52. package/dist/cm/format/cmsym/components/SymDexObj.d.ts +11 -11
  53. package/dist/cm/format/cmsym/components/SymDexObj.js +10 -10
  54. package/dist/cm/format/cmsym/components/SymGFX.d.ts +11 -11
  55. package/dist/cm/format/cmsym/components/SymGFX.js +20 -20
  56. package/dist/cm/format/cmsym/components/SymGMaterial.d.ts +19 -19
  57. package/dist/cm/format/cmsym/components/SymGMaterial.js +88 -88
  58. package/dist/cm/format/cmsym/components/SymGMaterialSelector.d.ts +17 -17
  59. package/dist/cm/format/cmsym/components/SymGMaterialSelector.js +22 -22
  60. package/dist/cm/format/cmsym/components/SymGetMeshEnv.d.ts +9 -9
  61. package/dist/cm/format/cmsym/components/SymGetMeshEnv.js +9 -9
  62. package/dist/cm/format/cmsym/components/SymLODGroup.d.ts +9 -9
  63. package/dist/cm/format/cmsym/components/SymLODGroup.js +13 -13
  64. package/dist/cm/format/cmsym/components/SymLight.d.ts +8 -8
  65. package/dist/cm/format/cmsym/components/SymLight.js +10 -10
  66. package/dist/cm/format/cmsym/components/SymLines2D.d.ts +5 -5
  67. package/dist/cm/format/cmsym/components/SymLines2D.js +7 -7
  68. package/dist/cm/format/cmsym/components/SymMeasure.d.ts +33 -33
  69. package/dist/cm/format/cmsym/components/SymMeasure.js +149 -149
  70. package/dist/cm/format/cmsym/components/SymMesh.d.ts +29 -29
  71. package/dist/cm/format/cmsym/components/SymMesh.js +130 -130
  72. package/dist/cm/format/cmsym/components/SymMeshLight.d.ts +8 -8
  73. package/dist/cm/format/cmsym/components/SymMeshLight.js +10 -10
  74. package/dist/cm/format/cmsym/components/SymMultiSelector.d.ts +13 -13
  75. package/dist/cm/format/cmsym/components/SymMultiSelector.js +48 -48
  76. package/dist/cm/format/cmsym/components/SymParams.d.ts +16 -16
  77. package/dist/cm/format/cmsym/components/SymParams.js +58 -58
  78. package/dist/cm/format/cmsym/components/SymPlane.d.ts +15 -15
  79. package/dist/cm/format/cmsym/components/SymPlane.js +30 -30
  80. package/dist/cm/format/cmsym/components/SymPlaneDivider.d.ts +4 -4
  81. package/dist/cm/format/cmsym/components/SymPlaneDivider.js +7 -7
  82. package/dist/cm/format/cmsym/components/SymPrimitive2D.d.ts +3 -3
  83. package/dist/cm/format/cmsym/components/SymPrimitive2D.js +3 -3
  84. package/dist/cm/format/cmsym/components/SymProgs.d.ts +32 -32
  85. package/dist/cm/format/cmsym/components/SymProgs.js +120 -120
  86. package/dist/cm/format/cmsym/components/SymProps.d.ts +54 -54
  87. package/dist/cm/format/cmsym/components/SymProps.js +171 -171
  88. package/dist/cm/format/cmsym/components/SymRep.d.ts +13 -13
  89. package/dist/cm/format/cmsym/components/SymRep.js +28 -28
  90. package/dist/cm/format/cmsym/components/SymReps.d.ts +36 -36
  91. package/dist/cm/format/cmsym/components/SymReps.js +230 -230
  92. package/dist/cm/format/cmsym/components/SymShape.d.ts +10 -10
  93. package/dist/cm/format/cmsym/components/SymShape.js +17 -17
  94. package/dist/cm/format/cmsym/components/SymSphere.d.ts +18 -18
  95. package/dist/cm/format/cmsym/components/SymSphere.js +33 -33
  96. package/dist/cm/format/cmsym/components/SymSpotlight.d.ts +8 -8
  97. package/dist/cm/format/cmsym/components/SymSpotlight.js +10 -10
  98. package/dist/cm/format/cmsym/components/SymTags.d.ts +11 -11
  99. package/dist/cm/format/cmsym/components/SymTags.js +20 -20
  100. package/dist/cm/format/cmsym/components/SymText2D.d.ts +5 -5
  101. package/dist/cm/format/cmsym/components/SymText2D.js +8 -8
  102. package/dist/cm/format/cmsym/components/SymText3D.d.ts +5 -5
  103. package/dist/cm/format/cmsym/components/SymText3D.js +8 -8
  104. package/dist/cm/format/cmsym/components/SymTransform.d.ts +23 -23
  105. package/dist/cm/format/cmsym/components/SymTransform.js +101 -101
  106. package/dist/cm/format/cmsym/components/SymUVMapper.d.ts +13 -13
  107. package/dist/cm/format/cmsym/components/SymUVMapper.js +50 -50
  108. package/dist/cm/format/cmsym/components/instantiate.d.ts +2 -2
  109. package/dist/cm/format/cmsym/components/instantiate.js +121 -121
  110. package/dist/cm/format/cmsym/components/legacy.d.ts +7 -7
  111. package/dist/cm/format/cmsym/components/legacy.js +27 -27
  112. package/dist/cm/format/cmsym/components/mesh.d.ts +8 -8
  113. package/dist/cm/format/cmsym/components/mesh.js +28 -28
  114. package/dist/cm/format/cmsym/invalidation.d.ts +4 -4
  115. package/dist/cm/format/cmsym/invalidation.js +72 -72
  116. package/dist/cm/format/dex/DexIRef.d.ts +9 -9
  117. package/dist/cm/format/dex/DexIRef.js +18 -18
  118. package/dist/cm/format/dex/DexInt.d.ts +11 -11
  119. package/dist/cm/format/dex/DexInt.js +18 -18
  120. package/dist/cm/format/dex/DexInternalizedXRef.d.ts +19 -19
  121. package/dist/cm/format/dex/DexInternalizedXRef.js +65 -65
  122. package/dist/cm/format/dex/DexLoader.d.ts +8 -8
  123. package/dist/cm/format/dex/DexLoader.js +12 -12
  124. package/dist/cm/format/dex/DexManager.d.ts +20 -20
  125. package/dist/cm/format/dex/DexManager.js +78 -78
  126. package/dist/cm/format/dex/DexObj.d.ts +15 -15
  127. package/dist/cm/format/dex/DexObj.js +86 -86
  128. package/dist/cm/format/dex/DexReader.d.ts +90 -90
  129. package/dist/cm/format/dex/DexReader.js +532 -532
  130. package/dist/cm/format/dex/DexRef.d.ts +6 -6
  131. package/dist/cm/format/dex/DexRef.js +8 -8
  132. package/dist/cm/format/dex/DexReplacedXRefs.d.ts +9 -9
  133. package/dist/cm/format/dex/DexReplacedXRefs.js +22 -22
  134. package/dist/cm/format/dex/DexURL.d.ts +4 -4
  135. package/dist/cm/format/dex/DexURL.js +5 -5
  136. package/dist/cm/format/dex/DexVersion.d.ts +15 -15
  137. package/dist/cm/format/dex/DexVersion.js +53 -53
  138. package/dist/cm/format/dex/DexXRef.d.ts +18 -18
  139. package/dist/cm/format/dex/DexXRef.js +51 -51
  140. package/dist/cm/format/dex/DexXRefTargetFilter.d.ts +4 -4
  141. package/dist/cm/format/dex/DexXRefTargetFilter.js +5 -5
  142. package/dist/cm/geometry/Angle.d.ts +9 -9
  143. package/dist/cm/geometry/Angle.js +18 -18
  144. package/dist/cm/geometry/AngleF.d.ts +5 -5
  145. package/dist/cm/geometry/AngleF.js +8 -8
  146. package/dist/cm/geometry/Box.d.ts +7 -7
  147. package/dist/cm/geometry/Box.js +9 -9
  148. package/dist/cm/geometry/DetailMask.d.ts +37 -37
  149. package/dist/cm/geometry/DetailMask.js +114 -114
  150. package/dist/cm/geometry/LayerExpr.d.ts +2 -2
  151. package/dist/cm/geometry/LayerExpr.js +2 -2
  152. package/dist/cm/geometry/Matrix22.d.ts +7 -7
  153. package/dist/cm/geometry/Matrix22.js +9 -9
  154. package/dist/cm/geometry/Matrix33.d.ts +42 -42
  155. package/dist/cm/geometry/Matrix33.js +124 -124
  156. package/dist/cm/geometry/Orientation.d.ts +7 -7
  157. package/dist/cm/geometry/Orientation.js +7 -7
  158. package/dist/cm/geometry/Plane.d.ts +8 -8
  159. package/dist/cm/geometry/Plane.js +14 -14
  160. package/dist/cm/geometry/Point.d.ts +21 -21
  161. package/dist/cm/geometry/Point.js +65 -65
  162. package/dist/cm/geometry/Point2D.d.ts +9 -9
  163. package/dist/cm/geometry/Point2D.js +23 -23
  164. package/dist/cm/geometry/PointF.d.ts +11 -11
  165. package/dist/cm/geometry/PointF.js +27 -27
  166. package/dist/cm/geometry/Transform.d.ts +11 -11
  167. package/dist/cm/geometry/Transform.js +61 -61
  168. package/dist/cm/geometry/Transform2D.d.ts +7 -7
  169. package/dist/cm/geometry/Transform2D.js +6 -6
  170. package/dist/cm/io/Semver.d.ts +18 -18
  171. package/dist/cm/io/Semver.js +61 -61
  172. package/dist/index.js +1 -1
  173. package/package.json +4 -4
@@ -1,18 +1,18 @@
1
- export class DexInt {
2
- constructor(value) {
3
- this.value = value;
4
- }
5
- toString() {
6
- return `DexInt(${this.value})`;
7
- }
8
- }
9
- // TODO: is this correct at all?
10
- export class DexInt64 {
11
- constructor(high, low) {
12
- this.high = high;
13
- this.low = low;
14
- }
15
- toString() {
16
- return `DexInt(${this.high}, ${this.low})`;
17
- }
18
- }
1
+ export class DexInt {
2
+ constructor(value) {
3
+ this.value = value;
4
+ }
5
+ toString() {
6
+ return `DexInt(${this.value})`;
7
+ }
8
+ }
9
+ // TODO: is this correct at all?
10
+ export class DexInt64 {
11
+ constructor(high, low) {
12
+ this.high = high;
13
+ this.low = low;
14
+ }
15
+ toString() {
16
+ return `DexInt(${this.high}, ${this.low})`;
17
+ }
18
+ }
@@ -1,20 +1,20 @@
1
- import { DexReader } from "./DexReader.js";
2
- import { DexXRefStyle } from "./DexXRef.js";
3
- export declare class DexInternalizedXRef {
4
- id: number;
5
- xrefCount: number;
6
- pos: number;
7
- fileSize: number;
8
- url: string;
9
- hashId: string;
10
- encoding: string;
11
- hash: string;
12
- localFileCreated: boolean;
13
- style: DexXRefStyle;
14
- constructor(id: number, xrefCount: number, pos: number, fileSize: number, url: string, style: string, hashId: string, encoding: string, hash: string);
15
- target(): string;
16
- xrefStyle(): DexXRefStyle;
17
- createLocalFile(reader: DexReader): string;
18
- toString(): string;
19
- }
1
+ import { DexReader } from "./DexReader.js";
2
+ import { DexXRefStyle } from "./DexXRef.js";
3
+ export declare class DexInternalizedXRef {
4
+ id: number;
5
+ xrefCount: number;
6
+ pos: number;
7
+ fileSize: number;
8
+ url: string;
9
+ hashId: string;
10
+ encoding: string;
11
+ hash: string;
12
+ localFileCreated: boolean;
13
+ style: DexXRefStyle;
14
+ constructor(id: number, xrefCount: number, pos: number, fileSize: number, url: string, style: string, hashId: string, encoding: string, hash: string);
15
+ target(): string;
16
+ xrefStyle(): DexXRefStyle;
17
+ createLocalFile(reader: DexReader): string;
18
+ toString(): string;
19
+ }
20
20
  //# sourceMappingURL=DexInternalizedXRef.d.ts.map
@@ -1,65 +1,65 @@
1
- import { DexReader } from "./DexReader.js";
2
- import { DexXRefStyle } from "./DexXRef.js";
3
- export class DexInternalizedXRef {
4
- constructor(id, xrefCount, pos, fileSize, url, style, hashId, encoding, hash) {
5
- this.id = id;
6
- this.xrefCount = xrefCount;
7
- this.pos = pos;
8
- this.fileSize = fileSize;
9
- this.url = url;
10
- this.hashId = hashId;
11
- this.encoding = encoding;
12
- this.hash = hash;
13
- this.localFileCreated = false;
14
- switch (style) {
15
- case "anonymous":
16
- this.style = DexXRefStyle.Anonymous;
17
- break;
18
- case "internal":
19
- this.style = DexXRefStyle.Internal;
20
- break;
21
- case "external":
22
- this.style = DexXRefStyle.External;
23
- break;
24
- default:
25
- throw new Error("[DexInternalizedXRef] invalid style: " + style);
26
- }
27
- }
28
- target() {
29
- switch (this.style) {
30
- case DexXRefStyle.Anonymous: {
31
- const filename = this.url.slice(this.url.lastIndexOf("/") + 1);
32
- return this.hash + "." + this.hashId + "." + this.encoding + "." + filename;
33
- }
34
- case DexXRefStyle.Internal:
35
- return this.url;
36
- default:
37
- throw Error("[DexInternalizedXRef.target] invalid style: " + this.style);
38
- }
39
- }
40
- xrefStyle() {
41
- return this.style;
42
- }
43
- // Desktop implementation returns url to new file on disk
44
- // Instead return a buffer here
45
- // TODO: let the reader take care of this
46
- createLocalFile(reader) {
47
- const manager = reader.manager;
48
- let url = manager.xrefTarget(this);
49
- url = manager.expandRoot(url);
50
- if (this.localFileCreated) {
51
- return url;
52
- }
53
- if (!reader.isOpen) {
54
- throw Error("reader not open");
55
- }
56
- const slice = reader.readInternalizedXRefFile(this.pos, this.fileSize);
57
- // TODO: verify hash
58
- new DexReader(slice, reader.manager, url);
59
- this.localFileCreated = true;
60
- return url;
61
- }
62
- toString() {
63
- return `DexInternalizedXRef()`;
64
- }
65
- }
1
+ import { DexReader } from "./DexReader.js";
2
+ import { DexXRefStyle } from "./DexXRef.js";
3
+ export class DexInternalizedXRef {
4
+ constructor(id, xrefCount, pos, fileSize, url, style, hashId, encoding, hash) {
5
+ this.id = id;
6
+ this.xrefCount = xrefCount;
7
+ this.pos = pos;
8
+ this.fileSize = fileSize;
9
+ this.url = url;
10
+ this.hashId = hashId;
11
+ this.encoding = encoding;
12
+ this.hash = hash;
13
+ this.localFileCreated = false;
14
+ switch (style) {
15
+ case "anonymous":
16
+ this.style = DexXRefStyle.Anonymous;
17
+ break;
18
+ case "internal":
19
+ this.style = DexXRefStyle.Internal;
20
+ break;
21
+ case "external":
22
+ this.style = DexXRefStyle.External;
23
+ break;
24
+ default:
25
+ throw new Error("[DexInternalizedXRef] invalid style: " + style);
26
+ }
27
+ }
28
+ target() {
29
+ switch (this.style) {
30
+ case DexXRefStyle.Anonymous: {
31
+ const filename = this.url.slice(this.url.lastIndexOf("/") + 1);
32
+ return this.hash + "." + this.hashId + "." + this.encoding + "." + filename;
33
+ }
34
+ case DexXRefStyle.Internal:
35
+ return this.url;
36
+ default:
37
+ throw Error("[DexInternalizedXRef.target] invalid style: " + this.style);
38
+ }
39
+ }
40
+ xrefStyle() {
41
+ return this.style;
42
+ }
43
+ // Desktop implementation returns url to new file on disk
44
+ // Instead return a buffer here
45
+ // TODO: let the reader take care of this
46
+ createLocalFile(reader) {
47
+ const manager = reader.manager;
48
+ let url = manager.xrefTarget(this);
49
+ url = manager.expandRoot(url);
50
+ if (this.localFileCreated) {
51
+ return url;
52
+ }
53
+ if (!reader.isOpen) {
54
+ throw Error("reader not open");
55
+ }
56
+ const slice = reader.readInternalizedXRefFile(this.pos, this.fileSize);
57
+ // TODO: verify hash
58
+ new DexReader(slice, reader.manager, url);
59
+ this.localFileCreated = true;
60
+ return url;
61
+ }
62
+ toString() {
63
+ return `DexInternalizedXRef()`;
64
+ }
65
+ }
@@ -1,9 +1,9 @@
1
- import { DexReader, DexSerializable } from "./DexReader.js";
2
- import { DexURL } from "./DexURL.js";
3
- export declare class DexLoader {
4
- load(reader: DexReader, url: string, path?: string): DexSerializable;
5
- }
6
- export declare class DexGmImageLoader extends DexLoader {
7
- load(reader: DexReader, url: string, path?: string): DexURL;
8
- }
1
+ import { DexReader, DexSerializable } from "./DexReader.js";
2
+ import { DexURL } from "./DexURL.js";
3
+ export declare class DexLoader {
4
+ load(reader: DexReader, url: string, path?: string): DexSerializable;
5
+ }
6
+ export declare class DexGmImageLoader extends DexLoader {
7
+ load(reader: DexReader, url: string, path?: string): DexURL;
8
+ }
9
9
  //# sourceMappingURL=DexLoader.d.ts.map
@@ -1,12 +1,12 @@
1
- import { DexURL } from "./DexURL.js";
2
- // tslint:disable:max-classes-per-file
3
- export class DexLoader {
4
- load(reader, url, path) {
5
- throw Error("default loader not implemented");
6
- }
7
- }
8
- export class DexGmImageLoader extends DexLoader {
9
- load(reader, url, path) {
10
- return new DexURL(url);
11
- }
12
- }
1
+ import { DexURL } from "./DexURL.js";
2
+ // tslint:disable:max-classes-per-file
3
+ export class DexLoader {
4
+ load(reader, url, path) {
5
+ throw Error("default loader not implemented");
6
+ }
7
+ }
8
+ export class DexGmImageLoader extends DexLoader {
9
+ load(reader, url, path) {
10
+ return new DexURL(url);
11
+ }
12
+ }
@@ -1,21 +1,21 @@
1
- import { Logger } from "@configura/web-utilities";
2
- import { DexInternalizedXRef } from "./DexInternalizedXRef.js";
3
- import { DexLoader } from "./DexLoader.js";
4
- import { DexObj } from "./DexObj.js";
5
- import { DexReader } from "./DexReader.js";
6
- import { DexXRefTargetFilter } from "./DexXRefTargetFilter.js";
7
- export declare class DexManager {
8
- id: string;
9
- urlRoots?: Map<string, string> | undefined;
10
- xrefTargetFilter: DexXRefTargetFilter;
11
- readers: Map<string, DexReader>;
12
- loaders: Map<string, DexLoader>;
13
- constructor(id: string, urlRoots?: Map<string, string> | undefined, xrefTargetFilter?: DexXRefTargetFilter, readers?: Map<string, DexReader>, defaultLoaders?: boolean);
14
- expandRoot(url: string): string;
15
- xrefTarget(ref: DexInternalizedXRef): string;
16
- loader(suffix: string): DexLoader | undefined;
17
- defaultLoaders(): void;
18
- load(logger: Logger, url: string, abortSignal?: AbortSignal): Promise<DexObj>;
19
- arrayBufferToDexObj(logger: Logger, url: string, buffer: ArrayBuffer): DexObj;
20
- }
1
+ import { Logger } from "@configura/web-utilities";
2
+ import { DexInternalizedXRef } from "./DexInternalizedXRef.js";
3
+ import { DexLoader } from "./DexLoader.js";
4
+ import { DexObj } from "./DexObj.js";
5
+ import { DexReader } from "./DexReader.js";
6
+ import { DexXRefTargetFilter } from "./DexXRefTargetFilter.js";
7
+ export declare class DexManager {
8
+ id: string;
9
+ urlRoots?: Map<string, string> | undefined;
10
+ xrefTargetFilter: DexXRefTargetFilter;
11
+ readers: Map<string, DexReader>;
12
+ loaders: Map<string, DexLoader>;
13
+ constructor(id: string, urlRoots?: Map<string, string> | undefined, xrefTargetFilter?: DexXRefTargetFilter, readers?: Map<string, DexReader>, defaultLoaders?: boolean);
14
+ expandRoot(url: string): string;
15
+ xrefTarget(ref: DexInternalizedXRef): string;
16
+ loader(suffix: string): DexLoader | undefined;
17
+ defaultLoaders(): void;
18
+ load(logger: Logger, url: string, abortSignal?: AbortSignal): Promise<DexObj>;
19
+ arrayBufferToDexObj(logger: Logger, url: string, buffer: ArrayBuffer): DexObj;
20
+ }
21
21
  //# sourceMappingURL=DexManager.d.ts.map
@@ -1,78 +1,78 @@
1
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
- return new (P || (P = Promise))(function (resolve, reject) {
4
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
- step((generator = generator.apply(thisArg, _arguments || [])).next());
8
- });
9
- };
10
- import { DexGmImageLoader } from "./DexLoader.js";
11
- import { DexObj } from "./DexObj.js";
12
- import { DexReader } from "./DexReader.js";
13
- import { DexXRefTargetFilter } from "./DexXRefTargetFilter.js";
14
- export class DexManager {
15
- constructor(id, urlRoots, xrefTargetFilter = new DexXRefTargetFilter(), readers = new Map(), defaultLoaders = true) {
16
- this.id = id;
17
- this.urlRoots = urlRoots;
18
- this.xrefTargetFilter = xrefTargetFilter;
19
- this.readers = readers;
20
- this.loaders = new Map();
21
- if (defaultLoaders) {
22
- this.defaultLoaders();
23
- }
24
- }
25
- expandRoot(url) {
26
- if (this.urlRoots === undefined) {
27
- return url;
28
- }
29
- for (const [key, value] of this.urlRoots.entries()) {
30
- url = url.replace(key, value);
31
- }
32
- return url;
33
- }
34
- xrefTarget(ref) {
35
- return this.xrefTargetFilter.target(ref);
36
- }
37
- loader(suffix) {
38
- return this.loaders.get(suffix);
39
- }
40
- defaultLoaders() {
41
- const suffixes = ["jpg", "jpeg", "bmp", "png", "cmmips"];
42
- const loader = new DexGmImageLoader();
43
- for (const suffix of suffixes) {
44
- this.loaders.set(suffix, loader);
45
- }
46
- }
47
- load(logger, url, abortSignal) {
48
- return __awaiter(this, void 0, void 0, function* () {
49
- const params = {};
50
- if (abortSignal) {
51
- params.signal = abortSignal;
52
- }
53
- const response = yield fetch(url, params);
54
- if (!response.ok) {
55
- logger.error(response);
56
- throw logger.errorAsObject("response not OK!");
57
- }
58
- const buffer = yield response.arrayBuffer();
59
- return this.arrayBufferToDexObj(logger, url, buffer);
60
- });
61
- }
62
- arrayBufferToDexObj(logger, url, buffer) {
63
- const slice = new Uint8Array(buffer);
64
- const reader = new DexReader(slice, this, url);
65
- try {
66
- reader.begin();
67
- const root = reader.readRoot();
68
- if (!(root instanceof DexObj)) {
69
- throw logger.errorAsObject("root: is not DexObj", root);
70
- }
71
- return root;
72
- }
73
- catch (e) {
74
- logger.errorFromCaught(e);
75
- throw typeof e === "string" ? Error(e) : e;
76
- }
77
- }
78
- }
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ import { DexGmImageLoader } from "./DexLoader.js";
11
+ import { DexObj } from "./DexObj.js";
12
+ import { DexReader } from "./DexReader.js";
13
+ import { DexXRefTargetFilter } from "./DexXRefTargetFilter.js";
14
+ export class DexManager {
15
+ constructor(id, urlRoots, xrefTargetFilter = new DexXRefTargetFilter(), readers = new Map(), defaultLoaders = true) {
16
+ this.id = id;
17
+ this.urlRoots = urlRoots;
18
+ this.xrefTargetFilter = xrefTargetFilter;
19
+ this.readers = readers;
20
+ this.loaders = new Map();
21
+ if (defaultLoaders) {
22
+ this.defaultLoaders();
23
+ }
24
+ }
25
+ expandRoot(url) {
26
+ if (this.urlRoots === undefined) {
27
+ return url;
28
+ }
29
+ for (const [key, value] of this.urlRoots.entries()) {
30
+ url = url.replace(key, value);
31
+ }
32
+ return url;
33
+ }
34
+ xrefTarget(ref) {
35
+ return this.xrefTargetFilter.target(ref);
36
+ }
37
+ loader(suffix) {
38
+ return this.loaders.get(suffix);
39
+ }
40
+ defaultLoaders() {
41
+ const suffixes = ["jpg", "jpeg", "bmp", "png", "cmmips"];
42
+ const loader = new DexGmImageLoader();
43
+ for (const suffix of suffixes) {
44
+ this.loaders.set(suffix, loader);
45
+ }
46
+ }
47
+ load(logger, url, abortSignal) {
48
+ return __awaiter(this, void 0, void 0, function* () {
49
+ const params = {};
50
+ if (abortSignal) {
51
+ params.signal = abortSignal;
52
+ }
53
+ const response = yield fetch(url, params);
54
+ if (!response.ok) {
55
+ logger.error(response);
56
+ throw logger.errorAsObject("response not OK!");
57
+ }
58
+ const buffer = yield response.arrayBuffer();
59
+ return this.arrayBufferToDexObj(logger, url, buffer);
60
+ });
61
+ }
62
+ arrayBufferToDexObj(logger, url, buffer) {
63
+ const slice = new Uint8Array(buffer);
64
+ const reader = new DexReader(slice, this, url);
65
+ try {
66
+ reader.begin();
67
+ const root = reader.readRoot();
68
+ if (!(root instanceof DexObj)) {
69
+ throw logger.errorAsObject("root: is not DexObj", root);
70
+ }
71
+ return root;
72
+ }
73
+ catch (e) {
74
+ logger.errorFromCaught(e);
75
+ throw typeof e === "string" ? Error(e) : e;
76
+ }
77
+ }
78
+ }
@@ -1,16 +1,16 @@
1
- import { DexReader, DexSerializable } from "./DexReader.js";
2
- export declare class DexObj {
3
- type?: string | undefined;
4
- id?: string | undefined;
5
- props: Map<string, DexSerializable>;
6
- reader?: DexReader | undefined;
7
- static cast(obj: unknown): DexObj | undefined;
8
- static fcast(obj: unknown): DexObj;
9
- static withReader(reader: DexReader): DexObj;
10
- constructor(type?: string | undefined, id?: string | undefined, props?: Map<string, DexSerializable>, reader?: DexReader | undefined);
11
- put(key: string, value: DexSerializable): void;
12
- has(key: string): boolean;
13
- get(key: string): DexSerializable;
14
- loadAll(visited?: DexObj[]): Error | undefined;
15
- }
1
+ import { DexReader, DexSerializable } from "./DexReader.js";
2
+ export declare class DexObj {
3
+ type?: string | undefined;
4
+ id?: string | undefined;
5
+ props: Map<string, DexSerializable>;
6
+ reader?: DexReader | undefined;
7
+ static cast(obj: unknown): DexObj | undefined;
8
+ static fcast(obj: unknown): DexObj;
9
+ static withReader(reader: DexReader): DexObj;
10
+ constructor(type?: string | undefined, id?: string | undefined, props?: Map<string, DexSerializable>, reader?: DexReader | undefined);
11
+ put(key: string, value: DexSerializable): void;
12
+ has(key: string): boolean;
13
+ get(key: string): DexSerializable;
14
+ loadAll(visited?: DexObj[]): Error | undefined;
15
+ }
16
16
  //# sourceMappingURL=DexObj.d.ts.map
@@ -1,86 +1,86 @@
1
- import { DexRef } from "./DexRef.js";
2
- export class DexObj {
3
- constructor(type, id, props = new Map(), reader) {
4
- this.type = type;
5
- this.id = id;
6
- this.props = props;
7
- this.reader = reader;
8
- }
9
- static cast(obj) {
10
- if (obj instanceof DexObj) {
11
- return obj;
12
- }
13
- }
14
- static fcast(obj) {
15
- if (obj instanceof DexObj) {
16
- return obj;
17
- }
18
- throw Error(`obj: ${obj} not DexObj`);
19
- }
20
- static withReader(reader) {
21
- return new this(undefined, undefined, undefined, reader);
22
- }
23
- // dexType() {
24
- // return DexTypeId.DexObj;
25
- // }
26
- // manager(): DexManager | undefined {
27
- // return this.reader ? this.reader.manager : undefined;
28
- // }
29
- put(key, value) {
30
- this.props.set(key, value);
31
- }
32
- has(key) {
33
- return this.props.get(key) !== undefined;
34
- }
35
- // _getPath(paths: string[]) {
36
- // let entity: DexEntity | undefined = this;
37
- // for (const path of paths) {
38
- // const a: DexObj | undefined = entity instanceof DexObj ? entity : undefined;
39
- // if (!a) {
40
- // return;
41
- // }
42
- // const entityAtPath = a.get(path);
43
- // if (entityAtPath instanceof DexEntity) {
44
- // entity = entityAtPath;
45
- // }
46
- // }
47
- // return entity;
48
- // }
49
- // getPathFromPaths(paths: string[]) {
50
- // return this._getPath(paths);
51
- // }
52
- // getPath(k: string) {
53
- // const delimiter = ".";
54
- // if (k.slice(0, 1) === delimiter) {
55
- // return Error("[DexObj.getPath] path may not begin with a delimiter");
56
- // }
57
- // return this._getPath(k.split(delimiter));
58
- // }
59
- get(key) {
60
- // if (this.reader) {
61
- // this.reader.setAccessed();
62
- // }
63
- const entity = this.props.get(key);
64
- if (entity instanceof DexRef) {
65
- const value = entity.load(key);
66
- this.props.set(key, value);
67
- return value;
68
- }
69
- return entity;
70
- }
71
- loadAll(visited = []) {
72
- if (visited.indexOf(this) !== -1) {
73
- return;
74
- }
75
- visited.push(this);
76
- for (const key of this.props.keys()) {
77
- const entity = this.get(key);
78
- if (entity instanceof Error) {
79
- return entity;
80
- }
81
- else if (entity instanceof DexObj) {
82
- entity.loadAll(visited);
83
- }
84
- }
85
- }
86
- }
1
+ import { DexRef } from "./DexRef.js";
2
+ export class DexObj {
3
+ constructor(type, id, props = new Map(), reader) {
4
+ this.type = type;
5
+ this.id = id;
6
+ this.props = props;
7
+ this.reader = reader;
8
+ }
9
+ static cast(obj) {
10
+ if (obj instanceof DexObj) {
11
+ return obj;
12
+ }
13
+ }
14
+ static fcast(obj) {
15
+ if (obj instanceof DexObj) {
16
+ return obj;
17
+ }
18
+ throw Error(`obj: ${obj} not DexObj`);
19
+ }
20
+ static withReader(reader) {
21
+ return new this(undefined, undefined, undefined, reader);
22
+ }
23
+ // dexType() {
24
+ // return DexTypeId.DexObj;
25
+ // }
26
+ // manager(): DexManager | undefined {
27
+ // return this.reader ? this.reader.manager : undefined;
28
+ // }
29
+ put(key, value) {
30
+ this.props.set(key, value);
31
+ }
32
+ has(key) {
33
+ return this.props.get(key) !== undefined;
34
+ }
35
+ // _getPath(paths: string[]) {
36
+ // let entity: DexEntity | undefined = this;
37
+ // for (const path of paths) {
38
+ // const a: DexObj | undefined = entity instanceof DexObj ? entity : undefined;
39
+ // if (!a) {
40
+ // return;
41
+ // }
42
+ // const entityAtPath = a.get(path);
43
+ // if (entityAtPath instanceof DexEntity) {
44
+ // entity = entityAtPath;
45
+ // }
46
+ // }
47
+ // return entity;
48
+ // }
49
+ // getPathFromPaths(paths: string[]) {
50
+ // return this._getPath(paths);
51
+ // }
52
+ // getPath(k: string) {
53
+ // const delimiter = ".";
54
+ // if (k.slice(0, 1) === delimiter) {
55
+ // return Error("[DexObj.getPath] path may not begin with a delimiter");
56
+ // }
57
+ // return this._getPath(k.split(delimiter));
58
+ // }
59
+ get(key) {
60
+ // if (this.reader) {
61
+ // this.reader.setAccessed();
62
+ // }
63
+ const entity = this.props.get(key);
64
+ if (entity instanceof DexRef) {
65
+ const value = entity.load(key);
66
+ this.props.set(key, value);
67
+ return value;
68
+ }
69
+ return entity;
70
+ }
71
+ loadAll(visited = []) {
72
+ if (visited.indexOf(this) !== -1) {
73
+ return;
74
+ }
75
+ visited.push(this);
76
+ for (const key of this.props.keys()) {
77
+ const entity = this.get(key);
78
+ if (entity instanceof Error) {
79
+ return entity;
80
+ }
81
+ else if (entity instanceof DexObj) {
82
+ entity.loadAll(visited);
83
+ }
84
+ }
85
+ }
86
+ }