diff --git a/components/rule-settings/rule-list.tsx b/components/rule-settings/rule-list.tsx index 613a2d9..7b26cce 100644 --- a/components/rule-settings/rule-list.tsx +++ b/components/rule-settings/rule-list.tsx @@ -102,7 +102,7 @@ function itemClass({ index, count, isDragging, dropSlot }: ItemState): string { * 先頭・末尾に着いてそのボタンが無効になったときは、もう一方のボタンにフォーカスを移す */ function useStepWithFocus( - listRef: RefObject, + listRef: RefObject, ids: readonly string[], onMove: (id: string, to: number) => void, ): (id: string, direction: MoveDirection) => void { diff --git a/components/rule-settings/use-drag-reorder.ts b/components/rule-settings/use-drag-reorder.ts index a580076..e8f0339 100644 --- a/components/rule-settings/use-drag-reorder.ts +++ b/components/rule-settings/use-drag-reorder.ts @@ -28,7 +28,7 @@ export interface DragReorder { * @remarks 一覧(listRef)の直下の要素をルールの並びとみなし、ポインターの位置から差し込み先を決める。ルールの間の隙間でもドロップできるよう、dragover・drop は各ルールではなく一覧で受ける */ export function useDragReorder( - listRef: RefObject, + listRef: RefObject, ids: readonly string[], onMove: (id: string, to: number) => void, ): DragReorder { diff --git a/components/rule-settings/use-rules.test.ts b/components/rule-settings/use-rules.test.ts index ed800d8..d623cd5 100644 --- a/components/rule-settings/use-rules.test.ts +++ b/components/rule-settings/use-rules.test.ts @@ -1,4 +1,4 @@ -import type { MutableRef } from "preact/hooks"; +import type { RefObject } from "preact"; import { describe, expect, it, onTestFinished, vi } from "vitest"; import type { ParsedRules } from "../../utils/rules/parse"; @@ -17,8 +17,8 @@ function loaded(rules: readonly Rule[]): RulesLoad { /** subscribeRules を始め、渡された読み込みの状態を順に入れた配列と、もう一度読み込む関数を返す。購読はテストの終わりにやめる */ function subscribe(store: ReturnType): { loads: RulesLoad[]; retry: () => Promise } { const loads: RulesLoad[] = []; - const latest: MutableRef = { current: null }; - const pendingWrites: MutableRef = { current: 0 }; + const latest: RefObject = { current: null }; + const pendingWrites: RefObject = { current: 0 }; const subscription = subscribeRules(store, { latest, pendingWrites, @@ -107,8 +107,8 @@ describe("unsubscribe 後の読み込み・変更通知(Issue #74 のフォロ const reading = Promise.withResolvers(); vi.spyOn(store, "read").mockReturnValueOnce(reading.promise); const loads: RulesLoad[] = []; - const latest: MutableRef = { current: null }; - const pendingWrites: MutableRef = { current: 0 }; + const latest: RefObject = { current: null }; + const pendingWrites: RefObject = { current: 0 }; const subscription = subscribeRules(store, { latest, pendingWrites, diff --git a/components/rule-settings/use-rules.ts b/components/rule-settings/use-rules.ts index 70a9dd6..9e2a1e1 100644 --- a/components/rule-settings/use-rules.ts +++ b/components/rule-settings/use-rules.ts @@ -1,4 +1,4 @@ -import type { MutableRef } from "preact/hooks"; +import type { RefObject } from "preact"; import { useCallback, useEffect, useMemo, useRef, useState } from "preact/hooks"; import type { RuleProblem } from "../../utils/rules/match"; @@ -92,9 +92,9 @@ export function useRules(store: RulesStore): RulesState { /** subscribeRules が一覧の読み込み・変更を伝える先 */ export interface RulesSubscription { /** 最新の一覧。読み込み・変更の通知で書き換える */ - latest: MutableRef; + latest: RefObject; /** 保存中の書き込みの数。0 でないあいだの通知は無視する */ - pendingWrites: MutableRef; + pendingWrites: RefObject; /** 読み込んだ・変わった一覧を受け取る */ onChange: (parsed: ParsedRules) => void; /** 読み込みが失敗したことを受け取る。latest がまだ無いときだけ呼ぶ */ @@ -158,7 +158,7 @@ export function subscribeRules( interface SaveOptions { /** 保存中の書き込みの数。保存が終わるまで増やしておく */ - pendingWrites: MutableRef; + pendingWrites: RefObject; /** 保存できたときに、pendingWrites を戻した後で呼ぶ */ onSaved: () => void; } diff --git a/package.json b/package.json index 15e9fec..4bad1f2 100644 --- a/package.json +++ b/package.json @@ -19,7 +19,7 @@ }, "dependencies": { "@logtape/logtape": "2.4.2", - "preact": "10.29.8", + "preact": "11.0.2", "valibot": "1.5.0" }, "devDependencies": { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 742ffc3..7f085b7 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -12,8 +12,8 @@ importers: specifier: 2.4.2 version: 2.4.2 preact: - specifier: 10.29.8 - version: 10.29.8 + specifier: 11.0.2 + version: 11.0.2 valibot: specifier: 1.5.0 version: 1.5.0(typescript@7.0.2) @@ -1364,10 +1364,10 @@ packages: resolution: {integrity: sha512-YUbWYCgErwnMAVkjUnYa+KlMBzGpHwiIt/DE7f0G33AuX2LH9UcTk6KgWxd3zRU+pN3u/C+Xl3EnMLM4Hea7Sg==} engines: {node: ^10 || ^12 || >=14} - preact@10.29.8: - resolution: {integrity: sha512-ej2aVZ+vZ8WO7tvlQWRM9N63A0KzF9q4mWJfDUHgYaIofWY9hu74QdnQrjoPMmZi2/nZ5gN0bJCQF49xQqx09Q==} + preact@11.0.2: + resolution: {integrity: sha512-ofG+Lqznbt13JKDjdWPLTo5ONBqcNgidqnLRzJBG6PZjzGXOLRd5y9r448+HUofTyDbgKWVrPhHP0IgcxEZslQ==} peerDependencies: - preact-render-to-string: '>=5' + preact-render-to-string: '>=6.7.0' peerDependenciesMeta: preact-render-to-string: optional: true @@ -2698,7 +2698,7 @@ snapshots: picocolors: 1.1.1 source-map-js: 1.2.2 - preact@10.29.8: {} + preact@11.0.2: {} publish-browser-extension@6.1.1: dependencies: