1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2025-01-05 23:10:28 +00:00

feat: make $tw.wiki globally available

This commit is contained in:
linonetwo 2024-09-10 16:13:59 +08:00
parent ac308e0f89
commit b6f219aa82
6 changed files with 21 additions and 5 deletions

1
.gitignore vendored
View File

@ -9,3 +9,4 @@ node_modules/
/playwright-report/
/playwright/.cache/
$__StoryList.tid
types/generated/

1
core/globals.d.ts vendored
View File

@ -1 +0,0 @@
declare var $tw: any;

View File

@ -22,6 +22,13 @@ Adds the following properties to the wiki object:
/*global $tw: false */
"use strict";
/**
* @typedef {import('$:/core/modules/widgets/widget.js').widget} Widget
*/
/**
* @type {Widget}
*/
var widget = require("$:/core/modules/widgets/widget.js");
var USER_NAME_TITLE = "$:/status/UserName",

View File

@ -13,6 +13,7 @@
"bin": {
"tiddlywiki": "./tiddlywiki.js"
},
"types": "./types",
"main": "./boot/boot.js",
"repository": {
"type": "git",

View File

@ -11,15 +11,16 @@
"allowSyntheticDefaultImports": true,
"checkJs": true,
"declaration": true,
"declarationDir": "types",
"declarationDir": "types/generated",
"declarationMap": true,
"emitDeclarationOnly": true,
"lib": ["ES2020", "DOM", "DOM.Iterable"],
"module": "Node16",
"outDir": "types",
"rootDir": "core",
"outDir": "types/generated",
"rootDir": ".",
"skipLibCheck": true,
"target": "ESNext"
},
"include": ["./core/**/*.js", "**/*.d.ts"]
"include": ["./core/**/*.js", "./core/**/*.d.ts", "types/tw.d.ts"],
"exclude": ["types/generated"]
}

7
types/tw.d.ts vendored Normal file
View File

@ -0,0 +1,7 @@
import * as Wiki from '../core/modules/wiki';
declare global {
var $tw: {
wiki: typeof Wiki;
};
}