structured-context-map-views 0.6.1 → 0.6.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.
- package/dist/artifact.html +1 -1
- package/dist/cli.js +6 -2
- package/dist/cli.js.map +1 -1
- package/dist/html.js +19 -0
- package/dist/html.js.map +1 -0
- package/dist/node-B0VWZju6.js +78 -0
- package/dist/node-B0VWZju6.js.map +1 -0
- package/dist/node.js +2 -2
- package/dist/read-definitions-DNcsxgXM.js +46 -0
- package/dist/read-definitions-DNcsxgXM.js.map +1 -0
- package/dist/types/node/html.d.ts +6 -0
- package/dist/types/node/index.d.ts +2 -19
- package/dist/types/node/read-definitions.d.ts +17 -0
- package/package.json +5 -1
- package/dist/node-aizYAYlq.js +0 -130
- package/dist/node-aizYAYlq.js.map +0 -1
package/dist/artifact.html
CHANGED
|
@@ -598,4 +598,4 @@ body { background: var(--viewer-ground); color: var(--mv-color-ink); }
|
|
|
598
598
|
</style>
|
|
599
599
|
<div id="root"></div>
|
|
600
600
|
<script type="importmap">{"imports":{"structured-context/browser":"https://cdn.jsdelivr.net/npm/structured-context@0.24.0/dist/browser.js/+esm","react":"https://cdn.jsdelivr.net/npm/react@19.3.0/+esm","react/jsx-runtime":"https://cdn.jsdelivr.net/npm/react@19.3.0/jsx-runtime/+esm","react-dom":"https://cdn.jsdelivr.net/npm/react-dom@19.3.0/+esm","react-dom/client":"https://cdn.jsdelivr.net/npm/react-dom@19.3.0/client/+esm","ajv/dist/2020":"https://cdn.jsdelivr.net/npm/ajv@8.20.0/dist/2020.js/+esm","json5":"https://cdn.jsdelivr.net/npm/json5@2.2.3/+esm","https://cdn.jsdelivr.net/npm/react@%5E19.3.0/+esm":"https://cdn.jsdelivr.net/npm/react@19.3.0/+esm"}}</script>
|
|
601
|
-
<script type="module" src="https://cdn.jsdelivr.net/npm/structured-context-map-views@0.6.
|
|
601
|
+
<script type="module" src="https://cdn.jsdelivr.net/npm/structured-context-map-views@0.6.2/dist/artifact.js"></script>
|
package/dist/cli.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
2
|
import { n as mapViewsForSchema } from "./definition-Cp1CCigh.js";
|
|
3
|
-
import { t as loadMapViewDefinitions } from "./node-
|
|
3
|
+
import { t as loadMapViewDefinitions } from "./node-B0VWZju6.js";
|
|
4
4
|
import { SctxError, assembleSpaceGraph, createSpaceContext, exportSpaceGraph, loadConfig, resolveConfigPath, setConfigPath, validateSpace } from "structured-context/api";
|
|
5
5
|
import { Command } from "commander";
|
|
6
6
|
var package_default = {
|
|
7
7
|
name: "structured-context-map-views",
|
|
8
|
-
version: "0.6.
|
|
8
|
+
version: "0.6.2",
|
|
9
9
|
description: "Declarative map views of structured-context spaces: render a space as a tree, nested containers or an XY plot from a short definition.",
|
|
10
10
|
license: "MIT",
|
|
11
11
|
type: "module",
|
|
@@ -34,6 +34,10 @@ var package_default = {
|
|
|
34
34
|
"types": "./dist/types/node/index.d.ts",
|
|
35
35
|
"default": "./dist/node.js"
|
|
36
36
|
},
|
|
37
|
+
"./html": {
|
|
38
|
+
"types": "./dist/types/node/html.d.ts",
|
|
39
|
+
"default": "./dist/html.js"
|
|
40
|
+
},
|
|
37
41
|
"./styles.css": "./dist/styles.css",
|
|
38
42
|
"./page.html": {
|
|
39
43
|
"types": "./dist/page.html.d.ts",
|
package/dist/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","names":["packageJson"],"sources":["../package.json","../src/node/snapshot.ts","../src/node/cli.ts"],"sourcesContent":["{\n \"name\": \"structured-context-map-views\",\n \"version\": \"0.6.
|
|
1
|
+
{"version":3,"file":"cli.js","names":["packageJson"],"sources":["../package.json","../src/node/snapshot.ts","../src/node/cli.ts"],"sourcesContent":["{\n \"name\": \"structured-context-map-views\",\n \"version\": \"0.6.2\",\n \"description\": \"Declarative map views of structured-context spaces: render a space as a tree, nested containers or an XY plot from a short definition.\",\n \"license\": \"MIT\",\n \"type\": \"module\",\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"git+https://github.com/mindsocket/structured-context-map-views.git\",\n \"directory\": \"packages/map-views\"\n },\n \"homepage\": \"https://github.com/mindsocket/structured-context-map-views#readme\",\n \"bugs\": \"https://github.com/mindsocket/structured-context-map-views/issues\",\n \"keywords\": [\n \"structured-context\",\n \"visualisation\",\n \"map-view\",\n \"react\"\n ],\n \"files\": [\n \"dist/\"\n ],\n \"sideEffects\": false,\n \"bin\": {\n \"structured-context-map-views\": \"dist/cli.js\"\n },\n \"exports\": {\n \".\": {\n \"types\": \"./dist/types/index.d.ts\",\n \"default\": \"./dist/index.js\"\n },\n \"./node\": {\n \"types\": \"./dist/types/node/index.d.ts\",\n \"default\": \"./dist/node.js\"\n },\n \"./html\": {\n \"types\": \"./dist/types/node/html.d.ts\",\n \"default\": \"./dist/html.js\"\n },\n \"./styles.css\": \"./dist/styles.css\",\n \"./page.html\": {\n \"types\": \"./dist/page.html.d.ts\",\n \"default\": \"./dist/page.html\"\n }\n },\n \"scripts\": {\n \"clean\": \"rm -rf dist\",\n \"generate\": \"bun run generate:schemas && bun run generate:definitions\",\n \"generate:schemas\": \"bun scripts/generate-schemas.ts\",\n \"generate:definitions\": \"bun scripts/generate-definitions.ts\",\n \"build:library\": \"bun run clean && bun run generate && bun --bun vite build && tsc -p tsconfig.build.json && tailwindcss -i src/layouts/styles.css -o dist/styles.css && bun scripts/build-page.ts\",\n \"build\": \"bun run build:library && bun scripts/build-artifact-page.ts\",\n \"typecheck\": \"tsc --noEmit\",\n \"capture-fixtures\": \"bun scripts/capture-fixtures.ts\",\n \"test\": \"bun test\",\n \"test:package\": \"bash scripts/test-package.sh\",\n \"prepublishOnly\": \"bun run build\",\n \"preversion\": \"bun run generate && bun run --cwd ../.. lint:fix && bun run --cwd ../.. test && bun run --cwd ../.. test:package\",\n \"version\": \"bun run generate:schemas --release && git add -A\"\n },\n \"peerDependencies\": {\n \"react\": \"^19.3.0\",\n \"react-dom\": \"^19.3.0\",\n \"structured-context\": \"^0.24.0\"\n },\n \"dependencies\": {\n \"ajv\": \"^8.20.0\",\n \"commander\": \"^15.0.0\",\n \"json-schema-to-ts\": \"^3.1.1\",\n \"json5\": \"^2.2.3\"\n },\n \"devDependencies\": {\n \"@tailwindcss/cli\": \"^4.3.3\",\n \"@types/node\": \"^22.20.5\",\n \"@types/react\": \"^19.3.0\",\n \"@types/react-dom\": \"^19.3.0\",\n \"@vitejs/plugin-react\": \"^6.1.1\",\n \"react\": \"^19.3.0\",\n \"react-dom\": \"^19.3.0\",\n \"structured-context\": \"^0.24.0\",\n \"tailwindcss\": \"^4.3.3\",\n \"vite\": \"^8.3.2\"\n }\n}\n","import {\n assembleSpaceGraph,\n type Config,\n createSpaceContext,\n exportSpaceGraph,\n validateSpace,\n} from 'structured-context/api';\nimport { mapViewsForSchema } from '../core/definition';\nimport type { SpaceSnapshot } from '../core/snapshot';\nimport { loadMapViewDefinitions } from './index';\n\n/** The `validateSpace` options `export` passes through unchanged. */\nexport type ExportValidateOptions = Pick<\n NonNullable<Parameters<typeof validateSpace>[1]>,\n 'depth' | 'includeGated' | 'semantic' | 'ruleFilter'\n>;\n\n/**\n * Node-only: snapshot a space for a browser-only host. Validation is structured-context's own\n * `validateSpace`, which also decides whether a judge runs.\n */\nexport async function exportSnapshot(\n spaceName: string,\n config: Config,\n configDir?: string,\n validateOptions: ExportValidateOptions = {},\n): Promise<SpaceSnapshot> {\n const context = createSpaceContext(spaceName, config);\n const graph = await assembleSpaceGraph(context, {});\n const schemaId = context.schema.$id;\n const validation = await validateSpace(context, validateOptions);\n return {\n space: spaceName,\n schemaId,\n graph: exportSpaceGraph(graph.nodes.values(), context.schema.metadata),\n validation: { issues: validation.issues },\n definitions: mapViewsForSchema(loadMapViewDefinitions(config, { configDir }), schemaId),\n };\n}\n","#!/usr/bin/env bun\nimport { Command } from 'commander';\nimport { loadConfig, resolveConfigPath, SctxError, setConfigPath } from 'structured-context/api';\nimport packageJson from '../../package.json' with { type: 'json' };\nimport { type ExportValidateOptions, exportSnapshot } from './snapshot';\n\nconst program = new Command();\n\nprogram\n .name('structured-context-map-views')\n .description('Map view tools for structured-context spaces')\n .version(packageJson.version)\n .option('--config <path>', 'Path to config file (overrides config discovery)');\n\nprogram\n .command('export')\n .description('Print a JSON snapshot of a space: its graph, validation results and map view definitions')\n .argument('<space-name>', 'Space name')\n .option('--depth <n>', 'Validate only hierarchy nodes within N levels from the top', (v) => parseInt(v, 10))\n .option('--include-gated', 'Evaluate rules even on nodes gated by an upstream failure')\n .option(\n '--rule-filter <dimension=values>',\n 'Evaluate only matching rules; dimensions: category, severity, type, id (repeatable, e.g. severity=error)',\n (v: string, prev: string[] = []) => [...prev, v],\n )\n .option('--semantic [provider]', 'Evaluate semantic rules, with the configured model provider or the one named')\n .action(async (spaceName: string, options: ExportValidateOptions) => {\n setConfigPath(program.opts().config);\n try {\n const config = loadConfig();\n const configDir = resolveConfigPath().root;\n const result = await exportSnapshot(spaceName, config, configDir, options);\n process.stdout.write(`${JSON.stringify(result)}\\n`);\n } catch (err) {\n if (!(err instanceof SctxError)) throw err;\n console.error(`${err.code}: ${err.message}`);\n process.exitCode = 1;\n }\n });\n\nawait program.parseAsync();\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACqBA,eAAsB,eACpB,WACA,QACA,WACA,kBAAyC,CAAC,GAClB;CACxB,MAAM,UAAU,mBAAmB,WAAW,MAAM;CACpD,MAAM,QAAQ,MAAM,mBAAmB,SAAS,CAAC,CAAC;CAClD,MAAM,WAAW,QAAQ,OAAO;CAChC,MAAM,aAAa,MAAM,cAAc,SAAS,eAAe;CAC/D,OAAO;EACL,OAAO;EACP;EACA,OAAO,iBAAiB,MAAM,MAAM,OAAO,GAAG,QAAQ,OAAO,QAAQ;EACrE,YAAY,EAAE,QAAQ,WAAW,OAAO;EACxC,aAAa,kBAAkB,uBAAuB,QAAQ,EAAE,UAAU,CAAC,GAAG,QAAQ;CACxF;AACF;;;AChCA,IAAM,UAAU,IAAI,QAAQ;AAE5B,QACG,KAAK,8BAA8B,CAAC,CACpC,YAAY,8CAA8C,CAAC,CAC3D,QAAQA,gBAAY,OAAO,CAAC,CAC5B,OAAO,mBAAmB,kDAAkD;AAE/E,QACG,QAAQ,QAAQ,CAAC,CACjB,YAAY,0FAA0F,CAAC,CACvG,SAAS,gBAAgB,YAAY,CAAC,CACtC,OAAO,eAAe,+DAA+D,MAAM,SAAS,GAAG,EAAE,CAAC,CAAC,CAC3G,OAAO,mBAAmB,2DAA2D,CAAC,CACtF,OACC,oCACA,6GACC,GAAW,OAAiB,CAAC,MAAM,CAAC,GAAG,MAAM,CAAC,CACjD,CAAC,CACA,OAAO,yBAAyB,8EAA8E,CAAC,CAC/G,OAAO,OAAO,WAAmB,YAAmC;CACnE,cAAc,QAAQ,KAAK,CAAC,CAAC,MAAM;CACnC,IAAI;EACF,MAAM,SAAS,WAAW;EAC1B,MAAM,YAAY,kBAAkB,CAAC,CAAC;EACtC,MAAM,SAAS,MAAM,eAAe,WAAW,QAAQ,WAAW,OAAO;EACzE,QAAQ,OAAO,MAAM,GAAG,KAAK,UAAU,MAAM,EAAE,GAAG;CACpD,SAAS,KAAK;EACZ,IAAI,EAAE,eAAe,YAAY,MAAM;EACvC,QAAQ,MAAM,GAAG,IAAI,KAAK,IAAI,IAAI,SAAS;EAC3C,QAAQ,WAAW;CACrB;AACF,CAAC;AAEH,MAAM,QAAQ,WAAW"}
|
package/dist/html.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { t as readDefinitionFolders } from "./read-definitions-DNcsxgXM.js";
|
|
2
|
+
//#region src/node/page.ts
|
|
3
|
+
var PAGE_SLOTS = {
|
|
4
|
+
title: "<!--sctx-title-->",
|
|
5
|
+
snapshots: "<!--sctx-snapshots-->"
|
|
6
|
+
};
|
|
7
|
+
/** `template` (`dist/page.html`) with the title and snapshots written in. */
|
|
8
|
+
function fillPage(template, snapshots, title) {
|
|
9
|
+
for (const slot of Object.values(PAGE_SLOTS)) if (template.split(slot).length !== 2) throw new Error(`The page template must hold ${slot} exactly once.`);
|
|
10
|
+
const json = JSON.stringify(snapshots).replaceAll("<", "\\u003c");
|
|
11
|
+
return template.replace(PAGE_SLOTS.title, () => escapeHtml(title)).replace(PAGE_SLOTS.snapshots, () => json);
|
|
12
|
+
}
|
|
13
|
+
function escapeHtml(text) {
|
|
14
|
+
return text.replaceAll("&", "&").replaceAll("<", "<").replaceAll(">", ">");
|
|
15
|
+
}
|
|
16
|
+
//#endregion
|
|
17
|
+
export { fillPage, readDefinitionFolders };
|
|
18
|
+
|
|
19
|
+
//# sourceMappingURL=html.js.map
|
package/dist/html.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"html.js","names":[],"sources":["../src/node/page.ts"],"sourcesContent":["import type { SpaceSnapshot } from '../core/snapshot';\n\nexport const PAGE_SLOTS = { title: '<!--sctx-title-->', snapshots: '<!--sctx-snapshots-->' } as const;\n\n/** `template` (`dist/page.html`) with the title and snapshots written in. */\nexport function fillPage(template: string, snapshots: SpaceSnapshot[], title: string): string {\n for (const slot of Object.values(PAGE_SLOTS)) {\n if (template.split(slot).length !== 2) throw new Error(`The page template must hold ${slot} exactly once.`);\n }\n // Escaping `<` stops a string in the data ending the script element\n const json = JSON.stringify(snapshots).replaceAll('<', '\\\\u003c');\n return template.replace(PAGE_SLOTS.title, () => escapeHtml(title)).replace(PAGE_SLOTS.snapshots, () => json);\n}\n\nfunction escapeHtml(text: string): string {\n return text.replaceAll('&', '&').replaceAll('<', '<').replaceAll('>', '>');\n}\n"],"mappings":";;AAEA,IAAa,aAAa;CAAE,OAAO;CAAqB,WAAW;AAAwB;;AAG3F,SAAgB,SAAS,UAAkB,WAA4B,OAAuB;CAC5F,KAAK,MAAM,QAAQ,OAAO,OAAO,UAAU,GACzC,IAAI,SAAS,MAAM,IAAI,CAAC,CAAC,WAAW,GAAG,MAAM,IAAI,MAAM,+BAA+B,KAAK,eAAe;CAG5G,MAAM,OAAO,KAAK,UAAU,SAAS,CAAC,CAAC,WAAW,KAAK,SAAS;CAChE,OAAO,SAAS,QAAQ,WAAW,aAAa,WAAW,KAAK,CAAC,CAAC,CAAC,QAAQ,WAAW,iBAAiB,IAAI;AAC7G;AAEA,SAAS,WAAW,MAAsB;CACxC,OAAO,KAAK,WAAW,KAAK,OAAO,CAAC,CAAC,WAAW,KAAK,MAAM,CAAC,CAAC,WAAW,KAAK,MAAM;AACrF"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { t as readDefinitionFolders } from "./read-definitions-DNcsxgXM.js";
|
|
2
|
+
import { existsSync, readFileSync, readdirSync } from "node:fs";
|
|
3
|
+
import { join, resolve } from "node:path";
|
|
4
|
+
import { PLUGIN_PREFIX, resolveConfigPath, resolvePluginDir, resourceDir } from "structured-context/api";
|
|
5
|
+
//#region src/node/index.ts
|
|
6
|
+
/**
|
|
7
|
+
* Node-only: finds map view definitions the way structured-context finds plugin schemas.
|
|
8
|
+
* Browser-only hosts receive the result from a server, like graph data.
|
|
9
|
+
*/
|
|
10
|
+
var DEFINITIONS_DIR = "map-views";
|
|
11
|
+
var CONFIG_PLUGINS_DIR = "plugins";
|
|
12
|
+
/**
|
|
13
|
+
* Every map view definition available with `config`, from:
|
|
14
|
+
* - this package's embedded definitions (`sctx-map-view://core/<name>`), for structured-context's bundled schemas;
|
|
15
|
+
* - each plugin found from a config folder or named by a space (`sctx-map-view://<plugin>/<name>`): the
|
|
16
|
+
* folder named by `"sctx": { "map-views": "…" }` in its package.json, else its `map-views/` folder;
|
|
17
|
+
* - the `map-views` resources folder of each config root (`sctx-map-view://<name>`).
|
|
18
|
+
*
|
|
19
|
+
* Each definition's `$id` must be in the namespace of where it was found, and ids must be unique.
|
|
20
|
+
* Throws on the first invalid definition.
|
|
21
|
+
*/
|
|
22
|
+
function loadMapViewDefinitions(config, options = {}) {
|
|
23
|
+
const configDir = options.configDir ?? resolveConfigPath().root;
|
|
24
|
+
const configDirs = [.../* @__PURE__ */ new Set([configDir, ...config.spaces.flatMap((s) => s.sourceDir ? [s.sourceDir] : [])])];
|
|
25
|
+
const folders = [...pluginDirs(config, configDir, configDirs).flatMap(([plugin, dir]) => {
|
|
26
|
+
const definitions = pluginDefinitionsDir(dir);
|
|
27
|
+
return definitions ? [{
|
|
28
|
+
dir: definitions,
|
|
29
|
+
source: {
|
|
30
|
+
kind: "plugin",
|
|
31
|
+
plugin
|
|
32
|
+
}
|
|
33
|
+
}] : [];
|
|
34
|
+
}), ...configDirs.flatMap((dir) => {
|
|
35
|
+
const definitions = resourceDir(dir, DEFINITIONS_DIR);
|
|
36
|
+
return definitions ? [{
|
|
37
|
+
dir: definitions,
|
|
38
|
+
source: { kind: "config" }
|
|
39
|
+
}] : [];
|
|
40
|
+
})];
|
|
41
|
+
return readDefinitionFolders(folders);
|
|
42
|
+
}
|
|
43
|
+
/** Plugin short name → root directory, for plugins in a config root's plugins folder or named by the config. */
|
|
44
|
+
function pluginDirs(config, configDir, configDirs) {
|
|
45
|
+
const found = /* @__PURE__ */ new Map();
|
|
46
|
+
const add = (name, fromDir) => {
|
|
47
|
+
const short = name.startsWith(PLUGIN_PREFIX) ? name.slice(PLUGIN_PREFIX.length) : name;
|
|
48
|
+
if (found.has(short)) return;
|
|
49
|
+
const dir = resolvePluginDir(name, fromDir);
|
|
50
|
+
if (dir) found.set(short, dir);
|
|
51
|
+
};
|
|
52
|
+
for (const dir of configDirs) {
|
|
53
|
+
const plugins = resourceDir(dir, CONFIG_PLUGINS_DIR);
|
|
54
|
+
if (!plugins) continue;
|
|
55
|
+
for (const entry of readdirSync(plugins).filter((e) => e.startsWith(PLUGIN_PREFIX)).sort()) add(entry, dir);
|
|
56
|
+
}
|
|
57
|
+
const topLevel = config.plugins ?? {};
|
|
58
|
+
for (const name of Object.keys(topLevel)) add(name, configDir);
|
|
59
|
+
for (const space of config.spaces) {
|
|
60
|
+
const fromDir = space.sourceDir ?? configDir;
|
|
61
|
+
const schemaPlugin = /^([^./][^/]*)\/./.exec(space.schema ?? "")?.[1];
|
|
62
|
+
if (schemaPlugin) add(schemaPlugin, fromDir);
|
|
63
|
+
for (const name of Object.keys(space.plugins ?? {})) add(name, fromDir);
|
|
64
|
+
}
|
|
65
|
+
return [...found];
|
|
66
|
+
}
|
|
67
|
+
function pluginDefinitionsDir(pluginDir) {
|
|
68
|
+
const pkgPath = join(pluginDir, "package.json");
|
|
69
|
+
if (existsSync(pkgPath)) {
|
|
70
|
+
const declared = JSON.parse(readFileSync(pkgPath, "utf8")).sctx?.[DEFINITIONS_DIR];
|
|
71
|
+
if (typeof declared === "string") return resolve(pluginDir, declared);
|
|
72
|
+
}
|
|
73
|
+
return join(pluginDir, DEFINITIONS_DIR);
|
|
74
|
+
}
|
|
75
|
+
//#endregion
|
|
76
|
+
export { loadMapViewDefinitions as t };
|
|
77
|
+
|
|
78
|
+
//# sourceMappingURL=node-B0VWZju6.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node-B0VWZju6.js","names":[],"sources":["../src/node/index.ts"],"sourcesContent":["/// <reference types=\"node\" />\nimport { existsSync, readdirSync, readFileSync, statSync } from 'node:fs';\nimport { join, resolve } from 'node:path';\nimport { type Config, PLUGIN_PREFIX, resolveConfigPath, resolvePluginDir, resourceDir } from 'structured-context/api';\nimport type { MapViewDefinition } from '../core/definition';\nimport { type DefinitionSource, readDefinitionFolders } from './read-definitions';\n\n/**\n * Node-only: finds map view definitions the way structured-context finds plugin schemas.\n * Browser-only hosts receive the result from a server, like graph data.\n */\n\nconst DEFINITIONS_DIR = 'map-views';\nconst CONFIG_PLUGINS_DIR = 'plugins';\n\nexport type LoadMapViewDefinitionsOptions = {\n /** Root of the main config file (`resolveConfigPath().root`). Defaults to where structured-context finds it. */\n configDir?: string;\n};\n\n/**\n * Every map view definition available with `config`, from:\n * - this package's embedded definitions (`sctx-map-view://core/<name>`), for structured-context's bundled schemas;\n * - each plugin found from a config folder or named by a space (`sctx-map-view://<plugin>/<name>`): the\n * folder named by `\"sctx\": { \"map-views\": \"…\" }` in its package.json, else its `map-views/` folder;\n * - the `map-views` resources folder of each config root (`sctx-map-view://<name>`).\n *\n * Each definition's `$id` must be in the namespace of where it was found, and ids must be unique.\n * Throws on the first invalid definition.\n */\nexport function loadMapViewDefinitions(\n config: Config,\n options: LoadMapViewDefinitionsOptions = {},\n): MapViewDefinition[] {\n const configDir = options.configDir ?? resolveConfigPath().root;\n const configDirs = [...new Set([configDir, ...config.spaces.flatMap((s) => (s.sourceDir ? [s.sourceDir] : []))])];\n\n const folders: { dir: string; source: DefinitionSource }[] = [\n ...pluginDirs(config, configDir, configDirs).flatMap(([plugin, dir]) => {\n const definitions = pluginDefinitionsDir(dir);\n return definitions ? [{ dir: definitions, source: { kind: 'plugin', plugin } as const }] : [];\n }),\n ...configDirs.flatMap((dir) => {\n const definitions = resourceDir(dir, DEFINITIONS_DIR);\n return definitions ? [{ dir: definitions, source: { kind: 'config' } as const }] : [];\n }),\n ];\n\n return readDefinitionFolders(folders);\n}\n\n/** Plugin short name → root directory, for plugins in a config root's plugins folder or named by the config. */\nfunction pluginDirs(config: Config, configDir: string, configDirs: string[]): [string, string][] {\n const found = new Map<string, string>();\n const add = (name: string, fromDir: string) => {\n const short = name.startsWith(PLUGIN_PREFIX) ? name.slice(PLUGIN_PREFIX.length) : name;\n if (found.has(short)) return;\n const dir = resolvePluginDir(name, fromDir);\n if (dir) found.set(short, dir);\n };\n\n for (const dir of configDirs) {\n const plugins = resourceDir(dir, CONFIG_PLUGINS_DIR);\n if (!plugins) continue;\n for (const entry of readdirSync(plugins)\n .filter((e) => e.startsWith(PLUGIN_PREFIX))\n .sort())\n add(entry, dir);\n }\n const topLevel = (config as { plugins?: Record<string, unknown> }).plugins ?? {};\n for (const name of Object.keys(topLevel)) add(name, configDir);\n for (const space of config.spaces) {\n const fromDir = space.sourceDir ?? configDir;\n // A schema named through a plugin, e.g. \"sctx-wardley-mapping/wardley_map.json\".\n const schemaPlugin = /^([^./][^/]*)\\/./.exec(space.schema ?? '')?.[1];\n if (schemaPlugin) add(schemaPlugin, fromDir);\n for (const name of Object.keys(space.plugins ?? {})) add(name, fromDir);\n }\n return [...found];\n}\n\nfunction pluginDefinitionsDir(pluginDir: string): string | undefined {\n const pkgPath = join(pluginDir, 'package.json');\n if (existsSync(pkgPath)) {\n const declared = JSON.parse(readFileSync(pkgPath, 'utf8')).sctx?.[DEFINITIONS_DIR];\n if (typeof declared === 'string') return resolve(pluginDir, declared);\n }\n return join(pluginDir, DEFINITIONS_DIR);\n}\n"],"mappings":";;;;;;;;;AAYA,IAAM,kBAAkB;AACxB,IAAM,qBAAqB;;;;;;;;;;;AAiB3B,SAAgB,uBACd,QACA,UAAyC,CAAC,GACrB;CACrB,MAAM,YAAY,QAAQ,aAAa,kBAAkB,CAAC,CAAC;CAC3D,MAAM,aAAa,CAAC,mBAAG,IAAI,IAAI,CAAC,WAAW,GAAG,OAAO,OAAO,SAAS,MAAO,EAAE,YAAY,CAAC,EAAE,SAAS,IAAI,CAAC,CAAE,CAAC,CAAC,CAAC;CAEhH,MAAM,UAAuD,CAC3D,GAAG,WAAW,QAAQ,WAAW,UAAU,CAAC,CAAC,SAAS,CAAC,QAAQ,SAAS;EACtE,MAAM,cAAc,qBAAqB,GAAG;EAC5C,OAAO,cAAc,CAAC;GAAE,KAAK;GAAa,QAAQ;IAAE,MAAM;IAAU;GAAO;EAAW,CAAC,IAAI,CAAC;CAC9F,CAAC,GACD,GAAG,WAAW,SAAS,QAAQ;EAC7B,MAAM,cAAc,YAAY,KAAK,eAAe;EACpD,OAAO,cAAc,CAAC;GAAE,KAAK;GAAa,QAAQ,EAAE,MAAM,SAAS;EAAW,CAAC,IAAI,CAAC;CACtF,CAAC,CACH;CAEA,OAAO,sBAAsB,OAAO;AACtC;;AAG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,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export {
|
|
1
|
+
import { t as loadMapViewDefinitions } from "./node-B0VWZju6.js";
|
|
2
|
+
export { loadMapViewDefinitions };
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { r as parseMapViewDefinition } from "./definition-Cp1CCigh.js";
|
|
2
|
+
import { existsSync, readFileSync, readdirSync, statSync } from "node:fs";
|
|
3
|
+
import { join } from "node:path";
|
|
4
|
+
//#region src/node/bundled-definitions.ts
|
|
5
|
+
var BUNDLED_DEFINITIONS = { "strategy-tree.json5": "// Strategy stack as a tree: vision → mission → goals → opportunities → solutions → experiments.\n{\n $schema: 'https://raw.githubusercontent.com/mindsocket/structured-context-map-views/main/schemas/generated/latest/definition.json',\n $id: 'sctx-map-view://core/strategy-tree',\n title: 'Strategy tree',\n schema: 'sctx://core/strategy_general',\n parameters: {\n orientation: { $ref: 'settings.json#/$defs/orientation', default: 'vertical' },\n nodeStyle: { $ref: 'settings.json#/$defs/nodeStyle', default: 'card' },\n validation: { $ref: 'settings.json#/$defs/validationLevel', default: 'off' },\n cardFields: {\n title: 'Card fields',\n type: 'array',\n items: { enum: ['status', 'priority', 'summary'] },\n default: ['status'],\n },\n },\n regions: [\n {\n id: 'main',\n layout: { type: 'tree', orientation: { $param: 'orientation' } },\n nodes: { style: { $param: 'nodeStyle' }, fields: { $param: 'cardFields' }, validation: { $param: 'validation' } },\n edges: { show: true },\n },\n ],\n}\n" };
|
|
6
|
+
//#endregion
|
|
7
|
+
//#region src/node/read-definitions.ts
|
|
8
|
+
var SCHEME = "sctx-map-view://";
|
|
9
|
+
var PACKAGE_NAME = "structured-context-map-views";
|
|
10
|
+
/**
|
|
11
|
+
* Definitions in `folders` and this package's embedded ones, each checked against the namespace of its source.
|
|
12
|
+
* Throws on the first invalid definition or a repeated id.
|
|
13
|
+
*/
|
|
14
|
+
function readDefinitionFolders(folders) {
|
|
15
|
+
const foundAt = /* @__PURE__ */ new Map();
|
|
16
|
+
const definitions = [];
|
|
17
|
+
const add = (label, text, source) => {
|
|
18
|
+
const definition = parseMapViewDefinition(label, text);
|
|
19
|
+
assertIdNamespace(definition.id, source, label);
|
|
20
|
+
const existing = foundAt.get(definition.id);
|
|
21
|
+
if (existing) throw new Error(`Map view id "${definition.id}" is defined by both ${existing} and ${label}.`);
|
|
22
|
+
foundAt.set(definition.id, label);
|
|
23
|
+
definitions.push(definition);
|
|
24
|
+
};
|
|
25
|
+
for (const [file, text] of Object.entries(BUNDLED_DEFINITIONS)) add(`${PACKAGE_NAME}/${file}`, text, { kind: "core" });
|
|
26
|
+
for (const { dir, source } of folders) {
|
|
27
|
+
if (!isDirectory(dir)) continue;
|
|
28
|
+
for (const file of readdirSync(dir).filter((f) => f.endsWith(".json5")).sort()) {
|
|
29
|
+
const path = join(dir, file);
|
|
30
|
+
add(path, readFileSync(path, "utf8"), source);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
return definitions;
|
|
34
|
+
}
|
|
35
|
+
function assertIdNamespace(id, source, path) {
|
|
36
|
+
const segments = id.slice(16).split("/");
|
|
37
|
+
const expected = source.kind === "core" ? `${SCHEME}core/<name>` : source.kind === "plugin" ? `${SCHEME}${source.plugin}/<name>` : `${SCHEME}<name>`;
|
|
38
|
+
if (!(source.kind === "config" ? segments.length === 1 : segments.length === 2 && segments[0] === (source.kind === "core" ? "core" : source.plugin)) || source.kind === "plugin" && source.plugin === "core") throw new Error(`Map view namespace violation: ${path} has $id "${id}". Use the form "${expected}".`);
|
|
39
|
+
}
|
|
40
|
+
function isDirectory(path) {
|
|
41
|
+
return existsSync(path) && statSync(path).isDirectory();
|
|
42
|
+
}
|
|
43
|
+
//#endregion
|
|
44
|
+
export { readDefinitionFolders as t };
|
|
45
|
+
|
|
46
|
+
//# sourceMappingURL=read-definitions-DNcsxgXM.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"read-definitions-DNcsxgXM.js","names":[],"sources":["../src/node/bundled-definitions.ts","../src/node/read-definitions.ts"],"sourcesContent":["// Generated by scripts/generate-definitions.ts from map-views/*.json5. Do not edit.\nexport const BUNDLED_DEFINITIONS: Record<string, string> = {\n \"strategy-tree.json5\": \"// Strategy stack as a tree: vision → mission → goals → opportunities → solutions → experiments.\\n{\\n $schema: 'https://raw.githubusercontent.com/mindsocket/structured-context-map-views/main/schemas/generated/latest/definition.json',\\n $id: 'sctx-map-view://core/strategy-tree',\\n title: 'Strategy tree',\\n schema: 'sctx://core/strategy_general',\\n parameters: {\\n orientation: { $ref: 'settings.json#/$defs/orientation', default: 'vertical' },\\n nodeStyle: { $ref: 'settings.json#/$defs/nodeStyle', default: 'card' },\\n validation: { $ref: 'settings.json#/$defs/validationLevel', default: 'off' },\\n cardFields: {\\n title: 'Card fields',\\n type: 'array',\\n items: { enum: ['status', 'priority', 'summary'] },\\n default: ['status'],\\n },\\n },\\n regions: [\\n {\\n id: 'main',\\n layout: { type: 'tree', orientation: { $param: 'orientation' } },\\n nodes: { style: { $param: 'nodeStyle' }, fields: { $param: 'cardFields' }, validation: { $param: 'validation' } },\\n edges: { show: true },\\n },\\n ],\\n}\\n\",\n};\n","import { existsSync, readdirSync, readFileSync, statSync } from 'node:fs';\nimport { join } from 'node:path';\nimport { type MapViewDefinition, parseMapViewDefinition } from '../core/definition';\nimport { BUNDLED_DEFINITIONS } from './bundled-definitions';\n\nconst SCHEME = 'sctx-map-view://';\nconst PACKAGE_NAME = 'structured-context-map-views';\n\nexport type DefinitionSource = { kind: 'core' } | { kind: 'plugin'; plugin: string } | { kind: 'config' };\n\n/**\n * Definitions in `folders` and this package's embedded ones, each checked against the namespace of its source.\n * Throws on the first invalid definition or a repeated id.\n */\nexport function readDefinitionFolders(folders: { dir: string; source: DefinitionSource }[]): MapViewDefinition[] {\n const foundAt = new Map<string, string>();\n const definitions: MapViewDefinition[] = [];\n const add = (label: string, text: string, source: DefinitionSource) => {\n const definition = parseMapViewDefinition(label, text);\n assertIdNamespace(definition.id, source, label);\n const existing = foundAt.get(definition.id);\n if (existing) throw new Error(`Map view id \"${definition.id}\" is defined by both ${existing} and ${label}.`);\n foundAt.set(definition.id, label);\n definitions.push(definition);\n };\n\n for (const [file, text] of Object.entries(BUNDLED_DEFINITIONS))\n add(`${PACKAGE_NAME}/${file}`, text, { kind: 'core' });\n for (const { dir, source } of folders) {\n if (!isDirectory(dir)) continue;\n for (const file of readdirSync(dir)\n .filter((f) => f.endsWith('.json5'))\n .sort()) {\n const path = join(dir, file);\n add(path, readFileSync(path, 'utf8'), source);\n }\n }\n return definitions;\n}\n\nfunction assertIdNamespace(id: string, source: DefinitionSource, path: string): void {\n const segments = id.slice(SCHEME.length).split('/');\n const expected =\n source.kind === 'core'\n ? `${SCHEME}core/<name>`\n : source.kind === 'plugin'\n ? `${SCHEME}${source.plugin}/<name>`\n : `${SCHEME}<name>`;\n const ok =\n source.kind === 'config'\n ? segments.length === 1\n : segments.length === 2 && segments[0] === (source.kind === 'core' ? 'core' : source.plugin);\n if (!ok || (source.kind === 'plugin' && source.plugin === 'core')) {\n throw new Error(`Map view namespace violation: ${path} has $id \"${id}\". Use the form \"${expected}\".`);\n }\n}\n\nfunction isDirectory(path: string): boolean {\n return existsSync(path) && statSync(path).isDirectory();\n}\n"],"mappings":";;;;AACA,IAAa,sBAA8C,EACzD,uBAAuB,8iCACzB;;;ACEA,IAAM,SAAS;AACf,IAAM,eAAe;;;;;AAQrB,SAAgB,sBAAsB,SAA2E;CAC/G,MAAM,0BAAU,IAAI,IAAoB;CACxC,MAAM,cAAmC,CAAC;CAC1C,MAAM,OAAO,OAAe,MAAc,WAA6B;EACrE,MAAM,aAAa,uBAAuB,OAAO,IAAI;EACrD,kBAAkB,WAAW,IAAI,QAAQ,KAAK;EAC9C,MAAM,WAAW,QAAQ,IAAI,WAAW,EAAE;EAC1C,IAAI,UAAU,MAAM,IAAI,MAAM,gBAAgB,WAAW,GAAG,uBAAuB,SAAS,OAAO,MAAM,EAAE;EAC3G,QAAQ,IAAI,WAAW,IAAI,KAAK;EAChC,YAAY,KAAK,UAAU;CAC7B;CAEA,KAAK,MAAM,CAAC,MAAM,SAAS,OAAO,QAAQ,mBAAmB,GAC3D,IAAI,GAAG,aAAa,GAAG,QAAQ,MAAM,EAAE,MAAM,OAAO,CAAC;CACvD,KAAK,MAAM,EAAE,KAAK,YAAY,SAAS;EACrC,IAAI,CAAC,YAAY,GAAG,GAAG;EACvB,KAAK,MAAM,QAAQ,YAAY,GAAG,CAAC,CAChC,QAAQ,MAAM,EAAE,SAAS,QAAQ,CAAC,CAAC,CACnC,KAAK,GAAG;GACT,MAAM,OAAO,KAAK,KAAK,IAAI;GAC3B,IAAI,MAAM,aAAa,MAAM,MAAM,GAAG,MAAM;EAC9C;CACF;CACA,OAAO;AACT;AAEA,SAAS,kBAAkB,IAAY,QAA0B,MAAoB;CACnF,MAAM,WAAW,GAAG,MAAM,EAAa,CAAC,CAAC,MAAM,GAAG;CAClD,MAAM,WACJ,OAAO,SAAS,SACZ,GAAG,OAAO,eACV,OAAO,SAAS,WACd,GAAG,SAAS,OAAO,OAAO,WAC1B,GAAG,OAAO;CAKlB,IAAI,EAHF,OAAO,SAAS,WACZ,SAAS,WAAW,IACpB,SAAS,WAAW,KAAK,SAAS,QAAQ,OAAO,SAAS,SAAS,SAAS,OAAO,YAC7E,OAAO,SAAS,YAAY,OAAO,WAAW,QACxD,MAAM,IAAI,MAAM,iCAAiC,KAAK,YAAY,GAAG,mBAAmB,SAAS,GAAG;AAExG;AAEA,SAAS,YAAY,MAAuB;CAC1C,OAAO,WAAW,IAAI,KAAK,SAAS,IAAI,CAAC,CAAC,YAAY;AACxD"}
|
|
@@ -1,13 +1,5 @@
|
|
|
1
1
|
import { type Config } from 'structured-context/api';
|
|
2
|
-
import {
|
|
3
|
-
export type DefinitionSource = {
|
|
4
|
-
kind: 'core';
|
|
5
|
-
} | {
|
|
6
|
-
kind: 'plugin';
|
|
7
|
-
plugin: string;
|
|
8
|
-
} | {
|
|
9
|
-
kind: 'config';
|
|
10
|
-
};
|
|
2
|
+
import type { MapViewDefinition } from '../core/definition';
|
|
11
3
|
export type LoadMapViewDefinitionsOptions = {
|
|
12
4
|
/** Root of the main config file (`resolveConfigPath().root`). Defaults to where structured-context finds it. */
|
|
13
5
|
configDir?: string;
|
|
@@ -16,19 +8,10 @@ export type LoadMapViewDefinitionsOptions = {
|
|
|
16
8
|
* Every map view definition available with `config`, from:
|
|
17
9
|
* - this package's embedded definitions (`sctx-map-view://core/<name>`), for structured-context's bundled schemas;
|
|
18
10
|
* - each plugin found from a config folder or named by a space (`sctx-map-view://<plugin>/<name>`): the
|
|
19
|
-
* folder named by `"sctx": { "
|
|
11
|
+
* folder named by `"sctx": { "map-views": "…" }` in its package.json, else its `map-views/` folder;
|
|
20
12
|
* - the `map-views` resources folder of each config root (`sctx-map-view://<name>`).
|
|
21
13
|
*
|
|
22
14
|
* Each definition's `$id` must be in the namespace of where it was found, and ids must be unique.
|
|
23
15
|
* Throws on the first invalid definition.
|
|
24
16
|
*/
|
|
25
17
|
export declare function loadMapViewDefinitions(config: Config, options?: LoadMapViewDefinitionsOptions): MapViewDefinition[];
|
|
26
|
-
/**
|
|
27
|
-
* Definitions in `folders` and this package's embedded ones, each checked against the namespace of its source.
|
|
28
|
-
* Throws on the first invalid definition or a repeated id.
|
|
29
|
-
*/
|
|
30
|
-
export declare function readDefinitionFolders(folders: {
|
|
31
|
-
dir: string;
|
|
32
|
-
source: DefinitionSource;
|
|
33
|
-
}[]): MapViewDefinition[];
|
|
34
|
-
export { fillPage } from './page';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type MapViewDefinition } from '../core/definition';
|
|
2
|
+
export type DefinitionSource = {
|
|
3
|
+
kind: 'core';
|
|
4
|
+
} | {
|
|
5
|
+
kind: 'plugin';
|
|
6
|
+
plugin: string;
|
|
7
|
+
} | {
|
|
8
|
+
kind: 'config';
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* Definitions in `folders` and this package's embedded ones, each checked against the namespace of its source.
|
|
12
|
+
* Throws on the first invalid definition or a repeated id.
|
|
13
|
+
*/
|
|
14
|
+
export declare function readDefinitionFolders(folders: {
|
|
15
|
+
dir: string;
|
|
16
|
+
source: DefinitionSource;
|
|
17
|
+
}[]): MapViewDefinition[];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "structured-context-map-views",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.2",
|
|
4
4
|
"description": "Declarative map views of structured-context spaces: render a space as a tree, nested containers or an XY plot from a short definition.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -33,6 +33,10 @@
|
|
|
33
33
|
"types": "./dist/types/node/index.d.ts",
|
|
34
34
|
"default": "./dist/node.js"
|
|
35
35
|
},
|
|
36
|
+
"./html": {
|
|
37
|
+
"types": "./dist/types/node/html.d.ts",
|
|
38
|
+
"default": "./dist/html.js"
|
|
39
|
+
},
|
|
36
40
|
"./styles.css": "./dist/styles.css",
|
|
37
41
|
"./page.html": {
|
|
38
42
|
"types": "./dist/page.html.d.ts",
|
package/dist/node-aizYAYlq.js
DELETED
|
@@ -1,130 +0,0 @@
|
|
|
1
|
-
import { r as parseMapViewDefinition } from "./definition-Cp1CCigh.js";
|
|
2
|
-
import { existsSync, readFileSync, readdirSync, statSync } from "node:fs";
|
|
3
|
-
import { join, resolve } from "node:path";
|
|
4
|
-
import { PLUGIN_PREFIX, resolveConfigPath, resolvePluginDir, resourceDir } from "structured-context/api";
|
|
5
|
-
//#region src/node/bundled-definitions.ts
|
|
6
|
-
var BUNDLED_DEFINITIONS = { "strategy-tree.json5": "// Strategy stack as a tree: vision → mission → goals → opportunities → solutions → experiments.\n{\n $schema: 'https://raw.githubusercontent.com/mindsocket/structured-context-map-views/main/schemas/generated/latest/definition.json',\n $id: 'sctx-map-view://core/strategy-tree',\n title: 'Strategy tree',\n schema: 'sctx://core/strategy_general',\n parameters: {\n orientation: { $ref: 'settings.json#/$defs/orientation', default: 'vertical' },\n nodeStyle: { $ref: 'settings.json#/$defs/nodeStyle', default: 'card' },\n validation: { $ref: 'settings.json#/$defs/validationLevel', default: 'off' },\n cardFields: {\n title: 'Card fields',\n type: 'array',\n items: { enum: ['status', 'priority', 'summary'] },\n default: ['status'],\n },\n },\n regions: [\n {\n id: 'main',\n layout: { type: 'tree', orientation: { $param: 'orientation' } },\n nodes: { style: { $param: 'nodeStyle' }, fields: { $param: 'cardFields' }, validation: { $param: 'validation' } },\n edges: { show: true },\n },\n ],\n}\n" };
|
|
7
|
-
//#endregion
|
|
8
|
-
//#region src/node/page.ts
|
|
9
|
-
var PAGE_SLOTS = {
|
|
10
|
-
title: "<!--sctx-title-->",
|
|
11
|
-
snapshots: "<!--sctx-snapshots-->"
|
|
12
|
-
};
|
|
13
|
-
/** `template` (`dist/page.html`) with the title and snapshots written in. */
|
|
14
|
-
function fillPage(template, snapshots, title) {
|
|
15
|
-
for (const slot of Object.values(PAGE_SLOTS)) if (template.split(slot).length !== 2) throw new Error(`The page template must hold ${slot} exactly once.`);
|
|
16
|
-
const json = JSON.stringify(snapshots).replaceAll("<", "\\u003c");
|
|
17
|
-
return template.replace(PAGE_SLOTS.title, () => escapeHtml(title)).replace(PAGE_SLOTS.snapshots, () => json);
|
|
18
|
-
}
|
|
19
|
-
function escapeHtml(text) {
|
|
20
|
-
return text.replaceAll("&", "&").replaceAll("<", "<").replaceAll(">", ">");
|
|
21
|
-
}
|
|
22
|
-
//#endregion
|
|
23
|
-
//#region src/node/index.ts
|
|
24
|
-
/**
|
|
25
|
-
* Node-only: finds map view definitions the way structured-context finds plugin schemas.
|
|
26
|
-
* Browser-only hosts receive the result from a server, like graph data.
|
|
27
|
-
*/
|
|
28
|
-
var SCHEME = "sctx-map-view://";
|
|
29
|
-
var DEFINITIONS_DIR = "map-views";
|
|
30
|
-
var CONFIG_PLUGINS_DIR = "plugins";
|
|
31
|
-
var PACKAGE_NAME = "structured-context-map-views";
|
|
32
|
-
/**
|
|
33
|
-
* Every map view definition available with `config`, from:
|
|
34
|
-
* - this package's embedded definitions (`sctx-map-view://core/<name>`), for structured-context's bundled schemas;
|
|
35
|
-
* - each plugin found from a config folder or named by a space (`sctx-map-view://<plugin>/<name>`): the
|
|
36
|
-
* folder named by `"sctx": { "mapViews": "…" }` in its package.json, else its `map-views/` folder;
|
|
37
|
-
* - the `map-views` resources folder of each config root (`sctx-map-view://<name>`).
|
|
38
|
-
*
|
|
39
|
-
* Each definition's `$id` must be in the namespace of where it was found, and ids must be unique.
|
|
40
|
-
* Throws on the first invalid definition.
|
|
41
|
-
*/
|
|
42
|
-
function loadMapViewDefinitions(config, options = {}) {
|
|
43
|
-
const configDir = options.configDir ?? resolveConfigPath().root;
|
|
44
|
-
const configDirs = [.../* @__PURE__ */ new Set([configDir, ...config.spaces.flatMap((s) => s.sourceDir ? [s.sourceDir] : [])])];
|
|
45
|
-
return readDefinitionFolders([...pluginDirs(config, configDir, configDirs).flatMap(([plugin, dir]) => {
|
|
46
|
-
const definitions = pluginDefinitionsDir(dir);
|
|
47
|
-
return definitions ? [{
|
|
48
|
-
dir: definitions,
|
|
49
|
-
source: {
|
|
50
|
-
kind: "plugin",
|
|
51
|
-
plugin
|
|
52
|
-
}
|
|
53
|
-
}] : [];
|
|
54
|
-
}), ...configDirs.flatMap((dir) => {
|
|
55
|
-
const definitions = resourceDir(dir, DEFINITIONS_DIR);
|
|
56
|
-
return definitions ? [{
|
|
57
|
-
dir: definitions,
|
|
58
|
-
source: { kind: "config" }
|
|
59
|
-
}] : [];
|
|
60
|
-
})]);
|
|
61
|
-
}
|
|
62
|
-
/**
|
|
63
|
-
* Definitions in `folders` and this package's embedded ones, each checked against the namespace of its source.
|
|
64
|
-
* Throws on the first invalid definition or a repeated id.
|
|
65
|
-
*/
|
|
66
|
-
function readDefinitionFolders(folders) {
|
|
67
|
-
const foundAt = /* @__PURE__ */ new Map();
|
|
68
|
-
const definitions = [];
|
|
69
|
-
const add = (label, text, source) => {
|
|
70
|
-
const definition = parseMapViewDefinition(label, text);
|
|
71
|
-
assertIdNamespace(definition.id, source, label);
|
|
72
|
-
const existing = foundAt.get(definition.id);
|
|
73
|
-
if (existing) throw new Error(`Map view id "${definition.id}" is defined by both ${existing} and ${label}.`);
|
|
74
|
-
foundAt.set(definition.id, label);
|
|
75
|
-
definitions.push(definition);
|
|
76
|
-
};
|
|
77
|
-
for (const [file, text] of Object.entries(BUNDLED_DEFINITIONS)) add(`${PACKAGE_NAME}/${file}`, text, { kind: "core" });
|
|
78
|
-
for (const { dir, source } of folders) {
|
|
79
|
-
if (!isDirectory(dir)) continue;
|
|
80
|
-
for (const file of readdirSync(dir).filter((f) => f.endsWith(".json5")).sort()) {
|
|
81
|
-
const path = join(dir, file);
|
|
82
|
-
add(path, readFileSync(path, "utf8"), source);
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
return definitions;
|
|
86
|
-
}
|
|
87
|
-
/** Plugin short name → root directory, for plugins in a config root's plugins folder or named by the config. */
|
|
88
|
-
function pluginDirs(config, configDir, configDirs) {
|
|
89
|
-
const found = /* @__PURE__ */ new Map();
|
|
90
|
-
const add = (name, fromDir) => {
|
|
91
|
-
const short = name.startsWith(PLUGIN_PREFIX) ? name.slice(PLUGIN_PREFIX.length) : name;
|
|
92
|
-
if (found.has(short)) return;
|
|
93
|
-
const dir = resolvePluginDir(name, fromDir);
|
|
94
|
-
if (dir) found.set(short, dir);
|
|
95
|
-
};
|
|
96
|
-
for (const dir of configDirs) {
|
|
97
|
-
const plugins = resourceDir(dir, CONFIG_PLUGINS_DIR);
|
|
98
|
-
if (!plugins) continue;
|
|
99
|
-
for (const entry of readdirSync(plugins).filter((e) => e.startsWith(PLUGIN_PREFIX)).sort()) add(entry, dir);
|
|
100
|
-
}
|
|
101
|
-
const topLevel = config.plugins ?? {};
|
|
102
|
-
for (const name of Object.keys(topLevel)) add(name, configDir);
|
|
103
|
-
for (const space of config.spaces) {
|
|
104
|
-
const fromDir = space.sourceDir ?? configDir;
|
|
105
|
-
const schemaPlugin = /^([^./][^/]*)\/./.exec(space.schema ?? "")?.[1];
|
|
106
|
-
if (schemaPlugin) add(schemaPlugin, fromDir);
|
|
107
|
-
for (const name of Object.keys(space.plugins ?? {})) add(name, fromDir);
|
|
108
|
-
}
|
|
109
|
-
return [...found];
|
|
110
|
-
}
|
|
111
|
-
function pluginDefinitionsDir(pluginDir) {
|
|
112
|
-
const pkgPath = join(pluginDir, "package.json");
|
|
113
|
-
if (existsSync(pkgPath)) {
|
|
114
|
-
const declared = JSON.parse(readFileSync(pkgPath, "utf8")).sctx?.mapViews;
|
|
115
|
-
if (typeof declared === "string") return resolve(pluginDir, declared);
|
|
116
|
-
}
|
|
117
|
-
return join(pluginDir, DEFINITIONS_DIR);
|
|
118
|
-
}
|
|
119
|
-
function assertIdNamespace(id, source, path) {
|
|
120
|
-
const segments = id.slice(16).split("/");
|
|
121
|
-
const expected = source.kind === "core" ? `${SCHEME}core/<name>` : source.kind === "plugin" ? `${SCHEME}${source.plugin}/<name>` : `${SCHEME}<name>`;
|
|
122
|
-
if (!(source.kind === "config" ? segments.length === 1 : segments.length === 2 && segments[0] === (source.kind === "core" ? "core" : source.plugin)) || source.kind === "plugin" && source.plugin === "core") throw new Error(`Map view namespace violation: ${path} has $id "${id}". Use the form "${expected}".`);
|
|
123
|
-
}
|
|
124
|
-
function isDirectory(path) {
|
|
125
|
-
return existsSync(path) && statSync(path).isDirectory();
|
|
126
|
-
}
|
|
127
|
-
//#endregion
|
|
128
|
-
export { readDefinitionFolders as n, fillPage as r, loadMapViewDefinitions as t };
|
|
129
|
-
|
|
130
|
-
//# sourceMappingURL=node-aizYAYlq.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"node-aizYAYlq.js","names":[],"sources":["../src/node/bundled-definitions.ts","../src/node/page.ts","../src/node/index.ts"],"sourcesContent":["// Generated by scripts/generate-definitions.ts from map-views/*.json5. Do not edit.\nexport const BUNDLED_DEFINITIONS: Record<string, string> = {\n \"strategy-tree.json5\": \"// Strategy stack as a tree: vision → mission → goals → opportunities → solutions → experiments.\\n{\\n $schema: 'https://raw.githubusercontent.com/mindsocket/structured-context-map-views/main/schemas/generated/latest/definition.json',\\n $id: 'sctx-map-view://core/strategy-tree',\\n title: 'Strategy tree',\\n schema: 'sctx://core/strategy_general',\\n parameters: {\\n orientation: { $ref: 'settings.json#/$defs/orientation', default: 'vertical' },\\n nodeStyle: { $ref: 'settings.json#/$defs/nodeStyle', default: 'card' },\\n validation: { $ref: 'settings.json#/$defs/validationLevel', default: 'off' },\\n cardFields: {\\n title: 'Card fields',\\n type: 'array',\\n items: { enum: ['status', 'priority', 'summary'] },\\n default: ['status'],\\n },\\n },\\n regions: [\\n {\\n id: 'main',\\n layout: { type: 'tree', orientation: { $param: 'orientation' } },\\n nodes: { style: { $param: 'nodeStyle' }, fields: { $param: 'cardFields' }, validation: { $param: 'validation' } },\\n edges: { show: true },\\n },\\n ],\\n}\\n\",\n};\n","import type { SpaceSnapshot } from '../core/snapshot';\n\nexport const PAGE_SLOTS = { title: '<!--sctx-title-->', snapshots: '<!--sctx-snapshots-->' } as const;\n\n/** `template` (`dist/page.html`) with the title and snapshots written in. */\nexport function fillPage(template: string, snapshots: SpaceSnapshot[], title: string): string {\n for (const slot of Object.values(PAGE_SLOTS)) {\n if (template.split(slot).length !== 2) throw new Error(`The page template must hold ${slot} exactly once.`);\n }\n // Escaping `<` stops a string in the data ending the script element\n const json = JSON.stringify(snapshots).replaceAll('<', '\\\\u003c');\n return template.replace(PAGE_SLOTS.title, () => escapeHtml(title)).replace(PAGE_SLOTS.snapshots, () => json);\n}\n\nfunction escapeHtml(text: string): string {\n return text.replaceAll('&', '&').replaceAll('<', '<').replaceAll('>', '>');\n}\n","/// <reference types=\"node\" />\nimport { existsSync, readdirSync, readFileSync, statSync } from 'node:fs';\nimport { join, resolve } from 'node:path';\nimport { type Config, PLUGIN_PREFIX, resolveConfigPath, resolvePluginDir, resourceDir } from 'structured-context/api';\nimport { type MapViewDefinition, parseMapViewDefinition } from '../core/definition';\nimport { BUNDLED_DEFINITIONS } from './bundled-definitions';\n\n/**\n * Node-only: finds map view definitions the way structured-context finds plugin schemas.\n * Browser-only hosts receive the result from a server, like graph data.\n */\n\nconst SCHEME = 'sctx-map-view://';\nconst DEFINITIONS_DIR = 'map-views';\nconst CONFIG_PLUGINS_DIR = 'plugins';\nconst PACKAGE_NAME = 'structured-context-map-views';\n\nexport type DefinitionSource = { kind: 'core' } | { kind: 'plugin'; plugin: string } | { kind: 'config' };\n\nexport type LoadMapViewDefinitionsOptions = {\n /** Root of the main config file (`resolveConfigPath().root`). Defaults to where structured-context finds it. */\n configDir?: string;\n};\n\n/**\n * Every map view definition available with `config`, from:\n * - this package's embedded definitions (`sctx-map-view://core/<name>`), for structured-context's bundled schemas;\n * - each plugin found from a config folder or named by a space (`sctx-map-view://<plugin>/<name>`): the\n * folder named by `\"sctx\": { \"mapViews\": \"…\" }` in its package.json, else its `map-views/` folder;\n * - the `map-views` resources folder of each config root (`sctx-map-view://<name>`).\n *\n * Each definition's `$id` must be in the namespace of where it was found, and ids must be unique.\n * Throws on the first invalid definition.\n */\nexport function loadMapViewDefinitions(\n config: Config,\n options: LoadMapViewDefinitionsOptions = {},\n): MapViewDefinition[] {\n const configDir = options.configDir ?? resolveConfigPath().root;\n const configDirs = [...new Set([configDir, ...config.spaces.flatMap((s) => (s.sourceDir ? [s.sourceDir] : []))])];\n\n const folders: { dir: string; source: DefinitionSource }[] = [\n ...pluginDirs(config, configDir, configDirs).flatMap(([plugin, dir]) => {\n const definitions = pluginDefinitionsDir(dir);\n return definitions ? [{ dir: definitions, source: { kind: 'plugin', plugin } as const }] : [];\n }),\n ...configDirs.flatMap((dir) => {\n const definitions = resourceDir(dir, DEFINITIONS_DIR);\n return definitions ? [{ dir: definitions, source: { kind: 'config' } as const }] : [];\n }),\n ];\n\n return readDefinitionFolders(folders);\n}\n\n/**\n * Definitions in `folders` and this package's embedded ones, each checked against the namespace of its source.\n * Throws on the first invalid definition or a repeated id.\n */\nexport function readDefinitionFolders(folders: { dir: string; source: DefinitionSource }[]): MapViewDefinition[] {\n const foundAt = new Map<string, string>();\n const definitions: MapViewDefinition[] = [];\n const add = (label: string, text: string, source: DefinitionSource) => {\n const definition = parseMapViewDefinition(label, text);\n assertIdNamespace(definition.id, source, label);\n const existing = foundAt.get(definition.id);\n if (existing) throw new Error(`Map view id \"${definition.id}\" is defined by both ${existing} and ${label}.`);\n foundAt.set(definition.id, label);\n definitions.push(definition);\n };\n\n for (const [file, text] of Object.entries(BUNDLED_DEFINITIONS))\n add(`${PACKAGE_NAME}/${file}`, text, { kind: 'core' });\n for (const { dir, source } of folders) {\n if (!isDirectory(dir)) continue;\n for (const file of readdirSync(dir)\n .filter((f) => f.endsWith('.json5'))\n .sort()) {\n const path = join(dir, file);\n add(path, readFileSync(path, 'utf8'), source);\n }\n }\n return definitions;\n}\n\n/** Plugin short name → root directory, for plugins in a config root's plugins folder or named by the config. */\nfunction pluginDirs(config: Config, configDir: string, configDirs: string[]): [string, string][] {\n const found = new Map<string, string>();\n const add = (name: string, fromDir: string) => {\n const short = name.startsWith(PLUGIN_PREFIX) ? name.slice(PLUGIN_PREFIX.length) : name;\n if (found.has(short)) return;\n const dir = resolvePluginDir(name, fromDir);\n if (dir) found.set(short, dir);\n };\n\n for (const dir of configDirs) {\n const plugins = resourceDir(dir, CONFIG_PLUGINS_DIR);\n if (!plugins) continue;\n for (const entry of readdirSync(plugins)\n .filter((e) => e.startsWith(PLUGIN_PREFIX))\n .sort())\n add(entry, dir);\n }\n const topLevel = (config as { plugins?: Record<string, unknown> }).plugins ?? {};\n for (const name of Object.keys(topLevel)) add(name, configDir);\n for (const space of config.spaces) {\n const fromDir = space.sourceDir ?? configDir;\n // A schema named through a plugin, e.g. \"sctx-wardley-mapping/wardley_map.json\".\n const schemaPlugin = /^([^./][^/]*)\\/./.exec(space.schema ?? '')?.[1];\n if (schemaPlugin) add(schemaPlugin, fromDir);\n for (const name of Object.keys(space.plugins ?? {})) add(name, fromDir);\n }\n return [...found];\n}\n\nfunction pluginDefinitionsDir(pluginDir: string): string | undefined {\n const pkgPath = join(pluginDir, 'package.json');\n if (existsSync(pkgPath)) {\n const declared = JSON.parse(readFileSync(pkgPath, 'utf8')).sctx?.mapViews;\n if (typeof declared === 'string') return resolve(pluginDir, declared);\n }\n return join(pluginDir, DEFINITIONS_DIR);\n}\n\nfunction assertIdNamespace(id: string, source: DefinitionSource, path: string): void {\n const segments = id.slice(SCHEME.length).split('/');\n const expected =\n source.kind === 'core'\n ? `${SCHEME}core/<name>`\n : source.kind === 'plugin'\n ? `${SCHEME}${source.plugin}/<name>`\n : `${SCHEME}<name>`;\n const ok =\n source.kind === 'config'\n ? segments.length === 1\n : segments.length === 2 && segments[0] === (source.kind === 'core' ? 'core' : source.plugin);\n if (!ok || (source.kind === 'plugin' && source.plugin === 'core')) {\n throw new Error(`Map view namespace violation: ${path} has $id \"${id}\". Use the form \"${expected}\".`);\n }\n}\n\nfunction isDirectory(path: string): boolean {\n return existsSync(path) && statSync(path).isDirectory();\n}\n\nexport { fillPage } from './page';\n"],"mappings":";;;;;AACA,IAAa,sBAA8C,EACzD,uBAAuB,8iCACzB;;;ACDA,IAAa,aAAa;CAAE,OAAO;CAAqB,WAAW;AAAwB;;AAG3F,SAAgB,SAAS,UAAkB,WAA4B,OAAuB;CAC5F,KAAK,MAAM,QAAQ,OAAO,OAAO,UAAU,GACzC,IAAI,SAAS,MAAM,IAAI,CAAC,CAAC,WAAW,GAAG,MAAM,IAAI,MAAM,+BAA+B,KAAK,eAAe;CAG5G,MAAM,OAAO,KAAK,UAAU,SAAS,CAAC,CAAC,WAAW,KAAK,SAAS;CAChE,OAAO,SAAS,QAAQ,WAAW,aAAa,WAAW,KAAK,CAAC,CAAC,CAAC,QAAQ,WAAW,iBAAiB,IAAI;AAC7G;AAEA,SAAS,WAAW,MAAsB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