@atolis-hq/corum 0.1.55 → 0.1.57
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.
- package/dist/src/web/server.js +10 -0
- package/package.json +1 -1
- package/web/primitives.jsx +62 -52
- package/web/style.css +23 -0
package/dist/src/web/server.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { printBanner } from '../banner.js';
|
|
2
2
|
import express from 'express';
|
|
3
3
|
import path from 'node:path';
|
|
4
|
+
import { createRequire } from 'node:module';
|
|
4
5
|
import { existsSync, readFileSync, readdirSync, watch } from 'node:fs';
|
|
5
6
|
import { readdir } from 'node:fs/promises';
|
|
6
7
|
import { fileURLToPath, pathToFileURL } from 'node:url';
|
|
@@ -15,6 +16,8 @@ import { createGraphRuntimeConfig } from '../source/config.js';
|
|
|
15
16
|
const __filename = fileURLToPath(import.meta.url);
|
|
16
17
|
const __dirname = path.dirname(__filename);
|
|
17
18
|
const WEB_DIR = path.join(__dirname, '..', '..', '..', 'web');
|
|
19
|
+
const require = createRequire(import.meta.url);
|
|
20
|
+
const { version } = require('../../../package.json');
|
|
18
21
|
export function createMultiGraphCache(source) {
|
|
19
22
|
let cache = null;
|
|
20
23
|
return {
|
|
@@ -583,6 +586,13 @@ export function createApp(graph, reloadEvents = createReloadEvents(), source, mu
|
|
|
583
586
|
}
|
|
584
587
|
}
|
|
585
588
|
});
|
|
589
|
+
const indexHtml = readFileSync(path.join(WEB_DIR, 'index.html'), 'utf8')
|
|
590
|
+
.replace('href="style.css"', `href="style.css?v=${encodeURIComponent(version)}"`)
|
|
591
|
+
.replace('src="app.jsx"', `src="app.jsx?v=${encodeURIComponent(version)}"`);
|
|
592
|
+
app.get(['/', '/index.html'], (_req, res) => {
|
|
593
|
+
res.setHeader('Cache-Control', 'no-cache');
|
|
594
|
+
res.type('html').send(indexHtml);
|
|
595
|
+
});
|
|
586
596
|
app.use(express.static(WEB_DIR, {
|
|
587
597
|
setHeaders(res, filePath) {
|
|
588
598
|
if (filePath.endsWith('.jsx')) {
|
package/package.json
CHANGED
package/web/primitives.jsx
CHANGED
|
@@ -160,6 +160,10 @@ function buildPropertyRows(entries, onNavigate, depth = 0, parentPath = '', prop
|
|
|
160
160
|
});
|
|
161
161
|
}
|
|
162
162
|
|
|
163
|
+
function TableScroll({ children, className = '' }) {
|
|
164
|
+
return <div className="table-scroll"><div className={className}>{children}</div></div>;
|
|
165
|
+
}
|
|
166
|
+
|
|
163
167
|
function PropertiesTable({ properties, onNavigate, propertyHints = {} }) {
|
|
164
168
|
const entries = Object.entries(properties ?? {});
|
|
165
169
|
const rows = buildPropertyRows(entries, onNavigate, 0, '', propertyHints);
|
|
@@ -168,20 +172,22 @@ function PropertiesTable({ properties, onNavigate, propertyHints = {} }) {
|
|
|
168
172
|
}
|
|
169
173
|
|
|
170
174
|
return (
|
|
171
|
-
<
|
|
172
|
-
<
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
<
|
|
176
|
-
<
|
|
177
|
-
{row.
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
175
|
+
<TableScroll>
|
|
176
|
+
<table className="prop-table">
|
|
177
|
+
<tbody>
|
|
178
|
+
{rows.map(row => (
|
|
179
|
+
<tr key={row.key} className={`prop-row${row.depth > 0 ? ' nested' : ''}`}>
|
|
180
|
+
<td className="mono prop-key-cell">
|
|
181
|
+
<span className="prop-key-label" style={{ '--prop-depth': row.depth }}>
|
|
182
|
+
{row.label}
|
|
183
|
+
</span>
|
|
184
|
+
</td>
|
|
185
|
+
<td>{row.value}</td>
|
|
186
|
+
</tr>
|
|
187
|
+
))}
|
|
188
|
+
</tbody>
|
|
189
|
+
</table>
|
|
190
|
+
</TableScroll>
|
|
185
191
|
);
|
|
186
192
|
}
|
|
187
193
|
|
|
@@ -667,24 +673,26 @@ function SchemaCard({ title, nodes, allNodes, edges, anchorIdForNode, overlayFie
|
|
|
667
673
|
</div>
|
|
668
674
|
<div className="label-sm mono">{enumNode.id}</div>
|
|
669
675
|
</div>
|
|
670
|
-
<
|
|
671
|
-
<div className="
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
{values.length === 0 ? (
|
|
676
|
-
<div className="enum-row">
|
|
677
|
-
<div className="label-sm">No values.</div>
|
|
678
|
-
<div />
|
|
679
|
-
<div />
|
|
680
|
-
</div>
|
|
681
|
-
) : values.map(value => (
|
|
682
|
-
<div key={value.id} className="enum-row">
|
|
683
|
-
<div className="name">{enumValueDisplayName(value)}</div>
|
|
684
|
-
<div className="description">{enumValueDescription(value)}</div>
|
|
685
|
-
<div className="state"><StateTag state={value.state} /></div>
|
|
676
|
+
<TableScroll className="enum-table">
|
|
677
|
+
<div className="enum-row enum-row-head">
|
|
678
|
+
<div className="label-xs">Name</div>
|
|
679
|
+
<div className="label-xs">Description</div>
|
|
680
|
+
<div className="label-xs">Status</div>
|
|
686
681
|
</div>
|
|
687
|
-
|
|
682
|
+
{values.length === 0 ? (
|
|
683
|
+
<div className="enum-row">
|
|
684
|
+
<div className="label-sm">No values.</div>
|
|
685
|
+
<div />
|
|
686
|
+
<div />
|
|
687
|
+
</div>
|
|
688
|
+
) : values.map(value => (
|
|
689
|
+
<div key={value.id} className="enum-row">
|
|
690
|
+
<div className="name">{enumValueDisplayName(value)}</div>
|
|
691
|
+
<div className="description">{enumValueDescription(value)}</div>
|
|
692
|
+
<div className="state"><StateTag state={value.state} /></div>
|
|
693
|
+
</div>
|
|
694
|
+
))}
|
|
695
|
+
</TableScroll>
|
|
688
696
|
</div>
|
|
689
697
|
);
|
|
690
698
|
})}
|
|
@@ -713,27 +721,29 @@ function SchemaCard({ title, nodes, allNodes, edges, anchorIdForNode, overlayFie
|
|
|
713
721
|
<div className="label-sm mono">{schema.id}</div>
|
|
714
722
|
</div>
|
|
715
723
|
{ghostFields.length > 0 && <OverlayLegend overlayRefs={overlayRefs} />}
|
|
716
|
-
<
|
|
717
|
-
<div
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
724
|
+
<TableScroll className="field-table">
|
|
725
|
+
<div className="field-row field-row-head">
|
|
726
|
+
<div />
|
|
727
|
+
<div className="label-xs">Name</div>
|
|
728
|
+
<div className="label-xs">Type</div>
|
|
729
|
+
<div className="label-xs">Collection</div>
|
|
730
|
+
<div className="label-xs">Req</div>
|
|
731
|
+
<div className="label-xs">State</div>
|
|
732
|
+
<div className="label-xs">Links</div>
|
|
733
|
+
</div>
|
|
734
|
+
<SchemaFieldRows
|
|
735
|
+
schemaNodeId={schema.id}
|
|
736
|
+
model={model}
|
|
737
|
+
visited={new Set()}
|
|
738
|
+
edges={edges ?? []}
|
|
739
|
+
overlayFields={overlayFields}
|
|
740
|
+
overlayRefs={overlayRefs}
|
|
741
|
+
compact={compact}
|
|
742
|
+
/>
|
|
743
|
+
{ghostFields.length > 0 && (
|
|
744
|
+
<GhostFieldRows fields={ghostFields} overlayRefs={overlayRefs} compact={compact} />
|
|
745
|
+
)}
|
|
746
|
+
</TableScroll>
|
|
737
747
|
</div>
|
|
738
748
|
);
|
|
739
749
|
})}
|
package/web/style.css
CHANGED
|
@@ -328,6 +328,23 @@ button {
|
|
|
328
328
|
color: #fff;
|
|
329
329
|
}
|
|
330
330
|
|
|
331
|
+
.table-scroll {
|
|
332
|
+
max-width: 100%;
|
|
333
|
+
overflow-x: auto;
|
|
334
|
+
-webkit-overflow-scrolling: touch;
|
|
335
|
+
overscroll-behavior-x: contain;
|
|
336
|
+
scrollbar-width: none;
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
.table-scroll::-webkit-scrollbar {
|
|
340
|
+
display: none;
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
/* Minimum grid tracks plus gaps and padding; retain desktop column sizing. */
|
|
344
|
+
/* 724px of tracks + six 10px gaps + two 14px paddings. */
|
|
345
|
+
.field-table { min-width: 812px; }
|
|
346
|
+
.enum-table { min-width: 532px; }
|
|
347
|
+
|
|
331
348
|
.prop-table {
|
|
332
349
|
width: 100%;
|
|
333
350
|
border-collapse: collapse;
|
|
@@ -1718,6 +1735,12 @@ button {
|
|
|
1718
1735
|
}
|
|
1719
1736
|
|
|
1720
1737
|
@media (max-width: 780px) {
|
|
1738
|
+
.branch-bar {
|
|
1739
|
+
height: auto;
|
|
1740
|
+
min-height: 38px;
|
|
1741
|
+
flex-wrap: wrap;
|
|
1742
|
+
padding-block: 6px;
|
|
1743
|
+
}
|
|
1721
1744
|
#root {
|
|
1722
1745
|
height: 100dvh;
|
|
1723
1746
|
}
|