@kensnzk/koyu 0.27.0 → 0.29.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.
- package/README.ja.md +1 -1
- package/README.md +1 -1
- package/assets/plan/README.md +18 -0
- package/assets/plan/catalog.muro +87 -0
- package/assets/plan/library.muro +26 -0
- package/assets/plan/svg/bathtub.svg +9 -0
- package/assets/plan/svg/bed-double.svg +9 -0
- package/assets/plan/svg/bed-single.svg +8 -0
- package/assets/plan/svg/cabinet.svg +9 -0
- package/assets/plan/svg/chair.svg +8 -0
- package/assets/plan/svg/desk.svg +9 -0
- package/assets/plan/svg/hedge-2m.svg +7 -0
- package/assets/plan/svg/kitchen-sink.svg +10 -0
- package/assets/plan/svg/locker.svg +9 -0
- package/assets/plan/svg/office-chair.svg +25 -0
- package/assets/plan/svg/potted-plant.svg +14 -0
- package/assets/plan/svg/refrigerator.svg +10 -0
- package/assets/plan/svg/shelf.svg +9 -0
- package/assets/plan/svg/shrub-1m.svg +7 -0
- package/assets/plan/svg/sofa-2.svg +9 -0
- package/assets/plan/svg/sofa-3.svg +9 -0
- package/assets/plan/svg/table-rect.svg +7 -0
- package/assets/plan/svg/table-round.svg +7 -0
- package/assets/plan/svg/tree-3m.svg +8 -0
- package/assets/plan/svg/urinal.svg +9 -0
- package/assets/plan/svg/washing-machine-pan.svg +13 -0
- package/assets/plan/svg/washing-machine.svg +10 -0
- package/assets/plan/svg/washstand-500.svg +12 -0
- package/assets/plan/svg/washstand.svg +12 -0
- package/assets/plan/svg/wc-cabinet.svg +14 -0
- package/assets/plan/svg/wc.svg +9 -0
- package/dist/analysis/contracts.d.ts +1 -0
- package/dist/analysis/contracts.d.ts.map +1 -1
- package/dist/cli.js +16 -4
- package/dist/cli.js.map +1 -1
- package/dist/core/components.d.ts +31 -0
- package/dist/core/components.d.ts.map +1 -0
- package/dist/core/components.js +167 -0
- package/dist/core/components.js.map +1 -0
- package/dist/core/derive.d.ts +13 -2
- package/dist/core/derive.d.ts.map +1 -1
- package/dist/core/derive.js +36 -5
- package/dist/core/derive.js.map +1 -1
- package/dist/core/diagnose.d.ts +7 -0
- package/dist/core/diagnose.d.ts.map +1 -1
- package/dist/core/diagnose.js +141 -5
- package/dist/core/diagnose.js.map +1 -1
- package/dist/core/diff.d.ts +4 -0
- package/dist/core/diff.d.ts.map +1 -1
- package/dist/core/diff.js +4 -0
- package/dist/core/diff.js.map +1 -1
- package/dist/core/fabric.js +1 -1
- package/dist/core/fabric.js.map +1 -1
- package/dist/core/graph.d.ts +8 -0
- package/dist/core/graph.d.ts.map +1 -1
- package/dist/core/graph.js +31 -1
- package/dist/core/graph.js.map +1 -1
- package/dist/core/light.d.ts.map +1 -1
- package/dist/core/light.js +2 -0
- package/dist/core/light.js.map +1 -1
- package/dist/core/model.d.ts +20 -14
- package/dist/core/model.d.ts.map +1 -1
- package/dist/core/model.js +15 -8
- package/dist/core/model.js.map +1 -1
- package/dist/core/parse.d.ts.map +1 -1
- package/dist/core/parse.js +23 -4
- package/dist/core/parse.js.map +1 -1
- package/dist/core/vocabulary.d.ts +20 -4
- package/dist/core/vocabulary.d.ts.map +1 -1
- package/dist/core/vocabulary.js +107 -9
- package/dist/core/vocabulary.js.map +1 -1
- package/dist/draw/component-files.d.ts +8 -0
- package/dist/draw/component-files.d.ts.map +1 -0
- package/dist/draw/component-files.js +35 -0
- package/dist/draw/component-files.js.map +1 -0
- package/dist/draw/component-svg.d.ts +14 -0
- package/dist/draw/component-svg.d.ts.map +1 -0
- package/dist/draw/component-svg.js +67 -0
- package/dist/draw/component-svg.js.map +1 -0
- package/dist/draw/conventions/architectural.d.ts +32 -0
- package/dist/draw/conventions/architectural.d.ts.map +1 -0
- package/dist/draw/conventions/architectural.js +29 -0
- package/dist/draw/conventions/architectural.js.map +1 -0
- package/dist/draw/index.d.ts +1 -1
- package/dist/draw/index.d.ts.map +1 -1
- package/dist/draw/index.js +1 -1
- package/dist/draw/index.js.map +1 -1
- package/dist/draw/marks.d.ts +37 -12
- package/dist/draw/marks.d.ts.map +1 -1
- package/dist/draw/marks.js +508 -38
- package/dist/draw/marks.js.map +1 -1
- package/dist/draw/plan.d.ts +3 -1
- package/dist/draw/plan.d.ts.map +1 -1
- package/dist/draw/plan.js +257 -86
- package/dist/draw/plan.js.map +1 -1
- package/dist/form.d.ts +1 -1
- package/dist/form.d.ts.map +1 -1
- package/dist/form.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/mcp.js +22 -3
- package/dist/mcp.js.map +1 -1
- package/dist/parse-file.d.ts +1 -0
- package/dist/parse-file.d.ts.map +1 -1
- package/dist/parse-file.js +1 -0
- package/dist/parse-file.js.map +1 -1
- package/dist/validate/assessment.js +13 -2
- package/dist/validate/assessment.js.map +1 -1
- package/dist/validate/builtin/index.d.ts +4 -2
- package/dist/validate/builtin/index.d.ts.map +1 -1
- package/dist/validate/builtin/index.js +9 -2
- package/dist/validate/builtin/index.js.map +1 -1
- package/dist/validate/builtin/opening-operations.d.ts +63 -0
- package/dist/validate/builtin/opening-operations.d.ts.map +1 -0
- package/dist/validate/builtin/opening-operations.js +406 -0
- package/dist/validate/builtin/opening-operations.js.map +1 -0
- package/dist/validate/contracts.d.ts +1 -0
- package/dist/validate/contracts.d.ts.map +1 -1
- package/dist/validate/contracts.js.map +1 -1
- package/editors/vscode/syntaxes/koyu.tmLanguage.json +4 -4
- package/examples/basement/main.muro +3 -3
- package/examples/complex/L1.muro +1 -1
- package/examples/complex/assets.muro +2 -2
- package/examples/complex/main.muro +1 -1
- package/examples/house/L1.muro +3 -3
- package/examples/house/L2.muro +2 -2
- package/examples/house/assets.muro +8 -8
- package/examples/house/main.muro +1 -1
- package/examples/house/site.muro +2 -2
- package/examples/house.muro +6 -6
- package/examples/mansion.muro +1 -1
- package/examples/office.muro +1 -1
- package/examples/spatial/layout.muro +8 -0
- package/examples/spatial/main.muro +4 -0
- package/examples/steps/06-finished.muro +1 -1
- package/examples/tower/assets.muro +1 -1
- package/examples/tower/main.muro +1 -1
- package/examples/twin/assets.muro +2 -2
- package/examples/twin/main.muro +1 -1
- package/examples/two-rooms.canonical.json +1 -1
- package/examples/two-rooms.muro +1 -1
- package/package.json +9 -5
- package/src/analysis/contracts.ts +1 -0
- package/src/cli.ts +15 -4
- package/src/core/components.ts +224 -0
- package/src/core/derive.ts +53 -6
- package/src/core/diagnose.ts +185 -5
- package/src/core/diff.ts +3 -0
- package/src/core/fabric.ts +1 -1
- package/src/core/graph.ts +32 -0
- package/src/core/light.ts +1 -0
- package/src/core/model.ts +23 -13
- package/src/core/parse.ts +21 -4
- package/src/core/vocabulary.ts +115 -9
- package/src/draw/component-files.ts +36 -0
- package/src/draw/component-svg.ts +79 -0
- package/src/draw/conventions/architectural.ts +60 -0
- package/src/draw/index.ts +1 -1
- package/src/draw/marks.ts +564 -44
- package/src/draw/plan.ts +262 -89
- package/src/form.ts +1 -0
- package/src/index.ts +1 -1
- package/src/mcp.ts +22 -3
- package/src/parse-file.ts +1 -0
- package/src/validate/assessment.ts +17 -3
- package/src/validate/builtin/index.ts +14 -2
- package/src/validate/builtin/opening-operations.ts +519 -0
- package/src/validate/contracts.ts +1 -0
package/src/core/vocabulary.ts
CHANGED
|
@@ -71,6 +71,92 @@ const retired = (after: string, instead: string, base: AttrSpec = free()): AttrS
|
|
|
71
71
|
*/
|
|
72
72
|
export const CARRY_NAMESPACE = /^[a-z][a-z0-9_-]*(\.[a-z0-9_-]+)+$/;
|
|
73
73
|
|
|
74
|
+
/** Opening operations introduced after the original hinged / sliding / auto set. */
|
|
75
|
+
export const MURO_1_5_OPENING_STYLES = [
|
|
76
|
+
"hinged-double",
|
|
77
|
+
"hinged-unequal",
|
|
78
|
+
"sliding-double",
|
|
79
|
+
"sliding-bypass",
|
|
80
|
+
"auto-single",
|
|
81
|
+
"auto-double",
|
|
82
|
+
"entrance",
|
|
83
|
+
"gate-hinged",
|
|
84
|
+
"gate-hinged-double",
|
|
85
|
+
"gate-sliding",
|
|
86
|
+
"rolling-shutter",
|
|
87
|
+
"overhead",
|
|
88
|
+
"fixed",
|
|
89
|
+
"projecting",
|
|
90
|
+
"curtain-wall",
|
|
91
|
+
] as const;
|
|
92
|
+
|
|
93
|
+
/** Every interpreted value accepted by an opening's `style:` attribute. */
|
|
94
|
+
export const OPENING_STYLE_VALUES = [
|
|
95
|
+
"hinged",
|
|
96
|
+
"sliding",
|
|
97
|
+
"auto",
|
|
98
|
+
...MURO_1_5_OPENING_STYLES,
|
|
99
|
+
] as const;
|
|
100
|
+
|
|
101
|
+
/** Opening presentation attributes introduced in muro 1.5. */
|
|
102
|
+
export const MURO_1_5_OPENING_ATTRS = ["panels"] as const;
|
|
103
|
+
|
|
104
|
+
/** Area attributes introduced with component placement in muro 1.5. */
|
|
105
|
+
export const MURO_1_5_COMPONENT_AREA_ATTRS = [
|
|
106
|
+
"asset",
|
|
107
|
+
"align-x",
|
|
108
|
+
"align-y",
|
|
109
|
+
"offset-x",
|
|
110
|
+
"offset-y",
|
|
111
|
+
"rotate",
|
|
112
|
+
] as const;
|
|
113
|
+
|
|
114
|
+
const DOOR_OPENING_STYLES = new Set<string>([
|
|
115
|
+
"hinged",
|
|
116
|
+
"hinged-double",
|
|
117
|
+
"hinged-unequal",
|
|
118
|
+
"sliding",
|
|
119
|
+
"sliding-double",
|
|
120
|
+
"sliding-bypass",
|
|
121
|
+
"auto",
|
|
122
|
+
"auto-single",
|
|
123
|
+
"auto-double",
|
|
124
|
+
"entrance",
|
|
125
|
+
"gate-hinged",
|
|
126
|
+
"gate-hinged-double",
|
|
127
|
+
"gate-sliding",
|
|
128
|
+
"rolling-shutter",
|
|
129
|
+
"overhead",
|
|
130
|
+
]);
|
|
131
|
+
|
|
132
|
+
const WINDOW_OPENING_STYLES = new Set<string>([
|
|
133
|
+
"hinged",
|
|
134
|
+
"hinged-double",
|
|
135
|
+
"sliding",
|
|
136
|
+
"sliding-double",
|
|
137
|
+
"sliding-bypass",
|
|
138
|
+
"fixed",
|
|
139
|
+
"projecting",
|
|
140
|
+
"curtain-wall",
|
|
141
|
+
]);
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* Whether a known opening operation applies to the declared opening kind.
|
|
145
|
+
*
|
|
146
|
+
* Unknown values return true because ATT02 owns that contradiction. This check only partitions
|
|
147
|
+
* the closed vocabulary and therefore never emits a second diagnostic for one misspelling.
|
|
148
|
+
*/
|
|
149
|
+
export function openingStyleAppliesTo(kind: "door" | "window", style: string): boolean {
|
|
150
|
+
if (!(OPENING_STYLE_VALUES as readonly string[]).includes(style)) return true;
|
|
151
|
+
return (kind === "door" ? DOOR_OPENING_STYLES : WINDOW_OPENING_STYLES).has(style);
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
/** The other opening kind for a known operation that does not apply to `kind`. */
|
|
155
|
+
export function openingStyleOwner(kind: "door" | "window", style: string): "door" | "window" | undefined {
|
|
156
|
+
if (openingStyleAppliesTo(kind, style)) return undefined;
|
|
157
|
+
return kind === "door" ? "window" : "door";
|
|
158
|
+
}
|
|
159
|
+
|
|
74
160
|
/** そのキーが名前空間つきの運搬層かどうか */
|
|
75
161
|
export function isNamespaced(key: string): boolean {
|
|
76
162
|
return CARRY_NAMESPACE.test(key);
|
|
@@ -174,12 +260,13 @@ export const ATTR_LEDGER: Record<string, Record<string, AttrSpec>> = {
|
|
|
174
260
|
hinge: structure(),
|
|
175
261
|
swing: structure(),
|
|
176
262
|
|
|
177
|
-
//
|
|
178
|
-
style: one(
|
|
179
|
-
|
|
263
|
+
// Interpreted.
|
|
264
|
+
style: one(...OPENING_STYLE_VALUES), // selects the plan opening symbol
|
|
265
|
+
panels: num(), // explicit equal panel count for a curtain wall
|
|
266
|
+
name: free(), // unique within the boundary: the opening's identity key
|
|
180
267
|
|
|
181
|
-
//
|
|
182
|
-
sill: carry(), //
|
|
268
|
+
// Carried.
|
|
269
|
+
sill: carry(), // window sill height
|
|
183
270
|
spec: carry(),
|
|
184
271
|
fire: carry(),
|
|
185
272
|
},
|
|
@@ -188,6 +275,23 @@ export const ATTR_LEDGER: Record<string, Record<string, AttrSpec>> = {
|
|
|
188
275
|
floor: carry(),
|
|
189
276
|
name: free(),
|
|
190
277
|
spec: carry(),
|
|
278
|
+
// A named uncounted area is the sole placement frame for a component asset. Position remains
|
|
279
|
+
// relative to the written extent, so changing the extent moves the component with it.
|
|
280
|
+
asset: free(),
|
|
281
|
+
"align-x": one("min", "center", "max"),
|
|
282
|
+
"align-y": one("min", "center", "max"),
|
|
283
|
+
"offset-x": free(),
|
|
284
|
+
"offset-y": free(),
|
|
285
|
+
rotate: free(),
|
|
286
|
+
},
|
|
287
|
+
|
|
288
|
+
component: {
|
|
289
|
+
w: num(),
|
|
290
|
+
d: num(),
|
|
291
|
+
"plan-svg": free(),
|
|
292
|
+
name: free(),
|
|
293
|
+
category: carry(),
|
|
294
|
+
spec: carry(),
|
|
191
295
|
},
|
|
192
296
|
|
|
193
297
|
seg: {
|
|
@@ -243,8 +347,10 @@ export function attrSpec(elem: string, key: string): AttrSpec | undefined {
|
|
|
243
347
|
return ATTR_LEDGER[elem]?.[key];
|
|
244
348
|
}
|
|
245
349
|
|
|
246
|
-
/**
|
|
247
|
-
* asset は開口の既定値の束なので、開口と同じ台帳で読む (ADR-0010)。
|
|
248
|
-
* 「アセットに書けて開口に書けない属性」を作らないための同一視である。
|
|
249
|
-
*/
|
|
350
|
+
/** Door and window assets use the opening ledger unchanged. */
|
|
250
351
|
export const ASSET_ELEM = "opening";
|
|
352
|
+
|
|
353
|
+
/** Door/window assets share the opening ledger; placed component assets have their own ledger. */
|
|
354
|
+
export function assetElem(kind: "door" | "window" | "component"): "opening" | "component" {
|
|
355
|
+
return kind === "component" ? "component" : ASSET_ELEM;
|
|
356
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { readFileSync } from "node:fs";
|
|
2
|
+
import { dirname, resolve } from "node:path";
|
|
3
|
+
|
|
4
|
+
import { placedComponents } from "../core/components.js";
|
|
5
|
+
import type { Model } from "../core/model.js";
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Read component plan artwork for a filesystem-backed model. The bytes enter drawing only: they
|
|
9
|
+
* are absent from Model, canonical JSON and Form. A composed override resolves relative to the
|
|
10
|
+
* layer that supplied the winning plan-svg value.
|
|
11
|
+
*/
|
|
12
|
+
export function componentSvgFiles(model: Model, level?: string): Readonly<Record<string, string>> {
|
|
13
|
+
const sources: Record<string, string> = {};
|
|
14
|
+
const needed = new Set(
|
|
15
|
+
placedComponents(model).components
|
|
16
|
+
.filter((component) => level === undefined || component.level === level)
|
|
17
|
+
.map((component) => component.asset),
|
|
18
|
+
);
|
|
19
|
+
for (const asset of model.assets.values()) {
|
|
20
|
+
if (asset.kind !== "component" || !needed.has(asset.name)) continue;
|
|
21
|
+
const ref = asset.attrs["plan-svg"];
|
|
22
|
+
if (typeof ref !== "string" || (!ref.startsWith("./") && !ref.startsWith("../"))) continue;
|
|
23
|
+
const layer = model.attrSrc.get(`asset:${asset.name}:plan-svg`);
|
|
24
|
+
const from = layer === undefined ? asset.file : model.layers[layer] ?? asset.file;
|
|
25
|
+
if (!from) {
|
|
26
|
+
throw new Error(`Component asset ${asset.name} plan-svg cannot be resolved from a source file`);
|
|
27
|
+
}
|
|
28
|
+
const file = resolve(dirname(from), ref);
|
|
29
|
+
try {
|
|
30
|
+
sources[asset.name] = readFileSync(file, "utf8");
|
|
31
|
+
} catch {
|
|
32
|
+
throw new Error(`Cannot read plan SVG for component asset ${asset.name}: ${ref}`);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
return sources;
|
|
36
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import type { Asset } from "../core/model.js";
|
|
2
|
+
|
|
3
|
+
export interface ComponentSvg {
|
|
4
|
+
dataUri: string;
|
|
5
|
+
viewBox: { width: number; height: number };
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Validate an SVG before it is embedded as an isolated image. Isolation preserves Figma-style
|
|
10
|
+
* defs, masks and clip paths without letting IDs collide with the plan sheet.
|
|
11
|
+
*/
|
|
12
|
+
export function componentSvg(asset: Asset, source: string): ComponentSvg {
|
|
13
|
+
const text = source.trim();
|
|
14
|
+
const root = /<svg\b([^>]*)>/i.exec(text);
|
|
15
|
+
if (!root) throw new Error(`Component asset ${asset.name} plan-svg does not contain an svg root`);
|
|
16
|
+
const number = "[+-]?(?:\\d+(?:\\.\\d*)?|\\.\\d+)(?:[eE][+-]?\\d+)?";
|
|
17
|
+
const viewBox = new RegExp(
|
|
18
|
+
`\\bviewBox\\s*=\\s*["']\\s*(${number})\\s+(${number})\\s+(${number})\\s+(${number})\\s*["']`,
|
|
19
|
+
"i",
|
|
20
|
+
).exec(root[1]!);
|
|
21
|
+
if (!viewBox) throw new Error(`Component asset ${asset.name} plan-svg requires a positive viewBox`);
|
|
22
|
+
const width = Number(viewBox[3]);
|
|
23
|
+
const height = Number(viewBox[4]);
|
|
24
|
+
if (!(width > 0 && height > 0)) throw new Error(`Component asset ${asset.name} plan-svg requires a positive viewBox`);
|
|
25
|
+
|
|
26
|
+
const forbidden = [
|
|
27
|
+
/<!DOCTYPE/i,
|
|
28
|
+
/<!ENTITY/i,
|
|
29
|
+
/<script\b/i,
|
|
30
|
+
/<foreignObject\b/i,
|
|
31
|
+
/<(?:animate|animateMotion|animateTransform|set)\b/i,
|
|
32
|
+
/\s(?:[A-Za-z_][\w.-]*:)?on[a-z]+\s*=/i,
|
|
33
|
+
/javascript\s*:/i,
|
|
34
|
+
/@import\b/i,
|
|
35
|
+
];
|
|
36
|
+
if (forbidden.some((pattern) => pattern.test(text))) {
|
|
37
|
+
throw new Error(`Component asset ${asset.name} plan-svg contains active or external content`);
|
|
38
|
+
}
|
|
39
|
+
for (const match of text.matchAll(/\b(?:href|src)\s*=\s*["']([^"']+)["']/gi)) {
|
|
40
|
+
const value = match[1]!;
|
|
41
|
+
if (!safeReference(value)) {
|
|
42
|
+
throw new Error(`Component asset ${asset.name} plan-svg contains an external reference: ${value}`);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
for (const match of text.matchAll(/url\(\s*([^)]+?)\s*\)/gi)) {
|
|
46
|
+
const value = match[1]!.replace(/^["']|["']$/g, "").trim();
|
|
47
|
+
if (!safeReference(value)) {
|
|
48
|
+
throw new Error(`Component asset ${asset.name} plan-svg contains an external reference: ${value}`);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
const w = asset.attrs["w"];
|
|
53
|
+
const d = asset.attrs["d"];
|
|
54
|
+
if (typeof w !== "number" || !(w > 0) || typeof d !== "number" || !(d > 0)) {
|
|
55
|
+
throw new Error(`Component asset ${asset.name} requires positive w: and d:`);
|
|
56
|
+
}
|
|
57
|
+
const sourceRatio = width / height;
|
|
58
|
+
const physicalRatio = w / d;
|
|
59
|
+
const ratioError = Math.abs(sourceRatio - physicalRatio) / physicalRatio;
|
|
60
|
+
if (ratioError > 0.001) {
|
|
61
|
+
throw new Error(
|
|
62
|
+
`Component asset ${asset.name} plan-svg viewBox ratio ${round(sourceRatio)} does not match w:d ratio ${round(physicalRatio)}`,
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
return {
|
|
67
|
+
dataUri: `data:image/svg+xml,${encodeURIComponent(text).replace(/'/g, "%27").replace(/"/g, "%22")}`,
|
|
68
|
+
viewBox: { width, height },
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
function safeReference(value: string): boolean {
|
|
73
|
+
if (value.startsWith("#")) return true;
|
|
74
|
+
return /^data:image\/(?:png|jpeg|webp|gif);base64,/i.test(value);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
function round(value: number): number {
|
|
78
|
+
return Math.round(value * 10000) / 10000;
|
|
79
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
// Shared architectural plan conventions.
|
|
2
|
+
//
|
|
3
|
+
// These values describe paper symbols, never building geometry. They live outside core and Form
|
|
4
|
+
// so another drawing convention can replace them without changing a `.muro` file, canonical JSON,
|
|
5
|
+
// circulation, area or validation. The current set is broadly shared architectural practice; a
|
|
6
|
+
// jurisdiction module should override only a convention that is actually different.
|
|
7
|
+
|
|
8
|
+
export interface ArchitecturalPlanConvention {
|
|
9
|
+
readonly openings: {
|
|
10
|
+
/** Clear paper distance from the wall face to a sliding panel, in model millimetres. */
|
|
11
|
+
readonly slidingGapMm: number;
|
|
12
|
+
/** Extra overlap used to make two bypass leaves legible as separate panels. */
|
|
13
|
+
readonly bypassOverlapRatio: number;
|
|
14
|
+
/** Length of an automatic-door direction chevron relative to the aperture width. */
|
|
15
|
+
readonly automaticDirectionRatio: number;
|
|
16
|
+
/** Meeting point of the larger leaf in an unequal pair, measured from the first jamb. */
|
|
17
|
+
readonly unequalLeafMeetingRatio: number;
|
|
18
|
+
};
|
|
19
|
+
readonly stairs: {
|
|
20
|
+
/** How far an arrow enters a landing, relative to the narrower adjoining flight. */
|
|
21
|
+
readonly landingOffsetFlightWidthRatio: number;
|
|
22
|
+
readonly breakGlyph: {
|
|
23
|
+
/** Rotation from the line that crosses the flight. */
|
|
24
|
+
readonly angleDegrees: number;
|
|
25
|
+
/** Source-glyph proportions. The glyph is scaled to the flight width. */
|
|
26
|
+
readonly width: number;
|
|
27
|
+
readonly height: number;
|
|
28
|
+
readonly notch: number;
|
|
29
|
+
};
|
|
30
|
+
readonly arrowHead: {
|
|
31
|
+
/** SVG-space sizes: legibility belongs to paper, not to the building model. */
|
|
32
|
+
readonly length: number;
|
|
33
|
+
readonly halfWidth: number;
|
|
34
|
+
readonly startRadius: number;
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export const ARCHITECTURAL_PLAN_CONVENTION: ArchitecturalPlanConvention = {
|
|
40
|
+
openings: {
|
|
41
|
+
slidingGapMm: 60,
|
|
42
|
+
bypassOverlapRatio: 0.12,
|
|
43
|
+
automaticDirectionRatio: 0.08,
|
|
44
|
+
unequalLeafMeetingRatio: 2 / 3,
|
|
45
|
+
},
|
|
46
|
+
stairs: {
|
|
47
|
+
landingOffsetFlightWidthRatio: 0.5,
|
|
48
|
+
breakGlyph: {
|
|
49
|
+
angleDegrees: 30,
|
|
50
|
+
width: 10,
|
|
51
|
+
height: 40,
|
|
52
|
+
notch: 3.5,
|
|
53
|
+
},
|
|
54
|
+
arrowHead: {
|
|
55
|
+
length: 8,
|
|
56
|
+
halfWidth: 3.5,
|
|
57
|
+
startRadius: 2.8,
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
};
|