diff --git a/src/elements/CopyableInputBox.ts b/src/elements/CopyableInputBox.ts index 7157aaa..43c6a40 100644 --- a/src/elements/CopyableInputBox.ts +++ b/src/elements/CopyableInputBox.ts @@ -1,4 +1,4 @@ -import { MarginInline } from "./MarginInline.js"; +import { MarginInline } from "./MarginInline"; import { addClipboardNotifications } from "../pageUtils"; import { makeElement } from "../htmlUtils"; import ClipboardJS from "clipboard"; diff --git a/src/elements/Margin.js b/src/elements/Margin.ts similarity index 52% rename from src/elements/Margin.js rename to src/elements/Margin.ts index 8afc59f..7421d29 100644 --- a/src/elements/Margin.js +++ b/src/elements/Margin.ts @@ -1,10 +1,9 @@ import { makeElement } from "../htmlUtils"; -export function Margin(children, options = {}) { +export function Margin(children: null | Element | (Element | null[])): Element { return makeElement({ tag: "div", class: "uk-margin", - children: children, - ...options + children: children }); } \ No newline at end of file diff --git a/src/elements/MarginInline.js b/src/elements/MarginInline.ts similarity index 63% rename from src/elements/MarginInline.js rename to src/elements/MarginInline.ts index fdf8ebd..729262e 100644 --- a/src/elements/MarginInline.js +++ b/src/elements/MarginInline.ts @@ -1,6 +1,6 @@ import { makeElement } from "../htmlUtils"; -export function MarginInline(children, marginOptions = {}, inlineOptions = {}) { +export function MarginInline(children: null | Element | (Element | null[])): Element { return makeElement({ tag: "div", class: "uk-margin", @@ -8,8 +8,6 @@ export function MarginInline(children, marginOptions = {}, inlineOptions = {}) { tag: "div", class: "uk-inline", children: children, - ...inlineOptions, }), - ...marginOptions, }); } \ No newline at end of file diff --git a/src/elements/QRScanner.js b/src/elements/QRScanner.js index c94fa42..a3b8afb 100644 --- a/src/elements/QRScanner.js +++ b/src/elements/QRScanner.js @@ -1,4 +1,4 @@ -import { Margin } from "./Margin.js"; +import { Margin } from "./Margin"; import { makeElement } from "../htmlUtils"; import QrScanner from 'qr-scanner'; diff --git a/src/htmlUtils.ts b/src/htmlUtils.ts index 28dfc68..a45ca1c 100644 --- a/src/htmlUtils.ts +++ b/src/htmlUtils.ts @@ -17,7 +17,7 @@ const optionsFunctions: optionsFunctionsObject = { "onclick": (e: HTMLButtonElement, arg: any) => e.onclick = arg, "attributes": setElementAttributes, "text": (e: HTMLParagraphElement, arg: string) => e.innerText = arg, - "children": (e: Element, arg: null | Element | (Element | null[])) => { + "children": (e: Element, arg: Element | Element[]) => { if (Array.isArray(arg)) { arg.forEach(child => { if (child != null) e.appendChild(child); @@ -38,6 +38,7 @@ interface ElementInfo { attributes?: { [propName: string]: any }; + children?: Element | Element[]; text?: string; thenRun?: (e: Element) => void; [propName: string]: any; diff --git a/src/pages/Login.js b/src/pages/Login.js index a4da780..14503af 100644 --- a/src/pages/Login.js +++ b/src/pages/Login.js @@ -1,5 +1,5 @@ -import { Margin } from "../elements/Margin.js"; -import { MarginInline } from "../elements/MarginInline.js"; +import { Margin } from "../elements/Margin"; +import { MarginInline } from "../elements/MarginInline"; import { Page } from "../types/Page"; import { changePage, setErrorText, setPageContent } from "../pageUtils"; import { lookupSelf } from "../api/lookupSelf"; diff --git a/src/pages/PwGen.js b/src/pages/PwGen.js index ac95f6a..f3a9331 100644 --- a/src/pages/PwGen.js +++ b/src/pages/PwGen.js @@ -1,5 +1,5 @@ import { CopyableInputBox } from "../elements/CopyableInputBox"; -import { Margin } from "../elements/Margin.js"; +import { Margin } from "../elements/Margin"; import { Page } from "../types/Page"; import { makeElement } from "../htmlUtils"; import { setPageContent } from "../pageUtils"; diff --git a/src/pages/SetLanguage.js b/src/pages/SetLanguage.js index edc0a66..67ab6c8 100644 --- a/src/pages/SetLanguage.js +++ b/src/pages/SetLanguage.js @@ -1,4 +1,4 @@ -import { Margin } from "../elements/Margin.js"; +import { Margin } from "../elements/Margin"; import { Page } from "../types/Page"; import { changePage, setPageContent } from "../pageUtils"; import { makeElement } from "../htmlUtils"; diff --git a/src/pages/TOTP/NewTOTP.js b/src/pages/TOTP/NewTOTP.js index 5220520..15f8823 100644 --- a/src/pages/TOTP/NewTOTP.js +++ b/src/pages/TOTP/NewTOTP.js @@ -1,5 +1,5 @@ -import { Margin } from "../../elements/Margin.js"; -import { MarginInline } from "../../elements/MarginInline.js"; +import { Margin } from "../../elements/Margin"; +import { MarginInline } from "../../elements/MarginInline"; import { Page } from "../../types/Page"; import { addNewTOTP } from "../../api/addNewTOTP"; import { changePage, setErrorText, setPageContent, setTitleElement } from "../../pageUtils"; diff --git a/src/pages/Transit/TransitDecrypt.js b/src/pages/Transit/TransitDecrypt.js index 24a1b56..73bccf1 100644 --- a/src/pages/Transit/TransitDecrypt.js +++ b/src/pages/Transit/TransitDecrypt.js @@ -1,5 +1,5 @@ import { CopyableModal } from "../../elements/CopyableModal"; -import { Margin } from "../../elements/Margin.js"; +import { Margin } from "../../elements/Margin"; import { Page } from "../../types/Page"; import { changePage, setErrorText, setPageContent, setTitleElement } from "../../pageUtils"; import { makeElement } from "../../htmlUtils"; diff --git a/src/pages/Transit/TransitEncrypt.js b/src/pages/Transit/TransitEncrypt.js index 76a1915..c456eb1 100644 --- a/src/pages/Transit/TransitEncrypt.js +++ b/src/pages/Transit/TransitEncrypt.js @@ -1,5 +1,5 @@ import { CopyableModal } from "../../elements/CopyableModal"; -import { Margin } from "../../elements/Margin.js"; +import { Margin } from "../../elements/Margin"; import { Page } from "../../types/Page"; import { changePage, setErrorText, setPageContent, setTitleElement } from "../../pageUtils"; import { makeElement } from "../../htmlUtils"; diff --git a/src/pages/Unseal.js b/src/pages/Unseal.js index 3c96fa1..b9d71d5 100644 --- a/src/pages/Unseal.js +++ b/src/pages/Unseal.js @@ -1,4 +1,4 @@ -import { MarginInline } from "../elements/MarginInline.js"; +import { MarginInline } from "../elements/MarginInline"; import { Page } from "../types/Page"; import { QRScanner } from "../elements/QRScanner.js"; import { changePage, setErrorText, setPageContent } from "../pageUtils";