Compare commits

44 Commits

Author SHA1 Message Date
Spxg c12cd6e01f deploy: abc16510c3 2025-12-07 13:11:21 +00:00
Spxg 4b0066c80a deploy: 39df7e7235 2025-11-30 16:30:26 +00:00
Spxg 36915d76cc deploy: c49c2f949c 2025-11-10 17:09:38 +00:00
Spxg 7bc0a248e5 deploy: e91b47bcf8 2025-10-23 16:26:15 +00:00
Spxg c54e2056b8 deploy: b31843509b 2025-09-29 14:23:35 +00:00
Spxg 3fc6db9559 deploy: 4f86a2f647 2025-09-24 15:59:41 +00:00
Spxg 45e33f7781 deploy: 9cf27bf27a 2025-08-03 12:10:41 +00:00
Spxg 763b92a20f deploy: 3ea88ffdfb 2025-07-20 17:09:24 +00:00
Spxg 8dc2647175 deploy: 609cc6d508 2025-07-06 09:48:52 +00:00
Spxg e021355678 deploy: 87197ea68a 2025-07-02 16:06:43 +00:00
Spxg 44f619acf3 deploy: e6832fbbfa 2025-06-10 13:33:28 +00:00
Spxg 5f6175bcf9 deploy: 8e9a5fd689 2025-06-05 14:30:16 +00:00
Spxg cbb5edb607 deploy: 2cf0cc0b04 2025-06-02 14:36:03 +00:00
Spxg 5cbae61a34 deploy: b531c05d40 2025-05-30 12:28:41 +00:00
Spxg a3206ee24d deploy: 99323c5706 2025-05-30 01:03:50 +00:00
Spxg 3906842afb deploy: aaf9a842b5 2025-05-29 18:33:53 +00:00
Spxg 99989d51cb deploy: 722a874bac 2025-05-29 15:06:59 +00:00
Spxg 67f177b343 deploy: 09d499d5a3 2025-05-29 14:49:56 +00:00
Spxg bab44f4518 deploy: 81561cb51d 2025-05-29 01:57:52 +00:00
Spxg ec4badd4d1 deploy: b3f51ff2b2 2025-05-28 15:35:06 +00:00
Spxg 73a2ce5422 deploy: 5f88554db9 2025-05-26 17:06:19 +00:00
Spxg 51f6c9bdfd deploy: 908fb127a1 2025-05-25 07:52:17 +00:00
Spxg 751d58846e deploy: 5a2bc95e23 2025-05-25 06:04:08 +00:00
Spxg 4cc8d37c31 deploy: 5109ba151e329b711de78140bc104c756c95f379 2025-05-25 05:54:14 +00:00
Spxg 01c52ec3f1 deploy: e9775581f5 2025-05-25 05:41:29 +00:00
Spxg 7ca97206b8 deploy: c344645244 2025-05-21 18:00:00 +00:00
Spxg 22899ba17b deploy: 9e4e6a1445 2025-05-21 17:35:15 +00:00
Spxg dd13b1c3c7 deploy: 097133d749 2025-05-21 17:30:29 +00:00
Spxg a91ad7e597 deploy: 50e620ba38 2025-05-21 15:56:42 +00:00
Spxg 9a7daa3fb3 deploy: 746e30f6a7 2025-05-19 13:25:01 +00:00
Spxg ac83cbe26b Update CNAME 2025-05-19 21:14:40 +08:00
Spxg c755fa76b4 deploy: a5f6396497 2025-05-18 13:27:19 +00:00
Spxg 160da88147 deploy: d0c7cbc980 2025-05-18 12:57:23 +00:00
Spxg e70dc232a8 deploy: 65742e09a3 2025-05-18 10:07:40 +00:00
Spxg c264a48bec deploy: 16196f0797 2025-05-18 09:33:45 +00:00
Spxg 0eda2579ef deploy: 76dc7b8af4 2025-05-18 09:14:10 +00:00
Spxg 1d03a057e6 deploy: 2d6390e562 2025-05-18 09:08:38 +00:00
Spxg 245a1c3005 deploy: e84d5af619 2025-05-17 18:12:34 +00:00
Spxg 3346beed5d deploy: e6d17b1b54 2025-05-17 17:03:59 +00:00
Spxg 2931bb4b27 deploy: 06110db136 2025-05-17 16:11:09 +00:00
Spxg 706939cd6d deploy: 52f7a53e41 2025-05-17 15:20:15 +00:00
Spxg 56e22eb4f4 deploy: 5d528f6320 2025-05-17 04:28:45 +00:00
Spxg 9a3b12d0c2 Create CNAME 2025-05-17 11:28:25 +08:00
Spxg c4b911218f deploy: aa793399bb 2025-05-17 03:18:55 +00:00
104 changed files with 3425 additions and 11795 deletions
-45
View File
@@ -1,45 +0,0 @@
name: Pages
on:
workflow_dispatch:
permissions:
contents: write
concurrency: pages
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 22
- run: npm install
- run: npx postcss --dir assets/module.postcss assets/module.css --base assets/module.css
- name: List postcss
run: |
ls assets/module.postcss
- uses: cargo-bins/cargo-binstall@main
- run: cargo binstall trunk
- name: Build
run: |
git clone https://github.com/emscripten-core/emsdk.git
cd emsdk
./emsdk install latest
./emsdk activate latest
source ./emsdk_env.sh
cd ..
trunk build --release
- name: Deploy
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./dist
cname: sqlight.dev
-5
View File
@@ -1,5 +0,0 @@
/target
node_modules
.DS_Store
dist
assets/module.postcss
View File
+1
View File
@@ -0,0 +1 @@
sqlight.dev
Generated
-2563
View File
File diff suppressed because it is too large Load Diff
-49
View File
@@ -1,49 +0,0 @@
[package]
name = "sqlight"
version = "0.1.0"
edition = "2024"
[workspace]
resolver = "2"
members = [
"crates/aceditor",
"crates/floating-ui",
"crates/istyles",
"crates/split-grid"
]
[dependencies]
istyles = { path = "crates/istyles" }
aceditor = { path = "crates/aceditor" }
split-grid = { path = "crates/split-grid" }
floating-ui = { path = "crates/floating-ui" }
console_error_panic_hook = "0.1.7"
leptos = { version = "0.8.2", features = ["csr"] }
reactive_stores = "0.2.2"
thiserror = "2.0.12"
serde = "1.0.219"
serde_json = "1.0.140"
web-sys = { version = "0.3.77", features = ["BlobPropertyBag", "Clipboard", "DedicatedWorkerGlobalScope", "DomException", "File", "FileList", "HtmlSelectElement", "MediaQueryList", "Navigator", "Storage", "Worker", "WorkerOptions", "WorkerType"] }
serde-wasm-bindgen = "0.6.5"
parking_lot = "0.12.3"
once_cell = "1.21.3"
tokio = { version = "1.45.0", features = ["sync"] }
wasm-bindgen = "0.2.104"
js-sys = "0.3.81"
wasm-bindgen-futures = "0.4.54"
console_log = "1.0.0"
log = "0.4.27"
fragile = "2.0.1"
hex = "0.4.3"
prettytable-rs = "0.10.0"
sqlformat = "0.3.5"
sqlite-wasm-vec = "0.1.1"
sqlite-wasm-vfs = "0.1.0"
sqlite-wasm-rs = { version = "0.5.0", default-features = false }
[features]
default = ["sqlite3"]
sqlite3 = []
sqlite3mc = ["sqlite-wasm-rs/sqlite3mc"]
-21
View File
@@ -1,21 +0,0 @@
MIT License
Copyright (c) 2025 Spxg
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
-33
View File
@@ -1,33 +0,0 @@
# SQLight
A SQLite Playground that runs completely locally.
## How it works
Run SQLite as wasm in the browser using [`sqlite-wasm-rs`](https://github.com/Spxg/sqlite-wasm-rs).
## About UI
Users who have used [rust playground](https://play.rust-lang.org) will feel very familiar.
Because the layout and component design are derived from it, but rewritten using [leptos](https://leptos.dev).
## Extensions Supported
|Extension|About|
|-|-|
|[sqlite-vec](https://crates.io/crates/sqlite-wasm-vec)|A vector search SQLite extension that runs anywhere!|
## Local deployment
```sh
npm install
npx postcss --dir assets/module.postcss assets/module.css --base assets/module.css
# Choose your preferred installation method
# https://trunkrs.dev/#install
cargo install trunk --locked
# The product is in the dist folder
trunk build --release
```
File diff suppressed because it is too large Load Diff
Binary file not shown.
@@ -1,38 +0,0 @@
.-buttonReset {
color: var(--font-color);
border: none;
background: inherit;
background-color: transparent; /* IE 11 */
padding: 0;
font: inherit;
line-height: inherit;
text-align: inherit;
}
.-menuItemFullButton {
composes: -buttonReset;
transition: color var(--header-transition);
width: 100%;
user-select: text;
}
.container {
composes: -menuItemFullButton;
&:hover {
color: var(--header-tint);
}
}
.-menuItemTitle {
font-weight: 600;
}
.name {
composes: -menuItemTitle;
margin: 0;
}
.description {
margin: 0;
}
-135
View File
@@ -1,135 +0,0 @@
$width: 1px;
$radius: 4px;
.-buttonReset {
color: var(--font-color);
border: none;
background: inherit;
background-color: transparent; /* IE 11 */
padding: 0;
font: inherit;
line-height: inherit;
text-align: inherit;
}
.set {
display: flex;
}
.-border {
border-width: $width 0;
border-style: solid;
&:first-child {
border-top-left-radius: $radius;
border-bottom-left-radius: $radius;
border-left-width: $width;
}
&:last-child {
border-top-right-radius: $radius;
border-bottom-right-radius: $radius;
border-right-width: $width;
}
}
.-button {
--button-gap: 0.5em;
--button-side-padding: 1.25em;
--button-height: 3em;
--button-side-icon-nudge: 0.25em;
composes: -buttonReset;
display: grid;
grid-auto-flow: column;
gap: var(--button-gap);
align-content: center;
align-items: center;
padding: 0 var(--button-side-padding);
height: var(--button-height);
font-weight: 600;
text-decoration: none;
text-transform: uppercase;
white-space: nowrap;
&:enabled {
cursor: pointer;
}
}
.small {
--button-gap: 0.25em;
--button-side-padding: 0.75em;
--button-height: 2.5em;
--button-side-icon-nudge: 0.125em;
}
.primary {
composes: -border -button;
background-color: var(--button-primary-bg-color);
border-color: var(--button-primary-border-color);
color: var(--button-primary-color);
font-weight: 700;
&:disabled {
background-color: var(--button-primary-bg-color-light);
border-color: var(--button-primary-border-color-light);
}
&:hover:enabled {
background-color: var(--button-primary-border-color);
}
&:active:enabled {
box-shadow: inset 0 0 5px var(--button-primary-active-color);
}
}
.secondary {
composes: -border -button;
background: var(--button-secondary-bg-color);
border-color: var(--button-secondary-border-color);
color: var(--button-secondary-color);
&:disabled {
background: inherit;
background-color: var(--button-secondary-bg-color-light);
border-color: var(--button-secondary-border-color-light);
color: var(--button-secondary-color-light);
}
&:visited {
color: var(--button-secondary-color);
}
&:hover:enabled {
background: inherit;
background-color: var(--button-secondary-border-color);
}
&:active:enabled {
box-shadow: inset 0 0 5px var(--button-secondary-active-color);
}
}
.iconLeft {
transform: translate(calc(-1 * var(--button-side-icon-nudge)), 0);
}
.iconRight {
transform: translate(var(--button-side-icon-nudge), 0);
}
.rule {
composes: -border;
background-color: var(--button-secondary-border-color);
width: 1px;
border-color: var(--button-secondary-border-color);
}
.icon {
composes: secondary;
padding: 0;
aspect-ratio: 1/1;
justify-items: center;
}
@@ -1,75 +0,0 @@
.container {
display: flex;
align-items: center;
}
.name {
flex: 1;
}
.notDefault {
composes: name;
color: var(--header-tint);
font-weight: 600;
}
.value {
flex: 1;
}
.select {
width: 100%;
background: var(--button-secondary-bg-color);
border-color: var(--button-secondary-border-color);
color: var(--button-secondary-color);
& option {
background-color: var(--button-secondary-bg-color-top);
border-color: var(--button-secondary-border-color);
color: var(--button-secondary-color);
}
}
.toggle {
display: flex;
& label {
$border: 1px solid #bbb;
flex: 1;
cursor: pointer;
border: $border;
border-right-width: 0;
border-top-left-radius: var(--header-border-radius);
border-bottom-left-radius: var(--header-border-radius);
padding: 0 1em;
color: #777;
font-weight: 600;
text-align: center;
text-transform: uppercase;
& ~ label {
border-left: $border;
border-right-width: 1px;
border-radius: 0 var(--header-border-radius) var(--header-border-radius) 0;
}
&:hover {
background: hsl(208deg 100% 43% / 10%);
}
}
& input {
display: none;
&:checked + label {
border-color: var(--header-tint);
background: var(--header-tint);
color: #fff;
& ~ label {
border-left-width: 0;
}
}
}
}
-42
View File
@@ -1,42 +0,0 @@
.-autoSize {
width: 100%;
min-width: 0;
height: 100%;
min-height: 0;
}
.-bodyMonospace {
font-size: inherit;
line-height: 1.25;
/* http://code.stephenmorley.org/html-and-css/fixing-browsers-broken-monospace-font-handling/
* ACE uses Monaco, Menlo, "Ubuntu Mono", Consolas, source-code-pro, monospace;
*/
font-family: 'Source Code Pro', monospace;
font-optical-sizing: auto;
}
.container {
composes: -autoSize;
position: relative;
}
.-advanced {
composes: -bodyMonospace -autoSize;
position: absolute;
}
.ace {
composes: -advanced;
}
.monaco {
composes: -advanced;
}
.simple {
composes: -advanced;
border: none;
color: inherit;
background-color: inherit;
}
-12
View File
@@ -1,12 +0,0 @@
.container,
.left,
.right {
display: flex;
gap: 0.5em;
}
.container {
font-size: var(--secondary-font-size);
padding: 1.25em 0;
justify-content: space-between;
}
-4
View File
@@ -1,4 +0,0 @@
.icon {
fill: currentcolor;
display: block;
}
-231
View File
@@ -1,231 +0,0 @@
/* Non-theme variables */
:root {
/* Fonts */
--primary-font: 'Open Sans', sans-serif;
--primary-font-size: 18px;
--secondary-font-size: calc(0.75 * var(--primary-font-size));
/* Header */
--header-transition: 0.2s ease-in-out;
--header-border-radius: 4px;
/* Border */
--border: 1px solid var(--border-color);
}
@define-mixin light-theme-vars {
--positive-luminance: white;
--negative-luminance: black;
/* Fonts */
--font-color: #444;
--font-color-high-contrast: var(--negative-luminance);
/* Links */
--link-color: #00e;
--link-color-visited: #551a8b;
/* Background */
--background-color: #e1e1db;
--background-color-high-contrast: var(--positive-luminance);
/* Code */
--code-background-color: #eee;
/* Border */
--border-color: #bbb;
/* Header */
--header-link-color: var(--negative-luminance);
--header-main-border: #dedede;
--header-tint: #428bca;
--header-accent-border: #bdbdbd;
/* The big red button */
--button-primary-color: var(--positive-luminance);
--button-primary-bg-color: #a42;
--button-primary-border-color: #80331a;
--button-primary-bg-color-light: color-mix(
in hsl,
var(--button-primary-bg-color),
var(--positive-luminance)
);
--button-primary-border-color-light: color-mix(
in hsl,
var(--button-primary-border-color),
var(--positive-luminance)
);
/* Clicked */
--button-primary-active-color: color-mix(
in hsl,
var(--positive-luminance),
var(--negative-luminance) 30%
);
/* Not the big red button */
--button-secondary-color: #444;
--button-secondary-bg-color-top: #fff;
--button-secondary-bg-color-bottom: #f9f9f9;
--button-secondary-bg-color: linear-gradient(
to bottom,
var(--button-secondary-bg-color-top),
var(--button-secondary-bg-color-bottom)
);
--button-secondary-border-color: color-mix(
in hsl,
var(--button-secondary-bg-color-bottom),
var(--negative-luminance) 20%
);
/* Disabled */
--button-secondary-bg-color-light: color-mix(
in hsl,
var(--button-secondary-bg-color-bottom),
var(--positive-luminance)
);
--button-secondary-border-color-light: color-mix(
in hsl,
var(--button-secondary-border-color),
var(--positive-luminance)
);
--button-secondary-color-light: color-mix(
in hsl,
var(--button-secondary-color),
var(--positive-luminance)
);
/* Clicked */
--button-secondary-active-color: color-mix(
in hsl,
var(--negative-luminance),
var(--positive-luminance) 30%
);
/* Output tabs */
--output-background-tab: #fcfcfc;
--output-current-tab: #f9ffff;
/* Output compiler highlighting */
--output-highlight-warning-color: #f79a06;
--output-highlight-warning-bg-color: inherit;
--output-highlight-error-color: #bf1b1b;
--output-highlight-error-bg-color: inherit;
}
@define-mixin dark-theme-vars {
--positive-luminance: black;
--negative-luminance: white;
/* Fonts */
--font-color: #dcdbd8;
--font-color-high-contrast: #dcdbd8;
/* Links */
--link-color: #b2dcff;
--link-color-visited: #eecaff;
/* Background */
--background-color: #444;
--background-color-high-contrast: #181818;
/* Code */
--code-background-color: #3c3c3c;
/* Border */
--border-color: #5e5e5e;
/* Header */
--header-main-border: #363b3d;
--header-accent-border: #bdbdbd;
/* The big red button */
--button-primary-color: #dcdbd8;
--button-primary-bg-color: #5d2310;
--button-primary-border-color: #612714;
/* Not the big red button */
--button-secondary-color: #dcdbd8;
--button-secondary-bg-color-top: #17191a;
--button-secondary-bg-color-bottom: #1a1c1d;
--button-secondary-border-color: color-mix(
in hsl,
var(--button-secondary-bg-color-bottom),
var(--negative-luminance) 40%
);
/* Output tabs */
--output-background-tab: #343434;
--output-current-tab: #191b1c;
/* Output compiler highlighting */
--output-highlight-warning-color: #ffe800;
--output-highlight-warning-bg-color: #330;
--output-highlight-error-color: #f5f5f5;
--output-highlight-error-bg-color: #820000;
}
:root,
[data-theme='light']:root {
@mixin light-theme-vars;
}
@media (prefers-color-scheme: dark) {
:root {
@mixin dark-theme-vars;
}
}
[data-theme='dark']:root {
@mixin dark-theme-vars;
}
/* Modify normalized styles */
button,
input,
optgroup,
select,
textarea {
font-family: var(--primary-font);
font-optical-sizing: auto;
}
html {
box-sizing: border-box;
}
a {
color: var(--link-color);
}
a:visited {
color: var(--link-color-visited);
}
*,
*::before,
*::after {
box-sizing: inherit;
}
body {
color: var(--font-color);
background-color: var(--background-color);
padding: 0 1em;
font-family: var(--primary-font);
font-optical-sizing: auto;
font-size: var(--primary-font-size);
}
/* stylelint-disable-next-line selector-class-pattern */
:global(.language-rust_errors) {
& :global(.warning) {
color: var(--output-highlight-warning-color);
background-color: var(--output-highlight-warning-bg-color);
}
& :global(.error) {
color: var(--output-highlight-error-color);
background-color: var(--output-highlight-error-bg-color);
}
}
-23
View File
@@ -1,23 +0,0 @@
@keyframes loader-fade {
0% {
opacity: 0;
}
75% {
opacity: 1;
}
}
.dot {
opacity: 0;
animation: loader-fade 1s;
animation-iteration-count: infinite;
&:nth-child(2) {
animation-delay: 0.2s;
}
&:nth-child(3) {
animation-delay: 0.4s;
}
}
-4
View File
@@ -1,4 +0,0 @@
.aside {
margin: 0.25em 0 0;
color: #888;
}
-22
View File
@@ -1,22 +0,0 @@
.container {
padding: 0.75em 1em 0;
width: 27em;
line-height: normal;
&:last-child {
padding-bottom: 0.75em;
}
}
.title {
margin: 0;
border-bottom: 1px solid var(--header-main-border);
padding-bottom: 10px;
font-weight: 700;
font-size: var(--secondary-font-size);
text-transform: uppercase;
}
.content {
padding: 1em 0.25em;
}
-7
View File
@@ -1,7 +0,0 @@
.container {
margin-bottom: 1em;
&:last-child {
margin-bottom: 0;
}
}
-53
View File
@@ -1,53 +0,0 @@
.container {
display: flex;
flex-direction: column;
width: 100%;
height: 100%;
}
.tabs {
display: flex;
}
.tab {
color: var(--font-color);
flex: 1 1 auto;
cursor: pointer;
border: var(--border);
border-right: none;
background-color: var(--output-background-tab);
line-height: 1.5;
&:last-of-type {
border-right: var(--border);
}
}
.tabSelected {
composes: tab;
cursor: default;
border-bottom: none;
background-color: var(--output-current-tab);
&:focus {
outline: none;
}
}
.tabClose {
composes: tab;
flex: 0 0 auto;
}
.body {
border: var(--border);
border-top: none;
background-color: var(--output-current-tab);
padding: 0.5em;
height: 100%;
overflow: scroll;
}
.stdin {
margin-top: 0.25em;
}
@@ -1,32 +0,0 @@
.-buttonReset {
color: var(--font-color);
border: none;
background: inherit;
background-color: transparent; /* IE 11 */
padding: 0;
font: inherit;
line-height: inherit;
text-align: inherit;
}
.-buttonAsLink {
composes: -buttonReset;
cursor: pointer;
color: var(--link-color);
user-select: text;
text-decoration: underline;
}
.addMain {
composes: -buttonAsLink;
}
.table {
border-collapse: collapse;
}
.tdAndTh {
border: 1px solid #dddddd;
text-align: left;
padding: 8px;
}
@@ -1,21 +0,0 @@
.container {
display: flex;
color: var(--font-color);
white-space: nowrap;
&::before,
&::after {
flex: 1 1 auto;
margin: auto;
border-top: var(--border);
content: '';
}
&::before {
margin-right: 2%;
}
&::after {
margin-left: 2%;
}
}
@@ -1,14 +0,0 @@
.-bodyMonospace {
font-size: inherit;
line-height: 1.25;
/* http://code.stephenmorley.org/html-and-css/fixing-browsers-broken-monospace-font-handling/
* ACE uses Monaco, Menlo, "Ubuntu Mono", Consolas, source-code-pro, monospace;
*/
font-family: 'Source Code Pro', monospace;
font-optical-sizing: auto;
}
.code {
composes: -bodyMonospace;
}
-51
View File
@@ -1,51 +0,0 @@
.-buttonReset {
color: var(--font-color);
border: none;
background: inherit;
background-color: transparent; /* IE 11 */
padding: 0;
font: inherit;
line-height: inherit;
text-align: inherit;
}
.container {
display: flex;
--copied-duration: 1s ease-in-out;
}
.button {
composes: -buttonReset;
transition: color var(--copied-duration);
cursor: pointer;
margin: 0 0.25em 0 0.5em;
}
.text {
visibility: hidden;
opacity: 0;
transition:
visibility var(--copied-duration),
opacity var(--copied-duration),
color var(--copied-duration);
}
.active {
composes: container;
& .button {
transition: color 0s;
color: green;
}
& .text {
visibility: visible;
opacity: 1;
transition:
visibility 0s,
opacity 0s,
color 0s;
color: green;
}
}
-69
View File
@@ -1,69 +0,0 @@
.-autoSize {
width: 100%;
min-width: 0;
height: 100%;
min-height: 0;
}
.container {
display: flex;
flex-direction: column;
padding-bottom: 1em;
height: 100vh;
}
.-resizeableArea {
composes: -autoSize;
display: grid;
}
.resizeableAreaRowOutputUnfocused {
composes: -resizeableArea;
grid-template-rows: 1fr auto;
}
.resizeableAreaRowOutputFocused {
composes: -resizeableArea;
grid-template-rows: 1fr 12px 1fr;
}
.resizeableAreaColumnOutputUnfocused {
composes: -resizeableArea;
grid-template-columns: 1fr auto;
}
.resizeableAreaColumnOutputFocused {
composes: -resizeableArea;
grid-template-columns: 1fr 12px 1fr;
}
.-gutter {
display: flex;
justify-content: center;
align-items: center;
}
.splitRowsGutter {
composes: -gutter;
cursor: row-resize;
}
.splitRowsGutterHandle {
transform: rotate(90deg);
pointer-events: none;
}
.splitColumnsGutter {
composes: -gutter;
cursor: col-resize;
}
.editor {
composes: -autoSize;
border: 4px solid var(--border-color);
border-radius: 4px;
}
.output {
composes: -autoSize;
}
-35
View File
@@ -1,35 +0,0 @@
$arrow-height: 10px;
$arrow-width: 20px;
.container {
z-index: 10;
font-size: var(--secondary-font-size);
& button:enabled {
cursor: pointer;
}
}
.arrow {
fill: var(--background-color-high-contrast);
}
.-content {
margin: $arrow-height;
box-shadow:
5px 5px 20px -3px rgb(0 0 0 / 25%),
0 0 5px -2px rgb(0 0 0 / 90%);
border-radius: var(--header-border-radius);
background: var(--background-color-high-contrast);
color: var(--font-color);
}
.contentBottom {
composes: -content;
margin-top: 0;
}
.contentTop {
composes: -content;
margin-bottom: 0;
}
@@ -1,64 +0,0 @@
.-buttonReset {
color: var(--font-color);
border: none;
background: inherit;
background-color: transparent; /* IE 11 */
padding: 0;
font: inherit;
line-height: inherit;
text-align: inherit;
}
.-menuItemFullButton {
composes: -buttonReset;
transition: color var(--header-transition);
width: 100%;
user-select: text;
}
.-menuItemTitle {
font-weight: 600;
}
.container {
composes: -menuItemFullButton;
&:hover {
color: var(--header-tint);
}
}
.selected {
composes: container;
color: var(--header-tint);
font-weight: 600;
}
.header {
display: flex;
align-items: center;
}
.name {
composes: -menuItemTitle;
}
.description {
padding-left: 2em;
}
.checkmark {
opacity: 0;
transition: opacity 0.15s ease-in-out;
margin-right: 0.5em;
}
.selected .checkmark,
.selected:hover .checkmark {
opacity: 1;
}
.container:hover .checkmark {
opacity: 0.5;
color: var(--header-tint);
}
-47
View File
@@ -1,47 +0,0 @@
.-bodyMonospace {
font-size: inherit;
line-height: 1.25;
/* http://code.stephenmorley.org/html-and-css/fixing-browsers-broken-monospace-font-handling/
* ACE uses Monaco, Menlo, "Ubuntu Mono", Consolas, source-code-pro, monospace;
*/
font-family: 'Source Code Pro', monospace;
font-optical-sizing: auto;
}
.-autoSize {
width: 100%;
min-width: 0;
height: 100%;
min-height: 0;
}
.-buttonReset {
color: var(--font-color);
border: none;
background: inherit;
background-color: transparent; /* IE 11 */
padding: 0;
font: inherit;
line-height: inherit;
text-align: inherit;
}
.-buttonAsLink {
composes: -buttonReset;
cursor: pointer;
color: var(--link-color);
user-select: text;
text-decoration: underline;
}
.-menuItemTitle {
font-weight: 600;
}
.-menuItemFullButton {
composes: -buttonReset;
transition: color var(--header-transition);
width: 100%;
user-select: text;
}
@@ -0,0 +1 @@
._-buttonReset_1jgi6_1{background:inherit;background-color:transparent;border:none;color:var(--font-color);font:inherit;line-height:inherit;padding:0;text-align:inherit}._-menuItemFullButton_1jgi6_12{transition:color var(--header-transition);-webkit-user-select:text;-moz-user-select:text;user-select:text;width:100%}._container_1jgi6_19:hover{color:var(--header-tint)}._-menuItemTitle_1jgi6_27{font-weight:600}._description_1jgi6_36,._name_1jgi6_31{margin:0}
+1
View File
@@ -0,0 +1 @@
._-buttonReset_14uvt_4{background:inherit;background-color:transparent;border:none;color:var(--font-color);font:inherit;line-height:inherit;padding:0;text-align:inherit}._set_14uvt_15{display:flex}._-border_14uvt_19{border-style:solid;border-width:1px 0}._-border_14uvt_19:first-child{border-bottom-left-radius:4px;border-left-width:1px;border-top-left-radius:4px}._-border_14uvt_19:last-child{border-bottom-right-radius:4px;border-right-width:1px;border-top-right-radius:4px}._-button_14uvt_4{--button-gap:0.5em;--button-side-padding:1.25em;--button-height:3em;--button-side-icon-nudge:0.25em;display:grid;grid-auto-flow:column;grid-gap:.5em;grid-gap:var(--button-gap);align-content:center;align-items:center;font-weight:600;gap:.5em;gap:var(--button-gap);height:3em;height:var(--button-height);padding:0 1.25em;padding:0 var(--button-side-padding);-webkit-text-decoration:none;text-decoration:none;text-transform:uppercase;white-space:nowrap}._-button_14uvt_4:enabled{cursor:pointer}._small_14uvt_60{--button-gap:0.25em;--button-side-padding:0.75em;--button-height:2.5em;--button-side-icon-nudge:0.125em}._primary_14uvt_67{background-color:var(--button-primary-bg-color);border-color:var(--button-primary-border-color);color:var(--button-primary-color);font-weight:700}._primary_14uvt_67:disabled{background-color:var(--button-primary-bg-color-light);border-color:var(--button-primary-border-color-light)}._primary_14uvt_67:hover:enabled{background-color:var(--button-primary-border-color)}._primary_14uvt_67:active:enabled{box-shadow:inset 0 0 5px var(--button-primary-active-color)}._secondary_14uvt_88{background:var(--button-secondary-bg-color);border-color:var(--button-secondary-border-color);color:var(--button-secondary-color)}._secondary_14uvt_88:disabled{background:inherit;background-color:var(--button-secondary-bg-color-light);border-color:var(--button-secondary-border-color-light);color:var(--button-secondary-color-light)}._secondary_14uvt_88:visited{color:var(--button-secondary-color)}._secondary_14uvt_88:hover:enabled{background:inherit;background-color:var(--button-secondary-border-color)}._secondary_14uvt_88:active:enabled{box-shadow:inset 0 0 5px var(--button-secondary-active-color)}._iconLeft_14uvt_115{transform:translate(calc(var(--button-side-icon-nudge)*-1))}._iconRight_14uvt_119{transform:translate(var(--button-side-icon-nudge))}._rule_14uvt_123{background-color:var(--button-secondary-border-color);border-color:var(--button-secondary-border-color);width:1px}._icon_14uvt_115{aspect-ratio:1/1;justify-items:center;padding:0}
@@ -0,0 +1 @@
._container_e4oy5_1{align-items:center;display:flex}._name_e4oy5_6{flex:1}._notDefault_e4oy5_10{color:var(--header-tint);font-weight:600}._value_e4oy5_16{flex:1}._select_e4oy5_20{background:var(--button-secondary-bg-color);width:100%}._select_e4oy5_20,._select_e4oy5_20 option{border-color:var(--button-secondary-border-color);color:var(--button-secondary-color)}._select_e4oy5_20 option{background-color:var(--button-secondary-bg-color-top)}._toggle_e4oy5_33{display:flex}._toggle_e4oy5_33 label{border:1px solid #bbb;border-bottom-left-radius:var(--header-border-radius);border-right-width:0;border-top-left-radius:var(--header-border-radius);color:#777;cursor:pointer;flex:1;font-weight:600;padding:0 1em;text-align:center;text-transform:uppercase}._toggle_e4oy5_33 label~label{border-left:1px solid #bbb;border-radius:0 var(--header-border-radius) var(--header-border-radius) 0;border-right-width:1px}._toggle_e4oy5_33 label:hover{background:rgba(0,117,219,.1)}._toggle_e4oy5_33 input{display:none}._toggle_e4oy5_33 input:checked+label{background:var(--header-tint);border-color:var(--header-tint);color:#fff}._toggle_e4oy5_33 input:checked+label~label{border-left-width:0}
-12
View File
@@ -1,12 +0,0 @@
[package]
name = "aceditor"
version = "0.1.0"
edition = "2024"
[dependencies]
js-sys = "0.3.77"
serde = { version = "1.0.219", features = ["derive"] }
serde-wasm-bindgen = "0.6.5"
thiserror = "2.0.12"
wasm-bindgen = "0.2.100"
web-sys = { version = "0.3.77", features = ["HtmlElement"] }
-289
View File
@@ -1,289 +0,0 @@
use js_sys::{Object, Reflect};
use serde::{Deserialize, Serialize};
use wasm_bindgen::{JsCast, JsValue, prelude::Closure};
// <https://ajaxorg.github.io/ace-api-docs/index.html>
mod bindgen {
use js_sys::Object;
use wasm_bindgen::{JsValue, prelude::wasm_bindgen};
#[wasm_bindgen]
extern "C" {
#[wasm_bindgen(js_namespace = ace, js_name = edit, catch)]
pub fn edit(element: &str, options: Option<Object>) -> Result<Editor, JsValue>;
#[wasm_bindgen(js_namespace = ace, js_name = require, catch)]
pub fn require(module: &str) -> Result<JsValue, JsValue>;
}
#[wasm_bindgen]
extern "C" {
pub type Editor;
#[wasm_bindgen(method, js_name = setTheme, catch)]
pub fn set_theme(this: &Editor, theme: &str) -> Result<(), JsValue>;
#[wasm_bindgen(method, js_name = setKeyboardHandler, catch)]
pub fn set_keyboard_handler(this: &Editor, handler: JsValue) -> Result<(), JsValue>;
#[wasm_bindgen(method, js_name = getValue)]
pub fn get_value(this: &Editor) -> String;
#[wasm_bindgen(method, js_name = clearSelection)]
pub fn clear_selection(this: &Editor);
#[wasm_bindgen(method, js_name = setValue)]
pub fn set_value(this: &Editor, value: String);
#[wasm_bindgen(method, js_name = getSession)]
pub fn get_session(this: &Editor) -> EditSession;
#[wasm_bindgen(method, js_name = getSelection)]
pub fn get_selection(this: &Editor) -> Selection;
#[wasm_bindgen(method, js_name = getSelectedText)]
pub fn get_selected_text(this: &Editor) -> String;
#[wasm_bindgen(method, js_name = setReadOnly)]
pub fn set_read_only(this: &Editor, value: bool);
}
#[wasm_bindgen]
extern "C" {
pub type Selection;
#[wasm_bindgen(method, js_name = getRange)]
pub fn get_range(this: &Selection) -> JsValue;
}
#[wasm_bindgen]
extern "C" {
pub type EditSession;
#[wasm_bindgen(method, js_name = setValue)]
pub fn set_value(this: &EditSession, value: String);
#[wasm_bindgen(method, js_name = getLength)]
pub fn get_length(this: &EditSession) -> usize;
#[wasm_bindgen(method, js_name = getTextRange)]
pub fn get_text_range(this: &EditSession, range: JsValue) -> String;
#[wasm_bindgen(method, js_name = getLine)]
pub fn get_line(this: &EditSession, row: usize) -> String;
}
#[wasm_bindgen]
extern "C" {
pub type CommandManager;
#[wasm_bindgen(method, js_name = addCommand)]
pub fn add_command(this: &CommandManager, command: JsValue);
}
}
type Result<T> = std::result::Result<T, EditorError>;
#[derive(Default, Serialize, Deserialize)]
pub struct EditorOptionsBuilder(EditorOptions);
impl EditorOptionsBuilder {
pub fn mode(mut self, value: &str) -> Self {
self.0.mode = value.into();
self
}
pub fn theme(mut self, value: &str) -> Self {
self.0.theme = value.into();
self
}
pub fn keyboard(mut self, value: Option<&str>) -> Self {
let value = if let Some(value) = value {
JsValue::from(value)
} else {
JsValue::null()
};
self.0.keyboard_handler = value;
self
}
pub fn value(mut self, value: &str) -> Self {
self.0.value = value.into();
self
}
pub fn build(self) -> EditorOptions {
self.0
}
}
#[derive(Serialize, Deserialize, Debug)]
#[serde(rename_all = "camelCase")]
pub struct Range {
pub start: Point,
pub end: Point,
}
#[derive(Serialize, Deserialize, Debug)]
#[serde(rename_all = "camelCase")]
pub struct Point {
pub row: usize,
pub column: usize,
}
#[derive(Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct EditorOptions {
pub mode: String,
pub theme: String,
#[serde(with = "serde_wasm_bindgen::preserve")]
pub keyboard_handler: JsValue,
pub value: String,
}
impl Default for EditorOptions {
fn default() -> Self {
EditorOptions {
mode: "ace/mode/text".into(),
theme: "ace/theme/textmate".into(),
keyboard_handler: "ace/keyboard/ace".into(),
value: String::new(),
}
}
}
impl EditorOptions {
pub fn to_js(&self) -> Object {
serde_wasm_bindgen::to_value(self).unwrap().into()
}
}
#[derive(thiserror::Error, Debug)]
pub enum EditorError {
#[error(transparent)]
Serde(#[from] serde_wasm_bindgen::Error),
#[error("Failed to open an editor")]
Open(JsValue),
#[error("Failed to set theme")]
SetTheme(JsValue),
#[error("Failed to set keyboard handler")]
SetKeyboardHandler(JsValue),
#[error("Failed to define extenstion")]
DefineEx(JsValue),
}
#[derive(Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct Command {
pub name: String,
pub bind_key: BindKey,
#[serde(with = "serde_wasm_bindgen::preserve")]
pub exec: js_sys::Function,
pub read_only: bool,
}
#[derive(Serialize, Deserialize)]
pub struct BindKey {
pub win: String,
pub mac: String,
}
pub struct Editor {
js: bindgen::Editor,
}
unsafe impl Send for Editor {}
unsafe impl Sync for Editor {}
impl Editor {
/// ace.edit
pub fn open(element: &str, options: Option<&EditorOptions>) -> Result<Self> {
let editor = bindgen::edit(element, options.map(|options| options.to_js()))
.map_err(EditorError::Open)?;
Ok(Editor { js: editor })
}
pub fn set_theme(&self, theme: &str) -> Result<()> {
self.js.set_theme(theme).map_err(EditorError::SetTheme)
}
pub fn set_keyboard_handler(&self, handler: Option<&str>) -> Result<()> {
let handler = if let Some(handler) = handler {
JsValue::from(handler)
} else {
JsValue::null()
};
self.js
.set_keyboard_handler(handler)
.map_err(EditorError::SetKeyboardHandler)
}
pub fn define_vim_w(callback: Box<dyn Fn() + 'static>) -> Result<()> {
let value = bindgen::require("ace/keyboard/vim").map_err(EditorError::DefineEx)?;
let define_ex = Reflect::get(&value, &JsValue::from("CodeMirror"))
.and_then(|code_mirror| Reflect::get(&code_mirror, &JsValue::from("Vim")))
.and_then(|vim| Reflect::get(&vim, &JsValue::from("defineEx")))
.map_err(EditorError::DefineEx)?;
let callback = Closure::wrap(callback);
js_sys::Function::from(define_ex)
.call3(
&JsValue::null(),
&JsValue::from("write"),
&JsValue::from("w"),
callback.as_ref().unchecked_ref(),
)
.map_err(EditorError::DefineEx)?;
callback.forget();
Ok(())
}
pub fn add_command(&self, command: Command) {
let editor = self.js.clone();
let manager = bindgen::CommandManager::from(
Reflect::get(&editor, &JsValue::from("commands")).unwrap(),
);
manager.add_command(serde_wasm_bindgen::to_value(&command).unwrap());
}
pub fn get_value(&self) -> String {
self.js.get_value()
}
pub fn set_value(&self, value: String) {
self.js.set_value(value);
self.js.clear_selection();
}
pub fn get_range(&self) -> Range {
serde_wasm_bindgen::from_value(self.js.get_selection().get_range()).unwrap()
}
pub fn get_selected_value(&self) -> String {
self.js.get_selected_text()
}
pub fn set_read_only(&self, value: bool) {
self.js.set_read_only(value);
}
pub fn get_length(&self) -> usize {
self.js.get_session().get_length()
}
pub fn get_line(&self, row: usize) -> String {
self.js.get_session().get_line(row)
}
pub fn get_text_range(&self, range: Range) -> String {
self.js
.get_session()
.get_text_range(serde_wasm_bindgen::to_value(&range).unwrap())
}
}
-12
View File
@@ -1,12 +0,0 @@
[package]
name = "floating-ui"
version = "0.1.0"
edition = "2024"
[dependencies]
serde = "1.0.219"
serde-wasm-bindgen = "0.6.5"
wasm-bindgen = "0.2.100"
wasm-bindgen-futures = "0.4.50"
web-sys = "0.3.77"
-83
View File
@@ -1,83 +0,0 @@
use wasm_bindgen::{
JsValue,
prelude::{Closure, wasm_bindgen},
};
use web_sys::js_sys::{self, Array, Object, Reflect};
#[wasm_bindgen]
extern "C" {
#[wasm_bindgen(js_namespace = ["globalThis", "FloatingUIDOM"], js_name = computePosition)]
pub async fn compute_position(
reference: JsValue,
floating: JsValue,
options: JsValue,
) -> JsValue;
#[wasm_bindgen(js_namespace = ["globalThis", "FloatingUIDOM"])]
pub fn offset(value: i32) -> JsValue;
#[wasm_bindgen(js_namespace = ["globalThis", "FloatingUIDOM"])]
pub fn flip() -> JsValue;
#[wasm_bindgen(js_namespace = ["globalThis", "FloatingUIDOM"])]
pub fn shift() -> JsValue;
#[wasm_bindgen(js_namespace = ["globalThis", "FloatingUIDOM"])]
pub fn arrow(options: JsValue) -> JsValue;
#[wasm_bindgen(js_namespace = ["globalThis", "FloatingUIDOM"], js_name = autoUpdate)]
pub fn auto_update(
reference: JsValue,
floating: JsValue,
callback: &Closure<dyn FnMut()>,
options: JsValue,
) -> js_sys::Function;
}
#[derive(serde::Serialize)]
pub struct ComputeOptions {
placement: String,
#[serde(with = "serde_wasm_bindgen::preserve")]
middleware: Array,
}
#[derive(serde::Deserialize, Debug)]
#[serde(rename_all = "camelCase")]
pub struct ComputePosition {
pub x: f64,
pub y: f64,
pub placement: String,
pub strategy: String,
pub middleware_data: MiddlewareData,
}
#[derive(serde::Deserialize, Debug)]
pub struct MiddlewareData {
pub arrow: ArrowPosition,
}
#[derive(serde::Deserialize, Debug)]
pub struct ArrowPosition {
pub x: f64,
}
pub fn compute_options(offset_value: i32, element: &JsValue) -> JsValue {
let middleware = Array::new();
middleware.push(&offset(offset_value));
middleware.push(&flip());
middleware.push(&shift());
let options = {
let options = Object::new();
Reflect::set(&options, &JsValue::from("element"), element).unwrap();
options
};
middleware.push(&arrow(JsValue::from(options)));
let options = {
let options = Object::new();
Reflect::set(
&options,
&JsValue::from("middleware"),
&JsValue::from(middleware),
)
.unwrap();
options
};
JsValue::from(options)
}
-13
View File
@@ -1,13 +0,0 @@
[package]
name = "istyles"
version = "0.1.0"
edition = "2024"
[lib]
proc-macro = true
[dependencies]
syn = { version = "2.0", features = ["full"] }
quote = "1.0"
serde_json = "1.0"
proc-macro2 = "1.0.95"
-55
View File
@@ -1,55 +0,0 @@
use proc_macro::TokenStream;
use quote::quote;
use serde_json::Value;
use syn::{LitStr, parse_macro_input};
#[proc_macro]
pub fn istyles(input: TokenStream) -> TokenStream {
let (css_module_map, mod_name) = parse_macro_input!(input with parse_input);
let value: Value = match serde_json::from_str(&css_module_map) {
Ok(v) => v,
Err(e) => {
return syn::Error::new_spanned(css_module_map, format!("Invalid JSON: {e}"))
.to_compile_error()
.into();
}
};
let consts = generate_consts(&value);
let expanded = quote! {
pub mod #mod_name {
#consts
}
};
TokenStream::from(expanded)
}
fn parse_input(input: syn::parse::ParseStream) -> syn::Result<(String, syn::Ident)> {
let mod_name: syn::Ident = input.parse()?;
input.parse::<syn::Token![,]>()?;
let path: LitStr = input.parse()?;
let path = path.value();
let json = std::fs::read_to_string(&path)
.map_err(|e| syn::Error::new_spanned(&path, format!("Failed to read JSON: {e:?}")))?;
Ok((json, mod_name))
}
fn generate_consts(value: &Value) -> proc_macro2::TokenStream {
match value {
Value::Object(map) => {
let const_decls = map.iter().map(|(k, v)| {
let key = k.replace('-', "_");
let key_ident = syn::Ident::new(&key, proc_macro2::Span::call_site());
let value_str = v.as_str().unwrap_or_default();
quote! {
pub const #key_ident: &str = #value_str;
}
});
quote! { #(#const_decls)* }
}
_ => quote! {},
}
}
-10
View File
@@ -1,10 +0,0 @@
[package]
name = "split-grid"
version = "0.1.0"
edition = "2024"
[dependencies]
serde = "1.0.219"
serde-wasm-bindgen = "0.6.5"
wasm-bindgen = "0.2.100"
web-sys = "0.3.77"
-38
View File
@@ -1,38 +0,0 @@
use wasm_bindgen::{JsValue, prelude::wasm_bindgen};
#[wasm_bindgen]
extern "C" {
pub type Grid;
#[wasm_bindgen(js_namespace = ["globalThis"], js_name = Split)]
pub fn split(options: &JsValue) -> Grid;
#[wasm_bindgen(method)]
pub fn destroy(this: &Grid);
}
unsafe impl Send for Grid {}
unsafe impl Sync for Grid {}
#[derive(serde::Serialize, serde::Deserialize)]
pub struct Gutter {
pub track: i32,
#[serde(with = "serde_wasm_bindgen::preserve")]
pub element: JsValue,
}
#[derive(serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct SplitOptions {
pub min_size: i32,
#[serde(skip_serializing_if = "Option::is_none")]
pub row_gutters: Option<Vec<Gutter>>,
#[serde(skip_serializing_if = "Option::is_none")]
pub column_gutters: Option<Vec<Gutter>>,
}
impl From<SplitOptions> for JsValue {
fn from(value: SplitOptions) -> Self {
serde_wasm_bindgen::to_value(&value).unwrap()
}
}
+1
View File
@@ -0,0 +1 @@
._-autoSize_1m78w_1{height:100%;min-height:0;min-width:0;width:100%}._-bodyMonospace_1m78w_8{font-family:Source Code Pro,monospace;font-optical-sizing:auto;font-size:inherit;line-height:1.25}._container_1m78w_19{position:relative}._-advanced_1m78w_24{position:absolute}._simple_1m78w_37{background-color:inherit;border:none;color:inherit}
+1
View File
@@ -0,0 +1 @@
._-buttonReset_16ln6_1{background:inherit;background-color:transparent;border:none;color:var(--font-color);font:inherit;line-height:inherit;padding:0;text-align:inherit}._-buttonAsLink_16ln6_12{color:var(--link-color);cursor:pointer;-webkit-text-decoration:underline;text-decoration:underline;-webkit-user-select:text;-moz-user-select:text;user-select:text}._table_16ln6_24{border-collapse:collapse}._tdAndTh_16ln6_28{border:1px solid #ddd;padding:8px;text-align:left}
+1
View File
@@ -0,0 +1 @@
._container_qgdhb_1,._left_qgdhb_2,._right_qgdhb_3{display:flex;gap:.5em}._container_qgdhb_1{font-size:var(--secondary-font-size);justify-content:space-between;padding:1.25em 0}
+1
View File
@@ -0,0 +1 @@
._container_knjdr_1{color:var(--font-color);display:flex;white-space:nowrap}._container_knjdr_1:after,._container_knjdr_1:before{border-top:var(--border);content:"";flex:1 1 auto;margin:auto}._container_knjdr_1:before{margin-right:2%}._container_knjdr_1:after{margin-left:2%}
+1
View File
@@ -0,0 +1 @@
._icon_imjug_1{fill:currentcolor;display:block}
+34 -23
View File
@@ -32,30 +32,41 @@
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/8.0.1/normalize.min.css" integrity="sha512-NhSC1YmyruXifcj/KFRWoC561YpHpc5Jtzgvbuzx5VozKpWvQ+4nXhPdFgmx8xqexRcpAglTj9sIBWINXa8x5w==" crossorigin="anonymous" referrerpolicy="no-referrer" />
<link data-trunk href="./assets/module.postcss/index.module.css" rel="css">
<link data-trunk href="./assets/module.postcss/playground.module.css" rel="css">
<link data-trunk href="./assets/module.postcss/header.module.css" rel="css">
<link data-trunk href="./assets/module.postcss/button_set.module.css" rel="css">
<link data-trunk href="./assets/module.postcss/icon.module.css" rel="css">
<link data-trunk href="./assets/module.postcss/editor.module.css" rel="css">
<link data-trunk href="./assets/module.postcss/output.module.css" rel="css">
<link data-trunk href="./assets/module.postcss/pop_button.module.css" rel="css">
<link data-trunk href="./assets/module.postcss/menu_group.module.css" rel="css">
<link data-trunk href="./assets/module.postcss/menu_item.module.css" rel="css">
<link data-trunk href="./assets/module.postcss/selectable_menu_item.module.css" rel="css">
<link data-trunk href="./assets/module.postcss/loader.module.css" rel="css">
<link data-trunk href="./assets/module.postcss/config_element.module.css" rel="css">
<link data-trunk href="./assets/module.postcss/menu_aside.module.css" rel="css">
<link data-trunk href="./assets/module.postcss/button_menu_item.module.css" rel="css">
<link rel="stylesheet" href="/index.module-c01d34afdf78524a.css" integrity="sha384-lRQ7qmLXo5zZTWDlGd7G9oZRaBZZxw8NCDa9rXAonRgQfdMwzameMZMynyjN5x3o"/>
<link rel="stylesheet" href="/playground.module-35ee78edbba67fac.css" integrity="sha384-sWwhPrGt5KjDGMGK79VYYCIrKolv16GCWAECkvfu0fi/8CFv6DqWBj2T7Q2A8g0K"/>
<link rel="stylesheet" href="/header.module-ac51c18531f057e2.css" integrity="sha384-AXJcnlvV59TxSIsnlrOOqdYQhrXMfDhGTgQLNBEWAJrDnACKot7TRejHMf6J2fnb"/>
<link rel="stylesheet" href="/button_set.module-5d3db6de68478263.css" integrity="sha384-TIe5ThZOwLJJ0+6mtvBjL4MarKH9k+DZw4XEyTZR5AdvQ1EtL5U4t9UN/6dQIBBq"/>
<link rel="stylesheet" href="/icon.module-1bc61d4168b5ccb3.css" integrity="sha384-ptZCYE08acxN2qaPD7gAPcOIeTItTKiaA1I9NS6kBnqibXsPPgFW36L8SJhtGaDM"/>
<link rel="stylesheet" href="/editor.module-3debeca2955ed188.css" integrity="sha384-4YYDPvob82vT6KfK473O3k+pyZqFhJXpp3rm7MUcVYyWamz+BbzKztB7Ov8qo52M"/>
<link rel="stylesheet" href="/output.module-a4a1c196d90b7bd9.css" integrity="sha384-jgzSRUt3zKwlwNZ7PWvIF41cnxzf1i1pqj/Di40KsTyjYFWyQGvaFfswHpLiouMJ"/>
<link rel="stylesheet" href="/pop_button.module-4f72d3126fbce92f.css" integrity="sha384-M/+7uvtst1jTBIlpkcLyRzEnwDmbU5vy81Mc/C9rALmv7CSEhheO1wf8SFVZgSbE"/>
<link rel="stylesheet" href="/menu_group.module-a772dbc7816990dc.css" integrity="sha384-/Vwj3jYZ7voDVUioLY/bPL6evlrD3H94zFOrXqaGLVfWq5j6pGvzlZNsgmF90urx"/>
<link rel="stylesheet" href="/menu_item.module-6dd753f9a643aa5d.css" integrity="sha384-6nHT5o64h02Lgj0NnWeFjA2b+BriplzWjqVTxATth/vlEoNAUULsKk+qjGtOspEu"/>
<link rel="stylesheet" href="/selectable_menu_item.module-9fcaffb1a28552bd.css" integrity="sha384-Qt+6dKGAA/3lJLyxaO3egtMB3d2cf+891VbURt6e+3HA5lsKGzINrw2jgRgFm4Cy"/>
<link rel="stylesheet" href="/loader.module-5ed8421e1bd0b762.css" integrity="sha384-WADDyWyS3McBlbEZF6EHwhvBF6TtFVLo1Ku02jThVPG013QgPFbKV73wPCOajuEG"/>
<link rel="stylesheet" href="/config_element.module-82b9972ec45d5c22.css" integrity="sha384-tguuNkgpBUBDvkjnTXJMSgz63AUAf29HHfcXUdkRsDYmJQosQumekxskP4kPA+kv"/>
<link rel="stylesheet" href="/menu_aside.module-964b87e610335227.css" integrity="sha384-71iPAUci+bIK/FTdmE9zXpmHzFOSRTc0l5MfQWrEaiIiXiCb57dJhY7VvxRdfpqk"/>
<link rel="stylesheet" href="/button_menu_item.module-cfe0e7e3436ec378.css" integrity="sha384-4j4UI+gK+h/Tb4TAGV8phf/uduZpBjxCze4y0ZBWhnDCU+Pgugi15tx7QwFxDOMu"/>
<link data-trunk href="./assets/module.postcss/output/execute.module.css" rel="css">
<link data-trunk href="./assets/module.postcss/output/header.module.css" rel="css">
<link data-trunk href="./assets/module.postcss/output/section.module.css" rel="css">
<link data-trunk href="./assets/module.postcss/output/share.module.css" rel="css">
<link rel="stylesheet" href="/execute.module-c022a117ac00c250.css" integrity="sha384-a82+iJP4SyJ1M1rs5vfbWLs1o/40EEz88cSvxA9vZu0s6CruMAdTrG4OcwQ/wJti"/>
<link rel="stylesheet" href="/header.module-fd412fdcaf14ec7f.css" integrity="sha384-WkHqFfcJ4a2iNggEfDC1FOPjE09nG8bDRcJB/ATap/loWw61KN80coRydss0l1kd"/>
<link rel="stylesheet" href="/section.module-563342bb49f45fea.css" integrity="sha384-ODwBBjvfm9KhL/rvz0uzAS1boRM6ejhf5KWkH7aVAKIdcxo5a7PX/M/UMx21xMmg"/>
<link rel="stylesheet" href="/share.module-98b6a8e1f8fbcd6d.css" integrity="sha384-wg7LcdSidiM2bt+2SF5mvUvX7QMFNdtd34lSrNMOc/9PTE0Dgp0JNm6iE1My1a7o"/>
<link data-trunk rel="rust" href="Cargo.toml" data-cargo-no-default-features data-bin="app" data-type="main" />
<link data-trunk rel="rust" href="Cargo.toml" data-cargo-no-default-features data-cargo-features="sqlite3" data-bin="sqlite3" data-type="worker" data-loader-shim data-bindgen-target="web" />
<link data-trunk rel="rust" href="Cargo.toml" data-cargo-no-default-features data-cargo-features="sqlite3mc" data-bin="sqlite3mc" data-type="worker" data-loader-shim data-bindgen-target="web" />
</head>
<script type="module">
import init, * as bindings from '/app-311ae77b051b1152.js';
const wasm = await init({ module_or_path: '/app-311ae77b051b1152_bg.wasm' });
window.wasmBindings = bindings;
dispatchEvent(new CustomEvent("TrunkApplicationStarted", {detail: {wasm}}));
</script>
<link rel="modulepreload" href="/app-311ae77b051b1152.js" crossorigin="anonymous" integrity="sha384-IIEp/GI2eAj2RwPyrsfnTjz4bf0sLtO11nspVngosv3YJAu5nu60kU089W/8VptR"><link rel="preload" href="/app-311ae77b051b1152_bg.wasm" crossorigin="anonymous" integrity="sha384-HB0H540WBL6s5Rbku1lepl1mzI7/bRj0pfLofruhXcsO9G0waLTcgh70ktcFr0uG" as="fetch" type="application/wasm"></head>
<body></body>
</html>
+1
View File
@@ -0,0 +1 @@
:root{--primary-font:"Open Sans",sans-serif;--primary-font-size:18px;--secondary-font-size:calc(var(--primary-font-size)*0.75);--header-transition:0.2s ease-in-out;--header-border-radius:4px;--border:1px solid var(--border-color)}:root,[data-theme=light]:root{--positive-luminance:#fff;--negative-luminance:#000;--font-color:#444;--font-color-high-contrast:var(--negative-luminance);--link-color:#00e;--link-color-visited:#551a8b;--background-color:#e1e1db;--background-color-high-contrast:var(--positive-luminance);--code-background-color:#eee;--border-color:#bbb;--header-link-color:var(--negative-luminance);--header-main-border:#dedede;--header-tint:#428bca;--header-accent-border:#bdbdbd;--button-primary-color:var(--positive-luminance);--button-primary-bg-color:#a42;--button-primary-border-color:#80331a;--button-primary-bg-color-light:color-mix(in hsl,var(--button-primary-bg-color),var(--positive-luminance));--button-primary-border-color-light:color-mix(in hsl,var(--button-primary-border-color),var(--positive-luminance));--button-primary-active-color:color-mix(in hsl,var(--positive-luminance),var(--negative-luminance) 30%);--button-secondary-color:#444;--button-secondary-bg-color-top:#fff;--button-secondary-bg-color-bottom:#f9f9f9;--button-secondary-bg-color:linear-gradient(to bottom,var(--button-secondary-bg-color-top),var(--button-secondary-bg-color-bottom));--button-secondary-border-color:color-mix(in hsl,var(--button-secondary-bg-color-bottom),var(--negative-luminance) 20%);--button-secondary-bg-color-light:color-mix(in hsl,var(--button-secondary-bg-color-bottom),var(--positive-luminance));--button-secondary-border-color-light:color-mix(in hsl,var(--button-secondary-border-color),var(--positive-luminance));--button-secondary-color-light:color-mix(in hsl,var(--button-secondary-color),var(--positive-luminance));--button-secondary-active-color:color-mix(in hsl,var(--negative-luminance),var(--positive-luminance) 30%);--output-background-tab:#fcfcfc;--output-current-tab:#f9ffff;--output-highlight-warning-color:#f79a06;--output-highlight-warning-bg-color:inherit;--output-highlight-error-color:#bf1b1b;--output-highlight-error-bg-color:inherit}@media (prefers-color-scheme:dark){:root{--positive-luminance:#000;--negative-luminance:#fff;--font-color:#dcdbd8;--font-color-high-contrast:#dcdbd8;--link-color:#b2dcff;--link-color-visited:#eecaff;--background-color:#444;--background-color-high-contrast:#181818;--code-background-color:#3c3c3c;--border-color:#5e5e5e;--header-main-border:#363b3d;--header-accent-border:#bdbdbd;--button-primary-color:#dcdbd8;--button-primary-bg-color:#5d2310;--button-primary-border-color:#612714;--button-secondary-color:#dcdbd8;--button-secondary-bg-color-top:#17191a;--button-secondary-bg-color-bottom:#1a1c1d;--button-secondary-border-color:color-mix(in hsl,var(--button-secondary-bg-color-bottom),var(--negative-luminance) 40%);--output-background-tab:#343434;--output-current-tab:#191b1c;--output-highlight-warning-color:#ffe800;--output-highlight-warning-bg-color:#330;--output-highlight-error-color:#f5f5f5;--output-highlight-error-bg-color:#820000}}[data-theme=dark]:root{--positive-luminance:#000;--negative-luminance:#fff;--font-color:#dcdbd8;--font-color-high-contrast:#dcdbd8;--link-color:#b2dcff;--link-color-visited:#eecaff;--background-color:#444;--background-color-high-contrast:#181818;--code-background-color:#3c3c3c;--border-color:#5e5e5e;--header-main-border:#363b3d;--header-accent-border:#bdbdbd;--button-primary-color:#dcdbd8;--button-primary-bg-color:#5d2310;--button-primary-border-color:#612714;--button-secondary-color:#dcdbd8;--button-secondary-bg-color-top:#17191a;--button-secondary-bg-color-bottom:#1a1c1d;--button-secondary-border-color:color-mix(in hsl,var(--button-secondary-bg-color-bottom),var(--negative-luminance) 40%);--output-background-tab:#343434;--output-current-tab:#191b1c;--output-highlight-warning-color:#ffe800;--output-highlight-warning-bg-color:#330;--output-highlight-error-color:#f5f5f5;--output-highlight-error-bg-color:#820000}button,input,optgroup,select,textarea{font-family:Open Sans,sans-serif;font-family:var(--primary-font);font-optical-sizing:auto}html{box-sizing:border-box}a{color:var(--link-color)}a:visited{color:var(--link-color-visited)}*,:after,:before{box-sizing:inherit}body{background-color:var(--background-color);color:var(--font-color);font-family:Open Sans,sans-serif;font-family:var(--primary-font);font-optical-sizing:auto;font-size:18px;font-size:var(--primary-font-size);padding:0 1em}.language-rust_errors .warning{background-color:var(--output-highlight-warning-bg-color);color:var(--output-highlight-warning-color)}.language-rust_errors .error{background-color:var(--output-highlight-error-bg-color);color:var(--output-highlight-error-color)}
+1
View File
@@ -0,0 +1 @@
@keyframes _loader-fade_jthdv_1{0%{opacity:0}75%{opacity:1}}._dot_jthdv_11{animation:_loader-fade_jthdv_1 1s;animation-iteration-count:infinite;opacity:0}._dot_jthdv_11:nth-child(2){animation-delay:.2s}._dot_jthdv_11:nth-child(3){animation-delay:.4s}
+1
View File
@@ -0,0 +1 @@
._aside_1ogsq_1{color:#888;margin:.25em 0 0}
+1
View File
@@ -0,0 +1 @@
._container_18py9_1{line-height:normal;padding:.75em 1em 0;width:27em}._container_18py9_1:last-child{padding-bottom:.75em}._title_18py9_11{border-bottom:1px solid var(--header-main-border);font-size:var(--secondary-font-size);font-weight:700;margin:0;padding-bottom:10px;text-transform:uppercase}._content_18py9_20{padding:1em .25em}
+1
View File
@@ -0,0 +1 @@
._container_1i3fr_1{margin-bottom:1em}._container_1i3fr_1:last-child{margin-bottom:0}
+1
View File
@@ -0,0 +1 @@
._container_d1av0_1{display:flex;flex-direction:column;height:100%;width:100%}._tabs_d1av0_8{display:flex}._tab_d1av0_8{background-color:var(--output-background-tab);border:var(--border);border-right:none;color:var(--font-color);cursor:pointer;flex:1 1 auto;line-height:1.5}._tab_d1av0_8:last-of-type{border-right:var(--border)}._tabSelected_d1av0_26{background-color:var(--output-current-tab);border-bottom:none;cursor:default}._tabSelected_d1av0_26:focus{outline:none}._tabClose_d1av0_37{flex:0 0 auto}._body_d1av0_42{background-color:var(--output-current-tab);border:var(--border);border-top:none;height:100%;overflow:scroll;padding:.5em}._stdin_d1av0_51{margin-top:.25em}
-3991
View File
File diff suppressed because it is too large Load Diff
-12
View File
@@ -1,12 +0,0 @@
{
"devDependencies": {
"cssnano": "^7.0.7",
"postcss": "^8.5.3",
"postcss-cli": "^11.0.1",
"postcss-mixins": "^11.0.3",
"postcss-modules": "^6.0.1",
"postcss-plugin": "^1.0.0",
"postcss-preset-env": "^10.1.6",
"postcss-simple-vars": "^7.0.1"
}
}
+1
View File
@@ -0,0 +1 @@
._-autoSize_1uxa0_1{height:100%;min-height:0;min-width:0;width:100%}._container_1uxa0_8{display:flex;flex-direction:column;height:100vh;padding-bottom:1em}._-resizeableArea_1uxa0_15{display:grid}._resizeableAreaRowOutputUnfocused_1uxa0_20{grid-template-rows:1fr auto}._resizeableAreaRowOutputFocused_1uxa0_25{grid-template-rows:1fr 12px 1fr}._resizeableAreaColumnOutputUnfocused_1uxa0_30{grid-template-columns:1fr auto}._resizeableAreaColumnOutputFocused_1uxa0_35{grid-template-columns:1fr 12px 1fr}._-gutter_1uxa0_40{align-items:center;display:flex;justify-content:center}._splitRowsGutter_1uxa0_46{cursor:row-resize}._splitRowsGutterHandle_1uxa0_51{pointer-events:none;transform:rotate(90deg)}._splitColumnsGutter_1uxa0_56{cursor:col-resize}._editor_1uxa0_61{border:4px solid var(--border-color);border-radius:4px}
+1
View File
@@ -0,0 +1 @@
._container_1chxk_4{font-size:var(--secondary-font-size);z-index:10}._container_1chxk_4 button:enabled{cursor:pointer}._arrow_1chxk_13{fill:var(--background-color-high-contrast)}._-content_1chxk_17{background:var(--background-color-high-contrast);border-radius:var(--header-border-radius);box-shadow:5px 5px 20px -3px rgba(0,0,0,.25),0 0 5px -2px rgba(0,0,0,.9);color:var(--font-color);margin:10px}._contentBottom_1chxk_27{margin-top:0}._contentTop_1chxk_32{margin-bottom:0}
-22
View File
@@ -1,22 +0,0 @@
module.exports = {
plugins: [
require('postcss-simple-vars')(),
require('postcss-preset-env')(),
require('postcss-mixins')(),
require("postcss-modules")({
getJSON: function(_, json, outputFileName) {
var path = require("path");
var fs = require("fs");
var jsonPath = path.resolve(outputFileName + ".map");
var dir = path.dirname(jsonPath);
if (!fs.existsSync(dir)) {
fs.mkdirSync(dir, { recursive: true });
}
fs.writeFileSync(jsonPath, JSON.stringify(json));
},
}),
require('cssnano')({
reset: 'default',
}),
]
};
-3
View File
@@ -1,3 +0,0 @@
[toolchain]
channel = "stable"
targets = ["wasm32-unknown-unknown"]
+1
View File
@@ -0,0 +1 @@
._-bodyMonospace_1qg95_1{font-family:Source Code Pro,monospace;font-optical-sizing:auto;font-size:inherit;line-height:1.25}
@@ -0,0 +1 @@
._-buttonReset_11oz3_1{background:inherit;background-color:transparent;border:none;color:var(--font-color);font:inherit;line-height:inherit;padding:0;text-align:inherit}._-menuItemFullButton_11oz3_12{transition:color var(--header-transition);-webkit-user-select:text;-moz-user-select:text;user-select:text;width:100%}._-menuItemTitle_11oz3_19{font-weight:600}._container_11oz3_23:hover,._selected_11oz3_31{color:var(--header-tint)}._selected_11oz3_31{font-weight:600}._header_11oz3_37{align-items:center;display:flex}._description_11oz3_46{padding-left:2em}._checkmark_11oz3_50{margin-right:.5em;opacity:0;transition:opacity .15s ease-in-out}._selected_11oz3_31 ._checkmark_11oz3_50,._selected_11oz3_31:hover ._checkmark_11oz3_50{opacity:1}._container_11oz3_23:hover ._checkmark_11oz3_50{color:var(--header-tint);opacity:.5}
+1
View File
@@ -0,0 +1 @@
._-buttonReset_ccgtz_1{background:inherit;background-color:transparent;border:none;color:var(--font-color);font:inherit;line-height:inherit;padding:0;text-align:inherit}._container_ccgtz_12{display:flex;--copied-duration:1s ease-in-out}._button_ccgtz_18{cursor:pointer;margin:0 .25em 0 .5em;transition:color var(--copied-duration)}._text_ccgtz_25{opacity:0;transition:visibility var(--copied-duration),opacity var(--copied-duration),color var(--copied-duration);visibility:hidden}._active_ccgtz_34 ._button_ccgtz_18{color:green;transition:color 0s}._active_ccgtz_34 ._text_ccgtz_25{color:green;opacity:1;transition:visibility 0s,opacity 0s,color 0s;visibility:visible}
+995
View File
@@ -0,0 +1,995 @@
let wasm;
function addToExternrefTable0(obj) {
const idx = wasm.__externref_table_alloc();
wasm.__wbindgen_externrefs.set(idx, obj);
return idx;
}
const CLOSURE_DTORS = (typeof FinalizationRegistry === 'undefined')
? { register: () => {}, unregister: () => {} }
: new FinalizationRegistry(state => state.dtor(state.a, state.b));
function debugString(val) {
// primitive types
const type = typeof val;
if (type == 'number' || type == 'boolean' || val == null) {
return `${val}`;
}
if (type == 'string') {
return `"${val}"`;
}
if (type == 'symbol') {
const description = val.description;
if (description == null) {
return 'Symbol';
} else {
return `Symbol(${description})`;
}
}
if (type == 'function') {
const name = val.name;
if (typeof name == 'string' && name.length > 0) {
return `Function(${name})`;
} else {
return 'Function';
}
}
// objects
if (Array.isArray(val)) {
const length = val.length;
let debug = '[';
if (length > 0) {
debug += debugString(val[0]);
}
for(let i = 1; i < length; i++) {
debug += ', ' + debugString(val[i]);
}
debug += ']';
return debug;
}
// Test for built-in
const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
let className;
if (builtInMatches && builtInMatches.length > 1) {
className = builtInMatches[1];
} else {
// Failed to match the standard '[object ClassName]'
return toString.call(val);
}
if (className == 'Object') {
// we're a user defined class or Object
// JSON.stringify avoids problems with cycles, and is generally much
// easier than looping through ownProperties of `val`.
try {
return 'Object(' + JSON.stringify(val) + ')';
} catch (_) {
return 'Object';
}
}
// errors
if (val instanceof Error) {
return `${val.name}: ${val.message}\n${val.stack}`;
}
// TODO we could test for more things here, like `Set`s and `Map`s.
return className;
}
function getArrayU8FromWasm0(ptr, len) {
ptr = ptr >>> 0;
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
}
let cachedDataViewMemory0 = null;
function getDataViewMemory0() {
if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
}
return cachedDataViewMemory0;
}
function getStringFromWasm0(ptr, len) {
ptr = ptr >>> 0;
return decodeText(ptr, len);
}
let cachedUint8ArrayMemory0 = null;
function getUint8ArrayMemory0() {
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
}
return cachedUint8ArrayMemory0;
}
function handleError(f, args) {
try {
return f.apply(this, args);
} catch (e) {
const idx = addToExternrefTable0(e);
wasm.__wbindgen_exn_store(idx);
}
}
function isLikeNone(x) {
return x === undefined || x === null;
}
function makeClosure(arg0, arg1, dtor, f) {
const state = { a: arg0, b: arg1, cnt: 1, dtor };
const real = (...args) => {
// First up with a closure we increment the internal reference
// count. This ensures that the Rust closure environment won't
// be deallocated while we're invoking it.
state.cnt++;
try {
return f(state.a, state.b, ...args);
} finally {
real._wbg_cb_unref();
}
};
real._wbg_cb_unref = () => {
if (--state.cnt === 0) {
state.dtor(state.a, state.b);
state.a = 0;
CLOSURE_DTORS.unregister(state);
}
};
CLOSURE_DTORS.register(real, state, state);
return real;
}
function makeMutClosure(arg0, arg1, dtor, f) {
const state = { a: arg0, b: arg1, cnt: 1, dtor };
const real = (...args) => {
// First up with a closure we increment the internal reference
// count. This ensures that the Rust closure environment won't
// be deallocated while we're invoking it.
state.cnt++;
const a = state.a;
state.a = 0;
try {
return f(a, state.b, ...args);
} finally {
state.a = a;
real._wbg_cb_unref();
}
};
real._wbg_cb_unref = () => {
if (--state.cnt === 0) {
state.dtor(state.a, state.b);
state.a = 0;
CLOSURE_DTORS.unregister(state);
}
};
CLOSURE_DTORS.register(real, state, state);
return real;
}
function passStringToWasm0(arg, malloc, realloc) {
if (realloc === undefined) {
const buf = cachedTextEncoder.encode(arg);
const ptr = malloc(buf.length, 1) >>> 0;
getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
WASM_VECTOR_LEN = buf.length;
return ptr;
}
let len = arg.length;
let ptr = malloc(len, 1) >>> 0;
const mem = getUint8ArrayMemory0();
let offset = 0;
for (; offset < len; offset++) {
const code = arg.charCodeAt(offset);
if (code > 0x7F) break;
mem[ptr + offset] = code;
}
if (offset !== len) {
if (offset !== 0) {
arg = arg.slice(offset);
}
ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
const ret = cachedTextEncoder.encodeInto(arg, view);
offset += ret.written;
ptr = realloc(ptr, len, offset, 1) >>> 0;
}
WASM_VECTOR_LEN = offset;
return ptr;
}
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
cachedTextDecoder.decode();
const MAX_SAFARI_DECODE_BYTES = 2146435072;
let numBytesDecoded = 0;
function decodeText(ptr, len) {
numBytesDecoded += len;
if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
cachedTextDecoder.decode();
numBytesDecoded = len;
}
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
}
const cachedTextEncoder = new TextEncoder();
if (!('encodeInto' in cachedTextEncoder)) {
cachedTextEncoder.encodeInto = function (arg, view) {
const buf = cachedTextEncoder.encode(arg);
view.set(buf);
return {
read: arg.length,
written: buf.length
};
}
}
let WASM_VECTOR_LEN = 0;
function wasm_bindgen__convert__closures_____invoke__hc5c04b5ba49ccfb9(arg0, arg1, arg2) {
wasm.wasm_bindgen__convert__closures_____invoke__hc5c04b5ba49ccfb9(arg0, arg1, arg2);
}
function wasm_bindgen__convert__closures_____invoke__h5336b4c4f5394a94(arg0, arg1, arg2) {
wasm.wasm_bindgen__convert__closures_____invoke__h5336b4c4f5394a94(arg0, arg1, arg2);
}
function wasm_bindgen__convert__closures_____invoke__ha942a44eff540ade(arg0, arg1, arg2, arg3) {
wasm.wasm_bindgen__convert__closures_____invoke__ha942a44eff540ade(arg0, arg1, arg2, arg3);
}
const __wbindgen_enum_ReadableStreamType = ["bytes"];
const IntoUnderlyingByteSourceFinalization = (typeof FinalizationRegistry === 'undefined')
? { register: () => {}, unregister: () => {} }
: new FinalizationRegistry(ptr => wasm.__wbg_intounderlyingbytesource_free(ptr >>> 0, 1));
const IntoUnderlyingSinkFinalization = (typeof FinalizationRegistry === 'undefined')
? { register: () => {}, unregister: () => {} }
: new FinalizationRegistry(ptr => wasm.__wbg_intounderlyingsink_free(ptr >>> 0, 1));
const IntoUnderlyingSourceFinalization = (typeof FinalizationRegistry === 'undefined')
? { register: () => {}, unregister: () => {} }
: new FinalizationRegistry(ptr => wasm.__wbg_intounderlyingsource_free(ptr >>> 0, 1));
export class IntoUnderlyingByteSource {
__destroy_into_raw() {
const ptr = this.__wbg_ptr;
this.__wbg_ptr = 0;
IntoUnderlyingByteSourceFinalization.unregister(this);
return ptr;
}
free() {
const ptr = this.__destroy_into_raw();
wasm.__wbg_intounderlyingbytesource_free(ptr, 0);
}
/**
* @returns {number}
*/
get autoAllocateChunkSize() {
const ret = wasm.intounderlyingbytesource_autoAllocateChunkSize(this.__wbg_ptr);
return ret >>> 0;
}
/**
* @param {ReadableByteStreamController} controller
* @returns {Promise<any>}
*/
pull(controller) {
const ret = wasm.intounderlyingbytesource_pull(this.__wbg_ptr, controller);
return ret;
}
/**
* @param {ReadableByteStreamController} controller
*/
start(controller) {
wasm.intounderlyingbytesource_start(this.__wbg_ptr, controller);
}
/**
* @returns {ReadableStreamType}
*/
get type() {
const ret = wasm.intounderlyingbytesource_type(this.__wbg_ptr);
return __wbindgen_enum_ReadableStreamType[ret];
}
cancel() {
const ptr = this.__destroy_into_raw();
wasm.intounderlyingbytesource_cancel(ptr);
}
}
if (Symbol.dispose) IntoUnderlyingByteSource.prototype[Symbol.dispose] = IntoUnderlyingByteSource.prototype.free;
export class IntoUnderlyingSink {
__destroy_into_raw() {
const ptr = this.__wbg_ptr;
this.__wbg_ptr = 0;
IntoUnderlyingSinkFinalization.unregister(this);
return ptr;
}
free() {
const ptr = this.__destroy_into_raw();
wasm.__wbg_intounderlyingsink_free(ptr, 0);
}
/**
* @param {any} reason
* @returns {Promise<any>}
*/
abort(reason) {
const ptr = this.__destroy_into_raw();
const ret = wasm.intounderlyingsink_abort(ptr, reason);
return ret;
}
/**
* @returns {Promise<any>}
*/
close() {
const ptr = this.__destroy_into_raw();
const ret = wasm.intounderlyingsink_close(ptr);
return ret;
}
/**
* @param {any} chunk
* @returns {Promise<any>}
*/
write(chunk) {
const ret = wasm.intounderlyingsink_write(this.__wbg_ptr, chunk);
return ret;
}
}
if (Symbol.dispose) IntoUnderlyingSink.prototype[Symbol.dispose] = IntoUnderlyingSink.prototype.free;
export class IntoUnderlyingSource {
__destroy_into_raw() {
const ptr = this.__wbg_ptr;
this.__wbg_ptr = 0;
IntoUnderlyingSourceFinalization.unregister(this);
return ptr;
}
free() {
const ptr = this.__destroy_into_raw();
wasm.__wbg_intounderlyingsource_free(ptr, 0);
}
/**
* @param {ReadableStreamDefaultController} controller
* @returns {Promise<any>}
*/
pull(controller) {
const ret = wasm.intounderlyingsource_pull(this.__wbg_ptr, controller);
return ret;
}
cancel() {
const ptr = this.__destroy_into_raw();
wasm.intounderlyingsource_cancel(ptr);
}
}
if (Symbol.dispose) IntoUnderlyingSource.prototype[Symbol.dispose] = IntoUnderlyingSource.prototype.free;
const EXPECTED_RESPONSE_TYPES = new Set(['basic', 'cors', 'default']);
async function __wbg_load(module, imports) {
if (typeof Response === 'function' && module instanceof Response) {
if (typeof WebAssembly.instantiateStreaming === 'function') {
try {
return await WebAssembly.instantiateStreaming(module, imports);
} catch (e) {
const validResponse = module.ok && EXPECTED_RESPONSE_TYPES.has(module.type);
if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e);
} else {
throw e;
}
}
}
const bytes = await module.arrayBuffer();
return await WebAssembly.instantiate(bytes, imports);
} else {
const instance = await WebAssembly.instantiate(module, imports);
if (instance instanceof WebAssembly.Instance) {
return { instance, module };
} else {
return instance;
}
}
}
function __wbg_get_imports() {
const imports = {};
imports.wbg = {};
imports.wbg.__wbg_Error_52673b7de5a0ca89 = function(arg0, arg1) {
const ret = Error(getStringFromWasm0(arg0, arg1));
return ret;
};
imports.wbg.__wbg_Number_2d1dcfcf4ec51736 = function(arg0) {
const ret = Number(arg0);
return ret;
};
imports.wbg.__wbg___wbindgen_boolean_get_dea25b33882b895b = function(arg0) {
const v = arg0;
const ret = typeof(v) === 'boolean' ? v : undefined;
return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
};
imports.wbg.__wbg___wbindgen_debug_string_adfb662ae34724b6 = function(arg0, arg1) {
const ret = debugString(arg1);
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
const len1 = WASM_VECTOR_LEN;
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
};
imports.wbg.__wbg___wbindgen_in_0d3e1e8f0c669317 = function(arg0, arg1) {
const ret = arg0 in arg1;
return ret;
};
imports.wbg.__wbg___wbindgen_is_function_8d400b8b1af978cd = function(arg0) {
const ret = typeof(arg0) === 'function';
return ret;
};
imports.wbg.__wbg___wbindgen_is_object_ce774f3490692386 = function(arg0) {
const val = arg0;
const ret = typeof(val) === 'object' && val !== null;
return ret;
};
imports.wbg.__wbg___wbindgen_is_string_704ef9c8fc131030 = function(arg0) {
const ret = typeof(arg0) === 'string';
return ret;
};
imports.wbg.__wbg___wbindgen_is_undefined_f6b95eab589e0269 = function(arg0) {
const ret = arg0 === undefined;
return ret;
};
imports.wbg.__wbg___wbindgen_jsval_loose_eq_766057600fdd1b0d = function(arg0, arg1) {
const ret = arg0 == arg1;
return ret;
};
imports.wbg.__wbg___wbindgen_number_get_9619185a74197f95 = function(arg0, arg1) {
const obj = arg1;
const ret = typeof(obj) === 'number' ? obj : undefined;
getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
};
imports.wbg.__wbg___wbindgen_string_get_a2a31e16edf96e42 = function(arg0, arg1) {
const obj = arg1;
const ret = typeof(obj) === 'string' ? obj : undefined;
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
var len1 = WASM_VECTOR_LEN;
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
};
imports.wbg.__wbg___wbindgen_throw_dd24417ed36fc46e = function(arg0, arg1) {
throw new Error(getStringFromWasm0(arg0, arg1));
};
imports.wbg.__wbg__wbg_cb_unref_87dfb5aaa0cbcea7 = function(arg0) {
arg0._wbg_cb_unref();
};
imports.wbg.__wbg_buffer_6cb2fecb1f253d71 = function(arg0) {
const ret = arg0.buffer;
return ret;
};
imports.wbg.__wbg_byobRequest_f8e3517f5f8ad284 = function(arg0) {
const ret = arg0.byobRequest;
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
};
imports.wbg.__wbg_byteLength_faa9938885bdeee6 = function(arg0) {
const ret = arg0.byteLength;
return ret;
};
imports.wbg.__wbg_byteOffset_3868b6a19ba01dea = function(arg0) {
const ret = arg0.byteOffset;
return ret;
};
imports.wbg.__wbg_call_3020136f7a2d6e44 = function() { return handleError(function (arg0, arg1, arg2) {
const ret = arg0.call(arg1, arg2);
return ret;
}, arguments) };
imports.wbg.__wbg_call_abb4ff46ce38be40 = function() { return handleError(function (arg0, arg1) {
const ret = arg0.call(arg1);
return ret;
}, arguments) };
imports.wbg.__wbg_close_0af5661bf3d335f2 = function() { return handleError(function (arg0) {
arg0.close();
}, arguments) };
imports.wbg.__wbg_close_3ec111e7b23d94d8 = function() { return handleError(function (arg0) {
arg0.close();
}, arguments) };
imports.wbg.__wbg_createSyncAccessHandle_df3bfed7c6bd8d02 = function(arg0) {
const ret = arg0.createSyncAccessHandle();
return ret;
};
imports.wbg.__wbg_data_8bf4ae669a78a688 = function(arg0) {
const ret = arg0.data;
return ret;
};
imports.wbg.__wbg_debug_9d0c87ddda3dc485 = function(arg0) {
console.debug(arg0);
};
imports.wbg.__wbg_done_62ea16af4ce34b24 = function(arg0) {
const ret = arg0.done;
return ret;
};
imports.wbg.__wbg_enqueue_a7e6b1ee87963aad = function() { return handleError(function (arg0, arg1) {
arg0.enqueue(arg1);
}, arguments) };
imports.wbg.__wbg_entries_7de5c9edd116e219 = function(arg0) {
const ret = arg0.entries();
return ret;
};
imports.wbg.__wbg_entries_83c79938054e065f = function(arg0) {
const ret = Object.entries(arg0);
return ret;
};
imports.wbg.__wbg_error_7534b8e9a36f1ab4 = function(arg0, arg1) {
let deferred0_0;
let deferred0_1;
try {
deferred0_0 = arg0;
deferred0_1 = arg1;
console.error(getStringFromWasm0(arg0, arg1));
} finally {
wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
}
};
imports.wbg.__wbg_error_7bc7d576a6aaf855 = function(arg0) {
console.error(arg0);
};
imports.wbg.__wbg_fill_508dd108a821ee20 = function(arg0, arg1, arg2, arg3) {
const ret = arg0.fill(arg1, arg2 >>> 0, arg3 >>> 0);
return ret;
};
imports.wbg.__wbg_flush_554f5177ae6f76cb = function() { return handleError(function (arg0) {
arg0.flush();
}, arguments) };
imports.wbg.__wbg_getDate_b8071ea9fc4f6838 = function(arg0) {
const ret = arg0.getDate();
return ret;
};
imports.wbg.__wbg_getDay_c13a50561112f77a = function(arg0) {
const ret = arg0.getDay();
return ret;
};
imports.wbg.__wbg_getDirectoryHandle_edea923e1d89a19d = function(arg0, arg1, arg2, arg3) {
const ret = arg0.getDirectoryHandle(getStringFromWasm0(arg1, arg2), arg3);
return ret;
};
imports.wbg.__wbg_getDirectory_9beed6c83b6861f5 = function(arg0) {
const ret = arg0.getDirectory();
return ret;
};
imports.wbg.__wbg_getFileHandle_298ee7a4e5a85f84 = function(arg0, arg1, arg2, arg3) {
const ret = arg0.getFileHandle(getStringFromWasm0(arg1, arg2), arg3);
return ret;
};
imports.wbg.__wbg_getFullYear_6ac412e8eee86879 = function(arg0) {
const ret = arg0.getFullYear();
return ret;
};
imports.wbg.__wbg_getHours_52eb417ad6e924e8 = function(arg0) {
const ret = arg0.getHours();
return ret;
};
imports.wbg.__wbg_getMinutes_4097cef8e08622f9 = function(arg0) {
const ret = arg0.getMinutes();
return ret;
};
imports.wbg.__wbg_getMonth_48a392071f9e5017 = function(arg0) {
const ret = arg0.getMonth();
return ret;
};
imports.wbg.__wbg_getRandomValues_a33d3c7f4388c9d7 = function() { return handleError(function (arg0, arg1) {
globalThis.crypto.getRandomValues(getArrayU8FromWasm0(arg0, arg1));
}, arguments) };
imports.wbg.__wbg_getSeconds_d94762aec8103802 = function(arg0) {
const ret = arg0.getSeconds();
return ret;
};
imports.wbg.__wbg_getSize_1bf196c4094d8f7b = function() { return handleError(function (arg0) {
const ret = arg0.getSize();
return ret;
}, arguments) };
imports.wbg.__wbg_getTime_ad1e9878a735af08 = function(arg0) {
const ret = arg0.getTime();
return ret;
};
imports.wbg.__wbg_getTimezoneOffset_45389e26d6f46823 = function(arg0) {
const ret = arg0.getTimezoneOffset();
return ret;
};
imports.wbg.__wbg_getUint32_d63de983274cb44e = function(arg0, arg1) {
const ret = arg0.getUint32(arg1 >>> 0);
return ret;
};
imports.wbg.__wbg_get_6b7bd52aca3f9671 = function(arg0, arg1) {
const ret = arg0[arg1 >>> 0];
return ret;
};
imports.wbg.__wbg_get_af9dab7e9603ea93 = function() { return handleError(function (arg0, arg1) {
const ret = Reflect.get(arg0, arg1);
return ret;
}, arguments) };
imports.wbg.__wbg_get_index_4e7b3f629a0ab9cd = function(arg0, arg1) {
const ret = arg0[arg1 >>> 0];
return ret;
};
imports.wbg.__wbg_get_with_ref_key_1dc361bd10053bfe = function(arg0, arg1) {
const ret = arg0[arg1];
return ret;
};
imports.wbg.__wbg_info_ce6bcc489c22f6f0 = function(arg0) {
console.info(arg0);
};
imports.wbg.__wbg_instanceof_ArrayBuffer_f3320d2419cd0355 = function(arg0) {
let result;
try {
result = arg0 instanceof ArrayBuffer;
} catch (_) {
result = false;
}
const ret = result;
return ret;
};
imports.wbg.__wbg_instanceof_Uint8Array_da54ccc9d3e09434 = function(arg0) {
let result;
try {
result = arg0 instanceof Uint8Array;
} catch (_) {
result = false;
}
const ret = result;
return ret;
};
imports.wbg.__wbg_instanceof_WorkerGlobalScope_9a3411db21c65a54 = function(arg0) {
let result;
try {
result = arg0 instanceof WorkerGlobalScope;
} catch (_) {
result = false;
}
const ret = result;
return ret;
};
imports.wbg.__wbg_isArray_51fd9e6422c0a395 = function(arg0) {
const ret = Array.isArray(arg0);
return ret;
};
imports.wbg.__wbg_isSafeInteger_ae7d3f054d55fa16 = function(arg0) {
const ret = Number.isSafeInteger(arg0);
return ret;
};
imports.wbg.__wbg_iterator_27b7c8b35ab3e86b = function() {
const ret = Symbol.iterator;
return ret;
};
imports.wbg.__wbg_length_1f83b8e5895c84aa = function(arg0) {
const ret = arg0.length;
return ret;
};
imports.wbg.__wbg_length_22ac23eaec9d8053 = function(arg0) {
const ret = arg0.length;
return ret;
};
imports.wbg.__wbg_length_d45040a40c570362 = function(arg0) {
const ret = arg0.length;
return ret;
};
imports.wbg.__wbg_log_1d990106d99dacb7 = function(arg0) {
console.log(arg0);
};
imports.wbg.__wbg_navigator_11b7299bb7886507 = function(arg0) {
const ret = arg0.navigator;
return ret;
};
imports.wbg.__wbg_new_0_23cedd11d9b40c9d = function() {
const ret = new Date();
return ret;
};
imports.wbg.__wbg_new_1ba21ce319a06297 = function() {
const ret = new Object();
return ret;
};
imports.wbg.__wbg_new_23eee00e990dac7f = function(arg0, arg1, arg2) {
const ret = new DataView(arg0, arg1 >>> 0, arg2 >>> 0);
return ret;
};
imports.wbg.__wbg_new_25f239778d6112b9 = function() {
const ret = new Array();
return ret;
};
imports.wbg.__wbg_new_6421f6084cc5bc5a = function(arg0) {
const ret = new Uint8Array(arg0);
return ret;
};
imports.wbg.__wbg_new_8a6f238a6ece86ea = function() {
const ret = new Error();
return ret;
};
imports.wbg.__wbg_new_b2db8aa2650f793a = function(arg0) {
const ret = new Date(arg0);
return ret;
};
imports.wbg.__wbg_new_df1173567d5ff028 = function(arg0, arg1) {
const ret = new Error(getStringFromWasm0(arg0, arg1));
return ret;
};
imports.wbg.__wbg_new_ff12d2b041fb48f1 = function(arg0, arg1) {
try {
var state0 = {a: arg0, b: arg1};
var cb0 = (arg0, arg1) => {
const a = state0.a;
state0.a = 0;
try {
return wasm_bindgen__convert__closures_____invoke__ha942a44eff540ade(a, state0.b, arg0, arg1);
} finally {
state0.a = a;
}
};
const ret = new Promise(cb0);
return ret;
} finally {
state0.a = state0.b = 0;
}
};
imports.wbg.__wbg_new_from_slice_f9c22b9153b26992 = function(arg0, arg1) {
const ret = new Uint8Array(getArrayU8FromWasm0(arg0, arg1));
return ret;
};
imports.wbg.__wbg_new_no_args_cb138f77cf6151ee = function(arg0, arg1) {
const ret = new Function(getStringFromWasm0(arg0, arg1));
return ret;
};
imports.wbg.__wbg_new_with_byte_offset_and_length_d85c3da1fd8df149 = function(arg0, arg1, arg2) {
const ret = new Uint8Array(arg0, arg1 >>> 0, arg2 >>> 0);
return ret;
};
imports.wbg.__wbg_new_with_length_aa5eaf41d35235e5 = function(arg0) {
const ret = new Uint8Array(arg0 >>> 0);
return ret;
};
imports.wbg.__wbg_new_with_year_month_day_2ce3621d93185809 = function(arg0, arg1, arg2) {
const ret = new Date(arg0 >>> 0, arg1, arg2);
return ret;
};
imports.wbg.__wbg_next_138a17bbf04e926c = function(arg0) {
const ret = arg0.next;
return ret;
};
imports.wbg.__wbg_next_3cfe5c0fe2a4cc53 = function() { return handleError(function (arg0) {
const ret = arg0.next();
return ret;
}, arguments) };
imports.wbg.__wbg_next_b34c09a202bf4424 = function() { return handleError(function (arg0) {
const ret = arg0.next();
return ret;
}, arguments) };
imports.wbg.__wbg_postMessage_7243f814e0cfb266 = function() { return handleError(function (arg0, arg1) {
arg0.postMessage(arg1);
}, arguments) };
imports.wbg.__wbg_prototypesetcall_dfe9b766cdc1f1fd = function(arg0, arg1, arg2) {
Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
};
imports.wbg.__wbg_queueMicrotask_9b549dfce8865860 = function(arg0) {
const ret = arg0.queueMicrotask;
return ret;
};
imports.wbg.__wbg_queueMicrotask_fca69f5bfad613a5 = function(arg0) {
queueMicrotask(arg0);
};
imports.wbg.__wbg_random_cc1f9237d866d212 = function() {
const ret = Math.random();
return ret;
};
imports.wbg.__wbg_read_0063be96fda4ddbb = function() { return handleError(function (arg0, arg1, arg2, arg3) {
const ret = arg0.read(getArrayU8FromWasm0(arg1, arg2), arg3);
return ret;
}, arguments) };
imports.wbg.__wbg_read_6d42da91294142f6 = function() { return handleError(function (arg0, arg1, arg2) {
const ret = arg0.read(arg1, arg2);
return ret;
}, arguments) };
imports.wbg.__wbg_resolve_fd5bfbaa4ce36e1e = function(arg0) {
const ret = Promise.resolve(arg0);
return ret;
};
imports.wbg.__wbg_respond_9f7fc54636c4a3af = function() { return handleError(function (arg0, arg1) {
arg0.respond(arg1 >>> 0);
}, arguments) };
imports.wbg.__wbg_setUint32_6ee364ad2096f0ed = function(arg0, arg1, arg2) {
arg0.setUint32(arg1 >>> 0, arg2 >>> 0);
};
imports.wbg.__wbg_set_169e13b608078b7b = function(arg0, arg1, arg2) {
arg0.set(getArrayU8FromWasm0(arg1, arg2));
};
imports.wbg.__wbg_set_3f1d0b984ed272ed = function(arg0, arg1, arg2) {
arg0[arg1] = arg2;
};
imports.wbg.__wbg_set_7df433eea03a5c14 = function(arg0, arg1, arg2) {
arg0[arg1 >>> 0] = arg2;
};
imports.wbg.__wbg_set_at_8ed309b95b9da8e8 = function(arg0, arg1) {
arg0.at = arg1;
};
imports.wbg.__wbg_set_create_a7fa115dfd714480 = function(arg0, arg1) {
arg0.create = arg1 !== 0;
};
imports.wbg.__wbg_set_create_c87a4965b38c1564 = function(arg0, arg1) {
arg0.create = arg1 !== 0;
};
imports.wbg.__wbg_set_onmessage_5fe29d0fb54cb575 = function(arg0, arg1) {
arg0.onmessage = arg1;
};
imports.wbg.__wbg_slice_3ab25105e7277633 = function(arg0, arg1, arg2) {
const ret = arg0.slice(arg1 >>> 0, arg2 >>> 0);
return ret;
};
imports.wbg.__wbg_stack_0ed75d68575b0f3c = function(arg0, arg1) {
const ret = arg1.stack;
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
const len1 = WASM_VECTOR_LEN;
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
};
imports.wbg.__wbg_static_accessor_GLOBAL_769e6b65d6557335 = function() {
const ret = typeof global === 'undefined' ? null : global;
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
};
imports.wbg.__wbg_static_accessor_GLOBAL_THIS_60cf02db4de8e1c1 = function() {
const ret = typeof globalThis === 'undefined' ? null : globalThis;
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
};
imports.wbg.__wbg_static_accessor_SELF_08f5a74c69739274 = function() {
const ret = typeof self === 'undefined' ? null : self;
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
};
imports.wbg.__wbg_static_accessor_WINDOW_a8924b26aa92d024 = function() {
const ret = typeof window === 'undefined' ? null : window;
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
};
imports.wbg.__wbg_storage_7db24ea4f9f4aa79 = function(arg0) {
const ret = arg0.storage;
return ret;
};
imports.wbg.__wbg_subarray_845f2f5bce7d061a = function(arg0, arg1, arg2) {
const ret = arg0.subarray(arg1 >>> 0, arg2 >>> 0);
return ret;
};
imports.wbg.__wbg_then_429f7caf1026411d = function(arg0, arg1, arg2) {
const ret = arg0.then(arg1, arg2);
return ret;
};
imports.wbg.__wbg_then_4f95312d68691235 = function(arg0, arg1) {
const ret = arg0.then(arg1);
return ret;
};
imports.wbg.__wbg_toString_42914f2ae774fcf8 = function() { return handleError(function (arg0, arg1) {
const ret = arg0.toString(arg1);
return ret;
}, arguments) };
imports.wbg.__wbg_truncate_07b2629f3dbd9443 = function() { return handleError(function (arg0, arg1) {
arg0.truncate(arg1);
}, arguments) };
imports.wbg.__wbg_truncate_9e72c83b9fc1d156 = function() { return handleError(function (arg0, arg1) {
arg0.truncate(arg1 >>> 0);
}, arguments) };
imports.wbg.__wbg_value_57b7b035e117f7ee = function(arg0) {
const ret = arg0.value;
return ret;
};
imports.wbg.__wbg_view_788aaf149deefd2f = function(arg0) {
const ret = arg0.view;
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
};
imports.wbg.__wbg_warn_6e567d0d926ff881 = function(arg0) {
console.warn(arg0);
};
imports.wbg.__wbg_write_c21838a97defef4b = function() { return handleError(function (arg0, arg1, arg2) {
const ret = arg0.write(arg1, arg2);
return ret;
}, arguments) };
imports.wbg.__wbg_write_f87f327ea3e1dd4b = function() { return handleError(function (arg0, arg1, arg2, arg3) {
const ret = arg0.write(getArrayU8FromWasm0(arg1, arg2), arg3);
return ret;
}, arguments) };
imports.wbg.__wbindgen_cast_2241b6af4c4b2941 = function(arg0, arg1) {
// Cast intrinsic for `Ref(String) -> Externref`.
const ret = getStringFromWasm0(arg0, arg1);
return ret;
};
imports.wbg.__wbindgen_cast_4625c577ab2ec9ee = function(arg0) {
// Cast intrinsic for `U64 -> Externref`.
const ret = BigInt.asUintN(64, arg0);
return ret;
};
imports.wbg.__wbindgen_cast_484b311e26c958d3 = function(arg0, arg1) {
// Cast intrinsic for `Closure(Closure { dtor_idx: 31, function: Function { arguments: [NamedExternref("MessageEvent")], shim_idx: 32, ret: Unit, inner_ret: Some(Unit) }, mutable: false }) -> Externref`.
const ret = makeClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__h0c75566bfa2b51f8, wasm_bindgen__convert__closures_____invoke__h5336b4c4f5394a94);
return ret;
};
imports.wbg.__wbindgen_cast_7b149911c7ce6808 = function(arg0, arg1) {
// Cast intrinsic for `Closure(Closure { dtor_idx: 740, function: Function { arguments: [Externref], shim_idx: 741, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__ha2974c92fa39f26b, wasm_bindgen__convert__closures_____invoke__hc5c04b5ba49ccfb9);
return ret;
};
imports.wbg.__wbindgen_cast_d6cd19b81560fd6e = function(arg0) {
// Cast intrinsic for `F64 -> Externref`.
const ret = arg0;
return ret;
};
imports.wbg.__wbindgen_init_externref_table = function() {
const table = wasm.__wbindgen_externrefs;
const offset = table.grow(4);
table.set(0, undefined);
table.set(offset + 0, undefined);
table.set(offset + 1, null);
table.set(offset + 2, true);
table.set(offset + 3, false);
};
return imports;
}
function __wbg_finalize_init(instance, module) {
wasm = instance.exports;
__wbg_init.__wbindgen_wasm_module = module;
cachedDataViewMemory0 = null;
cachedUint8ArrayMemory0 = null;
wasm.__wbindgen_start();
return wasm;
}
function initSync(module) {
if (wasm !== undefined) return wasm;
if (typeof module !== 'undefined') {
if (Object.getPrototypeOf(module) === Object.prototype) {
({module} = module)
} else {
console.warn('using deprecated parameters for `initSync()`; pass a single object instead')
}
}
const imports = __wbg_get_imports();
if (!(module instanceof WebAssembly.Module)) {
module = new WebAssembly.Module(module);
}
const instance = new WebAssembly.Instance(module, imports);
return __wbg_finalize_init(instance, module);
}
async function __wbg_init(module_or_path) {
if (wasm !== undefined) return wasm;
if (typeof module_or_path !== 'undefined') {
if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
({module_or_path} = module_or_path)
} else {
console.warn('using deprecated parameters for the initialization function; pass a single object instead')
}
}
if (typeof module_or_path === 'undefined') {
module_or_path = new URL('sqlite3_bg.wasm', import.meta.url);
}
const imports = __wbg_get_imports();
if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {
module_or_path = fetch(module_or_path);
}
const { instance, module } = await __wbg_load(await module_or_path, imports);
return __wbg_finalize_init(instance, module);
}
export { initSync };
export default __wbg_init;
BIN
View File
Binary file not shown.
+1
View File
@@ -0,0 +1 @@
import init from './sqlite3.js';await init();
+995
View File
@@ -0,0 +1,995 @@
let wasm;
function addToExternrefTable0(obj) {
const idx = wasm.__externref_table_alloc();
wasm.__wbindgen_externrefs.set(idx, obj);
return idx;
}
const CLOSURE_DTORS = (typeof FinalizationRegistry === 'undefined')
? { register: () => {}, unregister: () => {} }
: new FinalizationRegistry(state => state.dtor(state.a, state.b));
function debugString(val) {
// primitive types
const type = typeof val;
if (type == 'number' || type == 'boolean' || val == null) {
return `${val}`;
}
if (type == 'string') {
return `"${val}"`;
}
if (type == 'symbol') {
const description = val.description;
if (description == null) {
return 'Symbol';
} else {
return `Symbol(${description})`;
}
}
if (type == 'function') {
const name = val.name;
if (typeof name == 'string' && name.length > 0) {
return `Function(${name})`;
} else {
return 'Function';
}
}
// objects
if (Array.isArray(val)) {
const length = val.length;
let debug = '[';
if (length > 0) {
debug += debugString(val[0]);
}
for(let i = 1; i < length; i++) {
debug += ', ' + debugString(val[i]);
}
debug += ']';
return debug;
}
// Test for built-in
const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
let className;
if (builtInMatches && builtInMatches.length > 1) {
className = builtInMatches[1];
} else {
// Failed to match the standard '[object ClassName]'
return toString.call(val);
}
if (className == 'Object') {
// we're a user defined class or Object
// JSON.stringify avoids problems with cycles, and is generally much
// easier than looping through ownProperties of `val`.
try {
return 'Object(' + JSON.stringify(val) + ')';
} catch (_) {
return 'Object';
}
}
// errors
if (val instanceof Error) {
return `${val.name}: ${val.message}\n${val.stack}`;
}
// TODO we could test for more things here, like `Set`s and `Map`s.
return className;
}
function getArrayU8FromWasm0(ptr, len) {
ptr = ptr >>> 0;
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
}
let cachedDataViewMemory0 = null;
function getDataViewMemory0() {
if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
}
return cachedDataViewMemory0;
}
function getStringFromWasm0(ptr, len) {
ptr = ptr >>> 0;
return decodeText(ptr, len);
}
let cachedUint8ArrayMemory0 = null;
function getUint8ArrayMemory0() {
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
}
return cachedUint8ArrayMemory0;
}
function handleError(f, args) {
try {
return f.apply(this, args);
} catch (e) {
const idx = addToExternrefTable0(e);
wasm.__wbindgen_exn_store(idx);
}
}
function isLikeNone(x) {
return x === undefined || x === null;
}
function makeClosure(arg0, arg1, dtor, f) {
const state = { a: arg0, b: arg1, cnt: 1, dtor };
const real = (...args) => {
// First up with a closure we increment the internal reference
// count. This ensures that the Rust closure environment won't
// be deallocated while we're invoking it.
state.cnt++;
try {
return f(state.a, state.b, ...args);
} finally {
real._wbg_cb_unref();
}
};
real._wbg_cb_unref = () => {
if (--state.cnt === 0) {
state.dtor(state.a, state.b);
state.a = 0;
CLOSURE_DTORS.unregister(state);
}
};
CLOSURE_DTORS.register(real, state, state);
return real;
}
function makeMutClosure(arg0, arg1, dtor, f) {
const state = { a: arg0, b: arg1, cnt: 1, dtor };
const real = (...args) => {
// First up with a closure we increment the internal reference
// count. This ensures that the Rust closure environment won't
// be deallocated while we're invoking it.
state.cnt++;
const a = state.a;
state.a = 0;
try {
return f(a, state.b, ...args);
} finally {
state.a = a;
real._wbg_cb_unref();
}
};
real._wbg_cb_unref = () => {
if (--state.cnt === 0) {
state.dtor(state.a, state.b);
state.a = 0;
CLOSURE_DTORS.unregister(state);
}
};
CLOSURE_DTORS.register(real, state, state);
return real;
}
function passStringToWasm0(arg, malloc, realloc) {
if (realloc === undefined) {
const buf = cachedTextEncoder.encode(arg);
const ptr = malloc(buf.length, 1) >>> 0;
getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
WASM_VECTOR_LEN = buf.length;
return ptr;
}
let len = arg.length;
let ptr = malloc(len, 1) >>> 0;
const mem = getUint8ArrayMemory0();
let offset = 0;
for (; offset < len; offset++) {
const code = arg.charCodeAt(offset);
if (code > 0x7F) break;
mem[ptr + offset] = code;
}
if (offset !== len) {
if (offset !== 0) {
arg = arg.slice(offset);
}
ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
const ret = cachedTextEncoder.encodeInto(arg, view);
offset += ret.written;
ptr = realloc(ptr, len, offset, 1) >>> 0;
}
WASM_VECTOR_LEN = offset;
return ptr;
}
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
cachedTextDecoder.decode();
const MAX_SAFARI_DECODE_BYTES = 2146435072;
let numBytesDecoded = 0;
function decodeText(ptr, len) {
numBytesDecoded += len;
if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
cachedTextDecoder.decode();
numBytesDecoded = len;
}
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
}
const cachedTextEncoder = new TextEncoder();
if (!('encodeInto' in cachedTextEncoder)) {
cachedTextEncoder.encodeInto = function (arg, view) {
const buf = cachedTextEncoder.encode(arg);
view.set(buf);
return {
read: arg.length,
written: buf.length
};
}
}
let WASM_VECTOR_LEN = 0;
function wasm_bindgen__convert__closures_____invoke__h4f6eb43b24fe6f3b(arg0, arg1, arg2) {
wasm.wasm_bindgen__convert__closures_____invoke__h4f6eb43b24fe6f3b(arg0, arg1, arg2);
}
function wasm_bindgen__convert__closures_____invoke__hc5c04b5ba49ccfb9(arg0, arg1, arg2) {
wasm.wasm_bindgen__convert__closures_____invoke__hc5c04b5ba49ccfb9(arg0, arg1, arg2);
}
function wasm_bindgen__convert__closures_____invoke__ha942a44eff540ade(arg0, arg1, arg2, arg3) {
wasm.wasm_bindgen__convert__closures_____invoke__ha942a44eff540ade(arg0, arg1, arg2, arg3);
}
const __wbindgen_enum_ReadableStreamType = ["bytes"];
const IntoUnderlyingByteSourceFinalization = (typeof FinalizationRegistry === 'undefined')
? { register: () => {}, unregister: () => {} }
: new FinalizationRegistry(ptr => wasm.__wbg_intounderlyingbytesource_free(ptr >>> 0, 1));
const IntoUnderlyingSinkFinalization = (typeof FinalizationRegistry === 'undefined')
? { register: () => {}, unregister: () => {} }
: new FinalizationRegistry(ptr => wasm.__wbg_intounderlyingsink_free(ptr >>> 0, 1));
const IntoUnderlyingSourceFinalization = (typeof FinalizationRegistry === 'undefined')
? { register: () => {}, unregister: () => {} }
: new FinalizationRegistry(ptr => wasm.__wbg_intounderlyingsource_free(ptr >>> 0, 1));
export class IntoUnderlyingByteSource {
__destroy_into_raw() {
const ptr = this.__wbg_ptr;
this.__wbg_ptr = 0;
IntoUnderlyingByteSourceFinalization.unregister(this);
return ptr;
}
free() {
const ptr = this.__destroy_into_raw();
wasm.__wbg_intounderlyingbytesource_free(ptr, 0);
}
/**
* @returns {number}
*/
get autoAllocateChunkSize() {
const ret = wasm.intounderlyingbytesource_autoAllocateChunkSize(this.__wbg_ptr);
return ret >>> 0;
}
/**
* @param {ReadableByteStreamController} controller
* @returns {Promise<any>}
*/
pull(controller) {
const ret = wasm.intounderlyingbytesource_pull(this.__wbg_ptr, controller);
return ret;
}
/**
* @param {ReadableByteStreamController} controller
*/
start(controller) {
wasm.intounderlyingbytesource_start(this.__wbg_ptr, controller);
}
/**
* @returns {ReadableStreamType}
*/
get type() {
const ret = wasm.intounderlyingbytesource_type(this.__wbg_ptr);
return __wbindgen_enum_ReadableStreamType[ret];
}
cancel() {
const ptr = this.__destroy_into_raw();
wasm.intounderlyingbytesource_cancel(ptr);
}
}
if (Symbol.dispose) IntoUnderlyingByteSource.prototype[Symbol.dispose] = IntoUnderlyingByteSource.prototype.free;
export class IntoUnderlyingSink {
__destroy_into_raw() {
const ptr = this.__wbg_ptr;
this.__wbg_ptr = 0;
IntoUnderlyingSinkFinalization.unregister(this);
return ptr;
}
free() {
const ptr = this.__destroy_into_raw();
wasm.__wbg_intounderlyingsink_free(ptr, 0);
}
/**
* @param {any} reason
* @returns {Promise<any>}
*/
abort(reason) {
const ptr = this.__destroy_into_raw();
const ret = wasm.intounderlyingsink_abort(ptr, reason);
return ret;
}
/**
* @returns {Promise<any>}
*/
close() {
const ptr = this.__destroy_into_raw();
const ret = wasm.intounderlyingsink_close(ptr);
return ret;
}
/**
* @param {any} chunk
* @returns {Promise<any>}
*/
write(chunk) {
const ret = wasm.intounderlyingsink_write(this.__wbg_ptr, chunk);
return ret;
}
}
if (Symbol.dispose) IntoUnderlyingSink.prototype[Symbol.dispose] = IntoUnderlyingSink.prototype.free;
export class IntoUnderlyingSource {
__destroy_into_raw() {
const ptr = this.__wbg_ptr;
this.__wbg_ptr = 0;
IntoUnderlyingSourceFinalization.unregister(this);
return ptr;
}
free() {
const ptr = this.__destroy_into_raw();
wasm.__wbg_intounderlyingsource_free(ptr, 0);
}
/**
* @param {ReadableStreamDefaultController} controller
* @returns {Promise<any>}
*/
pull(controller) {
const ret = wasm.intounderlyingsource_pull(this.__wbg_ptr, controller);
return ret;
}
cancel() {
const ptr = this.__destroy_into_raw();
wasm.intounderlyingsource_cancel(ptr);
}
}
if (Symbol.dispose) IntoUnderlyingSource.prototype[Symbol.dispose] = IntoUnderlyingSource.prototype.free;
const EXPECTED_RESPONSE_TYPES = new Set(['basic', 'cors', 'default']);
async function __wbg_load(module, imports) {
if (typeof Response === 'function' && module instanceof Response) {
if (typeof WebAssembly.instantiateStreaming === 'function') {
try {
return await WebAssembly.instantiateStreaming(module, imports);
} catch (e) {
const validResponse = module.ok && EXPECTED_RESPONSE_TYPES.has(module.type);
if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e);
} else {
throw e;
}
}
}
const bytes = await module.arrayBuffer();
return await WebAssembly.instantiate(bytes, imports);
} else {
const instance = await WebAssembly.instantiate(module, imports);
if (instance instanceof WebAssembly.Instance) {
return { instance, module };
} else {
return instance;
}
}
}
function __wbg_get_imports() {
const imports = {};
imports.wbg = {};
imports.wbg.__wbg_Error_52673b7de5a0ca89 = function(arg0, arg1) {
const ret = Error(getStringFromWasm0(arg0, arg1));
return ret;
};
imports.wbg.__wbg_Number_2d1dcfcf4ec51736 = function(arg0) {
const ret = Number(arg0);
return ret;
};
imports.wbg.__wbg___wbindgen_boolean_get_dea25b33882b895b = function(arg0) {
const v = arg0;
const ret = typeof(v) === 'boolean' ? v : undefined;
return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
};
imports.wbg.__wbg___wbindgen_debug_string_adfb662ae34724b6 = function(arg0, arg1) {
const ret = debugString(arg1);
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
const len1 = WASM_VECTOR_LEN;
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
};
imports.wbg.__wbg___wbindgen_in_0d3e1e8f0c669317 = function(arg0, arg1) {
const ret = arg0 in arg1;
return ret;
};
imports.wbg.__wbg___wbindgen_is_function_8d400b8b1af978cd = function(arg0) {
const ret = typeof(arg0) === 'function';
return ret;
};
imports.wbg.__wbg___wbindgen_is_object_ce774f3490692386 = function(arg0) {
const val = arg0;
const ret = typeof(val) === 'object' && val !== null;
return ret;
};
imports.wbg.__wbg___wbindgen_is_string_704ef9c8fc131030 = function(arg0) {
const ret = typeof(arg0) === 'string';
return ret;
};
imports.wbg.__wbg___wbindgen_is_undefined_f6b95eab589e0269 = function(arg0) {
const ret = arg0 === undefined;
return ret;
};
imports.wbg.__wbg___wbindgen_jsval_loose_eq_766057600fdd1b0d = function(arg0, arg1) {
const ret = arg0 == arg1;
return ret;
};
imports.wbg.__wbg___wbindgen_number_get_9619185a74197f95 = function(arg0, arg1) {
const obj = arg1;
const ret = typeof(obj) === 'number' ? obj : undefined;
getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
};
imports.wbg.__wbg___wbindgen_string_get_a2a31e16edf96e42 = function(arg0, arg1) {
const obj = arg1;
const ret = typeof(obj) === 'string' ? obj : undefined;
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
var len1 = WASM_VECTOR_LEN;
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
};
imports.wbg.__wbg___wbindgen_throw_dd24417ed36fc46e = function(arg0, arg1) {
throw new Error(getStringFromWasm0(arg0, arg1));
};
imports.wbg.__wbg__wbg_cb_unref_87dfb5aaa0cbcea7 = function(arg0) {
arg0._wbg_cb_unref();
};
imports.wbg.__wbg_buffer_6cb2fecb1f253d71 = function(arg0) {
const ret = arg0.buffer;
return ret;
};
imports.wbg.__wbg_byobRequest_f8e3517f5f8ad284 = function(arg0) {
const ret = arg0.byobRequest;
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
};
imports.wbg.__wbg_byteLength_faa9938885bdeee6 = function(arg0) {
const ret = arg0.byteLength;
return ret;
};
imports.wbg.__wbg_byteOffset_3868b6a19ba01dea = function(arg0) {
const ret = arg0.byteOffset;
return ret;
};
imports.wbg.__wbg_call_3020136f7a2d6e44 = function() { return handleError(function (arg0, arg1, arg2) {
const ret = arg0.call(arg1, arg2);
return ret;
}, arguments) };
imports.wbg.__wbg_call_abb4ff46ce38be40 = function() { return handleError(function (arg0, arg1) {
const ret = arg0.call(arg1);
return ret;
}, arguments) };
imports.wbg.__wbg_close_0af5661bf3d335f2 = function() { return handleError(function (arg0) {
arg0.close();
}, arguments) };
imports.wbg.__wbg_close_3ec111e7b23d94d8 = function() { return handleError(function (arg0) {
arg0.close();
}, arguments) };
imports.wbg.__wbg_createSyncAccessHandle_df3bfed7c6bd8d02 = function(arg0) {
const ret = arg0.createSyncAccessHandle();
return ret;
};
imports.wbg.__wbg_data_8bf4ae669a78a688 = function(arg0) {
const ret = arg0.data;
return ret;
};
imports.wbg.__wbg_debug_9d0c87ddda3dc485 = function(arg0) {
console.debug(arg0);
};
imports.wbg.__wbg_done_62ea16af4ce34b24 = function(arg0) {
const ret = arg0.done;
return ret;
};
imports.wbg.__wbg_enqueue_a7e6b1ee87963aad = function() { return handleError(function (arg0, arg1) {
arg0.enqueue(arg1);
}, arguments) };
imports.wbg.__wbg_entries_7de5c9edd116e219 = function(arg0) {
const ret = arg0.entries();
return ret;
};
imports.wbg.__wbg_entries_83c79938054e065f = function(arg0) {
const ret = Object.entries(arg0);
return ret;
};
imports.wbg.__wbg_error_7534b8e9a36f1ab4 = function(arg0, arg1) {
let deferred0_0;
let deferred0_1;
try {
deferred0_0 = arg0;
deferred0_1 = arg1;
console.error(getStringFromWasm0(arg0, arg1));
} finally {
wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
}
};
imports.wbg.__wbg_error_7bc7d576a6aaf855 = function(arg0) {
console.error(arg0);
};
imports.wbg.__wbg_fill_508dd108a821ee20 = function(arg0, arg1, arg2, arg3) {
const ret = arg0.fill(arg1, arg2 >>> 0, arg3 >>> 0);
return ret;
};
imports.wbg.__wbg_flush_554f5177ae6f76cb = function() { return handleError(function (arg0) {
arg0.flush();
}, arguments) };
imports.wbg.__wbg_getDate_b8071ea9fc4f6838 = function(arg0) {
const ret = arg0.getDate();
return ret;
};
imports.wbg.__wbg_getDay_c13a50561112f77a = function(arg0) {
const ret = arg0.getDay();
return ret;
};
imports.wbg.__wbg_getDirectoryHandle_edea923e1d89a19d = function(arg0, arg1, arg2, arg3) {
const ret = arg0.getDirectoryHandle(getStringFromWasm0(arg1, arg2), arg3);
return ret;
};
imports.wbg.__wbg_getDirectory_9beed6c83b6861f5 = function(arg0) {
const ret = arg0.getDirectory();
return ret;
};
imports.wbg.__wbg_getFileHandle_298ee7a4e5a85f84 = function(arg0, arg1, arg2, arg3) {
const ret = arg0.getFileHandle(getStringFromWasm0(arg1, arg2), arg3);
return ret;
};
imports.wbg.__wbg_getFullYear_6ac412e8eee86879 = function(arg0) {
const ret = arg0.getFullYear();
return ret;
};
imports.wbg.__wbg_getHours_52eb417ad6e924e8 = function(arg0) {
const ret = arg0.getHours();
return ret;
};
imports.wbg.__wbg_getMinutes_4097cef8e08622f9 = function(arg0) {
const ret = arg0.getMinutes();
return ret;
};
imports.wbg.__wbg_getMonth_48a392071f9e5017 = function(arg0) {
const ret = arg0.getMonth();
return ret;
};
imports.wbg.__wbg_getRandomValues_a33d3c7f4388c9d7 = function() { return handleError(function (arg0, arg1) {
globalThis.crypto.getRandomValues(getArrayU8FromWasm0(arg0, arg1));
}, arguments) };
imports.wbg.__wbg_getSeconds_d94762aec8103802 = function(arg0) {
const ret = arg0.getSeconds();
return ret;
};
imports.wbg.__wbg_getSize_1bf196c4094d8f7b = function() { return handleError(function (arg0) {
const ret = arg0.getSize();
return ret;
}, arguments) };
imports.wbg.__wbg_getTime_ad1e9878a735af08 = function(arg0) {
const ret = arg0.getTime();
return ret;
};
imports.wbg.__wbg_getTimezoneOffset_45389e26d6f46823 = function(arg0) {
const ret = arg0.getTimezoneOffset();
return ret;
};
imports.wbg.__wbg_getUint32_d63de983274cb44e = function(arg0, arg1) {
const ret = arg0.getUint32(arg1 >>> 0);
return ret;
};
imports.wbg.__wbg_get_6b7bd52aca3f9671 = function(arg0, arg1) {
const ret = arg0[arg1 >>> 0];
return ret;
};
imports.wbg.__wbg_get_af9dab7e9603ea93 = function() { return handleError(function (arg0, arg1) {
const ret = Reflect.get(arg0, arg1);
return ret;
}, arguments) };
imports.wbg.__wbg_get_index_4e7b3f629a0ab9cd = function(arg0, arg1) {
const ret = arg0[arg1 >>> 0];
return ret;
};
imports.wbg.__wbg_get_with_ref_key_1dc361bd10053bfe = function(arg0, arg1) {
const ret = arg0[arg1];
return ret;
};
imports.wbg.__wbg_info_ce6bcc489c22f6f0 = function(arg0) {
console.info(arg0);
};
imports.wbg.__wbg_instanceof_ArrayBuffer_f3320d2419cd0355 = function(arg0) {
let result;
try {
result = arg0 instanceof ArrayBuffer;
} catch (_) {
result = false;
}
const ret = result;
return ret;
};
imports.wbg.__wbg_instanceof_Uint8Array_da54ccc9d3e09434 = function(arg0) {
let result;
try {
result = arg0 instanceof Uint8Array;
} catch (_) {
result = false;
}
const ret = result;
return ret;
};
imports.wbg.__wbg_instanceof_WorkerGlobalScope_9a3411db21c65a54 = function(arg0) {
let result;
try {
result = arg0 instanceof WorkerGlobalScope;
} catch (_) {
result = false;
}
const ret = result;
return ret;
};
imports.wbg.__wbg_isArray_51fd9e6422c0a395 = function(arg0) {
const ret = Array.isArray(arg0);
return ret;
};
imports.wbg.__wbg_isSafeInteger_ae7d3f054d55fa16 = function(arg0) {
const ret = Number.isSafeInteger(arg0);
return ret;
};
imports.wbg.__wbg_iterator_27b7c8b35ab3e86b = function() {
const ret = Symbol.iterator;
return ret;
};
imports.wbg.__wbg_length_1f83b8e5895c84aa = function(arg0) {
const ret = arg0.length;
return ret;
};
imports.wbg.__wbg_length_22ac23eaec9d8053 = function(arg0) {
const ret = arg0.length;
return ret;
};
imports.wbg.__wbg_length_d45040a40c570362 = function(arg0) {
const ret = arg0.length;
return ret;
};
imports.wbg.__wbg_log_1d990106d99dacb7 = function(arg0) {
console.log(arg0);
};
imports.wbg.__wbg_navigator_11b7299bb7886507 = function(arg0) {
const ret = arg0.navigator;
return ret;
};
imports.wbg.__wbg_new_0_23cedd11d9b40c9d = function() {
const ret = new Date();
return ret;
};
imports.wbg.__wbg_new_1ba21ce319a06297 = function() {
const ret = new Object();
return ret;
};
imports.wbg.__wbg_new_23eee00e990dac7f = function(arg0, arg1, arg2) {
const ret = new DataView(arg0, arg1 >>> 0, arg2 >>> 0);
return ret;
};
imports.wbg.__wbg_new_25f239778d6112b9 = function() {
const ret = new Array();
return ret;
};
imports.wbg.__wbg_new_6421f6084cc5bc5a = function(arg0) {
const ret = new Uint8Array(arg0);
return ret;
};
imports.wbg.__wbg_new_8a6f238a6ece86ea = function() {
const ret = new Error();
return ret;
};
imports.wbg.__wbg_new_b2db8aa2650f793a = function(arg0) {
const ret = new Date(arg0);
return ret;
};
imports.wbg.__wbg_new_df1173567d5ff028 = function(arg0, arg1) {
const ret = new Error(getStringFromWasm0(arg0, arg1));
return ret;
};
imports.wbg.__wbg_new_ff12d2b041fb48f1 = function(arg0, arg1) {
try {
var state0 = {a: arg0, b: arg1};
var cb0 = (arg0, arg1) => {
const a = state0.a;
state0.a = 0;
try {
return wasm_bindgen__convert__closures_____invoke__ha942a44eff540ade(a, state0.b, arg0, arg1);
} finally {
state0.a = a;
}
};
const ret = new Promise(cb0);
return ret;
} finally {
state0.a = state0.b = 0;
}
};
imports.wbg.__wbg_new_from_slice_f9c22b9153b26992 = function(arg0, arg1) {
const ret = new Uint8Array(getArrayU8FromWasm0(arg0, arg1));
return ret;
};
imports.wbg.__wbg_new_no_args_cb138f77cf6151ee = function(arg0, arg1) {
const ret = new Function(getStringFromWasm0(arg0, arg1));
return ret;
};
imports.wbg.__wbg_new_with_byte_offset_and_length_d85c3da1fd8df149 = function(arg0, arg1, arg2) {
const ret = new Uint8Array(arg0, arg1 >>> 0, arg2 >>> 0);
return ret;
};
imports.wbg.__wbg_new_with_length_aa5eaf41d35235e5 = function(arg0) {
const ret = new Uint8Array(arg0 >>> 0);
return ret;
};
imports.wbg.__wbg_new_with_year_month_day_2ce3621d93185809 = function(arg0, arg1, arg2) {
const ret = new Date(arg0 >>> 0, arg1, arg2);
return ret;
};
imports.wbg.__wbg_next_138a17bbf04e926c = function(arg0) {
const ret = arg0.next;
return ret;
};
imports.wbg.__wbg_next_3cfe5c0fe2a4cc53 = function() { return handleError(function (arg0) {
const ret = arg0.next();
return ret;
}, arguments) };
imports.wbg.__wbg_next_b34c09a202bf4424 = function() { return handleError(function (arg0) {
const ret = arg0.next();
return ret;
}, arguments) };
imports.wbg.__wbg_postMessage_7243f814e0cfb266 = function() { return handleError(function (arg0, arg1) {
arg0.postMessage(arg1);
}, arguments) };
imports.wbg.__wbg_prototypesetcall_dfe9b766cdc1f1fd = function(arg0, arg1, arg2) {
Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
};
imports.wbg.__wbg_queueMicrotask_9b549dfce8865860 = function(arg0) {
const ret = arg0.queueMicrotask;
return ret;
};
imports.wbg.__wbg_queueMicrotask_fca69f5bfad613a5 = function(arg0) {
queueMicrotask(arg0);
};
imports.wbg.__wbg_random_cc1f9237d866d212 = function() {
const ret = Math.random();
return ret;
};
imports.wbg.__wbg_read_0063be96fda4ddbb = function() { return handleError(function (arg0, arg1, arg2, arg3) {
const ret = arg0.read(getArrayU8FromWasm0(arg1, arg2), arg3);
return ret;
}, arguments) };
imports.wbg.__wbg_read_6d42da91294142f6 = function() { return handleError(function (arg0, arg1, arg2) {
const ret = arg0.read(arg1, arg2);
return ret;
}, arguments) };
imports.wbg.__wbg_resolve_fd5bfbaa4ce36e1e = function(arg0) {
const ret = Promise.resolve(arg0);
return ret;
};
imports.wbg.__wbg_respond_9f7fc54636c4a3af = function() { return handleError(function (arg0, arg1) {
arg0.respond(arg1 >>> 0);
}, arguments) };
imports.wbg.__wbg_setUint32_6ee364ad2096f0ed = function(arg0, arg1, arg2) {
arg0.setUint32(arg1 >>> 0, arg2 >>> 0);
};
imports.wbg.__wbg_set_169e13b608078b7b = function(arg0, arg1, arg2) {
arg0.set(getArrayU8FromWasm0(arg1, arg2));
};
imports.wbg.__wbg_set_3f1d0b984ed272ed = function(arg0, arg1, arg2) {
arg0[arg1] = arg2;
};
imports.wbg.__wbg_set_7df433eea03a5c14 = function(arg0, arg1, arg2) {
arg0[arg1 >>> 0] = arg2;
};
imports.wbg.__wbg_set_at_8ed309b95b9da8e8 = function(arg0, arg1) {
arg0.at = arg1;
};
imports.wbg.__wbg_set_create_a7fa115dfd714480 = function(arg0, arg1) {
arg0.create = arg1 !== 0;
};
imports.wbg.__wbg_set_create_c87a4965b38c1564 = function(arg0, arg1) {
arg0.create = arg1 !== 0;
};
imports.wbg.__wbg_set_onmessage_5fe29d0fb54cb575 = function(arg0, arg1) {
arg0.onmessage = arg1;
};
imports.wbg.__wbg_slice_3ab25105e7277633 = function(arg0, arg1, arg2) {
const ret = arg0.slice(arg1 >>> 0, arg2 >>> 0);
return ret;
};
imports.wbg.__wbg_stack_0ed75d68575b0f3c = function(arg0, arg1) {
const ret = arg1.stack;
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
const len1 = WASM_VECTOR_LEN;
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
};
imports.wbg.__wbg_static_accessor_GLOBAL_769e6b65d6557335 = function() {
const ret = typeof global === 'undefined' ? null : global;
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
};
imports.wbg.__wbg_static_accessor_GLOBAL_THIS_60cf02db4de8e1c1 = function() {
const ret = typeof globalThis === 'undefined' ? null : globalThis;
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
};
imports.wbg.__wbg_static_accessor_SELF_08f5a74c69739274 = function() {
const ret = typeof self === 'undefined' ? null : self;
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
};
imports.wbg.__wbg_static_accessor_WINDOW_a8924b26aa92d024 = function() {
const ret = typeof window === 'undefined' ? null : window;
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
};
imports.wbg.__wbg_storage_7db24ea4f9f4aa79 = function(arg0) {
const ret = arg0.storage;
return ret;
};
imports.wbg.__wbg_subarray_845f2f5bce7d061a = function(arg0, arg1, arg2) {
const ret = arg0.subarray(arg1 >>> 0, arg2 >>> 0);
return ret;
};
imports.wbg.__wbg_then_429f7caf1026411d = function(arg0, arg1, arg2) {
const ret = arg0.then(arg1, arg2);
return ret;
};
imports.wbg.__wbg_then_4f95312d68691235 = function(arg0, arg1) {
const ret = arg0.then(arg1);
return ret;
};
imports.wbg.__wbg_toString_42914f2ae774fcf8 = function() { return handleError(function (arg0, arg1) {
const ret = arg0.toString(arg1);
return ret;
}, arguments) };
imports.wbg.__wbg_truncate_07b2629f3dbd9443 = function() { return handleError(function (arg0, arg1) {
arg0.truncate(arg1);
}, arguments) };
imports.wbg.__wbg_truncate_9e72c83b9fc1d156 = function() { return handleError(function (arg0, arg1) {
arg0.truncate(arg1 >>> 0);
}, arguments) };
imports.wbg.__wbg_value_57b7b035e117f7ee = function(arg0) {
const ret = arg0.value;
return ret;
};
imports.wbg.__wbg_view_788aaf149deefd2f = function(arg0) {
const ret = arg0.view;
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
};
imports.wbg.__wbg_warn_6e567d0d926ff881 = function(arg0) {
console.warn(arg0);
};
imports.wbg.__wbg_write_c21838a97defef4b = function() { return handleError(function (arg0, arg1, arg2) {
const ret = arg0.write(arg1, arg2);
return ret;
}, arguments) };
imports.wbg.__wbg_write_f87f327ea3e1dd4b = function() { return handleError(function (arg0, arg1, arg2, arg3) {
const ret = arg0.write(getArrayU8FromWasm0(arg1, arg2), arg3);
return ret;
}, arguments) };
imports.wbg.__wbindgen_cast_2241b6af4c4b2941 = function(arg0, arg1) {
// Cast intrinsic for `Ref(String) -> Externref`.
const ret = getStringFromWasm0(arg0, arg1);
return ret;
};
imports.wbg.__wbindgen_cast_30a9d87a68d4675c = function(arg0, arg1) {
// Cast intrinsic for `Closure(Closure { dtor_idx: 904, function: Function { arguments: [Externref], shim_idx: 905, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__ha2974c92fa39f26b, wasm_bindgen__convert__closures_____invoke__hc5c04b5ba49ccfb9);
return ret;
};
imports.wbg.__wbindgen_cast_4625c577ab2ec9ee = function(arg0) {
// Cast intrinsic for `U64 -> Externref`.
const ret = BigInt.asUintN(64, arg0);
return ret;
};
imports.wbg.__wbindgen_cast_d6cd19b81560fd6e = function(arg0) {
// Cast intrinsic for `F64 -> Externref`.
const ret = arg0;
return ret;
};
imports.wbg.__wbindgen_cast_e9a535cf6449adba = function(arg0, arg1) {
// Cast intrinsic for `Closure(Closure { dtor_idx: 93, function: Function { arguments: [NamedExternref("MessageEvent")], shim_idx: 94, ret: Unit, inner_ret: Some(Unit) }, mutable: false }) -> Externref`.
const ret = makeClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__h3e181ecbfa4f8f16, wasm_bindgen__convert__closures_____invoke__h4f6eb43b24fe6f3b);
return ret;
};
imports.wbg.__wbindgen_init_externref_table = function() {
const table = wasm.__wbindgen_externrefs;
const offset = table.grow(4);
table.set(0, undefined);
table.set(offset + 0, undefined);
table.set(offset + 1, null);
table.set(offset + 2, true);
table.set(offset + 3, false);
};
return imports;
}
function __wbg_finalize_init(instance, module) {
wasm = instance.exports;
__wbg_init.__wbindgen_wasm_module = module;
cachedDataViewMemory0 = null;
cachedUint8ArrayMemory0 = null;
wasm.__wbindgen_start();
return wasm;
}
function initSync(module) {
if (wasm !== undefined) return wasm;
if (typeof module !== 'undefined') {
if (Object.getPrototypeOf(module) === Object.prototype) {
({module} = module)
} else {
console.warn('using deprecated parameters for `initSync()`; pass a single object instead')
}
}
const imports = __wbg_get_imports();
if (!(module instanceof WebAssembly.Module)) {
module = new WebAssembly.Module(module);
}
const instance = new WebAssembly.Instance(module, imports);
return __wbg_finalize_init(instance, module);
}
async function __wbg_init(module_or_path) {
if (wasm !== undefined) return wasm;
if (typeof module_or_path !== 'undefined') {
if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
({module_or_path} = module_or_path)
} else {
console.warn('using deprecated parameters for the initialization function; pass a single object instead')
}
}
if (typeof module_or_path === 'undefined') {
module_or_path = new URL('sqlite3mc_bg.wasm', import.meta.url);
}
const imports = __wbg_get_imports();
if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {
module_or_path = fetch(module_or_path);
}
const { instance, module } = await __wbg_load(await module_or_path, imports);
return __wbg_finalize_init(instance, module);
}
export { initSync };
export default __wbg_init;
BIN
View File
Binary file not shown.
+1
View File
@@ -0,0 +1 @@
import init from './sqlite3mc.js';await init();
-55
View File
@@ -1,55 +0,0 @@
use leptos::prelude::*;
use reactive_stores::Store;
use crate::app::{
GlobalState, GlobalStateStoreFields, config_element::Either, menu_aside::MenuAside,
menu_group::MenuGroup,
};
#[component]
pub fn AdvancedOptionsMenu() -> impl IntoView {
let state = expect_context::<Store<GlobalState>>();
view! {
<>
<MenuGroup title="Advanced options".into()>
<Either
id="run_selected_sql".into()
name="Run Selected SQL".into()
a=true
b=false
a_label=Some("On".to_string())
b_label=Some("Off".to_string())
value=move || *state.run_selected_sql().read()
is_default=Box::new(move || !*state.run_selected_sql().read())
on_change=move |value: &bool| {
state.run_selected_sql().set(*value);
}
/>
<Either
aside=Some(
view! {
<MenuAside>
"Using an encrypted database.
https://github.com/utelle/SQLite3MultipleCiphers
https://utelle.github.io/SQLite3MultipleCiphers"
</MenuAside>
}
.into_any(),
)
id="multiple_ciphers".into()
name="Multiple Ciphers".into()
a=true
b=false
a_label=Some("On".to_string())
b_label=Some("Off".to_string())
value=move || *state.multiple_ciphers().read()
is_default=Box::new(move || !*state.multiple_ciphers().read())
on_change=move |value: &bool| {
state.multiple_ciphers().set(*value);
}
/>
</MenuGroup>
</>
}
}
-25
View File
@@ -1,25 +0,0 @@
use istyles::istyles;
use leptos::prelude::*;
use web_sys::MouseEvent;
use crate::app::menu_item::MenuItem;
istyles!(
styles,
"assets/module.postcss/button_menu_item.module.css.map"
);
#[component]
pub fn ButtonMenuItem<C>(name: String, on_click: C, children: Children) -> impl IntoView
where
C: Fn(MouseEvent) + Send + 'static,
{
view! {
<MenuItem>
<button class=styles::container on:click=on_click>
<div class=styles::name>{name}</div>
<div class=styles::description>{children()}</div>
</button>
</MenuItem>
}
}
-96
View File
@@ -1,96 +0,0 @@
use istyles::istyles;
use leptos::{prelude::*, tachys::html};
use web_sys::MouseEvent;
istyles!(styles, "assets/module.postcss/button_set.module.css.map");
#[component]
pub fn ButtonSet(
#[prop(default = String::new())] class_name: String,
children: Children,
) -> impl IntoView {
let class = format!("{} {}", styles::set, class_name);
view! { <div class=class>{children()}</div> }
}
#[component]
pub fn Button<C>(
#[prop(default = false)] is_primary: bool,
#[prop(default = false)] is_small: bool,
#[prop(optional)] icon_left: Option<AnyView>,
#[prop(optional)] icon_right: Option<AnyView>,
#[prop(optional)] node_ref: NodeRef<html::element::Button>,
on_click: C,
children: Children,
) -> impl IntoView
where
C: FnMut(MouseEvent) + Send + 'static,
{
let class = format!(
"{} {}",
if is_primary {
styles::primary
} else {
styles::secondary
},
if is_small { styles::small } else { "" }
);
let icon_left = move || {
if let Some(icon) = icon_left {
view! { <span class=styles::iconLeft>{icon}</span> }.into_any()
} else {
().into_any()
}
};
let icon_right = move || {
if let Some(icon) = icon_right {
view! { <span class=styles::iconRight>{icon}</span> }.into_any()
} else {
().into_any()
}
};
view! {
<button type="button" class=class on:click=on_click node_ref=node_ref>
{icon_left()}
{children()}
{icon_right()}
</button>
}
}
#[component]
pub fn Rule() -> impl IntoView {
view! { <span class=styles::rule /> }
}
#[component]
pub fn IconButton<C>(
#[prop(default = false)] is_small: bool,
#[prop(optional)] node_ref: NodeRef<html::element::Button>,
on_click: C,
children: Children,
) -> impl IntoView
where
C: FnMut(MouseEvent) + Send + 'static,
{
let style = if is_small { styles::small } else { "" };
let style = format!("{} {style}", styles::icon);
view! {
<button node_ref=node_ref class=style on:click=on_click>
{children()}
</button>
}
}
#[component]
pub fn LinkButton(href: String, children: Children) -> impl IntoView {
view! {
<a class=styles::icon href=href target="_blank">
{children()}
</a>
}
}
-129
View File
@@ -1,129 +0,0 @@
use std::sync::Arc;
use istyles::istyles;
use leptos::prelude::*;
use web_sys::Event;
use crate::app::menu_item::MenuItem;
istyles!(
styles,
"assets/module.postcss/config_element.module.css.map"
);
#[component]
pub fn Either<E, V, T>(
#[prop(default =None)] aside: Option<AnyView>,
on_change: E,
id: String,
a: T,
b: T,
a_label: Option<String>,
b_label: Option<String>,
value: V,
name: String,
#[prop(default = Box::new(|| true))] is_default: Box<dyn Fn() -> bool + Send>,
) -> impl IntoView
where
E: Fn(&T) + Send + Sync + 'static,
V: Fn() -> T + Send + Sync + 'static,
T: PartialEq + Eq + Send + Sync + ToString + 'static,
{
let a_label = if let Some(label) = a_label {
label
} else {
a.to_string()
};
let b_label = if let Some(label) = b_label {
label
} else {
b.to_string()
};
let a_id = format!("{id}-a");
let b_id = format!("{id}-b");
let on_change1 = Arc::new(on_change);
let on_change2 = Arc::clone(&on_change1);
let value1 = Arc::new(value);
let value2 = Arc::clone(&value1);
let a_value = a.to_string();
let b_value = b.to_string();
let a1 = Arc::new(a);
let a2 = Arc::clone(&a1);
let b1 = Arc::new(b);
let b2 = Arc::clone(&b1);
view! {
<ConfigElement name=name is_default=is_default aside>
<div class=styles::toggle>
<input
id=a_id.clone()
name=id.clone()
value=a_value
type="radio"
checked=move || value1().eq(&a1)
on:change=move |_ev| on_change1(&a2)
/>
<label for=a_id>{a_label}</label>
<input
id=b_id.clone()
name=id.clone()
value=b_value
type="radio"
checked=move || value2().eq(&b1)
on:change=move |_ev| on_change2(&b2)
/>
<label for=b_id>{b_label}</label>
</div>
</ConfigElement>
}
}
#[component]
pub fn Select<E>(
on_change: E,
name: String,
#[prop(default = Box::new(|| true))] is_default: Box<dyn Fn() -> bool + Send>,
children: Children,
) -> impl IntoView
where
E: FnMut(Event) + Send + 'static,
{
view! {
<ConfigElement name=name is_default=is_default>
<select class=styles::select on:change=on_change>
{children()}
</select>
</ConfigElement>
}
}
#[component]
pub fn ConfigElement(
name: String,
#[prop(default =None)] aside: Option<AnyView>,
#[prop(default = Box::new(|| true))] is_default: Box<dyn Fn() -> bool + Send>,
children: Children,
) -> impl IntoView {
let style = move || {
if is_default() {
styles::name
} else {
styles::notDefault
}
};
view! {
<MenuItem>
<div class=styles::container>
<span class=style>{name}</span>
<div class=styles::value>{children()}</div>
</div>
{aside}
</MenuItem>
}
}
-122
View File
@@ -1,122 +0,0 @@
use leptos::prelude::*;
use reactive_stores::Store;
use wasm_bindgen::JsValue;
use web_sys::{Event, HtmlSelectElement};
use crate::app::{
GlobalState, GlobalStateStoreFields, Orientation, Theme,
config_element::Select as SelectConfig, menu_group::MenuGroup,
};
const ACE_KEYBOARDS: [&str; 5] = ["ace", "emacs", "sublime", "vim", "vscode"];
const ACE_THEMES: [&str; 6] = [
"github",
"github_dark",
"github_light_default",
"gruvbox",
"gruvbox_light_hard",
"gruvbox_dark_hard",
];
fn selecet_view(s: &str, selected: &str) -> AnyView {
if s == selected {
view! {
<option selected value=s>
{s}
</option>
}
.into_any()
} else {
view! { <option value=s>{s}</option> }.into_any()
}
}
#[component]
pub fn ConfigMenu() -> impl IntoView {
let state = expect_context::<Store<GlobalState>>();
let ace_keyboard_change = move |event: Event| {
if let Some(target) = event.target() {
let select = HtmlSelectElement::from(JsValue::from(target));
state.editor_config().write().keyboard = select.value();
}
};
let light_ace_theme_change = move |event: Event| {
if let Some(target) = event.target() {
let select = HtmlSelectElement::from(JsValue::from(target));
state.editor_config().write().light_theme = select.value();
}
};
let dark_ace_theme_change = move |event: Event| {
if let Some(target) = event.target() {
let select = HtmlSelectElement::from(JsValue::from(target));
state.editor_config().write().dark_theme = select.value();
}
};
let theme_change = move |event: Event| {
if let Some(target) = event.target() {
let select = HtmlSelectElement::from(JsValue::from(target));
state.theme().set(Theme::from_select(&select.value()));
}
};
let orientation_change = move |event: Event| {
if let Some(target) = event.target() {
let select = HtmlSelectElement::from(JsValue::from(target));
state
.orientation()
.set(Orientation::from_select(&select.value()));
}
};
view! {
<MenuGroup title="Editor".into()>
<SelectConfig name="Keybinding".into() on_change=ace_keyboard_change>
{move || {
ACE_KEYBOARDS
.into_iter()
.map(|s| selecet_view(s, &state.editor_config().read().keyboard))
.collect_view()
}}
</SelectConfig>
<SelectConfig name="Light Theme".into() on_change=light_ace_theme_change>
{move || {
ACE_THEMES
.into_iter()
.map(|s| selecet_view(s, &state.editor_config().read().light_theme))
.collect_view()
}}
</SelectConfig>
<SelectConfig name="Dark Theme".into() on_change=dark_ace_theme_change>
{move || {
ACE_THEMES
.into_iter()
.map(|s| selecet_view(s, &state.editor_config().read().dark_theme))
.collect_view()
}}
</SelectConfig>
</MenuGroup>
<MenuGroup title="UI".into()>
<SelectConfig name="Theme".into() on_change=theme_change>
{move || {
["System", "Light", "Dark"]
.into_iter()
.map(|s| selecet_view(s, &state.theme().read().select()))
.collect_view()
}}
</SelectConfig>
<SelectConfig name="Orientation".into() on_change=orientation_change>
{move || {
["Automatic", "Horizontal", "Vertical"]
.into_iter()
.map(|s| selecet_view(s, &state.orientation().read().select()))
.collect_view()
}}
</SelectConfig>
</MenuGroup>
}
}
-36
View File
@@ -1,36 +0,0 @@
use leptos::prelude::*;
use reactive_stores::Store;
use crate::app::{
GlobalState, GlobalStateStoreFields, menu_group::MenuGroup, select_one::SelectOne,
};
#[component]
pub fn ContextMenu() -> impl IntoView {
let state = expect_context::<Store<GlobalState>>();
view! {
<MenuGroup title="Choose whether to keep the context".into()>
<SelectOne
name="Drop Context".into()
current_value=move || { *state.keep_ctx().read() }
this_value=false
change_value=move || {
state.keep_ctx().set(false);
}
>
"Each execution is in a new DB."
</SelectOne>
<SelectOne
name="Keep Context".into()
current_value=move || { *state.keep_ctx().read() }
this_value=true
change_value=move || {
state.keep_ctx().set(true);
}
>
"Keep the results of each execution."
</SelectOne>
</MenuGroup>
}
}
-22
View File
@@ -1,22 +0,0 @@
use leptos::prelude::*;
use web_sys::MouseEvent;
use crate::app::{button_menu_item::ButtonMenuItem, menu_aside::MenuAside, menu_group::MenuGroup};
#[component]
pub fn DatabaseMenu<L, D>(load: L, download: D) -> impl IntoView
where
L: Fn(MouseEvent) + Send + 'static,
D: Fn(MouseEvent) + Send + 'static,
{
view! {
<MenuGroup title="Database".into()>
<ButtonMenuItem name="Load".into() on_click=load>
<MenuAside>"The KEEP CONTEXT will be automatically enabled."</MenuAside>
</ButtonMenuItem>
<ButtonMenuItem name="Download".into() on_click=download>
<MenuAside>"Will be downloaded as test.db."</MenuAside>
</ButtonMenuItem>
</MenuGroup>
}
}
-76
View File
@@ -1,76 +0,0 @@
use aceditor::{BindKey, EditorOptionsBuilder};
use istyles::istyles;
use leptos::prelude::*;
use reactive_stores::Store;
use wasm_bindgen::{JsCast, prelude::Closure};
use web_sys::UrlSearchParams;
use crate::{
SQLightError,
app::{GlobalState, GlobalStateStoreFields, header::execute},
};
istyles!(styles, "assets/module.postcss/editor.module.css.map");
#[component]
pub fn Editor() -> impl IntoView {
let state = expect_context::<Store<GlobalState>>();
let editor_ref = NodeRef::new();
editor_ref.on_load(move |_| {
let shared_code = || {
let search = window().location().search().ok()?;
let params = UrlSearchParams::new_with_str(&search).ok()?;
params.get("code")
};
let opt = EditorOptionsBuilder::default()
.mode("ace/mode/sql")
.theme(&format!(
"ace/theme/{}",
state.editor_config().read_untracked().light_theme
))
.keyboard(
{
let keyboard = &state.editor_config().read_untracked().keyboard;
(keyboard != "ace").then_some(format!("ace/keyboard/{keyboard}"))
}
.as_deref(),
)
.value(&shared_code().unwrap_or_else(|| state.sql().get_untracked()))
.build();
match aceditor::Editor::open("ace_editor", Some(&opt)) {
Ok(editor) => {
let exec = Closure::<dyn Fn() + 'static>::new(execute(state));
let command = aceditor::Command {
name: "executeCode".into(),
bind_key: BindKey {
win: "Ctrl-Enter".into(),
mac: "Ctrl-Enter|Command-Enter".into(),
},
exec: exec.as_ref().unchecked_ref::<js_sys::Function>().clone(),
read_only: true,
};
exec.forget();
editor.add_command(command);
state.editor().set(Some(editor));
}
Err(err) => state
.last_error()
.set(Some(SQLightError::new_ace_editor(err))),
}
if let Err(err) = aceditor::Editor::define_vim_w(execute(state)) {
state
.last_error()
.set(Some(SQLightError::new_ace_editor(err)));
}
});
view! {
<div class=styles::container>
<div node_ref=editor_ref id="ace_editor" class=styles::ace></div>
</div>
}
}
-474
View File
@@ -1,474 +0,0 @@
use istyles::istyles;
use leptos::{html::Input, prelude::*, tachys::html};
use reactive_stores::Store;
use sqlformat::{FormatOptions, QueryParams};
use wasm_bindgen::{JsCast, prelude::Closure};
use web_sys::{Blob, Event, FileReader, HtmlInputElement, MouseEvent, Url, UrlSearchParams};
use crate::{
FragileComfirmed, LoadDbOptions, RunOptions, SQLightError, WorkerRequest,
app::{
ImportProgress,
advanced_options_menu::AdvancedOptionsMenu,
button_set::{Button, ButtonSet, IconButton, LinkButton, Rule},
config_menu::ConfigMenu,
context_menu::ContextMenu,
database_menu::DatabaseMenu,
icon::{build_icon, config_icon, expandable_icon, github_icon, more_options_icon},
output::change_focus,
pop_button::PopButton,
state::{Focus, GlobalState, GlobalStateStoreFields},
tools_menu::ToolsMenu,
vfs_menu::VfsMenu,
},
send_request,
};
istyles!(styles, "assets/module.postcss/header.module.css.map");
#[component]
pub fn Header() -> impl IntoView {
let menu_container = NodeRef::new();
let input_ref = NodeRef::new();
view! {
<>
<div id="header" class=styles::container>
<div class=styles::left>
<ButtonSet>
<ExecuteButton />
</ButtonSet>
<ButtonSet>
<VfsMenuButton menu_container=menu_container />
<Rule />
<ContextMenuButton menu_container=menu_container />
<Rule />
<AdvancedOptionsMenuButton menu_container=menu_container />
</ButtonSet>
</div>
<div class=styles::right>
<input type="file" node_ref=input_ref style="display: none" />
<ButtonSet>
<ShareButton />
</ButtonSet>
<ButtonSet>
<DatabaseButton input_ref=input_ref menu_container=menu_container />
</ButtonSet>
<ButtonSet>
<ToolsButton menu_container=menu_container />
</ButtonSet>
<ButtonSet>
<ConfigMenuButton menu_container=menu_container />
</ButtonSet>
<ButtonSet>
<GithubButton />
</ButtonSet>
</div>
</div>
<div node_ref=menu_container></div>
</>
}
}
pub fn execute(state: Store<GlobalState>) -> Box<dyn Fn() + Send + 'static> {
Box::new(move || {
let editor_guard = state.editor().read_untracked();
let Some(editor) = editor_guard.as_ref() else {
return;
};
let (code, selected_code) = (editor.get_value(), editor.get_selected_value());
drop(editor_guard);
state.sql().set(code.clone());
change_focus(state, Some(Focus::Execute));
std::mem::take(&mut *state.output().write());
let run_selected_code =
!selected_code.is_empty() && state.run_selected_sql().get_untracked();
send_request(
state,
WorkerRequest::Run(RunOptions {
embed: false,
sql: if run_selected_code {
selected_code
} else {
code
},
clear_on_prepare: !*state.keep_ctx().read_untracked(),
}),
);
})
}
#[component]
fn ExecuteButton() -> impl IntoView {
let state = expect_context::<Store<GlobalState>>();
let on_click = execute(state);
view! {
<Button is_primary=true icon_right=build_icon() on_click=move |_| on_click()>
"Run"
</Button>
}
}
#[component]
fn VfsMenuButton(menu_container: NodeRef<html::element::Div>) -> impl IntoView {
let state = expect_context::<Store<GlobalState>>();
let button = move |toggle, node_ref| {
view! {
<Button icon_right=expandable_icon() on_click=toggle node_ref=node_ref>
{move || state.vfs().read().value()}
</Button>
}
.into_any()
};
view! {
<PopButton
button=button
menu=Box::new(|_close| { view! { <VfsMenu /> }.into_any() })
menu_container=menu_container
></PopButton>
}
}
#[component]
fn ContextMenuButton(menu_container: NodeRef<html::element::Div>) -> impl IntoView {
let state = expect_context::<Store<GlobalState>>();
let button = move |toggle, node_ref| {
view! {
<Button icon_right=expandable_icon() on_click=toggle node_ref=node_ref>
{move || if *state.keep_ctx().read() { "Keep Context" } else { "Drop Context" }}
</Button>
}
.into_any()
};
view! {
<PopButton
button=button
menu=Box::new(|_close| { view! { <ContextMenu /> }.into_any() })
menu_container=menu_container
></PopButton>
}
}
#[component]
fn ConfigMenuButton(menu_container: NodeRef<html::element::Div>) -> impl IntoView {
let button = |toggle, node_ref| {
view! {
<Button
icon_left=config_icon()
icon_right=expandable_icon()
on_click=toggle
node_ref=node_ref
>
"Config"
</Button>
}
.into_any()
};
view! {
<PopButton
button=button
menu=Box::new(|_close| { view! { <ConfigMenu /> }.into_any() })
menu_container=menu_container
></PopButton>
}
}
#[component]
fn AdvancedOptionsMenuButton(menu_container: NodeRef<html::element::Div>) -> impl IntoView {
let button = |toggle, node_ref| {
view! {
<IconButton on_click=toggle node_ref=node_ref>
{more_options_icon()}
</IconButton>
}
.into_any()
};
view! {
<PopButton
button=button
menu=Box::new(|_close| { view! { <AdvancedOptionsMenu /> }.into_any() })
menu_container=menu_container
></PopButton>
}
}
#[component]
fn ToolsButton(menu_container: NodeRef<html::element::Div>) -> impl IntoView {
let state = expect_context::<Store<GlobalState>>();
let button = |toggle, node_ref| {
view! {
<Button icon_right=expandable_icon() on_click=toggle node_ref=node_ref>
"Tools"
</Button>
}
.into_any()
};
let on_format = move |_event, signal: WriteSignal<bool>| {
let Some(editor) = &*state.editor().read() else {
return;
};
let format_options = FormatOptions {
uppercase: Some(true),
lines_between_queries: 2,
..Default::default()
};
let sql = sqlformat::format(
&editor.get_value(),
&QueryParams::default(),
&format_options,
);
editor.set_value(sql);
signal.set(false);
};
let on_embed = move |_event, signal: WriteSignal<bool>| {
let editor_guard = state.editor().read_untracked();
let Some(editor) = editor_guard.as_ref() else {
return;
};
let sql = editor.get_value();
drop(editor_guard);
send_request(
state,
WorkerRequest::Run(RunOptions {
embed: true,
sql,
clear_on_prepare: !*state.keep_ctx().read_untracked(),
}),
);
signal.set(false);
};
view! {
<PopButton
button=button
menu=Box::new(move |signal: WriteSignal<bool>| {
view! {
<ToolsMenu
on_format=move |e| {
on_format(e, signal);
}
on_embed=move |e| {
on_embed(e, signal);
}
on_internal=move |_| {
signal.set(false);
}
/>
}
.into_any()
})
menu_container=menu_container
></PopButton>
}
}
#[component]
fn DatabaseButton(
input_ref: NodeRef<Input>,
menu_container: NodeRef<html::element::Div>,
) -> impl IntoView {
let state = expect_context::<Store<GlobalState>>();
let button = |toggle, node_ref| {
view! {
<Button icon_right=expandable_icon() on_click=toggle node_ref=node_ref>
"Database"
</Button>
}
.into_any()
};
let (file, set_file) = signal::<Option<FragileComfirmed<web_sys::File>>>(None);
Effect::new(move || {
if let Some(file) = &*file.read() {
let filename = file.name();
if let Ok(reader) = FileReader::new() {
let on_progress = FragileComfirmed::new(Closure::wrap(Box::new(
move |ev: web_sys::ProgressEvent| {
if ev.length_computable() {
state.import_progress().set(Some(ImportProgress {
filename: filename.clone(),
loaded: ev.loaded(),
total: ev.total(),
opened: None,
}));
}
},
)
as Box<dyn FnMut(_)>));
let on_error = FragileComfirmed::new(Closure::wrap(Box::new(
move |ev: web_sys::ProgressEvent| {
let target = ev.target().unwrap();
let reader = target.unchecked_into::<FileReader>();
let dom_error = reader.error().unwrap();
state.last_error().set(Some(FragileComfirmed::new(
SQLightError::ImportDb(dom_error.message().to_string()),
)));
},
)
as Box<dyn FnMut(_)>));
let on_load =
FragileComfirmed::new(Closure::wrap(Box::new(move |ev: web_sys::Event| {
let target = ev.target().unwrap();
let reader = target.unchecked_into::<FileReader>();
let result = reader.result().unwrap();
let array_buffer = result.unchecked_into::<js_sys::ArrayBuffer>();
let data = js_sys::Uint8Array::new(&array_buffer);
send_request(state, WorkerRequest::LoadDb(LoadDbOptions { data }));
})
as Box<dyn FnMut(_)>));
reader.set_onprogress(Some(on_progress.as_ref().unchecked_ref()));
reader.set_onerror(Some(on_error.as_ref().unchecked_ref()));
reader.set_onload(Some(on_load.as_ref().unchecked_ref()));
reader.read_as_array_buffer(file).unwrap();
on_cleanup(move || {
drop(on_progress);
drop(on_error);
drop(on_load);
});
}
}
});
let on_change = move |ev: Event| {
if let Some(target) = ev.target() {
let input = target.unchecked_into::<HtmlInputElement>();
if let Some(files) = input.files() {
if files.length() > 0 {
let file = FragileComfirmed::new(files.get(0).unwrap());
set_file.set(Some(file));
} else {
set_file.set(None);
}
}
}
};
let on_load = move |_: MouseEvent, signal: WriteSignal<bool>| {
if let Some(input) = &*input_ref.read() {
if input.onchange().is_none() {
let callback = Closure::wrap(Box::new(on_change) as Box<dyn Fn(Event)>);
input.set_onchange(Some(callback.as_ref().unchecked_ref::<js_sys::Function>()));
callback.forget();
}
input.set_value("");
input.click();
}
signal.set(false);
};
Effect::new(move || {
state.exported().track();
let Some(downloaded) = state.exported().write_untracked().take() else {
return;
};
let filename = downloaded.filename;
let buffer = downloaded.data;
let array = js_sys::Array::new();
array.push(&buffer);
let blob = Blob::new_with_u8_array_sequence(&array).unwrap();
let url = Url::create_object_url_with_blob(&blob).unwrap();
let document = document();
let a = document
.create_element("a")
.unwrap()
.dyn_into::<web_sys::HtmlAnchorElement>()
.unwrap();
a.set_href(&url);
a.set_download(&filename);
a.click();
Url::revoke_object_url(&url).unwrap();
});
let on_download = move |_: MouseEvent, signal: WriteSignal<bool>| {
send_request(state, WorkerRequest::DownloadDb);
signal.set(false);
};
view! {
<PopButton
button=button
menu=Box::new(move |signal| {
view! {
<DatabaseMenu
load=move |e| on_load(e, signal)
download=move |e| on_download(e, signal)
/>
}
.into_any()
})
menu_container=menu_container
></PopButton>
}
}
#[component]
fn ShareButton() -> impl IntoView {
let state = expect_context::<Store<GlobalState>>();
let click = move |_| {
let Some(code) = state
.editor()
.read()
.as_ref()
.map(|editor| editor.get_value())
else {
return;
};
if let Ok(href) = window().location().href().and_then(|href| {
let url = Url::new(&href)?;
let params = UrlSearchParams::new()?;
params.set("code", &code);
url.set_search(&params.to_string().as_string().unwrap());
Ok(url.href())
}) {
state.share_href().set(Some(href));
}
change_focus(state, Some(Focus::Share));
};
view! { <Button on_click=click>"Share"</Button> }
}
#[component]
fn GithubButton() -> impl IntoView {
view! { <LinkButton href="https://github.com/Spxg/sqlight".into()>{github_icon()}</LinkButton> }
}
-109
View File
@@ -1,109 +0,0 @@
use istyles::istyles;
use leptos::prelude::*;
istyles!(styles, "assets/module.postcss/icon.module.css.map");
pub fn build_icon() -> AnyView {
view! {
<svg
class=styles::icon
height="14"
viewBox="8 4 10 16"
width="12"
xmlns="http://www.w3.org/2000/svg"
>
<path d="M8 5v14l11-7z" />
</svg>
}
.into_any()
}
pub fn config_icon() -> AnyView {
view! {
<svg
class=styles::icon
height="15"
viewBox="0 0 24 24"
width="15"
xmlns="http://www.w3.org/2000/svg"
>
<path d="M19.43 12.98c.04-.32.07-.64.07-.98s-.03-.66-.07-.98l2.11-1.65c.19-.15.24-.42.12-.64l-2-3.46c-.12-.22-.39-.3-.61-.22l-2.49 1c-.52-.4-1.08-.73-1.69-.98l-.38-2.65C14.46 2.18 14.25 2 14 2h-4c-.25 0-.46.18-.49.42l-.38 2.65c-.61.25-1.17.59-1.69.98l-2.49-1c-.23-.09-.49 0-.61.22l-2 3.46c-.13.22-.07.49.12.64l2.11 1.65c-.04.32-.07.65-.07.98s.03.66.07.98l-2.11 1.65c-.19.15-.24.42-.12.64l2 3.46c.12.22.39.3.61.22l2.49-1c.52.4 1.08.73 1.69.98l.38 2.65c.03.24.24.42.49.42h4c.25 0 .46-.18.49-.42l.38-2.65c.61-.25 1.17-.59 1.69-.98l2.49 1c.23.09.49 0 .61-.22l2-3.46c.12-.22.07-.49-.12-.64l-2.11-1.65zM12 15.5c-1.93 0-3.5-1.57-3.5-3.5s1.57-3.5 3.5-3.5 3.5 1.57 3.5 3.5-1.57 3.5-3.5 3.5z" />
</svg>
}.into_any()
}
pub fn expandable_icon() -> AnyView {
view! {
<svg
class=styles::icon
height="10"
viewBox="6 8 12 8"
width="10"
opacity="0.5"
xmlns="http://www.w3.org/2000/svg"
>
<path d="M16.59 8.59L12 13.17 7.41 8.59 6 10l6 6 6-6z" />
</svg>
}
.into_any()
}
pub fn checkmark_icon() -> AnyView {
view! {
<svg
class=styles::icon
height="18"
viewBox="2 2 22 22"
width="18"
xmlns="http://www.w3.org/2000/svg"
>
<path d="M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z" />
</svg>
}
.into_any()
}
pub fn clipboard_icon() -> AnyView {
view! {
<svg
class=styles::icon
height="18"
width="18"
viewBox="0 0 24 24"
xmlns="http://www.w3.org/2000/svg"
>
<rect x="7" y="15" width="7" height="2" />
<rect x="7" y="11" width="10" height="2" />
<rect x="7" y="7" width="10" height="2" />
<path d="M19,3L19,3h-4.18C14.4,1.84,13.3,1,12,1c-1.3,0-2.4,0.84-2.82,2H5h0C4.86,3,4.73,3.01,4.6,3.04 C4.21,3.12,3.86,3.32,3.59,3.59c-0.18,0.18-0.33,0.4-0.43,0.64C3.06,4.46,3,4.72,3,5v14c0,0.27,0.06,0.54,0.16,0.78 c0.1,0.24,0.25,0.45,0.43,0.64c0.27,0.27,0.62,0.47,1.01,0.55C4.73,20.99,4.86,21,5,21h0h14h0c1.1,0,2-0.9,2-2V5 C21,3.9,20.1,3,19,3z M12,2.75c0.41,0,0.75,0.34,0.75,0.75c0,0.41-0.34,0.75-0.75,0.75c-0.41,0-0.75-0.34-0.75-0.75 C11.25,3.09,11.59,2.75,12,2.75z M19,19H5V5h14V19z" />
</svg>
}.into_any()
}
pub fn more_options_icon() -> AnyView {
view! {
<svg
class=styles::icon
height="18"
viewBox="0 0 24 24"
width="18"
xmlns="http://www.w3.org/2000/svg"
>
<path d="M6 10c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm12 0c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm-6 0c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z" />
</svg>
}.into_any()
}
pub fn github_icon() -> AnyView {
view! {
<svg
class=styles::icon
height="18"
viewBox="0 0 24 24"
width="18"
xmlns="http://www.w3.org/2000/svg"
>
<path d="M10.9,2.1c-4.6,0.5-8.3,4.2-8.8,8.7c-0.5,4.7,2.2,8.9,6.3,10.5C8.7,21.4,9,21.2,9,20.8v-1.6c0,0-0.4,0.1-0.9,0.1 c-1.4,0-2-1.2-2.1-1.9c-0.1-0.4-0.3-0.7-0.6-1C5.1,16.3,5,16.3,5,16.2C5,16,5.3,16,5.4,16c0.6,0,1.1,0.7,1.3,1c0.5,0.8,1.1,1,1.4,1 c0.4,0,0.7-0.1,0.9-0.2c0.1-0.7,0.4-1.4,1-1.8c-2.3-0.5-4-1.8-4-4c0-1.1,0.5-2.2,1.2-3C7.1,8.8,7,8.3,7,7.6c0-0.4,0-0.9,0.2-1.3 C7.2,6.1,7.4,6,7.5,6c0,0,0.1,0,0.1,0C8.1,6.1,9.1,6.4,10,7.3C10.6,7.1,11.3,7,12,7s1.4,0.1,2,0.3c0.9-0.9,2-1.2,2.5-1.3 c0,0,0.1,0,0.1,0c0.2,0,0.3,0.1,0.4,0.3C17,6.7,17,7.2,17,7.6c0,0.8-0.1,1.2-0.2,1.4c0.7,0.8,1.2,1.8,1.2,3c0,2.2-1.7,3.5-4,4 c0.6,0.5,1,1.4,1,2.3v2.6c0,0.3,0.3,0.6,0.7,0.5c3.7-1.5,6.3-5.1,6.3-9.3C22,6.1,16.9,1.4,10.9,2.1z" />
</svg>
}.into_any()
}
-15
View File
@@ -1,15 +0,0 @@
use istyles::istyles;
use leptos::prelude::*;
istyles!(styles, "assets/module.postcss/loader.module.css.map");
#[component]
pub fn Loader() -> impl IntoView {
view! {
<div>
<span class=styles::dot>""</span>
<span class=styles::dot>""</span>
<span class=styles::dot>""</span>
</div>
}
}
-9
View File
@@ -1,9 +0,0 @@
use istyles::istyles;
use leptos::prelude::*;
istyles!(styles, "assets/module.postcss/menu_aside.module.css.map");
#[component]
pub fn MenuAside(children: Children) -> impl IntoView {
view! { <p class=styles::aside>{children()}</p> }
}
-14
View File
@@ -1,14 +0,0 @@
use istyles::istyles;
use leptos::prelude::*;
istyles!(styles, "assets/module.postcss/menu_group.module.css.map");
#[component]
pub fn MenuGroup(title: String, children: Children) -> impl IntoView {
view! {
<div class=styles::container>
<h1 class=styles::title>{title}</h1>
<div class=styles::content>{children()}</div>
</div>
}
}
-9
View File
@@ -1,9 +0,0 @@
use istyles::istyles;
use leptos::prelude::*;
istyles!(styles, "assets/module.postcss/menu_item.module.css.map");
#[component]
pub fn MenuItem(children: Children) -> impl IntoView {
view! { <div class=styles::container>{children()}</div> }
}
-25
View File
@@ -1,25 +0,0 @@
mod advanced_options_menu;
mod button_menu_item;
mod button_set;
mod config_element;
mod config_menu;
mod context_menu;
mod database_menu;
mod editor;
mod header;
mod icon;
mod loader;
mod menu_aside;
mod menu_group;
mod menu_item;
mod output;
mod playground;
mod pop_button;
mod select_one;
mod selectable_menu_item;
mod state;
mod tools_menu;
mod vfs_menu;
pub use playground::Playground;
pub use state::*;
-141
View File
@@ -1,141 +0,0 @@
mod execute;
mod header;
mod loader;
mod section;
mod share;
mod simple_pane;
mod status;
use execute::Execute;
use istyles::istyles;
use leptos::prelude::*;
use reactive_stores::Store;
use share::Share;
use status::Status;
use crate::app::state::{Focus, GlobalState, GlobalStateStoreFields};
istyles!(styles, "assets/module.postcss/output.module.css.map");
fn close() -> AnyView {
let state = expect_context::<Store<GlobalState>>();
if state.read().is_focus() {
view! {
<button class=styles::tabClose on:click=move |_| change_focus(state, None)>
"Close"
</button>
}
.into_any()
} else {
().into_any()
}
}
fn body() -> AnyView {
let state = expect_context::<Store<GlobalState>>();
if state.read().is_focus() {
view! {
<>
<div class=styles::body>
<Show
when=move || matches!(*state.focus().read(), Some(Focus::Execute))
fallback=|| ()
>
<Execute />
</Show>
<Show
when=move || matches!(*state.focus().read(), Some(Focus::Share))
fallback=|| ()
>
<Share />
</Show>
<Show
when=move || matches!(*state.focus().read(), Some(Focus::Status))
fallback=|| ()
>
<Status />
</Show>
</div>
</>
}
.into_any()
} else {
().into_any()
}
}
#[component]
pub fn Tab(kind: Focus, label: String) -> impl IntoView {
let state = expect_context::<Store<GlobalState>>();
let class = move || {
if matches!(*state.focus().read(), Some(focus) if focus == kind) {
styles::tabSelected
} else {
styles::tab
}
};
view! {
<Show when=move || state.opened_focus().read().contains(&kind) fallback=|| ()>
<button class=class>{label.clone()}</button>
</Show>
}
}
#[component]
pub fn Output() -> impl IntoView {
let state = expect_context::<Store<GlobalState>>();
view! {
<Show when=move || *state.show_something().read() fallback=|| ()>
<div class=styles::container>
<div class=styles::tabs>
<Tab
kind=Focus::Execute
label="Execution".into()
on:click=move |_| change_focus(state, Some(Focus::Execute))
/>
<Tab
kind=Focus::Share
label="Share".into()
on:click=move |_| change_focus(state, Some(Focus::Share))
/>
<Tab
kind=Focus::Status
label="Status".into()
on:click=move |_| change_focus(state, Some(Focus::Status))
/>
{close}
</div>
{body}
</div>
</Show>
}
}
pub fn change_focus(state: Store<GlobalState>, focus: Option<Focus>) {
if let Some(focus) = focus {
state.opened_focus().write().insert(focus);
state
.is_focused()
.maybe_update(|before| !std::mem::replace(before, true));
} else {
state
.is_focused()
.maybe_update(|before| std::mem::replace(before, false));
}
state
.focus()
.maybe_update(|before| std::mem::replace(before, focus) != focus);
state
.show_something()
.maybe_update(|before| !std::mem::replace(before, true));
}
-121
View File
@@ -1,121 +0,0 @@
use istyles::istyles;
use leptos::prelude::*;
use reactive_stores::Store;
use crate::app::{
output::{header::Header, loader::Loader, section::Section, simple_pane::SimplePane},
state::{GlobalState, GlobalStateStoreFields},
};
use crate::{SQLiteStatementResult, SQLiteStatementTable};
istyles!(
styles,
"assets/module.postcss/output/execute.module.css.map"
);
fn get_output(table: &SQLiteStatementTable) -> Option<AnyView> {
let Some(values) = &table.values else {
return None;
};
Some(
view! {
<table
class=styles::table
style="table-layout: fixed; width: 100%; word-wrap: break-word;"
>
<tr>
{values
.columns
.iter()
.map(|s| {
view! { <th class=styles::tdAndTh>{s.to_string()}</th> }
})
.collect_view()}
</tr>
{values
.rows
.iter()
.map(|row| {
view! {
<tr>
{row
.iter()
.map(|s| {
view! { <td class=styles::tdAndTh>{s.to_string()}</td> }
})
.collect_view()}
</tr>
}
})
.collect_view()}
</table>
}
.into_any(),
)
}
#[component]
fn Output() -> AnyView {
let state = expect_context::<Store<GlobalState>>();
view! {
<>
<Show
when=move || {
state
.output()
.read()
.last()
.is_none_or(|r| !matches!(r, SQLiteStatementResult::Finish))
}
fallback=|| ()
>
<Loader />
</Show>
<>
{move || {
state
.output()
.read()
.iter()
.enumerate()
.map(|(idx, item)| {
match &item {
SQLiteStatementResult::Finish => {
view! { <Header label="Finished".into() /> }
.into_any()
}
SQLiteStatementResult::Step(table) => {
let label = format!("Statement #{}", idx + 1);
if let Some(output) = get_output(table) {
view! {
<Section label=label>
<p>{output}</p>
</Section>
}
.into_any()
} else {
().into_any()
}
}
}
})
.collect_view()
}}
</>
</>
}
.into_any()
}
#[component]
pub fn Execute() -> impl IntoView {
view! {
<SimplePane>
<Output />
</SimplePane>
}
}
-9
View File
@@ -1,9 +0,0 @@
use istyles::istyles;
use leptos::prelude::*;
istyles!(styles, "assets/module.postcss/output/header.module.css.map");
#[component]
pub fn Header(label: String) -> impl IntoView {
view! { <span class=styles::container>{label}</span> }
}
-13
View File
@@ -1,13 +0,0 @@
use leptos::prelude::*;
use crate::app::{loader::Loader as GenericLoader, output::header::Header};
#[component]
pub fn Loader() -> impl IntoView {
view! {
<div>
<Header label="Progress".into() />
<GenericLoader />
</div>
}
}
-19
View File
@@ -1,19 +0,0 @@
use istyles::istyles;
use leptos::prelude::*;
use crate::app::output::header::Header;
istyles!(
styles,
"assets/module.postcss/output/section.module.css.map"
);
#[component]
pub fn Section(label: String, children: Children) -> impl IntoView {
view! {
<div>
<Header label=label />
<p>{children()}</p>
</div>
}
}
-66
View File
@@ -1,66 +0,0 @@
use std::{sync::Arc, time::Duration};
use istyles::istyles;
use leptos::prelude::*;
use reactive_stores::Store;
use wasm_bindgen_futures::{JsFuture, spawn_local};
use crate::app::{GlobalState, GlobalStateStoreFields, icon::clipboard_icon};
istyles!(styles, "assets/module.postcss/output/share.module.css.map");
#[component]
fn Copied<S, H>(shared: S, href: H, children: Children) -> impl IntoView
where
S: Fn() -> String + Send + Sync + 'static,
H: Fn() -> String + Send + Sync + 'static,
{
let (copied, set_copied) = signal(false);
let shared = Arc::new(shared);
let copy = move |_| {
let shared = Arc::clone(&shared);
spawn_local(async move {
set_copied.set(true);
if let Err(err) =
JsFuture::from(window().navigator().clipboard().write_text(&shared())).await
{
log::error!("Failed to write href to clipboard: {err:?}");
}
set_timeout(move || set_copied.set(false), Duration::from_millis(1000));
});
};
view! {
<p class=move || { if *copied.read() { styles::active } else { styles::container } }>
<a href=href target="_blank">
{children()}
</a>
<button class=styles::button on:click=copy>
{clipboard_icon()}
</button>
<span class=styles::text>"Copied!"</span>
</p>
}
}
#[component]
fn EmbeddedLinks() -> impl IntoView {
let state = expect_context::<Store<GlobalState>>();
let shared = move || state.share_href().get_untracked().unwrap_or_default();
let href = move || state.share_href().get_untracked().unwrap_or_default();
view! {
<Copied shared=shared href=href>
"Embedded code in link"
</Copied>
}
}
#[component]
pub fn Share() -> impl IntoView {
view! {
<>
<EmbeddedLinks />
</>
}
}
-6
View File
@@ -1,6 +0,0 @@
use leptos::prelude::*;
#[component]
pub fn SimplePane(children: Children) -> impl IntoView {
view! { <div>{children()}</div> }
}
-128
View File
@@ -1,128 +0,0 @@
use std::ops::Deref;
use leptos::prelude::*;
use reactive_stores::Store;
use crate::{
SQLightError, SQLitendError, WorkerError,
app::{
GlobalState, GlobalStateStoreFields,
output::{section::Section, simple_pane::SimplePane},
},
};
const OPFS_SAH_POOL_OPENED_DETAILS: &str = "Due to OPFS SyncAccessHandle restrictions, \
the db can only have one web tab access.
Close other tabs and refresh, or switch to memory VFS.";
#[component]
pub fn Status() -> impl IntoView {
let state = expect_context::<Store<GlobalState>>();
let last_error = move || match &*state.last_error().read() {
Some(error) => {
let summary = format!("{}", error.deref());
let details = match error.deref() {
SQLightError::Worker(worker) => match worker {
WorkerError::SQLite(sqlitend_error) => match sqlitend_error {
SQLitendError::ToCStr
| SQLitendError::GetColumnName(_)
| SQLitendError::Utf8Text => {
"This shouldn't happen, please create an issue on github."
}
SQLitendError::OpenDb(_) | SQLitendError::Step(_) => {
"If database disk image is malformed, change the context option and run it once."
}
SQLitendError::Prepare(_) => "Check if the syntax is correct.",
SQLitendError::UnsupportColumnType(_) => {
"An unsupported type was encountered, please create an issue on github."
}
},
WorkerError::NotOpened => {
"This is most likely to happen only on OPFS VFS, switch VFS and try again."
}
WorkerError::Unexpected => {
"This shouldn't happen, please create an issue on github."
}
WorkerError::InvaildState => {
"SQLite is in an abnormal state when executing sql, change the context option and run it once."
}
WorkerError::LoadDb(_) => "Check whether the imported DB is a SQLite3 file.",
WorkerError::DownloadDb(_) => "It may be caused by OOM.",
WorkerError::OpfsSAHPoolOpened => OPFS_SAH_POOL_OPENED_DETAILS,
},
SQLightError::AceEditor(ace_editor) => match ace_editor {
aceditor::EditorError::Serde(_)
| aceditor::EditorError::SetTheme(_)
| aceditor::EditorError::SetKeyboardHandler(_)
| aceditor::EditorError::Open(_)
| aceditor::EditorError::DefineEx(_) => {
"This shouldn't happen, please create an issue on github."
}
},
SQLightError::ImportDb(_) => {
"Maybe the db was not found, could not be read, or was too large."
}
};
view! {
<details open>
<summary>{summary}</summary>
<p>{details}</p>
</details>
}
.into_any()
}
None => view! { "No Error" }.into_any(),
};
let import_progress = move || {
if let Some(progress) = &*state.import_progress().read() {
let filename = format!("Filename: {}", progress.filename);
let loading = format!("Loading: {} of {} bytes", progress.loaded, progress.total);
let status = if progress.loaded == progress.total {
view! { <p>"Loading completed"</p> }.into_any()
} else {
().into_any()
};
let process = if progress.loaded == progress.total {
match &progress.opened {
Some(success) => {
if *success {
view! { <p>"Processing completed"</p> }.into_any()
} else {
view! { <p>"Processing failed"</p> }.into_any()
}
}
None => view! { <p>"Processing..."</p> }.into_any(),
}
} else {
().into_any()
};
view! {
<p>{filename}</p>
<p>{loading}</p>
{status}
{process}
}
.into_any()
} else {
view! { "No files are being imported." }.into_any()
}
};
view! {
<SimplePane>
<Section label="Last Error".into()>
<pre style="white-space: pre-wrap;">{last_error}</pre>
</Section>
<Section label="Import Progress".into()>
<pre style="white-space: pre-wrap;">{import_progress}</pre>
</Section>
</SimplePane>
}
}
-336
View File
@@ -1,336 +0,0 @@
use std::ops::Deref;
use istyles::istyles;
use leptos::prelude::*;
use leptos::tachys::html;
use prettytable::{Cell, Row, Table};
use reactive_stores::Store;
use split_grid::{Gutter, SplitOptions};
use wasm_bindgen::{JsCast, prelude::Closure};
use web_sys::wasm_bindgen::JsValue;
use crate::{
SQLightError, SQLiteStatementResult,
app::{
Focus,
editor::Editor,
header::Header,
output::{Output, change_focus},
state::{GlobalState, GlobalStateStoreFields, Orientation, Theme},
},
};
istyles!(styles, "assets/module.postcss/playground.module.css.map");
#[component]
pub fn Playground() -> impl IntoView {
let state = GlobalState::load().unwrap_or_default();
provide_context(Store::new(state));
let state = expect_context::<Store<GlobalState>>();
handle_last_error(state);
handle_system_theme(state);
handle_automic_orientation(state);
handle_save_state(state);
handle_import_progress(state);
handle_ace_config(state);
handle_embed_query_result(state);
view! {
<div id="playground" class=styles::container>
<Header />
<ResizableArea />
</div>
}
.into_any()
}
fn handle_embed_query_result(state: Store<GlobalState>) {
const MARK: &str = "-- R:";
Effect::new(move || {
let mut sqls = vec![];
for result in &*state.embed().read() {
let mut table_s = Table::new();
match result {
SQLiteStatementResult::Finish => continue,
SQLiteStatementResult::Step(table) => {
let sql = table.sql.trim().to_string();
let sql = if let Some(values) = &table.values {
table_s.add_row(Row::new(
values.columns.iter().map(|s| Cell::new(s)).collect(),
));
for row in &values.rows {
table_s.add_row(Row::new(row.iter().map(|s| Cell::new(s)).collect()));
}
let mut result = table_s
.to_string()
.lines()
.map(|x| format!("{MARK} {x}"))
.collect::<Vec<String>>()
.join("\n");
result.push('\n');
let sql = sql
.lines()
.filter(|s| !s.starts_with(MARK))
.collect::<Vec<_>>()
.join("\n");
result.push_str(&sql);
result
} else {
sql
};
sqls.push(sql);
}
}
}
if !sqls.is_empty() {
if let Some(editor) = &*state.editor().read_untracked() {
editor.set_value(sqls.join("\n\n"));
}
}
});
}
fn handle_ace_config(state: Store<GlobalState>) {
Effect::new(move || {
let config = state.editor_config().read();
let keyboard = &config.keyboard;
let theme = match state.theme().read().value() {
Theme::SystemLight | Theme::Light => &config.light_theme,
Theme::SystemDark | Theme::Dark => &config.dark_theme,
Theme::System => unreachable!(),
};
if let Some(Err(err)) = state.editor().read().as_ref().map(|editor| {
let handler = (keyboard != "ace").then_some(format!("ace/keyboard/{keyboard}"));
editor.set_keyboard_handler(handler.as_deref())
}) {
state
.last_error()
.set(Some(SQLightError::new_ace_editor(err)));
}
if let Some(Err(err)) = state
.editor()
.read()
.as_ref()
.map(|editor| editor.set_theme(&format!("ace/theme/{theme}")))
{
state
.last_error()
.set(Some(SQLightError::new_ace_editor(err)));
}
});
}
fn handle_save_state(state: Store<GlobalState>) {
Effect::new(move || {
state.vfs().track();
state.editor_config().track();
state.orientation().track();
state.theme().track();
state.keep_ctx().track();
state.sql().track();
state.run_selected_sql().track();
state.multiple_ciphers().track();
state.read_untracked().save();
});
}
fn handle_last_error(state: Store<GlobalState>) {
Effect::new(move || {
if state.last_error().read().is_some() {
change_focus(state, Some(Focus::Status));
}
});
}
fn handle_import_progress(state: Store<GlobalState>) {
Effect::new(move || {
if state.import_progress().read().is_some() {
change_focus(state, Some(Focus::Status));
}
});
}
fn handle_system_theme(state: Store<GlobalState>) {
Effect::new(move || {
let theme = match state.theme().read().value() {
Theme::SystemLight | Theme::Light => "light",
Theme::SystemDark | Theme::Dark => "dark",
Theme::System => unreachable!(),
};
if let Some(element) = document().document_element() {
element.set_attribute("data-theme", theme).unwrap()
}
});
if let Some(query) = Theme::match_media() {
let f = move |query: web_sys::MediaQueryList| {
if state.theme().get_untracked().is_system() {
state.theme().set(if query.matches() {
Theme::SystemDark
} else {
Theme::SystemLight
});
}
};
let callback = Closure::<dyn Fn(web_sys::MediaQueryList)>::new(f);
query
.add_event_listener_with_callback("change", callback.as_ref().unchecked_ref())
.unwrap();
callback.forget();
}
}
fn handle_automic_orientation(state: Store<GlobalState>) {
let auto_change = move |query: web_sys::MediaQueryList| {
if state.orientation().read().is_auto() {
let value = if query.matches() {
Orientation::AutoHorizontal
} else {
Orientation::AutoVertical
};
state
.orientation()
.maybe_update(|orientation| std::mem::replace(orientation, value) != value);
}
};
Effect::new(move || {
if let Some(query) = Orientation::match_media() {
auto_change(query);
}
});
if let Some(query) = Orientation::match_media() {
let callback = Closure::<dyn Fn(web_sys::MediaQueryList)>::new(auto_change);
query
.add_event_listener_with_callback("change", callback.as_ref().unchecked_ref())
.unwrap();
callback.forget();
}
}
fn gird_style() -> String {
let state = expect_context::<Store<GlobalState>>();
let (focused_grid_style, unfocused_grid_style) = match state.orientation().read().value() {
Orientation::Horizontal | Orientation::AutoHorizontal => (
styles::resizeableAreaRowOutputFocused.to_string(),
styles::resizeableAreaRowOutputUnfocused.to_string(),
),
Orientation::Vertical | Orientation::AutoVertical => (
styles::resizeableAreaColumnOutputFocused.to_string(),
styles::resizeableAreaColumnOutputUnfocused.to_string(),
),
Orientation::Automatic => unreachable!(),
};
if state.read().is_focus() {
focused_grid_style
} else {
unfocused_grid_style
}
}
fn handle_outer_style() -> String {
let state = expect_context::<Store<GlobalState>>();
match state.orientation().read().value() {
Orientation::Horizontal | Orientation::AutoHorizontal => {
styles::splitRowsGutter.to_string()
}
Orientation::Vertical | Orientation::AutoVertical => styles::splitColumnsGutter.to_string(),
Orientation::Automatic => unreachable!(),
}
}
fn handle_inner_style() -> String {
let state = expect_context::<Store<GlobalState>>();
match state.orientation().read().value() {
Orientation::Horizontal | Orientation::AutoHorizontal => {
styles::splitRowsGutterHandle.to_string()
}
Orientation::Vertical | Orientation::AutoVertical => String::new(),
Orientation::Automatic => unreachable!(),
}
}
#[component]
fn ResizableArea() -> impl IntoView {
let state = expect_context::<Store<GlobalState>>();
let node_ref = NodeRef::<html::element::Div>::new();
let drag_handle = NodeRef::<html::element::Div>::new();
Effect::new(move || {
state.orientation().track();
state.is_focused().track();
if let Some(div) = &*node_ref.read() {
let style = div.deref().style();
let _ = style.remove_property("grid-template-columns");
let _ = style.remove_property("grid-template-rows");
}
});
Effect::new(move || {
state.show_something().track();
let element = if let Some(element) = &*drag_handle.read() {
JsValue::from(element)
} else {
JsValue::null()
};
let options = match state.orientation().read().value() {
Orientation::Horizontal | Orientation::AutoHorizontal => SplitOptions {
min_size: 100,
row_gutters: Some(vec![Gutter { track: 1, element }]),
column_gutters: None,
},
Orientation::Vertical | Orientation::AutoVertical => SplitOptions {
min_size: 100,
row_gutters: None,
column_gutters: Some(vec![Gutter { track: 1, element }]),
},
Orientation::Automatic => unreachable!(),
};
let grid = split_grid::split(&options.into());
on_cleanup(move || grid.destroy());
});
view! {
<div node_ref=node_ref class=gird_style>
<div class=styles::editor>
<Editor />
</div>
<Show when=move || state.read().is_focus() fallback=|| ()>
<div node_ref=drag_handle class=handle_outer_style>
<span class=handle_inner_style>""</span>
</div>
</Show>
<Show when=move || *state.show_something().read() fallback=|| ()>
<div class=styles::output>
<Output />
</div>
</Show>
</div>
}
}
-222
View File
@@ -1,222 +0,0 @@
use std::{ops::Deref, sync::Arc};
use floating_ui::{
ArrowPosition, ComputePosition, MiddlewareData, auto_update, compute_options, compute_position,
};
use istyles::istyles;
use js_sys::Object;
use leptos::{portal::Portal, prelude::*, tachys::html};
use wasm_bindgen::{JsCast, JsValue, prelude::Closure};
use wasm_bindgen_futures::spawn_local;
use web_sys::{KeyboardEvent, MouseEvent};
use crate::FragileComfirmed;
istyles!(styles, "assets/module.postcss/pop_button.module.css.map");
#[component]
pub fn PopButton<B, M>(
button: B,
menu: M,
#[prop(optional)] menu_container: NodeRef<html::element::Div>,
) -> impl IntoView
where
B: FnOnce(Box<dyn FnMut(MouseEvent) + Send>, NodeRef<html::element::Button>) -> AnyView,
M: Fn(WriteSignal<bool>) -> AnyView + Send + Sync + 'static,
{
let (is_open, set_open) = signal(false);
let toggle = move || set_open.set(!is_open.get());
let arrow_ref = NodeRef::<html::element::Div>::new();
let reference_ref = NodeRef::<html::element::Button>::new();
let floating_ref = NodeRef::<html::element::Div>::new();
let menu_ref = NodeRef::<html::element::Div>::new();
Effect::new(move || {
let key_listener = move |event: KeyboardEvent| {
if !is_open.get_untracked() {
return;
}
if event.key() == "Escape" {
set_open.set(false);
}
};
let callback = FragileComfirmed::new(Closure::<dyn Fn(KeyboardEvent)>::new(key_listener));
window()
.add_event_listener_with_callback("keydown", callback.as_ref().unchecked_ref())
.unwrap();
on_cleanup(move || {
window()
.remove_event_listener_with_callback("keydown", callback.as_ref().unchecked_ref())
.unwrap();
drop(callback)
});
});
Effect::new(move || {
let listener = move |event: MouseEvent| {
if !is_open.get_untracked() {
return;
}
if let Some(target) = event.target() {
let node = target.dyn_into::<web_sys::Node>().ok();
if !reference_ref.with_untracked(|reference| {
reference
.as_ref()
.is_some_and(|reference| reference.deref().contains(node.as_ref()))
}) && !floating_ref.with_untracked(|floating| {
floating
.as_ref()
.is_some_and(|floating| floating.deref().contains(node.as_ref()))
}) {
set_open.set(false);
}
}
};
let callback = FragileComfirmed::new(Closure::<dyn Fn(MouseEvent)>::new(listener));
window()
.add_event_listener_with_callback("click", callback.as_ref().unchecked_ref())
.unwrap();
on_cleanup(move || {
window()
.remove_event_listener_with_callback("click", callback.as_ref().unchecked_ref())
.unwrap();
drop(callback)
});
});
Effect::new(move || {
let callback = Closure::new(move || {
let options = compute_options(10, &arrow_ref.get_untracked().into());
spawn_local(async move {
let value = compute_position(
reference_ref.get_untracked().into(),
floating_ref.get_untracked().into(),
options,
)
.await;
let ComputePosition {
x,
y,
placement,
strategy,
middleware_data,
} = serde_wasm_bindgen::from_value(value).unwrap();
if let Some(element) = floating_ref.get_untracked() {
let style = element.deref().style();
#[derive(serde::Serialize)]
struct Style {
position: String,
left: String,
top: String,
}
let pos = serde_wasm_bindgen::to_value(&Style {
position: strategy,
left: format!("{x}px"),
top: format!("{y}px"),
})
.unwrap();
Object::assign(&style, &pos.into());
}
if let Some(element) = arrow_ref.get_untracked() {
let MiddlewareData {
arrow: ArrowPosition { x },
} = middleware_data;
let style = element.deref().style();
#[derive(serde::Serialize)]
struct Style {
left: String,
}
let pos = serde_wasm_bindgen::to_value(&Style {
left: format!("{x}px"),
})
.unwrap();
Object::assign(&style, &pos.into());
}
if let Some(menu_ref) = menu_ref.get_untracked() {
let class = if placement == "top" {
styles::contentTop
} else if placement == "bottom" {
styles::contentBottom
} else {
""
};
menu_ref.set_class_name(class);
}
});
});
if let (Some(reference), Some(floating)) = (&*reference_ref.read(), &*floating_ref.read()) {
let func = auto_update(
reference.into(),
floating.into(),
&callback,
JsValue::default(),
);
let func = FragileComfirmed::new(func);
let callback = FragileComfirmed::new(callback);
on_cleanup(move || {
func.call0(&JsValue::null()).unwrap();
drop(callback);
});
}
});
let menu = Arc::new(menu);
let float = move || {
let menu_clone = Arc::clone(&menu);
view! {
<Show when=move || is_open.get() fallback=|| ()>
<div
class=styles::container
node_ref=floating_ref
style="position: absolute; width: max-content;"
>
<div
class=styles::arrow
node_ref=arrow_ref
style="position: absolute; pointer-events: none; bottom: 100%; transform: rotate(180deg);"
>
<svg width="20" height="20" viewBox="0 0 20 20">
<path stroke="none" d="M0,0 H20 L10,10 Q10,10 10,10 Z"></path>
<clipPath id=":rh:">
<rect x="0" y="0" width="20" height="20"></rect>
</clipPath>
</svg>
</div>
<div node_ref=menu_ref>
<div>{menu_clone(set_open)}</div>
</div>
</div>
</Show>
}
};
let float = Arc::new(float);
let total = move || {
let float_clone = Arc::clone(&float);
if let Some(container) = menu_container.get() {
view! { <Portal mount=container.clone()>{float_clone()}</Portal> }.into_any()
} else {
float_clone().into_any()
}
};
view! { <>{button(Box::new(move |_| toggle()), reference_ref)} {total}</> }
}
-27
View File
@@ -1,27 +0,0 @@
use leptos::prelude::*;
use crate::app::selectable_menu_item::SelectableMenuItem;
#[component]
pub fn SelectOne<T, C, CH>(
name: String,
current_value: C,
this_value: T,
mut change_value: CH,
children: Children,
) -> impl IntoView
where
C: Fn() -> T + Send + 'static,
CH: FnMut() + Send + 'static,
T: PartialEq + Eq + Send + 'static,
{
view! {
<SelectableMenuItem
name=name
selected=move || { current_value() == this_value }
on_click=move |_| change_value()
>
{children()}
</SelectableMenuItem>
}
}
-37
View File
@@ -1,37 +0,0 @@
use istyles::istyles;
use leptos::prelude::*;
use web_sys::MouseEvent;
use crate::app::{icon::checkmark_icon, menu_item::MenuItem};
istyles!(
styles,
"assets/module.postcss/selectable_menu_item.module.css.map"
);
#[component]
pub fn SelectableMenuItem<S, C>(
name: String,
selected: S,
on_click: C,
children: Children,
) -> impl IntoView
where
S: Fn() -> bool + Send + 'static,
C: FnMut(MouseEvent) + Send + 'static,
{
view! {
<MenuItem>
<button
class=move || { if selected() { styles::selected } else { styles::container } }
on:click=on_click
>
<div class=styles::header>
<span class=styles::checkmark>{checkmark_icon()}</span>
<span class=styles::name>{name}</span>
</div>
<div class=styles::description>{children()}</div>
</button>
</MenuItem>
}
}
-277
View File
@@ -1,277 +0,0 @@
use std::collections::HashSet;
use aceditor::Editor;
use js_sys::Uint8Array;
use leptos::tachys::dom::window;
use reactive_stores::Store;
use serde::{Deserialize, Serialize};
use web_sys::MediaQueryList;
use crate::{FragileComfirmed, SQLightError, SQLiteStatementResult};
const DEFAULT_CODE: &str = "PRAGMA page_size=4096;
CREATE TABLE IF NOT EXISTS blobs (
id INTEGER PRIMARY KEY,
data BLOB
);
INSERT INTO blobs(data) VALUES (randomblob(12));
SELECT 'Hello World!',
datetime('now','localtime') AS TM,
unhex('73716c69676874') AS BLOB_VAL,
NULL as NULL_VAL;
SELECT * FROM blobs;";
#[derive(Store, Serialize, Deserialize)]
pub struct GlobalState {
vfs: Vfs,
editor_config: EditorConfig,
orientation: Orientation,
theme: Theme,
keep_ctx: bool,
sql: String,
run_selected_sql: bool,
multiple_ciphers: bool,
// runtime state below
#[serde(skip)]
editor: Option<Editor>,
#[serde(skip)]
focus: Option<Focus>,
#[serde(skip)]
is_focused: bool,
#[serde(skip)]
opened_focus: HashSet<Focus>,
#[serde(skip)]
share_href: Option<String>,
#[serde(skip)]
show_something: bool,
#[serde(skip)]
output: Vec<SQLiteStatementResult>,
#[serde(skip)]
embed: Vec<SQLiteStatementResult>,
#[serde(skip)]
last_error: Option<FragileComfirmed<SQLightError>>,
#[serde(skip)]
import_progress: Option<ImportProgress>,
#[serde(skip)]
exported: Option<Exported>,
}
impl Default for GlobalState {
fn default() -> Self {
Self {
vfs: Vfs::Memory,
editor_config: EditorConfig::default(),
orientation: Orientation::Automatic,
theme: Theme::System,
keep_ctx: false,
sql: DEFAULT_CODE.into(),
run_selected_sql: false,
multiple_ciphers: false,
editor: None,
focus: None,
is_focused: false,
opened_focus: HashSet::new(),
share_href: None,
show_something: false,
output: vec![],
embed: vec![],
last_error: None,
import_progress: None,
exported: None,
}
}
}
impl GlobalState {
pub fn load() -> Option<Self> {
let storage = window().local_storage().ok()??;
let value = storage.get("config").ok()??;
serde_json::from_str(&value).ok()
}
pub fn save(&self) {
if let Some(Err(e)) = window()
.local_storage()
.ok()
.flatten()
.map(|s| s.set_item("config", &serde_json::to_string(self).unwrap()))
{
log::error!("Faild to save config to localstorage: {e:?}");
}
}
}
pub struct ImportProgress {
pub filename: String,
pub loaded: f64,
pub total: f64,
pub opened: Option<bool>,
}
pub struct Exported {
pub filename: String,
pub data: FragileComfirmed<Uint8Array>,
}
#[derive(Serialize, Deserialize)]
pub struct EditorConfig {
pub keyboard: String,
pub light_theme: String,
pub dark_theme: String,
}
impl Default for EditorConfig {
fn default() -> Self {
EditorConfig {
keyboard: "ace".into(),
light_theme: "github".into(),
dark_theme: "github_dark".into(),
}
}
}
impl GlobalState {
pub fn is_focus(&self) -> bool {
self.focus.is_some()
}
}
#[derive(Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
pub enum Vfs {
Memory,
OPFS,
}
impl Vfs {
pub fn value(&self) -> String {
match self {
Vfs::Memory => "Memory".into(),
Vfs::OPFS => "OPFS".into(),
}
}
}
#[derive(Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum Focus {
Execute,
Share,
Status,
}
#[derive(Clone, Copy, Serialize, Deserialize, PartialEq, Eq)]
pub enum Theme {
System,
SystemLight,
SystemDark,
Light,
Dark,
}
impl Theme {
pub fn is_system(&self) -> bool {
matches!(self, Theme::System | Theme::SystemLight | Theme::SystemDark)
}
pub fn from_select(s: &str) -> Self {
match s {
"System" => Self::System,
"Light" => Self::Light,
"Dark" => Self::Dark,
_ => unreachable!(),
}
}
pub fn match_media() -> Option<MediaQueryList> {
window()
.match_media("(prefers-color-scheme: dark)")
.ok()
.flatten()
}
pub fn value(&self) -> Self {
if self.is_system() {
Self::match_media()
.map(|query| {
if query.matches() {
Theme::SystemDark
} else {
Theme::SystemLight
}
})
.unwrap_or_else(|| Theme::SystemLight)
} else {
*self
}
}
pub fn select(&self) -> String {
match self {
Theme::System | Theme::SystemLight | Theme::SystemDark => "System",
Theme::Light => "Light",
Theme::Dark => "Dark",
}
.into()
}
}
#[derive(Clone, Copy, Serialize, Deserialize, PartialEq, Eq)]
pub enum Orientation {
Automatic,
AutoHorizontal,
AutoVertical,
Horizontal,
Vertical,
}
impl Orientation {
pub fn is_auto(&self) -> bool {
matches!(
self,
Orientation::Automatic | Orientation::AutoVertical | Orientation::AutoHorizontal
)
}
pub fn from_select(s: &str) -> Self {
match s {
"Automatic" => Self::Automatic,
"Horizontal" => Self::Horizontal,
"Vertical" => Self::Vertical,
_ => unreachable!(),
}
}
pub fn match_media() -> Option<MediaQueryList> {
window().match_media("(max-width: 1600px)").ok().flatten()
}
pub fn value(&self) -> Self {
if self.is_auto() {
Self::match_media()
.map(|query| {
if query.matches() {
Orientation::AutoHorizontal
} else {
Orientation::AutoVertical
}
})
.unwrap_or_else(|| Orientation::AutoVertical)
} else {
*self
}
}
pub fn select(&self) -> String {
match self {
Orientation::Automatic | Orientation::AutoVertical | Orientation::AutoHorizontal => {
"Automatic"
}
Orientation::Horizontal => "Horizontal",
Orientation::Vertical => "Vertical",
}
.into()
}
}
-30
View File
@@ -1,30 +0,0 @@
use leptos::prelude::*;
use web_sys::MouseEvent;
use crate::app::{button_menu_item::ButtonMenuItem, menu_aside::MenuAside, menu_group::MenuGroup};
#[component]
pub fn ToolsMenu<F, E, I>(on_format: F, on_embed: E, on_internal: I) -> impl IntoView
where
F: Fn(MouseEvent) + Send + 'static,
E: Fn(MouseEvent) + Send + 'static,
I: Fn(MouseEvent) + Send + 'static,
{
view! {
<MenuGroup title="Tools".into()>
<ButtonMenuItem name="SQL Format".into() on_click=on_format>
<MenuAside>"https://crates.io/crates/sqlformat"</MenuAside>
</ButtonMenuItem>
<ButtonMenuItem name="Embed Query Result".into() on_click=on_embed>
<MenuAside>"Embed results into query statements for easy sharing."</MenuAside>
</ButtonMenuItem>
<a href="https://sqlite-internal.pages.dev" target="_blank">
<ButtonMenuItem name="SQLite internal".into() on_click=on_internal>
<MenuAside>
"This tool helps you explore the SQLite file format internals (encrypted db is not supported)."
</MenuAside>
</ButtonMenuItem>
</a>
</MenuGroup>
}
}
-36
View File
@@ -1,36 +0,0 @@
use leptos::prelude::*;
use reactive_stores::Store;
use crate::app::{
GlobalState, GlobalStateStoreFields, Vfs, menu_group::MenuGroup, select_one::SelectOne,
};
#[component]
pub fn VfsMenu() -> impl IntoView {
let state = expect_context::<Store<GlobalState>>();
view! {
<MenuGroup title="Choose SQLite VFS".into()>
<SelectOne
name="Memory".into()
current_value=move || { *state.vfs().read() }
this_value=Vfs::Memory
change_value=move || {
state.vfs().set(Vfs::Memory);
}
>
"Data will be lost after refreshing."
</SelectOne>
<SelectOne
name="OPFS".into()
current_value=move || { *state.vfs().read() }
this_value=Vfs::OPFS
change_value=move || {
state.vfs().set(Vfs::OPFS);
}
>
"Persistent Storage."
</SelectOne>
</MenuGroup>
}
}
-11
View File
@@ -1,11 +0,0 @@
use leptos::prelude::*;
use sqlight::app::Playground;
use wasm_bindgen::prelude::wasm_bindgen;
#[wasm_bindgen(main)]
async fn main() {
console_error_panic_hook::set_once();
console_log::init_with_level(log::Level::Debug).unwrap();
mount_to_body(Playground);
}
-3
View File
@@ -1,3 +0,0 @@
fn main() {
sqlight::worker::entry();
}

Some files were not shown because too many files have changed in this diff Show More