2022-05-18 17:14:24 +00:00
<!doctype html>
< html lang = "en-us" >
< head >
< meta charset = "utf-8" >
< meta http-equiv = "Content-Type" content = "text/html; charset=utf-8" >
2023-11-28 09:26:28 +01:00
< title > libSQL Fiddle< / title >
2022-05-25 03:08:22 +00:00
< link rel = "shortcut icon" href = "data:image/x-icon;," type = "image/x-icon" >
2022-11-05 10:56:33 +01:00
< script src = "https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.1/jquery.min.js" > < / script >
< script src = "https://cdnjs.cloudflare.com/ajax/libs/jquery.terminal/2.34.0/js/jquery.terminal.js" > < / script >
< link rel = "stylesheet" href = "https://cdnjs.cloudflare.com/ajax/libs/jquery.terminal/2.34.0/css/jquery.terminal.min.css" / >
2022-05-22 00:27:19 +00:00
< link rel = "stylesheet" href = "emscripten.css" / >
2022-05-18 17:14:24 +00:00
< style >
2022-05-19 10:24:50 +00:00
/* The following styles are for app-level use. */
2022-06-10 09:31:12 +00:00
:root {
--sqlite-blue: #044a64;
2022-06-10 15:43:03 +00:00
--textarea-color1: #044a64;
--textarea-color2: white;
2022-06-10 09:31:12 +00:00
}
2022-05-19 10:24:50 +00:00
textarea {
font-family: monospace;
flex: 1 1 auto;
2022-06-10 15:43:03 +00:00
background-color: var(--textarea-color1);
color: var(--textarea-color2);
}
textarea#input {
color: var(--textarea-color1);
background-color: var(--textarea-color2);
2022-05-19 10:24:50 +00:00
}
2022-05-19 01:12:23 +00:00
header {
2022-06-10 09:31:12 +00:00
display: flex;
justify-content: space-between;
align-items: center;
background-color: var(--sqlite-blue);
color: white;
font-size: 120%;
2022-05-18 17:14:24 +00:00
font-weight: bold;
2022-06-10 09:31:12 +00:00
border-radius: 0.25em;
padding: 0.2em 0.5em;
}
header > .powered-by {
font-size: 80%;
}
header a, header a:visited, header a:hover {
color: inherit;
2022-05-18 17:14:24 +00:00
}
#main-wrapper {
display: flex;
2022-05-19 15:58:13 +00:00
flex-direction: column-reverse;
2022-06-10 09:31:12 +00:00
flex: 1 1 auto;
margin: 0.5em 0;
overflow: hidden;
2022-05-18 17:14:24 +00:00
}
#main-wrapper.side-by-side {
2022-06-10 09:31:12 +00:00
flex-direction: row;
}
#main-wrapper.side-by-side > fieldset {
margin-left: 0.25em;
margin-right: 0.25em;
}
#main-wrapper:not(.side-by-side) > fieldset {
margin-bottom: 0.25em;
2022-05-18 17:14:24 +00:00
}
2022-05-19 16:11:35 +00:00
#main-wrapper.swapio {
flex-direction: column;
}
#main-wrapper.side-by-side.swapio {
2022-06-10 09:31:12 +00:00
flex-direction: row-reverse;
2022-05-19 16:11:35 +00:00
}
2022-06-10 09:31:12 +00:00
.zone-wrapper{
2022-05-18 17:14:24 +00:00
display: flex;
2022-06-10 09:31:12 +00:00
margin: 0;
flex: 1 1 0%;
border-radius: 0.5em;
min-width: inherit/*important: resolves inability to scroll fieldset child element!*/;
padding: 0.35em 0 0 0;
}
.zone-wrapper textarea {
border-radius: 0.5em;
2022-05-18 17:14:24 +00:00
flex: 1 1 auto;
2022-06-10 09:31:12 +00:00
/*min/max width resolve an inexplicable margin on the RHS. The -1em
is for the padding, else we overlap the parent boundaries.*/
/*min-width: calc(100% - 1em);
max-width: calc(100% - 1em);
padding: 0 0.5em;*/
2022-05-18 17:14:24 +00:00
}
2022-06-10 09:31:12 +00:00
.zone-wrapper.input { flex: 10 1 auto; }
.zone-wrapper.output { flex: 20 1 auto; }
.zone-wrapper > div {
display:flex;
flex: 1 1 0%;
2022-05-19 09:22:16 +00:00
}
2022-06-10 09:31:12 +00:00
.zone-wrapper.output {}
2022-05-18 17:14:24 +00:00
.button-bar {
display: flex;
2022-05-21 00:45:46 +00:00
flex-wrap: wrap;
2022-06-10 09:31:12 +00:00
align-items: center;
align-content: space-between;
justify-content: flex-start;
2022-05-18 17:14:24 +00:00
}
2022-06-10 09:31:12 +00:00
.button-bar > * {
margin: 0.05em 0.5em 0.05em 0;
flex: 0 1 auto;
align-self: auto;
2022-05-18 17:14:24 +00:00
}
2022-05-18 22:58:34 +00:00
label[for] {
2022-05-18 17:22:02 +00:00
cursor: pointer;
}
2022-05-18 21:18:21 +00:00
.error {
color: red;
background-color: yellow;
}
2022-05-19 18:14:34 +00:00
.hidden, .initially-hidden {
2022-05-19 10:24:50 +00:00
position: absolute !important;
opacity: 0 !important;
pointer-events: none !important;
display: none !important;
}
2022-06-10 15:43:03 +00:00
fieldset {
2022-05-27 03:27:10 +00:00
border-radius: 0.5em;
border: 1px inset;
2022-06-10 09:31:12 +00:00
padding: 0.25em;
2022-05-18 23:40:27 +00:00
}
2022-06-10 15:43:03 +00:00
fieldset.options {
font-size: 80%;
margin-top: 0.5em;
}
fieldset:not(.options) > legend {
font-size: 80%;
}
2022-06-10 09:31:12 +00:00
fieldset.options > div {
2022-05-24 19:01:21 +00:00
display: flex;
flex-wrap: wrap;
2022-05-27 03:27:10 +00:00
}
2022-06-10 15:43:03 +00:00
fieldset button {
font-size: inherit;
2022-05-27 03:27:10 +00:00
}
2022-06-10 09:31:12 +00:00
fieldset.collapsible > legend > .fieldset-toggle::after {
2022-05-27 03:27:10 +00:00
content: " [hide]";
position: relative;
}
2022-06-10 09:31:12 +00:00
fieldset.collapsible.collapsed > legend > .fieldset-toggle::after {
2022-05-27 03:27:10 +00:00
content: " [show]";
position: relative;
2022-05-24 19:01:21 +00:00
}
2022-05-18 23:40:27 +00:00
span.labeled-input {
padding: 0.25em;
2022-06-10 09:31:12 +00:00
margin: 0.05em 0.25em;
2022-05-18 23:40:27 +00:00
border-radius: 0.25em;
2022-05-19 00:38:34 +00:00
white-space: nowrap;
2022-05-19 16:11:35 +00:00
background: #0002;
2022-06-10 09:31:12 +00:00
display: flex;
align-items: center;
2022-05-18 23:40:27 +00:00
}
2022-06-10 09:31:12 +00:00
span.labeled-input > *:nth-child(2) {
margin-left: 0.3em;
2022-05-19 01:12:23 +00:00
}
2022-05-19 10:24:50 +00:00
.center { text-align: center; }
2022-05-19 15:58:13 +00:00
body.terminal-mode {
max-height: calc(100% - 2em);
display: flex;
flex-direction: column;
align-items: stretch;
}
2022-06-10 09:31:12 +00:00
#view-terminal {}
2022-05-19 15:58:13 +00:00
.app-view {
flex: 20 1 auto;
}
#view-split {
display: flex;
2022-05-24 19:01:21 +00:00
flex-direction: column-reverse;
2022-05-19 15:58:13 +00:00
}
2022-05-18 17:14:24 +00:00
< / style >
< / head >
< body >
2022-06-10 09:31:12 +00:00
< header id = 'titlebar' >
2023-11-28 09:26:28 +01:00
< span > libSQL Fiddle< / span >
2022-06-10 09:31:12 +00:00
< span class = 'powered-by' > Powered by
2023-11-28 09:26:28 +01:00
< a href = 'https://libsql.org' > libSQL< / a > < / span >
2022-06-10 09:31:12 +00:00
< / header >
2022-05-22 00:27:19 +00:00
<!-- emscripten bits -->
2022-05-21 14:19:05 +00:00
< figure id = "module-spinner" >
2022-05-19 10:24:50 +00:00
< div class = "spinner" > < / div >
< div class = 'center' > < strong > Initializing app...< / strong > < / div >
< div class = 'center' >
On a slow internet connection this may take a moment. If this
message displays for "a long time", intialization may have
failed and the JavaScript console may contain clues as to why.
< / div >
< / figure >
2022-05-21 14:19:05 +00:00
< div class = "emscripten" id = "module-status" > Downloading...< / div >
2022-05-18 17:14:24 +00:00
< div class = "emscripten" >
2022-05-21 14:19:05 +00:00
< progress value = "0" max = "100" id = "module-progress" hidden = '1' > < / progress >
2022-05-22 00:27:19 +00:00
< / div > <!-- /emscripten bits -->
2022-05-19 15:58:13 +00:00
2022-05-20 13:50:04 +00:00
< div id = 'view-terminal' class = 'app-view hidden initially-hidden' >
2022-06-10 09:31:12 +00:00
This is a placeholder for a terminal-like view which is not in
the default build.
2022-05-19 15:58:13 +00:00
< / div >
< div id = 'view-split' class = 'app-view initially-hidden' >
2022-06-10 09:31:12 +00:00
< fieldset class = 'options collapsible' >
< legend > < button class = 'fieldset-toggle' > Options< / button > < / legend >
2022-05-19 15:58:13 +00:00
< div class = '' >
< span class = 'labeled-input' >
2022-05-19 16:30:03 +00:00
< input type = 'checkbox' id = 'opt-cb-sbs'
data-csstgt='#main-wrapper'
data-cssclass='side-by-side'
data-config='sideBySide'>
2022-05-19 15:58:13 +00:00
< label for = 'opt-cb-sbs' > Side-by-side< / label >
< / span >
2022-05-19 16:11:35 +00:00
< span class = 'labeled-input' >
2022-05-19 16:30:03 +00:00
< input type = 'checkbox' id = 'opt-cb-swapio'
data-csstgt='#main-wrapper'
data-cssclass='swapio'
data-config='swapInOut'>
2022-05-19 16:11:35 +00:00
< label for = 'opt-cb-swapio' > Swap in/out< / label >
< / span >
2022-05-19 15:58:13 +00:00
< span class = 'labeled-input' >
< input type = 'checkbox' id = 'opt-cb-autoscroll'
data-config='autoScrollOutput'>
< label for = 'opt-cb-autoscroll' > Auto-scroll output< / label >
< / span >
< span class = 'labeled-input' >
< input type = 'checkbox' id = 'opt-cb-autoclear'
data-config='autoClearOutput'>
< label for = 'opt-cb-autoclear' > Auto-clear output< / label >
< / span >
2022-05-24 19:01:21 +00:00
< span class = 'labeled-input' >
2022-06-06 06:29:09 +00:00
< input type = 'file' id = 'load-db' class = 'hidden' / >
< button id = 'btn-load-db' > Load DB...< / button >
2022-05-24 19:01:21 +00:00
< / span >
2022-05-24 22:16:12 +00:00
< span class = 'labeled-input' >
< button id = 'btn-export' > Download DB< / button >
< / span >
2022-05-27 03:27:10 +00:00
< span class = 'labeled-input' >
< button id = 'btn-reset' > Reset DB< / button >
< / span >
2022-05-19 15:58:13 +00:00
< / div >
2022-06-10 09:31:12 +00:00
< / fieldset > <!-- .options -->
2022-05-19 16:11:35 +00:00
< div id = 'main-wrapper' class = '' >
2022-06-10 09:31:12 +00:00
< fieldset class = 'zone-wrapper input' >
< legend > < div class = 'button-bar' >
2022-05-21 14:19:05 +00:00
< button id = 'btn-shell-exec' > Run< / button >
2022-05-19 17:47:17 +00:00
< button id = 'btn-clear' > Clear Input< / button >
2022-06-10 09:31:12 +00:00
<!-- button data - cmd='.help'>Help</button -->
< select id = 'select-examples' > < / select >
< / div > < / legend >
< div > < textarea id = "input"
placeholder="Shell input. Ctrl-enter/shift-enter runs it.">
-- ==================================================
-- Use ctrl-enter or shift-enter to execute sqlite3
-- shell commands and SQL.
-- If a subset of the text is currently selected,
-- only that part is executed.
-- ==================================================
.nullvalue NULL
.headers on
< / textarea > < / div >
< / fieldset >
< fieldset class = 'zone-wrapper output' >
< legend > < div class = 'button-bar' >
2022-05-19 17:47:17 +00:00
< button id = 'btn-clear-output' > Clear Output< / button >
2022-05-24 19:01:21 +00:00
< button id = 'btn-interrupt' class = 'hidden' disabled > Interrupt< / button >
<!-- interruption cannot work in the current configuration
because we cannot send an interrupt message when work
is currently underway. At that point the Worker is
2022-05-27 17:13:56 +00:00
tied up and will not receive the message. -->
2022-06-10 09:31:12 +00:00
< / div > < / legend >
< div > < textarea id = "output" readonly
placeholder="Shell output.">< / textarea > < / div >
< / fieldset >
2022-05-18 17:14:24 +00:00
< / div >
2022-05-19 18:14:34 +00:00
< / div > <!-- #view - split -->
2022-05-21 14:19:05 +00:00
< script src = "fiddle.js" > < / script >
2022-05-18 17:14:24 +00:00
< / body >
< / html >