@0001-labs/idv1 4.0.3 → 4.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.
- package/README.md +1 -1
- package/package.json +1 -1
- package/src/util/explorer.ts +5 -7
package/README.md
CHANGED
|
@@ -77,4 +77,4 @@ The five masks are `LLNNNN`, `LLNNLL`, `LLLLNN`, `LLLLLL` and the remaining `XXX
|
|
|
77
77
|
|
|
78
78
|
`overviewHtml({ directory, records, namespaceIds })` from `@0001-labs/idv1/overview` renders separate Shapes, Taxonomies and Namespaces tables. Import `@0001-labs/idv1/overview.css` for the base layout; hosts supply theme variables. Namespace labels contain no dashes. Capacities come from the package; record counts come from the supplied catalogue.
|
|
79
79
|
|
|
80
|
-
Explorer
|
|
80
|
+
Explorer's cross-namespace labels separate the namespace and ID with a space.
|
package/package.json
CHANGED
package/src/util/explorer.ts
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { ID_CAPACITY, patternCapacity } from './capacity'
|
|
2
|
-
|
|
3
1
|
export type ExplorerRecord = { key: string; id?: string; label: string; kind?: string; href?: string; children?: ExplorerRecord[]; load?: () => Promise<ExplorerRecord[]> };
|
|
4
2
|
export type ExplorerNode = { qualifiedId: string; namespace: string; shape: string; label: string; group: string; at?: number };
|
|
5
3
|
export type ExplorerLink = { subject: string; relation: string; object: string };
|
|
@@ -20,7 +18,7 @@ export type ExplorerData = {
|
|
|
20
18
|
type Node = ExplorerNode;
|
|
21
19
|
type Taxonomy = ExplorerTaxonomy;
|
|
22
20
|
type Identifier = ExplorerIdentifier;
|
|
23
|
-
export type ExplorerEntry = { path: string[]; id: string; label: string; kind: string; count: number;
|
|
21
|
+
export type ExplorerEntry = { path: string[]; id: string; label: string; kind: string; count: number; href?: string; gap?: true };
|
|
24
22
|
type Entry = ExplorerEntry;
|
|
25
23
|
|
|
26
24
|
export function createExplorer(data: ExplorerData) {
|
|
@@ -89,8 +87,8 @@ export function createExplorer(data: ExplorerData) {
|
|
|
89
87
|
function entries(path: string[]): Entry[] {
|
|
90
88
|
const at = path.at(-1);
|
|
91
89
|
if (!at) return [
|
|
92
|
-
...shapes.map(kind => ({ path: [`sh:${kind.name}`], id: kind.pattern, label: plural(kind.label), kind: '', count: ofShape(kind.name).length
|
|
93
|
-
{ path: ['namespaces'], id: '', label: 'Namespaces', kind: '', count: namespaces().length,
|
|
90
|
+
...shapes.map(kind => ({ path: [`sh:${kind.name}`], id: kind.pattern, label: plural(kind.label), kind: '', count: ofShape(kind.name).length })),
|
|
91
|
+
{ path: ['namespaces'], id: '', label: 'Namespaces', kind: '', count: namespaces().length, gap: true as const },
|
|
94
92
|
{ path: ['taxonomies'], id: '', label: 'Taxonomies', kind: '', count: taxonomy.length },
|
|
95
93
|
{ path: ['identifiers'], id: '', label: 'Identifiers', kind: '', count: identifiers.length },
|
|
96
94
|
...recordEntries([], data.collections ?? []),
|
|
@@ -100,7 +98,7 @@ export function createExplorer(data: ExplorerData) {
|
|
|
100
98
|
path: [namespace], id: namespace, label: owner(namespace)?.name ?? namespace, kind: 'Namespace', count: topLevel(namespace).length,
|
|
101
99
|
}));
|
|
102
100
|
if (at === 'taxonomies') return taxonomy.map(entry => ({
|
|
103
|
-
path: [`tx:${entry.tag}`], id: entry.pattern, label: entry.name, kind: shapeName(entry.shape), count: tagged(entry).length,
|
|
101
|
+
path: [`tx:${entry.tag}`], id: entry.pattern, label: entry.name, kind: shapeName(entry.shape), count: tagged(entry).length,
|
|
104
102
|
}));
|
|
105
103
|
if (at === 'identifiers') return identifiers.map(entry => ({
|
|
106
104
|
path: [`id:${identifierKey(entry)}`], id: idIn(identifierKey(entry), scope(path)), label: entry.name, kind: named(identifierKey(entry))[0] ? kindOf(named(identifierKey(entry))[0]) : shapeName(entry.shape), count: named(identifierKey(entry)).length,
|
|
@@ -177,7 +175,7 @@ export function mountExplorer(surface: HTMLElement, data: ExplorerData) {
|
|
|
177
175
|
rows.replaceChildren(...list.map(entry => link(entry.path, entry.gap ? 'explorer-row explorer-gap' : 'explorer-row', [
|
|
178
176
|
[entry.id.padEnd(8), 'explorer-mono'],
|
|
179
177
|
[entry.label, ''],
|
|
180
|
-
[entry.
|
|
178
|
+
[entry.kind, 'explorer-dim'],
|
|
181
179
|
[entry.count ? `${String(entry.count).padStart(3)}/` : ' ', 'explorer-mono explorer-dim'],
|
|
182
180
|
], entry.href)));
|
|
183
181
|
if (!list.length) {
|