archiyou 0.7.0

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 (83) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +215 -0
  3. package/dist/archiyou.js +35969 -0
  4. package/dist/index.d.ts +2 -0
  5. package/dist/src/Annotator.d.ts +55 -0
  6. package/dist/src/AnnotatorBaseAnnotation.d.ts +16 -0
  7. package/dist/src/AnnotatorDimensionLine.d.ts +92 -0
  8. package/dist/src/Bbox.d.ts +126 -0
  9. package/dist/src/Beams.d.ts +316 -0
  10. package/dist/src/Brep.d.ts +152 -0
  11. package/dist/src/Calc.d.ts +48 -0
  12. package/dist/src/CalcDb.d.ts +33 -0
  13. package/dist/src/CalcTable.d.ts +60 -0
  14. package/dist/src/CalcTableIO.d.ts +130 -0
  15. package/dist/src/CodeParser.d.ts +58 -0
  16. package/dist/src/ComponentManager.d.ts +33 -0
  17. package/dist/src/Console.d.ts +34 -0
  18. package/dist/src/Doc.d.ts +181 -0
  19. package/dist/src/DocDocument.d.ts +27 -0
  20. package/dist/src/DocPDFExporter.d.ts +105 -0
  21. package/dist/src/DocPage.d.ts +75 -0
  22. package/dist/src/DocPageContainer.d.ts +65 -0
  23. package/dist/src/DocPageContainerGraphic.d.ts +10 -0
  24. package/dist/src/DocPageContainerImage.d.ts +21 -0
  25. package/dist/src/DocPageContainerTable.d.ts +21 -0
  26. package/dist/src/DocPageContainerText.d.ts +23 -0
  27. package/dist/src/DocPageContainerTextArea.d.ts +23 -0
  28. package/dist/src/DocPageContainerView.d.ts +22 -0
  29. package/dist/src/DocUtils.d.ts +12 -0
  30. package/dist/src/DocViewSVGManager.d.ts +91 -0
  31. package/dist/src/Edge.d.ts +190 -0
  32. package/dist/src/Exporter.d.ts +100 -0
  33. package/dist/src/Face.d.ts +134 -0
  34. package/dist/src/GLTFBuilder.d.ts +30 -0
  35. package/dist/src/IO.d.ts +87 -0
  36. package/dist/src/LibraryConnector.d.ts +56 -0
  37. package/dist/src/Make.d.ts +85 -0
  38. package/dist/src/MakeOperations.d.ts +32 -0
  39. package/dist/src/OBbox.d.ts +121 -0
  40. package/dist/src/Obj.d.ts +104 -0
  41. package/dist/src/OcLoader.d.ts +39 -0
  42. package/dist/src/ParamManager.d.ts +57 -0
  43. package/dist/src/ParamManagerOperator.d.ts +68 -0
  44. package/dist/src/Pipeline.d.ts +20 -0
  45. package/dist/src/Point.d.ts +88 -0
  46. package/dist/src/Runner.d.ts +230 -0
  47. package/dist/src/RunnerComponentImporter.d.ts +71 -0
  48. package/dist/src/RunnerOps.d.ts +15 -0
  49. package/dist/src/Script.d.ts +78 -0
  50. package/dist/src/ScriptOutputManager.d.ts +19 -0
  51. package/dist/src/ScriptOutputPath.d.ts +48 -0
  52. package/dist/src/ScriptParam.d.ts +78 -0
  53. package/dist/src/Selector.d.ts +48 -0
  54. package/dist/src/Services.d.ts +68 -0
  55. package/dist/src/Shape.d.ts +628 -0
  56. package/dist/src/ShapeCollection.d.ts +429 -0
  57. package/dist/src/Shell.d.ts +48 -0
  58. package/dist/src/Sketch.d.ts +162 -0
  59. package/dist/src/Solid.d.ts +54 -0
  60. package/dist/src/Vector.d.ts +167 -0
  61. package/dist/src/Vertex.d.ts +57 -0
  62. package/dist/src/VertexCollection.d.ts +11 -0
  63. package/dist/src/Wire.d.ts +180 -0
  64. package/dist/src/constants.d.ts +112 -0
  65. package/dist/src/decorators.d.ts +27 -0
  66. package/dist/src/garbageCollection.d.ts +4 -0
  67. package/dist/src/init.d.ts +5 -0
  68. package/dist/src/internal.d.ts +67 -0
  69. package/dist/src/models.d.ts +40 -0
  70. package/dist/src/typeguards.d.ts +88 -0
  71. package/dist/src/types.d.ts +944 -0
  72. package/dist/src/utils.d.ts +140 -0
  73. package/dist/src/wasm/build-scripts/build_wasm_base64.d.ts +8 -0
  74. package/dist/src/wasm/index.d.ts +8 -0
  75. package/dist/src/workerUtils.d.ts +14 -0
  76. package/dist/wasm/README.md +13 -0
  77. package/dist/wasm/archiyou-opencascade.d.ts +9933 -0
  78. package/dist/wasm/archiyou-opencascade.js +16 -0
  79. package/dist/wasm/archiyou-opencascade.wasm +0 -0
  80. package/dist/wasm/index.js +32 -0
  81. package/dist/wasm/node.d.ts +16 -0
  82. package/dist/wasm/node.js +40 -0
  83. package/package.json +66 -0
@@ -0,0 +1,140 @@
1
+ import { ScriptParamData, PolarCoord, ScriptParam, UnitsWithPerc, ScriptOutputDataWrapper } from './internal';
2
+ /** Turn data ScriptParamData into Param by recreating functions
3
+ * NOTE: ScriptParamData is used as data - internally make sure to use Param
4
+ */
5
+ export declare function ScriptParamDataToParam(param: ScriptParam | ScriptParamData): ScriptParam;
6
+ /** Turn param into ScriptParamData */
7
+ export declare function paramToScriptParamData(param: ScriptParam | ScriptParamData): ScriptParamData;
8
+ export declare function flattenEntitiesToArray(entities: any): Array<any>;
9
+ /** Alternative to the above. Faster? */
10
+ export declare function flattenEntities(arr: Array<any>): any;
11
+ /** Export sha256 hasing function */
12
+ export declare function hash(s: string): string;
13
+ export declare function roundTo(number: number, precision: number): number;
14
+ /** Round to 3 decimals (standard for AY ) */
15
+ export declare function roundToTolerance(n: number): number;
16
+ /** Round to step size */
17
+ export declare function roundToStep(n: number, step: number, start: number): number;
18
+ export declare function toDeg(r: number): number;
19
+ export declare function toRad(d: number): number;
20
+ export declare function isNumeric(x: any): boolean;
21
+ export declare function isBoolean(x: any): boolean;
22
+ /** Used for Calc excel export */
23
+ export declare function getTypeClass(x: any): StringConstructor | NumberConstructor | BooleanConstructor;
24
+ export declare function rangeArray(min: number, max: number): Array<number>;
25
+ /** String hex (#FF0000) to int
26
+ * WARNING: This seems to generate wrong numbers
27
+ */
28
+ export declare function colorHexToInt(rrggbb: string): number;
29
+ export declare function colorIntToHex(c?: number): string;
30
+ /** Test is a given parameter is a relative (cartesian) coordinate */
31
+ export declare function isRelativeCartesianCoordString(s: any): boolean;
32
+ /** Transform cartesian or polar relative string coordinate to a real number */
33
+ export declare function relativeCoordToNumber(s: any): number;
34
+ export declare function parseRelativePolarCoordString(s: any): PolarCoord;
35
+ export declare function isRelativeCoordString(s: any): boolean;
36
+ /** duplicate values in array a n number of times
37
+ * doubleArrayValue([1,0],1) ==> [1,1,0,0]
38
+ * */
39
+ export declare function replicateArrayValues(array: Array<any>, n: number): any[];
40
+ /** Generate array of integers from start and including end */
41
+ export declare function intRange(start: string | number, end: string | number): number[];
42
+ /** Convert a value between units of measure */
43
+ export declare function convertValueFromToUnit(v: number, from: UnitsWithPerc, to: UnitsWithPerc, relativeToNum?: number): number;
44
+ export declare function pointsToMm(p: number): number;
45
+ export declare function mmToPoints(m: number): number;
46
+ /** Node structure for filterNestedObjects - optimized for XML/SVG parsing */
47
+ export interface NestedObjectNode<T = any> {
48
+ tagName: string;
49
+ value: T;
50
+ parent?: NestedObjectNode<T>;
51
+ children?: NestedObjectNode<T>[];
52
+ attributes?: Record<string, any>;
53
+ }
54
+ /**
55
+ * Recursively traverse nested XML/SVG objects and return nodes matching the filter
56
+ * Optimized for structures from fast-xml-parser where tag names are object keys
57
+ * Traverses ALL object properties as potential child elements
58
+ *
59
+ * @param obj - The root object to traverse
60
+ * @param filterFunc - Function that returns true for nodes to include
61
+ * @param options - Configuration options
62
+ * @returns Array of matching Node objects
63
+ *
64
+ * @example
65
+ * // SVG structure: { svg: { rect: { x: 0, y: 0, width: 50 }, circle: { cx: 25, cy: 25, r: 10 } } }
66
+ * const rects = filterNestedObjects(
67
+ * svgData,
68
+ * (node) => node.tagName === 'rect'
69
+ * );
70
+ * // Returns: [{ tagName: 'rect', value: {...}, attributes: { x: 0, y: 0, width: 50 }, children: [] }]
71
+ */
72
+ export declare function filterNestedObjects<T = any>(obj: T, filterFunc: (node: NestedObjectNode<T>) => boolean, options?: {
73
+ maxDepth?: number;
74
+ includeRoot?: boolean;
75
+ collectParents?: boolean;
76
+ extractAttributes?: boolean;
77
+ excludeKeys?: string[];
78
+ }): NestedObjectNode<T>[];
79
+ /**
80
+ * Convert a string value to its native type if possible.
81
+ * - "true"/"false" (case-insensitive) => boolean
82
+ * - Numeric strings => number
83
+ * - Otherwise, return as string
84
+ */
85
+ export declare function convertStringValue(value: string): string | number | boolean;
86
+ export declare const arrayBufferToBase64: (arraybuffer: ArrayBuffer) => string;
87
+ export declare function isBrowser(): boolean;
88
+ export declare function isWorker(): boolean;
89
+ /** A simple uuid4 method */
90
+ export declare function uuidv4(): string;
91
+ /**
92
+ * Recursively transforms binary data in an object to base64 strings for JSON serialization
93
+ * We use an instance of ScriptOutputDataWrapper to keep track of original type and length for easy decoding
94
+ *
95
+ * @param obj - The object to transform
96
+ * @param maxDepth - Maximum recursion depth to prevent infinite loops (default: 10)
97
+ * @param currentDepth - Current recursion depth (internal use)
98
+ * @returns Transformed object with binary data as base64 strings
99
+ */
100
+ export declare function convertBinaryToBase64<T>(obj: T, maxDepth?: number, currentDepth?: number): number | string | Array<any> | Object | ScriptOutputDataWrapper;
101
+ /**
102
+ * Restores binary data from base64 strings after JSON parsing
103
+ * @param obj - The object to restore
104
+ * @returns Object with restored binary data
105
+ */
106
+ export declare function restoreBinaryFromBase64(obj: ScriptOutputDataWrapper, forceBuffer?: boolean): Buffer | ArrayBuffer | Uint8Array | null;
107
+ /** Simple metadata printout */
108
+ export declare function printDataInfo(data: any): void;
109
+ export declare function getValuePreview(data: any, maxLength?: number): string;
110
+ /**
111
+ * Converts a record object to a URL parameter string.
112
+ * Example: { foo: 'bar', baz: 1 } => 'foo=bar&baz=1'
113
+ * @param params Record<string, any>
114
+ * @returns URL parameter string
115
+ */
116
+ export declare function recordToUrlParams(params: Record<string, any>): string;
117
+ /**
118
+ * Converts a URL parameter string to a record object.
119
+ * Example: 'foo=bar&baz=1' => { foo: 'bar', baz: '1' }
120
+ * @param paramString URL parameter string
121
+ * @returns Record<string, string>
122
+ */
123
+ export declare function urlParamsToRecord(paramString: string): Record<string, string>;
124
+ /**
125
+ * Converts a data object to a JS module string with export default,
126
+ * each key on a separate line for readability.
127
+ * @param data The data object to export
128
+ * @returns JS module string
129
+ *
130
+ * This is used to write script.js files in the Library
131
+ */
132
+ export declare function dataToModuleString(data: Record<string, any>): string;
133
+ export declare function _getArgNames(func: any): Array<string>;
134
+ export declare function analyzeFunc(func: (any: any) => any): {
135
+ argCount: number;
136
+ argNames: string[];
137
+ isAsync: boolean;
138
+ hasMainScopeParam: boolean;
139
+ returnsPromise: boolean;
140
+ };
@@ -0,0 +1,8 @@
1
+ /**
2
+ * build-wasm.ts
3
+ * Builds the Rust WASM module and inlines it as a Base64 string into a TypeScript file.
4
+ * Requirements:
5
+ * - Please make sure you have csgrs Rust git submodule in lib/csgrs folder.
6
+ *
7
+ */
8
+ export {};
@@ -0,0 +1,8 @@
1
+ export default initOpenCascade;
2
+ declare function initOpenCascade({ mainJS, mainWasm, worker, libs, module, }?: {
3
+ mainJS?: typeof ocFullJS;
4
+ mainWasm?: any;
5
+ worker?: any;
6
+ libs?: any[];
7
+ module?: {};
8
+ }): Promise<any>;
@@ -0,0 +1,14 @@
1
+ /**
2
+ * workerUtils.ts
3
+ * Defining workers - from WebWorkers to Node JS workers often use the same functions
4
+ * These are bundled here
5
+ */
6
+ /** Setup the scope for execution. See also archiyou-app/GeomWorker.ts */
7
+ export declare function makeShapeGlobals(oc: any, scope: any): void;
8
+ export declare function makeGeomMethodsGlobals(scope: any): void;
9
+ export declare function setParamVariables(scope: any, params: {
10
+ [key: string]: any;
11
+ }): void;
12
+ export declare function clearParamVariables(scope: any, params?: {
13
+ [key: string]: any;
14
+ }): void;
@@ -0,0 +1,13 @@
1
+ # archiyou-opencascade
2
+
3
+ Builds of custom opencascade.js WASM libraries
4
+
5
+ ## Build
6
+
7
+ Use python script in /build-scripts/run_build
8
+
9
+ IMPORTANT: Add
10
+ ```
11
+ // @ts-nocheck
12
+ ```
13
+ To archiyou_opencascade.d.ts