geomui 1.0.4 → 1.0.5

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.
@@ -20,6 +20,7 @@
20
20
  import InputParams from './InputParams.svelte';
21
21
  import Drawing from './Drawing.svelte';
22
22
  import SubDesign from './SubDesign.svelte';
23
+ import { getContentDownloadParams, downloadParams } from './downloadParams';
23
24
  import { sParams } from './stateParams.svelte';
24
25
  import { afterNavigate } from '$app/navigation';
25
26
 
@@ -79,8 +80,6 @@
79
80
  afterNavigate(() => {
80
81
  selFace = checkFace(Object.keys(fgeom(0, sParams[pDef.partName]).fig), '');
81
82
  });
82
- // internal state that should not need state
83
- let exportFace: string = $state('zip'); // TODO5 keep state otherwise svelte complains
84
83
 
85
84
  // derived
86
85
  let geome: tGeom = $derived(fgeom(simTime, sParams[pDef.partName]));
@@ -187,8 +186,21 @@
187
186
  download_textFile(fName, fContent, fMime);
188
187
  }
189
188
  }
190
- async function downloadExport2() {
191
- await downloadExport(exportFace);
189
+ async function downloadExportPxParams() {
190
+ //console.log('dbg621: downloadExportPxParams');
191
+ downloadParams(pDef.partName, sParams[pDef.partName], '');
192
+ }
193
+ let myDiag: HTMLDialogElement;
194
+ let myPreview = $state('');
195
+ function openDiag(txt: string) {
196
+ myPreview = txt;
197
+ myDiag.showModal();
198
+ }
199
+ function openDiag2(nFace: string, fmt: EFormat) {
200
+ openDiag(fileTextContent(fgeom, sParams[pDef.partName], pDef, nFace, fmt));
201
+ }
202
+ function closeDiag() {
203
+ myDiag.close();
192
204
  }
193
205
  </script>
194
206
 
@@ -207,35 +219,247 @@
207
219
  </section>
208
220
  <section>
209
221
  <h2>
210
- Drawing
211
- <select bind:value={selFace}>
212
- {#each optFaces as optFace}
213
- <option value={optFace}>{optFace}</option>
214
- {/each}
215
- <option value={c_ParametrixAll}>All faces merged</option>
216
- </select>
222
+ 2D Drawings :
223
+ {#each optFaces as optFace}
224
+ <button
225
+ onclick={() => {
226
+ selFace = optFace;
227
+ }}
228
+ class={{ theFace: selFace === optFace }}>{optFace}</button
229
+ >
230
+ {/each}
231
+ <button
232
+ onclick={() => {
233
+ selFace = c_ParametrixAll;
234
+ }}
235
+ class={{ theFace: selFace === c_ParametrixAll }}>All faces merged</button
236
+ >
217
237
  </h2>
218
238
  </section>
219
239
  <Drawing pDefSim={pDef.sim} {pFig} bind:simTime />
220
240
  <section>
221
241
  <h2>Export</h2>
222
- <select bind:value={exportFace}>
223
- {#each optFaces as optFace}
224
- <option value="svg_{optFace}">face {optFace} as svg</option>
225
- {/each}
226
- <option value="allsvg">all faces merged as svg</option>
227
- {#each optFaces as optFace}
228
- <option value="dxf_{optFace}">face {optFace} as dxf</option>
229
- {/each}
230
- <option value="alldxf">all faces merged as dxf</option>
231
- <option value="compute_log">compute.log as log-file</option>
232
- <option value="pax">all faces as pax.json</option>
233
- <option value="oscad">all faces as openscad.scad</option>
234
- <option value="ojscad">all faces as OpenJScad.js</option>
235
- <option value="freecad">all faces as Freecad.py</option>
236
- <option value="zip">all faces and more as zip</option>
237
- </select>
238
- <button onclick={downloadExport2}>Save to File</button>
242
+ <table>
243
+ <caption>Output files</caption>
244
+ <thead>
245
+ <tr>
246
+ <th>#</th>
247
+ <th>Filename</th>
248
+ <th>Type</th>
249
+ <th>Preview</th>
250
+ <th>Download</th>
251
+ </tr>
252
+ </thead>
253
+ <tbody>
254
+ <tr>
255
+ <td>1</td>
256
+ <td>px_{pDef.partName}.json</td>
257
+ <td>0-params- pxJson</td>
258
+ <td
259
+ ><button
260
+ onclick={() => {
261
+ openDiag(
262
+ getContentDownloadParams(pDef.partName, sParams[pDef.partName], '')
263
+ );
264
+ }}>preview</button
265
+ ></td
266
+ >
267
+ <td><button onclick={downloadExportPxParams}>download</button></td>
268
+ </tr>
269
+ <tr>
270
+ <td>2</td>
271
+ <td>{pDef.partName}_all.log</td>
272
+ <td>1-log- txtLog</td>
273
+ <td
274
+ ><button
275
+ onclick={() => {
276
+ openDiag2('all', EFormat.eTXTLOG);
277
+ }}>preview</button
278
+ ></td
279
+ >
280
+ <td
281
+ ><button
282
+ onclick={async () => {
283
+ await downloadExport('compute_log');
284
+ }}>download</button
285
+ ></td
286
+ >
287
+ </tr>
288
+ {#each optFaces as optFace, idx}
289
+ <tr>
290
+ <td>{3 + idx}</td>
291
+ <td>{pDef.partName}_{optFace}.svg</td>
292
+ <td>2d- svg</td>
293
+ <td
294
+ ><button
295
+ onclick={() => {
296
+ openDiag2(optFace, EFormat.eSVG);
297
+ }}>preview</button
298
+ ></td
299
+ >
300
+ <td
301
+ ><button
302
+ onclick={async () => {
303
+ await downloadExport(`svg_${optFace}`);
304
+ }}>download</button
305
+ ></td
306
+ >
307
+ </tr>
308
+ {/each}
309
+ <tr>
310
+ <td>{3 + optFaces.length}</td>
311
+ <td>{pDef.partName}_all.svg</td>
312
+ <td>2d- svg</td>
313
+ <td
314
+ ><button
315
+ onclick={() => {
316
+ openDiag2('all', EFormat.eSVGALL);
317
+ }}>preview</button
318
+ ></td
319
+ >
320
+ <td
321
+ ><button
322
+ onclick={async () => {
323
+ await downloadExport('allsvg');
324
+ }}>download</button
325
+ ></td
326
+ >
327
+ </tr>
328
+ {#each optFaces as optFace, idx}
329
+ <tr>
330
+ <td>{4 + optFaces.length + idx}</td>
331
+ <td>{pDef.partName}_{optFace}.dxf</td>
332
+ <td>2d- dxf</td>
333
+ <td
334
+ ><button
335
+ onclick={() => {
336
+ openDiag2(optFace, EFormat.eDXF);
337
+ }}>preview</button
338
+ ></td
339
+ >
340
+ <td
341
+ ><button
342
+ onclick={async () => {
343
+ await downloadExport(`dxf_${optFace}`);
344
+ }}>download</button
345
+ ></td
346
+ >
347
+ </tr>
348
+ {/each}
349
+ <tr>
350
+ <td>{4 + 2 * optFaces.length}</td>
351
+ <td>{pDef.partName}_all.dxf</td>
352
+ <td>2d- dxf</td>
353
+ <td
354
+ ><button
355
+ onclick={() => {
356
+ openDiag2('all', EFormat.eDXFALL);
357
+ }}>preview</button
358
+ ></td
359
+ >
360
+ <td
361
+ ><button
362
+ onclick={async () => {
363
+ await downloadExport('alldxf');
364
+ }}>download</button
365
+ ></td
366
+ >
367
+ </tr>
368
+ <tr>
369
+ <td>{5 + 2 * optFaces.length}</td>
370
+ <td>{pDef.partName}_all.pax.json</td>
371
+ <td>4-pax- paxJson</td>
372
+ <td
373
+ ><button
374
+ onclick={() => {
375
+ openDiag2('all', EFormat.ePAX);
376
+ }}>preview</button
377
+ ></td
378
+ >
379
+ <td
380
+ ><button
381
+ onclick={async () => {
382
+ await downloadExport('pax');
383
+ }}>download</button
384
+ ></td
385
+ >
386
+ </tr>
387
+ <tr>
388
+ <td>{6 + 2 * optFaces.length}</td>
389
+ <td>{pDef.partName}_all_noarc_openscad.scad</td>
390
+ <td>5-script- scad</td>
391
+ <td
392
+ ><button
393
+ onclick={() => {
394
+ openDiag2('all', EFormat.eOPENSCAD);
395
+ }}>preview</button
396
+ ></td
397
+ >
398
+ <td
399
+ ><button
400
+ onclick={async () => {
401
+ await downloadExport('oscad');
402
+ }}>download</button
403
+ ></td
404
+ >
405
+ </tr>
406
+ <tr>
407
+ <td>{7 + 2 * optFaces.length}</td>
408
+ <td>{pDef.partName}_all_noarc_jscad.js</td>
409
+ <td>5-script- jsCad</td>
410
+ <td
411
+ ><button
412
+ onclick={() => {
413
+ openDiag2('all', EFormat.eJSCAD);
414
+ }}>preview</button
415
+ ></td
416
+ >
417
+ <td
418
+ ><button
419
+ onclick={async () => {
420
+ await downloadExport('ojscad');
421
+ }}>download</button
422
+ ></td
423
+ >
424
+ </tr>
425
+ <tr>
426
+ <td>{8 + 2 * optFaces.length}</td>
427
+ <td>{pDef.partName}_all_freecad.py</td>
428
+ <td>5-script- pyFreecad</td>
429
+ <td
430
+ ><button
431
+ onclick={() => {
432
+ openDiag2('all', EFormat.eFREECAD);
433
+ }}>preview</button
434
+ ></td
435
+ >
436
+ <td
437
+ ><button
438
+ onclick={async () => {
439
+ await downloadExport('freecad');
440
+ }}>download</button
441
+ ></td
442
+ >
443
+ </tr>
444
+ <tr>
445
+ <td>{9 + 2 * optFaces.length}</td>
446
+ <td>{pDef.partName}_all.zip</td>
447
+ <td>6-zip- zip</td>
448
+ <td></td>
449
+ <td
450
+ ><button
451
+ onclick={async () => {
452
+ await downloadExport('zip');
453
+ }}>download</button
454
+ ></td
455
+ >
456
+ </tr>
457
+ </tbody>
458
+ </table>
459
+ <dialog id="dBview" bind:this={myDiag}>
460
+ <textarea readonly wrap="soft" value={myPreview}></textarea>
461
+ <button class="bback" onclick={closeDiag}>close - back - escape</button>
462
+ </dialog>
239
463
  <SubDesign {subD} origPartName={pDef.partName} {pLink} />
240
464
  </section>
241
465
 
@@ -252,7 +476,7 @@ section > h2 {
252
476
  margin: 1rem 0.5rem 0;
253
477
  }
254
478
 
255
- section > h2 > select {
479
+ section > h2 > button {
256
480
  /*display: inline-block;*/
257
481
  height: 1.6rem;
258
482
  /*width: 1.6rem;*/
@@ -268,6 +492,11 @@ section > h2 > select {
268
492
  background-color: lightBlue;
269
493
  }
270
494
 
495
+ section > h2 > button.theFace {
496
+ border-color: Blue;
497
+ border-width: 0.2rem;
498
+ }
499
+
271
500
  section > textarea {
272
501
  /*resize: horizontal;*/
273
502
  margin-left: 0.5rem;
@@ -281,19 +510,76 @@ section > textarea.colorErr {
281
510
  background-color: violet;
282
511
  }
283
512
 
284
- section > button,
285
- section > select {
513
+ table {
514
+ border-collapse: collapse;
515
+ /*border: 1px solid red;*/
516
+ margin: 0.2rem 1rem 2rem;
517
+ }
518
+
519
+ table > caption {
520
+ color: darkBlue;
521
+ background-color: lightBlue;
522
+ font-weight: 700;
523
+ }
524
+
525
+ table > thead > tr > th,
526
+ table > tbody > tr > td {
527
+ border: 1px solid red;
528
+ padding: 0.2rem 1rem 0.2rem;
529
+ }
530
+
531
+ table > tbody > tr:nth-child(odd) {
532
+ background-color: lightYellow;
533
+ }
534
+
535
+ table > tbody > tr:nth-child(even) {
536
+ background-color: lightBlue;
537
+ }
538
+
539
+ section > table > tbody > tr > td > button {
286
540
  /*display: inline-block;*/
287
- height: 1.6rem;
541
+ /*Height: 1.6rem;*/
288
542
  /*width: 1.6rem;*/
289
543
  color: darkBlue;
290
- font-size: 0.8rem;
291
- font-weight: 400;
292
- padding: 0.2rem 0.4rem 0.2rem;
293
- border-style: solid;
294
- border-width: 0.1rem;
295
- border-radius: 0.2rem;
296
- border-color: darkBlue;
297
- margin: 0.5rem;
298
- background-color: lightBlue;
544
+ font-size: 1rem;
545
+ font-weight: 700;
546
+ padding: 0.1rem 0.4rem 0.1rem;
547
+ border-style: none;
548
+ /*Border-width: 0.1rem;*/
549
+ /*Border-radius: 0.2rem;*/
550
+ /*Border-color: colors.$timectrl-sign;*/
551
+ margin: 0;
552
+ background-color: inherit;
553
+ }
554
+
555
+ dialog#dBview {
556
+ display: none;
557
+ }
558
+
559
+ dialog#dBview[open] {
560
+ display: block;
561
+ }
562
+
563
+ dialog#dBview::backdrop {
564
+ background-color: rgba(0, 0, 0, 0.4);
565
+ }
566
+
567
+ dialog#dBview > textarea {
568
+ display: block;
569
+ resize: none;
570
+ background-color: lightYellow;
571
+ width: 80vw;
572
+ height: 70vh;
573
+ margin: 0;
574
+ }
575
+
576
+ dialog#dBview > button.bback {
577
+ display: block;
578
+ color: white;
579
+ background-color: black;
580
+ border: none;
581
+ outline: none;
582
+ width: 100%;
583
+ height: 2rem;
584
+ margin: 1rem 0 0 0;
299
585
  }</style>
@@ -1,4 +1,5 @@
1
1
  import type { tParamVal } from 'geometrix';
2
+ declare function getContentDownloadParams(iPartName: string, idparams: tParamVal, iComment: string): string;
2
3
  declare function downloadParams(iPartName: string, idparams: tParamVal, iComment: string): void;
3
4
  declare function generateUrl(ihref: string, idparams: tParamVal, iLenghtLimit: boolean): string;
4
- export { downloadParams, generateUrl };
5
+ export { getContentDownloadParams, downloadParams, generateUrl };
@@ -10,6 +10,13 @@ function download_file(file_name, file_content) {
10
10
  //document.body.removeChild(elem_a_download);
11
11
  elem_a_download.remove(); // Is this really required?
12
12
  }
13
+ function getContentDownloadParams(iPartName, idparams, iComment) {
14
+ const re1 = /[-:]/g;
15
+ const re2 = /\..*$/;
16
+ const datestr = new Date().toISOString().replace(re1, '').replace(re2, '').replace('T', '_');
17
+ const file_content = createParamFile(datestr, iPartName, idparams, iComment);
18
+ return file_content;
19
+ }
13
20
  function downloadParams(iPartName, idparams, iComment) {
14
21
  const re1 = /[-:]/g;
15
22
  const re2 = /\..*$/;
@@ -39,4 +46,4 @@ function generateUrl(ihref, idparams, iLenghtLimit) {
39
46
  }
40
47
  return url1.toString();
41
48
  }
42
- export { downloadParams, generateUrl };
49
+ export { getContentDownloadParams, downloadParams, generateUrl };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "geomui",
3
- "version": "1.0.4",
3
+ "version": "1.0.5",
4
4
  "description": "The svelte-library of the webapp-UI of Parametrix",
5
5
  "private": false,
6
6
  "repository": {
@@ -70,32 +70,32 @@
70
70
  "svelte": "^5.19.0"
71
71
  },
72
72
  "dependencies": {
73
- "geometrix": "^1.0.3"
73
+ "geometrix": "^1.0.4"
74
74
  },
75
75
  "devDependencies": {
76
76
  "@atao60/fse-cli": "^0.1.9",
77
77
  "@sveltejs/adapter-auto": "^4.0.0",
78
78
  "@sveltejs/adapter-static": "^3.0.8",
79
- "@sveltejs/kit": "^2.16.1",
80
- "@sveltejs/package": "^2.3.9",
79
+ "@sveltejs/kit": "^2.17.1",
80
+ "@sveltejs/package": "^2.3.10",
81
81
  "@sveltejs/vite-plugin-svelte": "^5.0.3",
82
82
  "@types/eslint": "^9.6.1",
83
- "designix": "^1.0.3",
84
- "eslint": "^9.19.0",
83
+ "designix": "^1.0.4",
84
+ "eslint": "^9.20.0",
85
85
  "eslint-config-prettier": "^10.0.1",
86
86
  "eslint-plugin-svelte": "^2.46.1",
87
87
  "globals": "^15.14.0",
88
88
  "npm-run-all2": "^7.0.2",
89
- "prettier": "^3.4.2",
89
+ "prettier": "^3.5.0",
90
90
  "prettier-plugin-svelte": "^3.3.3",
91
- "publint": "^0.3.2",
91
+ "publint": "^0.3.4",
92
92
  "rimraf": "^6.0.1",
93
- "sass": "^1.83.4",
94
- "svelte": "^5.19.3",
93
+ "sass": "^1.84.0",
94
+ "svelte": "^5.19.9",
95
95
  "svelte-check": "^4.1.4",
96
96
  "typescript": "^5.7.3",
97
- "typescript-eslint": "^8.21.0",
98
- "vite": "^6.0.11",
99
- "vitest": "^3.0.4"
97
+ "typescript-eslint": "^8.23.0",
98
+ "vite": "^6.1.0",
99
+ "vitest": "^3.0.5"
100
100
  }
101
101
  }