-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindex.html
More file actions
201 lines (176 loc) · 9.98 KB
/
Copy pathindex.html
File metadata and controls
201 lines (176 loc) · 9.98 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
<!DOCTYPE html>
<html>
<head>
<title>BuildRight - Orbital Sunburst Ontology</title>
<script src="https://d3js.org/d3.v7.min.js"></script>
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;600&display=swap" rel="stylesheet">
<style>
body { font-family: 'Inter', sans-serif; margin: 0; padding: 0; background: #0f172a; color: white; overflow: hidden; display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100vh; }
.header { position: absolute; top: 30px; left: 30px; z-index: 100; padding: 24px; background: rgba(15, 23, 42, 0.8); backdrop-filter: blur(12px); border-radius: 16px; border: 1px solid rgba(255,255,255,0.1); box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5); }
.header h2 { margin: 0; color: #3b82f6; font-size: 1.8rem; letter-spacing: -0.04em; font-weight: 600; }
.header p { margin: 8px 0 0; color: #94a3b8; font-size: 14px; line-height: 1.6; }
svg { width: 100vw; height: 100vh; cursor: crosshair; filter: drop-shadow(0 0 30px rgba(59, 130, 246, 0.1)); }
path { stroke: #0f172a; stroke-width: 1.5px; cursor: pointer; transition: opacity 0.3s, transform 0.3s; }
path:hover { opacity: 0.9 !important; stroke: #fff; stroke-width: 2px; }
.label { font-size: 10px; fill: white; pointer-events: none; opacity: 0.8; text-transform: uppercase; font-weight: 500; letter-spacing: 0.02em; }
.tooltip {
position: absolute; text-align: left; padding: 20px; font-size: 13px;
background: rgba(15, 23, 42, 0.95); color: #f1f5f9; border: 1px solid rgba(255,255,255,0.1); border-radius: 16px;
pointer-events: none; opacity: 0; box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.5);
max-width: 360px; line-height: 1.6; backdrop-filter: blur(8px);
}
.footer { position: absolute; bottom: 30px; width: 100%; text-align: center; color: #475569; font-size: 12px; letter-spacing: 0.1em; pointer-events: none; }
.central-label { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); text-align: center; width: 240px; pointer-events: none; z-index: 50; }
.central-label h3 { margin: 0; color: #fff; font-size: 1.2rem; filter: drop-shadow(0 0 10px rgba(59, 130, 246, 0.5)); }
.central-label span { display: block; margin-top: 8px; font-size: 11px; color: #64748b; font-weight: 600; text-transform: uppercase; }
</style>
</head>
<body>
<div class="header">
<h2>🛡️ BuildRight: Orbital Sunburst</h2>
<p>Tightly Compressed Ontological Memory Layer.<br/>Click a segment to zoom into the principle logic.</p>
</div>
<div id="central-label" class="central-label">
<h3 id="center-title">BuildRight Core</h3>
<span id="center-subtitle">Engineering Source of Truth</span>
</div>
<div id="chart"></div>
<div id="tooltip" class="tooltip"></div>
<div class="footer">AUTONOMOUS ENGINEERING HEALTH ENGINE // FASTBUILDER AI</div>
<script src="buildright.js"></script>
<script>
document.addEventListener("DOMContentLoaded", () => {
if (typeof fastMemoryData === 'undefined') {
document.getElementById('chart').innerHTML = "<p style='color:white; padding: 20px;'>Error: fastMemoryData not defined. Run generate.py first.</p>";
return;
}
renderSunburst();
});
function renderSunburst() {
// Build hierarchy from FastMemory data
const rootData = {
name: "BuildRight",
children: fastMemoryData.map(block => ({
name: block.name || block.id,
type: "Category",
children: block.nodes ? block.nodes.map(n => ({
name: n.id,
action: n.action,
logic: n.logic,
type: n.topology_level || "Function",
value: 1 // Equal weighting for blocks initially
})) : []
}))
};
const width = window.innerWidth;
const height = window.innerHeight;
const radius = Math.min(width, height) / 2.2;
const partition = data => {
const root = d3.hierarchy(data)
.sum(d => d.value)
.sort((a, b) => b.value - a.value);
return d3.partition()
.size([2 * Math.PI, root.height + 1])(root);
};
const color = d3.scaleOrdinal(d3.quantize(d3.interpolateRainbow, rootData.children.length + 1));
const arc = d3.arc()
.startAngle(d => d.x0)
.endAngle(d => d.x1)
.padAngle(d => Math.min((d.x1 - d.x0) / 2, 0.005))
.padRadius(radius / 3)
.innerRadius(d => d.y0 * radius / (root.height + 1))
.outerRadius(d => Math.max(d.y0 * radius / (root.height + 1), d.y1 * radius / (root.height + 1) - 1));
const root = partition(rootData);
root.each(d => d.current = d);
const svg = d3.select("#chart").append("svg")
.attr("viewBox", [0, 0, width, height])
.append("g")
.attr("transform", `translate(${width / 2},${height / 2})`);
const path = svg.append("g")
.selectAll("path")
.data(root.descendants().slice(1))
.join("path")
.attr("fill", d => { while (d.depth > 1) d = d.parent; return color(d.data.name); })
.attr("fill-opacity", d => d.depth === 1 ? 0.8 : d.depth === 2 ? 0.6 : 0.4)
.attr("d", d => arc(d.current));
path.filter(d => d.children)
.style("cursor", "pointer")
.on("click", clicked);
const tooltip = d3.select("#tooltip");
const centerTitle = document.getElementById("center-title");
const centerSubtitle = document.getElementById("center-subtitle");
path.on("mouseover", (event, d) => {
tooltip.transition().duration(100).style("opacity", 1);
const content = d.data.logic ?
`<strong style="color:${color(d.depth === 1 ? d.data.name : d.parent.data.name)}">${d.data.name}</strong><br/>` +
`<span style="color:#94a3b8; font-size:11px">${d.data.type}</span><hr style="border:0; border-top:1px solid rgba(255,255,255,0.1); margin:12px 0;"/>` +
`<p style="margin:0">${d.data.logic}</p>` :
`<strong>${d.data.name}</strong><br/>Category Cluster`;
tooltip.html(content)
.style("left", (event.pageX + 20) + "px")
.style("top", (event.pageY - 40) + "px");
// Update center label
centerTitle.innerText = d.data.name.split('_').slice(-1)[0];
centerSubtitle.innerText = d.data.type || "Layer";
}).on("mouseout", () => {
tooltip.transition().duration(400).style("opacity", 0);
centerTitle.innerText = "BuildRight Core";
centerSubtitle.innerText = "Engineering Source of Truth";
});
const label = svg.append("g")
.attr("pointer-events", "none")
.attr("text-anchor", "middle")
.style("user-select", "none")
.selectAll("text")
.data(root.descendants().slice(1))
.join("text")
.attr("class", "label")
.attr("dy", "0.35em")
.attr("fill-opacity", d => +labelVisible(d.current))
.attr("transform", d => labelTransform(d.current))
.text(d => d.data.name.split('_').slice(-1)[0]);
const parent = svg.append("circle")
.datum(root)
.attr("r", radius / (root.height + 1))
.attr("fill", "none")
.attr("pointer-events", "all")
.on("click", clicked);
function clicked(event, p) {
parent.datum(p.parent || root);
root.each(d => d.target = {
x0: Math.max(0, Math.min(1, (d.x0 - p.x0) / (p.x1 - p.x0))) * 2 * Math.PI,
x1: Math.max(0, Math.min(1, (d.x1 - p.x0) / (p.x1 - p.x0))) * 2 * Math.PI,
y0: Math.max(0, d.y0 - p.depth),
y1: Math.max(0, d.y1 - p.depth)
});
const t = svg.transition().duration(750);
path.transition(t)
.tween("data", d => {
const i = d3.interpolate(d.current, d.target);
return t => d.current = i(t);
})
.filter(function(d) {
return +this.getAttribute("fill-opacity") || labelVisible(d.target);
})
.attr("fill-opacity", d => d.depth === p.depth + 1 ? 0.8 : 0.4)
.attrTween("d", d => () => arc(d.current));
label.filter(function(d) {
return +this.getAttribute("fill-opacity") || labelVisible(d.target);
}).transition(t)
.attr("fill-opacity", d => +labelVisible(d.target))
.attrTween("transform", d => () => labelTransform(d.current));
}
function labelVisible(d) {
// Only show labels for depth 1 (Categories) if they are wide enough
// and depth 2 (Frameworks) if they are zoomed into.
return d.y1 <= 2 && d.y0 >= 1 && (d.y1 - d.y0) * (d.x1 - d.x0) > 0.05;
}
function labelTransform(d) {
const x = (d.x0 + d.x1) / 2 * 180 / Math.PI;
const y = (d.y0 + d.y1) / 2 * radius / (root.height + 1);
return `rotate(${x - 90}) translate(${y},0) rotate(${x < 180 ? 0 : 180})`;
}
}
</script>
</body>
</html>