Skip to content

Commit

Permalink
fix: 馃帹 type definings
Browse files Browse the repository at this point in the history
  • Loading branch information
Leecason committed Jun 30, 2020
1 parent cfd4f9e commit 9cc1274
Show file tree
Hide file tree
Showing 6 changed files with 84 additions and 3 deletions.
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
"jsdelivr": "lib/element-tiptap.min.js",
"files": [
"lib/*",
"src/*",
"types/*"
"src/*"
],
"types": "lib/index.d.ts",
"dependencies": {
"@juggle/resize-observer": "^3.1.2",
"codemirror": "^5.54.0",
Expand Down Expand Up @@ -66,6 +66,7 @@
"rollup": "^2.15.0",
"rollup-plugin-babel": "^4.3.3",
"rollup-plugin-commonjs": "^10.1.0",
"rollup-plugin-dts": "^1.4.7",
"rollup-plugin-node-resolve": "^5.2.0",
"rollup-plugin-postcss": "^2.0.3",
"rollup-plugin-replace": "^2.2.0",
Expand Down
9 changes: 9 additions & 0 deletions rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import postcss from 'rollup-plugin-postcss';
import postcssPresetEnv from 'postcss-preset-env';
import typescript from 'rollup-plugin-typescript2';
import alias from '@rollup/plugin-alias';
import dts from 'rollup-plugin-dts';

const libDir = path.resolve(__dirname, 'lib');
const srcDir = path.resolve(__dirname, 'src');
Expand All @@ -26,6 +27,14 @@ export default () => [
file: path.resolve(libDir, 'element-tiptap.esm.js'),
format: 'es',
}),
{
input: './types/index.d.ts',
output: [{
file: path.resolve(libDir, 'index.d.ts'),
format: 'es'
}],
plugins: [dts()],
},
];

function getConfig ({
Expand Down
41 changes: 41 additions & 0 deletions types/extensions.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
// TODO: tiptap extensions
export class Doc {}
export class Paragraph {}
export class Text {}
export class Heading {}
export class Bold {}
export class Underline {}
export class Italic {}
export class Strike {}
export class Link {}
export class Blockquote {}
export class CodeBlock {}
export class Code {}
export class Image {}
export class Iframe {}
export class ListItem { }
export class BulletList { }
export class OrdererList { }
export class TodoItem { }
export class TodoList { }
export class Table { }
export class TableHeader { }
export class TableCell { }
export class TableRow {}
export class HardBreak {}
export class TrailingNode {}
export class TextAlign {}
export class Indent {}
export class LineHeight {}
export class HorizontalRule {}
export class History {}
export class TextColor {}
export class TextHighlight {}
export class FontType {}
export class FontSize {}
export class FormatClear {}
export class Fullscreen {}
export class Print {}
export class Preview {}
export class SelectAll {}
export class CodeView {}
2 changes: 2 additions & 0 deletions types/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { VueConstructor } from 'vue';

export * from './extensions';

export interface OptionsInterface {
lang?: string;
spellcheck?: boolean;
Expand Down
2 changes: 1 addition & 1 deletion types/shims-tiptap-commands.d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
declare module 'tiptap-commands' {
import { EditorView } from 'prosemirror-view';
import { EditorState, Transaction } from "prosemirror-state";
import { EditorState, Transaction } from 'prosemirror-state';

interface DispatchFunction {
(tr: Transaction): boolean;
Expand Down
28 changes: 28 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,13 @@
dependencies:
"@babel/highlight" "^7.10.1"

"@babel/code-frame@^7.8.3":
version "7.10.3"
resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.10.3.tgz#324bcfd8d35cd3d47dae18cde63d752086435e9a"
integrity sha512-fDx9eNW0qz0WkUeqL6tXEXzVlPh6Y5aCDEZesl0xBGA8ndRukX91Uk44ZqnkECp01NAZUdCAl+aiQNGi0k88Eg==
dependencies:
"@babel/highlight" "^7.10.3"

"@babel/compat-data@^7.10.1":
version "7.10.1"
resolved "https://registry.yarnpkg.com/@babel/compat-data/-/compat-data-7.10.1.tgz#b1085ffe72cd17bf2c0ee790fc09f9626011b2db"
Expand Down Expand Up @@ -232,6 +239,11 @@
resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.10.1.tgz#5770b0c1a826c4f53f5ede5e153163e0318e94b5"
integrity sha512-5vW/JXLALhczRCWP0PnFDMCJAchlBvM7f4uk/jXritBnIa6E1KmqmtrS3yn1LAnxFBypQ3eneLuXjsnfQsgILw==

"@babel/helper-validator-identifier@^7.10.3":
version "7.10.3"
resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.10.3.tgz#60d9847f98c4cea1b279e005fdb7c28be5412d15"
integrity sha512-bU8JvtlYpJSBPuj1VUmKpFGaDZuLxASky3LhaKj3bmpSTY6VWooSM8msk+Z0CZoErFye2tlABF6yDkT3FOPAXw==

"@babel/helper-wrap-function@^7.10.1":
version "7.10.1"
resolved "https://registry.yarnpkg.com/@babel/helper-wrap-function/-/helper-wrap-function-7.10.1.tgz#956d1310d6696257a7afd47e4c42dfda5dfcedc9"
Expand Down Expand Up @@ -260,6 +272,15 @@
chalk "^2.0.0"
js-tokens "^4.0.0"

"@babel/highlight@^7.10.3":
version "7.10.3"
resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.10.3.tgz#c633bb34adf07c5c13156692f5922c81ec53f28d"
integrity sha512-Ih9B/u7AtgEnySE2L2F0Xm0GaM729XqqLfHkalTsbjXGyqmf/6M0Cu0WpvqueUlW+xk88BHw9Nkpj49naU+vWw==
dependencies:
"@babel/helper-validator-identifier" "^7.10.3"
chalk "^2.0.0"
js-tokens "^4.0.0"

"@babel/parser@^7.10.1", "@babel/parser@^7.10.2", "@babel/parser@^7.7.0":
version "7.10.2"
resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.10.2.tgz#871807f10442b92ff97e4783b9b54f6a0ca812d0"
Expand Down Expand Up @@ -10993,6 +11014,13 @@ rollup-plugin-commonjs@^10.1.0:
resolve "^1.11.0"
rollup-pluginutils "^2.8.1"

rollup-plugin-dts@^1.4.7:
version "1.4.7"
resolved "https://registry.yarnpkg.com/rollup-plugin-dts/-/rollup-plugin-dts-1.4.7.tgz#6255147ac777314c0725a1efcb42df10fe282243"
integrity sha512-QkunbJ96yUNkW95k/Vd6SdTjCbWSG0rMVUtpHSCwfg078Z7vbDaBnfz/gkSqR5h8WFMxoccBT4aodHm6387Jvg==
optionalDependencies:
"@babel/code-frame" "^7.8.3"

rollup-plugin-node-resolve@^5.2.0:
version "5.2.0"
resolved "https://registry.yarnpkg.com/rollup-plugin-node-resolve/-/rollup-plugin-node-resolve-5.2.0.tgz#730f93d10ed202473b1fb54a5997a7db8c6d8523"
Expand Down

0 comments on commit 9cc1274

Please sign in to comment.