diff --git a/priv/static/ws-test-echo.html b/priv/static/echo.html similarity index 100% rename from priv/static/ws-test-echo.html rename to priv/static/echo.html diff --git a/priv/static/index.html b/priv/static/index.html index 91952c7..3501522 100644 --- a/priv/static/index.html +++ b/priv/static/index.html @@ -17,7 +17,7 @@ diff --git a/priv/static/js/dist/index.d.ts b/priv/static/js/dist/index.d.ts deleted file mode 100644 index e1bf407..0000000 --- a/priv/static/js/dist/index.d.ts +++ /dev/null @@ -1,22 +0,0 @@ -/** - * Home page ts/js - * - * @module - */ -declare function main(): void; -declare function on_input_key(evt: KeyboardEvent, ielt: HTMLInputElement, oelt: HTMLTextAreaElement, cb_resize: HTMLInputElement, cb_scroll: HTMLInputElement, max_height: number): Promise; -declare function auto_resize_output(checkbox_element: HTMLInputElement, target_element: HTMLTextAreaElement, max_height: number): void; -declare function auto_scroll_to_bottom(checkbox_element: HTMLInputElement, target_element: HTMLTextAreaElement): void; -type ok_err = { - ok: true; - result: t; -} | { - ok: false; - error: string; -}; -type wfcin = { - wfcin: string; -}; -type wfcout = ok_err; -declare function assert(condition: boolean, fail_msg: string): void; -declare function fetch_wfcin(user_line: string): Promise; diff --git a/priv/static/js/dist/index.js.map b/priv/static/js/dist/index.js.map deleted file mode 100644 index fa2c502..0000000 --- a/priv/static/js/dist/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../ts/index.ts"],"names":[],"mappings":";AAAA;;;;GAIG;AAGH,oEAAoE;AACpE,qBAAqB;AACrB,oEAAoE;AAEpE,IAAI,EAAE,CAAC;AAEP,SACA,IAAI;IAIA,IAAI,IAAI,GAAoC,QAAQ,CAAC,cAAc,CAAC,WAAW,CAA8B,CAAK;IAClH,IAAI,IAAI,GAAoC,QAAQ,CAAC,cAAc,CAAC,YAAY,CAAgC,CAAE;IAClH,IAAI,SAAS,GAA+B,QAAQ,CAAC,cAAc,CAAC,oBAAoB,CAAqB,CAAK;IAClH,IAAI,SAAS,GAA+B,QAA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E,IAAI,CAAC;QACD,IAAI,QAAQ,GAAc,MAAM,KAAK,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC;QAC7D,IAAI,QAAQ,CAAC,EAAE;YACX,MAAM,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAY,CAAC;aACxC,CAAC;YACF,OAAO,CAAC,GAAG,CAAC,oBAAoB,EAAE,QAAQ,CAAC,CAAC;YAC5C,MAAM,GAAG,EAAC,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,mBAAmB,EAAC,CAAC;QACrD,CAAC;IACL,CAAC;IACD,OAAO,CAAM,EAAE,CAAC;QACZ,OAAO,CAAC,GAAG,CAAC,gBAAgB,EAAE,CAAC,CAAC,CAAC;QACjC,MAAM,GAAG,EAAC,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,eAAe,EAAC,CAAC;IACjD,CAAC;IAED,OAAO,MAAM,CAAC;AAClB,CAAC"} \ No newline at end of file diff --git a/priv/static/js/dist/wfc.d.ts b/priv/static/js/dist/wfc.d.ts new file mode 100644 index 0000000..6aae126 --- /dev/null +++ b/priv/static/js/dist/wfc.d.ts @@ -0,0 +1,6 @@ +/** + * Home page ts/js + * + * @module + */ +export {}; diff --git a/priv/static/js/dist/index.js b/priv/static/js/dist/wfc.js similarity index 74% rename from priv/static/js/dist/index.js rename to priv/static/js/dist/wfc.js index ce687d3..ab8c2c5 100644 --- a/priv/static/js/dist/index.js +++ b/priv/static/js/dist/wfc.js @@ -1,9 +1,9 @@ -"use strict"; /** * Home page ts/js * * @module */ +import * as libfewd from './libfewd.js'; //------------------------------------------------------------------ // page element stuff //------------------------------------------------------------------ @@ -42,28 +42,11 @@ async function on_input_key(evt, ielt, oelt, cb_resize, cb_scroll, max_height) { oelt.value += result.error; oelt.value += '\n'; // auto-resize - auto_resize_output(cb_resize, oelt, max_height); - auto_scroll_to_bottom(cb_scroll, oelt); + libfewd.auto_resize(cb_resize, oelt, max_height); + libfewd.auto_scroll_to_bottom(cb_scroll, oelt); } } } -function auto_resize_output(checkbox_element, target_element, max_height) { - // if the user has manually resized their output, we do nothing - if (checkbox_element.checked) { - let target_height = target_element.scrollHeight; - // resize it automagically up to 500px - if (target_height < max_height) - target_element.style.height = String(target_height) + 'px'; - else - target_element.style.height = String(max_height) + 'px'; - } -} -function auto_scroll_to_bottom(checkbox_element, target_element) { - if (checkbox_element.checked) { - // scroll to bottom - target_element.scrollTop = target_element.scrollHeight; - } -} function assert(condition, fail_msg) { if (!condition) throw new Error(fail_msg); @@ -93,4 +76,4 @@ async function fetch_wfcin(user_line) { } return result; } -//# sourceMappingURL=index.js.map \ No newline at end of file +//# sourceMappingURL=wfc.js.map \ No newline at end of file diff --git a/priv/static/js/dist/wfc.js.map b/priv/static/js/dist/wfc.js.map new file mode 100644 index 0000000..ca3d152 --- /dev/null +++ b/priv/static/js/dist/wfc.js.map @@ -0,0 +1 @@ +{"version":3,"file":"wfc.js","sourceRoot":"","sources":["../ts/wfc.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,OAAO,MAAM,cAAc,CAAA;AAEvC,oEAAoE;AACpE,qBAAqB;AACrB,oEAAoE;AAEpE,IAAI,EAAE,CAAC;AAEP,SACA,IAAI;IAIA,IAAI,IAAI,GAAoC,QAAQ,CAAC,cAAc,CAAC,WAAW,CAA8B,CAAK;IAClH,IAAI,IAAI,GAAoC,QAAQ,CAAC,cAAc,CAAC,YAAY,CAAgC,CAAE;IAClH,IAAI,SAAS,GAA+B,QAAQ,CAAC,cAAc,CAAC,oBAAoB,CAAqB,CAAK;IAClH,IAAI,SAAS,GAA+B,QAAQ,CAAC,cAAc,CAAC,aAAa,CAA4B,CAAK;IAClH,IAAI,eAAe,GAAyB,GAAG,CAAC;IAGhD,IAAI,CAAC,gBAAgB,CAAC,SAAS,EAC3B,UAAS,CAAgB;QACrB,YAAY,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,SAAS,EAAE,eAAe,CAAC,CAAC;IAC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C;AAGD,KAAK,UACL,WAAW,CACN,SAAkB;IAGnB,IAAI,YAAY,GAAG,EAAC,KAAK,EAAE,SAAS,EAAC,CAAC;IACtC,IAAI,YAAY,GAAG,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC;IAEhD,IAAI,WAAW,GAAI,EAAC,MAAM,EAAG,MAAM;QACf,OAAO,EAAE,EAAC,cAAc,EAAE,kBAAkB,EAAC;QAC7C,IAAI,EAAK,YAAY,EAAC,CAAC;IAE3C,mEAAmE;IACnE,4CAA4C;IAC5C,IAAI,MAAM,GAAW,EAAC,EAAE,EAAM,KAAK;QACb,KAAK,EAAG,kCAAkC,EAAC,CAAC;IAElE,IAAI,CAAC;QACD,IAAI,QAAQ,GAAc,MAAM,KAAK,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC;QAC7D,IAAI,QAAQ,CAAC,EAAE;YACX,MAAM,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAY,CAAC;aACxC,CAAC;YACF,OAAO,CAAC,GAAG,CAAC,oBAAoB,EAAE,QAAQ,CAAC,CAAC;YAC5C,MAAM,GAAG,EAAC,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,mBAAmB,EAAC,CAAC;QACrD,CAAC;IACL,CAAC;IACD,OAAO,CAAM,EAAE,CAAC;QACZ,OAAO,CAAC,GAAG,CAAC,gBAAgB,EAAE,CAAC,CAAC,CAAC;QACjC,MAAM,GAAG,EAAC,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,eAAe,EAAC,CAAC;IACjD,CAAC;IAED,OAAO,MAAM,CAAC;AAClB,CAAC"} \ No newline at end of file diff --git a/priv/static/js/ts/index.ts b/priv/static/js/ts/wfc.ts similarity index 78% rename from priv/static/js/ts/index.ts rename to priv/static/js/ts/wfc.ts index 2b535c0..2871143 100644 --- a/priv/static/js/ts/index.ts +++ b/priv/static/js/ts/wfc.ts @@ -4,6 +4,7 @@ * @module */ +import * as libfewd from './libfewd.js' //------------------------------------------------------------------ // page element stuff @@ -68,47 +69,13 @@ on_input_key oelt.value += '\n'; // auto-resize - auto_resize_output(cb_resize, oelt, max_height); - auto_scroll_to_bottom(cb_scroll, oelt); + libfewd.auto_resize(cb_resize, oelt, max_height); + libfewd.auto_scroll_to_bottom(cb_scroll, oelt); } } } - -function -auto_resize_output - (checkbox_element : HTMLInputElement, - target_element : HTMLTextAreaElement, - max_height : number) - : void -{ - // if the user has manually resized their output, we do nothing - if (checkbox_element.checked) { - let target_height: number = target_element.scrollHeight; - // resize it automagically up to 500px - if (target_height < max_height) - target_element.style.height = String(target_height) + 'px'; - else - target_element.style.height = String(max_height) + 'px'; - } -} - - -function -auto_scroll_to_bottom - (checkbox_element : HTMLInputElement, - target_element : HTMLTextAreaElement) - : void -{ - if (checkbox_element.checked) { - // scroll to bottom - target_element.scrollTop = target_element.scrollHeight; - } -} - - - //------------------------------------------------------------------ // wfc api //------------------------------------------------------------------ diff --git a/priv/static/wfc.html b/priv/static/wfc.html index 72ac544..1ae26d1 100644 --- a/priv/static/wfc.html +++ b/priv/static/wfc.html @@ -25,6 +25,6 @@ - +