diff --git a/eslint.config.mjs b/eslint.config.mjs index d1431c96b..13d2a9ab6 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -82,6 +82,7 @@ export default [ "prefer-const": "warn", "sort-imports": "off", "sort-keys": "off", + "solid/jsx-no-undef": "off", }, linterOptions: { reportUnusedDisableDirectives: "error", diff --git a/package-lock.json b/package-lock.json index 8c91c5ff1..d12cf822c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -30,7 +30,7 @@ "rehype-autolink-headings": "^7.1.0", "remark-custom-heading-id": "^2.0.0", "solid-icons": "^1.1.0", - "solid-js": "^1.9.1", + "solid-js": "^1.9.2", "solid-markdown": "^2.0.13", "solid-toast": "^0.5.0", "tippy.js": "^6.3.7", @@ -8445,9 +8445,9 @@ } }, "node_modules/solid-js": { - "version": "1.9.1", - "resolved": "https://registry.npmjs.org/solid-js/-/solid-js-1.9.1.tgz", - "integrity": "sha512-Gd6QWRFfO2XKKZqVK4YwbhWZkr0jWw1dYHOt+VYebomeyikGP0SuMflf42XcDuU9HAEYDArFJIYsBNjlE7iZsw==", + "version": "1.9.2", + "resolved": "https://registry.npmjs.org/solid-js/-/solid-js-1.9.2.tgz", + "integrity": "sha512-fe/K03nV+kMFJYhAOE8AIQHcGxB4rMIEoEyrulbtmf217NffbbwBqJnJI4ovt16e+kaIt0czE2WA7mP/pYN9yg==", "license": "MIT", "dependencies": { "csstype": "^3.1.0", diff --git a/package.json b/package.json index 871ee7edc..4c567700d 100644 --- a/package.json +++ b/package.json @@ -68,7 +68,7 @@ "rehype-autolink-headings": "^7.1.0", "remark-custom-heading-id": "^2.0.0", "solid-icons": "^1.1.0", - "solid-js": "^1.9.1", + "solid-js": "^1.9.2", "solid-markdown": "^2.0.13", "solid-toast": "^0.5.0", "tippy.js": "^6.3.7", diff --git a/resources/js/components/ui/Table/Header.tsx b/resources/js/components/ui/Table/Header.tsx index 0a3b1a318..398953275 100644 --- a/resources/js/components/ui/Table/Header.tsx +++ b/resources/js/components/ui/Table/Header.tsx @@ -55,7 +55,7 @@ export const Header: VoidComponent = (props) => {
div.addEventListener("touchstart", (e) => resizeHandler()(e), {passive: true})} + on:touchstart={{handleEvent: (e) => resizeHandler()(e), passive: true}} class={cx( "absolute top-0 right-0 h-full cursor-col-resize w-[5px] select-none touch-none", props.ctx.column.getIsResizing() ? "bg-memo-active" : "hover:bg-gray-400", diff --git a/resources/js/components/ui/Table/Table.tsx b/resources/js/components/ui/Table/Table.tsx index 63de28f3d..99693a062 100644 --- a/resources/js/components/ui/Table/Table.tsx +++ b/resources/js/components/ui/Table/Table.tsx @@ -276,26 +276,23 @@ export const Table = (allProps: VoidProps>): JSX.Element => {
- div.addEventListener( - "wheel", - (e) => { - if (e.deltaX) { - // With 2d wheels (like a touchpad) avoid too much interference between the axes. - setDesiredScrollX(undefined); - return; - } - const scrWrapper = scrollingWrapper(); - if (scrWrapper && !e.shiftKey && e.deltaY) { - setDesiredScrollX((l = scrWrapper.scrollLeft) => - Math.min(Math.max(l + e.deltaY, 0), scrWrapper.scrollWidth - scrWrapper.clientWidth), - ); - e.preventDefault(); - } - }, - {passive: false}, - ) - } + on:wheel={{ + handleEvent: (e) => { + if (e.deltaX) { + // With 2d wheels (like a touchpad) avoid too much interference between the axes. + setDesiredScrollX(undefined); + return; + } + const scrWrapper = scrollingWrapper(); + if (scrWrapper && !e.shiftKey && e.deltaY) { + setDesiredScrollX((l = scrWrapper.scrollLeft) => + Math.min(Math.max(l + e.deltaY, 0), scrWrapper.scrollWidth - scrWrapper.clientWidth), + ); + e.preventDefault(); + } + }, + passive: false, + }} class={s.headerRow} > diff --git a/resources/js/components/ui/calendar/ColumnsCalendar.tsx b/resources/js/components/ui/calendar/ColumnsCalendar.tsx index b1914abf2..da4bd720c 100644 --- a/resources/js/components/ui/calendar/ColumnsCalendar.tsx +++ b/resources/js/components/ui/calendar/ColumnsCalendar.tsx @@ -158,17 +158,14 @@ export const ColumnsCalendar: VoidComponent = (allProps) => { {(col) =>
{col.header()}
}
{ - div.addEventListener( - "wheel", - (e) => { - if (e.altKey) { - props.onWheelWithAlt?.(e, "allDay"); - e.preventDefault(); - } - }, - {passive: false}, - ); + on:wheel={{ + handleEvent: (e) => { + if (e.altKey) { + props.onWheelWithAlt?.(e, "allDay"); + e.preventDefault(); + } + }, + passive: false, }} class={s.columnsAllDayArea} > @@ -176,17 +173,14 @@ export const ColumnsCalendar: VoidComponent = (allProps) => {
{ - div.addEventListener( - "wheel", - (e) => { - if (e.altKey) { - props.onWheelWithAlt?.(e, "hours"); - e.preventDefault(); - } - }, - {passive: false}, - ); + on:wheel={{ + handleEvent: (e) => { + if (e.altKey) { + props.onWheelWithAlt?.(e, "hours"); + e.preventDefault(); + } + }, + passive: false, }} class={s.hoursArea} onScroll={() => setHoursAreaScrollOffset(hoursArea()!.scrollTop)} diff --git a/resources/js/components/ui/calendar/MonthCalendar.tsx b/resources/js/components/ui/calendar/MonthCalendar.tsx index 8d430bf4e..1c84a8fb4 100644 --- a/resources/js/components/ui/calendar/MonthCalendar.tsx +++ b/resources/js/components/ui/calendar/MonthCalendar.tsx @@ -56,18 +56,15 @@ export const MonthCalendar: VoidComponent = (allProps) => {
- div.addEventListener( - "wheel", - (e) => { - if (e.altKey) { - props.onWheelWithAlt?.(e); - e.preventDefault(); - } - }, - {passive: false}, - ) - } + on:wheel={{ + handleEvent: (e) => { + if (e.altKey) { + props.onWheelWithAlt?.(e); + e.preventDefault(); + } + }, + passive: false, + }} class="col-span-full row-start-2 grid grid-cols-subgrid gap-px overflow-x-clip overflow-y-auto" style={{"grid-auto-rows": "1fr"}} > diff --git a/resources/js/components/ui/title.tsx b/resources/js/components/ui/title.tsx index 765856b9e..220cd7ded 100644 --- a/resources/js/components/ui/title.tsx +++ b/resources/js/components/ui/title.tsx @@ -5,8 +5,6 @@ import "tippy.js/dist/border.css"; import "tippy.js/dist/tippy.css"; import "./title.scss"; -export type TitleDirectiveType = JSX.Element | readonly [JSX.Element, Partial]; - interface ExtraTippyProps extends Omit { /** The appear/disappear delay. Undefined means the default. */ readonly delay?: number | readonly [number | null | undefined, number | null | undefined]; @@ -14,8 +12,8 @@ interface ExtraTippyProps extends Omit { declare module "solid-js" { namespace JSX { - interface Directives { - title: TitleDirectiveType; + interface DirectiveFunctions { + title: typeof title; } } } @@ -104,6 +102,8 @@ class TippySingletonManager { const tippySingletonManager = new TippySingletonManager(); +export type TitleDirectiveType = JSX.Element | readonly [JSX.Element, Partial]; + /** * A replacement for the title attribute, using tippy.js. * @@ -124,7 +124,7 @@ const tippySingletonManager = new TippySingletonManager(); * The easiest workaround is to wrap the (potentially) disabled element in a div or span and put * the title on that element. */ -export function title(element: Element, accessor: Accessor) { +export function title(element: HTMLElement, accessor: Accessor) { let thisTippy: Instance | undefined; createEffect( on(accessor, (value) => { diff --git a/resources/js/index.tsx b/resources/js/index.tsx index 04add027c..c0985b621 100644 --- a/resources/js/index.tsx +++ b/resources/js/index.tsx @@ -3,7 +3,7 @@ import {TransProvider} from "@mbarzda/solid-i18next"; import {MetaProvider} from "@solidjs/meta"; import {InitializeTanstackQuery} from "components/utils"; import {DEV, ErrorBoundary, Show} from "solid-js"; -import {DelegatedEvents, render} from "solid-js/web"; +import {render} from "solid-js/web"; import {Toaster} from "solid-toast"; import {TimeZoneController} from "time_zone_controller"; import App from "./App"; @@ -11,10 +11,11 @@ import {FatalError} from "./FatalError"; import {LoaderInPortal, MemoLoader} from "./components/ui/MemoLoader"; import {GlobalPageElements} from "./components/utils/GlobalPageElements"; import {DictionariesAndAttributesProvider} from "./data-access/memo-api/dictionaries_and_attributes_context"; -import "./global_init"; import {translationsLoaded} from "./i18n_loader"; import "./index.scss"; -import {luxonInit} from "./luxon_init"; +import "./init_luxon"; +import "./init_solid"; +import "./init_types"; const root = document.getElementById("root"); if (!(root instanceof HTMLElement)) { @@ -23,11 +24,6 @@ if (!(root instanceof HTMLElement)) { const TOAST_DURATION_SECS = 10; -luxonInit(); - -// Allow stopping propagation of events (see https://github.com/solidjs/solid/issues/1786#issuecomment-1694589801). -DelegatedEvents.clear(); - render(() => { return (