From 08adac1c43da2bc7a5eb9d6c25f8da209b0f51a7 Mon Sep 17 00:00:00 2001 From: windingwind <33902321+windingwind@users.noreply.github.com> Date: Thu, 3 Oct 2024 15:12:44 +0200 Subject: [PATCH] update: ztoolkit --- package-lock.json | 11 ++++++---- package.json | 2 +- src/addon.ts | 13 ++++-------- src/elements/linkCreator/notePicker.ts | 2 +- src/elements/linkCreator/notePreview.ts | 2 +- src/elements/linkCreator/outlinePicker.ts | 2 +- src/elements/workspace/outlinePane.ts | 2 +- src/index.ts | 2 +- src/modules/template/picker.ts | 2 +- src/modules/viewItems.ts | 2 +- src/utils/hint.ts | 2 +- src/utils/ztoolkit.ts | 26 ++++++++++++----------- 12 files changed, 34 insertions(+), 34 deletions(-) diff --git a/package-lock.json b/package-lock.json index 6843f00a..02dd1634 100644 --- a/package-lock.json +++ b/package-lock.json @@ -35,7 +35,7 @@ "unist-util-visit": "^5.0.0", "unist-util-visit-parents": "^6.0.1", "yamljs": "^0.3.0", - "zotero-plugin-toolkit": "^3.0.3" + "zotero-plugin-toolkit": "^4.0.3" }, "devDependencies": { "@esbuild-plugins/node-globals-polyfill": "^0.2.3", @@ -14980,11 +14980,14 @@ } }, "node_modules/zotero-plugin-toolkit": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/zotero-plugin-toolkit/-/zotero-plugin-toolkit-3.0.3.tgz", - "integrity": "sha512-EEor041k9/05gBPuHy3ghX1nN++0We5+5+HIb6EHj2NJaHQ06e4asj31EpLaVBOMmCa72vocbYbHlpBXbZgmGA==", + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/zotero-plugin-toolkit/-/zotero-plugin-toolkit-4.0.3.tgz", + "integrity": "sha512-H88eFYD8uPfAMIskdEdriPaE+/Z+emquI7QMIbQu0yTzT0W6hQUberURJ5DNnd4ETtc2N1hCAxn0f7KXPbfseg==", "dependencies": { "zotero-types": "^2.0.3" + }, + "engines": { + "node": ">=16" } }, "node_modules/zotero-types": { diff --git a/package.json b/package.json index d7bcda18..8635acd3 100644 --- a/package.json +++ b/package.json @@ -56,7 +56,7 @@ "unist-util-visit": "^5.0.0", "unist-util-visit-parents": "^6.0.1", "yamljs": "^0.3.0", - "zotero-plugin-toolkit": "^3.0.3" + "zotero-plugin-toolkit": "^4.0.3" }, "devDependencies": { "@esbuild-plugins/node-globals-polyfill": "^0.2.3", diff --git a/src/addon.ts b/src/addon.ts index b52002bc..fd7cd775 100644 --- a/src/addon.ts +++ b/src/addon.ts @@ -1,12 +1,7 @@ -import { Prompt } from "zotero-plugin-toolkit/dist/managers/prompt"; -import { - ColumnOptions, - VirtualizedTableHelper, -} from "zotero-plugin-toolkit/dist/helpers/virtualizedTable"; -import { LargePrefHelper } from "zotero-plugin-toolkit/dist/helpers/largePref"; -import ToolkitGlobal from "zotero-plugin-toolkit/dist/managers/toolkitGlobal"; +import { Prompt, PromptManager } from "zotero-plugin-toolkit"; +import { VirtualizedTableHelper } from "zotero-plugin-toolkit"; +import { LargePrefHelper } from "zotero-plugin-toolkit"; -import { getPref, setPref } from "./utils/prefs"; import { SyncDataType } from "./modules/sync/managerWindow"; import hooks from "./hooks"; import api from "./api"; @@ -126,7 +121,7 @@ class Addon { relation: {}, imageCache: {}, get prompt() { - return ToolkitGlobal.getInstance().prompt.instance; + return new PromptManager().prompt; }, hint: { silent: false, diff --git a/src/elements/linkCreator/notePicker.ts b/src/elements/linkCreator/notePicker.ts index 02ea14a5..281bfc2f 100644 --- a/src/elements/linkCreator/notePicker.ts +++ b/src/elements/linkCreator/notePicker.ts @@ -1,5 +1,5 @@ import { config } from "../../../package.json"; -import { VirtualizedTableHelper } from "zotero-plugin-toolkit/dist/helpers/virtualizedTable"; +import { VirtualizedTableHelper } from "zotero-plugin-toolkit"; import { PluginCEBase } from "../base"; import { getPref, diff --git a/src/elements/linkCreator/notePreview.ts b/src/elements/linkCreator/notePreview.ts index 5236a05e..69fe38fa 100644 --- a/src/elements/linkCreator/notePreview.ts +++ b/src/elements/linkCreator/notePreview.ts @@ -1,5 +1,5 @@ import { config } from "../../../package.json"; -import { VirtualizedTableHelper } from "zotero-plugin-toolkit/dist/helpers/virtualizedTable"; +import { VirtualizedTableHelper } from "zotero-plugin-toolkit"; import { PluginCEBase } from "../base"; import TreeModel = require("tree-model"); import { waitUtilAsync } from "../../utils/wait"; diff --git a/src/elements/linkCreator/outlinePicker.ts b/src/elements/linkCreator/outlinePicker.ts index bc36d103..72deeb30 100644 --- a/src/elements/linkCreator/outlinePicker.ts +++ b/src/elements/linkCreator/outlinePicker.ts @@ -1,5 +1,5 @@ import { config } from "../../../package.json"; -import { VirtualizedTableHelper } from "zotero-plugin-toolkit/dist/helpers/virtualizedTable"; +import { VirtualizedTableHelper } from "zotero-plugin-toolkit"; import { PluginCEBase } from "../base"; import TreeModel = require("tree-model"); diff --git a/src/elements/workspace/outlinePane.ts b/src/elements/workspace/outlinePane.ts index 648d0293..76df40db 100644 --- a/src/elements/workspace/outlinePane.ts +++ b/src/elements/workspace/outlinePane.ts @@ -1,4 +1,4 @@ -import { FilePickerHelper } from "zotero-plugin-toolkit/dist/helpers/filePicker"; +import { FilePickerHelper } from "zotero-plugin-toolkit"; import { config } from "../../../package.json"; import { formatPath } from "../../utils/str"; import { waitUtilAsync } from "../../utils/wait"; diff --git a/src/index.ts b/src/index.ts index 5f6a7499..7aa09933 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,4 +1,4 @@ -import { BasicTool } from "zotero-plugin-toolkit/dist/basic"; +import { BasicTool } from "zotero-plugin-toolkit"; import Addon from "./addon"; import { config } from "../package.json"; diff --git a/src/modules/template/picker.ts b/src/modules/template/picker.ts index 62431bf3..220c428b 100644 --- a/src/modules/template/picker.ts +++ b/src/modules/template/picker.ts @@ -1,4 +1,4 @@ -import { Prompt } from "zotero-plugin-toolkit/dist/managers/prompt"; +import { Prompt } from "zotero-plugin-toolkit"; import { addLineToNote } from "../../utils/note"; import { getString } from "../../utils/locale"; diff --git a/src/modules/viewItems.ts b/src/modules/viewItems.ts index 318a3028..c82ee88f 100644 --- a/src/modules/viewItems.ts +++ b/src/modules/viewItems.ts @@ -1,4 +1,4 @@ -import { PatchHelper } from "zotero-plugin-toolkit/dist/helpers/patch"; +import { PatchHelper } from "zotero-plugin-toolkit"; import { getPref } from "../utils/prefs"; export function patchViewItems(win: Window) { diff --git a/src/utils/hint.ts b/src/utils/hint.ts index d259d13e..0ad501fb 100644 --- a/src/utils/hint.ts +++ b/src/utils/hint.ts @@ -1,5 +1,5 @@ import { config } from "../../package.json"; -import { ProgressWindowHelper } from "zotero-plugin-toolkit/dist/helpers/progressWindow"; +import { ProgressWindowHelper } from "zotero-plugin-toolkit"; import { PROGRESS_TITLE } from "./config"; import { waitUtilAsync } from "./wait"; diff --git a/src/utils/ztoolkit.ts b/src/utils/ztoolkit.ts index b084fad8..399e9ed4 100644 --- a/src/utils/ztoolkit.ts +++ b/src/utils/ztoolkit.ts @@ -1,3 +1,17 @@ +import { + BasicTool, + UITool, + PromptManager, + MenuManager, + ClipboardHelper, + FilePickerHelper, + ProgressWindowHelper, + VirtualizedTableHelper, + DialogHelper, + LargePrefHelper, + GuideHelper, + unregister, +} from "zotero-plugin-toolkit"; import { config } from "../../package.json"; export { createZToolkit }; @@ -27,18 +41,6 @@ function initZToolkit(_ztoolkit: ReturnType) { ); } -import { BasicTool, unregister } from "zotero-plugin-toolkit/dist/basic"; -import { UITool } from "zotero-plugin-toolkit/dist/tools/ui"; -import { ClipboardHelper } from "zotero-plugin-toolkit/dist/helpers/clipboard"; -import { DialogHelper } from "zotero-plugin-toolkit/dist/helpers/dialog"; -import { FilePickerHelper } from "zotero-plugin-toolkit/dist/helpers/filePicker"; -import { ProgressWindowHelper } from "zotero-plugin-toolkit/dist/helpers/progressWindow"; -import { VirtualizedTableHelper } from "zotero-plugin-toolkit/dist/helpers/virtualizedTable"; -import { MenuManager } from "zotero-plugin-toolkit/dist/managers/menu"; -import { PromptManager } from "zotero-plugin-toolkit/dist/managers/prompt"; -import { LargePrefHelper } from "zotero-plugin-toolkit/dist/helpers/largePref"; -import { GuideHelper } from "zotero-plugin-toolkit/dist/helpers/guide"; - class MyToolkit extends BasicTool { UI: UITool; Prompt: PromptManager;