planscript 0.1.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/LICENSE +19 -0
- package/README.md +277 -0
- package/dist/ast/types.d.ts +195 -0
- package/dist/ast/types.d.ts.map +1 -0
- package/dist/ast/types.js +5 -0
- package/dist/ast/types.js.map +1 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +100 -0
- package/dist/cli.js.map +1 -0
- package/dist/compiler.d.ts +30 -0
- package/dist/compiler.d.ts.map +1 -0
- package/dist/compiler.js +80 -0
- package/dist/compiler.js.map +1 -0
- package/dist/exporters/json.d.ts +13 -0
- package/dist/exporters/json.d.ts.map +1 -0
- package/dist/exporters/json.js +17 -0
- package/dist/exporters/json.js.map +1 -0
- package/dist/exporters/svg.d.ts +27 -0
- package/dist/exporters/svg.d.ts.map +1 -0
- package/dist/exporters/svg.js +684 -0
- package/dist/exporters/svg.js.map +1 -0
- package/dist/geometry/index.d.ts +13 -0
- package/dist/geometry/index.d.ts.map +1 -0
- package/dist/geometry/index.js +333 -0
- package/dist/geometry/index.js.map +1 -0
- package/dist/geometry/types.d.ts +34 -0
- package/dist/geometry/types.d.ts.map +1 -0
- package/dist/geometry/types.js +2 -0
- package/dist/geometry/types.js.map +1 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +20 -0
- package/dist/index.js.map +1 -0
- package/dist/lowering/index.d.ts +25 -0
- package/dist/lowering/index.d.ts.map +1 -0
- package/dist/lowering/index.js +217 -0
- package/dist/lowering/index.js.map +1 -0
- package/dist/parser/grammar.d.ts +168 -0
- package/dist/parser/grammar.d.ts.map +1 -0
- package/dist/parser/grammar.js +7341 -0
- package/dist/parser/grammar.js.map +1 -0
- package/dist/parser/index.d.ts +27 -0
- package/dist/parser/index.d.ts.map +1 -0
- package/dist/parser/index.js +26 -0
- package/dist/parser/index.js.map +1 -0
- package/dist/validation/index.d.ts +22 -0
- package/dist/validation/index.d.ts.map +1 -0
- package/dist/validation/index.js +243 -0
- package/dist/validation/index.js.map +1 -0
- package/examples/house-with-dimensions.svg +106 -0
- package/examples/house.json +478 -0
- package/examples/house.psc +86 -0
- package/examples/house.svg +57 -0
- package/package.json +54 -0
|
@@ -0,0 +1,478 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": "1.0.0",
|
|
3
|
+
"geometry": {
|
|
4
|
+
"footprint": {
|
|
5
|
+
"points": [
|
|
6
|
+
{
|
|
7
|
+
"x": 0,
|
|
8
|
+
"y": 0
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
"x": 20,
|
|
12
|
+
"y": 0
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
"x": 20,
|
|
16
|
+
"y": 30
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
"x": 0,
|
|
20
|
+
"y": 30
|
|
21
|
+
}
|
|
22
|
+
]
|
|
23
|
+
},
|
|
24
|
+
"rooms": [
|
|
25
|
+
{
|
|
26
|
+
"name": "living",
|
|
27
|
+
"label": "Living Room",
|
|
28
|
+
"polygon": {
|
|
29
|
+
"points": [
|
|
30
|
+
{
|
|
31
|
+
"x": 1,
|
|
32
|
+
"y": 1
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
"x": 9,
|
|
36
|
+
"y": 1
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
"x": 9,
|
|
40
|
+
"y": 7
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
"x": 1,
|
|
44
|
+
"y": 7
|
|
45
|
+
}
|
|
46
|
+
]
|
|
47
|
+
},
|
|
48
|
+
"area": 48
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
"name": "kitchen",
|
|
52
|
+
"label": "Kitchen",
|
|
53
|
+
"polygon": {
|
|
54
|
+
"points": [
|
|
55
|
+
{
|
|
56
|
+
"x": 9,
|
|
57
|
+
"y": 1
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
"x": 13,
|
|
61
|
+
"y": 1
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
"x": 13,
|
|
65
|
+
"y": 7
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
"x": 9,
|
|
69
|
+
"y": 7
|
|
70
|
+
}
|
|
71
|
+
]
|
|
72
|
+
},
|
|
73
|
+
"area": 24
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
"name": "hall",
|
|
77
|
+
"label": "Hallway",
|
|
78
|
+
"polygon": {
|
|
79
|
+
"points": [
|
|
80
|
+
{
|
|
81
|
+
"x": 1,
|
|
82
|
+
"y": 7
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
"x": 13,
|
|
86
|
+
"y": 7
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
"x": 13,
|
|
90
|
+
"y": 9
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
"x": 1,
|
|
94
|
+
"y": 9
|
|
95
|
+
}
|
|
96
|
+
]
|
|
97
|
+
},
|
|
98
|
+
"area": 24
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
"name": "bedroom",
|
|
102
|
+
"label": "Master Bedroom",
|
|
103
|
+
"polygon": {
|
|
104
|
+
"points": [
|
|
105
|
+
{
|
|
106
|
+
"x": 1,
|
|
107
|
+
"y": 9
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
"x": 4.6,
|
|
111
|
+
"y": 9
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
"x": 4.6,
|
|
115
|
+
"y": 13
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
"x": 1,
|
|
119
|
+
"y": 13
|
|
120
|
+
}
|
|
121
|
+
]
|
|
122
|
+
},
|
|
123
|
+
"area": 14.399999999999999
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
"name": "bath",
|
|
127
|
+
"label": "Bathroom",
|
|
128
|
+
"polygon": {
|
|
129
|
+
"points": [
|
|
130
|
+
{
|
|
131
|
+
"x": 4.6,
|
|
132
|
+
"y": 10.8
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
"x": 7.199999999999999,
|
|
136
|
+
"y": 10.8
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
"x": 7.199999999999999,
|
|
140
|
+
"y": 13
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
"x": 4.6,
|
|
144
|
+
"y": 13
|
|
145
|
+
}
|
|
146
|
+
]
|
|
147
|
+
},
|
|
148
|
+
"area": 5.720000000000006
|
|
149
|
+
}
|
|
150
|
+
],
|
|
151
|
+
"walls": [
|
|
152
|
+
{
|
|
153
|
+
"id": "wall_0",
|
|
154
|
+
"start": {
|
|
155
|
+
"x": 9,
|
|
156
|
+
"y": 1
|
|
157
|
+
},
|
|
158
|
+
"end": {
|
|
159
|
+
"x": 9,
|
|
160
|
+
"y": 7
|
|
161
|
+
},
|
|
162
|
+
"thickness": 0.15,
|
|
163
|
+
"isExterior": false,
|
|
164
|
+
"rooms": [
|
|
165
|
+
"living",
|
|
166
|
+
"kitchen"
|
|
167
|
+
]
|
|
168
|
+
},
|
|
169
|
+
{
|
|
170
|
+
"id": "wall_1",
|
|
171
|
+
"start": {
|
|
172
|
+
"x": 1,
|
|
173
|
+
"y": 7
|
|
174
|
+
},
|
|
175
|
+
"end": {
|
|
176
|
+
"x": 9,
|
|
177
|
+
"y": 7
|
|
178
|
+
},
|
|
179
|
+
"thickness": 0.15,
|
|
180
|
+
"isExterior": false,
|
|
181
|
+
"rooms": [
|
|
182
|
+
"living",
|
|
183
|
+
"hall"
|
|
184
|
+
]
|
|
185
|
+
},
|
|
186
|
+
{
|
|
187
|
+
"id": "wall_2",
|
|
188
|
+
"start": {
|
|
189
|
+
"x": 9,
|
|
190
|
+
"y": 7
|
|
191
|
+
},
|
|
192
|
+
"end": {
|
|
193
|
+
"x": 13,
|
|
194
|
+
"y": 7
|
|
195
|
+
},
|
|
196
|
+
"thickness": 0.15,
|
|
197
|
+
"isExterior": false,
|
|
198
|
+
"rooms": [
|
|
199
|
+
"kitchen",
|
|
200
|
+
"hall"
|
|
201
|
+
]
|
|
202
|
+
},
|
|
203
|
+
{
|
|
204
|
+
"id": "wall_3",
|
|
205
|
+
"start": {
|
|
206
|
+
"x": 1,
|
|
207
|
+
"y": 9
|
|
208
|
+
},
|
|
209
|
+
"end": {
|
|
210
|
+
"x": 4.6,
|
|
211
|
+
"y": 9
|
|
212
|
+
},
|
|
213
|
+
"thickness": 0.15,
|
|
214
|
+
"isExterior": false,
|
|
215
|
+
"rooms": [
|
|
216
|
+
"hall",
|
|
217
|
+
"bedroom"
|
|
218
|
+
]
|
|
219
|
+
},
|
|
220
|
+
{
|
|
221
|
+
"id": "wall_4",
|
|
222
|
+
"start": {
|
|
223
|
+
"x": 4.6,
|
|
224
|
+
"y": 10.8
|
|
225
|
+
},
|
|
226
|
+
"end": {
|
|
227
|
+
"x": 4.6,
|
|
228
|
+
"y": 13
|
|
229
|
+
},
|
|
230
|
+
"thickness": 0.15,
|
|
231
|
+
"isExterior": false,
|
|
232
|
+
"rooms": [
|
|
233
|
+
"bedroom",
|
|
234
|
+
"bath"
|
|
235
|
+
]
|
|
236
|
+
},
|
|
237
|
+
{
|
|
238
|
+
"id": "wall_5",
|
|
239
|
+
"start": {
|
|
240
|
+
"x": 1,
|
|
241
|
+
"y": 1
|
|
242
|
+
},
|
|
243
|
+
"end": {
|
|
244
|
+
"x": 9,
|
|
245
|
+
"y": 1
|
|
246
|
+
},
|
|
247
|
+
"thickness": 0.15,
|
|
248
|
+
"isExterior": false,
|
|
249
|
+
"rooms": [
|
|
250
|
+
"living"
|
|
251
|
+
]
|
|
252
|
+
},
|
|
253
|
+
{
|
|
254
|
+
"id": "wall_6",
|
|
255
|
+
"start": {
|
|
256
|
+
"x": 1,
|
|
257
|
+
"y": 1
|
|
258
|
+
},
|
|
259
|
+
"end": {
|
|
260
|
+
"x": 1,
|
|
261
|
+
"y": 7
|
|
262
|
+
},
|
|
263
|
+
"thickness": 0.15,
|
|
264
|
+
"isExterior": false,
|
|
265
|
+
"rooms": [
|
|
266
|
+
"living"
|
|
267
|
+
]
|
|
268
|
+
},
|
|
269
|
+
{
|
|
270
|
+
"id": "wall_7",
|
|
271
|
+
"start": {
|
|
272
|
+
"x": 9,
|
|
273
|
+
"y": 1
|
|
274
|
+
},
|
|
275
|
+
"end": {
|
|
276
|
+
"x": 13,
|
|
277
|
+
"y": 1
|
|
278
|
+
},
|
|
279
|
+
"thickness": 0.15,
|
|
280
|
+
"isExterior": false,
|
|
281
|
+
"rooms": [
|
|
282
|
+
"kitchen"
|
|
283
|
+
]
|
|
284
|
+
},
|
|
285
|
+
{
|
|
286
|
+
"id": "wall_8",
|
|
287
|
+
"start": {
|
|
288
|
+
"x": 13,
|
|
289
|
+
"y": 1
|
|
290
|
+
},
|
|
291
|
+
"end": {
|
|
292
|
+
"x": 13,
|
|
293
|
+
"y": 7
|
|
294
|
+
},
|
|
295
|
+
"thickness": 0.15,
|
|
296
|
+
"isExterior": false,
|
|
297
|
+
"rooms": [
|
|
298
|
+
"kitchen"
|
|
299
|
+
]
|
|
300
|
+
},
|
|
301
|
+
{
|
|
302
|
+
"id": "wall_9",
|
|
303
|
+
"start": {
|
|
304
|
+
"x": 13,
|
|
305
|
+
"y": 7
|
|
306
|
+
},
|
|
307
|
+
"end": {
|
|
308
|
+
"x": 13,
|
|
309
|
+
"y": 9
|
|
310
|
+
},
|
|
311
|
+
"thickness": 0.15,
|
|
312
|
+
"isExterior": false,
|
|
313
|
+
"rooms": [
|
|
314
|
+
"hall"
|
|
315
|
+
]
|
|
316
|
+
},
|
|
317
|
+
{
|
|
318
|
+
"id": "wall_10",
|
|
319
|
+
"start": {
|
|
320
|
+
"x": 4.6,
|
|
321
|
+
"y": 9
|
|
322
|
+
},
|
|
323
|
+
"end": {
|
|
324
|
+
"x": 13,
|
|
325
|
+
"y": 9
|
|
326
|
+
},
|
|
327
|
+
"thickness": 0.15,
|
|
328
|
+
"isExterior": false,
|
|
329
|
+
"rooms": [
|
|
330
|
+
"hall"
|
|
331
|
+
]
|
|
332
|
+
},
|
|
333
|
+
{
|
|
334
|
+
"id": "wall_11",
|
|
335
|
+
"start": {
|
|
336
|
+
"x": 1,
|
|
337
|
+
"y": 7
|
|
338
|
+
},
|
|
339
|
+
"end": {
|
|
340
|
+
"x": 1,
|
|
341
|
+
"y": 9
|
|
342
|
+
},
|
|
343
|
+
"thickness": 0.15,
|
|
344
|
+
"isExterior": false,
|
|
345
|
+
"rooms": [
|
|
346
|
+
"hall"
|
|
347
|
+
]
|
|
348
|
+
},
|
|
349
|
+
{
|
|
350
|
+
"id": "wall_12",
|
|
351
|
+
"start": {
|
|
352
|
+
"x": 4.6,
|
|
353
|
+
"y": 9
|
|
354
|
+
},
|
|
355
|
+
"end": {
|
|
356
|
+
"x": 4.6,
|
|
357
|
+
"y": 10.8
|
|
358
|
+
},
|
|
359
|
+
"thickness": 0.15,
|
|
360
|
+
"isExterior": false,
|
|
361
|
+
"rooms": [
|
|
362
|
+
"bedroom"
|
|
363
|
+
]
|
|
364
|
+
},
|
|
365
|
+
{
|
|
366
|
+
"id": "wall_13",
|
|
367
|
+
"start": {
|
|
368
|
+
"x": 1,
|
|
369
|
+
"y": 13
|
|
370
|
+
},
|
|
371
|
+
"end": {
|
|
372
|
+
"x": 4.6,
|
|
373
|
+
"y": 13
|
|
374
|
+
},
|
|
375
|
+
"thickness": 0.15,
|
|
376
|
+
"isExterior": false,
|
|
377
|
+
"rooms": [
|
|
378
|
+
"bedroom"
|
|
379
|
+
]
|
|
380
|
+
},
|
|
381
|
+
{
|
|
382
|
+
"id": "wall_14",
|
|
383
|
+
"start": {
|
|
384
|
+
"x": 1,
|
|
385
|
+
"y": 9
|
|
386
|
+
},
|
|
387
|
+
"end": {
|
|
388
|
+
"x": 1,
|
|
389
|
+
"y": 13
|
|
390
|
+
},
|
|
391
|
+
"thickness": 0.15,
|
|
392
|
+
"isExterior": false,
|
|
393
|
+
"rooms": [
|
|
394
|
+
"bedroom"
|
|
395
|
+
]
|
|
396
|
+
},
|
|
397
|
+
{
|
|
398
|
+
"id": "wall_15",
|
|
399
|
+
"start": {
|
|
400
|
+
"x": 4.6,
|
|
401
|
+
"y": 10.8
|
|
402
|
+
},
|
|
403
|
+
"end": {
|
|
404
|
+
"x": 7.199999999999999,
|
|
405
|
+
"y": 10.8
|
|
406
|
+
},
|
|
407
|
+
"thickness": 0.15,
|
|
408
|
+
"isExterior": false,
|
|
409
|
+
"rooms": [
|
|
410
|
+
"bath"
|
|
411
|
+
]
|
|
412
|
+
},
|
|
413
|
+
{
|
|
414
|
+
"id": "wall_16",
|
|
415
|
+
"start": {
|
|
416
|
+
"x": 7.199999999999999,
|
|
417
|
+
"y": 10.8
|
|
418
|
+
},
|
|
419
|
+
"end": {
|
|
420
|
+
"x": 7.199999999999999,
|
|
421
|
+
"y": 13
|
|
422
|
+
},
|
|
423
|
+
"thickness": 0.15,
|
|
424
|
+
"isExterior": false,
|
|
425
|
+
"rooms": [
|
|
426
|
+
"bath"
|
|
427
|
+
]
|
|
428
|
+
},
|
|
429
|
+
{
|
|
430
|
+
"id": "wall_17",
|
|
431
|
+
"start": {
|
|
432
|
+
"x": 4.6,
|
|
433
|
+
"y": 13
|
|
434
|
+
},
|
|
435
|
+
"end": {
|
|
436
|
+
"x": 7.199999999999999,
|
|
437
|
+
"y": 13
|
|
438
|
+
},
|
|
439
|
+
"thickness": 0.15,
|
|
440
|
+
"isExterior": false,
|
|
441
|
+
"rooms": [
|
|
442
|
+
"bath"
|
|
443
|
+
]
|
|
444
|
+
}
|
|
445
|
+
],
|
|
446
|
+
"openings": [
|
|
447
|
+
{
|
|
448
|
+
"id": "d1",
|
|
449
|
+
"type": "door",
|
|
450
|
+
"wallId": "wall_1",
|
|
451
|
+
"position": 4.8,
|
|
452
|
+
"width": 0.9
|
|
453
|
+
},
|
|
454
|
+
{
|
|
455
|
+
"id": "d2",
|
|
456
|
+
"type": "door",
|
|
457
|
+
"wallId": "wall_0",
|
|
458
|
+
"position": 3,
|
|
459
|
+
"width": 0.9
|
|
460
|
+
},
|
|
461
|
+
{
|
|
462
|
+
"id": "d3",
|
|
463
|
+
"type": "door",
|
|
464
|
+
"wallId": "wall_3",
|
|
465
|
+
"position": 1.7999999999999998,
|
|
466
|
+
"width": 0.9
|
|
467
|
+
},
|
|
468
|
+
{
|
|
469
|
+
"id": "w1",
|
|
470
|
+
"type": "window",
|
|
471
|
+
"wallId": "wall_5",
|
|
472
|
+
"position": 2,
|
|
473
|
+
"width": 2.4,
|
|
474
|
+
"sill": 0.9
|
|
475
|
+
}
|
|
476
|
+
]
|
|
477
|
+
}
|
|
478
|
+
}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
# Example House Floor Plan
|
|
2
|
+
# This demonstrates the full syntax of PlanScript
|
|
3
|
+
|
|
4
|
+
units m
|
|
5
|
+
origin (0,0)
|
|
6
|
+
|
|
7
|
+
# Default widths for doors and windows
|
|
8
|
+
defaults {
|
|
9
|
+
door_width 0.9
|
|
10
|
+
window_width 2.4
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
plan "Example House" {
|
|
14
|
+
footprint rect (0,0) (20,30)
|
|
15
|
+
|
|
16
|
+
# Main living area
|
|
17
|
+
room living {
|
|
18
|
+
rect (1,1) (9,7)
|
|
19
|
+
label "Living Room"
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
# Kitchen attached to living room
|
|
23
|
+
room kitchen {
|
|
24
|
+
rect size (4,6)
|
|
25
|
+
attach east_of living
|
|
26
|
+
align top
|
|
27
|
+
gap 0
|
|
28
|
+
label "Kitchen"
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
# Hallway spanning from living to kitchen
|
|
32
|
+
room hall {
|
|
33
|
+
rect span x from living.left to kitchen.right y (7, 9)
|
|
34
|
+
label "Hallway"
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
# Bedroom
|
|
38
|
+
room bedroom {
|
|
39
|
+
rect at (1,9) size (3.6,4.0)
|
|
40
|
+
label "Master Bedroom"
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
# Bathroom attached to bedroom
|
|
44
|
+
room bath {
|
|
45
|
+
rect size (2.6,2.2)
|
|
46
|
+
attach east_of bedroom
|
|
47
|
+
align top
|
|
48
|
+
label "Bathroom"
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
# Door between living and hall (uses default door_width)
|
|
52
|
+
# at 60% means 60% along the shared wall
|
|
53
|
+
opening door d1 {
|
|
54
|
+
between living and hall
|
|
55
|
+
on shared_edge
|
|
56
|
+
at 60%
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
# Door between living and kitchen (uses default door_width)
|
|
60
|
+
# at 50% means centered on the shared wall
|
|
61
|
+
opening door d2 {
|
|
62
|
+
between living and kitchen
|
|
63
|
+
on shared_edge
|
|
64
|
+
at 50%
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
# Door between hallway and master bedroom (uses default door_width)
|
|
68
|
+
opening door d3 {
|
|
69
|
+
between hall and bedroom
|
|
70
|
+
on shared_edge
|
|
71
|
+
at 50%
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
# Window on living room south wall (uses default window_width)
|
|
75
|
+
# at 2.0 means 2.0 meters from the left edge of the wall
|
|
76
|
+
opening window w1 {
|
|
77
|
+
on living.edge south
|
|
78
|
+
at 2.0
|
|
79
|
+
sill 0.9
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
# Assertions for validation
|
|
83
|
+
assert no_overlap rooms
|
|
84
|
+
assert inside footprint all_rooms
|
|
85
|
+
assert min_room_area bedroom >= 12.0
|
|
86
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="1000" height="800" viewBox="0 0 1000 800">
|
|
3
|
+
<defs>
|
|
4
|
+
<style>
|
|
5
|
+
.room-label { font-family: Arial, sans-serif; font-weight: 500; }
|
|
6
|
+
</style>
|
|
7
|
+
</defs>
|
|
8
|
+
|
|
9
|
+
<!-- Background -->
|
|
10
|
+
<rect width="1000" height="800" fill="#ffffff" />
|
|
11
|
+
|
|
12
|
+
<!-- Footprint (boundary) -->
|
|
13
|
+
<path d="M 273.33 740.00 L 726.67 740.00 L 726.67 60.00 L 273.33 60.00 Z" fill="none" stroke="#7f8c8d" stroke-width="2" stroke-dasharray="8,4" />
|
|
14
|
+
|
|
15
|
+
<!-- Rooms -->
|
|
16
|
+
<path d="M 296.00 717.33 L 477.33 717.33 L 477.33 581.33 L 296.00 581.33 Z" fill="#ecf0f1" stroke="#bdc3c7" stroke-width="1" />
|
|
17
|
+
<path d="M 477.33 717.33 L 568.00 717.33 L 568.00 581.33 L 477.33 581.33 Z" fill="#ecf0f1" stroke="#bdc3c7" stroke-width="1" />
|
|
18
|
+
<path d="M 296.00 581.33 L 568.00 581.33 L 568.00 536.00 L 296.00 536.00 Z" fill="#ecf0f1" stroke="#bdc3c7" stroke-width="1" />
|
|
19
|
+
<path d="M 296.00 536.00 L 377.60 536.00 L 377.60 445.33 L 296.00 445.33 Z" fill="#ecf0f1" stroke="#bdc3c7" stroke-width="1" />
|
|
20
|
+
<path d="M 377.60 495.20 L 436.53 495.20 L 436.53 445.33 L 377.60 445.33 Z" fill="#ecf0f1" stroke="#bdc3c7" stroke-width="1" />
|
|
21
|
+
|
|
22
|
+
<!-- Walls -->
|
|
23
|
+
<line x1="477.33" y1="717.33" x2="477.33" y2="581.33" stroke="#2c3e50" stroke-width="3" stroke-linecap="round" />
|
|
24
|
+
<line x1="296.00" y1="581.33" x2="477.33" y2="581.33" stroke="#2c3e50" stroke-width="3" stroke-linecap="round" />
|
|
25
|
+
<line x1="477.33" y1="581.33" x2="568.00" y2="581.33" stroke="#2c3e50" stroke-width="3" stroke-linecap="round" />
|
|
26
|
+
<line x1="296.00" y1="536.00" x2="377.60" y2="536.00" stroke="#2c3e50" stroke-width="3" stroke-linecap="round" />
|
|
27
|
+
<line x1="377.60" y1="495.20" x2="377.60" y2="445.33" stroke="#2c3e50" stroke-width="3" stroke-linecap="round" />
|
|
28
|
+
<line x1="296.00" y1="717.33" x2="477.33" y2="717.33" stroke="#2c3e50" stroke-width="3" stroke-linecap="round" />
|
|
29
|
+
<line x1="296.00" y1="717.33" x2="296.00" y2="581.33" stroke="#2c3e50" stroke-width="3" stroke-linecap="round" />
|
|
30
|
+
<line x1="477.33" y1="717.33" x2="568.00" y2="717.33" stroke="#2c3e50" stroke-width="3" stroke-linecap="round" />
|
|
31
|
+
<line x1="568.00" y1="717.33" x2="568.00" y2="581.33" stroke="#2c3e50" stroke-width="3" stroke-linecap="round" />
|
|
32
|
+
<line x1="568.00" y1="581.33" x2="568.00" y2="536.00" stroke="#2c3e50" stroke-width="3" stroke-linecap="round" />
|
|
33
|
+
<line x1="377.60" y1="536.00" x2="568.00" y2="536.00" stroke="#2c3e50" stroke-width="3" stroke-linecap="round" />
|
|
34
|
+
<line x1="296.00" y1="581.33" x2="296.00" y2="536.00" stroke="#2c3e50" stroke-width="3" stroke-linecap="round" />
|
|
35
|
+
<line x1="377.60" y1="536.00" x2="377.60" y2="495.20" stroke="#2c3e50" stroke-width="3" stroke-linecap="round" />
|
|
36
|
+
<line x1="296.00" y1="445.33" x2="377.60" y2="445.33" stroke="#2c3e50" stroke-width="3" stroke-linecap="round" />
|
|
37
|
+
<line x1="296.00" y1="536.00" x2="296.00" y2="445.33" stroke="#2c3e50" stroke-width="3" stroke-linecap="round" />
|
|
38
|
+
<line x1="377.60" y1="495.20" x2="436.53" y2="495.20" stroke="#2c3e50" stroke-width="3" stroke-linecap="round" />
|
|
39
|
+
<line x1="436.53" y1="495.20" x2="436.53" y2="445.33" stroke="#2c3e50" stroke-width="3" stroke-linecap="round" />
|
|
40
|
+
<line x1="377.60" y1="445.33" x2="436.53" y2="445.33" stroke="#2c3e50" stroke-width="3" stroke-linecap="round" />
|
|
41
|
+
|
|
42
|
+
<!-- Openings (doors/windows) -->
|
|
43
|
+
<line x1="394.60" y1="581.33" x2="415.00" y2="581.33" stroke="#e74c3c" stroke-width="4" stroke-linecap="round" />
|
|
44
|
+
<line x1="477.33" y1="659.53" x2="477.33" y2="639.13" stroke="#e74c3c" stroke-width="4" stroke-linecap="round" />
|
|
45
|
+
<line x1="326.60" y1="536.00" x2="347.00" y2="536.00" stroke="#e74c3c" stroke-width="4" stroke-linecap="round" />
|
|
46
|
+
<line x1="314.13" y1="717.33" x2="368.53" y2="717.33" stroke="#3498db" stroke-width="3" stroke-linecap="round" />
|
|
47
|
+
|
|
48
|
+
<!-- Labels -->
|
|
49
|
+
<text x="386.67" y="649.33" font-size="14" fill="#2c3e50" text-anchor="middle" dominant-baseline="middle" font-family="Arial, sans-serif">Living Room</text>
|
|
50
|
+
<text x="522.67" y="649.33" font-size="14" fill="#2c3e50" text-anchor="middle" dominant-baseline="middle" font-family="Arial, sans-serif">Kitchen</text>
|
|
51
|
+
<text x="432.00" y="558.67" font-size="14" fill="#2c3e50" text-anchor="middle" dominant-baseline="middle" font-family="Arial, sans-serif">Hallway</text>
|
|
52
|
+
<text x="336.80" y="490.67" font-size="8" fill="#2c3e50" text-anchor="middle" dominant-baseline="middle" font-family="Arial, sans-serif">Master Bedroom</text>
|
|
53
|
+
<text x="407.07" y="470.27" font-size="10" fill="#2c3e50" text-anchor="middle" dominant-baseline="middle" font-family="Arial, sans-serif">Bathroom</text>
|
|
54
|
+
|
|
55
|
+
<!-- Dimensions -->
|
|
56
|
+
|
|
57
|
+
</svg>
|
package/package.json
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "planscript",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "PlanScript - A DSL for defining floor plans",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "dist/index.js",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"import": "./dist/index.js"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"bin": {
|
|
15
|
+
"planscript": "./dist/cli.js"
|
|
16
|
+
},
|
|
17
|
+
"files": [
|
|
18
|
+
"dist",
|
|
19
|
+
"examples",
|
|
20
|
+
"README.md",
|
|
21
|
+
"LICENSE"
|
|
22
|
+
],
|
|
23
|
+
"scripts": {
|
|
24
|
+
"build:grammar": "peggy --plugin ts-pegjs --extra-options-file src/parser/pegconfig.json -o src/parser/grammar.ts src/parser/grammar.pegjs",
|
|
25
|
+
"build:ts": "tsc",
|
|
26
|
+
"build": "npm run build:grammar && npm run build:ts",
|
|
27
|
+
"dev": "npm run build:grammar && tsc --watch",
|
|
28
|
+
"test": "npm run build:grammar && vitest run",
|
|
29
|
+
"test:watch": "npm run build:grammar && vitest",
|
|
30
|
+
"prepare": "npm run build"
|
|
31
|
+
},
|
|
32
|
+
"keywords": [
|
|
33
|
+
"planscript",
|
|
34
|
+
"dsl",
|
|
35
|
+
"floor-plan",
|
|
36
|
+
"floorplan",
|
|
37
|
+
"architecture",
|
|
38
|
+
"blueprint",
|
|
39
|
+
"compiler",
|
|
40
|
+
"svg"
|
|
41
|
+
],
|
|
42
|
+
"license": "MIT",
|
|
43
|
+
"repository": {
|
|
44
|
+
"type": "git",
|
|
45
|
+
"url": "https://github.com/user/planscript"
|
|
46
|
+
},
|
|
47
|
+
"devDependencies": {
|
|
48
|
+
"@types/node": "^20.11.0",
|
|
49
|
+
"peggy": "^3.0.2",
|
|
50
|
+
"ts-pegjs": "^4.2.1",
|
|
51
|
+
"typescript": "^5.3.3",
|
|
52
|
+
"vitest": "^1.2.0"
|
|
53
|
+
}
|
|
54
|
+
}
|