@holoscript/core 6.0.3 → 6.0.4

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 (229) hide show
  1. package/README.md +38 -38
  2. package/dist/GLTFPipeline-DEN36VNK.js +12 -0
  3. package/dist/GLTFPipeline-YPCAK236.cjs +33 -0
  4. package/dist/{HoloScriptPlusParser-BZR5DELQ.js → HoloScriptPlusParser-BN6KVRCM.js} +5 -5
  5. package/dist/{HoloScriptPlusParser-SBMYDNXO.cjs → HoloScriptPlusParser-NC5FE6AL.cjs} +16 -16
  6. package/dist/{USDZExporter-YA55ZS35.js → USDZExporter-NTMBNTDB.js} +3 -3
  7. package/dist/{USDZExporter-MHEHXZB4.cjs → USDZExporter-UWGWNMMD.cjs} +3 -3
  8. package/dist/{chunk-32TWR3HE.js → chunk-2CWOLHTE.js} +3 -4
  9. package/dist/{chunk-2UX5LRAP.cjs → chunk-33LSUQDD.cjs} +33 -31
  10. package/dist/{chunk-LBPEZQAF.js → chunk-3FJCK5XA.js} +7 -7
  11. package/dist/{chunk-EGIZHYJP.cjs → chunk-3SAK5KFL.cjs} +2 -4
  12. package/dist/{chunk-PJMOXFPR.cjs → chunk-4XSNJCLC.cjs} +25 -27
  13. package/dist/{chunk-HKCVM6OK.cjs → chunk-5BGSECRJ.cjs} +21 -21
  14. package/dist/{chunk-EMO7HAKJ.cjs → chunk-5O6TQC6M.cjs} +26 -30
  15. package/dist/{chunk-XSUZMPVQ.cjs → chunk-5OEOHAAW.cjs} +26 -26
  16. package/dist/{chunk-EJA7G2C4.cjs → chunk-5WUNN6ZN.cjs} +2 -2
  17. package/dist/{chunk-CQDOF3G7.cjs → chunk-6TZPZCOJ.cjs} +18 -18
  18. package/dist/{chunk-NRUB55IT.cjs → chunk-6UEHYZ7V.cjs} +18 -16
  19. package/dist/{chunk-V42NTCFH.js → chunk-6XSERL6L.js} +4230 -2197
  20. package/dist/{chunk-X4YVN7H3.cjs → chunk-72EQECGT.cjs} +37 -17
  21. package/dist/{chunk-4KJ2R7VP.cjs → chunk-7AGYRWKW.cjs} +19 -19
  22. package/dist/{chunk-UQW6SLM5.js → chunk-A7PIMZGU.js} +110 -19
  23. package/dist/{chunk-RT7LJRSF.cjs → chunk-ATSKSYVE.cjs} +1013 -6708
  24. package/dist/{chunk-WN3YF33G.cjs → chunk-B5TCIAPQ.cjs} +9 -10
  25. package/dist/{chunk-AIUXRS74.cjs → chunk-BF2235SI.cjs} +4275 -2242
  26. package/dist/{chunk-DIEDKX5B.cjs → chunk-BND3ST2K.cjs} +18 -16
  27. package/dist/{chunk-EPWRXL6S.js → chunk-BU7VWW2K.js} +29 -29
  28. package/dist/{chunk-6OQBLABR.js → chunk-BWFJEM5A.js} +368 -189
  29. package/dist/{chunk-ARNKA274.cjs → chunk-CAUCGUEA.cjs} +6 -6
  30. package/dist/{chunk-YCMQQQ5U.cjs → chunk-CBJSLA2E.cjs} +398 -219
  31. package/dist/{chunk-BU5ZAFMC.js → chunk-CDPGV4DN.js} +6 -7
  32. package/dist/{chunk-CO2VM2DK.js → chunk-CS2EMTGF.js} +10 -9
  33. package/dist/{chunk-AW7WAELW.js → chunk-DMG7C4H2.js} +4 -4
  34. package/dist/{chunk-XSF76QRU.js → chunk-DXJQDCFL.js} +3 -3
  35. package/dist/{chunk-4FCZDTD5.js → chunk-E3FWRT3Z.js} +7 -9
  36. package/dist/{chunk-KYM4XRFG.js → chunk-E3UALNFA.js} +4 -4
  37. package/dist/{chunk-GC3YU46J.js → chunk-EONILVMF.js} +2 -2
  38. package/dist/{chunk-VJVCD5T5.cjs → chunk-EQV4R3EV.cjs} +22 -22
  39. package/dist/{chunk-FEFHPUEM.cjs → chunk-F3HH56EB.cjs} +74 -658
  40. package/dist/{chunk-WYH4GVZ5.js → chunk-F4IULT7N.js} +2 -2
  41. package/dist/{chunk-XDXZM3ZP.cjs → chunk-FFKU7BTK.cjs} +19 -19
  42. package/dist/{chunk-NKRKT6V2.js → chunk-FHQVYCH2.js} +11 -10
  43. package/dist/{chunk-7H5UNJZD.cjs → chunk-FSF7EQVA.cjs} +11 -10
  44. package/dist/{chunk-KUJRR4FJ.js → chunk-G4VZTCIB.js} +9 -7
  45. package/dist/{chunk-A6GO3DPZ.cjs → chunk-G7CT3EMP.cjs} +4 -4
  46. package/dist/{chunk-EUFLX2PI.js → chunk-GGHSW2NN.js} +989 -6611
  47. package/dist/chunk-GVUR45UF.cjs +777 -0
  48. package/dist/{chunk-ODGMVILH.js → chunk-H5Z7NASB.js} +3 -3
  49. package/dist/{chunk-7KPI4EKH.cjs → chunk-HE7ULERA.cjs} +45 -49
  50. package/dist/{chunk-26TLYBFD.js → chunk-HPS76H7Q.js} +3 -3
  51. package/dist/{chunk-RE3OKSYF.cjs → chunk-HQUEA5R6.cjs} +6 -6
  52. package/dist/{chunk-ZGTGVSTZ.js → chunk-HYNTS5CP.js} +2 -2
  53. package/dist/{chunk-PBA6NXCT.cjs → chunk-IBDG74G2.cjs} +6 -3
  54. package/dist/chunk-IFNQFCTM.js +3098 -0
  55. package/dist/{chunk-ZL6VJ6SN.js → chunk-IWI6J7FX.js} +5 -5
  56. package/dist/{chunk-3KEU5QYY.cjs → chunk-K3JDKWGI.cjs} +118 -23
  57. package/dist/{chunk-NLPSZT4C.js → chunk-K6EKD26I.js} +6 -6
  58. package/dist/chunk-KCQ5NDYC.cjs +3172 -0
  59. package/dist/{chunk-ELLQPFAF.js → chunk-KED34ILP.js} +11 -9
  60. package/dist/{chunk-BY3B7ZYV.cjs → chunk-KSGXLT74.cjs} +3 -3
  61. package/dist/{chunk-65RFOWZI.js → chunk-L4G4RLXX.js} +9 -7
  62. package/dist/{chunk-4SMUJFHL.js → chunk-LDP5OK6G.js} +6 -3
  63. package/dist/{chunk-VZNKJZTT.cjs → chunk-LGGRPKTV.cjs} +82 -96
  64. package/dist/{chunk-C2QHVHZF.js → chunk-LSW7P7ML.js} +23 -414
  65. package/dist/{chunk-HHS6FMOU.cjs → chunk-LXJ4667L.cjs} +83 -22
  66. package/dist/{chunk-H6WMMLQK.cjs → chunk-LZ266PCM.cjs} +20 -13
  67. package/dist/{chunk-V2ILLPHK.cjs → chunk-MD6KDHVE.cjs} +10 -10
  68. package/dist/{chunk-6WNCRE6F.js → chunk-MEASWI2Y.js} +5 -5
  69. package/dist/chunk-MPXBVFHQ.js +768 -0
  70. package/dist/{chunk-WUXIRGZP.cjs → chunk-NCUKG4SK.cjs} +304 -144
  71. package/dist/chunk-NDQNIJEH.js +1715 -0
  72. package/dist/{chunk-Y5MUAYTO.js → chunk-NOZZ46QU.js} +9 -8
  73. package/dist/{chunk-F5LVGHNT.js → chunk-OFKWH2IP.js} +3 -3
  74. package/dist/{chunk-SPDELRRV.cjs → chunk-PMGODDJA.cjs} +12 -12
  75. package/dist/{chunk-I3XGTIHM.cjs → chunk-Q4QX3AET.cjs} +2 -2
  76. package/dist/{chunk-Y7VK5TH3.cjs → chunk-Q5JT3YML.cjs} +10 -10
  77. package/dist/{chunk-TSWTWZ42.cjs → chunk-Q5SJOGHQ.cjs} +247 -205
  78. package/dist/{chunk-M6FU6S22.js → chunk-QGKNANZ3.js} +251 -91
  79. package/dist/{chunk-WFJIDI2N.cjs → chunk-QLEAOI3Q.cjs} +10 -10
  80. package/dist/{chunk-VK5AXKO3.js → chunk-R7MA7QWV.js} +70 -84
  81. package/dist/{chunk-W76ETJTI.js → chunk-RVYPEYPX.js} +6 -6
  82. package/dist/{chunk-MWEFR6YQ.js → chunk-S2N5TNMA.js} +7 -9
  83. package/dist/{chunk-NCUHGRTZ.js → chunk-S565K7NK.js} +7 -7
  84. package/dist/{chunk-AC4BSHFV.js → chunk-SDAMZIRE.js} +5 -5
  85. package/dist/{chunk-HBZYCASG.js → chunk-T36DDXSF.js} +75 -33
  86. package/dist/{chunk-BO2OKHIY.js → chunk-T4NKMBDL.js} +30 -611
  87. package/dist/{chunk-7X2IEJIE.cjs → chunk-T7LEXZUZ.cjs} +29 -29
  88. package/dist/{chunk-HUFNKFA6.js → chunk-TEWCN33Y.js} +8 -12
  89. package/dist/{chunk-L3Z2HIWJ.cjs → chunk-TQSZUOW5.cjs} +2 -2
  90. package/dist/chunk-TSH3MSQU.cjs +129 -0
  91. package/dist/{chunk-PLMYCCA4.js → chunk-UERJ3YJV.js} +6 -6
  92. package/dist/{chunk-7N3JIJMT.js → chunk-UPJBDCVF.js} +6 -6
  93. package/dist/{chunk-CMYAWUX3.js → chunk-V3NN3HPP.js} +12 -5
  94. package/dist/{chunk-SUCBB66F.js → chunk-WB4Z63GG.js} +3 -3
  95. package/dist/{chunk-PPULB4GG.cjs → chunk-WDW67DZB.cjs} +68 -68
  96. package/dist/chunk-WGMEAYBG.js +126 -0
  97. package/dist/{chunk-VSXOIUCF.cjs → chunk-X4ZF6CNE.cjs} +7 -7
  98. package/dist/{chunk-HF4OFY25.cjs → chunk-X6SEAXAX.cjs} +29 -445
  99. package/dist/{chunk-C7BNX4XJ.js → chunk-XCWFGZAA.js} +6 -6
  100. package/dist/{chunk-CNVM7J3M.js → chunk-XD6IYDUX.js} +34 -14
  101. package/dist/chunk-XG23EUQX.cjs +1717 -0
  102. package/dist/{chunk-DN7UFU63.cjs → chunk-XRKWN5PL.cjs} +12 -11
  103. package/dist/{chunk-XNMEH2BI.js → chunk-XUTX5CBW.js} +3 -3
  104. package/dist/{chunk-PQLGZKMC.cjs → chunk-XWPNTWDN.cjs} +26 -26
  105. package/dist/{chunk-NTMZSDXM.cjs → chunk-XXINBTZK.cjs} +43 -43
  106. package/dist/{chunk-74YCHHTE.js → chunk-YCXFCXDS.js} +8 -12
  107. package/dist/{chunk-KDB6BUMB.js → chunk-YQK5JNFK.js} +77 -18
  108. package/dist/{chunk-DH5G2JUA.cjs → chunk-Z34RLXRA.cjs} +44 -46
  109. package/dist/{chunk-XH7SE4HH.cjs → chunk-ZP4D3CSX.cjs} +19 -19
  110. package/dist/cli/holoscript-runner.cjs +33 -32
  111. package/dist/cli/holoscript-runner.js +13 -12
  112. package/dist/codebase/index.cjs +1 -1
  113. package/dist/codebase/index.d.ts +25 -0
  114. package/dist/codebase/index.js +1 -1
  115. package/dist/compiler/agent-inference.cjs +7 -8
  116. package/dist/compiler/agent-inference.js +3 -4
  117. package/dist/compiler/android-xr.cjs +7 -8
  118. package/dist/compiler/android-xr.js +5 -6
  119. package/dist/compiler/android.cjs +8 -9
  120. package/dist/compiler/android.js +6 -7
  121. package/dist/compiler/ar.cjs +6 -7
  122. package/dist/compiler/ar.js +4 -5
  123. package/dist/compiler/babylon.cjs +8 -9
  124. package/dist/compiler/babylon.js +7 -8
  125. package/dist/compiler/coco.cjs +1 -1
  126. package/dist/compiler/coco.js +1 -1
  127. package/dist/compiler/domain-block-utils.cjs +158 -151
  128. package/dist/compiler/domain-block-utils.js +4 -5
  129. package/dist/compiler/dtdl.cjs +7 -8
  130. package/dist/compiler/dtdl.js +4 -5
  131. package/dist/compiler/gltf-pipeline.cjs +9 -9
  132. package/dist/compiler/gltf-pipeline.js +2 -2
  133. package/dist/compiler/godot.cjs +6 -7
  134. package/dist/compiler/godot.js +5 -6
  135. package/dist/compiler/incremental.cjs +7 -8
  136. package/dist/compiler/incremental.js +2 -3
  137. package/dist/compiler/index.cjs +1934 -878
  138. package/dist/compiler/index.js +1904 -842
  139. package/dist/compiler/ios.cjs +8 -9
  140. package/dist/compiler/ios.js +6 -7
  141. package/dist/compiler/multi-layer.cjs +10 -17
  142. package/dist/compiler/multi-layer.js +9 -10
  143. package/dist/compiler/nodetoy.cjs +1 -1
  144. package/dist/compiler/nodetoy.js +1 -1
  145. package/dist/compiler/openxr.cjs +6 -7
  146. package/dist/compiler/openxr.js +5 -6
  147. package/dist/compiler/playcanvas.cjs +7 -8
  148. package/dist/compiler/playcanvas.js +6 -7
  149. package/dist/compiler/r3f.cjs +13 -14
  150. package/dist/compiler/r3f.js +8 -9
  151. package/dist/compiler/remotion.cjs +1 -1
  152. package/dist/compiler/remotion.js +1 -1
  153. package/dist/compiler/reproducibility.cjs +1 -1
  154. package/dist/compiler/reproducibility.js +1 -1
  155. package/dist/compiler/sdf.cjs +7 -8
  156. package/dist/compiler/sdf.js +5 -6
  157. package/dist/compiler/semantic-scene.cjs +7 -7
  158. package/dist/compiler/semantic-scene.js +2 -2
  159. package/dist/compiler/state.cjs +5 -6
  160. package/dist/compiler/state.js +3 -4
  161. package/dist/compiler/trait-composition.cjs +7 -8
  162. package/dist/compiler/trait-composition.js +3 -4
  163. package/dist/compiler/unity.cjs +6 -7
  164. package/dist/compiler/unity.js +5 -6
  165. package/dist/compiler/unreal.cjs +7 -8
  166. package/dist/compiler/unreal.js +5 -6
  167. package/dist/compiler/urdf.cjs +13 -14
  168. package/dist/compiler/urdf.js +5 -6
  169. package/dist/compiler/usd-physics.cjs +7 -8
  170. package/dist/compiler/usd-physics.js +4 -5
  171. package/dist/compiler/visionos.cjs +6 -7
  172. package/dist/compiler/visionos.js +5 -6
  173. package/dist/compiler/vrchat.cjs +7 -8
  174. package/dist/compiler/vrchat.js +5 -6
  175. package/dist/compiler/vrr.cjs +7 -8
  176. package/dist/compiler/vrr.js +5 -6
  177. package/dist/compiler/wasm.cjs +10 -11
  178. package/dist/compiler/wasm.js +5 -6
  179. package/dist/compiler/webgpu.cjs +6 -7
  180. package/dist/compiler/webgpu.js +5 -6
  181. package/dist/constants.d.ts +3 -0
  182. package/dist/debugger.cjs +7 -7
  183. package/dist/debugger.js +5 -5
  184. package/dist/entries/interop.cjs +1 -1
  185. package/dist/entries/interop.d.ts +9 -0
  186. package/dist/entries/interop.js +1 -1
  187. package/dist/entries/scripting.cjs +18 -17
  188. package/dist/entries/scripting.d.ts +7 -0
  189. package/dist/entries/scripting.js +8 -7
  190. package/dist/index.cjs +6773 -27555
  191. package/dist/index.d.ts +19 -0
  192. package/dist/index.js +5212 -26101
  193. package/dist/math/vec3.cjs +1 -1
  194. package/dist/math/vec3.js +1 -1
  195. package/dist/ml-dsa-PHCWUBPX.cjs +1178 -0
  196. package/dist/ml-dsa-WYLJHJO6.js +1178 -0
  197. package/dist/parser.cjs +11 -10
  198. package/dist/parser.js +8 -7
  199. package/dist/{playwright-BIZXMLD2.js → playwright-5OSAPTNH.js} +3 -3
  200. package/dist/{playwright-7DTEQCBD.cjs → playwright-RL6GY4F7.cjs} +1985 -1985
  201. package/dist/runtime.cjs +5 -5
  202. package/dist/runtime.js +4 -4
  203. package/dist/self-improvement/index.d.ts +0 -48
  204. package/dist/storage/index.cjs +1 -1
  205. package/dist/storage/index.d.ts +24 -0
  206. package/dist/storage/index.js +1 -1
  207. package/dist/tools/index.d.ts +12 -0
  208. package/dist/traits/index.cjs +925 -607
  209. package/dist/traits/index.js +137 -20
  210. package/dist/type-checker.cjs +4 -4
  211. package/dist/type-checker.js +2 -2
  212. package/package.json +56 -21
  213. package/LICENSE +0 -21
  214. package/dist/GLTFPipeline-3KLWWUQO.cjs +0 -34
  215. package/dist/GLTFPipeline-LYII2ZVQ.js +0 -13
  216. package/dist/chunk-CN4NOESF.cjs +0 -416
  217. package/dist/chunk-DXVCEFZB.js +0 -2027
  218. package/dist/chunk-ENV7K6XA.js +0 -282
  219. package/dist/chunk-H7XMORZI.js +0 -2731
  220. package/dist/chunk-HAN4V3PF.cjs +0 -2037
  221. package/dist/chunk-LER4WXW5.cjs +0 -286
  222. package/dist/chunk-QHVVVN47.cjs +0 -2033
  223. package/dist/chunk-QWKUKVRE.js +0 -2026
  224. package/dist/chunk-UITWA6DV.cjs +0 -2829
  225. package/dist/chunk-X67XRI2T.js +0 -410
  226. package/dist/post-quantum-JTTAAGO3.cjs +0 -6
  227. package/dist/post-quantum-RVPVDEPI.js +0 -4
  228. package/dist/wot/index.cjs +0 -29
  229. package/dist/wot/index.js +0 -4
@@ -1,473 +1,8 @@
1
- import { init_R3FCompiler, MATERIAL_PRESETS } from './chunk-HBZYCASG.js';
2
- import { init_DomainBlockCompilerMixin, compileDomainBlocks, inputToUSDA, compileInputBlock, navigationToUSDA, compileNavigationBlock, renderingToUSDA, compileRenderingBlock, proceduralToUSDA, compileProceduralBlock, web3ToUSDA, compileWeb3Block, architectureToUSDA, compileArchitectureBlock, musicToUSDA, compileMusicBlock, educationToUSDA, compileEducationBlock, datavizToUSDA, compileDataVizBlock, iotToUSDA, compileIoTBlock, compileRoboticsBlock, roboticsToUSDA, compileHealthcareBlock, healthcareToUSDA, compilePaymentBlock, paymentToUSDA, compileNarrativeBlock, narrativeToUSDA, compileWeatherBlock, weatherToUSD, compileAudioSourceBlock, audioSourceToUSD, compilePostProcessingBlock, postProcessingToUSD, compileParticleBlock, particlesToUSD, compilePhysicsBlock, compileMaterialBlock, materialToUSD } from './chunk-KDB6BUMB.js';
3
- import { init_CompilerBase, CompilerBase, init_ANSNamespace, ANSCapabilityPath } from './chunk-QWKUKVRE.js';
4
- import { __export, __esm } from './chunk-32TWR3HE.js';
5
-
6
- // src/compiler/Native2DCompiler.ts
7
- var Native2DCompiler_exports = {};
8
- __export(Native2DCompiler_exports, {
9
- Native2DCompiler: () => Native2DCompiler
10
- });
11
- var Native2DCompiler;
12
- var init_Native2DCompiler = __esm({
13
- "src/compiler/Native2DCompiler.ts"() {
14
- init_CompilerBase();
15
- Native2DCompiler = class extends CompilerBase {
16
- constructor() {
17
- super(...arguments);
18
- this.compilerName = "Native2DCompiler";
19
- // ============================================================================
20
- // REACT GENERATION
21
- // ============================================================================
22
- /** Collected during node traversal — used to generate imports and hooks */
23
- this._slotImports = /* @__PURE__ */ new Map();
24
- this._uiImports = /* @__PURE__ */ new Set();
25
- this._stateFields = /* @__PURE__ */ new Map();
26
- this._fetchCalls = [];
27
- this._options = {};
28
- }
29
- // @ts-expect-error During migration
30
- compile(composition, agentToken, outputPath, options) {
31
- this.validateCompilerAccess(agentToken, outputPath);
32
- const isReact = options?.format === "react";
33
- const elements = composition.ui?.elements || composition.objects || [];
34
- if (isReact) {
35
- const code = this.generateReactComponent(composition.name, elements, composition, options);
36
- if (options?.generateDocs) {
37
- return {
38
- output: code,
39
- documentation: this.generateDocumentation(composition, code, options.docsOptions)
40
- };
41
- }
42
- return code;
43
- } else {
44
- const code = this.generateHTMLPage(composition.name, elements, composition);
45
- if (options?.generateDocs) {
46
- return {
47
- output: code,
48
- documentation: this.generateDocumentation(composition, code, options.docsOptions)
49
- };
50
- }
51
- return code;
52
- }
53
- }
54
- generateReactComponent(name, objects, composition, options) {
55
- this._slotImports.clear();
56
- this._uiImports.clear();
57
- this._stateFields.clear();
58
- this._fetchCalls = [];
59
- this._options = options || {};
60
- const safeName = name.replace(/[^a-zA-Z0-9]/g, "");
61
- if (composition?.state?.properties) {
62
- for (const prop of composition.state.properties) {
63
- this._stateFields.set(prop.key, prop.value ?? null);
64
- }
65
- }
66
- const jsx = objects.map((obj) => this.generateReactNode(obj)).join("\n ");
67
- const imports = [];
68
- const reactImports = /* @__PURE__ */ new Set();
69
- if (this._stateFields.size > 0) reactImports.add("useState");
70
- if (this._fetchCalls.length > 0) reactImports.add("useEffect");
71
- imports.push(
72
- reactImports.size > 0 ? `import React, { ${[...reactImports].join(", ")} } from 'react';` : `import React from 'react';`
73
- );
74
- if (this._uiImports.size > 0) {
75
- imports.push(`import { ${[...this._uiImports].join(", ")} } from '@holoscript/ui';`);
76
- }
77
- for (const [, slot] of this._slotImports) {
78
- imports.push(`import { ${slot.component} } from '${slot.importPath}';`);
79
- }
80
- const stateHooks = [];
81
- for (const [key, value] of this._stateFields) {
82
- const capitalKey = key.charAt(0).toUpperCase() + key.slice(1);
83
- const initValue = JSON.stringify(value);
84
- stateHooks.push(` const [${key}, set${capitalKey}] = useState(${initValue === void 0 ? "null" : initValue});`);
85
- }
86
- const fetchEffects = [];
87
- for (const f of this._fetchCalls) {
88
- fetchEffects.push(` useEffect(() => {
89
- fetch(\`${f.endpoint}\`${f.method !== "GET" ? `, { method: '${f.method}' }` : ""})
90
- .then(r => r.json())
91
- .then(set${f.name.charAt(0).toUpperCase() + f.name.slice(1)})
92
- .catch(console.error);
93
- }, []);`);
94
- }
95
- return `${imports.join("\n")}
96
-
97
- // @generated by HoloScript Native2DCompiler \u2014 DO NOT EDIT
98
- export function ${safeName}Component() {
99
- ${stateHooks.join("\n")}
100
- ${fetchEffects.join("\n")}
101
-
102
- return (
103
- <div className="holoscript-2d-root w-full h-full">
104
- ${jsx}
105
- </div>
106
- );
107
- }
108
-
109
- export default ${safeName}Component;
110
- `;
111
- }
112
- generateReactNode(obj) {
113
- const traits = this.extractTraits(obj);
114
- if (traits.slot) {
115
- const slotName = traits.slot.name || obj.name || "Slot";
116
- const configuredSlot = this._options.slots?.[String(slotName)];
117
- const component = traits.slot.component || configuredSlot?.component || slotName;
118
- const importPath = traits.slot.import || configuredSlot?.importPath || `@/components/${component}`;
119
- this._slotImports.set(slotName, { component, importPath });
120
- const propsStr = traits.slot.props ? ` {...${JSON.stringify(traits.slot.props)}}` : "";
121
- return `<div data-holo-slot="${slotName}">
122
- <${component}${propsStr} />
123
- </div>`;
124
- }
125
- if (traits.fetch) {
126
- const name = traits.fetch.into || "data";
127
- const endpoint = traits.fetch.endpoint || "/api/data";
128
- const method = traits.fetch.method || "GET";
129
- this._fetchCalls.push({ name, endpoint, method });
130
- if (!this._stateFields.has(name)) {
131
- this._stateFields.set(name, null);
132
- }
133
- }
134
- let tag = traits.theme?.tag || traits.panel?.tag || (typeof obj.type === "string" ? obj.type.toLowerCase() : void 0) || "div";
135
- if ([
136
- "nav",
137
- "section",
138
- "main",
139
- "footer",
140
- "form",
141
- "style",
142
- "a",
143
- "header",
144
- "h1",
145
- "h2",
146
- "h3"
147
- ].includes(tag)) ; else if (tag === "container") {
148
- tag = "div";
149
- } else if (traits.link || tag === "link") {
150
- tag = "a";
151
- } else if (traits.button || tag === "button") {
152
- tag = "button";
153
- } else if (traits.image || tag === "image") {
154
- tag = "img";
155
- } else if (traits.input || tag === "input") {
156
- tag = "input";
157
- } else if (traits.text || tag === "text") {
158
- tag = this.mapTextVariantToTag(traits.text?.variant || "body");
159
- } else {
160
- tag = "div";
161
- }
162
- const styles = this.buildStyles(traits);
163
- const classes = this.buildClasses(traits);
164
- let props = ``;
165
- if (traits.theme?.className) {
166
- classes.push(traits.theme.className);
167
- }
168
- if (traits.theme?.id) {
169
- props += ` id="${traits.theme.id}"`;
170
- }
171
- const combinedStyles = { ...styles };
172
- if (traits.theme?.style) {
173
- traits.theme.style.split(";").forEach((rule) => {
174
- const [key, ...valueParts] = rule.split(":");
175
- const value = valueParts.join(":");
176
- if (key && value) {
177
- const camelKey = key.trim().replace(/-([a-z])/g, (g) => g[1].toUpperCase());
178
- combinedStyles[camelKey] = value.trim();
179
- }
180
- });
181
- }
182
- if (Object.keys(combinedStyles).length > 0) {
183
- props += ` style={${JSON.stringify(combinedStyles)}}`;
184
- }
185
- if (classes.length > 0) {
186
- props += ` className="${classes.join(" ")}"`;
187
- }
188
- if (traits.theme?.attributes) {
189
- try {
190
- const parsedAttrs = JSON.parse(traits.theme.attributes);
191
- for (const [key, value] of Object.entries(parsedAttrs)) {
192
- props += ` ${key}="${value}"`;
193
- }
194
- } catch (e) {
195
- }
196
- }
197
- if (traits.button?.onClick || traits.form?.onSubmit) {
198
- const action = traits.button?.onClick || traits.form?.onSubmit;
199
- if (action) {
200
- const cleanAction = action.replace(/["']/g, "'");
201
- if (cleanAction.includes("navigate")) {
202
- props += ` onClick={() => ${cleanAction}}`;
203
- } else if (cleanAction.includes("submit")) {
204
- props += ` onSubmit={${cleanAction}}`;
205
- } else if (cleanAction.includes("window.open")) {
206
- props += ` onClick={() => ${cleanAction}}`;
207
- } else {
208
- props += ` onClick={() => console.log('${cleanAction}')}`;
209
- }
210
- }
211
- }
212
- if (traits.image?.src) props += ` src="${traits.image.src}"`;
213
- if (traits.image?.alt) props += ` alt="${traits.image.alt}"`;
214
- if (traits.link?.href) props += ` href="${traits.link.href}"`;
215
- if (traits.input?.placeholder) props += ` placeholder="${traits.input.placeholder}"`;
216
- if (traits.input?.type) props += ` type="${traits.input.type}"`;
217
- if (traits.input?.required) props += ` required`;
218
- if (traits.button?.type) props += ` type="${traits.button.type}"`;
219
- const childrenMarkup = (obj.children || obj.objects || []).map((child) => this.generateReactNode(child)).join("\n");
220
- const content = traits.text?.content || traits.button?.content || traits.link?.content || traits.icon?.name;
221
- let safeContent = "";
222
- if (content) {
223
- safeContent = `{\`${content.replace(/`/g, "\\`").replace(/\$/g, "\\$")}\`}`;
224
- }
225
- if (tag === "style") {
226
- const escapedStyle = (content || "").replace(/`/g, "\\`").replace(/\$/g, "\\$");
227
- return `<style dangerouslySetInnerHTML={{ __html: \`${escapedStyle}\` }} />`;
228
- }
229
- if (tag === "img" || tag === "input") {
230
- return `<${tag}${props} />`;
231
- }
232
- return `<${tag}${props}>
233
- ${safeContent}
234
- ${childrenMarkup}
235
- </${tag}>`;
236
- }
237
- // ============================================================================
238
- // HTML GENERATION
239
- // ============================================================================
240
- generateHTMLPage(name, objects, composition) {
241
- const content = objects.map((obj) => this.generateHTMLNode(obj)).join("\n ");
242
- let bgColor = "#ffffff";
243
- let color = "#000000";
244
- if (composition.environment?.properties) {
245
- const themeProp = composition.environment.properties.find((p) => p.key === "theme");
246
- const bgProp = composition.environment.properties.find((p) => p.key === "backgroundColor");
247
- if (themeProp?.value === "dark" || composition.traits?.some((t) => t.name === "theme" && t.config?.dark)) {
248
- bgColor = bgProp?.value || "#050510";
249
- color = "#ffffff";
250
- }
251
- }
252
- return `<!DOCTYPE html>
253
- <html lang="en">
254
- <head>
255
- <meta charset="UTF-8">
256
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
257
- <title>${name}</title>
258
- <script src="https://cdn.tailwindcss.com"></script>
259
- <style>
260
- body { margin: 0; padding: 0; background-color: ${bgColor}; color: ${color}; font-family: system-ui, -apple-system, sans-serif; }
261
- /* Basic resets and custom trait animations to mirror React Framer variants */
262
- .glow-btn:hover { box-shadow: 0 0 15px rgba(255,255,255,0.5); }
263
- .lift-card { transition: transform 0.2s ease, box-shadow 0.2s ease; }
264
- .lift-card:hover { transform: translateY(-4px); box-shadow: 0 10px 20px rgba(0,0,0,0.2); }
265
- </style>
266
- </head>
267
- <body>
268
- <div id="holoscript-native-root">
269
- ${content}
270
- </div>
271
- <script>
272
- function navigate(path) { window.location.href = path; }
273
- function submitNewsletter(e) { e.preventDefault(); alert('Subscribed!'); }
274
- </script>
275
- </body>
276
- </html>`;
277
- }
278
- generateHTMLNode(obj) {
279
- const node = obj;
280
- const traits = this.extractTraits(obj);
281
- const nodeType = typeof node.type === "string" ? node.type.toLowerCase() : void 0;
282
- let tag = traits.theme?.tag || traits.panel?.tag || nodeType || "div";
283
- if ([
284
- "nav",
285
- "section",
286
- "main",
287
- "footer",
288
- "form",
289
- "style",
290
- "a",
291
- "header",
292
- "h1",
293
- "h2",
294
- "h3"
295
- ].includes(tag)) ; else if (tag === "container") {
296
- tag = "div";
297
- } else if (traits.link || tag === "link") {
298
- tag = "a";
299
- } else if (traits.button || tag === "button") {
300
- tag = "button";
301
- } else if (traits.image || tag === "image") {
302
- tag = "img";
303
- } else if (traits.input || tag === "input") {
304
- tag = "input";
305
- } else if (traits.text || tag === "text") {
306
- tag = this.mapTextVariantToTag(traits.text?.variant || "body");
307
- } else {
308
- tag = "div";
309
- }
310
- const styles = this.buildStyles(traits);
311
- const classes = this.buildClasses(traits);
312
- let props = ``;
313
- if (traits.theme?.className) {
314
- classes.push(traits.theme.className);
315
- }
316
- if (traits.theme?.id) {
317
- props += ` id="${traits.theme.id}"`;
318
- }
319
- if (Object.keys(styles).length > 0 || traits.theme?.style) {
320
- let styleStr = Object.entries(styles).map(([k, v]) => `${this.camelToKebab(k)}: ${v}`).join("; ");
321
- if (traits.theme?.style) {
322
- styleStr += (styleStr ? "; " : "") + traits.theme.style;
323
- }
324
- props += ` style="${styleStr}"`;
325
- }
326
- if (classes.length > 0) {
327
- props += ` class="${classes.join(" ")}"`;
328
- }
329
- if (traits.theme?.attributes) {
330
- try {
331
- const parsedAttrs = JSON.parse(traits.theme.attributes);
332
- for (const [key, value] of Object.entries(parsedAttrs)) {
333
- props += ` ${key}="${value}"`;
334
- }
335
- } catch (e) {
336
- }
337
- }
338
- if (traits.button?.onClick) props += ` onclick="${traits.button.onClick}"`;
339
- if (traits.form?.onSubmit) props += ` onsubmit="${traits.form.onSubmit}"`;
340
- if (traits.image?.src) props += ` src="${traits.image.src}"`;
341
- if (traits.image?.alt) props += ` alt="${traits.image.alt}"`;
342
- if (traits.link?.href) props += ` href="${traits.link.href}"`;
343
- if (traits.input?.placeholder) props += ` placeholder="${traits.input.placeholder}"`;
344
- if (traits.input?.type) props += ` type="${traits.input.type}"`;
345
- if (traits.input?.required) props += ` required`;
346
- const children = node.children || node.objects || [];
347
- const childrenMarkup = children.map((child) => this.generateHTMLNode(child)).join("\n");
348
- const content = traits.text?.content || traits.button?.content || traits.link?.content || traits.icon?.name;
349
- if (tag === "img" || tag === "input") {
350
- return `<${tag}${props}>`;
351
- }
352
- return `<${tag}${props}>
353
- ${content ? content : ""}
354
- ${childrenMarkup}
355
- </${tag}>`;
356
- }
357
- // ============================================================================
358
- // UTILITIES
359
- // ============================================================================
360
- extractTraits(obj) {
361
- const map = {};
362
- const node = obj;
363
- if (!node.traits) return map;
364
- for (const t of node.traits) {
365
- map[t.name] = t.config || {};
366
- if (t.name === "tailwind" && typeof t.config === "string") {
367
- map[t.name] = { classes: t.config };
368
- }
369
- }
370
- return map;
371
- }
372
- mapTextVariantToTag(variant) {
373
- switch (variant) {
374
- case "h1":
375
- return "h1";
376
- case "h2":
377
- return "h2";
378
- case "h3":
379
- return "h3";
380
- case "subtitle":
381
- return "h4";
382
- case "caption":
383
- return "span";
384
- case "emoji":
385
- return "span";
386
- default:
387
- return "p";
388
- }
389
- }
390
- buildStyles(traits) {
391
- const styles = {};
392
- const layout = traits.layout;
393
- const theme = traits.theme;
394
- if (layout) {
395
- if (layout.flex) {
396
- styles.display = "flex";
397
- styles.flexDirection = layout.flex === "row" ? "row" : "column";
398
- }
399
- if (layout.grid) {
400
- styles.display = "grid";
401
- styles.gridTemplateColumns = `repeat(${layout.columns || 1}, minmax(0, 1fr))`;
402
- }
403
- if (layout.justify) styles.justifyContent = layout.justify;
404
- if (layout.align) styles.alignItems = layout.align;
405
- if (layout.gap) styles.gap = typeof layout.gap === "number" ? `${layout.gap}px` : layout.gap;
406
- if (layout.padding)
407
- styles.padding = typeof layout.padding === "number" ? `${layout.padding}px` : layout.padding;
408
- }
409
- if (theme) {
410
- if (theme.backgroundColor) styles.backgroundColor = theme.backgroundColor;
411
- if (theme.color) styles.color = theme.color;
412
- if (theme.padding)
413
- styles.padding = typeof theme.padding === "number" ? `${theme.padding}px` : theme.padding;
414
- if (theme.borderRadius)
415
- styles.borderRadius = typeof theme.borderRadius === "number" ? `${theme.borderRadius}px` : theme.borderRadius;
416
- if (theme.border) styles.border = theme.border;
417
- if (theme.borderTop) styles.borderTop = theme.borderTop;
418
- }
419
- if (traits.text) {
420
- if (traits.text.align) styles.textAlign = traits.text.align;
421
- if (traits.text.maxWidth)
422
- styles.maxWidth = typeof traits.text.maxWidth === "number" ? `${traits.text.maxWidth}px` : traits.text.maxWidth;
423
- if (traits.text.weight) styles.fontWeight = traits.text.weight;
424
- }
425
- return styles;
426
- }
427
- buildClasses(traits) {
428
- const classes = [];
429
- if (traits.text) {
430
- if (traits.text.variant === "h1") classes.push("text-5xl font-bold tracking-tight");
431
- if (traits.text.variant === "h2") classes.push("text-3xl font-bold");
432
- if (traits.text.variant === "h3") classes.push("text-xl font-semibold");
433
- if (traits.text.variant === "subtitle") classes.push("text-xl text-gray-400");
434
- if (traits.text.variant === "caption") classes.push("text-sm text-gray-500");
435
- if (traits.text.variant === "emoji") classes.push("text-2xl");
436
- }
437
- if (traits.button) {
438
- classes.push("px-4 py-2 rounded-lg font-medium transition-all");
439
- if (traits.button.variant === "primary")
440
- classes.push("bg-blue-600 hover:bg-blue-700 text-white");
441
- if (traits.button.variant === "outline")
442
- classes.push("border border-gray-600 hover:bg-gray-800 text-white");
443
- if (traits.button.variant === "ghost")
444
- classes.push("hover:bg-gray-800 text-gray-300 hover:text-white");
445
- if (traits.button.variant === "glow")
446
- classes.push("bg-indigo-600 text-white glow-btn hover:bg-indigo-500");
447
- if (traits.button.size === "lg") classes.push("px-6 py-3 text-lg");
448
- if (traits.button.size === "sm") classes.push("px-3 py-1 text-sm");
449
- }
450
- if (traits.card) {
451
- if (traits.card.shadow === "md") classes.push("shadow-md");
452
- if (traits.card.shadow === "lg") classes.push("shadow-lg");
453
- if (traits.card.hover === "glow") classes.push("lift-card");
454
- }
455
- if (traits.input) {
456
- classes.push(
457
- "px-4 py-2 rounded-lg border border-gray-700 bg-gray-900 text-white focus:ring-2 focus:ring-indigo-500 outline-none"
458
- );
459
- }
460
- if (traits.tailwind?.classes) {
461
- classes.push(traits.tailwind.classes);
462
- }
463
- return classes;
464
- }
465
- camelToKebab(str) {
466
- return str.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
467
- }
468
- };
469
- }
470
- });
1
+ import { init_R3FCompiler, MATERIAL_PRESETS } from './chunk-T36DDXSF.js';
2
+ import { init_DomainBlockCompilerMixin, compileDomainBlocks, inputToUSDA, compileInputBlock, navigationToUSDA, compileNavigationBlock, renderingToUSDA, compileRenderingBlock, proceduralToUSDA, compileProceduralBlock, web3ToUSDA, compileWeb3Block, architectureToUSDA, compileArchitectureBlock, musicToUSDA, compileMusicBlock, educationToUSDA, compileEducationBlock, datavizToUSDA, compileDataVizBlock, iotToUSDA, compileIoTBlock, compileRoboticsBlock, roboticsToUSDA, compileHealthcareBlock, healthcareToUSDA, compilePaymentBlock, paymentToUSDA, compileNarrativeBlock, narrativeToUSDA, compileWeatherBlock, weatherToUSD, compileAudioSourceBlock, audioSourceToUSD, compilePostProcessingBlock, postProcessingToUSD, compileParticleBlock, particlesToUSD, compilePhysicsBlock, compileMaterialBlock, materialToUSD } from './chunk-YQK5JNFK.js';
3
+ import { init_CompilerBase, CompilerBase } from './chunk-6XSERL6L.js';
4
+ import { __export, __esm } from './chunk-2CWOLHTE.js';
5
+ import { ANSCapabilityPath } from '@holoscript/platform';
471
6
 
472
7
  // src/compiler/A2AAgentCardCompiler.ts
473
8
  var A2AAgentCardCompiler_exports = {};
@@ -479,7 +14,6 @@ var A2AAgentCardCompiler, A2AAgentCardCompiler_default;
479
14
  var init_A2AAgentCardCompiler = __esm({
480
15
  "src/compiler/A2AAgentCardCompiler.ts"() {
481
16
  init_CompilerBase();
482
- init_ANSNamespace();
483
17
  A2AAgentCardCompiler = class extends CompilerBase {
484
18
  constructor(options = {}) {
485
19
  super();
@@ -633,9 +167,7 @@ var init_A2AAgentCardCompiler = __esm({
633
167
  }
634
168
  }
635
169
  if (examples.length === 0) {
636
- examples.push(
637
- `Create a ${this.escapeStringValue(template.name, "JSON")} instance`
638
- );
170
+ examples.push(`Create a ${this.escapeStringValue(template.name, "JSON")} instance`);
639
171
  }
640
172
  return {
641
173
  id: this.sanitizeId(template.name),
@@ -663,9 +195,7 @@ var init_A2AAgentCardCompiler = __esm({
663
195
  }
664
196
  const examples = [];
665
197
  if (objTraitNames.includes("sensor")) {
666
- examples.push(
667
- `Read sensor data from ${this.escapeStringValue(obj.name, "JSON")}`
668
- );
198
+ examples.push(`Read sensor data from ${this.escapeStringValue(obj.name, "JSON")}`);
669
199
  }
670
200
  if (objTraitNames.includes("networked")) {
671
201
  examples.push(
@@ -943,9 +473,7 @@ var init_A2AAgentCardCompiler = __esm({
943
473
  */
944
474
  generateDescription(composition) {
945
475
  const parts = [];
946
- parts.push(
947
- `HoloScript agent "${this.escapeStringValue(composition.name, "JSON")}"`
948
- );
476
+ parts.push(`HoloScript agent "${this.escapeStringValue(composition.name, "JSON")}"`);
949
477
  const features = [];
950
478
  if (composition.templates?.length) {
951
479
  features.push(`${composition.templates.length} template(s)`);
@@ -1564,7 +1092,6 @@ var NIRCompiler, NIRCompiler_default;
1564
1092
  var init_NIRCompiler = __esm({
1565
1093
  "src/compiler/NIRCompiler.ts"() {
1566
1094
  init_CompilerBase();
1567
- init_ANSNamespace();
1568
1095
  init_NIRTraitMap();
1569
1096
  NIRCompiler = class extends CompilerBase {
1570
1097
  constructor(options = {}) {
@@ -2170,7 +1697,11 @@ function parsePipelineContent(name, content, errors) {
2170
1697
  for (const block of extractBlock(content, "filter")) {
2171
1698
  const p = parseProperties(block.content);
2172
1699
  if (!p.where) {
2173
- errors.push({ message: `Filter "${block.name}" missing 'where' clause`, line: block.startLine, block: block.name });
1700
+ errors.push({
1701
+ message: `Filter "${block.name}" missing 'where' clause`,
1702
+ line: block.startLine,
1703
+ block: block.name
1704
+ });
2174
1705
  }
2175
1706
  filters.push({
2176
1707
  kind: "filter",
@@ -5307,14 +4838,10 @@ function selectModality(platform, options = {}) {
5307
4838
  reasoning.push(`Embodiment forced to ${embodiment} by caller`);
5308
4839
  } else if (platform in PLATFORM_EMBODIMENT_OVERRIDES) {
5309
4840
  embodiment = PLATFORM_EMBODIMENT_OVERRIDES[platform];
5310
- reasoning.push(
5311
- `Embodiment ${embodiment} from platform-specific override for ${platform}`
5312
- );
4841
+ reasoning.push(`Embodiment ${embodiment} from platform-specific override for ${platform}`);
5313
4842
  } else {
5314
4843
  embodiment = CATEGORY_DEFAULT_EMBODIMENT[category];
5315
- reasoning.push(
5316
- `Embodiment ${embodiment} from category default for ${category}`
5317
- );
4844
+ reasoning.push(`Embodiment ${embodiment} from category default for ${category}`);
5318
4845
  }
5319
4846
  let exportTarget;
5320
4847
  let fallbackTarget;
@@ -5325,16 +4852,12 @@ function selectModality(platform, options = {}) {
5325
4852
  } else if (platform in PLATFORM_TARGET_OVERRIDES) {
5326
4853
  exportTarget = PLATFORM_TARGET_OVERRIDES[platform];
5327
4854
  fallbackTarget = EMBODIMENT_TO_TARGET[embodiment]?.fallback ?? null;
5328
- reasoning.push(
5329
- `ExportTarget ${exportTarget} from platform-specific override for ${platform}`
5330
- );
4855
+ reasoning.push(`ExportTarget ${exportTarget} from platform-specific override for ${platform}`);
5331
4856
  } else {
5332
4857
  const mapping = EMBODIMENT_TO_TARGET[embodiment];
5333
4858
  exportTarget = mapping.primary;
5334
4859
  fallbackTarget = mapping.fallback;
5335
- reasoning.push(
5336
- `ExportTarget ${exportTarget} from embodiment mapping for ${embodiment}`
5337
- );
4860
+ reasoning.push(`ExportTarget ${exportTarget} from embodiment mapping for ${embodiment}`);
5338
4861
  }
5339
4862
  const canRenderSpatial = capabilities.gpu3D && capabilities.frameBudgetMs <= 16.6;
5340
4863
  reasoning.push(
@@ -5376,8 +4899,10 @@ function bestCategoryForTraits(requiredCapabilities) {
5376
4899
  const canSupport = platforms.some((platform) => {
5377
4900
  const caps = PLATFORM_CAPABILITIES[platform];
5378
4901
  return Object.entries(requiredCapabilities).every(([key, required]) => {
5379
- if (typeof required === "boolean") return !required || caps[key] === true;
5380
- if (typeof required === "number") return caps[key] <= required;
4902
+ if (typeof required === "boolean")
4903
+ return !required || caps[key] === true;
4904
+ if (typeof required === "number")
4905
+ return caps[key] <= required;
5381
4906
  return true;
5382
4907
  });
5383
4908
  });
@@ -5543,7 +5068,9 @@ function emitSource(source) {
5543
5068
  }
5544
5069
  function emitFieldMappingTransform(t) {
5545
5070
  const mappings = t.mappings || [];
5546
- const mapExpr = mappings.map((m) => `${json(m.to)}: applyTransforms(item[${json(m.from)}], ${json(m.transforms || [])})`).join(",\n ");
5071
+ const mapExpr = mappings.map(
5072
+ (m) => `${json(m.to)}: applyTransforms(item[${json(m.from)}], ${json(m.transforms || [])})`
5073
+ ).join(",\n ");
5547
5074
  return `data = data.map((item) => ({
5548
5075
  ${mapExpr}
5549
5076
  }));`;
@@ -5600,7 +5127,9 @@ function emitPythonSource(source) {
5600
5127
  }
5601
5128
  function emitPythonFieldMappingTransform(t) {
5602
5129
  const mappings = t.mappings || [];
5603
- const mappingLines = mappings.map((m) => `${json(m.to)}: apply_transforms(item.get(${json(m.from)}), ${json(m.transforms || [])}),`).join("\n ");
5130
+ const mappingLines = mappings.map(
5131
+ (m) => `${json(m.to)}: apply_transforms(item.get(${json(m.from)}), ${json(m.transforms || [])}),`
5132
+ ).join("\n ");
5604
5133
  return `data = [
5605
5134
  {
5606
5135
  ${mappingLines}
@@ -5940,116 +5469,6 @@ function compilePipelineSource(source, options = {}) {
5940
5469
  return compilePipelineSourceToNode(source, options.node);
5941
5470
  }
5942
5471
 
5943
- // src/compiler/NextJSCompiler.ts
5944
- init_CompilerBase();
5945
- init_Native2DCompiler();
5946
- function findTrait(composition, traitName) {
5947
- const traits = composition.traits;
5948
- if (!traits) return null;
5949
- const found = traits.find((t) => t.name === traitName);
5950
- return found?.config || null;
5951
- }
5952
- var NextJSCompiler = class extends CompilerBase {
5953
- constructor(options = {}) {
5954
- super();
5955
- this.options = options;
5956
- this.compilerName = "NextJSCompiler";
5957
- }
5958
- /**
5959
- * Compile HoloComposition AST to Next.js App Router Code
5960
- *
5961
- * @param composition - HoloScript AST
5962
- * @param agentToken - JWT or UCAN token proving agent identity
5963
- * @param outputPath - Optional output file path for scope validation
5964
- * @param sceneGraph - Optional pre-computed SSG
5965
- */
5966
- async compile(composition, agentToken, outputPath, _sceneGraph) {
5967
- this.validateCompilerAccess(agentToken, outputPath);
5968
- return this.buildNextRoute(composition);
5969
- }
5970
- validateCompilerAccess(agentToken, outputPath) {
5971
- if (typeof agentToken === "object" && agentToken !== null) {
5972
- this.validateCapabilityAccess(agentToken, outputPath);
5973
- } else {
5974
- this.validateASTAccess(agentToken);
5975
- this.validateCodeGeneration(agentToken);
5976
- if (outputPath) {
5977
- this.validateOutputPath(agentToken, outputPath);
5978
- }
5979
- this.validateSpatialZoneAccess(agentToken);
5980
- }
5981
- }
5982
- buildNextRoute(composition) {
5983
- const compiler = new Native2DCompiler();
5984
- const pageTrait = findTrait(composition, "page");
5985
- const metaTrait = findTrait(composition, "metadata");
5986
- const route = pageTrait?.route || `/${composition.name.toLowerCase().replace(/\s+/g, "-")}`;
5987
- const isClient = pageTrait?.client !== false;
5988
- const slotMap = this.options.slots || {};
5989
- if (pageTrait?.redirect) {
5990
- const redirectUrl = pageTrait.redirect;
5991
- const lines2 = [
5992
- `// @generated by HoloScript NextJSCompiler \u2014 DO NOT EDIT`,
5993
- `import { redirect } from 'next/navigation';`,
5994
- ``,
5995
- `export default function RedirectPage() {`,
5996
- ` redirect(${JSON.stringify(redirectUrl)});`,
5997
- `}`
5998
- ];
5999
- if (metaTrait) {
6000
- const metaEntries = [];
6001
- if (metaTrait.title) metaEntries.push(` title: ${JSON.stringify(metaTrait.title)},`);
6002
- if (metaTrait.description) metaEntries.push(` description: ${JSON.stringify(metaTrait.description)},`);
6003
- lines2.push("");
6004
- lines2.push(`export const metadata = {`);
6005
- lines2.push(metaEntries.join("\n"));
6006
- lines2.push(`};`);
6007
- }
6008
- const routePath2 = route.replace(/^\//, "") || "index";
6009
- return {
6010
- path: `${routePath2}/page.tsx`,
6011
- code: lines2.join("\n")
6012
- };
6013
- }
6014
- const compilerOptions = {
6015
- format: "react",
6016
- useUIComponents: true,
6017
- slots: slotMap
6018
- };
6019
- const elements = composition.ui?.elements || composition.objects || [];
6020
- const componentCode = compiler.generateReactComponent(
6021
- composition.name,
6022
- elements,
6023
- composition,
6024
- compilerOptions
6025
- );
6026
- const pageSafeComponentCode = componentCode.replace(
6027
- /export\s+function\s+([A-Za-z0-9_]+)\s*\(/,
6028
- "function $1("
6029
- );
6030
- const lines = [];
6031
- if (isClient) {
6032
- lines.push("'use client';");
6033
- lines.push("");
6034
- }
6035
- lines.push(pageSafeComponentCode);
6036
- if (metaTrait && !isClient) {
6037
- const metaEntries = [];
6038
- if (metaTrait.title) metaEntries.push(` title: ${JSON.stringify(metaTrait.title)},`);
6039
- if (metaTrait.description) metaEntries.push(` description: ${JSON.stringify(metaTrait.description)},`);
6040
- lines.push("");
6041
- lines.push(`export const metadata = {`);
6042
- lines.push(metaEntries.join("\n"));
6043
- lines.push(`};`);
6044
- }
6045
- const routePath = route.replace(/^\//, "") || "index";
6046
- return {
6047
- path: `${routePath}/page.tsx`,
6048
- code: lines.join("\n")
6049
- };
6050
- }
6051
- };
6052
-
6053
- export { A2AAgentCardCompiler, A2AAgentCardCompiler_exports, ALL_PLATFORMS, BUILTIN_RESOURCES, CAPABILITY_HIERARCHY, CATEGORY_DEFAULT_EMBODIMENT, CompilerBridge, CrossRealityTraitRegistry, DEFAULT_EMBODIMENT, EFFECT_TO_CAPABILITY, EffectChecker, EffectRow, HANDOFF_PATH_RULES, LinearTypeChecker, MVC_BUDGET_CONSTRAINTS, NIRCompiler, NIRCompiler_exports, Native2DCompiler, Native2DCompiler_exports, NextJSCompiler, PLATFORM_BUDGETS, PLATFORM_CAPABILITIES, PLATFORM_CATEGORIES, PLATFORM_EMBODIMENT_OVERRIDES, ResourceBudgetAnalyzer, TRAIT_EFFECTS, TRAIT_RESOURCE_COSTS, TRAIT_RESOURCE_MAP, TRUST_LEVEL_CAPABILITIES, USDZPipeline, agentBudgetFor, bestCategoryForTraits, buildSafetyReport, checkCapabilities, compilePipelineSource, compilePipelineSourceToNode, compilePipelineSourceToPython, compilePipelineToNode, compilePipelineToPython, createCrossRealityTraitRegistry, createEffectChecker, dangerLevel, deriveRequirements, embodimentFor, expandCapabilities, formatReport, generateCertificate, getCompilerBridge, getCrossRealityTraitRegistry, hasCapability, inferFromBuiltins, inferFromTraits, init_A2AAgentCardCompiler, init_NIRCompiler, init_Native2DCompiler, isPipelineSource, isSafeTraitSet, knownBuiltins, knownTraits, matchesPlatform, parsePipeline, platformCategory, quickSafetyCheck, resetCrossRealityTraitRegistry, resolvePlatforms, runSafetyPass, selectBlock, selectModality, selectModalityForAll };
6054
- //# sourceMappingURL=chunk-BO2OKHIY.js.map
6055
- //# sourceMappingURL=chunk-BO2OKHIY.js.map
5472
+ export { A2AAgentCardCompiler, A2AAgentCardCompiler_exports, ALL_PLATFORMS, BUILTIN_RESOURCES, CAPABILITY_HIERARCHY, CATEGORY_DEFAULT_EMBODIMENT, CompilerBridge, CrossRealityTraitRegistry, DEFAULT_EMBODIMENT, EFFECT_TO_CAPABILITY, EffectChecker, EffectRow, HANDOFF_PATH_RULES, LinearTypeChecker, MVC_BUDGET_CONSTRAINTS, NIRCompiler, NIRCompiler_exports, PLATFORM_BUDGETS, PLATFORM_CAPABILITIES, PLATFORM_CATEGORIES, PLATFORM_EMBODIMENT_OVERRIDES, ResourceBudgetAnalyzer, TRAIT_EFFECTS, TRAIT_RESOURCE_COSTS, TRAIT_RESOURCE_MAP, TRUST_LEVEL_CAPABILITIES, USDZPipeline, agentBudgetFor, bestCategoryForTraits, buildSafetyReport, checkCapabilities, compilePipelineSource, compilePipelineSourceToNode, compilePipelineSourceToPython, compilePipelineToNode, compilePipelineToPython, createCrossRealityTraitRegistry, createEffectChecker, dangerLevel, deriveRequirements, embodimentFor, expandCapabilities, formatReport, generateCertificate, getCompilerBridge, getCrossRealityTraitRegistry, hasCapability, inferFromBuiltins, inferFromTraits, init_A2AAgentCardCompiler, init_NIRCompiler, isPipelineSource, isSafeTraitSet, knownBuiltins, knownTraits, matchesPlatform, parsePipeline, platformCategory, quickSafetyCheck, resetCrossRealityTraitRegistry, resolvePlatforms, runSafetyPass, selectBlock, selectModality, selectModalityForAll };
5473
+ //# sourceMappingURL=chunk-T4NKMBDL.js.map
5474
+ //# sourceMappingURL=chunk-T4NKMBDL.js.map