feat: remove ts errors of typer-js, autosize, qrcode and sortablejs

master
Katja Lutz 2 years ago
parent 58ff9f2f58
commit c09b0ecb4d

34
package-lock.json generated

@ -1,10 +1,12 @@
{
"name": "rappli",
"version": "0.0.1",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "rappli",
"version": "0.0.1",
"license": "MIT",
"dependencies": {
"solid-start": "v0.1.0-alpha.89",
@ -19,6 +21,8 @@
"@tailwindcss/typography": "^0.5.2",
"@thisbeyond/solid-select": "^0.11.0",
"@types/big.js": "^6.1.3",
"@types/qrcode": "^1.4.2",
"@types/sortablejs": "^1.13.0",
"autoprefixer": "^10.4.2",
"autosize": "^5.0.1",
"big.js": "^6.2.0",
@ -1915,6 +1919,15 @@
"integrity": "sha512-Gj7cI7z+98M282Tqmp2K5EIsoouUEzbBJhQQzDE3jSIRk6r9gsz0oUokqIUR4u1R3dMHo0pDHM7sNOHyhulypw==",
"dev": true
},
"node_modules/@types/qrcode": {
"version": "1.4.2",
"resolved": "https://registry.npmjs.org/@types/qrcode/-/qrcode-1.4.2.tgz",
"integrity": "sha512-7uNT9L4WQTNJejHTSTdaJhfBSCN73xtXaHFyBJ8TSwiLhe4PRuTue7Iph0s2nG9R/ifUaSnGhLUOZavlBEqDWQ==",
"dev": true,
"dependencies": {
"@types/node": "*"
}
},
"node_modules/@types/resolve": {
"version": "1.17.1",
"resolved": "https://registry.npmjs.org/@types/resolve/-/resolve-1.17.1.tgz",
@ -1923,6 +1936,12 @@
"@types/node": "*"
}
},
"node_modules/@types/sortablejs": {
"version": "1.13.0",
"resolved": "https://registry.npmjs.org/@types/sortablejs/-/sortablejs-1.13.0.tgz",
"integrity": "sha512-C3064MH72iEfeGCYEGCt7FCxXoAXaMPG0QPnstcxvPmbl54erpISu06d++FY37Smja64iWy5L8wOyHHBghWbJQ==",
"dev": true
},
"node_modules/@types/unist": {
"version": "2.0.6",
"resolved": "https://registry.npmjs.org/@types/unist/-/unist-2.0.6.tgz",
@ -9500,6 +9519,15 @@
"integrity": "sha512-Gj7cI7z+98M282Tqmp2K5EIsoouUEzbBJhQQzDE3jSIRk6r9gsz0oUokqIUR4u1R3dMHo0pDHM7sNOHyhulypw==",
"dev": true
},
"@types/qrcode": {
"version": "1.4.2",
"resolved": "https://registry.npmjs.org/@types/qrcode/-/qrcode-1.4.2.tgz",
"integrity": "sha512-7uNT9L4WQTNJejHTSTdaJhfBSCN73xtXaHFyBJ8TSwiLhe4PRuTue7Iph0s2nG9R/ifUaSnGhLUOZavlBEqDWQ==",
"dev": true,
"requires": {
"@types/node": "*"
}
},
"@types/resolve": {
"version": "1.17.1",
"resolved": "https://registry.npmjs.org/@types/resolve/-/resolve-1.17.1.tgz",
@ -9508,6 +9536,12 @@
"@types/node": "*"
}
},
"@types/sortablejs": {
"version": "1.13.0",
"resolved": "https://registry.npmjs.org/@types/sortablejs/-/sortablejs-1.13.0.tgz",
"integrity": "sha512-C3064MH72iEfeGCYEGCt7FCxXoAXaMPG0QPnstcxvPmbl54erpISu06d++FY37Smja64iWy5L8wOyHHBghWbJQ==",
"dev": true
},
"@types/unist": {
"version": "2.0.6",
"resolved": "https://registry.npmjs.org/@types/unist/-/unist-2.0.6.tgz",

@ -24,6 +24,8 @@
"@tailwindcss/typography": "^0.5.2",
"@thisbeyond/solid-select": "^0.11.0",
"@types/big.js": "^6.1.3",
"@types/qrcode": "^1.4.2",
"@types/sortablejs": "^1.13.0",
"autoprefixer": "^10.4.2",
"autosize": "^5.0.1",
"big.js": "^6.2.0",

@ -28,13 +28,13 @@ const QrCode: Component<
return qrcode.toString(value, {
type: "svg",
margin: props.margin,
errorCorrectionLevel: props.errorCorrectionLevel,
errorCorrectionLevel: props.errorCorrectionLevel as any,
});
}
);
createEffect(() => {
const html = svg();
const html = svg() || "";
requestAnimationFrame(function () {
ref.innerHTML = html;
});

@ -72,12 +72,16 @@ export const PositionsSettings: Component = () => {
ghostClass: "sortable-ghost-card",
filter: ".drag-disabled",
// forceFallback: true,
onEnd: (evt: any) => {
onEnd: (evt) => {
const oldIndex = evt.oldIndex;
const newIndex = evt.newIndex;
if (oldIndex == null || newIndex == null) {
return;
}
setState(
"positions",
produce((positions: any[]) => {
const oldIndex = evt.oldIndex;
const newIndex = evt.newIndex;
let item = positions[oldIndex];
positions.splice(oldIndex, 1);
positions.splice(newIndex, 0, unwrap(item));

@ -3,20 +3,24 @@ import Sortable from "sortablejs";
// https://github.com/SortableJS/Sortable
export const sortable = (el: HTMLElement, config: () => any) => {
export const sortable = (el: HTMLElement, config: () => Sortable.Options) => {
onMount(function () {
const config_ = config();
const userOnEnd = config_?.onEnd;
if (userOnEnd) {
config_.onEnd = (evt) => {
const parent = evt.from;
const oldNextSibling =
parent.children[evt.oldIndex + (evt.oldIndex > evt.newIndex ? 1 : 0)];
if (oldNextSibling) {
parent.insertBefore(evt.item, oldNextSibling);
} else {
parent.append(evt.item);
if (evt.oldIndex != null && evt.newIndex != null) {
const parent = evt.from;
const oldNextSibling =
parent.children[
evt.oldIndex + (evt.oldIndex > evt.newIndex ? 1 : 0)
];
if (oldNextSibling) {
parent.insertBefore(evt.item, oldNextSibling);
} else {
parent.append(evt.item);
}
}
userOnEnd(evt);
@ -34,7 +38,7 @@ export const sortable = (el: HTMLElement, config: () => any) => {
declare module "solid-js" {
namespace JSX {
interface Directives {
sortable: any;
sortable: Sortable.Options;
}
}
}

2
src/index.d.ts vendored

@ -1,2 +1,4 @@
declare const __APP_VERSION__: string;
declare const __BUILD_TIME__: number;
declare module "typer-js";
declare module "autosize";

Loading…
Cancel
Save