@holoscript/core 8.0.0 → 8.0.1

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 (126) hide show
  1. package/README.md +2 -2
  2. package/dist/{GLTFPipeline-M7WSSJED.cjs → GLTFPipeline-N6B6PJ6G.cjs} +10 -9
  3. package/dist/{GLTFPipeline-276GE64O.js → GLTFPipeline-P3WMNYCN.js} +6 -5
  4. package/dist/{HoloScriptRuntime-3URVTKPJ.js → HoloScriptRuntime-CBYJX3LZ.js} +3 -3
  5. package/dist/{HoloScriptRuntime-SXEAEU2N.cjs → HoloScriptRuntime-VJ374RER.cjs} +4 -4
  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-4GU5GCIY.js +1384 -0
  9. package/dist/{chunk-T2QCTZMO.js → chunk-4SDKXQ4C.js} +3 -3
  10. package/dist/{chunk-253GBQZY.cjs → chunk-5H2G27PK.cjs} +35 -35
  11. package/dist/{chunk-C2A5DUMF.cjs → chunk-5NWINHR5.cjs} +35 -35
  12. package/dist/chunk-6Q7RC2MK.cjs +1418 -0
  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-B4TFTDG4.js → chunk-7T25IEZ2.js} +3 -3
  16. package/dist/{chunk-7CUEMLDZ.cjs → chunk-7V4JI5TB.cjs} +540 -38
  17. package/dist/{chunk-WJIHFLMJ.js → chunk-ADADVMXY.js} +2 -2
  18. package/dist/{chunk-GQT4TYKY.cjs → chunk-ALC6K7GL.cjs} +40 -19
  19. package/dist/{chunk-3HYYMEXI.cjs → chunk-AOVGZ25K.cjs} +17 -12
  20. package/dist/{chunk-NHWSN2SD.cjs → chunk-AVJHHUC5.cjs} +17 -17
  21. package/dist/{chunk-UM6C3CGK.js → chunk-BGY3SDG3.js} +24 -3
  22. package/dist/{chunk-JCLBKPMX.js → chunk-BOVPWH4H.js} +48 -4
  23. package/dist/{chunk-ZZEI7MV4.js → chunk-CCATWPXM.js} +3 -3
  24. package/dist/{chunk-NBMHU6SW.js → chunk-CMT5NMMS.js} +3 -3
  25. package/dist/{chunk-HINXWAOD.cjs → chunk-CR4FMIWL.cjs} +11 -11
  26. package/dist/{chunk-W7VDOASB.cjs → chunk-CR7XRXRN.cjs} +5 -5
  27. package/dist/{chunk-AYBXB26F.js → chunk-CSD27UNQ.js} +5 -5
  28. package/dist/{chunk-IZM5VQZD.js → chunk-D3STJ56J.js} +3 -3
  29. package/dist/{chunk-ZBQXLH2L.js → chunk-DHO2YRIM.js} +3 -3
  30. package/dist/{chunk-JX7YL6ZE.js → chunk-E6XXE66V.js} +4 -4
  31. package/dist/{chunk-62FBK3B7.js → chunk-FFAOS5HQ.js} +4 -4
  32. package/dist/{chunk-NV4VMVXU.js → chunk-FL33V6U7.js} +3 -3
  33. package/dist/{chunk-XUUVDHIF.cjs → chunk-HKEXJUWS.cjs} +48 -3
  34. package/dist/{chunk-NXZFOPVD.cjs → chunk-HNDK4IQU.cjs} +16 -16
  35. package/dist/{chunk-RVBHAXFG.js → chunk-HR2OSYVQ.js} +16 -11
  36. package/dist/{chunk-LICPB5HZ.cjs → chunk-IUDGEUDO.cjs} +10 -10
  37. package/dist/{chunk-73FELZVJ.cjs → chunk-IWC5DM2M.cjs} +11 -11
  38. package/dist/{chunk-NGKREZ36.js → chunk-J52VSAQ7.js} +505 -5
  39. package/dist/{chunk-PHVRG4I2.js → chunk-J7XZV333.js} +3 -3
  40. package/dist/{chunk-K4VVR7CN.cjs → chunk-JBNDTXXV.cjs} +15 -15
  41. package/dist/{chunk-3NFFOWGG.js → chunk-JIBL5LRK.js} +2 -2
  42. package/dist/{chunk-HZSPDCXV.cjs → chunk-K574J76X.cjs} +3 -3
  43. package/dist/{chunk-SJBGLS25.cjs → chunk-KHDZJE5D.cjs} +5 -5
  44. package/dist/{chunk-KH4CNH66.cjs → chunk-L5LKKENW.cjs} +4 -4
  45. package/dist/{chunk-IVSZDECV.js → chunk-LHAXPADA.js} +3 -3
  46. package/dist/{chunk-EUDQTK7N.cjs → chunk-MQWAT42R.cjs} +2 -2
  47. package/dist/{chunk-KVRSTFNH.cjs → chunk-NCWCUZNS.cjs} +8 -8
  48. package/dist/{chunk-MGE5Z4GS.js → chunk-OH2FAIVU.js} +3 -3
  49. package/dist/{chunk-UMABK6SI.js → chunk-PY37LNDP.js} +3 -3
  50. package/dist/{chunk-23J755AR.js → chunk-QD32ADK6.js} +3 -3
  51. package/dist/{chunk-HZTDET3N.js → chunk-R24NNAEG.js} +3 -3
  52. package/dist/{chunk-6DPSFNJB.cjs → chunk-ROHLEP2W.cjs} +16 -16
  53. package/dist/{chunk-25IQCHTO.cjs → chunk-TWUXUCEW.cjs} +35 -35
  54. package/dist/{chunk-3AO425MZ.cjs → chunk-UFZZ7TSN.cjs} +17 -17
  55. package/dist/{chunk-BE4UJCQT.js → chunk-UWJHCOH2.js} +3 -3
  56. package/dist/{chunk-KEFNV2WM.cjs → chunk-X3UVCWNL.cjs} +13 -13
  57. package/dist/{chunk-7HIASF7S.cjs → chunk-XB274MW5.cjs} +10 -10
  58. package/dist/{chunk-KJLB4OPV.js → chunk-YN2YWTXW.js} +3 -3
  59. package/dist/{chunk-IPWSXCCN.js → chunk-YVD3CSO3.js} +3 -3
  60. package/dist/{chunk-F43YAA34.js → chunk-YVOAF4ML.js} +3 -3
  61. package/dist/{chunk-OR4Q2BGL.cjs → chunk-YWOBW2PV.cjs} +15 -15
  62. package/dist/compiler/android-xr.cjs +5 -5
  63. package/dist/compiler/android-xr.js +3 -3
  64. package/dist/compiler/babylon.cjs +4 -4
  65. package/dist/compiler/babylon.js +3 -3
  66. package/dist/compiler/business-quest.cjs +9 -9
  67. package/dist/compiler/business-quest.js +1 -1
  68. package/dist/compiler/domain-block-utils.cjs +154 -150
  69. package/dist/compiler/domain-block-utils.js +2 -2
  70. package/dist/compiler/gltf-pipeline.cjs +8 -8
  71. package/dist/compiler/gltf-pipeline.js +1 -1
  72. package/dist/compiler/godot.cjs +4 -4
  73. package/dist/compiler/godot.js +3 -3
  74. package/dist/compiler/index.cjs +129 -581
  75. package/dist/compiler/index.d.ts +12 -0
  76. package/dist/compiler/index.js +42 -498
  77. package/dist/compiler/multi-layer.cjs +5 -5
  78. package/dist/compiler/multi-layer.js +4 -4
  79. package/dist/compiler/nodetoy.d.ts +69 -0
  80. package/dist/compiler/openxr.cjs +4 -4
  81. package/dist/compiler/openxr.js +3 -3
  82. package/dist/compiler/playcanvas.cjs +4 -4
  83. package/dist/compiler/playcanvas.js +3 -3
  84. package/dist/compiler/r3f.cjs +9 -8
  85. package/dist/compiler/r3f.js +4 -3
  86. package/dist/compiler/sdf.cjs +5 -5
  87. package/dist/compiler/sdf.js +3 -3
  88. package/dist/compiler/unity.cjs +4 -4
  89. package/dist/compiler/unity.js +3 -3
  90. package/dist/compiler/unreal.cjs +5 -5
  91. package/dist/compiler/unreal.js +3 -3
  92. package/dist/compiler/urdf.cjs +12 -12
  93. package/dist/compiler/urdf.js +3 -3
  94. package/dist/compiler/usd-physics.cjs +5 -5
  95. package/dist/compiler/usd-physics.js +2 -2
  96. package/dist/compiler/visionos.cjs +4 -4
  97. package/dist/compiler/visionos.js +3 -3
  98. package/dist/compiler/vrchat.cjs +5 -5
  99. package/dist/compiler/vrchat.js +3 -3
  100. package/dist/compiler/vrr.cjs +5 -5
  101. package/dist/compiler/vrr.js +3 -3
  102. package/dist/compiler/wasm.cjs +8 -8
  103. package/dist/compiler/wasm.js +3 -3
  104. package/dist/compiler/webgpu.cjs +4 -4
  105. package/dist/compiler/webgpu.js +3 -3
  106. package/dist/debugger.cjs +4 -4
  107. package/dist/debugger.js +2 -2
  108. package/dist/dist-ACXG6IH5.cjs +3113 -0
  109. package/dist/dist-VD4L6V7Q.js +3076 -0
  110. package/dist/index.cjs +1915 -488
  111. package/dist/index.d.ts +2 -0
  112. package/dist/index.js +1480 -53
  113. package/dist/reconstruction/index.cjs +31 -31
  114. package/dist/reconstruction/index.js +2 -2
  115. package/dist/runtime.cjs +6 -6
  116. package/dist/runtime.js +2 -2
  117. package/dist/src-4ROC227P.cjs +2094 -0
  118. package/dist/src-HCCCSYP7.js +2073 -0
  119. package/dist/traits/botanical-lotus.cjs +146 -10
  120. package/dist/traits/botanical-lotus.d.ts +330 -0
  121. package/dist/traits/botanical-lotus.js +4 -1
  122. package/dist/traits/index.cjs +594 -455
  123. package/dist/traits/index.js +9 -5
  124. package/package.json +20 -20
  125. package/dist/chunk-VECQYRXL.js +0 -474
  126. package/dist/chunk-WDT3JTGM.cjs +0 -483
@@ -1,12 +1,13 @@
1
1
  'use strict';
2
2
 
3
- var chunkGQT4TYKY_cjs = require('./chunk-GQT4TYKY.cjs');
3
+ var chunkALC6K7GL_cjs = require('./chunk-ALC6K7GL.cjs');
4
4
  var chunk5S7RKFGR_cjs = require('./chunk-5S7RKFGR.cjs');
5
5
  var chunkOIQYIIO3_cjs = require('./chunk-OIQYIIO3.cjs');
6
6
  var chunkAIA52I7T_cjs = require('./chunk-AIA52I7T.cjs');
7
- var chunkXUUVDHIF_cjs = require('./chunk-XUUVDHIF.cjs');
7
+ var chunkHKEXJUWS_cjs = require('./chunk-HKEXJUWS.cjs');
8
8
  var chunkKKP7JKN4_cjs = require('./chunk-KKP7JKN4.cjs');
9
9
  var chunkKKFZ3B6J_cjs = require('./chunk-KKFZ3B6J.cjs');
10
+ var chunkE7JP3BS3_cjs = require('./chunk-E7JP3BS3.cjs');
10
11
  var chunkHCCQLAA4_cjs = require('./chunk-HCCQLAA4.cjs');
11
12
  var ans = require('@holoscript/core-types/ans');
12
13
 
@@ -644,6 +645,505 @@ var init_ThreeJSCompiler = chunkHCCQLAA4_cjs.__esm({
644
645
  }
645
646
  });
646
647
 
648
+ // src/compiler/Native2DCompiler.ts
649
+ var Native2DCompiler_exports = {};
650
+ chunkHCCQLAA4_cjs.__export(Native2DCompiler_exports, {
651
+ Native2DCompiler: () => exports.Native2DCompiler
652
+ });
653
+ exports.Native2DCompiler = void 0;
654
+ var init_Native2DCompiler = chunkHCCQLAA4_cjs.__esm({
655
+ "src/compiler/Native2DCompiler.ts"() {
656
+ chunkKKP7JKN4_cjs.init_CompilerBase();
657
+ chunkE7JP3BS3_cjs.init_safeJsonParse();
658
+ exports.Native2DCompiler = class extends chunkKKP7JKN4_cjs.CompilerBase {
659
+ constructor() {
660
+ super(...arguments);
661
+ this.compilerName = "Native2DCompiler";
662
+ // ============================================================================
663
+ // REACT GENERATION
664
+ // ============================================================================
665
+ /** Collected during node traversal — used to generate imports and hooks */
666
+ this._slotImports = /* @__PURE__ */ new Map();
667
+ this._uiImports = /* @__PURE__ */ new Set();
668
+ this._stateFields = /* @__PURE__ */ new Map();
669
+ this._fetchCalls = [];
670
+ this._options = {};
671
+ }
672
+ // @ts-expect-error During migration
673
+ compile(composition, agentToken, outputPath, options) {
674
+ this.validateCompilerAccess(agentToken, outputPath);
675
+ const isReact = options?.format === "react";
676
+ const elements = composition.ui?.elements || composition.objects || [];
677
+ if (isReact) {
678
+ const code2 = this.generateReactComponent(composition.name, elements, composition, options);
679
+ return this.withTripleOutputIfRequested(composition, code2, options);
680
+ }
681
+ const code = this.generateHTMLPage(composition.name, elements, composition);
682
+ return this.withTripleOutputIfRequested(composition, code, options);
683
+ }
684
+ generateReactComponent(name, objects, composition, options) {
685
+ this._slotImports.clear();
686
+ this._uiImports.clear();
687
+ this._stateFields.clear();
688
+ this._fetchCalls = [];
689
+ this._options = options || {};
690
+ const safeName = name.replace(/[^a-zA-Z0-9]/g, "");
691
+ if (composition?.state?.properties) {
692
+ for (const prop of composition.state.properties) {
693
+ this._stateFields.set(prop.key, prop.value ?? null);
694
+ }
695
+ }
696
+ const jsx = objects.map((obj) => this.generateReactNode(obj)).join("\n ");
697
+ const imports = [];
698
+ const reactImports = /* @__PURE__ */ new Set();
699
+ if (this._stateFields.size > 0) reactImports.add("useState");
700
+ if (this._fetchCalls.length > 0) reactImports.add("useEffect");
701
+ imports.push(
702
+ reactImports.size > 0 ? `import React, { ${[...reactImports].join(", ")} } from 'react';` : `import React from 'react';`
703
+ );
704
+ if (this._uiImports.size > 0) {
705
+ imports.push(`import { ${[...this._uiImports].join(", ")} } from '@holoscript/ui';`);
706
+ }
707
+ for (const [, slot] of this._slotImports) {
708
+ imports.push(`import { ${slot.component} } from '${slot.importPath}';`);
709
+ }
710
+ const stateHooks = [];
711
+ for (const [key, value] of this._stateFields) {
712
+ const capitalKey = key.charAt(0).toUpperCase() + key.slice(1);
713
+ const initValue = JSON.stringify(value);
714
+ stateHooks.push(
715
+ ` const [${key}, set${capitalKey}] = useState(${initValue === void 0 ? "null" : initValue});`
716
+ );
717
+ }
718
+ const fetchEffects = [];
719
+ for (const f of this._fetchCalls) {
720
+ fetchEffects.push(` useEffect(() => {
721
+ fetch(\`${f.endpoint}\`${f.method !== "GET" ? `, { method: '${f.method}' }` : ""})
722
+ .then(r => r.json())
723
+ .then(set${f.name.charAt(0).toUpperCase() + f.name.slice(1)})
724
+ .catch(console.error);
725
+ }, []);`);
726
+ }
727
+ return `${imports.join("\n")}
728
+
729
+ // @generated by HoloScript Native2DCompiler \u2014 DO NOT EDIT
730
+ export function ${safeName}Component() {
731
+ ${stateHooks.join("\n")}
732
+ ${fetchEffects.join("\n")}
733
+
734
+ return (
735
+ <div className="holoscript-2d-root w-full h-full">
736
+ ${jsx}
737
+ </div>
738
+ );
739
+ }
740
+
741
+ export default ${safeName}Component;
742
+ `;
743
+ }
744
+ generateReactNode(obj) {
745
+ const traits = this.extractTraits(obj);
746
+ if (traits.slot) {
747
+ const slotName = traits.slot.name || obj.name || "Slot";
748
+ const configuredSlot = this._options.slots?.[String(slotName)];
749
+ const component = traits.slot.component || configuredSlot?.component || slotName;
750
+ const importPath = traits.slot.import || configuredSlot?.importPath || `@/components/${component}`;
751
+ this._slotImports.set(slotName, { component, importPath });
752
+ const propsStr = traits.slot.props ? ` {...${JSON.stringify(traits.slot.props)}}` : "";
753
+ return `<div data-holo-slot="${slotName}">
754
+ <${component}${propsStr} />
755
+ </div>`;
756
+ }
757
+ if (traits.fetch) {
758
+ const name = traits.fetch.into || "data";
759
+ const endpoint = traits.fetch.endpoint || "/api/data";
760
+ const method = traits.fetch.method || "GET";
761
+ this._fetchCalls.push({ name, endpoint, method });
762
+ if (!this._stateFields.has(name)) {
763
+ this._stateFields.set(name, null);
764
+ }
765
+ }
766
+ let tag = traits.theme?.tag || traits.panel?.tag || (typeof obj.type === "string" ? obj.type.toLowerCase() : void 0) || "div";
767
+ if ([
768
+ "nav",
769
+ "section",
770
+ "main",
771
+ "footer",
772
+ "form",
773
+ "style",
774
+ "a",
775
+ "header",
776
+ "h1",
777
+ "h2",
778
+ "h3"
779
+ ].includes(tag)) ; else if (tag === "container") {
780
+ tag = "div";
781
+ } else if (traits.link || tag === "link") {
782
+ tag = "a";
783
+ } else if (traits.button || tag === "button") {
784
+ tag = "button";
785
+ } else if (traits.image || tag === "image") {
786
+ tag = "img";
787
+ } else if (traits.input || tag === "input") {
788
+ tag = "input";
789
+ } else if (traits.text || tag === "text") {
790
+ tag = this.mapTextVariantToTag(traits.text?.variant || "body");
791
+ } else {
792
+ tag = "div";
793
+ }
794
+ const styles = this.buildStyles(traits);
795
+ const classes = this.buildClasses(traits);
796
+ let props = ``;
797
+ if (traits.theme?.className) {
798
+ classes.push(traits.theme.className);
799
+ }
800
+ if (traits.theme?.id) {
801
+ props += ` id="${traits.theme.id}"`;
802
+ }
803
+ const combinedStyles = { ...styles };
804
+ if (traits.theme?.style) {
805
+ traits.theme.style.split(";").forEach((rule) => {
806
+ const [key, ...valueParts] = rule.split(":");
807
+ const value = valueParts.join(":");
808
+ if (key && value) {
809
+ const camelKey = key.trim().replace(/-([a-z])/g, (g) => g[1].toUpperCase());
810
+ combinedStyles[camelKey] = value.trim();
811
+ }
812
+ });
813
+ }
814
+ if (Object.keys(combinedStyles).length > 0) {
815
+ props += ` style={${JSON.stringify(combinedStyles)}}`;
816
+ }
817
+ if (classes.length > 0) {
818
+ props += ` className="${classes.join(" ")}"`;
819
+ }
820
+ if (traits.theme?.attributes) {
821
+ try {
822
+ const parsedAttrs = chunkE7JP3BS3_cjs.readJson(traits.theme.attributes);
823
+ for (const [key, value] of Object.entries(parsedAttrs)) {
824
+ props += ` ${key}="${value}"`;
825
+ }
826
+ } catch (e) {
827
+ }
828
+ }
829
+ if (traits.button?.onClick || traits.form?.onSubmit) {
830
+ const action = traits.button?.onClick || traits.form?.onSubmit;
831
+ if (action) {
832
+ const cleanAction = action.replace(/["']/g, "'");
833
+ if (cleanAction.includes("navigate")) {
834
+ props += ` onClick={() => ${cleanAction}}`;
835
+ } else if (cleanAction.includes("submit")) {
836
+ props += ` onSubmit={(e) => ${cleanAction}}`;
837
+ } else if (cleanAction.includes("window.open")) {
838
+ props += ` onClick={() => ${cleanAction}}`;
839
+ } else {
840
+ props += ` onClick={() => console.log('${cleanAction}')}`;
841
+ }
842
+ }
843
+ }
844
+ if (traits.image?.src) props += ` src="${traits.image.src}"`;
845
+ if (traits.image?.alt) props += ` alt="${traits.image.alt}"`;
846
+ if (traits.link?.href) props += ` href="${traits.link.href}"`;
847
+ if (traits.input?.placeholder) props += ` placeholder="${traits.input.placeholder}"`;
848
+ if (traits.input?.type) props += ` type="${traits.input.type}"`;
849
+ if (traits.input?.required) props += ` required`;
850
+ if (traits.button?.type) props += ` type="${traits.button.type}"`;
851
+ const childrenMarkup = (obj.children || obj.objects || []).map((child) => this.generateReactNode(child)).join("\n");
852
+ const content = traits.text?.content || traits.button?.content || traits.link?.content || traits.icon?.name;
853
+ let safeContent = "";
854
+ if (content) {
855
+ safeContent = `{\`${content.replace(/`/g, "\\`").replace(/\$/g, "\\$")}\`}`;
856
+ }
857
+ if (tag === "style") {
858
+ const escapedStyle = (content || "").replace(/`/g, "\\`").replace(/\$/g, "\\$");
859
+ return `<style dangerouslySetInnerHTML={{ __html: \`${escapedStyle}\` }} />`;
860
+ }
861
+ if (tag === "img" || tag === "input") {
862
+ return `<${tag}${props} />`;
863
+ }
864
+ return `<${tag}${props}>
865
+ ${safeContent}
866
+ ${childrenMarkup}
867
+ </${tag}>`;
868
+ }
869
+ // ============================================================================
870
+ // HTML GENERATION
871
+ // ============================================================================
872
+ generateHTMLPage(name, objects, composition) {
873
+ const content = objects.map((obj) => this.generateHTMLNode(obj)).join("\n ");
874
+ let bgColor = "#ffffff";
875
+ let color = "#000000";
876
+ if (composition.environment?.properties) {
877
+ const themeProp = composition.environment.properties.find((p) => p.key === "theme");
878
+ const bgProp = composition.environment.properties.find((p) => p.key === "backgroundColor");
879
+ if (themeProp?.value === "dark" || composition.traits?.some((t) => t.name === "theme" && t.config?.dark)) {
880
+ bgColor = bgProp?.value || "#050510";
881
+ color = "#ffffff";
882
+ }
883
+ }
884
+ return `<!DOCTYPE html>
885
+ <html lang="en">
886
+ <head>
887
+ <meta charset="UTF-8">
888
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
889
+ <title>${name}</title>
890
+ <script src="https://cdn.tailwindcss.com"></script>
891
+ <style>
892
+ body { margin: 0; padding: 0; background-color: ${bgColor}; color: ${color}; font-family: system-ui, -apple-system, sans-serif; }
893
+ /* Basic resets and custom trait animations to mirror React Framer variants */
894
+ .glow-btn:hover { box-shadow: 0 0 15px rgba(255,255,255,0.5); }
895
+ .lift-card { transition: transform 0.2s ease, box-shadow 0.2s ease; }
896
+ .lift-card:hover { transform: translateY(-4px); box-shadow: 0 10px 20px rgba(0,0,0,0.2); }
897
+ [data-holo-template] { display: none; }
898
+ </style>
899
+ </head>
900
+ <body>
901
+ <div id="holoscript-native-root">
902
+ ${content}
903
+ </div>
904
+ <script>
905
+ function navigate(path) { window.location.href = path; }
906
+ function submitNewsletter(e) { e.preventDefault(); alert('Subscribed!'); }
907
+ </script>
908
+ <script>
909
+ /* HoloScript Native2D \u2014 hydration-free live list-binding runtime (@fetch).
910
+ For each [data-holo-fetch] container: fetch the endpoint, then clone the
911
+ [data-holo-template] child per item and interpolate {{field}} (dotted paths
912
+ supported) into text + attributes. Plain DOM \u2014 no framework, no hydration. */
913
+ (function () {
914
+ function getPath(o, p) { return p.split('.').reduce(function (a, k) { return a == null ? a : a[k]; }, o); }
915
+ function interp(s, item) { return s.replace(/{{([^}]+)}}/g, function (_, k) { var v = getPath(item, k.trim()); return v == null ? '' : String(v); }); }
916
+ function fill(node, item) {
917
+ 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); } }
918
+ (node.childNodes || []).forEach(function (c) {
919
+ if (c.nodeType === 3) { if (c.nodeValue.indexOf('{{') >= 0) c.nodeValue = interp(c.nodeValue, item); }
920
+ else if (c.nodeType === 1) fill(c, item);
921
+ });
922
+ }
923
+ function render(el) {
924
+ var url = el.getAttribute('data-holo-fetch'); var method = el.getAttribute('data-holo-method') || 'GET';
925
+ var tpl = el.querySelector('[data-holo-template]'); if (!tpl) return;
926
+ fetch(url, { method: method }).then(function (r) { return r.json(); }).then(function (d) {
927
+ var items = (d && (d.items || d.actions)) || (Array.isArray(d) ? d : []);
928
+ items.forEach(function (item) {
929
+ var n = tpl.cloneNode(true); n.removeAttribute('data-holo-template'); n.style.display = '';
930
+ fill(n, item); el.appendChild(n);
931
+ });
932
+ var into = el.getAttribute('data-holo-into');
933
+ if (into) { document.querySelectorAll('[data-holo-count-for="' + into + '"]').forEach(function (c) { c.textContent = String(items.length); }); }
934
+ }).catch(function (e) { console.error('[holo-fetch]', url, e); });
935
+ }
936
+ function boot() { document.querySelectorAll('[data-holo-fetch]').forEach(render); }
937
+ if (document.readyState === 'loading') document.addEventListener('DOMContentLoaded', boot); else boot();
938
+ })();
939
+ </script>
940
+ </body>
941
+ </html>`;
942
+ }
943
+ generateHTMLNode(obj, opts = {}) {
944
+ const node = obj;
945
+ const traits = this.extractTraits(obj);
946
+ const nodeType = typeof node.type === "string" ? node.type.toLowerCase() : void 0;
947
+ let tag = traits.theme?.tag || traits.panel?.tag || nodeType || "div";
948
+ if ([
949
+ "nav",
950
+ "section",
951
+ "main",
952
+ "footer",
953
+ "form",
954
+ "style",
955
+ "a",
956
+ "header",
957
+ "h1",
958
+ "h2",
959
+ "h3"
960
+ ].includes(tag)) ; else if (tag === "container") {
961
+ tag = "div";
962
+ } else if (traits.link || tag === "link") {
963
+ tag = "a";
964
+ } else if (traits.button || tag === "button") {
965
+ tag = "button";
966
+ } else if (traits.image || tag === "image") {
967
+ tag = "img";
968
+ } else if (traits.input || tag === "input") {
969
+ tag = "input";
970
+ } else if (traits.text || tag === "text") {
971
+ tag = this.mapTextVariantToTag(traits.text?.variant || "body");
972
+ } else {
973
+ tag = "div";
974
+ }
975
+ const styles = this.buildStyles(traits);
976
+ const classes = this.buildClasses(traits);
977
+ let props = ``;
978
+ if (traits.theme?.className) {
979
+ classes.push(traits.theme.className);
980
+ }
981
+ if (traits.theme?.id) {
982
+ props += ` id="${traits.theme.id}"`;
983
+ }
984
+ if (Object.keys(styles).length > 0 || traits.theme?.style) {
985
+ let styleStr = Object.entries(styles).map(([k, v]) => `${this.camelToKebab(k)}: ${v}`).join("; ");
986
+ if (traits.theme?.style) {
987
+ styleStr += (styleStr ? "; " : "") + traits.theme.style;
988
+ }
989
+ props += ` style="${styleStr}"`;
990
+ }
991
+ if (classes.length > 0) {
992
+ props += ` class="${classes.join(" ")}"`;
993
+ }
994
+ if (traits.theme?.attributes) {
995
+ try {
996
+ const parsedAttrs = chunkE7JP3BS3_cjs.readJson(traits.theme.attributes);
997
+ for (const [key, value] of Object.entries(parsedAttrs)) {
998
+ props += ` ${key}="${value}"`;
999
+ }
1000
+ } catch (e) {
1001
+ }
1002
+ }
1003
+ if (traits.button?.onClick) props += ` onclick="${traits.button.onClick}"`;
1004
+ if (traits.form?.onSubmit) props += ` onsubmit="${traits.form.onSubmit}"`;
1005
+ if (traits.image?.src) props += ` src="${traits.image.src}"`;
1006
+ if (traits.image?.alt) props += ` alt="${traits.image.alt}"`;
1007
+ if (traits.link?.href) props += ` href="${traits.link.href}"`;
1008
+ if (traits.input?.placeholder) props += ` placeholder="${traits.input.placeholder}"`;
1009
+ if (traits.input?.type) props += ` type="${traits.input.type}"`;
1010
+ if (traits.input?.required) props += ` required`;
1011
+ if (opts.asTemplate) props += ` data-holo-template`;
1012
+ if (traits.count_of?.source) props += ` data-holo-count-for="${traits.count_of.source}"`;
1013
+ if (traits.fetch) {
1014
+ const fEndpoint = traits.fetch.endpoint || "/api/data";
1015
+ const fInto = traits.fetch.into || "data";
1016
+ const fMethod = traits.fetch.method || "GET";
1017
+ props += ` data-holo-fetch="${fEndpoint}" data-holo-into="${fInto}" data-holo-method="${fMethod}"`;
1018
+ }
1019
+ const children = node.children || node.objects || [];
1020
+ const childrenMarkup = children.map(
1021
+ (child, i) => this.generateHTMLNode(child, { asTemplate: !!traits.fetch && i === 0 })
1022
+ ).join("\n");
1023
+ const content = traits.text?.content || traits.button?.content || traits.link?.content || traits.icon?.name;
1024
+ if (tag === "img" || tag === "input") {
1025
+ return `<${tag}${props}>`;
1026
+ }
1027
+ return `<${tag}${props}>
1028
+ ${content ? content : ""}
1029
+ ${childrenMarkup}
1030
+ </${tag}>`;
1031
+ }
1032
+ // ============================================================================
1033
+ // UTILITIES
1034
+ // ============================================================================
1035
+ extractTraits(obj) {
1036
+ const map = {};
1037
+ const node = obj;
1038
+ if (!node.traits) return map;
1039
+ for (const t of node.traits) {
1040
+ map[t.name] = t.config || {};
1041
+ if (t.name === "tailwind" && typeof t.config === "string") {
1042
+ map[t.name] = { classes: t.config };
1043
+ }
1044
+ }
1045
+ return map;
1046
+ }
1047
+ mapTextVariantToTag(variant) {
1048
+ switch (variant) {
1049
+ case "h1":
1050
+ return "h1";
1051
+ case "h2":
1052
+ return "h2";
1053
+ case "h3":
1054
+ return "h3";
1055
+ case "subtitle":
1056
+ return "h4";
1057
+ case "caption":
1058
+ return "span";
1059
+ case "emoji":
1060
+ return "span";
1061
+ default:
1062
+ return "p";
1063
+ }
1064
+ }
1065
+ buildStyles(traits) {
1066
+ const styles = {};
1067
+ const layout = traits.layout;
1068
+ const theme = traits.theme;
1069
+ if (layout) {
1070
+ if (layout.flex) {
1071
+ styles.display = "flex";
1072
+ styles.flexDirection = layout.flex === "row" ? "row" : "column";
1073
+ }
1074
+ if (layout.grid) {
1075
+ styles.display = "grid";
1076
+ styles.gridTemplateColumns = `repeat(${layout.columns || 1}, minmax(0, 1fr))`;
1077
+ }
1078
+ if (layout.justify) styles.justifyContent = layout.justify;
1079
+ if (layout.align) styles.alignItems = layout.align;
1080
+ if (layout.gap) styles.gap = typeof layout.gap === "number" ? `${layout.gap}px` : layout.gap;
1081
+ if (layout.padding)
1082
+ styles.padding = typeof layout.padding === "number" ? `${layout.padding}px` : layout.padding;
1083
+ }
1084
+ if (theme) {
1085
+ if (theme.backgroundColor) styles.backgroundColor = theme.backgroundColor;
1086
+ if (theme.color) styles.color = theme.color;
1087
+ if (theme.padding)
1088
+ styles.padding = typeof theme.padding === "number" ? `${theme.padding}px` : theme.padding;
1089
+ if (theme.borderRadius)
1090
+ styles.borderRadius = typeof theme.borderRadius === "number" ? `${theme.borderRadius}px` : theme.borderRadius;
1091
+ if (theme.border) styles.border = theme.border;
1092
+ if (theme.borderTop) styles.borderTop = theme.borderTop;
1093
+ }
1094
+ if (traits.text) {
1095
+ if (traits.text.align) styles.textAlign = traits.text.align;
1096
+ if (traits.text.maxWidth)
1097
+ styles.maxWidth = typeof traits.text.maxWidth === "number" ? `${traits.text.maxWidth}px` : traits.text.maxWidth;
1098
+ if (traits.text.weight) styles.fontWeight = traits.text.weight;
1099
+ }
1100
+ return styles;
1101
+ }
1102
+ buildClasses(traits) {
1103
+ const classes = [];
1104
+ if (traits.text) {
1105
+ if (traits.text.variant === "h1") classes.push("text-5xl font-bold tracking-tight");
1106
+ if (traits.text.variant === "h2") classes.push("text-3xl font-bold");
1107
+ if (traits.text.variant === "h3") classes.push("text-xl font-semibold");
1108
+ if (traits.text.variant === "subtitle") classes.push("text-xl text-gray-400");
1109
+ if (traits.text.variant === "caption") classes.push("text-sm text-gray-500");
1110
+ if (traits.text.variant === "emoji") classes.push("text-2xl");
1111
+ }
1112
+ if (traits.button) {
1113
+ classes.push("px-4 py-2 rounded-lg font-medium transition-all");
1114
+ if (traits.button.variant === "primary")
1115
+ classes.push("bg-blue-600 hover:bg-blue-700 text-white");
1116
+ if (traits.button.variant === "outline")
1117
+ classes.push("border border-gray-600 hover:bg-gray-800 text-white");
1118
+ if (traits.button.variant === "ghost")
1119
+ classes.push("hover:bg-gray-800 text-gray-300 hover:text-white");
1120
+ if (traits.button.variant === "glow")
1121
+ classes.push("bg-indigo-600 text-white glow-btn hover:bg-indigo-500");
1122
+ if (traits.button.size === "lg") classes.push("px-6 py-3 text-lg");
1123
+ if (traits.button.size === "sm") classes.push("px-3 py-1 text-sm");
1124
+ }
1125
+ if (traits.card) {
1126
+ if (traits.card.shadow === "md") classes.push("shadow-md");
1127
+ if (traits.card.shadow === "lg") classes.push("shadow-lg");
1128
+ if (traits.card.hover === "glow") classes.push("lift-card");
1129
+ }
1130
+ if (traits.input) {
1131
+ classes.push(
1132
+ "px-4 py-2 rounded-lg border border-gray-700 bg-gray-900 text-white focus:ring-2 focus:ring-indigo-500 outline-none"
1133
+ );
1134
+ }
1135
+ if (traits.tailwind?.classes) {
1136
+ classes.push(traits.tailwind.classes);
1137
+ }
1138
+ return classes;
1139
+ }
1140
+ camelToKebab(str) {
1141
+ return str.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
1142
+ }
1143
+ };
1144
+ }
1145
+ });
1146
+
647
1147
  // src/compiler/A2AAgentCardCompiler.ts
648
1148
  var A2AAgentCardCompiler_exports = {};
649
1149
  chunkHCCQLAA4_cjs.__export(A2AAgentCardCompiler_exports, {
@@ -2063,8 +2563,8 @@ var init_NIRCompiler = chunkHCCQLAA4_cjs.__esm({
2063
2563
  });
2064
2564
 
2065
2565
  // src/compiler/USDZPipeline.ts
2066
- chunkXUUVDHIF_cjs.init_DomainBlockCompilerMixin();
2067
- chunkGQT4TYKY_cjs.init_R3FCompiler();
2566
+ chunkHKEXJUWS_cjs.init_DomainBlockCompilerMixin();
2567
+ chunkALC6K7GL_cjs.init_R3FCompiler();
2068
2568
  function presetString(p, k) {
2069
2569
  const v = p[k];
2070
2570
  return typeof v === "string" ? v : void 0;
@@ -2295,8 +2795,8 @@ ${domainBlocksOutput}` : materials,
2295
2795
  const matName = `Material_${this.sanitizeName(obj.name)}`;
2296
2796
  const mat = { name: matName };
2297
2797
  const presetName = typeof material === "string" ? material : typeof materialPreset === "string" ? materialPreset : void 0;
2298
- if (presetName && chunkGQT4TYKY_cjs.MATERIAL_PRESETS[presetName]) {
2299
- const preset = chunkGQT4TYKY_cjs.MATERIAL_PRESETS[presetName];
2798
+ if (presetName && chunkALC6K7GL_cjs.MATERIAL_PRESETS[presetName]) {
2799
+ const preset = chunkALC6K7GL_cjs.MATERIAL_PRESETS[presetName];
2300
2800
  const colorStr = presetString(preset, "color");
2301
2801
  if (colorStr) mat.baseColor = this.hexToRGB(colorStr);
2302
2802
  const metal = presetNumber(preset, "metalness");
@@ -2797,59 +3297,59 @@ ${domainBlocksOutput}` : materials,
2797
3297
  generateDomainBlocks(composition) {
2798
3298
  const domainBlocks = composition.domainBlocks ?? [];
2799
3299
  if (domainBlocks.length === 0) return "";
2800
- const compiled = chunkXUUVDHIF_cjs.compileDomainBlocks(
3300
+ const compiled = chunkHKEXJUWS_cjs.compileDomainBlocks(
2801
3301
  domainBlocks,
2802
3302
  {
2803
3303
  material: (block) => {
2804
- const mat = chunkXUUVDHIF_cjs.compileMaterialBlock(block);
2805
- return chunkXUUVDHIF_cjs.materialToUSD(mat);
3304
+ const mat = chunkHKEXJUWS_cjs.compileMaterialBlock(block);
3305
+ return chunkHKEXJUWS_cjs.materialToUSD(mat);
2806
3306
  },
2807
3307
  physics: (block) => {
2808
- const phys = chunkXUUVDHIF_cjs.compilePhysicsBlock(block);
3308
+ const phys = chunkHKEXJUWS_cjs.compilePhysicsBlock(block);
2809
3309
  return `# Physics: ${phys.keyword} "${phys.name || ""}" \u2014 ${JSON.stringify(phys.properties)}`;
2810
3310
  },
2811
3311
  vfx: (block) => {
2812
- const ps = chunkXUUVDHIF_cjs.compileParticleBlock(block);
2813
- return chunkXUUVDHIF_cjs.particlesToUSD(ps);
3312
+ const ps = chunkHKEXJUWS_cjs.compileParticleBlock(block);
3313
+ return chunkHKEXJUWS_cjs.particlesToUSD(ps);
2814
3314
  },
2815
3315
  postfx: (block) => {
2816
- const pp = chunkXUUVDHIF_cjs.compilePostProcessingBlock(block);
2817
- return chunkXUUVDHIF_cjs.postProcessingToUSD(pp);
3316
+ const pp = chunkHKEXJUWS_cjs.compilePostProcessingBlock(block);
3317
+ return chunkHKEXJUWS_cjs.postProcessingToUSD(pp);
2818
3318
  },
2819
3319
  audio: (block) => {
2820
- const audio = chunkXUUVDHIF_cjs.compileAudioSourceBlock(block);
2821
- return chunkXUUVDHIF_cjs.audioSourceToUSD(audio);
3320
+ const audio = chunkHKEXJUWS_cjs.compileAudioSourceBlock(block);
3321
+ return chunkHKEXJUWS_cjs.audioSourceToUSD(audio);
2822
3322
  },
2823
3323
  weather: (block) => {
2824
- const weather = chunkXUUVDHIF_cjs.compileWeatherBlock(block);
2825
- return chunkXUUVDHIF_cjs.weatherToUSD(weather);
3324
+ const weather = chunkHKEXJUWS_cjs.compileWeatherBlock(block);
3325
+ return chunkHKEXJUWS_cjs.weatherToUSD(weather);
2826
3326
  },
2827
3327
  narrative: (block) => {
2828
- const narr = chunkXUUVDHIF_cjs.compileNarrativeBlock(block);
2829
- return chunkXUUVDHIF_cjs.narrativeToUSDA(narr);
3328
+ const narr = chunkHKEXJUWS_cjs.compileNarrativeBlock(block);
3329
+ return chunkHKEXJUWS_cjs.narrativeToUSDA(narr);
2830
3330
  },
2831
3331
  payment: (block) => {
2832
- const pay = chunkXUUVDHIF_cjs.compilePaymentBlock(block);
2833
- return chunkXUUVDHIF_cjs.paymentToUSDA(pay);
3332
+ const pay = chunkHKEXJUWS_cjs.compilePaymentBlock(block);
3333
+ return chunkHKEXJUWS_cjs.paymentToUSDA(pay);
2834
3334
  },
2835
3335
  healthcare: (block) => {
2836
- const h = chunkXUUVDHIF_cjs.compileHealthcareBlock(block);
2837
- return chunkXUUVDHIF_cjs.healthcareToUSDA(h);
3336
+ const h = chunkHKEXJUWS_cjs.compileHealthcareBlock(block);
3337
+ return chunkHKEXJUWS_cjs.healthcareToUSDA(h);
2838
3338
  },
2839
3339
  robotics: (block) => {
2840
- const r = chunkXUUVDHIF_cjs.compileRoboticsBlock(block);
2841
- return chunkXUUVDHIF_cjs.roboticsToUSDA(r);
3340
+ const r = chunkHKEXJUWS_cjs.compileRoboticsBlock(block);
3341
+ return chunkHKEXJUWS_cjs.roboticsToUSDA(r);
2842
3342
  },
2843
- iot: (block) => chunkXUUVDHIF_cjs.iotToUSDA(chunkXUUVDHIF_cjs.compileIoTBlock(block)),
2844
- dataviz: (block) => chunkXUUVDHIF_cjs.datavizToUSDA(chunkXUUVDHIF_cjs.compileDataVizBlock(block)),
2845
- education: (block) => chunkXUUVDHIF_cjs.educationToUSDA(chunkXUUVDHIF_cjs.compileEducationBlock(block)),
2846
- music: (block) => chunkXUUVDHIF_cjs.musicToUSDA(chunkXUUVDHIF_cjs.compileMusicBlock(block)),
2847
- architecture: (block) => chunkXUUVDHIF_cjs.architectureToUSDA(chunkXUUVDHIF_cjs.compileArchitectureBlock(block)),
2848
- web3: (block) => chunkXUUVDHIF_cjs.web3ToUSDA(chunkXUUVDHIF_cjs.compileWeb3Block(block)),
2849
- procedural: (block) => chunkXUUVDHIF_cjs.proceduralToUSDA(chunkXUUVDHIF_cjs.compileProceduralBlock(block)),
2850
- rendering: (block) => chunkXUUVDHIF_cjs.renderingToUSDA(chunkXUUVDHIF_cjs.compileRenderingBlock(block)),
2851
- navigation: (block) => chunkXUUVDHIF_cjs.navigationToUSDA(chunkXUUVDHIF_cjs.compileNavigationBlock(block)),
2852
- input: (block) => chunkXUUVDHIF_cjs.inputToUSDA(chunkXUUVDHIF_cjs.compileInputBlock(block))
3343
+ iot: (block) => chunkHKEXJUWS_cjs.iotToUSDA(chunkHKEXJUWS_cjs.compileIoTBlock(block)),
3344
+ dataviz: (block) => chunkHKEXJUWS_cjs.datavizToUSDA(chunkHKEXJUWS_cjs.compileDataVizBlock(block)),
3345
+ education: (block) => chunkHKEXJUWS_cjs.educationToUSDA(chunkHKEXJUWS_cjs.compileEducationBlock(block)),
3346
+ music: (block) => chunkHKEXJUWS_cjs.musicToUSDA(chunkHKEXJUWS_cjs.compileMusicBlock(block)),
3347
+ architecture: (block) => chunkHKEXJUWS_cjs.architectureToUSDA(chunkHKEXJUWS_cjs.compileArchitectureBlock(block)),
3348
+ web3: (block) => chunkHKEXJUWS_cjs.web3ToUSDA(chunkHKEXJUWS_cjs.compileWeb3Block(block)),
3349
+ procedural: (block) => chunkHKEXJUWS_cjs.proceduralToUSDA(chunkHKEXJUWS_cjs.compileProceduralBlock(block)),
3350
+ rendering: (block) => chunkHKEXJUWS_cjs.renderingToUSDA(chunkHKEXJUWS_cjs.compileRenderingBlock(block)),
3351
+ navigation: (block) => chunkHKEXJUWS_cjs.navigationToUSDA(chunkHKEXJUWS_cjs.compileNavigationBlock(block)),
3352
+ input: (block) => chunkHKEXJUWS_cjs.inputToUSDA(chunkHKEXJUWS_cjs.compileInputBlock(block))
2853
3353
  },
2854
3354
  (block) => `# Domain block: ${block.domain}/${block.keyword} "${block.name}"`
2855
3355
  );
@@ -6396,6 +6896,7 @@ exports.HANDOFF_PATH_RULES = HANDOFF_PATH_RULES;
6396
6896
  exports.LinearTypeChecker = LinearTypeChecker;
6397
6897
  exports.MVC_BUDGET_CONSTRAINTS = MVC_BUDGET_CONSTRAINTS;
6398
6898
  exports.NIRCompiler_exports = NIRCompiler_exports;
6899
+ exports.Native2DCompiler_exports = Native2DCompiler_exports;
6399
6900
  exports.PLATFORM_BUDGETS = PLATFORM_BUDGETS;
6400
6901
  exports.PLATFORM_EMBODIMENT_OVERRIDES = PLATFORM_EMBODIMENT_OVERRIDES;
6401
6902
  exports.ResourceBudgetAnalyzer = ResourceBudgetAnalyzer;
@@ -6431,6 +6932,7 @@ exports.inferFromBuiltins = inferFromBuiltins;
6431
6932
  exports.inferFromTraits = inferFromTraits;
6432
6933
  exports.init_A2AAgentCardCompiler = init_A2AAgentCardCompiler;
6433
6934
  exports.init_NIRCompiler = init_NIRCompiler;
6935
+ exports.init_Native2DCompiler = init_Native2DCompiler;
6434
6936
  exports.init_ThreeJSCompiler = init_ThreeJSCompiler;
6435
6937
  exports.isSafeTraitSet = isSafeTraitSet;
6436
6938
  exports.knownBuiltins = knownBuiltins;
@@ -6441,5 +6943,5 @@ exports.runSafetyPass = runSafetyPass;
6441
6943
  exports.selectModality = selectModality;
6442
6944
  exports.selectModalityForAll = selectModalityForAll;
6443
6945
  exports.spatialPartition = spatialPartition;
6444
- //# sourceMappingURL=chunk-7CUEMLDZ.cjs.map
6445
- //# sourceMappingURL=chunk-7CUEMLDZ.cjs.map
6946
+ //# sourceMappingURL=chunk-7V4JI5TB.cjs.map
6947
+ //# sourceMappingURL=chunk-7V4JI5TB.cjs.map
@@ -400,5 +400,5 @@ function registerBusinessQuestTools(server) {
400
400
  var BusinessQuestTools_default = handleBusinessQuestToolCall;
401
401
 
402
402
  export { BUSINESS_QUEST_TOOLS, BusinessQuestTools_default, buildVRRCompositionFromDraft, businessVRRDraftSchema, draftToHoloPreview, handleBusinessQuestToolCall, registerBusinessQuestTools, validateBusinessVRRDraft };
403
- //# sourceMappingURL=chunk-WJIHFLMJ.js.map
404
- //# sourceMappingURL=chunk-WJIHFLMJ.js.map
403
+ //# sourceMappingURL=chunk-ADADVMXY.js.map
404
+ //# sourceMappingURL=chunk-ADADVMXY.js.map