structured-context-map-views 0.1.0 → 0.3.0

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 (45) hide show
  1. package/dist/ParameterControls-BsdG5GDk.js +1047 -0
  2. package/dist/ParameterControls-BsdG5GDk.js.map +1 -0
  3. package/dist/artifact.html +601 -0
  4. package/dist/artifact.js +237 -0
  5. package/dist/artifact.js.map +1 -0
  6. package/dist/cli.js +114 -0
  7. package/dist/cli.js.map +1 -0
  8. package/dist/{definition-KuPoA1mO.js → definition-Cft28YUA.js} +41 -7
  9. package/dist/definition-Cft28YUA.js.map +1 -0
  10. package/dist/index.js +3 -889
  11. package/dist/node-BceB0Wzc.js +106 -0
  12. package/dist/node-BceB0Wzc.js.map +1 -0
  13. package/dist/node.js +1 -105
  14. package/dist/styles.css +31 -0
  15. package/dist/types/artifact/load.d.ts +13 -0
  16. package/dist/types/artifact/main.d.ts +1 -0
  17. package/dist/types/core/annotations.d.ts +47 -0
  18. package/dist/types/core/definition.d.ts +6 -1
  19. package/dist/types/core/{schemas/definition.d.ts → format/definition-schema.d.ts} +18 -0
  20. package/dist/types/core/{schemas → format}/index.d.ts +33 -1
  21. package/dist/types/core/{schemas → format}/settings.d.ts +14 -0
  22. package/dist/types/index.d.ts +4 -1
  23. package/dist/types/layouts/EdgeOverlay.d.ts +1 -1
  24. package/dist/types/layouts/LandscapeLayout.d.ts +1 -1
  25. package/dist/types/layouts/MapView.d.ts +8 -2
  26. package/dist/types/layouts/NodeCard.d.ts +1 -1
  27. package/dist/types/layouts/ParameterControls.d.ts +3 -3
  28. package/dist/types/layouts/ParameterInputs.d.ts +21 -0
  29. package/dist/types/layouts/TreeLayout.d.ts +1 -1
  30. package/dist/types/layouts/XYLayout.d.ts +1 -1
  31. package/dist/types/layouts/annotations-context.d.ts +4 -0
  32. package/dist/types/layouts/useParameterControls.d.ts +13 -0
  33. package/dist/types/node/cli.d.ts +2 -0
  34. package/dist/types/node/index.d.ts +1 -1
  35. package/dist/types/node/snapshot.d.ts +20 -0
  36. package/package.json +8 -4
  37. package/dist/definition-KuPoA1mO.js.map +0 -1
  38. package/dist/index.js.map +0 -1
  39. package/dist/node.js.map +0 -1
  40. package/dist/types/core/index.d.ts +0 -6
  41. /package/dist/types/core/{schemas → format}/landscape-layout.d.ts +0 -0
  42. /package/dist/types/core/{schemas → format}/param-ref.d.ts +0 -0
  43. /package/dist/types/core/{schemas → format}/schema-url.d.ts +0 -0
  44. /package/dist/types/core/{schemas → format}/tree-layout.d.ts +0 -0
  45. /package/dist/types/core/{schemas → format}/xy-layout.d.ts +0 -0
@@ -0,0 +1,106 @@
1
+ import { r as parseMapViewDefinition } from "./definition-Cft28YUA.js";
2
+ import { existsSync, readFileSync, readdirSync, statSync } from "node:fs";
3
+ import { dirname, join, resolve } from "node:path";
4
+ import { PLUGIN_PREFIX, resolveConfigPath, resolvePluginDir } 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/index.ts
9
+ /**
10
+ * Node-only: finds map view definitions the way structured-context finds plugin schemas.
11
+ * Browser-only hosts receive the result from a server, like graph data.
12
+ */
13
+ var SCHEME = "sctx-map-view://";
14
+ var DEFINITIONS_DIR = "map-views";
15
+ var CONFIG_PLUGINS_DIR = "plugins";
16
+ var PACKAGE_NAME = "structured-context-map-views";
17
+ /**
18
+ * Every map view definition available with `config`, from:
19
+ * - this package's embedded definitions (`sctx-map-view://core/<name>`), for structured-context's bundled schemas;
20
+ * - each plugin found from a config folder or named by a space (`sctx-map-view://<plugin>/<name>`): the
21
+ * folder named by `"sctx": { "mapViews": "…" }` in its package.json, else its `map-views/` folder;
22
+ * - a `map-views/` folder next to each config file (`sctx-map-view://<name>`).
23
+ *
24
+ * Each definition's `$id` must be in the namespace of where it was found, and ids must be unique.
25
+ * Throws on the first invalid definition.
26
+ */
27
+ function loadMapViewDefinitions(config, options = {}) {
28
+ const configDir = options.configDir ?? dirname(resolve(resolveConfigPath().path));
29
+ const configDirs = [.../* @__PURE__ */ new Set([configDir, ...config.spaces.flatMap((s) => s.sourceDir ? [s.sourceDir] : [])])];
30
+ const folders = [...pluginDirs(config, configDir, configDirs).flatMap(([plugin, dir]) => {
31
+ const definitions = pluginDefinitionsDir(dir);
32
+ return definitions ? [{
33
+ dir: definitions,
34
+ source: {
35
+ kind: "plugin",
36
+ plugin
37
+ }
38
+ }] : [];
39
+ }), ...configDirs.map((dir) => ({
40
+ dir: join(dir, DEFINITIONS_DIR),
41
+ source: { kind: "config" }
42
+ }))];
43
+ const foundAt = /* @__PURE__ */ new Map();
44
+ const definitions = [];
45
+ const add = (label, text, source) => {
46
+ const definition = parseMapViewDefinition(label, text);
47
+ assertIdNamespace(definition.id, source, label);
48
+ const existing = foundAt.get(definition.id);
49
+ if (existing) throw new Error(`Map view id "${definition.id}" is defined by both ${existing} and ${label}.`);
50
+ foundAt.set(definition.id, label);
51
+ definitions.push(definition);
52
+ };
53
+ for (const [file, text] of Object.entries(BUNDLED_DEFINITIONS)) add(`${PACKAGE_NAME}/${file}`, text, { kind: "core" });
54
+ for (const { dir, source } of folders) {
55
+ if (!isDirectory(dir)) continue;
56
+ for (const file of readdirSync(dir).filter((f) => f.endsWith(".json5")).sort()) {
57
+ const path = join(dir, file);
58
+ add(path, readFileSync(path, "utf8"), source);
59
+ }
60
+ }
61
+ return definitions;
62
+ }
63
+ /** Plugin short name → root directory, for plugins in a config folder's `plugins/` or named by the config. */
64
+ function pluginDirs(config, configDir, configDirs) {
65
+ const found = /* @__PURE__ */ new Map();
66
+ const add = (name, fromDir) => {
67
+ const short = name.startsWith(PLUGIN_PREFIX) ? name.slice(PLUGIN_PREFIX.length) : name;
68
+ if (found.has(short)) return;
69
+ const dir = resolvePluginDir(name, fromDir);
70
+ if (dir) found.set(short, dir);
71
+ };
72
+ for (const dir of configDirs) {
73
+ const plugins = join(dir, CONFIG_PLUGINS_DIR);
74
+ if (!isDirectory(plugins)) continue;
75
+ for (const entry of readdirSync(plugins).filter((e) => e.startsWith(PLUGIN_PREFIX)).sort()) add(entry, dir);
76
+ }
77
+ const topLevel = config.plugins ?? {};
78
+ for (const name of Object.keys(topLevel)) add(name, configDir);
79
+ for (const space of config.spaces) {
80
+ const fromDir = space.sourceDir ?? configDir;
81
+ const schemaPlugin = /^([^./][^/]*)\/./.exec(space.schema ?? "")?.[1];
82
+ if (schemaPlugin) add(schemaPlugin, fromDir);
83
+ for (const name of Object.keys(space.plugins ?? {})) add(name, fromDir);
84
+ }
85
+ return [...found];
86
+ }
87
+ function pluginDefinitionsDir(pluginDir) {
88
+ const pkgPath = join(pluginDir, "package.json");
89
+ if (existsSync(pkgPath)) {
90
+ const declared = JSON.parse(readFileSync(pkgPath, "utf8")).sctx?.mapViews;
91
+ if (typeof declared === "string") return resolve(pluginDir, declared);
92
+ }
93
+ return join(pluginDir, DEFINITIONS_DIR);
94
+ }
95
+ function assertIdNamespace(id, source, path) {
96
+ const segments = id.slice(16).split("/");
97
+ const expected = source.kind === "core" ? `${SCHEME}core/<name>` : source.kind === "plugin" ? `${SCHEME}${source.plugin}/<name>` : `${SCHEME}<name>`;
98
+ 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}".`);
99
+ }
100
+ function isDirectory(path) {
101
+ return existsSync(path) && statSync(path).isDirectory();
102
+ }
103
+ //#endregion
104
+ export { loadMapViewDefinitions as t };
105
+
106
+ //# sourceMappingURL=node-BceB0Wzc.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"node-BceB0Wzc.js","names":[],"sources":["../src/node/bundled-definitions.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","/// <reference types=\"node\" />\nimport { existsSync, readdirSync, readFileSync, statSync } from 'node:fs';\nimport { dirname, join, resolve } from 'node:path';\nimport { type Config, PLUGIN_PREFIX, resolveConfigPath, resolvePluginDir } 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\ntype Source = { kind: 'core' } | { kind: 'plugin'; plugin: string } | { kind: 'config' };\n\nexport type LoadMapViewDefinitionsOptions = {\n /** Directory of the main config file. 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 * - a `map-views/` folder next to each config file (`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 ?? dirname(resolve(resolveConfigPath().path));\n const configDirs = [...new Set([configDir, ...config.spaces.flatMap((s) => (s.sourceDir ? [s.sourceDir] : []))])];\n\n const folders: { dir: string; source: Source }[] = [\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.map((dir) => ({ dir: join(dir, DEFINITIONS_DIR), source: { kind: 'config' } as const })),\n ];\n\n const foundAt = new Map<string, string>();\n const definitions: MapViewDefinition[] = [];\n const add = (label: string, text: string, source: Source) => {\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 folder's `plugins/` 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 = join(dir, CONFIG_PLUGINS_DIR);\n if (!isDirectory(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: Source, 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":"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"}
package/dist/node.js CHANGED
@@ -1,106 +1,2 @@
1
- import { r as parseMapViewDefinition } from "./definition-KuPoA1mO.js";
2
- import { existsSync, readFileSync, readdirSync, statSync } from "node:fs";
3
- import { dirname, join, resolve } from "node:path";
4
- import { PLUGIN_PREFIX, resolveConfigPath, resolvePluginDir } 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 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' } },\n edges: { show: true },\n },\n ],\n}\n" };
7
- //#endregion
8
- //#region src/node/index.ts
9
- /**
10
- * Node-only: finds map view definitions the way structured-context finds plugin schemas.
11
- * Browser-only hosts receive the result from a server, like graph data.
12
- */
13
- var SCHEME = "sctx-map-view://";
14
- var DEFINITIONS_DIR = "map-views";
15
- var CONFIG_PLUGINS_DIR = "plugins";
16
- var PACKAGE_NAME = "structured-context-map-views";
17
- /**
18
- * Every map view definition available with `config`, from:
19
- * - this package's embedded definitions (`sctx-map-view://core/<name>`), for structured-context's bundled schemas;
20
- * - each plugin found from a config folder or named by a space (`sctx-map-view://<plugin>/<name>`): the
21
- * folder named by `"sctx": { "mapViews": "…" }` in its package.json, else its `map-views/` folder;
22
- * - a `map-views/` folder next to each config file (`sctx-map-view://<name>`).
23
- *
24
- * Each definition's `$id` must be in the namespace of where it was found, and ids must be unique.
25
- * Throws on the first invalid definition.
26
- */
27
- function loadMapViewDefinitions(config, options = {}) {
28
- const configDir = options.configDir ?? dirname(resolve(resolveConfigPath().path));
29
- const configDirs = [.../* @__PURE__ */ new Set([configDir, ...config.spaces.flatMap((s) => s.sourceDir ? [s.sourceDir] : [])])];
30
- const folders = [...pluginDirs(config, configDir, configDirs).flatMap(([plugin, dir]) => {
31
- const definitions = pluginDefinitionsDir(dir);
32
- return definitions ? [{
33
- dir: definitions,
34
- source: {
35
- kind: "plugin",
36
- plugin
37
- }
38
- }] : [];
39
- }), ...configDirs.map((dir) => ({
40
- dir: join(dir, DEFINITIONS_DIR),
41
- source: { kind: "config" }
42
- }))];
43
- const foundAt = /* @__PURE__ */ new Map();
44
- const definitions = [];
45
- const add = (label, text, source) => {
46
- const definition = parseMapViewDefinition(label, text);
47
- assertIdNamespace(definition.id, source, label);
48
- const existing = foundAt.get(definition.id);
49
- if (existing) throw new Error(`Map view id "${definition.id}" is defined by both ${existing} and ${label}.`);
50
- foundAt.set(definition.id, label);
51
- definitions.push(definition);
52
- };
53
- for (const [file, text] of Object.entries(BUNDLED_DEFINITIONS)) add(`${PACKAGE_NAME}/${file}`, text, { kind: "core" });
54
- for (const { dir, source } of folders) {
55
- if (!isDirectory(dir)) continue;
56
- for (const file of readdirSync(dir).filter((f) => f.endsWith(".json5")).sort()) {
57
- const path = join(dir, file);
58
- add(path, readFileSync(path, "utf8"), source);
59
- }
60
- }
61
- return definitions;
62
- }
63
- /** Plugin short name → root directory, for plugins in a config folder's `plugins/` or named by the config. */
64
- function pluginDirs(config, configDir, configDirs) {
65
- const found = /* @__PURE__ */ new Map();
66
- const add = (name, fromDir) => {
67
- const short = name.startsWith(PLUGIN_PREFIX) ? name.slice(PLUGIN_PREFIX.length) : name;
68
- if (found.has(short)) return;
69
- const dir = resolvePluginDir(name, fromDir);
70
- if (dir) found.set(short, dir);
71
- };
72
- for (const dir of configDirs) {
73
- const plugins = join(dir, CONFIG_PLUGINS_DIR);
74
- if (!isDirectory(plugins)) continue;
75
- for (const entry of readdirSync(plugins).filter((e) => e.startsWith(PLUGIN_PREFIX)).sort()) add(entry, dir);
76
- }
77
- const topLevel = config.plugins ?? {};
78
- for (const name of Object.keys(topLevel)) add(name, configDir);
79
- for (const space of config.spaces) {
80
- const fromDir = space.sourceDir ?? configDir;
81
- const schemaPlugin = /^([^./][^/]*)\/./.exec(space.schema ?? "")?.[1];
82
- if (schemaPlugin) add(schemaPlugin, fromDir);
83
- for (const name of Object.keys(space.plugins ?? {})) add(name, fromDir);
84
- }
85
- return [...found];
86
- }
87
- function pluginDefinitionsDir(pluginDir) {
88
- const pkgPath = join(pluginDir, "package.json");
89
- if (existsSync(pkgPath)) {
90
- const declared = JSON.parse(readFileSync(pkgPath, "utf8")).sctx?.mapViews;
91
- if (typeof declared === "string") return resolve(pluginDir, declared);
92
- }
93
- return join(pluginDir, DEFINITIONS_DIR);
94
- }
95
- function assertIdNamespace(id, source, path) {
96
- const segments = id.slice(16).split("/");
97
- const expected = source.kind === "core" ? `${SCHEME}core/<name>` : source.kind === "plugin" ? `${SCHEME}${source.plugin}/<name>` : `${SCHEME}<name>`;
98
- 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}".`);
99
- }
100
- function isDirectory(path) {
101
- return existsSync(path) && statSync(path).isDirectory();
102
- }
103
- //#endregion
1
+ import { t as loadMapViewDefinitions } from "./node-BceB0Wzc.js";
104
2
  export { loadMapViewDefinitions };
105
-
106
- //# sourceMappingURL=node.js.map
package/dist/styles.css CHANGED
@@ -2,6 +2,7 @@
2
2
  @layer properties;
3
3
  @layer theme {
4
4
  :root, :host {
5
+ --mv-color-white: #fff;
5
6
  --mv-spacing: 0.25rem;
6
7
  --mv-text-xs: 0.75rem;
7
8
  --mv-text-xs--line-height: calc(1 / 0.75);
@@ -19,6 +20,9 @@
19
20
  --mv-color-muted: #59636e;
20
21
  --mv-color-edge: #d1d9e0;
21
22
  --mv-color-accent: #0969da;
23
+ --mv-color-error: #cf222e;
24
+ --mv-color-warning: #9a6700;
25
+ --mv-color-info: #0969da;
22
26
  }
23
27
  }
24
28
  .mv\:pointer-events-none {
@@ -36,6 +40,12 @@
36
40
  .mv\:inset-8 {
37
41
  inset: calc(var(--mv-spacing) * 8);
38
42
  }
43
+ .mv\:-top-1\.5 {
44
+ top: calc(var(--mv-spacing) * -1.5);
45
+ }
46
+ .mv\:-right-1\.5 {
47
+ right: calc(var(--mv-spacing) * -1.5);
48
+ }
39
49
  .mv\:float-left {
40
50
  float: left;
41
51
  }
@@ -64,6 +74,9 @@
64
74
  width: calc(var(--mv-spacing) * 6);
65
75
  height: calc(var(--mv-spacing) * 6);
66
76
  }
77
+ .mv\:h-4 {
78
+ height: calc(var(--mv-spacing) * 4);
79
+ }
67
80
  .mv\:h-full {
68
81
  height: 100%;
69
82
  }
@@ -88,6 +101,9 @@
88
101
  .mv\:max-w-\[36rem\] {
89
102
  max-width: 36rem;
90
103
  }
104
+ .mv\:min-w-4 {
105
+ min-width: calc(var(--mv-spacing) * 4);
106
+ }
91
107
  .mv\:min-w-\[36rem\] {
92
108
  min-width: 36rem;
93
109
  }
@@ -241,6 +257,12 @@
241
257
  .mv\:bg-card {
242
258
  background-color: var(--mv-color-card);
243
259
  }
260
+ .mv\:bg-error {
261
+ background-color: var(--mv-color-error);
262
+ }
263
+ .mv\:bg-info {
264
+ background-color: var(--mv-color-info);
265
+ }
244
266
  .mv\:bg-surface {
245
267
  background-color: var(--mv-color-surface);
246
268
  }
@@ -250,6 +272,9 @@
250
272
  background-color: color-mix(in oklab, var(--mv-color-surface) 80%, transparent);
251
273
  }
252
274
  }
275
+ .mv\:bg-warning {
276
+ background-color: var(--mv-color-warning);
277
+ }
253
278
  .mv\:fill-none {
254
279
  fill: none;
255
280
  }
@@ -309,6 +334,9 @@
309
334
  font-size: var(--mv-text-xs);
310
335
  line-height: var(--tw-leading, var(--mv-text-xs--line-height));
311
336
  }
337
+ .mv\:text-\[0\.6rem\] {
338
+ font-size: 0.6rem;
339
+ }
312
340
  .mv\:text-\[0\.65rem\] {
313
341
  font-size: 0.65rem;
314
342
  }
@@ -337,6 +365,9 @@
337
365
  .mv\:text-muted {
338
366
  color: var(--mv-color-muted);
339
367
  }
368
+ .mv\:text-white {
369
+ color: var(--mv-color-white);
370
+ }
340
371
  .mv\:uppercase {
341
372
  text-transform: uppercase;
342
373
  }
@@ -0,0 +1,13 @@
1
+ import type { spaceGraphFrom } from 'structured-context/browser';
2
+ import type { ValidationInput } from '../core/annotations';
3
+ import type { MapViewDefinition } from '../core/definition';
4
+ /** A space as the artifact's db holds it: the `export` command's document with its parts as JSON strings. */
5
+ export type LoadedSpace = {
6
+ name: string;
7
+ schemaId: string | undefined;
8
+ graph: Parameters<typeof spaceGraphFrom>[0];
9
+ validation: ValidationInput;
10
+ definitions: MapViewDefinition[];
11
+ };
12
+ /** Every space written to the artifact's `spaces` collection. Rejects with a message fit to show the viewer. */
13
+ export declare function loadSpaces(): Promise<LoadedSpace[]>;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,47 @@
1
+ import type { RuleSeverity, SourceLocation, SpaceGraph, SpaceNode, ValidationResult } from 'structured-context/api';
2
+ type NodeId = SpaceNode['id'];
3
+ /** How serious a result is: structured-context's rule severity. Schema and hierarchy failures are errors. */
4
+ export type Severity = RuleSeverity;
5
+ /** The kind of check a result came from. */
6
+ export type AnnotationSource = 'schema' | 'hierarchy' | 'rule';
7
+ /** One validation result attached to a node. */
8
+ export type NodeAnnotation = {
9
+ severity: Severity;
10
+ source: AnnotationSource;
11
+ message: string;
12
+ /** The violated rule, for `rule` results. */
13
+ ruleId?: string;
14
+ };
15
+ /** A validation result with no node on the map to attach to. */
16
+ export type UnattachedAnnotation = NodeAnnotation & {
17
+ /** The node it concerns. Absent for a global-scope rule. A node that failed its schema isn't in the graph. */
18
+ nodeId?: NodeId;
19
+ /** Where that node is defined, if known. */
20
+ location?: SourceLocation;
21
+ };
22
+ /** Annotations by the id of the node they apply to. */
23
+ export type AnnotationIndex = ReadonlyMap<NodeId, readonly NodeAnnotation[]>;
24
+ /**
25
+ * The parts of structured-context's `ValidationResult` that attach to a node. Every part is optional:
26
+ * a host that only runs some checks (the Obsidian plugin runs no AI-judged rules, say) passes what it has.
27
+ */
28
+ export type ValidationInput = Partial<Pick<ValidationResult, 'ruleViolations' | 'hierarchyViolations'> & {
29
+ nodeErrors: ReadonlyArray<Pick<ValidationResult['nodeErrors'][number], 'nodeId' | 'source' | 'issues'>>;
30
+ }>;
31
+ /**
32
+ * Attach validation results to the nodes of `graph`, by node id. Results that can't be attached are
33
+ * returned in `unattached` for the host to surface: global-scope rules (no node), and nodes that
34
+ * aren't in the graph, which includes every node that failed its schema.
35
+ */
36
+ export declare function annotationsFrom(input: ValidationInput, graph: SpaceGraph): {
37
+ annotations: AnnotationIndex;
38
+ unattached: UnattachedAnnotation[];
39
+ };
40
+ /** The most serious severity among annotations, or undefined if there are none. */
41
+ export declare function worstSeverity(annotations: readonly NodeAnnotation[]): Severity | undefined;
42
+ /**
43
+ * The annotations a map view shows: those at `level` or more serious, from `sources`. `off` shows none.
44
+ * Nodes left with no annotations are dropped from the index.
45
+ */
46
+ export declare function filterAnnotations(index: AnnotationIndex, level: Severity | 'off', sources: readonly AnnotationSource[]): AnnotationIndex;
47
+ export {};
@@ -1,5 +1,5 @@
1
1
  import type { FromSchema } from 'json-schema-to-ts';
2
- import { definitionSchema, type landscapeLayoutSchema, MAP_VIEW_SCHEMAS, type settingsSchema, type treeLayoutSchema, type xyLayoutSchema } from './schemas';
2
+ import { definitionSchema, type landscapeLayoutSchema, MAP_VIEW_SCHEMAS, type settingsSchema, type treeLayoutSchema, type xyLayoutSchema } from './format';
3
3
  export { MAP_VIEW_SCHEMAS };
4
4
  type References = {
5
5
  references: [
@@ -108,5 +108,10 @@ export declare function resolveRegions(definition: MapViewDefinition, values?: P
108
108
  * `structured-context/api`, imports Node built-ins). That's fine while only the first region renders.
109
109
  */
110
110
  export declare function selectionFilter(definition: MapViewDefinition, values?: ParameterValues): string | undefined;
111
+ /**
112
+ * The lowest severity of validation result the map view shows on nodes, or `off`. Hosts check it to
113
+ * decide whether to run validation at all, since results are only drawn when this isn't `off`.
114
+ */
115
+ export declare function viewValidationLevel(definition: MapViewDefinition, values?: ParameterValues): NodesConfig['validation'];
111
116
  /** Map view definitions that apply to a space with the given schema. */
112
117
  export declare function mapViewsForSchema(definitions: readonly MapViewDefinition[], schemaId: string | undefined): MapViewDefinition[];
@@ -138,6 +138,24 @@ export declare const definitionSchema: {
138
138
  readonly $ref: "https://raw.githubusercontent.com/mindsocket/structured-context-map-views/main/schemas/generated/latest/definition.json#/$defs/paramRef";
139
139
  }];
140
140
  };
141
+ readonly validation: {
142
+ readonly description: string;
143
+ readonly default: "off";
144
+ readonly anyOf: readonly [{
145
+ readonly $ref: "https://raw.githubusercontent.com/mindsocket/structured-context-map-views/main/schemas/generated/latest/settings.json#/$defs/validationLevel";
146
+ }, {
147
+ readonly $ref: "https://raw.githubusercontent.com/mindsocket/structured-context-map-views/main/schemas/generated/latest/definition.json#/$defs/paramRef";
148
+ }];
149
+ };
150
+ readonly validationSources: {
151
+ readonly description: string;
152
+ readonly default: readonly ["schema", "hierarchy", "rule"];
153
+ readonly anyOf: readonly [{
154
+ readonly $ref: "https://raw.githubusercontent.com/mindsocket/structured-context-map-views/main/schemas/generated/latest/settings.json#/$defs/validationSources";
155
+ }, {
156
+ readonly $ref: "https://raw.githubusercontent.com/mindsocket/structured-context-map-views/main/schemas/generated/latest/definition.json#/$defs/paramRef";
157
+ }];
158
+ };
141
159
  };
142
160
  };
143
161
  readonly edges: {
@@ -1,4 +1,4 @@
1
- import { definitionSchema } from './definition';
1
+ import { definitionSchema } from './definition-schema';
2
2
  import { landscapeLayoutSchema } from './landscape-layout';
3
3
  import { settingsSchema } from './settings';
4
4
  import { treeLayoutSchema } from './tree-layout';
@@ -139,6 +139,24 @@ export declare const MAP_VIEW_SCHEMAS: readonly [{
139
139
  readonly $ref: "https://raw.githubusercontent.com/mindsocket/structured-context-map-views/main/schemas/generated/latest/definition.json#/$defs/paramRef";
140
140
  }];
141
141
  };
142
+ readonly validation: {
143
+ readonly description: string;
144
+ readonly default: "off";
145
+ readonly anyOf: readonly [{
146
+ readonly $ref: "https://raw.githubusercontent.com/mindsocket/structured-context-map-views/main/schemas/generated/latest/settings.json#/$defs/validationLevel";
147
+ }, {
148
+ readonly $ref: "https://raw.githubusercontent.com/mindsocket/structured-context-map-views/main/schemas/generated/latest/definition.json#/$defs/paramRef";
149
+ }];
150
+ };
151
+ readonly validationSources: {
152
+ readonly description: string;
153
+ readonly default: readonly ["schema", "hierarchy", "rule"];
154
+ readonly anyOf: readonly [{
155
+ readonly $ref: "https://raw.githubusercontent.com/mindsocket/structured-context-map-views/main/schemas/generated/latest/settings.json#/$defs/validationSources";
156
+ }, {
157
+ readonly $ref: "https://raw.githubusercontent.com/mindsocket/structured-context-map-views/main/schemas/generated/latest/definition.json#/$defs/paramRef";
158
+ }];
159
+ };
142
160
  };
143
161
  };
144
162
  readonly edges: {
@@ -175,6 +193,20 @@ export declare const MAP_VIEW_SCHEMAS: readonly [{
175
193
  readonly description: 'card: a box with the title and selected fields. shape: a compact marker with a tooltip.';
176
194
  readonly enum: readonly ['card', 'shape'];
177
195
  };
196
+ readonly validationLevel: {
197
+ readonly title: 'Validation overlay';
198
+ readonly description: 'The lowest severity of validation result shown on nodes, or off. error: only errors. warning: errors and warnings. info: everything.';
199
+ readonly enum: readonly ['off', 'error', 'warning', 'info'];
200
+ };
201
+ readonly validationSources: {
202
+ readonly title: 'Validation sources';
203
+ readonly description: 'Which kinds of validation result are shown. schema: a node failing its schema. hierarchy: a node under a parent type it is not allowed under. rule: a schema rule violation.';
204
+ readonly type: 'array';
205
+ readonly items: {
206
+ readonly enum: readonly ['schema', 'hierarchy', 'rule'];
207
+ };
208
+ readonly uniqueItems: true;
209
+ };
178
210
  readonly fieldList: {
179
211
  readonly title: 'Fields';
180
212
  readonly type: 'array';
@@ -14,6 +14,20 @@ export declare const settingsSchema: {
14
14
  readonly description: 'card: a box with the title and selected fields. shape: a compact marker with a tooltip.';
15
15
  readonly enum: readonly ['card', 'shape'];
16
16
  };
17
+ readonly validationLevel: {
18
+ readonly title: 'Validation overlay';
19
+ readonly description: 'The lowest severity of validation result shown on nodes, or off. error: only errors. warning: errors and warnings. info: everything.';
20
+ readonly enum: readonly ['off', 'error', 'warning', 'info'];
21
+ };
22
+ readonly validationSources: {
23
+ readonly title: 'Validation sources';
24
+ readonly description: 'Which kinds of validation result are shown. schema: a node failing its schema. hierarchy: a node under a parent type it is not allowed under. rule: a schema rule violation.';
25
+ readonly type: 'array';
26
+ readonly items: {
27
+ readonly enum: readonly ['schema', 'hierarchy', 'rule'];
28
+ };
29
+ readonly uniqueItems: true;
30
+ };
17
31
  readonly fieldList: {
18
32
  readonly title: 'Fields';
19
33
  readonly type: 'array';
@@ -2,6 +2,9 @@
2
2
  * The package's public surface. Everything else (layouts, node cards, the edge overlay, the projections)
3
3
  * is internal; add an export here when a host needs it.
4
4
  */
5
- export { MAP_VIEW_SCHEMAS, type MapViewDefinition, MapViewDefinitionError, mapViewsForSchema, type ParameterValues, parseMapViewDefinition, resolveParameterValues, selectionFilter, } from './core';
5
+ export { type AnnotationIndex, type AnnotationSource, annotationsFrom, type NodeAnnotation, type Severity, type UnattachedAnnotation, type ValidationInput, worstSeverity, } from './core/annotations';
6
+ export { MAP_VIEW_SCHEMAS, type MapViewDefinition, MapViewDefinitionError, mapViewsForSchema, type Parameter, type ParameterControl, type ParameterValues, parseMapViewDefinition, resolveParameterValues, selectionFilter, viewValidationLevel, } from './core/definition';
6
7
  export { MapView } from './layouts/MapView';
7
8
  export { ParameterControls } from './layouts/ParameterControls';
9
+ export { MultiSelectParameterInput, ParameterInput, SelectParameterInput, ToggleParameterInput, } from './layouts/ParameterInputs';
10
+ export { type ParameterControlState, useParameterControls } from './layouts/useParameterControls';
@@ -1,4 +1,4 @@
1
- import type { Orientation } from '../core';
1
+ import type { Orientation } from '../core/definition';
2
2
  /**
3
3
  * A connector between two occurrences. `cross` links (e.g. extra parents) are drawn dashed.
4
4
  * `id` tells apart several links between the same occurrences; straight links between the same
@@ -1,4 +1,4 @@
1
- import { type LandscapeLayoutConfig } from '../core';
1
+ import type { LandscapeLayoutConfig } from '../core/definition';
2
2
  import type { LayoutProps } from './TreeLayout';
3
3
  /**
4
4
  * Nested containers following the layout's grouping levels; the last level is drawn as nodes.
@@ -1,12 +1,18 @@
1
1
  import type { SpaceGraph, SpaceNode } from 'structured-context/api';
2
- import { type MapViewDefinition, type ParameterValues } from '../core';
2
+ import { type AnnotationIndex } from '../core/annotations';
3
+ import { type MapViewDefinition, type ParameterValues } from '../core/definition';
3
4
  type Props = {
4
5
  definition: MapViewDefinition;
5
6
  graph: SpaceGraph;
6
7
  /** Current parameter values (host-owned session state); missing values use defaults. */
7
8
  values?: ParameterValues;
9
+ /**
10
+ * Validation results by node (see `annotationsFrom`). Which of them show, and at what severity, is
11
+ * the region's `nodes.validation` setting; with none supplied, nothing is drawn.
12
+ */
13
+ annotations?: AnnotationIndex;
8
14
  onNodeSelect?: (node: SpaceNode) => void;
9
15
  };
10
16
  /** Renders a map view definition against a space. Sizes to its container and scrolls within it. */
11
- export declare function MapView({ definition, graph, values, onNodeSelect }: Props): import("react").JSX.Element;
17
+ export declare function MapView({ definition, graph, values, annotations, onNodeSelect }: Props): import("react").JSX.Element;
12
18
  export {};
@@ -1,5 +1,5 @@
1
1
  import type { SpaceNode } from 'structured-context/api';
2
- import type { NodesConfig } from '../core';
2
+ import type { NodesConfig } from '../core/definition';
3
3
  type Props = {
4
4
  node: SpaceNode;
5
5
  /** The node's subtree is rendered at another occurrence. */
@@ -1,4 +1,4 @@
1
- import { type MapViewDefinition, type ParameterValues } from '../core';
1
+ import type { MapViewDefinition, ParameterValues } from '../core/definition';
2
2
  type Props = {
3
3
  definition: MapViewDefinition;
4
4
  /** Host-owned values; missing or stale ones show as the default, matching what renders. */
@@ -6,8 +6,8 @@ type Props = {
6
6
  onChange: (name: string, value: unknown) => void;
7
7
  };
8
8
  /**
9
- * Controls generated from a map view's declared parameters. Hosts own the values (session
10
- * state) and decide where the controls go.
9
+ * Default layout for a map view's parameter controls: a wrapping row. Hosts wanting their own layout
10
+ * use `useParameterControls` with `ParameterInput` (or the typed inputs) instead.
11
11
  */
12
12
  export declare function ParameterControls({ definition, values, onChange }: Props): import("react").JSX.Element | null;
13
13
  export {};
@@ -0,0 +1,21 @@
1
+ import type { Parameter, ParameterControl } from '../core/definition';
2
+ type InputProps<Kind extends ParameterControl['kind']> = {
3
+ parameter: Parameter & {
4
+ control: Extract<ParameterControl, {
5
+ kind: Kind;
6
+ }>;
7
+ };
8
+ value: unknown;
9
+ onChange: (value: unknown) => void;
10
+ };
11
+ /** A checkbox for a boolean parameter, labelled with the parameter's title. */
12
+ export declare function ToggleParameterInput({ parameter, value, onChange }: InputProps<'toggle'>): import("react").JSX.Element;
13
+ /** A dropdown for a parameter with one of several options. */
14
+ export declare function SelectParameterInput({ parameter, value, onChange }: InputProps<'select'>): import("react").JSX.Element;
15
+ /** A checkbox group for a parameter taking any subset of its options. */
16
+ export declare function MultiSelectParameterInput({ parameter, value, onChange }: InputProps<'multiselect'>): import("react").JSX.Element;
17
+ /** The input matching a parameter's control kind. */
18
+ export declare function ParameterInput({ parameter, value, onChange, }: Omit<InputProps<ParameterControl['kind']>, 'parameter'> & {
19
+ parameter: Parameter;
20
+ }): import("react").JSX.Element;
21
+ export {};
@@ -1,5 +1,5 @@
1
1
  import type { SpaceGraph, SpaceNode } from 'structured-context/api';
2
- import { type LayoutConfig, type Region, type TreeLayoutConfig } from '../core';
2
+ import type { LayoutConfig, Region, TreeLayoutConfig } from '../core/definition';
3
3
  export type LayoutProps<L extends LayoutConfig = LayoutConfig> = {
4
4
  graph: SpaceGraph;
5
5
  /** The region with parameter values applied, narrowed to the layout's own settings. */
@@ -1,4 +1,4 @@
1
- import { type XYLayoutConfig } from '../core';
1
+ import type { XYLayoutConfig } from '../core/definition';
2
2
  import type { LayoutProps } from './TreeLayout';
3
3
  /**
4
4
  * Nodes positioned by two numeric fields, with straight connectors between them. Positions are
@@ -0,0 +1,4 @@
1
+ import type { AnnotationIndex } from '../core/annotations';
2
+ /** The annotations a map view shows, already narrowed by its validation settings. Read by node cards. */
3
+ export declare const AnnotationsContext: import("react").Context<AnnotationIndex>;
4
+ export declare const useAnnotations: () => AnnotationIndex;