Comparing version 1.20.1 to 1.20.2
@@ -1,460 +0,5 @@ | ||
import type { default as CodeMirror_2 } from 'codemirror'; | ||
import type { Editor as Editor_2 } from 'codemirror'; | ||
import type { EditorConfiguration } from 'codemirror'; | ||
import type { Image as Image_2 } from 'mdast'; | ||
import { Options } from 'select-files'; | ||
import type { Options as Options_2 } from 'remark-rehype'; | ||
import type { Position } from 'codemirror'; | ||
import type { Processor } from 'unified'; | ||
import { Root } from 'hast'; | ||
import type { Schema } from 'hast-util-sanitize'; | ||
import type { VFile } from 'vfile'; | ||
declare const __propDef: any; | ||
declare const __propDef_2: any; | ||
export declare interface BytemdAction { | ||
/** | ||
* Action title | ||
*/ | ||
title?: string; | ||
/** | ||
* Action icon position | ||
* | ||
* Specifies that the action icon is in the toolbar position, which defaults to the left | ||
*/ | ||
position?: 'left' | 'right'; | ||
/** | ||
* Action icon (16x16), usually inline svg | ||
*/ | ||
icon?: string; | ||
/** | ||
* Markdown syntax cheatsheet | ||
* | ||
* If specified, this record will be added to the Markdown cheatsheet section | ||
*/ | ||
cheatsheet?: string; | ||
/** | ||
* Action handler | ||
*/ | ||
handler?: BytemdActionHandler; | ||
} | ||
declare type BytemdActionHandler = { | ||
type: 'action'; | ||
click: Listener; | ||
/** | ||
* Keyboard shortcut | ||
* | ||
* If specified, this shortcut will bind to click listener | ||
* and will be added to the Keyboard shortcut section | ||
* | ||
* https://codemirror.net/doc/manual.html#keymaps | ||
*/ | ||
shortcut?: string; | ||
/** | ||
* mouseenter event listener, only takes effect in dropdown items | ||
*/ | ||
mouseenter?: Listener; | ||
/** | ||
* mouseleave event listener, only takes effect in dropdown items | ||
*/ | ||
mouseleave?: Listener; | ||
} | { | ||
type: 'dropdown'; | ||
actions: BytemdAction[]; | ||
}; | ||
export declare interface BytemdEditorContext extends EditorUtils { | ||
codemirror: typeof CodeMirror_2; | ||
/** | ||
* CodeMirror editor instance | ||
*/ | ||
editor: Editor_2; | ||
/** | ||
* The root element | ||
*/ | ||
root: HTMLElement; | ||
} | ||
export declare interface BytemdLocale { | ||
write: string; | ||
preview: string; | ||
writeOnly: string; | ||
exitWriteOnly: string; | ||
previewOnly: string; | ||
exitPreviewOnly: string; | ||
help: string; | ||
closeHelp: string; | ||
toc: string; | ||
closeToc: string; | ||
fullscreen: string; | ||
exitFullscreen: string; | ||
source: string; | ||
cheatsheet: string; | ||
shortcuts: string; | ||
words: string; | ||
lines: string; | ||
sync: string; | ||
top: string; | ||
limited: string; | ||
h1: string; | ||
h2: string; | ||
h3: string; | ||
h4: string; | ||
h5: string; | ||
h6: string; | ||
headingText: string; | ||
bold: string; | ||
boldText: string; | ||
italic: string; | ||
italicText: string; | ||
quote: string; | ||
quotedText: string; | ||
link: string; | ||
linkText: string; | ||
image: string; | ||
imageAlt: string; | ||
imageTitle: string; | ||
code: string; | ||
codeText: string; | ||
codeBlock: string; | ||
codeLang: string; | ||
ul: string; | ||
ulItem: string; | ||
ol: string; | ||
olItem: string; | ||
hr: string; | ||
} | ||
export declare interface BytemdPlugin { | ||
/** | ||
* Customize Markdown parse by remark plugins: | ||
* | ||
* https://github.com/remarkjs/remark/blob/main/doc/plugins.md | ||
*/ | ||
remark?: (p: Processor) => Processor; | ||
/** | ||
* Customize HTML parse by rehype plugins: | ||
* | ||
* https://github.com/rehypejs/rehype/blob/main/doc/plugins.md | ||
*/ | ||
rehype?: (p: Processor) => Processor; | ||
/** | ||
* Register actions in toolbar, cheatsheet and shortcuts | ||
*/ | ||
actions?: BytemdAction[]; | ||
/** | ||
* Side effect for the editor, triggers when plugin changes | ||
*/ | ||
editorEffect?(ctx: BytemdEditorContext): void | (() => void); | ||
/** | ||
* Side effect for the viewer, triggers when viewer props changes | ||
*/ | ||
viewerEffect?(ctx: BytemdViewerContext): void | (() => void); | ||
} | ||
export declare interface BytemdViewerContext { | ||
/** | ||
* The root element of the viewer | ||
*/ | ||
markdownBody: HTMLElement; | ||
/** | ||
* Virtual file format used in [unified](https://unifiedjs.com/) | ||
* | ||
* Get the HTML output by calling `vfile.toString()` | ||
*/ | ||
file: VFile; | ||
} | ||
declare interface ComponentConstructorOptions<Props extends Record<string, any> = Record<string, any>> { | ||
target: Element | ShadowRoot; | ||
anchor?: Element; | ||
props?: Props; | ||
context?: Map<any, any>; | ||
hydrate?: boolean; | ||
intro?: boolean; | ||
$$inline?: boolean; | ||
} | ||
declare function createEditorUtils(codemirror: typeof CodeMirror_2, editor: Editor_2): { | ||
/** | ||
* Wrap text with decorators, for example: | ||
* | ||
* `text -> *text*` | ||
*/ | ||
wrapText(before: string, after?: string): void; | ||
/** | ||
* replace multiple lines | ||
* | ||
* `line -> # line` | ||
*/ | ||
replaceLines(replace: Parameters<Array<string>['map']>[0]): void; | ||
/** | ||
* Append a block based on the cursor position | ||
*/ | ||
appendBlock(content: string): Position; | ||
/** | ||
* Triggers a virtual file input and let user select files | ||
* | ||
* https://www.npmjs.com/package/select-files | ||
*/ | ||
selectFiles: (options?: Options | undefined) => Promise<FileList | null>; | ||
}; | ||
export declare class Editor extends SvelteComponentTyped<EditorProps_2, EditorEvents, EditorSlots> { | ||
} | ||
declare type EditorEvents = typeof __propDef.events; | ||
export declare interface EditorProps extends ViewerProps { | ||
/** | ||
* Editor display mode | ||
* | ||
* - `split`: edit on the left and preview on the right | ||
* - `tab`: click tabs to switch between edit and preview | ||
* - `auto`: auto determined by the width of editor container | ||
* | ||
* @defaultValue `auto` | ||
*/ | ||
mode?: 'split' | 'tab' | 'auto'; | ||
/** | ||
* Debounce time (ms) for preview | ||
* | ||
* @defaultValue 300 | ||
*/ | ||
previewDebounce?: number; | ||
/** | ||
* Editor placeholder | ||
*/ | ||
placeholder?: string; | ||
/** | ||
* CodeMirror editor config | ||
* | ||
* https://codemirror.net/doc/manual.html#config | ||
*/ | ||
editorConfig?: Omit<EditorConfiguration, 'value' | 'placeholder'>; | ||
/** | ||
* i18n locale | ||
* | ||
* @defaultValue en | ||
*/ | ||
locale?: Partial<BytemdLocale>; | ||
/** | ||
* Handle images upload | ||
*/ | ||
uploadImages?: (files: File[]) => Promise<Pick<Image_2, 'url' | 'alt' | 'title'>[]>; | ||
/** | ||
* Override the default preview area render | ||
* | ||
* If specified, the built-in viewer would not take effect. | ||
*/ | ||
overridePreview?(el: HTMLElement, props: ViewerProps): void; | ||
/** | ||
* Maximum length (number of characters) of value | ||
*/ | ||
maxLength?: number; | ||
} | ||
declare type EditorProps_2 = typeof __propDef.props; | ||
declare type EditorSlots = typeof __propDef.slots; | ||
declare type EditorUtils = ReturnType<typeof createEditorUtils>; | ||
/** | ||
* INTERNAL, DO NOT USE. Code may change at any time. | ||
*/ | ||
declare interface Fragment { | ||
key: string | null; | ||
first: null; | ||
c: () => void; | ||
l: (nodes: any) => void; | ||
h: () => void; | ||
m: (target: HTMLElement, anchor: any) => void; | ||
p: (ctx: T$$['ctx'], dirty: T$$['dirty']) => void; | ||
r: () => void; | ||
f: () => void; | ||
a: () => void; | ||
i: (local: any) => void; | ||
o: (local: any) => void; | ||
d: (detaching: 0 | 1) => void; | ||
} | ||
/** | ||
* Get unified processor with ByteMD plugins | ||
*/ | ||
export declare function getProcessor({ sanitize, plugins, remarkRehype: remarkRehypeOptions, }: Omit<ViewerProps, 'value'>): Processor<Root, Root, Root, string>; | ||
declare type Listener = (context: BytemdEditorContext) => void; | ||
declare function noop(): void; | ||
declare type Props = Record<string, any>; | ||
/** | ||
* Base class for Svelte components. Used when dev=false. | ||
*/ | ||
declare class SvelteComponent { | ||
$$: T$$; | ||
$$set?: ($$props: any) => void; | ||
$destroy(): void; | ||
$on(type: any, callback: any): typeof noop; | ||
$set($$props: any): void; | ||
} | ||
declare interface SvelteComponentDev { | ||
$set(props?: Props): void; | ||
$on(event: string, callback: ((event: any) => void) | null | undefined): () => void; | ||
$destroy(): void; | ||
[accessor: string]: any; | ||
} | ||
/** | ||
* Base class for Svelte components with some minor dev-enhancements. Used when dev=true. | ||
*/ | ||
declare class SvelteComponentDev extends SvelteComponent { | ||
/** | ||
* @private | ||
* For type checking capabilities only. | ||
* Does not exist at runtime. | ||
* ### DO NOT USE! | ||
*/ | ||
$$prop_def: Props; | ||
/** | ||
* @private | ||
* For type checking capabilities only. | ||
* Does not exist at runtime. | ||
* ### DO NOT USE! | ||
*/ | ||
$$events_def: any; | ||
/** | ||
* @private | ||
* For type checking capabilities only. | ||
* Does not exist at runtime. | ||
* ### DO NOT USE! | ||
*/ | ||
$$slot_def: any; | ||
constructor(options: ComponentConstructorOptions); | ||
$capture_state(): void; | ||
$inject_state(): void; | ||
} | ||
declare interface SvelteComponentTyped<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any> { | ||
$set(props?: Partial<Props>): void; | ||
$on<K extends Extract<keyof Events, string>>(type: K, callback: ((e: Events[K]) => void) | null | undefined): () => void; | ||
$destroy(): void; | ||
[accessor: string]: any; | ||
} | ||
/** | ||
* Base class to create strongly typed Svelte components. | ||
* This only exists for typing purposes and should be used in `.d.ts` files. | ||
* | ||
* ### Example: | ||
* | ||
* You have component library on npm called `component-library`, from which | ||
* you export a component called `MyComponent`. For Svelte+TypeScript users, | ||
* you want to provide typings. Therefore you create a `index.d.ts`: | ||
* ```ts | ||
* import { SvelteComponentTyped } from "svelte"; | ||
* export class MyComponent extends SvelteComponentTyped<{foo: string}> {} | ||
* ``` | ||
* Typing this makes it possible for IDEs like VS Code with the Svelte extension | ||
* to provide intellisense and to use the component like this in a Svelte file | ||
* with TypeScript: | ||
* ```svelte | ||
* <script lang="ts"> | ||
* import { MyComponent } from "component-library"; | ||
* </script> | ||
* <MyComponent foo={'bar'} /> | ||
* ``` | ||
* | ||
* #### Why not make this part of `SvelteComponent(Dev)`? | ||
* Because | ||
* ```ts | ||
* class ASubclassOfSvelteComponent extends SvelteComponent<{foo: string}> {} | ||
* const component: typeof SvelteComponent = ASubclassOfSvelteComponent; | ||
* ``` | ||
* will throw a type error, so we need to separate the more strictly typed class. | ||
*/ | ||
declare class SvelteComponentTyped<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any> extends SvelteComponentDev { | ||
/** | ||
* @private | ||
* For type checking capabilities only. | ||
* Does not exist at runtime. | ||
* ### DO NOT USE! | ||
*/ | ||
$$prop_def: Props; | ||
/** | ||
* @private | ||
* For type checking capabilities only. | ||
* Does not exist at runtime. | ||
* ### DO NOT USE! | ||
*/ | ||
$$events_def: Events; | ||
/** | ||
* @private | ||
* For type checking capabilities only. | ||
* Does not exist at runtime. | ||
* ### DO NOT USE! | ||
*/ | ||
$$slot_def: Slots; | ||
constructor(options: ComponentConstructorOptions<Props>); | ||
} | ||
declare interface T$$ { | ||
dirty: number[]; | ||
ctx: any[]; | ||
bound: any; | ||
update: () => void; | ||
callbacks: any; | ||
after_update: any[]; | ||
props: Record<string, 0 | string>; | ||
fragment: null | false | Fragment; | ||
not_equal: any; | ||
before_update: any[]; | ||
context: Map<any, any>; | ||
on_mount: any[]; | ||
on_destroy: any[]; | ||
skip_bound: boolean; | ||
on_disconnect: any[]; | ||
root: Element | ShadowRoot; | ||
} | ||
export declare class Viewer extends SvelteComponentTyped<ViewerProps_2, ViewerEvents, ViewerSlots> { | ||
} | ||
declare type ViewerEvents = typeof __propDef_2.events; | ||
export declare interface ViewerProps { | ||
/** | ||
* Markdown text | ||
*/ | ||
value: string; | ||
/** | ||
* ByteMD plugin list | ||
*/ | ||
plugins?: BytemdPlugin[]; | ||
/** | ||
* Sanitize strategy: Defaults to GitHub style sanitation with class names allowed | ||
* | ||
* https://github.com/syntax-tree/hast-util-sanitize/blob/main/lib/github.json | ||
* | ||
* If you want further customization, pass a function to mutate sanitize schema. | ||
*/ | ||
sanitize?: (schema: Schema) => Schema; | ||
/** | ||
* custom remark-rehype options: Defaults value { allowDangerousHtml: true } | ||
* | ||
* https://github.com/remarkjs/remark-rehype | ||
*/ | ||
remarkRehype?: Options_2; | ||
} | ||
declare type ViewerProps_2 = typeof __propDef_2.props; | ||
declare type ViewerSlots = typeof __propDef_2.slots; | ||
export { } | ||
import './index.scss'; | ||
export * from './types'; | ||
export { default as Editor } from './editor.svelte'; | ||
export { default as Viewer } from './viewer.svelte'; | ||
export { getProcessor } from './utils'; |
{ | ||
"name": "bytemd", | ||
"version": "1.20.1", | ||
"version": "1.20.2", | ||
"description": "Hackable Markdown Editor and Viewer", | ||
@@ -41,3 +41,3 @@ "keywords": [ | ||
"@popperjs/core": "^2.11.6", | ||
"@types/codemirror": "^5.60.6", | ||
"@types/codemirror": "^5.60.7", | ||
"@types/hast": "^2.3.4", | ||
@@ -57,3 +57,3 @@ "@types/lodash-es": "^4.17.6", | ||
"unified": "^10.1.2", | ||
"unist-util-visit": "^4.1.1", | ||
"unist-util-visit": "^4.1.2", | ||
"vfile": "^5.3.6", | ||
@@ -65,3 +65,3 @@ "word-count": "^0.2.2" | ||
}, | ||
"gitHead": "34c931fafd890af7806ad9f78ba125cf77bb47e0" | ||
"gitHead": "5341fc66607cf079145e3116ba101e57d1569b0f" | ||
} |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
3077443
47
75304
Updated@types/codemirror@^5.60.7
Updatedunist-util-visit@^4.1.2