@holoscript/core 8.0.0 → 8.0.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 (129) hide show
  1. package/README.md +2 -2
  2. package/dist/{GLTFPipeline-M7WSSJED.cjs → GLTFPipeline-76QTLF4Z.cjs} +10 -9
  3. package/dist/{GLTFPipeline-276GE64O.js → GLTFPipeline-ES5YMBGT.js} +6 -5
  4. package/dist/HoloScriptRuntime-2DDYOPOR.js +10 -0
  5. package/dist/{HoloScriptRuntime-SXEAEU2N.cjs → HoloScriptRuntime-ZGRR5EB3.cjs} +5 -5
  6. package/dist/{chunk-JJBE3TIH.cjs → chunk-2IWC4FP7.cjs} +6 -6
  7. package/dist/{chunk-S4W6Z2MN.js → chunk-2X7NGX3M.js} +3 -3
  8. package/dist/{chunk-NGKREZ36.js → chunk-3OYVN53V.js} +505 -5
  9. package/dist/{chunk-GQT4TYKY.cjs → chunk-3OZACAFQ.cjs} +44 -19
  10. package/dist/{chunk-T2QCTZMO.js → chunk-4SDKXQ4C.js} +3 -3
  11. package/dist/{chunk-253GBQZY.cjs → chunk-5H2G27PK.cjs} +35 -35
  12. package/dist/{chunk-C2A5DUMF.cjs → chunk-5NWINHR5.cjs} +35 -35
  13. package/dist/{chunk-D54CNIAJ.cjs → chunk-7H33U5SM.cjs} +2 -2
  14. package/dist/{chunk-CXFDRBQU.cjs → chunk-7M3PNU2M.cjs} +7 -7
  15. package/dist/{chunk-WJIHFLMJ.js → chunk-ADADVMXY.js} +2 -2
  16. package/dist/{chunk-NHWSN2SD.cjs → chunk-AVJHHUC5.cjs} +17 -17
  17. package/dist/{chunk-JCLBKPMX.js → chunk-BOVPWH4H.js} +48 -4
  18. package/dist/{chunk-ZZEI7MV4.js → chunk-CCATWPXM.js} +3 -3
  19. package/dist/{chunk-NBMHU6SW.js → chunk-CMT5NMMS.js} +3 -3
  20. package/dist/{chunk-HINXWAOD.cjs → chunk-CR4FMIWL.cjs} +11 -11
  21. package/dist/{chunk-IZM5VQZD.js → chunk-D3STJ56J.js} +3 -3
  22. package/dist/{chunk-EUDQTK7N.cjs → chunk-DAKRKDZV.cjs} +27 -38
  23. package/dist/{chunk-ZBQXLH2L.js → chunk-DHO2YRIM.js} +3 -3
  24. package/dist/{chunk-RVBHAXFG.js → chunk-DXWOTOUK.js} +16 -11
  25. package/dist/{chunk-F43YAA34.js → chunk-E47Z63DF.js} +3 -3
  26. package/dist/{chunk-62FBK3B7.js → chunk-FFAOS5HQ.js} +4 -4
  27. package/dist/{chunk-UM6C3CGK.js → chunk-FS7BFHFN.js} +28 -3
  28. package/dist/{chunk-SJBGLS25.cjs → chunk-FXIO6GHT.cjs} +5 -5
  29. package/dist/{chunk-XUUVDHIF.cjs → chunk-HKEXJUWS.cjs} +48 -3
  30. package/dist/{chunk-NXZFOPVD.cjs → chunk-HNDK4IQU.cjs} +16 -16
  31. package/dist/{chunk-SMIWS6DE.cjs → chunk-IELX2OKI.js} +118 -7
  32. package/dist/{chunk-KH4CNH66.cjs → chunk-IMGDUSTT.cjs} +4 -4
  33. package/dist/{chunk-LICPB5HZ.cjs → chunk-IUDGEUDO.cjs} +10 -10
  34. package/dist/{chunk-73FELZVJ.cjs → chunk-IWC5DM2M.cjs} +11 -11
  35. package/dist/{chunk-PHVRG4I2.js → chunk-J7XZV333.js} +3 -3
  36. package/dist/{chunk-K4VVR7CN.cjs → chunk-JBNDTXXV.cjs} +15 -15
  37. package/dist/{chunk-3NFFOWGG.js → chunk-KFIXE2MB.js} +14 -5
  38. package/dist/{chunk-B4TFTDG4.js → chunk-LCEXRE5Z.js} +3 -3
  39. package/dist/{chunk-IVSZDECV.js → chunk-LHAXPADA.js} +3 -3
  40. package/dist/{chunk-7CUEMLDZ.cjs → chunk-LKBTCABN.cjs} +540 -38
  41. package/dist/{chunk-AYBXB26F.js → chunk-LOGP3JWH.js} +5 -5
  42. package/dist/{chunk-KVRSTFNH.cjs → chunk-NCWCUZNS.cjs} +8 -8
  43. package/dist/{chunk-NV4VMVXU.js → chunk-NNFA2C3Y.js} +3 -3
  44. package/dist/{chunk-HZSPDCXV.cjs → chunk-O7WLJ53D.cjs} +3 -3
  45. package/dist/{chunk-MGE5Z4GS.js → chunk-OH2FAIVU.js} +3 -3
  46. package/dist/{chunk-UMABK6SI.js → chunk-PY37LNDP.js} +3 -3
  47. package/dist/{chunk-23J755AR.js → chunk-QD32ADK6.js} +3 -3
  48. package/dist/chunk-QRPRIJ2W.js +1525 -0
  49. package/dist/{chunk-HZTDET3N.js → chunk-R24NNAEG.js} +3 -3
  50. package/dist/{chunk-W7VDOASB.cjs → chunk-RMTPN3G4.cjs} +5 -5
  51. package/dist/{chunk-6DPSFNJB.cjs → chunk-ROHLEP2W.cjs} +16 -16
  52. package/dist/{chunk-3HYYMEXI.cjs → chunk-SMRVK6BI.cjs} +17 -12
  53. package/dist/{chunk-25IQCHTO.cjs → chunk-TWUXUCEW.cjs} +35 -35
  54. package/dist/{chunk-KEFNV2WM.cjs → chunk-U7IUS5HJ.cjs} +13 -13
  55. package/dist/{chunk-3AO425MZ.cjs → chunk-UFZZ7TSN.cjs} +17 -17
  56. package/dist/chunk-UPXIY52O.cjs +1562 -0
  57. package/dist/{chunk-BE4UJCQT.js → chunk-UWJHCOH2.js} +3 -3
  58. package/dist/{chunk-7HIASF7S.cjs → chunk-XB274MW5.cjs} +10 -10
  59. package/dist/{chunk-RARB3MBR.js → chunk-YDPEHCCI.cjs} +127 -3
  60. package/dist/{chunk-KJLB4OPV.js → chunk-YN2YWTXW.js} +3 -3
  61. package/dist/{chunk-IPWSXCCN.js → chunk-YVD3CSO3.js} +3 -3
  62. package/dist/{chunk-OR4Q2BGL.cjs → chunk-YWOBW2PV.cjs} +15 -15
  63. package/dist/{chunk-JX7YL6ZE.js → chunk-ZPYP4RBA.js} +4 -4
  64. package/dist/compiler/android-xr.cjs +5 -5
  65. package/dist/compiler/android-xr.js +3 -3
  66. package/dist/compiler/babylon.cjs +4 -4
  67. package/dist/compiler/babylon.js +3 -3
  68. package/dist/compiler/business-quest.cjs +9 -9
  69. package/dist/compiler/business-quest.js +1 -1
  70. package/dist/compiler/domain-block-utils.cjs +154 -150
  71. package/dist/compiler/domain-block-utils.js +2 -2
  72. package/dist/compiler/gltf-pipeline.cjs +8 -8
  73. package/dist/compiler/gltf-pipeline.js +1 -1
  74. package/dist/compiler/godot.cjs +4 -4
  75. package/dist/compiler/godot.js +3 -3
  76. package/dist/compiler/index.cjs +129 -581
  77. package/dist/compiler/index.d.ts +12 -0
  78. package/dist/compiler/index.js +42 -498
  79. package/dist/compiler/multi-layer.cjs +5 -5
  80. package/dist/compiler/multi-layer.js +4 -4
  81. package/dist/compiler/nodetoy.d.ts +69 -0
  82. package/dist/compiler/openxr.cjs +4 -4
  83. package/dist/compiler/openxr.js +3 -3
  84. package/dist/compiler/playcanvas.cjs +4 -4
  85. package/dist/compiler/playcanvas.js +3 -3
  86. package/dist/compiler/r3f.cjs +9 -8
  87. package/dist/compiler/r3f.js +4 -3
  88. package/dist/compiler/sdf.cjs +5 -5
  89. package/dist/compiler/sdf.js +3 -3
  90. package/dist/compiler/unity.cjs +4 -4
  91. package/dist/compiler/unity.js +3 -3
  92. package/dist/compiler/unreal.cjs +5 -5
  93. package/dist/compiler/unreal.js +3 -3
  94. package/dist/compiler/urdf.cjs +12 -12
  95. package/dist/compiler/urdf.js +3 -3
  96. package/dist/compiler/usd-physics.cjs +5 -5
  97. package/dist/compiler/usd-physics.js +2 -2
  98. package/dist/compiler/visionos.cjs +4 -4
  99. package/dist/compiler/visionos.js +3 -3
  100. package/dist/compiler/vrchat.cjs +5 -5
  101. package/dist/compiler/vrchat.js +3 -3
  102. package/dist/compiler/vrr.cjs +5 -5
  103. package/dist/compiler/vrr.js +3 -3
  104. package/dist/compiler/wasm.cjs +8 -8
  105. package/dist/compiler/wasm.js +3 -3
  106. package/dist/compiler/webgpu.cjs +4 -4
  107. package/dist/compiler/webgpu.js +3 -3
  108. package/dist/debugger.cjs +5 -5
  109. package/dist/debugger.js +3 -3
  110. package/dist/dist-ACXG6IH5.cjs +3113 -0
  111. package/dist/dist-VD4L6V7Q.js +3076 -0
  112. package/dist/index.cjs +1894 -559
  113. package/dist/index.d.ts +2 -0
  114. package/dist/index.js +1448 -113
  115. package/dist/reconstruction/index.cjs +31 -31
  116. package/dist/reconstruction/index.js +2 -2
  117. package/dist/runtime.cjs +150 -293
  118. package/dist/runtime.js +82 -23
  119. package/dist/src-4ROC227P.cjs +2094 -0
  120. package/dist/src-HCCCSYP7.js +2073 -0
  121. package/dist/traits/botanical-lotus.cjs +162 -10
  122. package/dist/traits/botanical-lotus.d.ts +330 -0
  123. package/dist/traits/botanical-lotus.js +4 -1
  124. package/dist/traits/index.cjs +610 -455
  125. package/dist/traits/index.js +9 -5
  126. package/package.json +23 -23
  127. package/dist/HoloScriptRuntime-3URVTKPJ.js +0 -10
  128. package/dist/chunk-VECQYRXL.js +0 -474
  129. package/dist/chunk-WDT3JTGM.cjs +0 -483
@@ -1,10 +1,11 @@
1
- import { init_R3FCompiler, MATERIAL_PRESETS } from './chunk-UM6C3CGK.js';
1
+ import { init_R3FCompiler, MATERIAL_PRESETS } from './chunk-FS7BFHFN.js';
2
2
  import { init_ProvenanceSemiring, ProvenanceSemiring } from './chunk-TJHVSBP2.js';
3
3
  import { init_TraitCompositor, TraitCompositor } from './chunk-4C57PR42.js';
4
4
  import { init_PlatformConditional, platformCategory, PLATFORM_CAPABILITIES, PLATFORM_CATEGORIES } from './chunk-GZG4KA4E.js';
5
- 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-JCLBKPMX.js';
5
+ 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-BOVPWH4H.js';
6
6
  import { init_CompilerBase, CompilerBase } from './chunk-QPSKHBJP.js';
7
7
  import { parsePipeline } from './chunk-J32ZJZJH.js';
8
+ import { init_safeJsonParse, readJson } from './chunk-VVKVQZI6.js';
8
9
  import { __export, __esm } from './chunk-OL46QLBJ.js';
9
10
  import { ANSCapabilityPath } from '@holoscript/core-types/ans';
10
11
 
@@ -642,6 +643,505 @@ var init_ThreeJSCompiler = __esm({
642
643
  }
643
644
  });
644
645
 
646
+ // src/compiler/Native2DCompiler.ts
647
+ var Native2DCompiler_exports = {};
648
+ __export(Native2DCompiler_exports, {
649
+ Native2DCompiler: () => Native2DCompiler
650
+ });
651
+ var Native2DCompiler;
652
+ var init_Native2DCompiler = __esm({
653
+ "src/compiler/Native2DCompiler.ts"() {
654
+ init_CompilerBase();
655
+ init_safeJsonParse();
656
+ Native2DCompiler = class extends CompilerBase {
657
+ constructor() {
658
+ super(...arguments);
659
+ this.compilerName = "Native2DCompiler";
660
+ // ============================================================================
661
+ // REACT GENERATION
662
+ // ============================================================================
663
+ /** Collected during node traversal — used to generate imports and hooks */
664
+ this._slotImports = /* @__PURE__ */ new Map();
665
+ this._uiImports = /* @__PURE__ */ new Set();
666
+ this._stateFields = /* @__PURE__ */ new Map();
667
+ this._fetchCalls = [];
668
+ this._options = {};
669
+ }
670
+ // @ts-expect-error During migration
671
+ compile(composition, agentToken, outputPath, options) {
672
+ this.validateCompilerAccess(agentToken, outputPath);
673
+ const isReact = options?.format === "react";
674
+ const elements = composition.ui?.elements || composition.objects || [];
675
+ if (isReact) {
676
+ const code2 = this.generateReactComponent(composition.name, elements, composition, options);
677
+ return this.withTripleOutputIfRequested(composition, code2, options);
678
+ }
679
+ const code = this.generateHTMLPage(composition.name, elements, composition);
680
+ return this.withTripleOutputIfRequested(composition, code, options);
681
+ }
682
+ generateReactComponent(name, objects, composition, options) {
683
+ this._slotImports.clear();
684
+ this._uiImports.clear();
685
+ this._stateFields.clear();
686
+ this._fetchCalls = [];
687
+ this._options = options || {};
688
+ const safeName = name.replace(/[^a-zA-Z0-9]/g, "");
689
+ if (composition?.state?.properties) {
690
+ for (const prop of composition.state.properties) {
691
+ this._stateFields.set(prop.key, prop.value ?? null);
692
+ }
693
+ }
694
+ const jsx = objects.map((obj) => this.generateReactNode(obj)).join("\n ");
695
+ const imports = [];
696
+ const reactImports = /* @__PURE__ */ new Set();
697
+ if (this._stateFields.size > 0) reactImports.add("useState");
698
+ if (this._fetchCalls.length > 0) reactImports.add("useEffect");
699
+ imports.push(
700
+ reactImports.size > 0 ? `import React, { ${[...reactImports].join(", ")} } from 'react';` : `import React from 'react';`
701
+ );
702
+ if (this._uiImports.size > 0) {
703
+ imports.push(`import { ${[...this._uiImports].join(", ")} } from '@holoscript/ui';`);
704
+ }
705
+ for (const [, slot] of this._slotImports) {
706
+ imports.push(`import { ${slot.component} } from '${slot.importPath}';`);
707
+ }
708
+ const stateHooks = [];
709
+ for (const [key, value] of this._stateFields) {
710
+ const capitalKey = key.charAt(0).toUpperCase() + key.slice(1);
711
+ const initValue = JSON.stringify(value);
712
+ stateHooks.push(
713
+ ` const [${key}, set${capitalKey}] = useState(${initValue === void 0 ? "null" : initValue});`
714
+ );
715
+ }
716
+ const fetchEffects = [];
717
+ for (const f of this._fetchCalls) {
718
+ fetchEffects.push(` useEffect(() => {
719
+ fetch(\`${f.endpoint}\`${f.method !== "GET" ? `, { method: '${f.method}' }` : ""})
720
+ .then(r => r.json())
721
+ .then(set${f.name.charAt(0).toUpperCase() + f.name.slice(1)})
722
+ .catch(console.error);
723
+ }, []);`);
724
+ }
725
+ return `${imports.join("\n")}
726
+
727
+ // @generated by HoloScript Native2DCompiler \u2014 DO NOT EDIT
728
+ export function ${safeName}Component() {
729
+ ${stateHooks.join("\n")}
730
+ ${fetchEffects.join("\n")}
731
+
732
+ return (
733
+ <div className="holoscript-2d-root w-full h-full">
734
+ ${jsx}
735
+ </div>
736
+ );
737
+ }
738
+
739
+ export default ${safeName}Component;
740
+ `;
741
+ }
742
+ generateReactNode(obj) {
743
+ const traits = this.extractTraits(obj);
744
+ if (traits.slot) {
745
+ const slotName = traits.slot.name || obj.name || "Slot";
746
+ const configuredSlot = this._options.slots?.[String(slotName)];
747
+ const component = traits.slot.component || configuredSlot?.component || slotName;
748
+ const importPath = traits.slot.import || configuredSlot?.importPath || `@/components/${component}`;
749
+ this._slotImports.set(slotName, { component, importPath });
750
+ const propsStr = traits.slot.props ? ` {...${JSON.stringify(traits.slot.props)}}` : "";
751
+ return `<div data-holo-slot="${slotName}">
752
+ <${component}${propsStr} />
753
+ </div>`;
754
+ }
755
+ if (traits.fetch) {
756
+ const name = traits.fetch.into || "data";
757
+ const endpoint = traits.fetch.endpoint || "/api/data";
758
+ const method = traits.fetch.method || "GET";
759
+ this._fetchCalls.push({ name, endpoint, method });
760
+ if (!this._stateFields.has(name)) {
761
+ this._stateFields.set(name, null);
762
+ }
763
+ }
764
+ let tag = traits.theme?.tag || traits.panel?.tag || (typeof obj.type === "string" ? obj.type.toLowerCase() : void 0) || "div";
765
+ if ([
766
+ "nav",
767
+ "section",
768
+ "main",
769
+ "footer",
770
+ "form",
771
+ "style",
772
+ "a",
773
+ "header",
774
+ "h1",
775
+ "h2",
776
+ "h3"
777
+ ].includes(tag)) ; else if (tag === "container") {
778
+ tag = "div";
779
+ } else if (traits.link || tag === "link") {
780
+ tag = "a";
781
+ } else if (traits.button || tag === "button") {
782
+ tag = "button";
783
+ } else if (traits.image || tag === "image") {
784
+ tag = "img";
785
+ } else if (traits.input || tag === "input") {
786
+ tag = "input";
787
+ } else if (traits.text || tag === "text") {
788
+ tag = this.mapTextVariantToTag(traits.text?.variant || "body");
789
+ } else {
790
+ tag = "div";
791
+ }
792
+ const styles = this.buildStyles(traits);
793
+ const classes = this.buildClasses(traits);
794
+ let props = ``;
795
+ if (traits.theme?.className) {
796
+ classes.push(traits.theme.className);
797
+ }
798
+ if (traits.theme?.id) {
799
+ props += ` id="${traits.theme.id}"`;
800
+ }
801
+ const combinedStyles = { ...styles };
802
+ if (traits.theme?.style) {
803
+ traits.theme.style.split(";").forEach((rule) => {
804
+ const [key, ...valueParts] = rule.split(":");
805
+ const value = valueParts.join(":");
806
+ if (key && value) {
807
+ const camelKey = key.trim().replace(/-([a-z])/g, (g) => g[1].toUpperCase());
808
+ combinedStyles[camelKey] = value.trim();
809
+ }
810
+ });
811
+ }
812
+ if (Object.keys(combinedStyles).length > 0) {
813
+ props += ` style={${JSON.stringify(combinedStyles)}}`;
814
+ }
815
+ if (classes.length > 0) {
816
+ props += ` className="${classes.join(" ")}"`;
817
+ }
818
+ if (traits.theme?.attributes) {
819
+ try {
820
+ const parsedAttrs = readJson(traits.theme.attributes);
821
+ for (const [key, value] of Object.entries(parsedAttrs)) {
822
+ props += ` ${key}="${value}"`;
823
+ }
824
+ } catch (e) {
825
+ }
826
+ }
827
+ if (traits.button?.onClick || traits.form?.onSubmit) {
828
+ const action = traits.button?.onClick || traits.form?.onSubmit;
829
+ if (action) {
830
+ const cleanAction = action.replace(/["']/g, "'");
831
+ if (cleanAction.includes("navigate")) {
832
+ props += ` onClick={() => ${cleanAction}}`;
833
+ } else if (cleanAction.includes("submit")) {
834
+ props += ` onSubmit={(e) => ${cleanAction}}`;
835
+ } else if (cleanAction.includes("window.open")) {
836
+ props += ` onClick={() => ${cleanAction}}`;
837
+ } else {
838
+ props += ` onClick={() => console.log('${cleanAction}')}`;
839
+ }
840
+ }
841
+ }
842
+ if (traits.image?.src) props += ` src="${traits.image.src}"`;
843
+ if (traits.image?.alt) props += ` alt="${traits.image.alt}"`;
844
+ if (traits.link?.href) props += ` href="${traits.link.href}"`;
845
+ if (traits.input?.placeholder) props += ` placeholder="${traits.input.placeholder}"`;
846
+ if (traits.input?.type) props += ` type="${traits.input.type}"`;
847
+ if (traits.input?.required) props += ` required`;
848
+ if (traits.button?.type) props += ` type="${traits.button.type}"`;
849
+ const childrenMarkup = (obj.children || obj.objects || []).map((child) => this.generateReactNode(child)).join("\n");
850
+ const content = traits.text?.content || traits.button?.content || traits.link?.content || traits.icon?.name;
851
+ let safeContent = "";
852
+ if (content) {
853
+ safeContent = `{\`${content.replace(/`/g, "\\`").replace(/\$/g, "\\$")}\`}`;
854
+ }
855
+ if (tag === "style") {
856
+ const escapedStyle = (content || "").replace(/`/g, "\\`").replace(/\$/g, "\\$");
857
+ return `<style dangerouslySetInnerHTML={{ __html: \`${escapedStyle}\` }} />`;
858
+ }
859
+ if (tag === "img" || tag === "input") {
860
+ return `<${tag}${props} />`;
861
+ }
862
+ return `<${tag}${props}>
863
+ ${safeContent}
864
+ ${childrenMarkup}
865
+ </${tag}>`;
866
+ }
867
+ // ============================================================================
868
+ // HTML GENERATION
869
+ // ============================================================================
870
+ generateHTMLPage(name, objects, composition) {
871
+ const content = objects.map((obj) => this.generateHTMLNode(obj)).join("\n ");
872
+ let bgColor = "#ffffff";
873
+ let color = "#000000";
874
+ if (composition.environment?.properties) {
875
+ const themeProp = composition.environment.properties.find((p) => p.key === "theme");
876
+ const bgProp = composition.environment.properties.find((p) => p.key === "backgroundColor");
877
+ if (themeProp?.value === "dark" || composition.traits?.some((t) => t.name === "theme" && t.config?.dark)) {
878
+ bgColor = bgProp?.value || "#050510";
879
+ color = "#ffffff";
880
+ }
881
+ }
882
+ return `<!DOCTYPE html>
883
+ <html lang="en">
884
+ <head>
885
+ <meta charset="UTF-8">
886
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
887
+ <title>${name}</title>
888
+ <script src="https://cdn.tailwindcss.com"></script>
889
+ <style>
890
+ body { margin: 0; padding: 0; background-color: ${bgColor}; color: ${color}; font-family: system-ui, -apple-system, sans-serif; }
891
+ /* Basic resets and custom trait animations to mirror React Framer variants */
892
+ .glow-btn:hover { box-shadow: 0 0 15px rgba(255,255,255,0.5); }
893
+ .lift-card { transition: transform 0.2s ease, box-shadow 0.2s ease; }
894
+ .lift-card:hover { transform: translateY(-4px); box-shadow: 0 10px 20px rgba(0,0,0,0.2); }
895
+ [data-holo-template] { display: none; }
896
+ </style>
897
+ </head>
898
+ <body>
899
+ <div id="holoscript-native-root">
900
+ ${content}
901
+ </div>
902
+ <script>
903
+ function navigate(path) { window.location.href = path; }
904
+ function submitNewsletter(e) { e.preventDefault(); alert('Subscribed!'); }
905
+ </script>
906
+ <script>
907
+ /* HoloScript Native2D \u2014 hydration-free live list-binding runtime (@fetch).
908
+ For each [data-holo-fetch] container: fetch the endpoint, then clone the
909
+ [data-holo-template] child per item and interpolate {{field}} (dotted paths
910
+ supported) into text + attributes. Plain DOM \u2014 no framework, no hydration. */
911
+ (function () {
912
+ function getPath(o, p) { return p.split('.').reduce(function (a, k) { return a == null ? a : a[k]; }, o); }
913
+ function interp(s, item) { return s.replace(/{{([^}]+)}}/g, function (_, k) { var v = getPath(item, k.trim()); return v == null ? '' : String(v); }); }
914
+ function fill(node, item) {
915
+ if (node.attributes) { for (var i = 0; i < node.attributes.length; i++) { var a = node.attributes[i]; if (a.value.indexOf('{{') >= 0) a.value = interp(a.value, item); } }
916
+ (node.childNodes || []).forEach(function (c) {
917
+ if (c.nodeType === 3) { if (c.nodeValue.indexOf('{{') >= 0) c.nodeValue = interp(c.nodeValue, item); }
918
+ else if (c.nodeType === 1) fill(c, item);
919
+ });
920
+ }
921
+ function render(el) {
922
+ var url = el.getAttribute('data-holo-fetch'); var method = el.getAttribute('data-holo-method') || 'GET';
923
+ var tpl = el.querySelector('[data-holo-template]'); if (!tpl) return;
924
+ fetch(url, { method: method }).then(function (r) { return r.json(); }).then(function (d) {
925
+ var items = (d && (d.items || d.actions)) || (Array.isArray(d) ? d : []);
926
+ items.forEach(function (item) {
927
+ var n = tpl.cloneNode(true); n.removeAttribute('data-holo-template'); n.style.display = '';
928
+ fill(n, item); el.appendChild(n);
929
+ });
930
+ var into = el.getAttribute('data-holo-into');
931
+ if (into) { document.querySelectorAll('[data-holo-count-for="' + into + '"]').forEach(function (c) { c.textContent = String(items.length); }); }
932
+ }).catch(function (e) { console.error('[holo-fetch]', url, e); });
933
+ }
934
+ function boot() { document.querySelectorAll('[data-holo-fetch]').forEach(render); }
935
+ if (document.readyState === 'loading') document.addEventListener('DOMContentLoaded', boot); else boot();
936
+ })();
937
+ </script>
938
+ </body>
939
+ </html>`;
940
+ }
941
+ generateHTMLNode(obj, opts = {}) {
942
+ const node = obj;
943
+ const traits = this.extractTraits(obj);
944
+ const nodeType = typeof node.type === "string" ? node.type.toLowerCase() : void 0;
945
+ let tag = traits.theme?.tag || traits.panel?.tag || nodeType || "div";
946
+ if ([
947
+ "nav",
948
+ "section",
949
+ "main",
950
+ "footer",
951
+ "form",
952
+ "style",
953
+ "a",
954
+ "header",
955
+ "h1",
956
+ "h2",
957
+ "h3"
958
+ ].includes(tag)) ; else if (tag === "container") {
959
+ tag = "div";
960
+ } else if (traits.link || tag === "link") {
961
+ tag = "a";
962
+ } else if (traits.button || tag === "button") {
963
+ tag = "button";
964
+ } else if (traits.image || tag === "image") {
965
+ tag = "img";
966
+ } else if (traits.input || tag === "input") {
967
+ tag = "input";
968
+ } else if (traits.text || tag === "text") {
969
+ tag = this.mapTextVariantToTag(traits.text?.variant || "body");
970
+ } else {
971
+ tag = "div";
972
+ }
973
+ const styles = this.buildStyles(traits);
974
+ const classes = this.buildClasses(traits);
975
+ let props = ``;
976
+ if (traits.theme?.className) {
977
+ classes.push(traits.theme.className);
978
+ }
979
+ if (traits.theme?.id) {
980
+ props += ` id="${traits.theme.id}"`;
981
+ }
982
+ if (Object.keys(styles).length > 0 || traits.theme?.style) {
983
+ let styleStr = Object.entries(styles).map(([k, v]) => `${this.camelToKebab(k)}: ${v}`).join("; ");
984
+ if (traits.theme?.style) {
985
+ styleStr += (styleStr ? "; " : "") + traits.theme.style;
986
+ }
987
+ props += ` style="${styleStr}"`;
988
+ }
989
+ if (classes.length > 0) {
990
+ props += ` class="${classes.join(" ")}"`;
991
+ }
992
+ if (traits.theme?.attributes) {
993
+ try {
994
+ const parsedAttrs = readJson(traits.theme.attributes);
995
+ for (const [key, value] of Object.entries(parsedAttrs)) {
996
+ props += ` ${key}="${value}"`;
997
+ }
998
+ } catch (e) {
999
+ }
1000
+ }
1001
+ if (traits.button?.onClick) props += ` onclick="${traits.button.onClick}"`;
1002
+ if (traits.form?.onSubmit) props += ` onsubmit="${traits.form.onSubmit}"`;
1003
+ if (traits.image?.src) props += ` src="${traits.image.src}"`;
1004
+ if (traits.image?.alt) props += ` alt="${traits.image.alt}"`;
1005
+ if (traits.link?.href) props += ` href="${traits.link.href}"`;
1006
+ if (traits.input?.placeholder) props += ` placeholder="${traits.input.placeholder}"`;
1007
+ if (traits.input?.type) props += ` type="${traits.input.type}"`;
1008
+ if (traits.input?.required) props += ` required`;
1009
+ if (opts.asTemplate) props += ` data-holo-template`;
1010
+ if (traits.count_of?.source) props += ` data-holo-count-for="${traits.count_of.source}"`;
1011
+ if (traits.fetch) {
1012
+ const fEndpoint = traits.fetch.endpoint || "/api/data";
1013
+ const fInto = traits.fetch.into || "data";
1014
+ const fMethod = traits.fetch.method || "GET";
1015
+ props += ` data-holo-fetch="${fEndpoint}" data-holo-into="${fInto}" data-holo-method="${fMethod}"`;
1016
+ }
1017
+ const children = node.children || node.objects || [];
1018
+ const childrenMarkup = children.map(
1019
+ (child, i) => this.generateHTMLNode(child, { asTemplate: !!traits.fetch && i === 0 })
1020
+ ).join("\n");
1021
+ const content = traits.text?.content || traits.button?.content || traits.link?.content || traits.icon?.name;
1022
+ if (tag === "img" || tag === "input") {
1023
+ return `<${tag}${props}>`;
1024
+ }
1025
+ return `<${tag}${props}>
1026
+ ${content ? content : ""}
1027
+ ${childrenMarkup}
1028
+ </${tag}>`;
1029
+ }
1030
+ // ============================================================================
1031
+ // UTILITIES
1032
+ // ============================================================================
1033
+ extractTraits(obj) {
1034
+ const map = {};
1035
+ const node = obj;
1036
+ if (!node.traits) return map;
1037
+ for (const t of node.traits) {
1038
+ map[t.name] = t.config || {};
1039
+ if (t.name === "tailwind" && typeof t.config === "string") {
1040
+ map[t.name] = { classes: t.config };
1041
+ }
1042
+ }
1043
+ return map;
1044
+ }
1045
+ mapTextVariantToTag(variant) {
1046
+ switch (variant) {
1047
+ case "h1":
1048
+ return "h1";
1049
+ case "h2":
1050
+ return "h2";
1051
+ case "h3":
1052
+ return "h3";
1053
+ case "subtitle":
1054
+ return "h4";
1055
+ case "caption":
1056
+ return "span";
1057
+ case "emoji":
1058
+ return "span";
1059
+ default:
1060
+ return "p";
1061
+ }
1062
+ }
1063
+ buildStyles(traits) {
1064
+ const styles = {};
1065
+ const layout = traits.layout;
1066
+ const theme = traits.theme;
1067
+ if (layout) {
1068
+ if (layout.flex) {
1069
+ styles.display = "flex";
1070
+ styles.flexDirection = layout.flex === "row" ? "row" : "column";
1071
+ }
1072
+ if (layout.grid) {
1073
+ styles.display = "grid";
1074
+ styles.gridTemplateColumns = `repeat(${layout.columns || 1}, minmax(0, 1fr))`;
1075
+ }
1076
+ if (layout.justify) styles.justifyContent = layout.justify;
1077
+ if (layout.align) styles.alignItems = layout.align;
1078
+ if (layout.gap) styles.gap = typeof layout.gap === "number" ? `${layout.gap}px` : layout.gap;
1079
+ if (layout.padding)
1080
+ styles.padding = typeof layout.padding === "number" ? `${layout.padding}px` : layout.padding;
1081
+ }
1082
+ if (theme) {
1083
+ if (theme.backgroundColor) styles.backgroundColor = theme.backgroundColor;
1084
+ if (theme.color) styles.color = theme.color;
1085
+ if (theme.padding)
1086
+ styles.padding = typeof theme.padding === "number" ? `${theme.padding}px` : theme.padding;
1087
+ if (theme.borderRadius)
1088
+ styles.borderRadius = typeof theme.borderRadius === "number" ? `${theme.borderRadius}px` : theme.borderRadius;
1089
+ if (theme.border) styles.border = theme.border;
1090
+ if (theme.borderTop) styles.borderTop = theme.borderTop;
1091
+ }
1092
+ if (traits.text) {
1093
+ if (traits.text.align) styles.textAlign = traits.text.align;
1094
+ if (traits.text.maxWidth)
1095
+ styles.maxWidth = typeof traits.text.maxWidth === "number" ? `${traits.text.maxWidth}px` : traits.text.maxWidth;
1096
+ if (traits.text.weight) styles.fontWeight = traits.text.weight;
1097
+ }
1098
+ return styles;
1099
+ }
1100
+ buildClasses(traits) {
1101
+ const classes = [];
1102
+ if (traits.text) {
1103
+ if (traits.text.variant === "h1") classes.push("text-5xl font-bold tracking-tight");
1104
+ if (traits.text.variant === "h2") classes.push("text-3xl font-bold");
1105
+ if (traits.text.variant === "h3") classes.push("text-xl font-semibold");
1106
+ if (traits.text.variant === "subtitle") classes.push("text-xl text-gray-400");
1107
+ if (traits.text.variant === "caption") classes.push("text-sm text-gray-500");
1108
+ if (traits.text.variant === "emoji") classes.push("text-2xl");
1109
+ }
1110
+ if (traits.button) {
1111
+ classes.push("px-4 py-2 rounded-lg font-medium transition-all");
1112
+ if (traits.button.variant === "primary")
1113
+ classes.push("bg-blue-600 hover:bg-blue-700 text-white");
1114
+ if (traits.button.variant === "outline")
1115
+ classes.push("border border-gray-600 hover:bg-gray-800 text-white");
1116
+ if (traits.button.variant === "ghost")
1117
+ classes.push("hover:bg-gray-800 text-gray-300 hover:text-white");
1118
+ if (traits.button.variant === "glow")
1119
+ classes.push("bg-indigo-600 text-white glow-btn hover:bg-indigo-500");
1120
+ if (traits.button.size === "lg") classes.push("px-6 py-3 text-lg");
1121
+ if (traits.button.size === "sm") classes.push("px-3 py-1 text-sm");
1122
+ }
1123
+ if (traits.card) {
1124
+ if (traits.card.shadow === "md") classes.push("shadow-md");
1125
+ if (traits.card.shadow === "lg") classes.push("shadow-lg");
1126
+ if (traits.card.hover === "glow") classes.push("lift-card");
1127
+ }
1128
+ if (traits.input) {
1129
+ classes.push(
1130
+ "px-4 py-2 rounded-lg border border-gray-700 bg-gray-900 text-white focus:ring-2 focus:ring-indigo-500 outline-none"
1131
+ );
1132
+ }
1133
+ if (traits.tailwind?.classes) {
1134
+ classes.push(traits.tailwind.classes);
1135
+ }
1136
+ return classes;
1137
+ }
1138
+ camelToKebab(str) {
1139
+ return str.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
1140
+ }
1141
+ };
1142
+ }
1143
+ });
1144
+
645
1145
  // src/compiler/A2AAgentCardCompiler.ts
646
1146
  var A2AAgentCardCompiler_exports = {};
647
1147
  __export(A2AAgentCardCompiler_exports, {
@@ -6379,6 +6879,6 @@ function compilePipelineSource(source, options = {}) {
6379
6879
  return compilePipelineSourceToNode(source, options.node);
6380
6880
  }
6381
6881
 
6382
- export { A2AAgentCardCompiler, A2AAgentCardCompiler_exports, BUILTIN_RESOURCES, CAPABILITY_HIERARCHY, CATEGORY_DEFAULT_EMBODIMENT, CompilerBridge, CrossRealityTraitRegistry, EFFECTS_BY_CATEGORY, EFFECT_TO_CAPABILITY, EffectChecker, EffectRow, GaussianSplattingCompiler, HANDOFF_PATH_RULES, LinearTypeChecker, MVC_BUDGET_CONSTRAINTS, NIRCompiler, NIRCompiler_exports, PLATFORM_BUDGETS, PLATFORM_EMBODIMENT_OVERRIDES, ResourceBudgetAnalyzer, SHARED_SORT_SHADER_PATH, SpatialPartitionPass, TRAIT_EFFECTS, TRAIT_RESOURCE_COSTS, TRAIT_RESOURCE_MAP, TRUST_LEVEL_CAPABILITIES, ThreeJSCompiler, ThreeJSCompiler_exports, USDZPipeline, bestCategoryForTraits, buildSafetyReport, checkCapabilities, compilePipelineSource, compilePipelineSourceToNode, compilePipelineSourceToPython, compilePipelineToNode, compilePipelineToPython, createCrossRealityTraitRegistry, createEffectChecker, createGaussianSplattingCompiler, dangerLevel, deriveRequirements, detectMultiUserSharedSort, effectCategory, expandCapabilities, formatReport, generateCertificate, getCompilerBridge, getCrossRealityTraitRegistry, inferFromBuiltins, inferFromTraits, init_A2AAgentCardCompiler, init_NIRCompiler, init_ThreeJSCompiler, isSafeTraitSet, knownBuiltins, knownTraits, quickSafetyCheck, resetCrossRealityTraitRegistry, runSafetyPass, selectModality, selectModalityForAll, spatialPartition };
6383
- //# sourceMappingURL=chunk-NGKREZ36.js.map
6384
- //# sourceMappingURL=chunk-NGKREZ36.js.map
6882
+ export { A2AAgentCardCompiler, A2AAgentCardCompiler_exports, BUILTIN_RESOURCES, CAPABILITY_HIERARCHY, CATEGORY_DEFAULT_EMBODIMENT, CompilerBridge, CrossRealityTraitRegistry, EFFECTS_BY_CATEGORY, EFFECT_TO_CAPABILITY, EffectChecker, EffectRow, GaussianSplattingCompiler, HANDOFF_PATH_RULES, LinearTypeChecker, MVC_BUDGET_CONSTRAINTS, NIRCompiler, NIRCompiler_exports, Native2DCompiler, Native2DCompiler_exports, PLATFORM_BUDGETS, PLATFORM_EMBODIMENT_OVERRIDES, ResourceBudgetAnalyzer, SHARED_SORT_SHADER_PATH, SpatialPartitionPass, TRAIT_EFFECTS, TRAIT_RESOURCE_COSTS, TRAIT_RESOURCE_MAP, TRUST_LEVEL_CAPABILITIES, ThreeJSCompiler, ThreeJSCompiler_exports, USDZPipeline, bestCategoryForTraits, buildSafetyReport, checkCapabilities, compilePipelineSource, compilePipelineSourceToNode, compilePipelineSourceToPython, compilePipelineToNode, compilePipelineToPython, createCrossRealityTraitRegistry, createEffectChecker, createGaussianSplattingCompiler, dangerLevel, deriveRequirements, detectMultiUserSharedSort, effectCategory, expandCapabilities, formatReport, generateCertificate, getCompilerBridge, getCrossRealityTraitRegistry, inferFromBuiltins, inferFromTraits, init_A2AAgentCardCompiler, init_NIRCompiler, init_Native2DCompiler, init_ThreeJSCompiler, isSafeTraitSet, knownBuiltins, knownTraits, quickSafetyCheck, resetCrossRealityTraitRegistry, runSafetyPass, selectModality, selectModalityForAll, spatialPartition };
6883
+ //# sourceMappingURL=chunk-3OYVN53V.js.map
6884
+ //# sourceMappingURL=chunk-3OYVN53V.js.map