geomui 0.5.55 → 0.5.56
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/dist/Drawing.svelte +131 -180
- package/dist/Drawing.svelte.d.ts +6 -24
- package/dist/DrawingList.svelte +20 -28
- package/dist/DrawingList.svelte.d.ts +3 -18
- package/dist/InputParams.svelte +107 -115
- package/dist/InputParams.svelte.d.ts +5 -25
- package/dist/LabelCheckbox.svelte +11 -11
- package/dist/LocStorRead.svelte +13 -7
- package/dist/LocStorRead.svelte.d.ts +3 -18
- package/dist/LocStorTable.svelte +20 -14
- package/dist/LocStorTable.svelte.d.ts +3 -18
- package/dist/LocStorWrite.svelte +10 -19
- package/dist/LocStorWrite.svelte.d.ts +3 -18
- package/dist/ModalDiag.svelte +21 -8
- package/dist/ModalDiag.svelte.d.ts +5 -27
- package/dist/ModalImg.svelte +6 -3
- package/dist/ModalImg.svelte.d.ts +3 -18
- package/dist/OneDesign.svelte +8 -4
- package/dist/OneDesign.svelte.d.ts +3 -18
- package/dist/ParamDrawExport.svelte +103 -37
- package/dist/ParamDrawExport.svelte.d.ts +3 -18
- package/dist/SimpleDrawing.svelte +67 -50
- package/dist/SimpleDrawing.svelte.d.ts +6 -24
- package/dist/SubDesign.svelte +15 -12
- package/dist/SubDesign.svelte.d.ts +6 -21
- package/dist/TimeControl.svelte +17 -10
- package/dist/TimeControl.svelte.d.ts +3 -18
- package/dist/ZoomControl.svelte +11 -21
- package/dist/ZoomControl.svelte.d.ts +4 -19
- package/dist/initStore.js +12 -11
- package/dist/stateDrawing.svelte.d.ts +8 -0
- package/dist/stateDrawing.svelte.js +8 -0
- package/dist/stateParams.svelte.d.ts +5 -0
- package/dist/stateParams.svelte.js +3 -0
- package/package.json +19 -19
- package/dist/drawingLayers.d.ts +0 -2
- package/dist/drawingLayers.js +0 -6
- package/dist/storePVal.d.ts +0 -5
- package/dist/storePVal.js +0 -4
package/dist/InputParams.svelte
CHANGED
|
@@ -5,30 +5,41 @@
|
|
|
5
5
|
import LocStorWrite from './LocStorWrite.svelte';
|
|
6
6
|
import LocStorRead from './LocStorRead.svelte';
|
|
7
7
|
import SimpleDrawing from './SimpleDrawing.svelte';
|
|
8
|
-
import type { tParam, tParamDef, tParamVal,
|
|
9
|
-
import { PType, parseParamFile, createParamFile
|
|
10
|
-
import {
|
|
8
|
+
import type { tParam, tParamDef, tParamVal, Figure } from 'geometrix';
|
|
9
|
+
import { PType, parseParamFile, createParamFile } from 'geometrix';
|
|
10
|
+
import { sParams } from './stateParams.svelte';
|
|
11
11
|
import { downloadParams, generateUrl } from './downloadParams';
|
|
12
|
-
import { onMount, createEventDispatcher } from 'svelte';
|
|
13
12
|
import { browser } from '$app/environment';
|
|
14
13
|
import { page } from '$app/stores';
|
|
15
14
|
import { base } from '$app/paths';
|
|
16
15
|
|
|
17
|
-
|
|
16
|
+
// props
|
|
17
|
+
interface Props {
|
|
18
|
+
pDef: tParamDef;
|
|
19
|
+
pFig: Figure;
|
|
20
|
+
}
|
|
21
|
+
let { pDef, pFig }: Props = $props();
|
|
18
22
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
export let selFace: string;
|
|
22
|
-
export let zAdjust: tCanvasAdjust;
|
|
23
|
-
export let simTime = 0;
|
|
23
|
+
// type
|
|
24
|
+
type tHTableVis = Record<string, boolean>;
|
|
24
25
|
|
|
25
|
-
|
|
26
|
-
let inputComment = '';
|
|
26
|
+
// state
|
|
27
|
+
let inputComment: string = $state('');
|
|
28
|
+
let hideColumn: boolean = $state(false);
|
|
29
|
+
let loadMsg: string = $state('');
|
|
30
|
+
let applyWarn: boolean = $state(false);
|
|
31
|
+
let modalLoadDefault: boolean = $state(false);
|
|
32
|
+
let modalLoadLocal: boolean = $state(false);
|
|
33
|
+
let modalSaveUrl: boolean = $state(false);
|
|
34
|
+
let modalSaveLocal: boolean = $state(false);
|
|
35
|
+
let locStorRname: string = $state('');
|
|
36
|
+
let locStorWname: string = $state('');
|
|
37
|
+
let pUrl: string = $state('');
|
|
38
|
+
let paramSvg: string = $state(checkPict(pDef.params[0].name));
|
|
39
|
+
let modalImg: boolean = $state(false);
|
|
40
|
+
let htableVis: tHTableVis = $state(makeHTableVis(makeHTable(pDef.params)));
|
|
27
41
|
|
|
28
42
|
// initialization
|
|
29
|
-
function paramChange() {
|
|
30
|
-
dispatch('paramChg', { foo: 'bla' });
|
|
31
|
-
}
|
|
32
43
|
// tolerant applyParamVal
|
|
33
44
|
function tolerantApply(iPartName: string, ipVal: tParamVal): [string, boolean] {
|
|
34
45
|
let rMsg = '';
|
|
@@ -47,10 +58,10 @@
|
|
|
47
58
|
pNameList.push(p.name);
|
|
48
59
|
if (Object.hasOwn(ipVal, p.name)) {
|
|
49
60
|
cover += 1;
|
|
50
|
-
if (
|
|
61
|
+
if (sParams[pDef.partName][p.name] === ipVal[p.name]) {
|
|
51
62
|
equal += 1;
|
|
52
63
|
} else {
|
|
53
|
-
|
|
64
|
+
sParams[pDef.partName][p.name] = ipVal[p.name];
|
|
54
65
|
}
|
|
55
66
|
} else {
|
|
56
67
|
uncover += 1;
|
|
@@ -75,14 +86,6 @@
|
|
|
75
86
|
const rApplyWarn = applyWarn1 || applyWarn2;
|
|
76
87
|
return [rMsg, rApplyWarn];
|
|
77
88
|
}
|
|
78
|
-
//function initParams1() {
|
|
79
|
-
// for (const p of pDef.params) {
|
|
80
|
-
// $storePV[pDef.partName][p.name] = p.init;
|
|
81
|
-
// }
|
|
82
|
-
//}
|
|
83
|
-
// load parameters
|
|
84
|
-
let loadMsg = '';
|
|
85
|
-
let applyWarn = false;
|
|
86
89
|
function initParams2() {
|
|
87
90
|
if (browser) {
|
|
88
91
|
const searchParams = new URLSearchParams($page.url.search);
|
|
@@ -100,34 +103,15 @@
|
|
|
100
103
|
}
|
|
101
104
|
}
|
|
102
105
|
}
|
|
103
|
-
//
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
paramChange();
|
|
108
|
-
}
|
|
109
|
-
onMount(() => {
|
|
110
|
-
forceInit();
|
|
111
|
-
});
|
|
112
|
-
// workaround because $page.url.searchParams contains the new value with some delay
|
|
113
|
-
//function delay(milliseconds: number) {
|
|
114
|
-
// return new Promise((resolve) => {
|
|
115
|
-
// setTimeout(resolve, milliseconds);
|
|
116
|
-
// });
|
|
117
|
-
//}
|
|
118
|
-
//async function forceInit2(partName: string) {
|
|
119
|
-
// await delay(1000);
|
|
120
|
-
// console.log(`dbg081: forceInit: partName ${partName} url ${$page.url}`);
|
|
121
|
-
// forceInit(partName);
|
|
122
|
-
//}
|
|
123
|
-
//$: forceInit2(pDef.partName);
|
|
124
|
-
// end of the workaround
|
|
106
|
+
// initiatlization
|
|
107
|
+
initParams2();
|
|
108
|
+
|
|
109
|
+
// actions
|
|
125
110
|
function loadParams(iStr: string) {
|
|
126
111
|
try {
|
|
127
112
|
const [paramJson] = parseParamFile(iStr);
|
|
128
113
|
[loadMsg, applyWarn] = tolerantApply(paramJson.partName, paramJson.pVal);
|
|
129
114
|
inputComment = paramJson.comment;
|
|
130
|
-
paramChange();
|
|
131
115
|
} catch (emsg) {
|
|
132
116
|
let errMsg = 'err723: error by parsing parameter file\n';
|
|
133
117
|
errMsg += emsg as string;
|
|
@@ -151,13 +135,9 @@
|
|
|
151
135
|
}
|
|
152
136
|
// download parameters
|
|
153
137
|
function downloadParams2() {
|
|
154
|
-
downloadParams(pDef.partName,
|
|
138
|
+
downloadParams(pDef.partName, sParams[pDef.partName], inputComment);
|
|
155
139
|
}
|
|
156
140
|
// modal
|
|
157
|
-
let modalLoadDefault = false;
|
|
158
|
-
let modalLoadLocal = false;
|
|
159
|
-
let modalSaveUrl = false;
|
|
160
|
-
let modalSaveLocal = false;
|
|
161
141
|
function loadDefaults() {
|
|
162
142
|
const pInit: tParamVal = {};
|
|
163
143
|
for (const p of pDef.params) {
|
|
@@ -166,7 +146,6 @@
|
|
|
166
146
|
[loadMsg, applyWarn] = tolerantApply(pDef.partName, pInit);
|
|
167
147
|
}
|
|
168
148
|
// load parameters from localStorage
|
|
169
|
-
let locStorRname: string;
|
|
170
149
|
function loadLocStor() {
|
|
171
150
|
if (locStorRname !== undefined && locStorRname !== '') {
|
|
172
151
|
const storeKey = `${pDef.partName}_${locStorRname}`;
|
|
@@ -186,7 +165,6 @@
|
|
|
186
165
|
}
|
|
187
166
|
}
|
|
188
167
|
// save parameters into localStorage
|
|
189
|
-
let locStorWname: string;
|
|
190
168
|
//$: console.log(`dbg888: ${locStorWname}`);
|
|
191
169
|
function saveInLocStor() {
|
|
192
170
|
if (locStorWname !== undefined && locStorWname !== '') {
|
|
@@ -196,7 +174,7 @@
|
|
|
196
174
|
const storeAllStr = createParamFile(
|
|
197
175
|
lastModif,
|
|
198
176
|
pDef.partName,
|
|
199
|
-
|
|
177
|
+
sParams[pDef.partName],
|
|
200
178
|
inputComment
|
|
201
179
|
);
|
|
202
180
|
//console.log(`save in localStorage ${storeKey}`);
|
|
@@ -208,9 +186,8 @@
|
|
|
208
186
|
}
|
|
209
187
|
}
|
|
210
188
|
// Save as URL
|
|
211
|
-
let pUrl = '';
|
|
212
189
|
function generateUrl2(): string {
|
|
213
|
-
const url1 = generateUrl($page.url.href,
|
|
190
|
+
const url1 = generateUrl($page.url.href, sParams[pDef.partName], false);
|
|
214
191
|
return url1.toString();
|
|
215
192
|
}
|
|
216
193
|
function openModalUrl() {
|
|
@@ -221,30 +198,18 @@
|
|
|
221
198
|
//console.log(`dbg244: voila`);
|
|
222
199
|
}
|
|
223
200
|
// parameter picture
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
//console.log(`dbg783: ${keyName}`);
|
|
201
|
+
function checkPict(keyName: string): string {
|
|
202
|
+
let rSvgPath = `${base}/pgdsvg/default_param_blank.svg`;
|
|
227
203
|
// convention for the file-names of the parameter description
|
|
228
204
|
//paramSvg = `${base}/pgdsvg/${pDef.partName}_${keyName}.svg`;
|
|
229
|
-
paramSvg = `${base}/pgdsvg/default_param_blank.svg`;
|
|
230
205
|
if (Object.keys(pDef.paramSvg).includes(keyName)) {
|
|
231
|
-
|
|
206
|
+
rSvgPath = `${base}/pgdsvg/${pDef.paramSvg[keyName]}`;
|
|
232
207
|
}
|
|
208
|
+
return rSvgPath;
|
|
233
209
|
}
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
function paramPict2(idx: number, pDef_page: string) {
|
|
237
|
-
//console.log(`dbg283: ${pDef_page}`);
|
|
238
|
-
if (prePartName !== pDef.partName) {
|
|
239
|
-
// workaround for avoiding weird re-trigger
|
|
240
|
-
const paramNb = Object.keys($storePV[pDef_page]).length;
|
|
241
|
-
if (idx < paramNb) {
|
|
242
|
-
paramPict(Object.keys($storePV[pDef_page])[idx]);
|
|
243
|
-
}
|
|
244
|
-
}
|
|
210
|
+
function paramPict(keyName: string) {
|
|
211
|
+
paramSvg = checkPict(keyName);
|
|
245
212
|
}
|
|
246
|
-
$: paramPict2(0, pDef.partName);
|
|
247
|
-
let modalImg = false;
|
|
248
213
|
function showSvg() {
|
|
249
214
|
//console.log(`dbg231: svgPath: ${svgPath}`);
|
|
250
215
|
modalImg = true;
|
|
@@ -256,7 +221,6 @@
|
|
|
256
221
|
sectionVisible: boolean;
|
|
257
222
|
params: tParam[];
|
|
258
223
|
}
|
|
259
|
-
type tHTableVis = Record<string, boolean>;
|
|
260
224
|
function makeHTable(iParams: tParam[]): tHTableSection[] {
|
|
261
225
|
const rHTable: tHTableSection[] = [];
|
|
262
226
|
const sectionMain: tHTableSection = {
|
|
@@ -292,18 +256,17 @@
|
|
|
292
256
|
}
|
|
293
257
|
return rVis;
|
|
294
258
|
}
|
|
295
|
-
let htable: tHTableSection[];
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
$: {
|
|
300
|
-
htable = makeHTable(pDef.params);
|
|
301
|
-
if (prePartName !== pDef.partName) {
|
|
302
|
-
// workaround for avoiding weird re-trigger
|
|
303
|
-
prePartName = pDef.partName;
|
|
304
|
-
htableVis = makeHTableVis(htable);
|
|
305
|
-
}
|
|
259
|
+
let htable: tHTableSection[] = $derived(makeHTable(pDef.params));
|
|
260
|
+
// actions
|
|
261
|
+
function sizeSmall() {
|
|
262
|
+
hideColumn = true;
|
|
306
263
|
}
|
|
264
|
+
function sizeBig() {
|
|
265
|
+
hideColumn = false;
|
|
266
|
+
}
|
|
267
|
+
let dColspanHide1: number = $derived(hideColumn ? 2 : 4);
|
|
268
|
+
let dColspanHide2: number = $derived(hideColumn ? 2 : 3);
|
|
269
|
+
let dCommentSize: number = $derived(hideColumn ? 50 : 70);
|
|
307
270
|
</script>
|
|
308
271
|
|
|
309
272
|
<section>
|
|
@@ -314,15 +277,15 @@
|
|
|
314
277
|
id="loadFParams"
|
|
315
278
|
type="file"
|
|
316
279
|
accept="text/plain, application/json"
|
|
317
|
-
|
|
280
|
+
onchange={loadParamFromFile}
|
|
318
281
|
/>
|
|
319
282
|
<button
|
|
320
|
-
|
|
283
|
+
onclick={() => {
|
|
321
284
|
modalLoadDefault = true;
|
|
322
285
|
}}>Set Params Default</button
|
|
323
286
|
>
|
|
324
287
|
<button
|
|
325
|
-
|
|
288
|
+
onclick={() => {
|
|
326
289
|
modalLoadLocal = true;
|
|
327
290
|
}}>Load Params from localStorage</button
|
|
328
291
|
>
|
|
@@ -347,20 +310,26 @@
|
|
|
347
310
|
<tr>
|
|
348
311
|
<td>#</td>
|
|
349
312
|
<td>Parameter name</td>
|
|
350
|
-
<td
|
|
351
|
-
|
|
352
|
-
|
|
313
|
+
<td
|
|
314
|
+
>Value<span
|
|
315
|
+
><button onclick={sizeSmall}>−</button><button onclick={sizeBig}
|
|
316
|
+
>+</button
|
|
317
|
+
></span
|
|
318
|
+
></td
|
|
319
|
+
>
|
|
320
|
+
<td class:hideColumn>Unit</td>
|
|
321
|
+
<td class:hideColumn>Default</td>
|
|
353
322
|
<td>Min</td>
|
|
354
323
|
<td>Max</td>
|
|
355
|
-
<td>Step</td>
|
|
324
|
+
<td class:hideColumn>Step</td>
|
|
356
325
|
</tr>
|
|
357
326
|
</thead>
|
|
358
327
|
{#each htable as sect, sidx}
|
|
359
328
|
<tbody>
|
|
360
329
|
<tr class="separator">
|
|
361
330
|
<td>{sidx + 1}</td>
|
|
362
|
-
<td colspan=
|
|
363
|
-
<td colspan=
|
|
331
|
+
<td colspan={dColspanHide1}>{sect.sectionName}</td>
|
|
332
|
+
<td colspan={dColspanHide2}>
|
|
364
333
|
<label>
|
|
365
334
|
<input type="checkbox" bind:checked={htableVis[sect.sectionID]} />
|
|
366
335
|
<span> </span></label
|
|
@@ -370,39 +339,37 @@
|
|
|
370
339
|
</tbody>
|
|
371
340
|
<tbody class:collaps={htableVis[sect.sectionID]}>
|
|
372
341
|
{#each sect.params as param, pidx}
|
|
373
|
-
<tr class:changed={
|
|
342
|
+
<tr class:changed={sParams[pDef.partName][param.name] !== param.init}>
|
|
374
343
|
<td>{sidx + 1}.{pidx + 1}</td>
|
|
375
344
|
<td
|
|
376
|
-
><button
|
|
345
|
+
><button onclick={() => paramPict(param.name)}>{param.name}</button
|
|
377
346
|
></td
|
|
378
347
|
>
|
|
379
348
|
<td>
|
|
380
349
|
{#if param.pType === PType.eNumber}
|
|
381
350
|
<input
|
|
382
351
|
type="number"
|
|
383
|
-
bind:value={
|
|
352
|
+
bind:value={sParams[pDef.partName][param.name]}
|
|
384
353
|
min={param.min}
|
|
385
354
|
max={param.max}
|
|
386
355
|
step={param.step}
|
|
387
|
-
on:change={paramChange}
|
|
388
356
|
class="input-number"
|
|
389
357
|
/>
|
|
390
358
|
<input
|
|
391
359
|
type="range"
|
|
392
|
-
bind:value={
|
|
360
|
+
bind:value={sParams[pDef.partName][param.name]}
|
|
393
361
|
min={param.min}
|
|
394
362
|
max={param.max}
|
|
395
363
|
step={param.step}
|
|
396
|
-
on:change={paramChange}
|
|
397
364
|
/>
|
|
398
365
|
{:else if param.pType === PType.eCheckbox}
|
|
399
|
-
<select bind:value={
|
|
366
|
+
<select bind:value={sParams[pDef.partName][param.name]}>
|
|
400
367
|
{#each ['Off', 'On'] as one, idx}
|
|
401
368
|
<option value={idx}>{one}</option>
|
|
402
369
|
{/each}
|
|
403
370
|
</select>
|
|
404
371
|
{:else if param.pType === PType.eDropdown}
|
|
405
|
-
<select bind:value={
|
|
372
|
+
<select bind:value={sParams[pDef.partName][param.name]}>
|
|
406
373
|
{#each param.dropdown as one, idx}
|
|
407
374
|
<option value={idx}>{one}</option>
|
|
408
375
|
{/each}
|
|
@@ -411,11 +378,11 @@
|
|
|
411
378
|
unknown
|
|
412
379
|
{/if}
|
|
413
380
|
</td>
|
|
414
|
-
<td>{param.unit}</td>
|
|
415
|
-
<td>{param.init}</td>
|
|
381
|
+
<td class:hideColumn>{param.unit}</td>
|
|
382
|
+
<td class:hideColumn>{param.init}</td>
|
|
416
383
|
<td>{param.min}</td>
|
|
417
384
|
<td>{param.max}</td>
|
|
418
|
-
<td>{param.step}</td>
|
|
385
|
+
<td class:hideColumn>{param.step}</td>
|
|
419
386
|
</tr>
|
|
420
387
|
{/each}
|
|
421
388
|
</tbody>
|
|
@@ -423,12 +390,18 @@
|
|
|
423
390
|
</table>
|
|
424
391
|
<div class="comment">
|
|
425
392
|
<label for="inComment">Comment:</label>
|
|
426
|
-
<input
|
|
393
|
+
<input
|
|
394
|
+
type="text"
|
|
395
|
+
id="inComment"
|
|
396
|
+
bind:value={inputComment}
|
|
397
|
+
maxlength="150"
|
|
398
|
+
size={dCommentSize}
|
|
399
|
+
/>
|
|
427
400
|
</div>
|
|
428
|
-
<button
|
|
429
|
-
<button
|
|
401
|
+
<button onclick={downloadParams2}>Save Parameters to File</button>
|
|
402
|
+
<button onclick={openModalUrl}>Save Parameters as URL</button>
|
|
430
403
|
<button
|
|
431
|
-
|
|
404
|
+
onclick={() => {
|
|
432
405
|
modalSaveLocal = true;
|
|
433
406
|
}}>Save Parameters to localStorage</button
|
|
434
407
|
>
|
|
@@ -444,14 +417,14 @@
|
|
|
444
417
|
>
|
|
445
418
|
</main>
|
|
446
419
|
<ModalImg bind:modalOpen={modalImg} svgPath={paramSvg} />
|
|
447
|
-
<button
|
|
420
|
+
<button onclick={showSvg} class="side-img">
|
|
448
421
|
<img src={paramSvg} alt={paramSvg} />
|
|
449
422
|
</button>
|
|
450
423
|
<div class="mini-canvas">
|
|
451
|
-
<SimpleDrawing
|
|
424
|
+
<SimpleDrawing {pFig} full={true} />
|
|
452
425
|
</div>
|
|
453
426
|
<div class="mini-canvas">
|
|
454
|
-
<SimpleDrawing
|
|
427
|
+
<SimpleDrawing {pFig} full={false} />
|
|
455
428
|
</div>
|
|
456
429
|
</section>
|
|
457
430
|
|
|
@@ -515,6 +488,20 @@ section > main > table > thead {
|
|
|
515
488
|
background-color: #ddd;
|
|
516
489
|
}
|
|
517
490
|
|
|
491
|
+
section > main > table > thead > tr > td > span {
|
|
492
|
+
margin-left: 5rem;
|
|
493
|
+
}
|
|
494
|
+
|
|
495
|
+
section > main > table > thead > tr > td > span > button {
|
|
496
|
+
border: 0;
|
|
497
|
+
padding-left: 1rem;
|
|
498
|
+
padding-right: 1rem;
|
|
499
|
+
border-radius: 30%;
|
|
500
|
+
font-weight: 700;
|
|
501
|
+
color: Blue;
|
|
502
|
+
background-color: LightBlue;
|
|
503
|
+
}
|
|
504
|
+
|
|
518
505
|
section > main > table > tbody {
|
|
519
506
|
background-color: #eee;
|
|
520
507
|
}
|
|
@@ -590,6 +577,11 @@ section > main > table > tbody > tr > td > input.input-number {
|
|
|
590
577
|
width: 5rem;
|
|
591
578
|
}
|
|
592
579
|
|
|
580
|
+
section > main > table > thead > tr > td.hideColumn,
|
|
581
|
+
section > main > table > tbody > tr > td.hideColumn {
|
|
582
|
+
display: none;
|
|
583
|
+
}
|
|
584
|
+
|
|
593
585
|
section > main > div.comment {
|
|
594
586
|
font-size: 0.8rem;
|
|
595
587
|
margin-left: 0.5rem;
|
|
@@ -1,27 +1,7 @@
|
|
|
1
|
-
import type { tParamDef,
|
|
2
|
-
|
|
3
|
-
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
4
|
-
$$bindings?: Bindings;
|
|
5
|
-
} & Exports;
|
|
6
|
-
(internal: unknown, props: Props & {
|
|
7
|
-
$$events?: Events;
|
|
8
|
-
$$slots?: Slots;
|
|
9
|
-
}): Exports & {
|
|
10
|
-
$set?: any;
|
|
11
|
-
$on?: any;
|
|
12
|
-
};
|
|
13
|
-
z_$$bindings?: Bindings;
|
|
14
|
-
}
|
|
15
|
-
declare const InputParams: $$__sveltets_2_IsomorphicComponent<{
|
|
1
|
+
import type { tParamDef, Figure } from 'geometrix';
|
|
2
|
+
declare const InputParams: import("svelte").Component<{
|
|
16
3
|
pDef: tParamDef;
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
simTime?: number;
|
|
21
|
-
}, {
|
|
22
|
-
paramChg: CustomEvent<any>;
|
|
23
|
-
} & {
|
|
24
|
-
[evt: string]: CustomEvent<any>;
|
|
25
|
-
}, {}, {}, string>;
|
|
26
|
-
type InputParams = InstanceType<typeof InputParams>;
|
|
4
|
+
pFig: Figure;
|
|
5
|
+
}, {}, "">;
|
|
6
|
+
type InputParams = ReturnType<typeof InputParams>;
|
|
27
7
|
export default InputParams;
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import {
|
|
2
|
+
import { sDraw } from './stateDrawing.svelte';
|
|
3
3
|
</script>
|
|
4
4
|
|
|
5
5
|
<div>
|
|
6
|
-
<label><input type="checkbox" bind:checked={
|
|
7
|
-
<label><input type="checkbox" bind:checked={
|
|
8
|
-
<label><input type="checkbox" bind:checked={
|
|
9
|
-
<label><input type="checkbox" bind:checked={
|
|
10
|
-
<label><input type="checkbox" bind:checked={
|
|
11
|
-
<label><input type="checkbox" bind:checked={
|
|
12
|
-
<label><input type="checkbox" bind:checked={
|
|
13
|
-
<label><input type="checkbox" bind:checked={
|
|
14
|
-
<label><input type="checkbox" bind:checked={
|
|
15
|
-
<label><input type="checkbox" bind:checked={
|
|
6
|
+
<label><input type="checkbox" bind:checked={sDraw.dLayers.main} />main part</label>
|
|
7
|
+
<label><input type="checkbox" bind:checked={sDraw.dLayers.mainB} />main skeleton</label>
|
|
8
|
+
<label><input type="checkbox" bind:checked={sDraw.dLayers.second} />second parts</label>
|
|
9
|
+
<label><input type="checkbox" bind:checked={sDraw.dLayers.secondB} />second skeletons</label>
|
|
10
|
+
<label><input type="checkbox" bind:checked={sDraw.dLayers.dynamics} />dynamics</label>
|
|
11
|
+
<label><input type="checkbox" bind:checked={sDraw.dLayers.ruler} />ruler</label>
|
|
12
|
+
<label><input type="checkbox" bind:checked={sDraw.dLayers.refframe} />frame of reference</label>
|
|
13
|
+
<label><input type="checkbox" bind:checked={sDraw.dLayers.points} />points</label>
|
|
14
|
+
<label><input type="checkbox" bind:checked={sDraw.dLayers.lines} />lines</label>
|
|
15
|
+
<label><input type="checkbox" bind:checked={sDraw.dLayers.vectors} />vectors</label>
|
|
16
16
|
</div>
|
|
17
17
|
|
|
18
18
|
<style>/*
|
package/dist/LocStorRead.svelte
CHANGED
|
@@ -1,12 +1,17 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import LocStorTable from './LocStorTable.svelte';
|
|
3
|
-
//import { browser } from '$app/environment';
|
|
4
3
|
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
// props
|
|
5
|
+
interface Props {
|
|
6
|
+
pageName: string;
|
|
7
|
+
storeName: string;
|
|
8
|
+
}
|
|
9
|
+
let { pageName, storeName = $bindable() }: Props = $props();
|
|
10
|
+
|
|
11
|
+
// state
|
|
12
|
+
let localKeys: string[] = $state([]);
|
|
7
13
|
|
|
8
|
-
|
|
9
|
-
// create a default key name
|
|
14
|
+
// default storeName
|
|
10
15
|
function defaultName(ilocalKeys: string[]) {
|
|
11
16
|
let rname = storeName;
|
|
12
17
|
const nameUpdate = !ilocalKeys.includes(rname);
|
|
@@ -19,8 +24,9 @@
|
|
|
19
24
|
}
|
|
20
25
|
return rname;
|
|
21
26
|
}
|
|
22
|
-
|
|
23
|
-
|
|
27
|
+
$effect(() => {
|
|
28
|
+
storeName = defaultName(localKeys);
|
|
29
|
+
});
|
|
24
30
|
</script>
|
|
25
31
|
|
|
26
32
|
<LocStorTable {pageName} bind:storeName bind:localKeys />
|
|
@@ -1,21 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
3
|
-
$$bindings?: Bindings;
|
|
4
|
-
} & Exports;
|
|
5
|
-
(internal: unknown, props: Props & {
|
|
6
|
-
$$events?: Events;
|
|
7
|
-
$$slots?: Slots;
|
|
8
|
-
}): Exports & {
|
|
9
|
-
$set?: any;
|
|
10
|
-
$on?: any;
|
|
11
|
-
};
|
|
12
|
-
z_$$bindings?: Bindings;
|
|
13
|
-
}
|
|
14
|
-
declare const LocStorRead: $$__sveltets_2_IsomorphicComponent<{
|
|
1
|
+
declare const LocStorRead: import("svelte").Component<{
|
|
15
2
|
pageName: string;
|
|
16
3
|
storeName: string;
|
|
17
|
-
}, {
|
|
18
|
-
|
|
19
|
-
}, {}, {}, string>;
|
|
20
|
-
type LocStorRead = InstanceType<typeof LocStorRead>;
|
|
4
|
+
}, {}, "storeName">;
|
|
5
|
+
type LocStorRead = ReturnType<typeof LocStorRead>;
|
|
21
6
|
export default LocStorRead;
|
package/dist/LocStorTable.svelte
CHANGED
|
@@ -2,9 +2,18 @@
|
|
|
2
2
|
import ModalDiag from './ModalDiag.svelte';
|
|
3
3
|
import { browser } from '$app/environment';
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
// props
|
|
6
|
+
interface Props {
|
|
7
|
+
pageName: string;
|
|
8
|
+
storeName: string;
|
|
9
|
+
localKeys: string[];
|
|
10
|
+
}
|
|
11
|
+
let { pageName, storeName = $bindable(), localKeys = $bindable() }: Props = $props();
|
|
12
|
+
|
|
13
|
+
// state
|
|
14
|
+
let localDel: tLocalDel = $state({});
|
|
15
|
+
let globalDel = $state(false);
|
|
16
|
+
let modalDelConfirm = $state(false);
|
|
8
17
|
|
|
9
18
|
// get the list of localStorage keys
|
|
10
19
|
function getLocalKey() {
|
|
@@ -15,6 +24,7 @@
|
|
|
15
24
|
//console.log(keyList);
|
|
16
25
|
rKeyList = keyList.map((k) => k.replace(re, ''));
|
|
17
26
|
}
|
|
27
|
+
rKeyList.sort(); // order the list for consistent UX
|
|
18
28
|
//console.log(rKeyList);
|
|
19
29
|
return rKeyList;
|
|
20
30
|
}
|
|
@@ -24,7 +34,6 @@
|
|
|
24
34
|
}
|
|
25
35
|
// last modification date
|
|
26
36
|
type tLocalDate = Record<string, string>;
|
|
27
|
-
let localDate: tLocalDate = {};
|
|
28
37
|
function getLocalDate(iKeys: string[]): tLocalDate {
|
|
29
38
|
let rLocalDate: tLocalDate = {};
|
|
30
39
|
if (browser) {
|
|
@@ -42,10 +51,9 @@
|
|
|
42
51
|
}
|
|
43
52
|
return rLocalDate;
|
|
44
53
|
}
|
|
45
|
-
localDate = getLocalDate(localKeys);
|
|
54
|
+
let localDate: tLocalDate = $derived(getLocalDate(localKeys));
|
|
46
55
|
// delete checkbox
|
|
47
56
|
type tLocalDel = Record<string, boolean>;
|
|
48
|
-
let localDel: tLocalDel = {};
|
|
49
57
|
function getInitDel(iKeys: string[]): tLocalDel {
|
|
50
58
|
let rLocalDel: tLocalDel = {};
|
|
51
59
|
for (const k of iKeys) {
|
|
@@ -55,13 +63,11 @@
|
|
|
55
63
|
}
|
|
56
64
|
localDel = getInitDel(localKeys);
|
|
57
65
|
// global delete
|
|
58
|
-
|
|
59
|
-
function setGlobalDel(iGlobalDel: boolean) {
|
|
66
|
+
function setGlobalDel() {
|
|
60
67
|
for (const k of localKeys) {
|
|
61
|
-
localDel[k] =
|
|
68
|
+
localDel[k] = globalDel;
|
|
62
69
|
}
|
|
63
70
|
}
|
|
64
|
-
$: setGlobalDel(globalDel);
|
|
65
71
|
// delete action
|
|
66
72
|
function actionDel() {
|
|
67
73
|
if (browser) {
|
|
@@ -73,14 +79,14 @@
|
|
|
73
79
|
}
|
|
74
80
|
}
|
|
75
81
|
}
|
|
82
|
+
globalDel = false; // reset global delete checkbox
|
|
76
83
|
localKeys = getLocalKey();
|
|
77
84
|
}
|
|
78
|
-
let modalDelConfirm = false;
|
|
79
85
|
</script>
|
|
80
86
|
|
|
81
87
|
<div class="deleteKeys">
|
|
82
88
|
<button
|
|
83
|
-
|
|
89
|
+
onclick={() => {
|
|
84
90
|
modalDelConfirm = true;
|
|
85
91
|
}}>Delete</button
|
|
86
92
|
>
|
|
@@ -100,7 +106,7 @@
|
|
|
100
106
|
<td>Last modification</td>
|
|
101
107
|
</tr>
|
|
102
108
|
<tr>
|
|
103
|
-
<td><input type="checkbox" bind:checked={globalDel} /></td>
|
|
109
|
+
<td><input type="checkbox" bind:checked={globalDel} onchange={setGlobalDel} /></td>
|
|
104
110
|
<td class="instruction">delete all</td>
|
|
105
111
|
<td></td>
|
|
106
112
|
</tr>
|
|
@@ -109,7 +115,7 @@
|
|
|
109
115
|
{#each localKeys as kname}
|
|
110
116
|
<tr>
|
|
111
117
|
<td><input type="checkbox" bind:checked={localDel[kname]} /></td>
|
|
112
|
-
<td><button
|
|
118
|
+
<td><button onclick={() => modifInput(kname)}>{kname}</button></td>
|
|
113
119
|
<td>{localDate[kname]}</td>
|
|
114
120
|
</tr>
|
|
115
121
|
{/each}
|
|
@@ -1,22 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
3
|
-
$$bindings?: Bindings;
|
|
4
|
-
} & Exports;
|
|
5
|
-
(internal: unknown, props: Props & {
|
|
6
|
-
$$events?: Events;
|
|
7
|
-
$$slots?: Slots;
|
|
8
|
-
}): Exports & {
|
|
9
|
-
$set?: any;
|
|
10
|
-
$on?: any;
|
|
11
|
-
};
|
|
12
|
-
z_$$bindings?: Bindings;
|
|
13
|
-
}
|
|
14
|
-
declare const LocStorTable: $$__sveltets_2_IsomorphicComponent<{
|
|
1
|
+
declare const LocStorTable: import("svelte").Component<{
|
|
15
2
|
pageName: string;
|
|
16
3
|
storeName: string;
|
|
17
4
|
localKeys: string[];
|
|
18
|
-
}, {
|
|
19
|
-
|
|
20
|
-
}, {}, {}, string>;
|
|
21
|
-
type LocStorTable = InstanceType<typeof LocStorTable>;
|
|
5
|
+
}, {}, "storeName" | "localKeys">;
|
|
6
|
+
type LocStorTable = ReturnType<typeof LocStorTable>;
|
|
22
7
|
export default LocStorTable;
|