Add typing to Margin.ts and MarginInline.ts.
This commit is contained in:
parent
3bfba4d3fc
commit
e712af95de
|
@ -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";
|
||||
|
|
|
@ -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
|
||||
});
|
||||
}
|
|
@ -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,
|
||||
});
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
import { Margin } from "./Margin.js";
|
||||
import { Margin } from "./Margin";
|
||||
import { makeElement } from "../htmlUtils";
|
||||
import QrScanner from 'qr-scanner';
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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";
|
||||
|
|
|
@ -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";
|
||||
|
|
|
@ -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";
|
||||
|
|
|
@ -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";
|
||||
|
|
|
@ -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";
|
||||
|
|
|
@ -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";
|
||||
|
|
|
@ -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";
|
||||
|
|
Loading…
Reference in a new issue