structured-context-map-views 0.0.0-stage → 0.2.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 (38) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +19 -2
  3. package/dist/definition-Cft28YUA.js +616 -0
  4. package/dist/definition-Cft28YUA.js.map +1 -0
  5. package/dist/index.js +1045 -0
  6. package/dist/index.js.map +1 -0
  7. package/dist/node.js +106 -0
  8. package/dist/node.js.map +1 -0
  9. package/dist/styles.css +528 -0
  10. package/dist/types/core/annotations.d.ts +47 -0
  11. package/dist/types/core/definition.d.ts +117 -0
  12. package/dist/types/core/format/definition-schema.d.ts +181 -0
  13. package/dist/types/core/format/index.d.ts +450 -0
  14. package/dist/types/core/format/landscape-layout.d.ts +102 -0
  15. package/dist/types/core/format/param-ref.d.ts +10 -0
  16. package/dist/types/core/format/schema-url.d.ts +7 -0
  17. package/dist/types/core/format/settings.d.ts +41 -0
  18. package/dist/types/core/format/tree-layout.d.ts +40 -0
  19. package/dist/types/core/format/xy-layout.d.ts +94 -0
  20. package/dist/types/core/graph.d.ts +16 -0
  21. package/dist/types/core/landscape.d.ts +44 -0
  22. package/dist/types/core/occurrence.d.ts +11 -0
  23. package/dist/types/core/tree.d.ts +45 -0
  24. package/dist/types/core/xy.d.ts +43 -0
  25. package/dist/types/index.d.ts +10 -0
  26. package/dist/types/layouts/EdgeOverlay.d.ts +36 -0
  27. package/dist/types/layouts/LandscapeLayout.d.ts +8 -0
  28. package/dist/types/layouts/MapView.d.ts +18 -0
  29. package/dist/types/layouts/NodeCard.d.ts +16 -0
  30. package/dist/types/layouts/ParameterControls.d.ts +13 -0
  31. package/dist/types/layouts/ParameterInputs.d.ts +21 -0
  32. package/dist/types/layouts/TreeLayout.d.ts +16 -0
  33. package/dist/types/layouts/XYLayout.d.ts +9 -0
  34. package/dist/types/layouts/annotations-context.d.ts +4 -0
  35. package/dist/types/layouts/useParameterControls.d.ts +13 -0
  36. package/dist/types/node/bundled-definitions.d.ts +1 -0
  37. package/dist/types/node/index.d.ts +17 -0
  38. package/package.json +69 -4
@@ -0,0 +1,13 @@
1
+ import { type MapViewDefinition, type Parameter, type ParameterValues } from '../core/definition';
2
+ /** One parameter with its current value and a setter, ready for a host to lay out. */
3
+ export type ParameterControlState = {
4
+ parameter: Parameter;
5
+ /** The value in effect: the host's value, else the default, matching what renders. */
6
+ value: unknown;
7
+ setValue: (value: unknown) => void;
8
+ };
9
+ /**
10
+ * The state behind a map view's parameter controls, with no markup, for hosts that lay the controls
11
+ * out themselves. Pair each entry with `ParameterInput`, or with one of the typed inputs.
12
+ */
13
+ export declare function useParameterControls(definition: MapViewDefinition, values: ParameterValues, onChange: (name: string, value: unknown) => void): ParameterControlState[];
@@ -0,0 +1 @@
1
+ export declare const BUNDLED_DEFINITIONS: Record<string, string>;
@@ -0,0 +1,17 @@
1
+ import { type Config } from 'structured-context/api';
2
+ import { type MapViewDefinition } from '../core/definition';
3
+ export type LoadMapViewDefinitionsOptions = {
4
+ /** Directory of the main config file. Defaults to where structured-context finds it. */
5
+ configDir?: string;
6
+ };
7
+ /**
8
+ * Every map view definition available with `config`, from:
9
+ * - this package's embedded definitions (`sctx-map-view://core/<name>`), for structured-context's bundled schemas;
10
+ * - each plugin found from a config folder or named by a space (`sctx-map-view://<plugin>/<name>`): the
11
+ * folder named by `"sctx": { "mapViews": "…" }` in its package.json, else its `map-views/` folder;
12
+ * - a `map-views/` folder next to each config file (`sctx-map-view://<name>`).
13
+ *
14
+ * Each definition's `$id` must be in the namespace of where it was found, and ids must be unique.
15
+ * Throws on the first invalid definition.
16
+ */
17
+ export declare function loadMapViewDefinitions(config: Config, options?: LoadMapViewDefinitionsOptions): MapViewDefinition[];
package/package.json CHANGED
@@ -1,6 +1,71 @@
1
1
  {
2
2
  "name": "structured-context-map-views",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.2.0",
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
+ "license": "MIT",
6
+ "type": "module",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "git+https://github.com/mindsocket/structured-context-map-views.git",
10
+ "directory": "packages/map-views"
11
+ },
12
+ "homepage": "https://github.com/mindsocket/structured-context-map-views#readme",
13
+ "bugs": "https://github.com/mindsocket/structured-context-map-views/issues",
14
+ "keywords": [
15
+ "structured-context",
16
+ "visualisation",
17
+ "map-view",
18
+ "react"
19
+ ],
20
+ "files": [
21
+ "dist/"
22
+ ],
23
+ "sideEffects": false,
24
+ "exports": {
25
+ ".": {
26
+ "types": "./dist/types/index.d.ts",
27
+ "default": "./dist/index.js"
28
+ },
29
+ "./node": {
30
+ "types": "./dist/types/node/index.d.ts",
31
+ "default": "./dist/node.js"
32
+ },
33
+ "./styles.css": "./dist/styles.css"
34
+ },
35
+ "scripts": {
36
+ "clean": "rm -rf dist",
37
+ "generate": "bun run generate:schemas && bun run generate:definitions",
38
+ "generate:schemas": "bun scripts/generate-schemas.ts",
39
+ "generate:definitions": "bun scripts/generate-definitions.ts",
40
+ "build": "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",
41
+ "typecheck": "tsc --noEmit",
42
+ "capture-fixtures": "bun scripts/capture-fixtures.ts",
43
+ "test": "bun test",
44
+ "test:package": "bash scripts/test-package.sh",
45
+ "prepublishOnly": "bun run build",
46
+ "preversion": "bun run generate && bun run --cwd ../.. lint:fix && bun run --cwd ../.. test && bun run test:package",
47
+ "version": "bun run generate:schemas --release && git add -A"
48
+ },
49
+ "peerDependencies": {
50
+ "react": "^19.3.0",
51
+ "react-dom": "^19.3.0",
52
+ "structured-context": "^0.19.0"
53
+ },
54
+ "dependencies": {
55
+ "ajv": "^8.20.0",
56
+ "json-schema-to-ts": "^3.1.1",
57
+ "json5": "^2.2.3"
58
+ },
59
+ "devDependencies": {
60
+ "@tailwindcss/cli": "^4.3.3",
61
+ "@types/node": "^22.20.5",
62
+ "@types/react": "^19.3.0",
63
+ "@types/react-dom": "^19.3.0",
64
+ "@vitejs/plugin-react": "^6.1.1",
65
+ "react": "^19.3.0",
66
+ "react-dom": "^19.3.0",
67
+ "structured-context": "^0.19.0",
68
+ "tailwindcss": "^4.3.3",
69
+ "vite": "^8.3.2"
70
+ }
71
+ }