@oxeo/visual 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 (48) hide show
  1. package/README.md +99 -2
  2. package/bin/oxeo-visual.js +2 -0
  3. package/dist/build.d.ts +23 -0
  4. package/dist/build.js +58 -0
  5. package/dist/cli/build-command.d.ts +5 -0
  6. package/dist/cli/build-command.js +57 -0
  7. package/dist/cli/dev.d.ts +6 -0
  8. package/dist/cli/dev.js +274 -0
  9. package/dist/cli/index.d.ts +1 -0
  10. package/dist/cli/index.js +104 -0
  11. package/dist/cli/open.d.ts +1 -0
  12. package/dist/cli/open.js +21 -0
  13. package/dist/cli/output.d.ts +4 -0
  14. package/dist/cli/output.js +13 -0
  15. package/dist/cli/run.d.ts +7 -0
  16. package/dist/cli/run.js +55 -0
  17. package/dist/cli/worker.d.ts +20 -0
  18. package/dist/cli/worker.js +94 -0
  19. package/dist/config.d.ts +33 -0
  20. package/dist/config.js +26 -0
  21. package/dist/extract.d.ts +8 -0
  22. package/dist/extract.js +300 -0
  23. package/dist/index.d.ts +6 -0
  24. package/dist/index.js +24 -0
  25. package/dist/layout/cards.d.ts +43 -0
  26. package/dist/layout/cards.js +121 -0
  27. package/dist/layout/place.d.ts +40 -0
  28. package/dist/layout/place.js +197 -0
  29. package/dist/layout/route.d.ts +30 -0
  30. package/dist/layout/route.js +192 -0
  31. package/dist/model.d.ts +60 -0
  32. package/dist/model.js +2 -0
  33. package/dist/project.d.ts +14 -0
  34. package/dist/project.js +11 -0
  35. package/dist/render/client.js +871 -0
  36. package/dist/render/html.d.ts +8 -0
  37. package/dist/render/html.js +211 -0
  38. package/dist/render/palette.d.ts +4 -0
  39. package/dist/render/palette.js +66 -0
  40. package/dist/render/svg.d.ts +20 -0
  41. package/dist/render/svg.js +222 -0
  42. package/dist/scheme-meta.d.ts +90 -0
  43. package/dist/scheme-meta.js +2 -0
  44. package/dist/text.d.ts +2 -0
  45. package/dist/text.js +12 -0
  46. package/dist/types.d.ts +15 -0
  47. package/dist/types.js +143 -0
  48. package/package.json +36 -3
@@ -0,0 +1,8 @@
1
+ import type { ZoneConfig } from '../config';
2
+ export interface RenderPageOptions {
3
+ zones: ZoneConfig[];
4
+ mapSvg: string;
5
+ data: unknown;
6
+ meta: string;
7
+ }
8
+ export declare const renderPage: ({ zones, mapSvg, data, meta }: RenderPageOptions) => string;
@@ -0,0 +1,211 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.renderPage = void 0;
37
+ const fs = __importStar(require("fs"));
38
+ const path = __importStar(require("path"));
39
+ const ts = __importStar(require("typescript"));
40
+ const palette_1 = require("./palette");
41
+ const svg_1 = require("./svg");
42
+ const clientScript = () => {
43
+ const compiled = path.join(__dirname, 'client.js');
44
+ if (fs.existsSync(compiled))
45
+ return fs.readFileSync(compiled, 'utf8');
46
+ const source = fs.readFileSync(path.join(__dirname, 'client.ts'), 'utf8');
47
+ return ts.transpileModule(source, {
48
+ compilerOptions: {
49
+ target: ts.ScriptTarget.ES2019,
50
+ module: ts.ModuleKind.None,
51
+ removeComments: true
52
+ }
53
+ }).outputText;
54
+ };
55
+ const pageCss = `
56
+ * { box-sizing: border-box; }
57
+ [hidden] { display: none !important; }
58
+ html, body { height: 100%; }
59
+ body { margin: 0; background: var(--xv-bg); color: var(--xv-text); font: 400 13px/1.45 ${svg_1.UI}; -webkit-font-smoothing: antialiased; }
60
+ code { font-family: ${svg_1.MONO}; font-size: 0.92em; background: var(--xv-surface-2); padding: 1px 4px; border-radius: 3px; }
61
+ button { font: inherit; color: inherit; }
62
+ :focus-visible { outline: 2px solid var(--xv-accent); outline-offset: 1px; }
63
+
64
+ .xv-app { position: fixed; inset: 0; }
65
+ .xv-stage { position: absolute; inset: 0; overflow: hidden; background: var(--xv-bg); cursor: grab; touch-action: none; user-select: none; }
66
+ .xv-stage.is-panning { cursor: grabbing; }
67
+ .xv-stage > svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
68
+
69
+ /* Плавающие подложки поверх карты, как в Miro: карта занимает всё окно */
70
+ .xv-float { position: absolute; top: 12px; z-index: 6; display: flex; align-items: center; gap: 6px; height: 44px; padding: 0 6px; background: var(--xv-surface); border-radius: 8px; box-shadow: 0 0 0 1px color-mix(in srgb, var(--xv-text) 7%, transparent), 0 2px 6px rgb(0 0 0 / 0.06), 0 8px 24px rgb(0 0 0 / 0.07); cursor: auto; user-select: none; }
71
+ .xv-float-left { left: 12px; }
72
+ .xv-float-right { right: 12px; }
73
+ .xv-divider { width: 1px; height: 22px; margin: 0 2px; background: var(--xv-line); flex: none; }
74
+ .xv-meta { padding: 0 8px 0 2px; color: var(--xv-muted); font-size: 12px; white-space: nowrap; font-variant-numeric: tabular-nums; }
75
+ .xv-ctl-label { padding-left: 6px; font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--xv-muted); }
76
+ .xv-seg { display: inline-flex; gap: 2px; padding: 2px; background: var(--xv-surface-2); border-radius: 7px; }
77
+ .xv-seg button { height: 28px; border: 0; background: transparent; color: var(--xv-muted); font-size: 12px; font-weight: 500; line-height: 1; padding: 0 10px; border-radius: 5px; cursor: pointer; }
78
+ .xv-seg button:hover { color: var(--xv-text); }
79
+ .xv-seg button[aria-pressed='true'] { background: var(--xv-surface); color: var(--xv-text); box-shadow: 0 0 0 1px var(--xv-line), 0 1px 2px rgb(0 0 0 / 0.06); }
80
+ .xv-tool { height: 32px; padding: 0 12px; border: 0; border-radius: 6px; background: transparent; font-size: 13px; font-weight: 500; cursor: pointer; }
81
+ .xv-tool:hover { background: var(--xv-surface-2); }
82
+ .xv-tool[aria-expanded='true'] { background: var(--xv-accent-quiet); color: var(--xv-accent); }
83
+ .xv-search { position: relative; display: flex; align-items: center; }
84
+ .xv-search-icon { position: absolute; left: 10px; color: var(--xv-faint); pointer-events: none; }
85
+ .xv-search input { width: 260px; height: 32px; padding: 0 40px 0 32px; border: 0; border-radius: 6px; background: var(--xv-surface-2); color: var(--xv-text); font: 13px ${svg_1.UI}; }
86
+ .xv-search input::placeholder { color: var(--xv-faint); }
87
+ .xv-search-count { position: absolute; right: 10px; font: 500 11px ${svg_1.MONO}; color: var(--xv-muted); pointer-events: none; }
88
+ .xv-zoom { position: absolute; left: 12px; bottom: 12px; padding: 3px 8px; border-radius: 4px; background: color-mix(in srgb, var(--xv-surface) 88%, transparent); color: var(--xv-muted); font: 500 11px ${svg_1.MONO}; pointer-events: none; }
89
+
90
+ .xv-map .xv-card, .xv-map .xv-edge { cursor: pointer; transition: opacity 0.12s; }
91
+ .xv-map .xv-row:hover .xv-row-bg { fill: color-mix(in srgb, var(--xv-accent) 8%, transparent); }
92
+ .xv-map.has-focus .xv-edge:not(.is-on) { opacity: 0.07; }
93
+ .xv-map.has-focus .xv-card:not(.is-on) { opacity: 0.3; }
94
+ .xv-map .xv-edge.is-on .xv-edge-line { stroke-width: 2.4; opacity: 1; }
95
+ .xv-map .xv-edge.xv-own.is-on .xv-edge-line { stroke-width: 3; }
96
+ .xv-map .xv-card.is-selected .xv-card-bg { stroke: var(--xv-accent); stroke-width: 2.5; }
97
+ .xv-map.has-search .xv-card:not(.match) { opacity: 0.25; }
98
+ .xv-map .xv-card.match .xv-card-bg { stroke: var(--xv-match); stroke-width: 3; }
99
+ .xv-map .xv-row.match .xv-row-bg { fill: color-mix(in srgb, var(--xv-match) 35%, transparent); }
100
+ .xv-map.is-locked .xv-card:not(.is-on) { opacity: 0.16; cursor: default; }
101
+ .xv-map.is-locked .xv-card:not(.is-on) .xv-row:hover .xv-row-bg { fill: transparent; }
102
+ .xv-map.is-locked .xv-edge:not(.is-on) { opacity: 0.04; pointer-events: none; }
103
+ .xv-map .xv-row.is-pinned .xv-row-bg { fill: color-mix(in srgb, var(--xv-accent) 24%, transparent); stroke: var(--xv-accent); stroke-width: 1; }
104
+ .xv-map .xv-row.is-pinned .xv-row-label { fill: var(--xv-accent); font-weight: 600; }
105
+ .xv-map .xv-row.is-linked .xv-row-bg { fill: color-mix(in srgb, var(--xv-accent) 12%, transparent); }
106
+ .xv-map .xv-edges[data-layer='nohub'] { visibility: hidden; }
107
+ .xv-map.mode-shortcuts .xv-edges[data-layer='all'] { visibility: hidden; }
108
+ .xv-map.mode-shortcuts .xv-edges[data-layer='nohub'] { visibility: visible; }
109
+ .xv-map.mode-shortcuts .xv-edges[data-layer='all'] .xv-edge.xv-hub.is-on { visibility: visible; }
110
+ .xv-map.lod-far .xv-row, .xv-map.lod-far .xv-card-title, .xv-map.lod-far .xv-card-badge, .xv-map.lod-far .xv-file-label { display: none; }
111
+ .xv-map.lod-far .xv-card-far { display: inline; }
112
+ .xv-map.lod-far .xv-zone-title { font-size: clamp(20px, calc(16px * var(--xv-inv, 1)), 76px); }
113
+ .xv-map.lod-far .xv-zone-meta { font-size: clamp(12px, calc(10px * var(--xv-inv, 1)), 36px); }
114
+ .xv-map.lod-far .xv-edge-line { stroke-width: 2.6; }
115
+
116
+ .xv-legend { position: absolute; top: 64px; right: 12px; z-index: 5; width: 320px; max-width: calc(100% - 24px); max-height: calc(100% - 76px); overflow: auto; padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 16px; background: var(--xv-surface); border: 1px solid var(--xv-line-strong); border-radius: 8px; box-shadow: 0 10px 30px rgb(0 0 0 / 0.12); cursor: auto; user-select: text; }
117
+ .xv-legend section h3 { margin: 0 0 8px; font-size: 11px; font-weight: 600; letter-spacing: 0.07em; text-transform: uppercase; color: var(--xv-muted); }
118
+ .lg-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 14px; }
119
+ .lg-close { width: 26px; height: 26px; border: 0; border-radius: 5px; background: none; color: var(--xv-muted); font-size: 18px; line-height: 1; cursor: pointer; }
120
+ .lg-close:hover { background: var(--xv-surface-2); color: var(--xv-text); }
121
+ .quiet { color: var(--xv-muted); font-size: 12px; margin: 0; }
122
+ .zone-dot { width: 8px; height: 8px; border-radius: 2px; background: var(--t); flex: none; }
123
+ .ent-link { padding: 0; border: 0; background: none; color: var(--t, var(--xv-accent)); font: 600 12px ${svg_1.MONO}; cursor: pointer; }
124
+ .ent-link:hover { text-decoration: underline; }
125
+ .del { display: inline-block; padding: 0 5px; border: 1px solid currentColor; border-radius: 3px; font: 500 10px/16px ${svg_1.MONO}; color: var(--xv-text); }
126
+ .del.cascade { color: #d62828; }
127
+ .del.set-null, .del.unlink { color: var(--xv-muted); border-style: dashed; }
128
+ .legend { display: flex; flex-direction: column; gap: 6px; }
129
+ .lg { display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 10px; align-items: center; font-size: 12px; color: var(--xv-muted); }
130
+ .lg span { color: var(--xv-text); }
131
+ .lg small { display: block; color: var(--xv-muted); font-size: 11px; }
132
+ .zones { display: flex; flex-direction: column; gap: 1px; margin: 0 -6px; }
133
+ .zone-row { display: grid; grid-template-columns: 10px minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 5px 6px; border: 0; border-radius: 5px; background: none; text-align: left; cursor: pointer; font-size: 13px; }
134
+ .zone-row:hover { background: var(--xv-surface-2); }
135
+ .zone-row .zone-dot { width: 10px; height: 10px; }
136
+ .keys { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--xv-muted); }
137
+ kbd { display: inline-block; min-width: 18px; padding: 0 5px; margin-right: 6px; border: 1px solid var(--xv-line-strong); border-bottom-width: 2px; border-radius: 4px; font: 500 11px/18px ${svg_1.MONO}; color: var(--xv-text); text-align: center; }
138
+ .foot { font-size: 11px; }
139
+
140
+ .xv-tip { position: fixed; z-index: 50; max-width: 520px; max-height: calc(100vh - 16px); overflow: hidden; padding: 8px 10px; border: 1px solid var(--xv-line-strong); border-radius: 6px; background: var(--xv-surface); box-shadow: 0 8px 24px rgb(0 0 0 / 0.14); font-size: 12px; line-height: 1.5; pointer-events: none; }
141
+ .xv-tip b { font-family: ${svg_1.MONO}; font-weight: 600; }
142
+ .xv-tip .muted { color: var(--xv-muted); }
143
+ .xv-tip .tip-code { margin: 6px 0 2px; padding: 5px 7px; border-radius: 4px; background: var(--xv-surface-2); font: 11px/1.5 ${svg_1.MONO}; color: var(--xv-text); overflow-wrap: anywhere; }
144
+ .xv-tip .tip-dec { color: var(--xv-accent); font-weight: 600; }
145
+ .xv-tip .tip-zone { font-weight: 600; }
146
+ .xv-tip .tip-doc { margin: 6px 0; line-height: 1.5; white-space: pre-line; }
147
+ .xv-tip .tip-meta { color: var(--xv-muted); }
148
+ .xv-tip .tip-impact { margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--xv-line); display: flex; flex-direction: column; gap: 3px; }
149
+ .xv-tip code { font-size: 11px; }
150
+ .xv-tip .tip-pre { margin: 6px 0 2px; padding: 7px 9px; border-radius: 4px; background: var(--xv-surface-2); font: 11px/1.5 ${svg_1.MONO}; color: var(--xv-text); white-space: pre-wrap; overflow-wrap: anywhere; tab-size: 2; }
151
+ .xv-tip .ts-c { color: var(--xv-muted); font-style: italic; }
152
+ .xv-tip .ts-s { color: var(--xv-code-string); }
153
+ .xv-tip .ts-k { color: var(--xv-accent); }
154
+ .xv-tip .ts-t { color: var(--xv-code-type); }
155
+
156
+ @media (max-width: 720px) {
157
+ .xv-float-left { right: 12px; }
158
+ .xv-float-left .xv-divider, .xv-meta { display: none; }
159
+ .xv-search, .xv-search input { width: 100%; }
160
+ .xv-search { flex: 1; }
161
+ .xv-float-right { top: 64px; }
162
+ .xv-legend { top: 116px; max-height: calc(100% - 128px); }
163
+ }
164
+ @media (prefers-reduced-motion: reduce) {
165
+ .xv-map .xv-card, .xv-map .xv-edge { transition: none; }
166
+ }
167
+ `;
168
+ const renderPage = ({ zones, mapSvg, data, meta }) => {
169
+ const json = JSON.stringify(data).replace(/</g, '\\u003c');
170
+ return `<!doctype html>
171
+ <meta charset="utf-8" />
172
+ <meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover" />
173
+ <title>Карта схемы</title>
174
+ <link rel="preconnect" href="https://fonts.googleapis.com" />
175
+ <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
176
+ <link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&family=JetBrains+Mono:wght@400;500;600&display=swap" />
177
+ <style>${(0, palette_1.pageThemeCss)(zones)}
178
+ ${svg_1.mapCss}
179
+ ${pageCss}</style>
180
+ <div class="xv-app">
181
+ <main class="xv-stage" id="xv-stage" aria-label="Карта схемы">
182
+ ${mapSvg}
183
+ <div class="xv-float xv-float-left">
184
+ <label class="xv-search">
185
+ <svg class="xv-search-icon" width="14" height="14" viewBox="0 0 16 16" aria-hidden="true"><circle cx="7" cy="7" r="5" fill="none" stroke="currentColor" stroke-width="1.6"/><path d="M11 11 L14.5 14.5" stroke="currentColor" stroke-width="1.6" stroke-linecap="round"/></svg>
186
+ <input id="xv-search" type="search" autocomplete="off" spellcheck="false" placeholder="Коллекция или поле…" aria-label="Поиск по коллекциям и полям" />
187
+ <span class="xv-search-count" id="xv-search-count"></span>
188
+ </label>
189
+ <span class="xv-divider" aria-hidden="true"></span>
190
+ <span class="xv-meta">${meta}</span>
191
+ </div>
192
+ <div class="xv-float xv-float-right">
193
+ <span class="xv-ctl-label">Хабы</span>
194
+ <div class="xv-seg">
195
+ <button type="button" data-hub-mode="lines">Линии</button>
196
+ <button type="button" data-hub-mode="shortcuts">Ярлыки</button>
197
+ </div>
198
+ <span class="xv-divider" aria-hidden="true"></span>
199
+ <button type="button" class="xv-tool" id="xv-legend-toggle" aria-controls="xv-legend" aria-expanded="false">Легенда</button>
200
+ </div>
201
+ <div class="xv-zoom" id="xv-zoom"></div>
202
+ <aside class="xv-legend" id="xv-legend" aria-label="Легенда" hidden></aside>
203
+ </main>
204
+ </div>
205
+ <div class="xv-tip" id="xv-tip" hidden></div>
206
+ <pre id="xv-debug" hidden></pre>
207
+ <script id="xv-data" type="application/json">${json}</script>
208
+ <script>${clientScript()}</script>
209
+ `;
210
+ };
211
+ exports.renderPage = renderPage;
@@ -0,0 +1,4 @@
1
+ import type { ZoneConfig } from '../config';
2
+ export declare const zoneVar: (id: string) => string;
3
+ export declare const pageThemeCss: (zones: ZoneConfig[]) => string;
4
+ export declare const svgThemeCss: (zones: ZoneConfig[]) => string;
@@ -0,0 +1,66 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.svgThemeCss = exports.pageThemeCss = exports.zoneVar = void 0;
4
+ const LIGHT = {
5
+ bg: '#f6f6f7',
6
+ surface: '#ffffff',
7
+ surface2: '#f1f1f3',
8
+ line: '#e4e4e7',
9
+ lineStrong: '#d4d4d8',
10
+ text: '#18181b',
11
+ muted: '#63636e',
12
+ faint: '#a1a1aa',
13
+ onZone: '#ffffff',
14
+ accent: '#2563eb',
15
+ accentQuiet: '#e0eafd',
16
+ match: '#f2b200',
17
+ codeString: '#a1501b',
18
+ codeType: '#0f7f77'
19
+ };
20
+ const DARK = {
21
+ bg: '#0c0c0e',
22
+ surface: '#151518',
23
+ surface2: '#1f1f23',
24
+ line: '#2a2a2f',
25
+ lineStrong: '#3a3a41',
26
+ text: '#f2f2f3',
27
+ muted: '#a3a3ad',
28
+ faint: '#6c6c75',
29
+ onZone: '#0c0c0e',
30
+ accent: '#6ea2ff',
31
+ accentQuiet: '#1a2944',
32
+ match: '#f4c64a',
33
+ codeString: '#f0a868',
34
+ codeType: '#5fd4c4'
35
+ };
36
+ const zoneVar = (id) => `--xv-zone-${id.replace(/[^A-Za-z0-9_-]/g, '_')}`;
37
+ exports.zoneVar = zoneVar;
38
+ const declarations = (palette, zones, dark) => [
39
+ dark ? 'color-scheme: dark;' : '',
40
+ `--xv-bg: ${palette.bg};`,
41
+ `--xv-surface: ${palette.surface};`,
42
+ `--xv-surface-2: ${palette.surface2};`,
43
+ `--xv-line: ${palette.line};`,
44
+ `--xv-line-strong: ${palette.lineStrong};`,
45
+ `--xv-text: ${palette.text};`,
46
+ `--xv-muted: ${palette.muted};`,
47
+ `--xv-faint: ${palette.faint};`,
48
+ `--xv-on-zone: ${palette.onZone};`,
49
+ `--xv-accent: ${palette.accent};`,
50
+ `--xv-accent-quiet: ${palette.accentQuiet};`,
51
+ `--xv-match: ${palette.match};`,
52
+ `--xv-code-string: ${palette.codeString};`,
53
+ `--xv-code-type: ${palette.codeType};`,
54
+ ...zones.map((z) => `${(0, exports.zoneVar)(z.id)}: ${dark ? (z.colorDark ?? z.color) : z.color};`)
55
+ ]
56
+ .filter(Boolean)
57
+ .join(' ');
58
+ const pageThemeCss = (zones) => `
59
+ :root { ${declarations(LIGHT, zones, false)} }
60
+ @media (prefers-color-scheme: dark) { :root:not([data-theme='light']) { ${declarations(DARK, zones, true)} } }
61
+ :root[data-theme='dark'] { ${declarations(DARK, zones, true)} }`;
62
+ exports.pageThemeCss = pageThemeCss;
63
+ const svgThemeCss = (zones) => `
64
+ .xv-root { ${declarations(LIGHT, zones, false)} }
65
+ @media (prefers-color-scheme: dark) { .xv-root { ${declarations(DARK, zones, true)} } }`;
66
+ exports.svgThemeCss = svgThemeCss;
@@ -0,0 +1,20 @@
1
+ import type { Spacing, VisualConfig } from '../config';
2
+ import { type Placement } from '../layout/place';
3
+ import type { Route } from '../layout/route';
4
+ export declare const MONO = "'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, 'DejaVu Sans Mono', monospace";
5
+ export declare const UI = "Inter, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif";
6
+ export declare const mapCss = "\n.xv-map { font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, 'DejaVu Sans Mono', monospace; }\n.xv-zone-bg { fill: color-mix(in srgb, var(--z) 7%, var(--xv-bg)); stroke: color-mix(in srgb, var(--z) 32%, var(--xv-bg)); stroke-width: 1; }\n.xv-zone-title { font: 600 20px Inter, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; fill: var(--z); letter-spacing: -0.01em; }\n.xv-zone-meta { font: 500 12px Inter, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; fill: var(--xv-muted); letter-spacing: 0; }\n.xv-file-bg { fill: color-mix(in srgb, var(--z) 2%, var(--xv-surface)); stroke: color-mix(in srgb, var(--z) 40%, var(--xv-surface)); stroke-width: 1; stroke-dasharray: 4 3; }\n.xv-file-label { font-size: 11px; font-weight: 600; fill: var(--z); }\n.xv-file-label .ns { font-weight: 400; fill: var(--xv-muted); }\n.xv-edge { color: var(--z); }\n.xv-edge-line { fill: none; stroke: currentColor; stroke-width: 1.3; stroke-linejoin: round; opacity: 0.9; }\n.xv-edge.xv-soft .xv-edge-line { stroke-dasharray: 5 4; }\n.xv-edge.xv-own .xv-edge-line { stroke-width: 2; }\n.xv-edge-end { fill: currentColor; stroke: currentColor; stroke-width: 1.2; stroke-linejoin: round; }\n.xv-edge-end.hollow { fill: var(--xv-surface); }\n.xv-edge-end.open { fill: none; }\n.xv-edge-hit { fill: none; stroke: transparent; stroke-width: 9; }\n.xv-card-bg { fill: var(--xv-surface); stroke: color-mix(in srgb, var(--z) 50%, var(--xv-line)); stroke-width: 1; }\n.xv-card-head { fill: var(--z); }\n.xv-card-title { font-size: 13px; font-weight: 600; fill: var(--xv-on-zone); }\n.xv-card-badge { font-size: 10px; font-weight: 500; fill: var(--xv-on-zone); opacity: 0.85; }\n.xv-row-sep { stroke: color-mix(in srgb, var(--z) 10%, var(--xv-line)); stroke-width: 1; }\n.xv-row-bg { fill: transparent; }\n.xv-row text { font-size: 11px; }\n.xv-row-label { fill: var(--xv-text); }\n.xv-row-label .q { fill: var(--xv-muted); }\n.xv-row-detail { fill: var(--xv-muted); }\n.xv-row-detail.rel { fill: var(--t); font-weight: 500; }\n.xv-row.id .xv-row-label { font-weight: 600; }\n.xv-row.block .xv-row-label, .xv-row.variant .xv-row-label { font-weight: 600; }\n.xv-row.block .xv-row-detail, .xv-row.variant .xv-row-detail { font-style: italic; }\n.xv-block-box { stroke: color-mix(in srgb, var(--z) 45%, var(--xv-line)); stroke-width: 1; }\n.xv-block-rule { stroke: color-mix(in srgb, var(--z) 45%, var(--xv-line)); stroke-width: 1; }\n.xv-row.block .xv-row-label { fill: color-mix(in srgb, var(--z) 70%, var(--xv-text)); }\n.xv-variant-band { fill: color-mix(in srgb, var(--z) 14%, var(--xv-surface)); }\n.xv-card-far { display: none; font-weight: 600; fill: var(--xv-text); dominant-baseline: hanging; font-size: min(var(--fit), calc(13px * var(--xv-inv, 1))); }\n";
7
+ export interface MapLayers {
8
+ all: Route[];
9
+ nohub: Route[];
10
+ }
11
+ export interface RenderMapOptions {
12
+ config: VisualConfig;
13
+ spacing: Spacing;
14
+ placement: Placement;
15
+ layers: MapLayers;
16
+ hubs: Set<string>;
17
+ sourcesCount: Map<string, number>;
18
+ standalone?: boolean;
19
+ }
20
+ export declare const renderMapSvg: ({ config, spacing, placement, layers, hubs, sourcesCount, standalone }: RenderMapOptions) => string;
@@ -0,0 +1,222 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.renderMapSvg = exports.mapCss = exports.UI = exports.MONO = void 0;
4
+ const cards_1 = require("../layout/cards");
5
+ const place_1 = require("../layout/place");
6
+ const palette_1 = require("./palette");
7
+ const text_1 = require("../text");
8
+ exports.MONO = `'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, 'DejaVu Sans Mono', monospace`;
9
+ exports.UI = `Inter, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif`;
10
+ exports.mapCss = `
11
+ .xv-map { font-family: ${exports.MONO}; }
12
+ .xv-zone-bg { fill: color-mix(in srgb, var(--z) 7%, var(--xv-bg)); stroke: color-mix(in srgb, var(--z) 32%, var(--xv-bg)); stroke-width: 1; }
13
+ .xv-zone-title { font: 600 ${place_1.ZONE_TITLE_FONT}px ${exports.UI}; fill: var(--z); letter-spacing: -0.01em; }
14
+ .xv-zone-meta { font: 500 ${place_1.ZONE_META_FONT}px ${exports.UI}; fill: var(--xv-muted); letter-spacing: 0; }
15
+ .xv-file-bg { fill: color-mix(in srgb, var(--z) 2%, var(--xv-surface)); stroke: color-mix(in srgb, var(--z) 40%, var(--xv-surface)); stroke-width: 1; stroke-dasharray: 4 3; }
16
+ .xv-file-label { font-size: ${place_1.FILE_LABEL_FONT}px; font-weight: 600; fill: var(--z); }
17
+ .xv-file-label .ns { font-weight: 400; fill: var(--xv-muted); }
18
+ .xv-edge { color: var(--z); }
19
+ .xv-edge-line { fill: none; stroke: currentColor; stroke-width: 1.3; stroke-linejoin: round; opacity: 0.9; }
20
+ .xv-edge.xv-soft .xv-edge-line { stroke-dasharray: 5 4; }
21
+ .xv-edge.xv-own .xv-edge-line { stroke-width: 2; }
22
+ .xv-edge-end { fill: currentColor; stroke: currentColor; stroke-width: 1.2; stroke-linejoin: round; }
23
+ .xv-edge-end.hollow { fill: var(--xv-surface); }
24
+ .xv-edge-end.open { fill: none; }
25
+ .xv-edge-hit { fill: none; stroke: transparent; stroke-width: 9; }
26
+ .xv-card-bg { fill: var(--xv-surface); stroke: color-mix(in srgb, var(--z) 50%, var(--xv-line)); stroke-width: 1; }
27
+ .xv-card-head { fill: var(--z); }
28
+ .xv-card-title { font-size: ${cards_1.HEADER_FONT}px; font-weight: 600; fill: var(--xv-on-zone); }
29
+ .xv-card-badge { font-size: 10px; font-weight: 500; fill: var(--xv-on-zone); opacity: 0.85; }
30
+ .xv-row-sep { stroke: color-mix(in srgb, var(--z) 10%, var(--xv-line)); stroke-width: 1; }
31
+ .xv-row-bg { fill: transparent; }
32
+ .xv-row text { font-size: ${cards_1.ROW_FONT}px; }
33
+ .xv-row-label { fill: var(--xv-text); }
34
+ .xv-row-label .q { fill: var(--xv-muted); }
35
+ .xv-row-detail { fill: var(--xv-muted); }
36
+ .xv-row-detail.rel { fill: var(--t); font-weight: 500; }
37
+ .xv-row.id .xv-row-label { font-weight: 600; }
38
+ .xv-row.block .xv-row-label, .xv-row.variant .xv-row-label { font-weight: 600; }
39
+ .xv-row.block .xv-row-detail, .xv-row.variant .xv-row-detail { font-style: italic; }
40
+ .xv-block-box { stroke: color-mix(in srgb, var(--z) 45%, var(--xv-line)); stroke-width: 1; }
41
+ .xv-block-rule { stroke: color-mix(in srgb, var(--z) 45%, var(--xv-line)); stroke-width: 1; }
42
+ .xv-row.block .xv-row-label { fill: color-mix(in srgb, var(--z) 70%, var(--xv-text)); }
43
+ .xv-variant-band { fill: color-mix(in srgb, var(--z) 14%, var(--xv-surface)); }
44
+ .xv-card-far { display: none; font-weight: 600; fill: var(--xv-text); dominant-baseline: hanging; font-size: min(var(--fit), calc(13px * var(--xv-inv, 1))); }
45
+ `;
46
+ const r1 = (n) => Math.round(n * 10) / 10;
47
+ const hatchId = (zone) => `xv-hatch-${zone.replace(/[^A-Za-z0-9_-]/g, '_')}`;
48
+ const unit = (a, b) => {
49
+ const dx = b[0] - a[0];
50
+ const dy = b[1] - a[1];
51
+ const len = Math.hypot(dx, dy) || 1;
52
+ return [dx / len, dy / len];
53
+ };
54
+ const roundedPath = (input, trimStart, trimEnd, radius = 7) => {
55
+ const points = input.map((p) => [...p]);
56
+ const length = (a, b) => Math.hypot(b[0] - a[0], b[1] - a[1]);
57
+ if (points.length >= 2) {
58
+ const start = Math.min(trimStart, length(points[0], points[1]) - 1);
59
+ const d0 = unit(points[0], points[1]);
60
+ points[0] = [points[0][0] + d0[0] * start, points[0][1] + d0[1] * start];
61
+ const n = points.length - 1;
62
+ const end = Math.min(trimEnd, length(points[n - 1], points[n]) - 1);
63
+ const d1 = unit(points[n - 1], points[n]);
64
+ points[n] = [points[n][0] - d1[0] * end, points[n][1] - d1[1] * end];
65
+ }
66
+ let d = `M${r1(points[0][0])},${r1(points[0][1])}`;
67
+ for (let i = 1; i < points.length - 1; i++) {
68
+ const [prev, corner, next] = [points[i - 1], points[i], points[i + 1]];
69
+ const inLen = Math.hypot(corner[0] - prev[0], corner[1] - prev[1]);
70
+ const outLen = Math.hypot(next[0] - corner[0], next[1] - corner[1]);
71
+ const r = Math.min(radius, inLen / 2, outLen / 2);
72
+ const a = unit(corner, prev);
73
+ const b = unit(corner, next);
74
+ d += ` L${r1(corner[0] + a[0] * r)},${r1(corner[1] + a[1] * r)}`;
75
+ d += ` Q${r1(corner[0])},${r1(corner[1])} ${r1(corner[0] + b[0] * r)},${r1(corner[1] + b[1] * r)}`;
76
+ }
77
+ const last = points[points.length - 1];
78
+ return `${d} L${r1(last[0])},${r1(last[1])}`;
79
+ };
80
+ const ARROW = 9;
81
+ const DIAMOND = 11;
82
+ const CROW = 10;
83
+ const decorations = (relation, points) => {
84
+ const parts = [];
85
+ const [s, s1] = [points[0], points[1]];
86
+ const [e1, e] = [points[points.length - 2], points[points.length - 1]];
87
+ const out = unit(s, s1);
88
+ const inn = unit(e1, e);
89
+ const perp = (d) => [-d[1], d[0]];
90
+ const at = (p, d, along, side = 0) => {
91
+ const n = perp(d);
92
+ return `${r1(p[0] + d[0] * along + n[0] * side)},${r1(p[1] + d[1] * along + n[1] * side)}`;
93
+ };
94
+ if (relation.kind === 'own') {
95
+ const cls = relation.onDelete === 'cascade' ? '' : ' hollow';
96
+ parts.push(`<path class="xv-edge-end${cls}" d="M${at(s, out, 0)} L${at(s, out, DIAMOND / 2, 4)} L${at(s, out, DIAMOND)} L${at(s, out, DIAMOND / 2, -4)} Z"/>`);
97
+ return { parts, trimStart: DIAMOND, trimEnd: 0 };
98
+ }
99
+ const cls = relation.nullable ? ' hollow' : '';
100
+ parts.push(`<path class="xv-edge-end${cls}" d="M${at(e, inn, 0)} L${at(e, inn, -ARROW, 4.5)} L${at(e, inn, -ARROW, -4.5)} Z"/>`);
101
+ if (relation.kind === 'set') {
102
+ parts.push(`<path class="xv-edge-end open" d="M${at(s, out, 0, 5)} L${at(s, out, CROW)} L${at(s, out, 0, -5)} M${at(s, out, 0)} L${at(s, out, CROW)}"/>`);
103
+ }
104
+ return { parts, trimStart: 0, trimEnd: ARROW };
105
+ };
106
+ const renderMapSvg = ({ config, spacing, placement, layers, hubs, sourcesCount, standalone }) => {
107
+ const zoneOf = (key) => placement.cards.get(key)?.zone ?? '?';
108
+ const zoneStyle = (zone) => `--z: var(${(0, palette_1.zoneVar)(zone)})`;
109
+ const out = [];
110
+ out.push(`<svg xmlns="http://www.w3.org/2000/svg" class="xv-map xv-root" viewBox="0 0 ${Math.ceil(placement.width)} ${Math.ceil(placement.height)}" width="${Math.ceil(placement.width)}" height="${Math.ceil(placement.height)}">`);
111
+ if (standalone) {
112
+ out.push(`<style>${(0, palette_1.svgThemeCss)(config.zones)}${exports.mapCss}</style>`);
113
+ out.push(`<rect width="100%" height="100%" style="fill: var(--xv-bg)"/>`);
114
+ }
115
+ out.push('<defs>');
116
+ for (const zone of placement.zones) {
117
+ const color = `var(${(0, palette_1.zoneVar)(zone.zone.id)})`;
118
+ out.push(`<pattern id="${hatchId(zone.zone.id)}" width="6" height="6" patternUnits="userSpaceOnUse" patternTransform="rotate(45)">` +
119
+ `<line x1="0" y1="0" x2="0" y2="6" style="stroke: ${color}; stroke-width: 1.5; stroke-opacity: 0.4"/></pattern>`);
120
+ }
121
+ out.push('</defs>');
122
+ out.push('<g class="xv-zones">');
123
+ for (const box of placement.zones) {
124
+ out.push(`<g class="xv-zone" data-zone="${(0, text_1.escapeXml)(box.zone.id)}" style="${zoneStyle(box.zone.id)}">` +
125
+ `<rect class="xv-zone-bg" x="${r1(box.x)}" y="${r1(box.y)}" width="${r1(box.w)}" height="${r1(box.h)}" rx="14"/>` +
126
+ `<text class="xv-zone-title" x="${r1(box.x + spacing.zonePadX)}" y="${r1(box.y + 38)}">${(0, text_1.escapeXml)(`${box.zone.id} · ${box.zone.title}`)}<tspan class="xv-zone-meta" dx="12">${(0, text_1.escapeXml)(box.meta)}</tspan></text></g>`);
127
+ }
128
+ out.push('</g>');
129
+ out.push('<g class="xv-files">');
130
+ for (const box of placement.files) {
131
+ const label = (0, place_1.fileLabel)(box.file, box.namespace);
132
+ const ns = box.namespace ? `<tspan class="ns"> · ${(0, text_1.escapeXml)(box.namespace)}</tspan>` : '';
133
+ out.push(`<g class="xv-file" data-file="${(0, text_1.escapeXml)(box.file)}" style="${zoneStyle(box.zone)}">` +
134
+ `<rect class="xv-file-bg" x="${r1(box.x)}" y="${r1(box.y)}" width="${r1(box.w)}" height="${r1(box.h)}" rx="8"/>` +
135
+ `<text class="xv-file-label" x="${r1(box.x + spacing.filePadX)}" y="${r1(box.y + 21)}" data-label="${(0, text_1.escapeXml)(label)}">${(0, text_1.escapeXml)(box.file)}${ns}</text></g>`);
136
+ }
137
+ out.push('</g>');
138
+ for (const [layer, routes] of Object.entries(layers)) {
139
+ out.push(`<g class="xv-edges" data-layer="${layer}">`);
140
+ for (const { relation, points } of routes) {
141
+ if (points.length < 2)
142
+ continue;
143
+ const zone = relation.kind === 'own' ? zoneOf(relation.source) : zoneOf(relation.target);
144
+ const soft = relation.onDelete === 'set-null' || relation.onDelete === 'unlink';
145
+ const { parts, trimStart, trimEnd } = decorations(relation, points);
146
+ const classes = [
147
+ 'xv-edge',
148
+ `xv-${relation.kind}`,
149
+ soft ? 'xv-soft' : '',
150
+ hubs.has(relation.target) && relation.kind !== 'own' ? 'xv-hub' : ''
151
+ ];
152
+ const full = roundedPath(points, 0, 0);
153
+ out.push(`<g class="${classes.filter(Boolean).join(' ')}" data-id="${(0, text_1.escapeXml)(relation.id)}" data-source="${(0, text_1.escapeXml)(relation.source)}" data-target="${(0, text_1.escapeXml)(relation.target)}" data-field="${(0, text_1.escapeXml)(relation.field)}" style="${zoneStyle(zone)}">` +
154
+ `<path class="xv-edge-hit" d="${full}"/>` +
155
+ `<path class="xv-edge-line" d="${roundedPath(points, trimStart, trimEnd)}"/>` +
156
+ parts.join('') +
157
+ '</g>');
158
+ }
159
+ out.push('</g>');
160
+ }
161
+ out.push('<g class="xv-cards">');
162
+ for (const [key, placed] of placement.cards) {
163
+ const card = placed.card;
164
+ const { width: w, height: h } = card;
165
+ const hr = spacing.cardHeader;
166
+ const sources = sourcesCount.get(key) ?? 0;
167
+ const badge = hubs.has(key) ? `хаб · ${sources}` : '';
168
+ const farFit = Math.min(140, (w - 24) / ([...key].length * 0.6));
169
+ out.push(`<g class="xv-card${hubs.has(key) ? ' hub' : ''}" data-key="${(0, text_1.escapeXml)(key)}" transform="translate(${r1(placed.x)} ${r1(placed.y)})" style="${zoneStyle(placed.zone)}">` +
170
+ `<rect class="xv-card-bg" width="${w}" height="${h}" rx="6"/>` +
171
+ `<path class="xv-card-head" d="M0,6 Q0,0 6,0 H${w - 6} Q${w},0 ${w},6 V${hr} H0 Z"/>` +
172
+ `<text class="xv-card-title" x="${spacing.cardPadX}" y="${hr / 2 + 4.5}">${(0, text_1.escapeXml)(key)}</text>` +
173
+ (badge
174
+ ? `<text class="xv-card-badge" x="${w - spacing.cardPadX}" y="${hr / 2 + 4}" text-anchor="end">${badge}</text>`
175
+ : ''));
176
+ const plain = (row) => row !== undefined && row.kind !== 'block' && row.kind !== 'variant';
177
+ card.rows.forEach((row, i) => {
178
+ const { y, h: rowH } = row;
179
+ const base = y + rowH / 2 + 4;
180
+ const level = (0, cards_1.rowLevel)(row);
181
+ const inset = (0, cards_1.boxInset)(level);
182
+ const pad = (0, cards_1.textInset)(level, spacing);
183
+ const isRelation = row.kind === 'ref' || row.kind === 'set' || row.kind === 'own' || row.kind === 'owner';
184
+ const detailStyle = isRelation && row.target ? ` style="--t: var(${(0, palette_1.zoneVar)(zoneOf(row.target))})"` : '';
185
+ const label = (0, text_1.escapeXml)(row.label) + (row.nullable ? '<tspan class="q">?</tspan>' : '');
186
+ let band = '';
187
+ if (row.kind === 'block') {
188
+ const x1 = inset + 0.5;
189
+ const x2 = w - inset - 0.5;
190
+ const bottom = (row.boxBottom ?? y + rowH) - 0.5;
191
+ const top = y + 0.5;
192
+ const head = y + rowH;
193
+ band =
194
+ `<rect class="xv-block-box" x="${x1}" y="${top}" width="${r1(x2 - x1)}" height="${r1(bottom - top)}" rx="5" style="fill: color-mix(in srgb, var(--z) ${3 + 5 * level}%, var(--xv-surface))"/>` +
195
+ `<path class="xv-block-head" d="M${x1},${head} V${top + 5} Q${x1},${top} ${x1 + 5},${top} H${x2 - 5} Q${x2},${top} ${x2},${top + 5} V${head} Z" style="fill: url(#${hatchId(placed.zone)})"/>` +
196
+ `<line class="xv-block-rule" x1="${x1}" x2="${x2}" y1="${head}" y2="${head}"/>`;
197
+ }
198
+ else if (row.kind === 'variant') {
199
+ band = `<rect class="xv-variant-band" x="0.5" y="${y + 0.5}" width="${w - 1}" height="${rowH - 1}"/>`;
200
+ }
201
+ const prev = card.rows[i - 1];
202
+ const separated = plain(row) && plain(prev) && prev.y + prev.h === y;
203
+ out.push(`<g class="xv-row ${row.kind}" data-path="${(0, text_1.escapeXml)(row.path)}"${row.target ? ` data-target="${(0, text_1.escapeXml)(row.target)}"` : ''}>` +
204
+ band +
205
+ (separated
206
+ ? `<line class="xv-row-sep" x1="${inset}" x2="${w - inset}" y1="${y}" y2="${y}"/>`
207
+ : '') +
208
+ `<rect class="xv-row-bg" x="${inset + 0.5}" y="${y + 0.5}" width="${w - inset * 2 - 1}" height="${rowH - 1}"/>` +
209
+ `<text class="xv-row-label" x="${pad}" y="${base}">${label}</text>` +
210
+ (row.detail
211
+ ? `<text class="xv-row-detail${isRelation ? ' rel' : ''}" x="${w - pad}" y="${base}" text-anchor="end"${detailStyle}>${(0, text_1.escapeXml)(row.detail)}</text>`
212
+ : '') +
213
+ '</g>');
214
+ });
215
+ out.push(`<text class="xv-card-far" x="${w / 2}" y="${hr + 10}" text-anchor="middle" style="--fit: ${r1(farFit)}px">${(0, text_1.escapeXml)(key)}</text>`);
216
+ out.push('</g>');
217
+ }
218
+ out.push('</g>');
219
+ out.push('</svg>');
220
+ return out.join('\n');
221
+ };
222
+ exports.renderMapSvg = renderMapSvg;
@@ -0,0 +1,90 @@
1
+ type Primitive = {
2
+ type: 'string' | 'number' | 'boolean' | 'json';
3
+ nullable?: boolean;
4
+ } | {
5
+ type: 'array';
6
+ itemType: 'number' | 'string' | 'json';
7
+ } | {
8
+ type: 'enum' | 'literal';
9
+ values: (string | number)[];
10
+ nullable?: boolean;
11
+ };
12
+ export interface ModelProperties {
13
+ properties: PropertyMeta[];
14
+ references: RelationMeta[];
15
+ }
16
+ export interface EmbeddedMeta extends ModelProperties {
17
+ type: 'embedded';
18
+ }
19
+ export interface PropertyMeta {
20
+ target: Function;
21
+ propertyKey: string;
22
+ primitive: Primitive | EmbeddedMeta;
23
+ }
24
+ export interface RelationMeta {
25
+ target: Function;
26
+ refType: string;
27
+ propertyKey: string;
28
+ referenceModel: () => Function;
29
+ }
30
+ interface BaseModelScheme extends ModelProperties {
31
+ target: Function;
32
+ name: string;
33
+ identifier: {
34
+ propertyKey: string;
35
+ options: {
36
+ type: string;
37
+ };
38
+ };
39
+ }
40
+ export interface DiscriminatorScheme extends ModelProperties {
41
+ target: Function;
42
+ name: string;
43
+ value: string;
44
+ }
45
+ export type ModelScheme = (BaseModelScheme & {
46
+ type: 'base';
47
+ }) | (BaseModelScheme & {
48
+ type: 'discriminated';
49
+ discriminatorKey: string;
50
+ discriminators: DiscriminatorScheme[];
51
+ });
52
+ export type TargetRef = {
53
+ refType: 'reference-to';
54
+ model: string;
55
+ nullable: boolean;
56
+ } | {
57
+ refType: 'reference-set';
58
+ model: string;
59
+ } | {
60
+ refType: 'has-many';
61
+ model: string;
62
+ cleanupBehavior?: 'cascade' | 'restrict';
63
+ modelBelongsToProperty: string;
64
+ } | {
65
+ refType: 'belongs-to';
66
+ model: string;
67
+ } | {
68
+ refType: 'owner' | 'owner-fallback';
69
+ model: string;
70
+ };
71
+ export type TargetRefs = Record<string, TargetRef>;
72
+ export interface ReferenceScheme {
73
+ commonRefs: TargetRefs;
74
+ discriminatorRefs?: Record<string, TargetRefs>;
75
+ inverseRefs: {
76
+ model: string;
77
+ modelConsumerProperty: string;
78
+ onDeleteBehavior: 'restrict' | 'set-null' | 'unlink';
79
+ }[];
80
+ }
81
+ export interface SchemeSource {
82
+ collectionsScheme: Record<string, {
83
+ name: string;
84
+ }>;
85
+ models: Record<string, {
86
+ scheme: ModelScheme;
87
+ refscheme: ReferenceScheme;
88
+ }>;
89
+ }
90
+ export {};
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
package/dist/text.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ export declare const plural: (n: number, forms: [string, string, string]) => string;
2
+ export declare const escapeXml: (text: string) => string;