diff --git a/.gitignore b/.gitignore
index 77fdd3e..e6a88d3 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,2 +1,4 @@
/target
dist
+node_modules
+static/uno.css
diff --git a/Cargo.lock b/Cargo.lock
index d6c6ace..4f01ae1 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -35,6 +35,12 @@ version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa"
+[[package]]
+name = "base64"
+version = "0.13.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8"
+
[[package]]
name = "bincode"
version = "1.3.3"
@@ -449,8 +455,13 @@ name = "magic-sql-gen"
version = "0.1.0"
dependencies = [
"anyhow",
+ "base64",
+ "gloo",
+ "js-sys",
"lazy-regex",
+ "serde",
"thiserror",
+ "web-sys",
"xml-rs",
"yew",
"zip",
diff --git a/Cargo.toml b/Cargo.toml
index 42d68e1..43b08b6 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -10,8 +10,24 @@ yew = { version="0.20", features=["csr"] }
anyhow = "1.0.69"
thiserror = "1.0.38"
lazy-regex = "2.4.1"
+js-sys = "0.3"
+base64 = "0.13.0"
+gloo = "0.8"
+serde = { version = "1.0", features = ["derive"] }
[dependencies.zip]
version = "0.6.4"
default-features = false
features=["deflate"]
+
+[dependencies.web-sys]
+version = "0.3"
+features = ["File", "DragEvent", "DataTransfer"]
+
+# More info: https://doc.rust-lang.org/cargo/reference/profiles.html
+[profile.release]
+panic = 'abort'
+codegen-units = 1
+lto = true
+# Experiment with levels: '1', '2', '3', 's', 'z' for best results
+opt-level = 'z' # or 's', for less aggresive size optimization
diff --git a/build.sh b/build.sh
new file mode 100755
index 0000000..ba6354b
--- /dev/null
+++ b/build.sh
@@ -0,0 +1,3 @@
+#!/bin/sh
+npm run uno
+trunk build --release
diff --git a/index.html b/index.html
index 4d13cf1..40e540d 100644
--- a/index.html
+++ b/index.html
@@ -1,8 +1,19 @@
-
+
- Trunk Template
-
+ 🪄 MagicDraw SQL Data Generator
+
+
+
+
+
+
+
+
+
+
diff --git a/index.scss b/index.scss
deleted file mode 100644
index 710545f..0000000
--- a/index.scss
+++ /dev/null
@@ -1,35 +0,0 @@
-html,
-body {
- height: 100%;
- margin: 0;
-}
-
-body {
- align-items: center;
- display: flex;
- justify-content: center;
-
- background: linear-gradient(to bottom right, #444444, #009a5b);
- font-size: 1.5rem;
-}
-
-main {
- color: #fff6d5;
- font-family: sans-serif;
- text-align: center;
-}
-
-.logo {
- height: 20em;
-}
-
-.heart:after {
- content: "❤️";
-
- font-size: 1.75em;
-}
-
-h1 + .subtitle {
- display: block;
- margin-top: -1em;
-}
diff --git a/package.json b/package.json
new file mode 100644
index 0000000..8b1db5e
--- /dev/null
+++ b/package.json
@@ -0,0 +1,16 @@
+{
+ "name": "magic-sql-gen",
+ "version": "1.0.0",
+ "description": "",
+ "type": "module",
+ "scripts": {
+ "preinstall": "npx only-allow pnpm",
+ "uno": "unocss src/*.rs src/components/*.rs index.html --out-file static/uno.css"
+ },
+ "devDependencies": {
+ "@unocss/cli": "^0.50.1",
+ "@unocss/preset-attributify": "^0.50.1",
+ "@unocss/preset-icons": "^0.50.1",
+ "unocss": "^0.50.1"
+ }
+}
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
new file mode 100644
index 0000000..a833ae0
--- /dev/null
+++ b/pnpm-lock.yaml
@@ -0,0 +1,749 @@
+lockfileVersion: 5.4
+
+specifiers:
+ '@unocss/cli': ^0.50.1
+ '@unocss/preset-attributify': ^0.50.1
+ '@unocss/preset-icons': ^0.50.1
+ unocss: ^0.50.1
+
+devDependencies:
+ '@unocss/cli': 0.50.1
+ '@unocss/preset-attributify': 0.50.1
+ '@unocss/preset-icons': 0.50.1
+ unocss: 0.50.1
+
+packages:
+
+ /@ampproject/remapping/2.2.0:
+ resolution: {integrity: sha512-qRmjj8nj9qmLTQXXmaR1cck3UXSRMPrbsLJAasZpF+t3riI71BXed5ebIOYwQntykeZuhjsdweEc9BxH5Jc26w==}
+ engines: {node: '>=6.0.0'}
+ dependencies:
+ '@jridgewell/gen-mapping': 0.1.1
+ '@jridgewell/trace-mapping': 0.3.17
+ dev: true
+
+ /@antfu/install-pkg/0.1.1:
+ resolution: {integrity: sha512-LyB/8+bSfa0DFGC06zpCEfs89/XoWZwws5ygEa5D+Xsm3OfI+aXQ86VgVG7Acyef+rSZ5HE7J8rrxzrQeM3PjQ==}
+ dependencies:
+ execa: 5.1.1
+ find-up: 5.0.0
+ dev: true
+
+ /@antfu/utils/0.5.2:
+ resolution: {integrity: sha512-CQkeV+oJxUazwjlHD0/3ZD08QWKuGQkhnrKo3e6ly5pd48VUpXbb77q0xMU4+vc2CkJnDS02Eq/M9ugyX20XZA==}
+ dev: true
+
+ /@antfu/utils/0.7.2:
+ resolution: {integrity: sha512-vy9fM3pIxZmX07dL+VX1aZe7ynZ+YyB0jY+jE6r3hOK6GNY2t6W8rzpFC4tgpbXUYABkFQwgJq2XYXlxbXAI0g==}
+ dev: true
+
+ /@iconify/types/2.0.0:
+ resolution: {integrity: sha512-+wluvCrRhXrhyOmRDJ3q8mux9JkKy5SJ/v8ol2tu4FVjyYvtEzkc/3pK15ET6RKg4b4w4BmTk1+gsCUhf21Ykg==}
+ dev: true
+
+ /@iconify/utils/2.1.4:
+ resolution: {integrity: sha512-7vzsYIvxv5Hng0MNEtSSnyMBD/+zqnORqmKiYsSgpMBGSz1r93URgBZHPYCZ1/gpoaVstYW4/SVLGCMJBNMCLQ==}
+ dependencies:
+ '@antfu/install-pkg': 0.1.1
+ '@antfu/utils': 0.7.2
+ '@iconify/types': 2.0.0
+ debug: 4.3.4
+ kolorist: 1.7.0
+ local-pkg: 0.4.3
+ transitivePeerDependencies:
+ - supports-color
+ dev: true
+
+ /@jridgewell/gen-mapping/0.1.1:
+ resolution: {integrity: sha512-sQXCasFk+U8lWYEe66WxRDOE9PjVz4vSM51fTu3Hw+ClTpUSQb718772vH3pyS5pShp6lvQM7SxgIDXXXmOX7w==}
+ engines: {node: '>=6.0.0'}
+ dependencies:
+ '@jridgewell/set-array': 1.1.2
+ '@jridgewell/sourcemap-codec': 1.4.14
+ dev: true
+
+ /@jridgewell/resolve-uri/3.1.0:
+ resolution: {integrity: sha512-F2msla3tad+Mfht5cJq7LSXcdudKTWCVYUgw6pLFOOHSTtZlj6SWNYAp+AhuqLmWdBO2X5hPrLcu8cVP8fy28w==}
+ engines: {node: '>=6.0.0'}
+ dev: true
+
+ /@jridgewell/set-array/1.1.2:
+ resolution: {integrity: sha512-xnkseuNADM0gt2bs+BvhO0p78Mk762YnZdsuzFV018NoG1Sj1SCQvpSqa7XUaTam5vAGasABV9qXASMKnFMwMw==}
+ engines: {node: '>=6.0.0'}
+ dev: true
+
+ /@jridgewell/sourcemap-codec/1.4.14:
+ resolution: {integrity: sha512-XPSJHWmi394fuUuzDnGz1wiKqWfo1yXecHQMRf2l6hztTO+nPru658AyDngaBe7isIxEkRsPR3FZh+s7iVa4Uw==}
+ dev: true
+
+ /@jridgewell/trace-mapping/0.3.17:
+ resolution: {integrity: sha512-MCNzAp77qzKca9+W/+I0+sEpaUnZoeasnghNeVc41VZCEKaCH73Vq3BZZ/SzWIgrqE4H4ceI+p+b6C0mHf9T4g==}
+ dependencies:
+ '@jridgewell/resolve-uri': 3.1.0
+ '@jridgewell/sourcemap-codec': 1.4.14
+ dev: true
+
+ /@nodelib/fs.scandir/2.1.5:
+ resolution: {integrity: sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==}
+ engines: {node: '>= 8'}
+ dependencies:
+ '@nodelib/fs.stat': 2.0.5
+ run-parallel: 1.2.0
+ dev: true
+
+ /@nodelib/fs.stat/2.0.5:
+ resolution: {integrity: sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==}
+ engines: {node: '>= 8'}
+ dev: true
+
+ /@nodelib/fs.walk/1.2.8:
+ resolution: {integrity: sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==}
+ engines: {node: '>= 8'}
+ dependencies:
+ '@nodelib/fs.scandir': 2.1.5
+ fastq: 1.15.0
+ dev: true
+
+ /@polka/url/1.0.0-next.21:
+ resolution: {integrity: sha512-a5Sab1C4/icpTZVzZc5Ghpz88yQtGOyNqYXcZgOssB2uuAr+wF/MvN6bgtW32q7HHrvBki+BsZ0OuNv6EV3K9g==}
+ dev: true
+
+ /@rollup/pluginutils/5.0.2:
+ resolution: {integrity: sha512-pTd9rIsP92h+B6wWwFbW8RkZv4hiR/xKsqre4SIuAOaOEQRxi0lqLke9k2/7WegC85GgUs9pjmOjCUi3In4vwA==}
+ engines: {node: '>=14.0.0'}
+ peerDependencies:
+ rollup: ^1.20.0||^2.0.0||^3.0.0
+ peerDependenciesMeta:
+ rollup:
+ optional: true
+ dependencies:
+ '@types/estree': 1.0.0
+ estree-walker: 2.0.2
+ picomatch: 2.3.1
+ dev: true
+
+ /@types/estree/1.0.0:
+ resolution: {integrity: sha512-WulqXMDUTYAXCjZnk6JtIHPigp55cVtDgDrO2gHRwhyJto21+1zbVCtOYB2L1F9w4qCQ0rOGWBnBe0FNTiEJIQ==}
+ dev: true
+
+ /@unocss/astro/0.50.1:
+ resolution: {integrity: sha512-TlGIK21OTbVUgrwZXfU4x0VwpNB7i/MKGcpv3HKadxdqhXReimt9gD+iRWSRAvRBgDIcH6Uqvr3Qq1aNCVEdTg==}
+ dependencies:
+ '@unocss/core': 0.50.1
+ '@unocss/reset': 0.50.1
+ '@unocss/vite': 0.50.1
+ transitivePeerDependencies:
+ - rollup
+ - vite
+ dev: true
+
+ /@unocss/cli/0.50.1:
+ resolution: {integrity: sha512-Qu1s8sJh4XFRN62qeHAQ+NkxylPi7Gf4Gz0NmTvn4C9BjpiCwO4QKJoyy0fjY4TcdPOIkibfSg/MjTD/4ceyyA==}
+ engines: {node: '>=14'}
+ hasBin: true
+ dependencies:
+ '@ampproject/remapping': 2.2.0
+ '@rollup/pluginutils': 5.0.2
+ '@unocss/config': 0.50.1
+ '@unocss/core': 0.50.1
+ '@unocss/preset-uno': 0.50.1
+ cac: 6.7.14
+ chokidar: 3.5.3
+ colorette: 2.0.19
+ consola: 2.15.3
+ fast-glob: 3.2.12
+ magic-string: 0.30.0
+ pathe: 1.1.0
+ perfect-debounce: 0.1.3
+ transitivePeerDependencies:
+ - rollup
+ dev: true
+
+ /@unocss/config/0.50.1:
+ resolution: {integrity: sha512-pZmT5gDIp0n/HMSD2kcSw/LW4QJ5azjBzGciuLN6p/kOjgj1SnYjElOgbedUEMeyZTZXveMoB50OuUzb9S+a2g==}
+ engines: {node: '>=14'}
+ dependencies:
+ '@unocss/core': 0.50.1
+ unconfig: 0.3.7
+ dev: true
+
+ /@unocss/core/0.50.1:
+ resolution: {integrity: sha512-jnWClMMGybzyXcRX4DY+g/DJ4JrH9w8YN/H6OTHt0WyrNfR1V3ebJtEc6gbqCkZCh2XmqSA5F49QPhTbErYePg==}
+ dev: true
+
+ /@unocss/inspector/0.50.1:
+ resolution: {integrity: sha512-pKjhO8hlkcYVksnQn/ly1HLnh49ZYu/MDnexaQaPtS3/1KLibiinTNqzZpZJZ71T0dVUadW9fMfV2t283GhJzA==}
+ dependencies:
+ gzip-size: 6.0.0
+ sirv: 2.0.2
+ dev: true
+
+ /@unocss/preset-attributify/0.50.1:
+ resolution: {integrity: sha512-hFvxX406r8jXYkHTSq5GVg5ZXNtGNlTmvrjvpirH3PxK/YOkcS7D3ZsnOmxTvblsIzXx45w+V7hplNAg9t46eQ==}
+ dependencies:
+ '@unocss/core': 0.50.1
+ dev: true
+
+ /@unocss/preset-icons/0.50.1:
+ resolution: {integrity: sha512-uqPzQ2U2ih3wb1sjjnEI3OMzf2jcpoflIY9+jIXb0CgIh2SQtvri2uK4mYBWTLyZXWp9bHfBEaM9Dzfr9eSU3w==}
+ dependencies:
+ '@iconify/utils': 2.1.4
+ '@unocss/core': 0.50.1
+ ofetch: 1.0.1
+ transitivePeerDependencies:
+ - supports-color
+ dev: true
+
+ /@unocss/preset-mini/0.50.1:
+ resolution: {integrity: sha512-asAJHsgNKbfH5aANuaA/1Q0efWPWalGSlLa9V73JXyXO4fbFT86m3o65NPHbm2N9t5IRxTfL3hcuUE/cOGEVLg==}
+ dependencies:
+ '@unocss/core': 0.50.1
+ dev: true
+
+ /@unocss/preset-tagify/0.50.1:
+ resolution: {integrity: sha512-3pAJDKxa+RFMpZL8bQpR/76htF22mpb72dV5UBj0l4HZk/9HK2hlLL2GurZ87HOZbh4cWfgHj9G+CK+ubTHY0w==}
+ dependencies:
+ '@unocss/core': 0.50.1
+ dev: true
+
+ /@unocss/preset-typography/0.50.1:
+ resolution: {integrity: sha512-sk2LGA47558BLTvIlZlYExnV84C+8wYSh8jYhizW7IJjrvudfOSuO21qPulhcUjCwcMo8pEDRx7YddZy8sJOuQ==}
+ dependencies:
+ '@unocss/core': 0.50.1
+ dev: true
+
+ /@unocss/preset-uno/0.50.1:
+ resolution: {integrity: sha512-d4A7lqldhA1AeD0T/uwPHc+6pz44FYOnsSf34C0KVBmt1kDR2kZUOk8tcNWSXMpDWBkGAhrOMl/EuZ5ShCRzeQ==}
+ dependencies:
+ '@unocss/core': 0.50.1
+ '@unocss/preset-mini': 0.50.1
+ '@unocss/preset-wind': 0.50.1
+ dev: true
+
+ /@unocss/preset-web-fonts/0.50.1:
+ resolution: {integrity: sha512-V9i5t57gPbpuuP7rKIS9wj2PUuLojG8/nkMIutivIOXNK+O+7klp3YDrs+0cwUjCRPgXCbnbBTAs/eXOjTitUQ==}
+ dependencies:
+ '@unocss/core': 0.50.1
+ ofetch: 1.0.1
+ dev: true
+
+ /@unocss/preset-wind/0.50.1:
+ resolution: {integrity: sha512-+gDGdundQTgyEiK9Y0DbVCxjT5Miu7vBGtcsp0AyLojz/cHkdDBL/1X34fWTA7mejnFgs/e2m0BlFVwAj9ZZiQ==}
+ dependencies:
+ '@unocss/core': 0.50.1
+ '@unocss/preset-mini': 0.50.1
+ dev: true
+
+ /@unocss/reset/0.50.1:
+ resolution: {integrity: sha512-BcANWHHrKgHML5TLaPuSl148L2WLA938r0pLi4PrRTmZtkgP4OhBLs8U8BaDNVVGR/nli7VDxNRZFb9es3Tq9Q==}
+ dev: true
+
+ /@unocss/scope/0.50.1:
+ resolution: {integrity: sha512-C59tSuuiNh/c7X+DcuaNKVsmFvqSyWu5tAa/sTMDYa6qLRof2W/ot7NEEH9QEC7s0fklAiRt7Iazehrjz4mf+w==}
+ dev: true
+
+ /@unocss/transformer-attributify-jsx/0.50.1:
+ resolution: {integrity: sha512-gyvPRcQVgg3yDcj+KCqkrm/kYNTPKhynNzY0UTLQ7eBH3C786zs+8miyONyL/K0bkoBaWnw3Jzr07JIRQfguUA==}
+ dependencies:
+ '@unocss/core': 0.50.1
+ dev: true
+
+ /@unocss/transformer-compile-class/0.50.1:
+ resolution: {integrity: sha512-HuAL914R1hXaDO/KkbWX8q8GffAPhvdZIMy+VpdGXNSWAGpYpHWQu/LGrTuzk56p8sGGy6jwza1iMIP/9l7CWQ==}
+ dependencies:
+ '@unocss/core': 0.50.1
+ dev: true
+
+ /@unocss/transformer-directives/0.50.1:
+ resolution: {integrity: sha512-rdkznrK6JeEp9m2StLhP0VViuBWDgzYUqA3JxOKMoMQ0+x/TfBbXWkw2WnoGGkj3Vms6NPoKGa5Yhbdxp4w8yg==}
+ dependencies:
+ '@unocss/core': 0.50.1
+ css-tree: 2.3.1
+ dev: true
+
+ /@unocss/transformer-variant-group/0.50.1:
+ resolution: {integrity: sha512-1+OBSsyHfW9mXAnzaELXWqLjcoi+B4G5R5h+9TT2RZfHqkSIu+5xu2OGsDJ2QFhNGFerv7R2k7ajVCnbQWq7TQ==}
+ dependencies:
+ '@unocss/core': 0.50.1
+ dev: true
+
+ /@unocss/vite/0.50.1:
+ resolution: {integrity: sha512-CDy9ZcwSCpz/ED9zglunmrCVDbczbtkC/ZzgcRehDUX9xeVRA397uakb7fe4Rm+KGOGmr7HsUTQR7s0C9EOYww==}
+ peerDependencies:
+ vite: ^2.9.0 || ^3.0.0-0 || ^4.0.0
+ dependencies:
+ '@ampproject/remapping': 2.2.0
+ '@rollup/pluginutils': 5.0.2
+ '@unocss/config': 0.50.1
+ '@unocss/core': 0.50.1
+ '@unocss/inspector': 0.50.1
+ '@unocss/scope': 0.50.1
+ '@unocss/transformer-directives': 0.50.1
+ chokidar: 3.5.3
+ fast-glob: 3.2.12
+ magic-string: 0.30.0
+ transitivePeerDependencies:
+ - rollup
+ dev: true
+
+ /anymatch/3.1.3:
+ resolution: {integrity: sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==}
+ engines: {node: '>= 8'}
+ dependencies:
+ normalize-path: 3.0.0
+ picomatch: 2.3.1
+ dev: true
+
+ /binary-extensions/2.2.0:
+ resolution: {integrity: sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==}
+ engines: {node: '>=8'}
+ dev: true
+
+ /braces/3.0.2:
+ resolution: {integrity: sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==}
+ engines: {node: '>=8'}
+ dependencies:
+ fill-range: 7.0.1
+ dev: true
+
+ /cac/6.7.14:
+ resolution: {integrity: sha512-b6Ilus+c3RrdDk+JhLKUAQfzzgLEPy6wcXqS7f/xe1EETvsDP6GORG7SFuOs6cID5YkqchW/LXZbX5bc8j7ZcQ==}
+ engines: {node: '>=8'}
+ dev: true
+
+ /chokidar/3.5.3:
+ resolution: {integrity: sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw==}
+ engines: {node: '>= 8.10.0'}
+ dependencies:
+ anymatch: 3.1.3
+ braces: 3.0.2
+ glob-parent: 5.1.2
+ is-binary-path: 2.1.0
+ is-glob: 4.0.3
+ normalize-path: 3.0.0
+ readdirp: 3.6.0
+ optionalDependencies:
+ fsevents: 2.3.2
+ dev: true
+
+ /colorette/2.0.19:
+ resolution: {integrity: sha512-3tlv/dIP7FWvj3BsbHrGLJ6l/oKh1O3TcgBqMn+yyCagOxc23fyzDS6HypQbgxWbkpDnf52p1LuR4eWDQ/K9WQ==}
+ dev: true
+
+ /consola/2.15.3:
+ resolution: {integrity: sha512-9vAdYbHj6x2fLKC4+oPH0kFzY/orMZyG2Aj+kNylHxKGJ/Ed4dpNyAQYwJOdqO4zdM7XpVHmyejQDcQHrnuXbw==}
+ dev: true
+
+ /cross-spawn/7.0.3:
+ resolution: {integrity: sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==}
+ engines: {node: '>= 8'}
+ dependencies:
+ path-key: 3.1.1
+ shebang-command: 2.0.0
+ which: 2.0.2
+ dev: true
+
+ /css-tree/2.3.1:
+ resolution: {integrity: sha512-6Fv1DV/TYw//QF5IzQdqsNDjx/wc8TrMBZsqjL9eW01tWb7R7k/mq+/VXfJCl7SoD5emsJop9cOByJZfs8hYIw==}
+ engines: {node: ^10 || ^12.20.0 || ^14.13.0 || >=15.0.0}
+ dependencies:
+ mdn-data: 2.0.30
+ source-map-js: 1.0.2
+ dev: true
+
+ /debug/4.3.4:
+ resolution: {integrity: sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==}
+ engines: {node: '>=6.0'}
+ peerDependencies:
+ supports-color: '*'
+ peerDependenciesMeta:
+ supports-color:
+ optional: true
+ dependencies:
+ ms: 2.1.2
+ dev: true
+
+ /defu/6.1.2:
+ resolution: {integrity: sha512-+uO4+qr7msjNNWKYPHqN/3+Dx3NFkmIzayk2L1MyZQlvgZb/J1A0fo410dpKrN2SnqFjt8n4JL8fDJE0wIgjFQ==}
+ dev: true
+
+ /destr/1.2.2:
+ resolution: {integrity: sha512-lrbCJwD9saUQrqUfXvl6qoM+QN3W7tLV5pAOs+OqOmopCCz/JkE05MHedJR1xfk4IAnZuJXPVuN5+7jNA2ZCiA==}
+ dev: true
+
+ /duplexer/0.1.2:
+ resolution: {integrity: sha512-jtD6YG370ZCIi/9GTaJKQxWTZD045+4R4hTk/x1UyoqadyJ9x9CgSi1RlVDQF8U2sxLLSnFkCaMihqljHIWgMg==}
+ dev: true
+
+ /estree-walker/2.0.2:
+ resolution: {integrity: sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w==}
+ dev: true
+
+ /execa/5.1.1:
+ resolution: {integrity: sha512-8uSpZZocAZRBAPIEINJj3Lo9HyGitllczc27Eh5YYojjMFMn8yHMDMaUHE2Jqfq05D/wucwI4JGURyXt1vchyg==}
+ engines: {node: '>=10'}
+ dependencies:
+ cross-spawn: 7.0.3
+ get-stream: 6.0.1
+ human-signals: 2.1.0
+ is-stream: 2.0.1
+ merge-stream: 2.0.0
+ npm-run-path: 4.0.1
+ onetime: 5.1.2
+ signal-exit: 3.0.7
+ strip-final-newline: 2.0.0
+ dev: true
+
+ /fast-glob/3.2.12:
+ resolution: {integrity: sha512-DVj4CQIYYow0BlaelwK1pHl5n5cRSJfM60UA0zK891sVInoPri2Ekj7+e1CT3/3qxXenpI+nBBmQAcJPJgaj4w==}
+ engines: {node: '>=8.6.0'}
+ dependencies:
+ '@nodelib/fs.stat': 2.0.5
+ '@nodelib/fs.walk': 1.2.8
+ glob-parent: 5.1.2
+ merge2: 1.4.1
+ micromatch: 4.0.5
+ dev: true
+
+ /fastq/1.15.0:
+ resolution: {integrity: sha512-wBrocU2LCXXa+lWBt8RoIRD89Fi8OdABODa/kEnyeyjS5aZO5/GNvI5sEINADqP/h8M29UHTHUb53sUu5Ihqdw==}
+ dependencies:
+ reusify: 1.0.4
+ dev: true
+
+ /fill-range/7.0.1:
+ resolution: {integrity: sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==}
+ engines: {node: '>=8'}
+ dependencies:
+ to-regex-range: 5.0.1
+ dev: true
+
+ /find-up/5.0.0:
+ resolution: {integrity: sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==}
+ engines: {node: '>=10'}
+ dependencies:
+ locate-path: 6.0.0
+ path-exists: 4.0.0
+ dev: true
+
+ /fsevents/2.3.2:
+ resolution: {integrity: sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==}
+ engines: {node: ^8.16.0 || ^10.6.0 || >=11.0.0}
+ os: [darwin]
+ requiresBuild: true
+ dev: true
+ optional: true
+
+ /get-stream/6.0.1:
+ resolution: {integrity: sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==}
+ engines: {node: '>=10'}
+ dev: true
+
+ /glob-parent/5.1.2:
+ resolution: {integrity: sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==}
+ engines: {node: '>= 6'}
+ dependencies:
+ is-glob: 4.0.3
+ dev: true
+
+ /gzip-size/6.0.0:
+ resolution: {integrity: sha512-ax7ZYomf6jqPTQ4+XCpUGyXKHk5WweS+e05MBO4/y3WJ5RkmPXNKvX+bx1behVILVwr6JSQvZAku021CHPXG3Q==}
+ engines: {node: '>=10'}
+ dependencies:
+ duplexer: 0.1.2
+ dev: true
+
+ /human-signals/2.1.0:
+ resolution: {integrity: sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw==}
+ engines: {node: '>=10.17.0'}
+ dev: true
+
+ /is-binary-path/2.1.0:
+ resolution: {integrity: sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==}
+ engines: {node: '>=8'}
+ dependencies:
+ binary-extensions: 2.2.0
+ dev: true
+
+ /is-extglob/2.1.1:
+ resolution: {integrity: sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==}
+ engines: {node: '>=0.10.0'}
+ dev: true
+
+ /is-glob/4.0.3:
+ resolution: {integrity: sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==}
+ engines: {node: '>=0.10.0'}
+ dependencies:
+ is-extglob: 2.1.1
+ dev: true
+
+ /is-number/7.0.0:
+ resolution: {integrity: sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==}
+ engines: {node: '>=0.12.0'}
+ dev: true
+
+ /is-stream/2.0.1:
+ resolution: {integrity: sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==}
+ engines: {node: '>=8'}
+ dev: true
+
+ /isexe/2.0.0:
+ resolution: {integrity: sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==}
+ dev: true
+
+ /jiti/1.17.1:
+ resolution: {integrity: sha512-NZIITw8uZQFuzQimqjUxIrIcEdxYDFIe/0xYfIlVXTkiBjjyBEvgasj5bb0/cHtPRD/NziPbT312sFrkI5ALpw==}
+ hasBin: true
+ dev: true
+
+ /kolorist/1.7.0:
+ resolution: {integrity: sha512-ymToLHqL02udwVdbkowNpzjFd6UzozMtshPQKVi5k1EjKRqKqBrOnE9QbLEb0/pV76SAiIT13hdL8R6suc+f3g==}
+ dev: true
+
+ /local-pkg/0.4.3:
+ resolution: {integrity: sha512-SFppqq5p42fe2qcZQqqEOiVRXl+WCP1MdT6k7BDEW1j++sp5fIY+/fdRQitvKgB5BrBcmrs5m/L0v2FrU5MY1g==}
+ engines: {node: '>=14'}
+ dev: true
+
+ /locate-path/6.0.0:
+ resolution: {integrity: sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==}
+ engines: {node: '>=10'}
+ dependencies:
+ p-locate: 5.0.0
+ dev: true
+
+ /magic-string/0.30.0:
+ resolution: {integrity: sha512-LA+31JYDJLs82r2ScLrlz1GjSgu66ZV518eyWT+S8VhyQn/JL0u9MeBOvQMGYiPk1DBiSN9DDMOcXvigJZaViQ==}
+ engines: {node: '>=12'}
+ dependencies:
+ '@jridgewell/sourcemap-codec': 1.4.14
+ dev: true
+
+ /mdn-data/2.0.30:
+ resolution: {integrity: sha512-GaqWWShW4kv/G9IEucWScBx9G1/vsFZZJUO+tD26M8J8z3Kw5RDQjaoZe03YAClgeS/SWPOcb4nkFBTEi5DUEA==}
+ dev: true
+
+ /merge-stream/2.0.0:
+ resolution: {integrity: sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==}
+ dev: true
+
+ /merge2/1.4.1:
+ resolution: {integrity: sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==}
+ engines: {node: '>= 8'}
+ dev: true
+
+ /micromatch/4.0.5:
+ resolution: {integrity: sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA==}
+ engines: {node: '>=8.6'}
+ dependencies:
+ braces: 3.0.2
+ picomatch: 2.3.1
+ dev: true
+
+ /mimic-fn/2.1.0:
+ resolution: {integrity: sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==}
+ engines: {node: '>=6'}
+ dev: true
+
+ /mrmime/1.0.1:
+ resolution: {integrity: sha512-hzzEagAgDyoU1Q6yg5uI+AorQgdvMCur3FcKf7NhMKWsaYg+RnbTyHRa/9IlLF9rf455MOCtcqqrQQ83pPP7Uw==}
+ engines: {node: '>=10'}
+ dev: true
+
+ /ms/2.1.2:
+ resolution: {integrity: sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==}
+ dev: true
+
+ /node-fetch-native/1.0.2:
+ resolution: {integrity: sha512-KIkvH1jl6b3O7es/0ShyCgWLcfXxlBrLBbP3rOr23WArC66IMcU4DeZEeYEOwnopYhawLTn7/y+YtmASe8DFVQ==}
+ dev: true
+
+ /normalize-path/3.0.0:
+ resolution: {integrity: sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==}
+ engines: {node: '>=0.10.0'}
+ dev: true
+
+ /npm-run-path/4.0.1:
+ resolution: {integrity: sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw==}
+ engines: {node: '>=8'}
+ dependencies:
+ path-key: 3.1.1
+ dev: true
+
+ /ofetch/1.0.1:
+ resolution: {integrity: sha512-icBz2JYfEpt+wZz1FRoGcrMigjNKjzvufE26m9+yUiacRQRHwnNlGRPiDnW4op7WX/MR6aniwS8xw8jyVelF2g==}
+ dependencies:
+ destr: 1.2.2
+ node-fetch-native: 1.0.2
+ ufo: 1.1.0
+ dev: true
+
+ /onetime/5.1.2:
+ resolution: {integrity: sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==}
+ engines: {node: '>=6'}
+ dependencies:
+ mimic-fn: 2.1.0
+ dev: true
+
+ /p-limit/3.1.0:
+ resolution: {integrity: sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==}
+ engines: {node: '>=10'}
+ dependencies:
+ yocto-queue: 0.1.0
+ dev: true
+
+ /p-locate/5.0.0:
+ resolution: {integrity: sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==}
+ engines: {node: '>=10'}
+ dependencies:
+ p-limit: 3.1.0
+ dev: true
+
+ /path-exists/4.0.0:
+ resolution: {integrity: sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==}
+ engines: {node: '>=8'}
+ dev: true
+
+ /path-key/3.1.1:
+ resolution: {integrity: sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==}
+ engines: {node: '>=8'}
+ dev: true
+
+ /pathe/1.1.0:
+ resolution: {integrity: sha512-ODbEPR0KKHqECXW1GoxdDb+AZvULmXjVPy4rt+pGo2+TnjJTIPJQSVS6N63n8T2Ip+syHhbn52OewKicV0373w==}
+ dev: true
+
+ /perfect-debounce/0.1.3:
+ resolution: {integrity: sha512-NOT9AcKiDGpnV/HBhI22Str++XWcErO/bALvHCuhv33owZW/CjH8KAFLZDCmu3727sihe0wTxpDhyGc6M8qacQ==}
+ dev: true
+
+ /picomatch/2.3.1:
+ resolution: {integrity: sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==}
+ engines: {node: '>=8.6'}
+ dev: true
+
+ /queue-microtask/1.2.3:
+ resolution: {integrity: sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==}
+ dev: true
+
+ /readdirp/3.6.0:
+ resolution: {integrity: sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==}
+ engines: {node: '>=8.10.0'}
+ dependencies:
+ picomatch: 2.3.1
+ dev: true
+
+ /reusify/1.0.4:
+ resolution: {integrity: sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==}
+ engines: {iojs: '>=1.0.0', node: '>=0.10.0'}
+ dev: true
+
+ /run-parallel/1.2.0:
+ resolution: {integrity: sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==}
+ dependencies:
+ queue-microtask: 1.2.3
+ dev: true
+
+ /shebang-command/2.0.0:
+ resolution: {integrity: sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==}
+ engines: {node: '>=8'}
+ dependencies:
+ shebang-regex: 3.0.0
+ dev: true
+
+ /shebang-regex/3.0.0:
+ resolution: {integrity: sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==}
+ engines: {node: '>=8'}
+ dev: true
+
+ /signal-exit/3.0.7:
+ resolution: {integrity: sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==}
+ dev: true
+
+ /sirv/2.0.2:
+ resolution: {integrity: sha512-4Qog6aE29nIjAOKe/wowFTxOdmbEZKb+3tsLljaBRzJwtqto0BChD2zzH0LhgCSXiI+V7X+Y45v14wBZQ1TK3w==}
+ engines: {node: '>= 10'}
+ dependencies:
+ '@polka/url': 1.0.0-next.21
+ mrmime: 1.0.1
+ totalist: 3.0.0
+ dev: true
+
+ /source-map-js/1.0.2:
+ resolution: {integrity: sha512-R0XvVJ9WusLiqTCEiGCmICCMplcCkIwwR11mOSD9CR5u+IXYdiseeEuXCVAjS54zqwkLcPNnmU4OeJ6tUrWhDw==}
+ engines: {node: '>=0.10.0'}
+ dev: true
+
+ /strip-final-newline/2.0.0:
+ resolution: {integrity: sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA==}
+ engines: {node: '>=6'}
+ dev: true
+
+ /to-regex-range/5.0.1:
+ resolution: {integrity: sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==}
+ engines: {node: '>=8.0'}
+ dependencies:
+ is-number: 7.0.0
+ dev: true
+
+ /totalist/3.0.0:
+ resolution: {integrity: sha512-eM+pCBxXO/njtF7vdFsHuqb+ElbxqtI4r5EAvk6grfAFyJ6IvWlSkfZ5T9ozC6xWw3Fj1fGoSmrl0gUs46JVIw==}
+ engines: {node: '>=6'}
+ dev: true
+
+ /ufo/1.1.0:
+ resolution: {integrity: sha512-LQc2s/ZDMaCN3QLpa+uzHUOQ7SdV0qgv3VBXOolQGXTaaZpIur6PwUclF5nN2hNkiTRcUugXd1zFOW3FLJ135Q==}
+ dev: true
+
+ /unconfig/0.3.7:
+ resolution: {integrity: sha512-1589b7oGa8ILBYpta7TndM5mLHLzHUqBfhszeZxuUBrjO/RoQ52VGVWsS3w0C0GLNxO9RPmqkf6BmIvBApaRdA==}
+ dependencies:
+ '@antfu/utils': 0.5.2
+ defu: 6.1.2
+ jiti: 1.17.1
+ dev: true
+
+ /unocss/0.50.1:
+ resolution: {integrity: sha512-D21InhvOwWb2quWVTqVUDl1shDU87KEWc8OzpLztaLmRpOV0S6SFxCZmxA5sAUGaVNdTgHAbBU9o43ipete1Mw==}
+ engines: {node: '>=14'}
+ peerDependencies:
+ '@unocss/webpack': 0.50.1
+ peerDependenciesMeta:
+ '@unocss/webpack':
+ optional: true
+ dependencies:
+ '@unocss/astro': 0.50.1
+ '@unocss/cli': 0.50.1
+ '@unocss/core': 0.50.1
+ '@unocss/preset-attributify': 0.50.1
+ '@unocss/preset-icons': 0.50.1
+ '@unocss/preset-mini': 0.50.1
+ '@unocss/preset-tagify': 0.50.1
+ '@unocss/preset-typography': 0.50.1
+ '@unocss/preset-uno': 0.50.1
+ '@unocss/preset-web-fonts': 0.50.1
+ '@unocss/preset-wind': 0.50.1
+ '@unocss/reset': 0.50.1
+ '@unocss/transformer-attributify-jsx': 0.50.1
+ '@unocss/transformer-compile-class': 0.50.1
+ '@unocss/transformer-directives': 0.50.1
+ '@unocss/transformer-variant-group': 0.50.1
+ '@unocss/vite': 0.50.1
+ transitivePeerDependencies:
+ - rollup
+ - supports-color
+ - vite
+ dev: true
+
+ /which/2.0.2:
+ resolution: {integrity: sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==}
+ engines: {node: '>= 8'}
+ hasBin: true
+ dependencies:
+ isexe: 2.0.0
+ dev: true
+
+ /yocto-queue/0.1.0:
+ resolution: {integrity: sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==}
+ engines: {node: '>=10'}
+ dev: true
diff --git a/run-serve.sh b/run-serve.sh
new file mode 100755
index 0000000..618c0ae
--- /dev/null
+++ b/run-serve.sh
@@ -0,0 +1,3 @@
+#!/bin/sh
+npm run uno -- --watch &
+trunk serve
diff --git a/src/app.rs b/src/app.rs
new file mode 100644
index 0000000..91781b2
--- /dev/null
+++ b/src/app.rs
@@ -0,0 +1,186 @@
+use std::io::Cursor;
+use std::collections::HashMap;
+use std::rc::Rc;
+use gloo::console::console_dbg;
+use base64::encode;
+use gloo::file::callbacks::FileReader;
+use gloo::file::File;
+use gloo::storage::{LocalStorage, Storage};
+use web_sys::{DragEvent, Event, FileList, HtmlInputElement};
+use yew::html::TargetCast;
+use yew::{html, Callback, Component, Context, Html};
+
+use crate::magicdraw_parser::{parse_project, SQLTableCollection, SQLTable};
+use crate::components::sql_column_info::SQLTableColumnInfo;
+
+const COLLECTION_STORE_KEY: &str = "current_collection";
+
+pub enum Msg {
+ Noop,
+ Loaded(String, Vec),
+ UploadProject(File),
+}
+
+pub struct App {
+ active_readers: HashMap,
+ current_collection: Option>>
+}
+
+impl Component for App {
+ type Message = Msg;
+ type Properties = ();
+
+ fn create(_ctx: &Context) -> Self {
+ let mut current_collection = None;
+ if let Ok(collection) = LocalStorage::get::("current_collection") {
+ current_collection = Some(collection.tables.into_iter().map(Rc::new).collect());
+ }
+
+ Self {
+ active_readers: HashMap::default(),
+ current_collection
+ }
+ }
+
+ fn update(&mut self, ctx: &Context, msg: Self::Message) -> bool {
+ match msg {
+ Msg::Loaded(file_name, data) => {
+ if file_name.ends_with(".mdzip") {
+ let cursor = Cursor::new(&data);
+
+ let mut collections = parse_project(cursor).expect("oops");
+ if collections.len() >= 1 {
+ self.set_current_collection(Some(collections.remove(0)));
+ }
+ }
+
+ self.active_readers.remove(&file_name);
+ true
+ }
+ Msg::UploadProject(file) => {
+ let file_name = file.name();
+
+ let task = {
+ let link = ctx.link().clone();
+ let file_name = file_name.clone();
+
+ gloo::file::callbacks::read_as_bytes(&file, move |res| {
+ link.send_message(Msg::Loaded(
+ file_name,
+ res.expect("failed to read file"),
+ ))
+ })
+ };
+
+ self.active_readers.insert(file_name, task);
+ true
+ },
+ Msg::Noop => false
+ }
+ }
+
+ fn view(&self, ctx: &Context) -> Html {
+ let prevent_default_cb = Callback::from(|event: DragEvent| {
+ event.prevent_default();
+ });
+
+ html! {
+
+ { "🪄 MagicDraw SQL Data Generator" }
+
+
+ { "1. Upload " }
+ {".mdzip"}
+ { " project" }
+
+
+
+
{ "NOTE: This relies on the fact, that you have a .dll script configured" }
+
+ if let Some(collection) = &self.current_collection {
+
+
{ "2. Make sure everything looks 👌" }
+ // { Self::show_collection(collection) }
+ { Self::show_table(collection[0].clone()) }
+
+
+
{ 0 } { " / " } { collection.len() }
+
+
+
+
+
+
{ "3. Copy & Paste" }
+
+ }
+
+ }
+ }
+}
+
+impl App {
+ fn show_collection(collection: &SQLTableCollection) -> Html {
+ collection.tables.iter().map(|table| {
+ html! {
+
+ { &table.name }
+
+ }
+ }).collect()
+ }
+
+ fn show_table(table: Rc) -> Html {
+ html!{
+
+ }
+ }
+
+ fn upload_project(files: Option) -> Msg {
+ if let Some(files) = files {
+ let file = js_sys::try_iter(&files)
+ .unwrap()
+ .unwrap()
+ .next()
+ .map(|v| web_sys::File::from(v.unwrap()))
+ .map(File::from)
+ .unwrap();
+ Msg::UploadProject(file)
+ } else {
+ Msg::Noop
+ }
+ }
+
+ pub fn set_current_collection(&mut self, current_collection: Option) {
+ if let Some(collection) = current_collection {
+ LocalStorage::set(COLLECTION_STORE_KEY, &collection).unwrap();
+ self.current_collection = Some(collection.tables.into_iter().map(Rc::new).collect());
+ } else {
+ LocalStorage::delete(COLLECTION_STORE_KEY);
+ self.current_collection = None
+ }
+ }
+}
diff --git a/src/components/mod.rs b/src/components/mod.rs
new file mode 100644
index 0000000..fd0325c
--- /dev/null
+++ b/src/components/mod.rs
@@ -0,0 +1 @@
+pub mod sql_column_info;
diff --git a/src/components/sql_column_info.rs b/src/components/sql_column_info.rs
new file mode 100644
index 0000000..4e4fb5f
--- /dev/null
+++ b/src/components/sql_column_info.rs
@@ -0,0 +1,64 @@
+use std::rc::Rc;
+
+use yew::{Properties, html, function_component, Html};
+
+use crate::magicdraw_parser::SQLTable;
+
+#[derive(Properties, PartialEq)]
+pub struct SQLTableColumnInfoProps {
+ pub table: Rc
+}
+
+const CHECK_MARK: &str = "✔️";
+const CROSS_MARK: &str = "❌";
+
+fn bool_to_mark(value: bool) -> &'static str {
+ if value { CHECK_MARK } else { CROSS_MARK }
+}
+
+#[function_component]
+pub fn SQLTableColumnInfo(props: &SQLTableColumnInfoProps) -> Html {
+ let table = &props.table;
+
+ let rows = table.columns.iter()
+ .map(|col| {
+ let foreign_key;
+ if let Some((table_name, prop_name)) = &col.foreign_key {
+ foreign_key = format!("{} {}", table_name, prop_name);
+ } else {
+ foreign_key = CROSS_MARK.into();
+ }
+
+ html! {
+
+ { &col.name } |
+ { &col.sql_type } |
+ { bool_to_mark(col.primary_key) } |
+ { bool_to_mark(col.nullable) } |
+ { foreign_key } |
+
+ }
+ }
+ );
+
+ html!{
+
+
{ &table.name }
+
+
+ { "Column" } |
+ { "Type" } |
+ { "Primary?" } |
+ { "Nullable?" } |
+ { "Foreign key?" } |
+
+ { for rows }
+
+
+ }
+}
diff --git a/src/magicdraw_parser/mod.rs b/src/magicdraw_parser/mod.rs
index 08c7548..16d8a16 100644
--- a/src/magicdraw_parser/mod.rs
+++ b/src/magicdraw_parser/mod.rs
@@ -1,12 +1,10 @@
-#![allow(dead_code)]
-#![allow(unused_variables)]
-
mod utils;
mod uml_model_parser;
mod ddl_parser;
mod sql_types_parser;
+use serde::{Serialize, Deserialize};
-use std::{io::{Read, Seek}, collections::HashSet};
+use std::{io::{Read, Seek}, collections::HashSet, fmt::Display};
use anyhow::{Result, Context};
use lazy_regex::regex_captures;
use zip::ZipArchive;
@@ -15,7 +13,7 @@ use crate::unwrap_opt_continue;
use self::{uml_model_parser::{parse_uml_model, UMLModel, UMLClass, UMLModifier, UMLNullableModifier, UMLPrimaryKeyModifier, UMLTypeModifier, UMLForeignKeyModifier}, ddl_parser::parse_ddl_scripts, sql_types_parser::{parse_sql_types, SQLTypeName}};
-#[derive(Debug)]
+#[derive(Debug, PartialEq, Deserialize, Serialize)]
pub enum SQLType {
Int,
Decimal,
@@ -26,31 +24,45 @@ pub enum SQLType {
Varchar(u16),
}
-#[derive(Debug)]
+impl Display for SQLType {
+ fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
+ match self {
+ SQLType::Int => write!(f, "INT"),
+ SQLType::Decimal => write!(f, "DECIMAL"),
+ SQLType::Date => write!(f, "DATE"),
+ SQLType::Float => write!(f, "FLOAT"),
+ SQLType::Bool => write!(f, "BOOL"),
+ SQLType::Char(size) => write!(f, "CHAR({})", size),
+ SQLType::Varchar(size) => write!(f, "VARCHAR({})", size),
+ }
+ }
+}
+
+#[derive(Debug, PartialEq, Deserialize, Serialize)]
pub enum SQLCheckConstraint {
OneOf(Vec),
Freeform(String)
}
-#[derive(Debug)]
+#[derive(Debug, PartialEq, Deserialize, Serialize)]
pub struct SQLColumn {
- name: String,
- sql_type: SQLType,
- primary_key: bool,
- nullable: bool,
- foreign_key: Option<(String, String)>,
- check_constraint: Option
+ pub name: String,
+ pub sql_type: SQLType,
+ pub primary_key: bool,
+ pub nullable: bool,
+ pub foreign_key: Option<(String, String)>,
+ pub check_constraint: Option
}
-#[derive(Debug)]
+#[derive(Debug, PartialEq, Deserialize, Serialize)]
pub struct SQLTable {
- name: String,
- columns: Vec,
+ pub name: String,
+ pub columns: Vec,
}
-#[derive(Debug)]
+#[derive(Debug, PartialEq, Deserialize, Serialize)]
pub struct SQLTableCollection {
- tables: Vec
+ pub tables: Vec
}
fn find_class_by_id<'a>(models: &'a [UMLModel], id: &str) -> Option<&'a UMLClass> {
diff --git a/src/main.rs b/src/main.rs
index d06bdb6..e6cd1d6 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -1,29 +1,18 @@
-use magicdraw_parser::parse_project;
-use yew::prelude::*;
-use std::fs::File;
-use anyhow::Result;
+use app::App;
mod magicdraw_parser;
+mod app;
+mod components;
// TODO: Make this work with enumation lookup tables
+// TODO: Dark theme switch button
+// TODO: Fix double rebuilding when on "trunk server". uno css triggers second build.
+// TODO: Add simple versioning in frontend for data
-#[function_component]
-fn App() -> Html {
- html! {
-
-
- { "Hello World!" }
- { "from Yew with " }
-
- }
-}
-
-fn main() -> Result<()> {
- let f = File::open("example.mdzip").unwrap();
-
- let collections = parse_project(f)?;
- dbg!(collections);
-
- // yew::Renderer::::new().render();
- Ok(())
+fn main() {
+ // let f = File::open("example.mdzip").unwrap();
+ // let collections = parse_project(f)?;
+ // dbg!(collections);
+
+ yew::Renderer::::new().render();
}
diff --git a/static/.gitkeep b/static/.gitkeep
new file mode 100644
index 0000000..e69de29
diff --git a/styles.css b/styles.css
new file mode 100644
index 0000000..0d4dda5
--- /dev/null
+++ b/styles.css
@@ -0,0 +1,9 @@
+
+.table-column-info td,
+.table-column-info th {
+ padding: 0.5rem;
+}
+
+button {
+ border: 0
+}
diff --git a/unocss.config.js b/unocss.config.js
new file mode 100644
index 0000000..ebafe49
--- /dev/null
+++ b/unocss.config.js
@@ -0,0 +1,19 @@
+import { defineConfig, presetUno, presetIcons, presetAttributify } from 'unocss'
+
+export default defineConfig({
+ presets: [
+ presetAttributify({
+ }),
+ presetUno(),
+ presetIcons({
+ cdn: 'https://esm.sh/'
+ }),
+ ],
+ shortcuts: [
+ {
+ "btn-base": "rounded-0.5rem b-0.2rem pointer",
+ "btn-white": "btn-base text-dark100 bg-light500 hover-bg-light300 active-bg-light900",
+ "btn-emerald": "btn-base text-light100 bg-emerald600 hover-bg-emerald500 active-bg-emerald700"
+ }
+ ]
+})