geomui 0.5.4
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.md +58 -0
- package/dist/Drawing.svelte +303 -0
- package/dist/Drawing.svelte.d.ts +21 -0
- package/dist/DrawingList.svelte +66 -0
- package/dist/DrawingList.svelte.d.ts +17 -0
- package/dist/InputParams.svelte +453 -0
- package/dist/InputParams.svelte.d.ts +22 -0
- package/dist/LabelCheckbox.svelte +27 -0
- package/dist/LabelCheckbox.svelte.d.ts +14 -0
- package/dist/LocStorRead.svelte +56 -0
- package/dist/LocStorRead.svelte.d.ts +17 -0
- package/dist/LocStorTable.svelte +167 -0
- package/dist/LocStorTable.svelte.d.ts +18 -0
- package/dist/LocStorWrite.svelte +66 -0
- package/dist/LocStorWrite.svelte.d.ts +17 -0
- package/dist/ModalDiag.svelte +100 -0
- package/dist/ModalDiag.svelte.d.ts +22 -0
- package/dist/ModalImg.svelte +59 -0
- package/dist/ModalImg.svelte.d.ts +17 -0
- package/dist/OneDesign.svelte +32 -0
- package/dist/OneDesign.svelte.d.ts +18 -0
- package/dist/ParamDrawExport.svelte +195 -0
- package/dist/ParamDrawExport.svelte.d.ts +19 -0
- package/dist/SimpleDrawing.svelte +58 -0
- package/dist/SimpleDrawing.svelte.d.ts +20 -0
- package/dist/SubDesign.svelte +202 -0
- package/dist/SubDesign.svelte.d.ts +19 -0
- package/dist/TimeControl.svelte +107 -0
- package/dist/TimeControl.svelte.d.ts +19 -0
- package/dist/ZoomControl.svelte +106 -0
- package/dist/ZoomControl.svelte.d.ts +16 -0
- package/dist/downloadParams.d.ts +4 -0
- package/dist/downloadParams.js +42 -0
- package/dist/drawingLayers.d.ts +3 -0
- package/dist/drawingLayers.js +6 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +5 -0
- package/dist/initStore.d.ts +5 -0
- package/dist/initStore.js +46 -0
- package/dist/storePVal.d.ts +6 -0
- package/dist/storePVal.js +4 -0
- package/dist/style/colors.scss +51 -0
- package/dist/style/styling.scss +23 -0
- package/package.json +66 -0
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
<script>import { createEventDispatcher } from "svelte";
|
|
2
|
+
const dispatch = createEventDispatcher();
|
|
3
|
+
function theClick(actionName) {
|
|
4
|
+
dispatch("myevent", {
|
|
5
|
+
action: actionName
|
|
6
|
+
});
|
|
7
|
+
}
|
|
8
|
+
</script>
|
|
9
|
+
|
|
10
|
+
<nav>
|
|
11
|
+
<button on:click={() => theClick('zoomInit')}><div class="zero" /></button>
|
|
12
|
+
<button on:click={() => theClick('zoomIn')}><div class="zoomin" /></button>
|
|
13
|
+
<button on:click={() => theClick('zoomOut')}><div class="zoomout" /></button>
|
|
14
|
+
<button on:click={() => theClick('moveLeft')}><div class="arrowleft" /></button>
|
|
15
|
+
<button on:click={() => theClick('moveRight')}><div class="arrowright" /></button>
|
|
16
|
+
<button on:click={() => theClick('moveUp')}><div class="arrowup" /></button>
|
|
17
|
+
<button on:click={() => theClick('moveDown')}><div class="arrowdown" /></button>
|
|
18
|
+
</nav>
|
|
19
|
+
|
|
20
|
+
<style>/*
|
|
21
|
+
$canvas-point: grey;
|
|
22
|
+
|
|
23
|
+
// export to js
|
|
24
|
+
:export {
|
|
25
|
+
colorCanvasPoint: $canvas-point;
|
|
26
|
+
}
|
|
27
|
+
*/
|
|
28
|
+
nav > button {
|
|
29
|
+
height: 2rem;
|
|
30
|
+
width: 2rem;
|
|
31
|
+
border-style: solid;
|
|
32
|
+
border-width: 0.1rem;
|
|
33
|
+
border-radius: 0.2rem;
|
|
34
|
+
border-color: darkGreen;
|
|
35
|
+
margin: 0.1rem;
|
|
36
|
+
background-color: lightGreen;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
nav > button > div.zero {
|
|
40
|
+
height: 0.8rem;
|
|
41
|
+
width: 0.8rem;
|
|
42
|
+
border-style: solid;
|
|
43
|
+
border-width: 0.3rem;
|
|
44
|
+
border-radius: 1rem;
|
|
45
|
+
border-color: darkGreen;
|
|
46
|
+
margin: auto;
|
|
47
|
+
background-color: transparent;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
nav > button > div.zoomin {
|
|
51
|
+
height: 0.8rem;
|
|
52
|
+
width: 0.8rem;
|
|
53
|
+
border-style: solid;
|
|
54
|
+
border-width: 0.3rem;
|
|
55
|
+
border-radius: 0;
|
|
56
|
+
border-color: grey;
|
|
57
|
+
margin: auto;
|
|
58
|
+
background-color: darkGreen;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
nav > button > div.zoomout {
|
|
62
|
+
height: 0.8rem;
|
|
63
|
+
width: 0.8rem;
|
|
64
|
+
border-style: solid;
|
|
65
|
+
border-width: 0.3rem;
|
|
66
|
+
border-radius: 0;
|
|
67
|
+
border-color: darkGreen;
|
|
68
|
+
margin: auto;
|
|
69
|
+
background-color: grey;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
nav > button > div.arrowleft {
|
|
73
|
+
width: 0;
|
|
74
|
+
height: 0;
|
|
75
|
+
border-top: 0.7rem solid transparent;
|
|
76
|
+
border-bottom: 0.7rem solid transparent;
|
|
77
|
+
border-right: 1.26rem solid darkGreen;
|
|
78
|
+
margin: auto;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
nav > button > div.arrowright {
|
|
82
|
+
width: 0;
|
|
83
|
+
height: 0;
|
|
84
|
+
border-top: 0.7rem solid transparent;
|
|
85
|
+
border-bottom: 0.7rem solid transparent;
|
|
86
|
+
border-left: 1.26rem solid darkGreen;
|
|
87
|
+
margin: auto;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
nav > button > div.arrowup {
|
|
91
|
+
width: 0;
|
|
92
|
+
height: 0;
|
|
93
|
+
border-left: 0.7rem solid transparent;
|
|
94
|
+
border-right: 0.7rem solid transparent;
|
|
95
|
+
border-bottom: 1.26rem solid darkGreen;
|
|
96
|
+
margin: auto;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
nav > button > div.arrowdown {
|
|
100
|
+
width: 0;
|
|
101
|
+
height: 0;
|
|
102
|
+
border-left: 0.7rem solid transparent;
|
|
103
|
+
border-right: 0.7rem solid transparent;
|
|
104
|
+
border-top: 1.26rem solid darkGreen;
|
|
105
|
+
margin: auto;
|
|
106
|
+
}</style>
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { SvelteComponent } from "svelte";
|
|
2
|
+
declare const __propDef: {
|
|
3
|
+
props: Record<string, never>;
|
|
4
|
+
events: {
|
|
5
|
+
myevent: CustomEvent<any>;
|
|
6
|
+
} & {
|
|
7
|
+
[evt: string]: CustomEvent<any>;
|
|
8
|
+
};
|
|
9
|
+
slots: {};
|
|
10
|
+
};
|
|
11
|
+
export type ZoomControlProps = typeof __propDef.props;
|
|
12
|
+
export type ZoomControlEvents = typeof __propDef.events;
|
|
13
|
+
export type ZoomControlSlots = typeof __propDef.slots;
|
|
14
|
+
export default class ZoomControl extends SvelteComponent<ZoomControlProps, ZoomControlEvents, ZoomControlSlots> {
|
|
15
|
+
}
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { tParamVal } from 'geometrix';
|
|
2
|
+
declare function downloadParams(iPartName: string, idparams: tParamVal, iComment: string): void;
|
|
3
|
+
declare function generateUrl(ihref: string, idparams: tParamVal, iLenghtLimit: boolean): string;
|
|
4
|
+
export { downloadParams, generateUrl };
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
// downloadParams.ts
|
|
2
|
+
import { createParamFile } from 'geometrix';
|
|
3
|
+
function download_file(file_name, file_content) {
|
|
4
|
+
//create temporary an invisible element
|
|
5
|
+
const elem_a_download = document.createElement('a');
|
|
6
|
+
elem_a_download.setAttribute('href', 'data:text/plain;charset=utf-8,' + encodeURIComponent(file_content));
|
|
7
|
+
elem_a_download.setAttribute('download', file_name);
|
|
8
|
+
//document.body.appendChild(elem_a_download); // it does not seem required to append the element to the DOM to use it
|
|
9
|
+
elem_a_download.click();
|
|
10
|
+
//document.body.removeChild(elem_a_download);
|
|
11
|
+
elem_a_download.remove(); // Is this really required?
|
|
12
|
+
}
|
|
13
|
+
function downloadParams(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_name = `px_${iPartName}_${datestr}.json`;
|
|
18
|
+
const file_content = createParamFile(datestr, idparams, iComment);
|
|
19
|
+
download_file(file_name, file_content);
|
|
20
|
+
//console.log(`dbg343: ${file_name}`);
|
|
21
|
+
}
|
|
22
|
+
function generateUrl(ihref, idparams, iLenghtLimit) {
|
|
23
|
+
const url1 = new URL(ihref);
|
|
24
|
+
const strLengthLimit = 2000;
|
|
25
|
+
let strLength = url1.toString().length;
|
|
26
|
+
for (const ky of Object.keys(idparams)) {
|
|
27
|
+
//const val = ffix(idparams[ky]);
|
|
28
|
+
const val = idparams[ky].toString();
|
|
29
|
+
const nLen = 2 + ky.length + val.length;
|
|
30
|
+
if (!iLenghtLimit || strLength + nLen < strLengthLimit) {
|
|
31
|
+
url1.searchParams.append(encodeURIComponent(ky), encodeURIComponent(val));
|
|
32
|
+
}
|
|
33
|
+
strLength += nLen;
|
|
34
|
+
//strLength = url1.toString().length;
|
|
35
|
+
//console.log(`dbg546: strLength ${strLength} and strLengthLimit ${strLengthLimit}`);
|
|
36
|
+
}
|
|
37
|
+
if (strLength >= strLengthLimit) {
|
|
38
|
+
console.log(`warn547: generateUrl: strLength ${strLength} larger than strLengthLimit ${strLengthLimit}`);
|
|
39
|
+
}
|
|
40
|
+
return url1.toString();
|
|
41
|
+
}
|
|
42
|
+
export { downloadParams, generateUrl };
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { tParamVal, tPageDef, tAllPageDef } from 'geometrix';
|
|
2
|
+
declare function initStore(designDefs: tAllPageDef): void;
|
|
3
|
+
declare function updateStore(iPartName: string, dParams: tParamVal, overwrite: boolean): void;
|
|
4
|
+
declare function incrStore(oneDesignDef: tPageDef): void;
|
|
5
|
+
export { initStore, incrStore, updateStore };
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
// initStore
|
|
2
|
+
import { storePV } from './storePVal';
|
|
3
|
+
import { get } from 'svelte/store';
|
|
4
|
+
function initStore(designDefs) {
|
|
5
|
+
const iniPV = {};
|
|
6
|
+
for (const design of Object.keys(designDefs)) {
|
|
7
|
+
const designParam = {};
|
|
8
|
+
for (const param of designDefs[design].pDef.params) {
|
|
9
|
+
designParam[param.name] = param.init;
|
|
10
|
+
}
|
|
11
|
+
iniPV[design] = designParam;
|
|
12
|
+
}
|
|
13
|
+
storePV.set(iniPV);
|
|
14
|
+
}
|
|
15
|
+
function updateStore(iPartName, dParams, overwrite) {
|
|
16
|
+
const iniPV = get(storePV);
|
|
17
|
+
const designNames = Object.keys(iniPV);
|
|
18
|
+
if (designNames.includes(iPartName)) {
|
|
19
|
+
const inidParams = iniPV[iPartName];
|
|
20
|
+
const inidParamNames = Object.keys(inidParams);
|
|
21
|
+
for (const pa of Object.keys(dParams)) {
|
|
22
|
+
if (!inidParamNames.includes(pa)) {
|
|
23
|
+
inidParams[pa] = dParams[pa];
|
|
24
|
+
}
|
|
25
|
+
else if (overwrite) {
|
|
26
|
+
inidParams[pa] = dParams[pa];
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
iniPV[iPartName] = inidParams;
|
|
30
|
+
//console.log(`dbg781: updateStore of ${iPartName}`);
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
iniPV[iPartName] = dParams;
|
|
34
|
+
//console.log(`dbg782: updateStore of new ${iPartName}`);
|
|
35
|
+
}
|
|
36
|
+
storePV.set(iniPV);
|
|
37
|
+
}
|
|
38
|
+
function incrStore(oneDesignDef) {
|
|
39
|
+
const dName = oneDesignDef.pDef.partName;
|
|
40
|
+
const dParams = {};
|
|
41
|
+
for (const param of oneDesignDef.pDef.params) {
|
|
42
|
+
dParams[param.name] = param.init;
|
|
43
|
+
}
|
|
44
|
+
updateStore(dName, dParams, false);
|
|
45
|
+
}
|
|
46
|
+
export { initStore, incrStore, updateStore };
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
// colors.scss
|
|
2
|
+
|
|
3
|
+
//$main: #ccccee;
|
|
4
|
+
//$main: #f0f0ff;
|
|
5
|
+
//$main-bg: #ffffff;
|
|
6
|
+
//$main-bg: ghostwhite;
|
|
7
|
+
//$main-bg: whitesmoke;
|
|
8
|
+
$subdesign-bg: LightGrey;
|
|
9
|
+
|
|
10
|
+
$arrow: DarkOrange;
|
|
11
|
+
//$link: ForestGreen;
|
|
12
|
+
|
|
13
|
+
//$indexBg: Lavender;
|
|
14
|
+
//$indexSepara: DarkBlue;
|
|
15
|
+
//$indexSeparaStop: LightBlue;
|
|
16
|
+
|
|
17
|
+
$pde-title: grey;
|
|
18
|
+
$pde-params: darkBlue;
|
|
19
|
+
$pde-canvas: pink;
|
|
20
|
+
$subd-title-complement: white;
|
|
21
|
+
$subd-title: black;
|
|
22
|
+
$subd-h4: DarkGrey;
|
|
23
|
+
|
|
24
|
+
$timectrl-bg: lightBlue;
|
|
25
|
+
$timectrl-sign: darkBlue;
|
|
26
|
+
|
|
27
|
+
$zoom-bg: lightGreen;
|
|
28
|
+
$zoom-sign: darkGreen;
|
|
29
|
+
$zoom-other: grey;
|
|
30
|
+
|
|
31
|
+
$modal: lightCyan;
|
|
32
|
+
//$table-head: aquamarine;
|
|
33
|
+
$table-head: #ddd;
|
|
34
|
+
//$table-body: lightSkyBlue;
|
|
35
|
+
$table-body: #eee;
|
|
36
|
+
$table-line-changed: #ded;
|
|
37
|
+
|
|
38
|
+
$warning-message: orange;
|
|
39
|
+
$warn-calc-warning: orange;
|
|
40
|
+
$warn-calc-error: violet;
|
|
41
|
+
|
|
42
|
+
$mini-picture: white;
|
|
43
|
+
|
|
44
|
+
/*
|
|
45
|
+
$canvas-point: grey;
|
|
46
|
+
|
|
47
|
+
// export to js
|
|
48
|
+
:export {
|
|
49
|
+
colorCanvasPoint: $canvas-point;
|
|
50
|
+
}
|
|
51
|
+
*/
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
// styling.scss
|
|
2
|
+
@use './colors.scss';
|
|
3
|
+
|
|
4
|
+
@mixin mix-h2 {
|
|
5
|
+
color: colors.$pde-title;
|
|
6
|
+
margin: 1rem 0.5rem 0;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
@mixin mix-button {
|
|
10
|
+
/*display: inline-block;*/
|
|
11
|
+
height: 1.6rem;
|
|
12
|
+
/*width: 1.6rem;*/
|
|
13
|
+
color: colors.$timectrl-sign;
|
|
14
|
+
font-size: 0.8rem;
|
|
15
|
+
font-weight: 400;
|
|
16
|
+
padding: 0.2rem 0.4rem 0.2rem;
|
|
17
|
+
border-style: solid;
|
|
18
|
+
border-width: 0.1rem;
|
|
19
|
+
border-radius: 0.2rem;
|
|
20
|
+
border-color: colors.$timectrl-sign;
|
|
21
|
+
margin: 0.5rem;
|
|
22
|
+
background-color: colors.$timectrl-bg;
|
|
23
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "geomui",
|
|
3
|
+
"version": "0.5.4",
|
|
4
|
+
"description": "The svelte-library of the webapp-UI of Parametrix",
|
|
5
|
+
"scripts": {
|
|
6
|
+
"dev": "vite dev",
|
|
7
|
+
"build": "vite build && npm run package",
|
|
8
|
+
"preview": "vite preview",
|
|
9
|
+
"package": "svelte-kit sync && svelte-package && publint",
|
|
10
|
+
"prepublishOnly": "npm run package",
|
|
11
|
+
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
|
|
12
|
+
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
|
|
13
|
+
"test:unit": "vitest",
|
|
14
|
+
"test:unit:once": "vitest --run",
|
|
15
|
+
"lint": "prettier --check . && eslint .",
|
|
16
|
+
"ci": "run-s build lint check test:unit:once",
|
|
17
|
+
"format": "prettier --write .",
|
|
18
|
+
"clean": "shx rm -fr .svelte-kit build node_modules dist"
|
|
19
|
+
},
|
|
20
|
+
"exports": {
|
|
21
|
+
".": {
|
|
22
|
+
"types": "./dist/index.d.ts",
|
|
23
|
+
"svelte": "./dist/index.js"
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
"files": [
|
|
27
|
+
"dist",
|
|
28
|
+
"!dist/**/*.test.*",
|
|
29
|
+
"!dist/**/*.spec.*"
|
|
30
|
+
],
|
|
31
|
+
"peerDependencies": {
|
|
32
|
+
"@sveltejs/kit": "^2.0.3",
|
|
33
|
+
"svelte": "^4.0.0"
|
|
34
|
+
},
|
|
35
|
+
"dependencies": {
|
|
36
|
+
"designix": "^0.5.2",
|
|
37
|
+
"geometrix": "^0.5.1"
|
|
38
|
+
},
|
|
39
|
+
"devDependencies": {
|
|
40
|
+
"@sveltejs/adapter-auto": "^3.0.1",
|
|
41
|
+
"@sveltejs/adapter-static": "^3.0.1",
|
|
42
|
+
"@sveltejs/kit": "^2.0.6",
|
|
43
|
+
"@sveltejs/package": "^2.2.5",
|
|
44
|
+
"@sveltejs/vite-plugin-svelte": "^3.0.1",
|
|
45
|
+
"@typescript-eslint/eslint-plugin": "^6.16.0",
|
|
46
|
+
"@typescript-eslint/parser": "^6.16.0",
|
|
47
|
+
"eslint": "^8.56.0",
|
|
48
|
+
"eslint-config-prettier": "^9.1.0",
|
|
49
|
+
"eslint-plugin-svelte": "^2.35.1",
|
|
50
|
+
"npm-run-all": "^4.1.5",
|
|
51
|
+
"prettier": "^3.1.1",
|
|
52
|
+
"prettier-plugin-svelte": "^3.1.2",
|
|
53
|
+
"publint": "^0.2.7",
|
|
54
|
+
"sass": "^1.69.6",
|
|
55
|
+
"shx": "^0.3.4",
|
|
56
|
+
"svelte": "^4.2.8",
|
|
57
|
+
"svelte-check": "^3.6.2",
|
|
58
|
+
"tslib": "^2.6.2",
|
|
59
|
+
"typescript": "^5.3.3",
|
|
60
|
+
"vite": "^5.0.10",
|
|
61
|
+
"vitest": "^1.1.0"
|
|
62
|
+
},
|
|
63
|
+
"svelte": "./dist/index.js",
|
|
64
|
+
"types": "./dist/index.d.ts",
|
|
65
|
+
"type": "module"
|
|
66
|
+
}
|