Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@milkdown/utils

Package Overview
Dependencies
Maintainers
1
Versions
118
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@milkdown/utils - npm Package Compare versions

Comparing version 7.1.1 to 7.1.2-next.0

16

./lib/index.es.js

@@ -171,4 +171,4 @@ import { createCmdKey as E, commandsTimerCtx as I, SchemaReady as p, commandsCtx as w, editorStateTimerCtx as b, inputRulesCtx as $, schemaTimerCtx as O, marksCtx as h, schemaCtx as f, nodesCtx as k, prosePluginsCtx as l, InitReady as M, remarkPluginsCtx as v, editorViewTimerCtx as D, nodeViewCtx as C, markViewCtx as T, editorViewCtx as g, serializerCtx as N, parserCtx as R, editorStateOptionsCtx as H } from "@milkdown/core";

const e = s(r);
return t.type instanceof A ? r.update(C, (a) => [...a, [t.id, e]]) : r.update(T, (a) => [...a, [t.id, e]]), n.view = e, n.type = t, () => {
t.type instanceof A ? r.update(C, (a) => a.filter((o) => o[0] !== t.id)) : r.update(T, (a) => a.filter((o) => o[0] !== t.id));
return t.type() instanceof A ? r.update(C, (a) => [...a, [t.id, e]]) : r.update(T, (a) => [...a, [t.id, e]]), n.view = e, n.type = t, () => {
t.type() instanceof A ? r.update(C, (a) => a.filter((o) => o[0] !== t.id)) : r.update(T, (a) => a.filter((o) => o[0] !== t.id));
};

@@ -181,4 +181,4 @@ };

const a = await s(r);
return t.type instanceof A ? r.update(C, (o) => [...o, [t.id, a]]) : r.update(T, (o) => [...o, [t.id, a]]), e.view = a, e.type = t, () => {
t.type instanceof A ? r.update(C, (o) => o.filter((i) => i[0] !== t.id)) : r.update(T, (o) => o.filter((i) => i[0] !== t.id));
return t.type() instanceof A ? r.update(C, (o) => [...o, [t.id, a]]) : r.update(T, (o) => [...o, [t.id, a]]), e.view = a, e.type = t, () => {
t.type() instanceof A ? r.update(C, (o) => o.filter((i) => i[0] !== t.id)) : r.update(T, (o) => o.filter((i) => i[0] !== t.id));
};

@@ -195,3 +195,3 @@ },

const n = S(s, t), r = Q(t, (a) => a.get(n.key)(a)), e = [n, r];
return e.id = r.id, e.node = r, e.type = r.type, e.schema = r.schema, e.key = n.key, e.extendSchema = (a) => (o) => () => {
return e.id = r.id, e.node = r, e.type = r.type, e.schema = r.schema, e.ctx = n, e.key = n.key, e.extendSchema = (a) => (o) => () => {
const i = o.get(n.key), u = a(i)(o);

@@ -201,4 +201,4 @@ o.update(k, (c) => [...c.filter((d) => d[0] !== t), [t, u]]), e.schema = u;

}, ge = (t, s) => {
const n = S(s, `${t}Schema`), r = J(t, (a) => a.get(n.key)(a)), e = [n, r];
return e.id = r.id, e.mark = r, e.type = r.type, e.schema = r.schema, e.key = n.key, e.extendSchema = (a) => (o) => () => {
const n = S(s, t), r = J(t, (a) => a.get(n.key)(a)), e = [n, r];
return e.id = r.id, e.mark = r, e.type = r.type, e.schema = r.schema, e.ctx = n, e.key = n.key, e.extendSchema = (a) => (o) => () => {
const i = o.get(n.key), u = a(i)(o);

@@ -212,3 +212,3 @@ o.update(h, (c) => [...c.filter((d) => d[0] !== t), [t, u]]), e.schema = u;

}), a = [r, e];
return a.key = r.key, a.keymap = e.keymap, a;
return a.ctx = r, a.shortcuts = e, a.key = r.key, a.keymap = e.keymap, a;
}, he = (t, s = () => ({})) => S(s, `${t}Attr`), ke = (t, s = () => ({})) => S(s, `${t}Attr`);

@@ -215,0 +215,0 @@ function Se(t, s) {

@@ -6,4 +6,4 @@ import type { Ctx, MilkdownPlugin } from '@milkdown/ctx';

export type GetMarkSchema = (ctx: Ctx) => MarkSchema;
export type $MarkSchema = [
schemaCtx: $Ctx<GetMarkSchema, string>,
export type $MarkSchema<T extends string> = [
schemaCtx: $Ctx<GetMarkSchema, T>,
schema: $Mark

@@ -14,7 +14,8 @@ ] & {

mark: $Mark;
ctx: $Ctx<GetMarkSchema, T>;
schema: MarkSchema;
key: $Ctx<GetMarkSchema, string>['key'];
key: $Ctx<GetMarkSchema, T>['key'];
extendSchema: (handler: (prev: GetMarkSchema) => GetMarkSchema) => MilkdownPlugin;
};
export declare const $markSchema: (id: string, schema: GetMarkSchema) => $MarkSchema;
export declare const $markSchema: <T extends string>(id: T, schema: GetMarkSchema) => $MarkSchema<T>;
//# sourceMappingURL=$mark-schema.d.ts.map

@@ -13,2 +13,3 @@ import type { Ctx, MilkdownPlugin } from '@milkdown/ctx';

node: $Node;
ctx: $Ctx<GetNodeSchema, T>;
schema: NodeSchema;

@@ -15,0 +16,0 @@ key: $Ctx<GetNodeSchema, T>['key'];

@@ -14,4 +14,6 @@ import type { Ctx, SliceType } from '@milkdown/ctx';

keymap: Keymap;
ctx: $Ctx<KeymapConfig<Key>, `${N}Keymap`>;
shortcuts: $Shortcut;
};
export declare const $useKeymap: <N extends string, Key extends string>(name: N, userKeymap: UserKeymapConfig<Key>) => $UserKeymap<N, Key>;
//# sourceMappingURL=$user-keymap.d.ts.map

@@ -171,4 +171,4 @@ import { createCmdKey as E, commandsTimerCtx as I, SchemaReady as p, commandsCtx as w, editorStateTimerCtx as b, inputRulesCtx as $, schemaTimerCtx as O, marksCtx as h, schemaCtx as f, nodesCtx as k, prosePluginsCtx as l, InitReady as M, remarkPluginsCtx as v, editorViewTimerCtx as D, nodeViewCtx as C, markViewCtx as T, editorViewCtx as g, serializerCtx as N, parserCtx as R, editorStateOptionsCtx as H } from "@milkdown/core";

const e = s(r);
return t.type instanceof A ? r.update(C, (a) => [...a, [t.id, e]]) : r.update(T, (a) => [...a, [t.id, e]]), n.view = e, n.type = t, () => {
t.type instanceof A ? r.update(C, (a) => a.filter((o) => o[0] !== t.id)) : r.update(T, (a) => a.filter((o) => o[0] !== t.id));
return t.type() instanceof A ? r.update(C, (a) => [...a, [t.id, e]]) : r.update(T, (a) => [...a, [t.id, e]]), n.view = e, n.type = t, () => {
t.type() instanceof A ? r.update(C, (a) => a.filter((o) => o[0] !== t.id)) : r.update(T, (a) => a.filter((o) => o[0] !== t.id));
};

@@ -181,4 +181,4 @@ };

const a = await s(r);
return t.type instanceof A ? r.update(C, (o) => [...o, [t.id, a]]) : r.update(T, (o) => [...o, [t.id, a]]), e.view = a, e.type = t, () => {
t.type instanceof A ? r.update(C, (o) => o.filter((i) => i[0] !== t.id)) : r.update(T, (o) => o.filter((i) => i[0] !== t.id));
return t.type() instanceof A ? r.update(C, (o) => [...o, [t.id, a]]) : r.update(T, (o) => [...o, [t.id, a]]), e.view = a, e.type = t, () => {
t.type() instanceof A ? r.update(C, (o) => o.filter((i) => i[0] !== t.id)) : r.update(T, (o) => o.filter((i) => i[0] !== t.id));
};

@@ -195,3 +195,3 @@ },

const n = S(s, t), r = Q(t, (a) => a.get(n.key)(a)), e = [n, r];
return e.id = r.id, e.node = r, e.type = r.type, e.schema = r.schema, e.key = n.key, e.extendSchema = (a) => (o) => () => {
return e.id = r.id, e.node = r, e.type = r.type, e.schema = r.schema, e.ctx = n, e.key = n.key, e.extendSchema = (a) => (o) => () => {
const i = o.get(n.key), u = a(i)(o);

@@ -201,4 +201,4 @@ o.update(k, (c) => [...c.filter((d) => d[0] !== t), [t, u]]), e.schema = u;

}, ge = (t, s) => {
const n = S(s, `${t}Schema`), r = J(t, (a) => a.get(n.key)(a)), e = [n, r];
return e.id = r.id, e.mark = r, e.type = r.type, e.schema = r.schema, e.key = n.key, e.extendSchema = (a) => (o) => () => {
const n = S(s, t), r = J(t, (a) => a.get(n.key)(a)), e = [n, r];
return e.id = r.id, e.mark = r, e.type = r.type, e.schema = r.schema, e.ctx = n, e.key = n.key, e.extendSchema = (a) => (o) => () => {
const i = o.get(n.key), u = a(i)(o);

@@ -212,3 +212,3 @@ o.update(h, (c) => [...c.filter((d) => d[0] !== t), [t, u]]), e.schema = u;

}), a = [r, e];
return a.key = r.key, a.keymap = e.keymap, a;
return a.ctx = r, a.shortcuts = e, a.key = r.key, a.keymap = e.keymap, a;
}, he = (t, s = () => ({})) => S(s, `${t}Attr`), ke = (t, s = () => ({})) => S(s, `${t}Attr`);

@@ -215,0 +215,0 @@ function Se(t, s) {

{
"name": "@milkdown/utils",
"type": "module",
"version": "7.1.1",
"version": "7.1.2-next.0",
"license": "MIT",

@@ -19,6 +19,6 @@ "repository": {

"peerDependencies": {
"@milkdown/core": "^7.0.0-next.0",
"@milkdown/ctx": "^7.0.0-next.0",
"@milkdown/prose": "^7.0.0-next.0",
"@milkdown/transformer": "^7.0.0-next.0"
"@milkdown/core": "^7.1.2-next.0",
"@milkdown/ctx": "^7.1.2-next.0",
"@milkdown/prose": "^7.1.2-next.0",
"@milkdown/transformer": "^7.1.2-next.0"
},

@@ -28,9 +28,9 @@ "dependencies": {

"tslib": "^2.5.0",
"@milkdown/exception": "7.1.1"
"@milkdown/exception": "7.1.2-next.0"
},
"devDependencies": {
"@milkdown/core": "7.1.1",
"@milkdown/ctx": "7.1.1",
"@milkdown/prose": "7.1.1",
"@milkdown/transformer": "7.1.1"
"@milkdown/core": "7.1.2-next.0",
"@milkdown/ctx": "7.1.2-next.0",
"@milkdown/prose": "7.1.2-next.0",
"@milkdown/transformer": "7.1.2-next.0"
},

@@ -37,0 +37,0 @@ "nx": {

@@ -14,3 +14,3 @@ /* Copyright 2021, Milkdown by Mirone. */

/// Create a input rule plugin.
/// Create an input rule plugin.
/// It takes a factory function which returns a [prosemirror input rule](https://prosemirror.net/docs/ref/#inputrules.InputRule).

@@ -17,0 +17,0 @@ ///

@@ -89,3 +89,4 @@ /* Copyright 2021, Milkdown by Mirone. */

plugin.type = () => nodeType!
return plugin
}

@@ -39,3 +39,3 @@ /* Copyright 2021, Milkdown by Mirone. */

const v = view(ctx)
if (type.type instanceof NodeType)
if (type.type() instanceof NodeType)
ctx.update(nodeViewCtx, ps => [...ps, [type.id, v] as [string, NodeViewConstructor]])

@@ -49,3 +49,3 @@ else

return () => {
if (type.type instanceof NodeType)
if (type.type() instanceof NodeType)
ctx.update(nodeViewCtx, ps => ps.filter(x => x[0] !== type.id))

@@ -74,3 +74,3 @@ else

const v = await view(ctx)
if (type.type instanceof NodeType)
if (type.type() instanceof NodeType)
ctx.update(nodeViewCtx, ps => [...ps, [type.id, v] as [string, NodeViewConstructor]])

@@ -84,3 +84,3 @@ else

return () => {
if (type.type instanceof NodeType)
if (type.type() instanceof NodeType)
ctx.update(nodeViewCtx, ps => ps.filter(x => x[0] !== type.id))

@@ -87,0 +87,0 @@ else

@@ -14,4 +14,4 @@ /* Copyright 2021, Milkdown by Mirone. */

/// @internal
export type $MarkSchema = [
schemaCtx: $Ctx<GetMarkSchema, string>,
export type $MarkSchema<T extends string> = [
schemaCtx: $Ctx<GetMarkSchema, T>,
schema: $Mark,

@@ -22,4 +22,5 @@ ] & {

mark: $Mark
ctx: $Ctx<GetMarkSchema, T>
schema: MarkSchema
key: $Ctx<GetMarkSchema, string>['key']
key: $Ctx<GetMarkSchema, T>['key']
extendSchema: (handler: (prev: GetMarkSchema) => GetMarkSchema) => MilkdownPlugin

@@ -35,2 +36,3 @@ }

/// - `type`: A function witch will return the type of the mark schema.
/// - `ctx`: The context of the mark schema.
/// - `mark`: The mark schema plugin.

@@ -40,4 +42,4 @@ /// - `schema`: The mark schema.

/// - `extendSchema`: A function witch will return a plugin that can extend the mark schema.
export const $markSchema = (id: string, schema: GetMarkSchema): $MarkSchema => {
const schemaCtx = $ctx(schema, `${id}Schema`)
export const $markSchema = <T extends string>(id: T, schema: GetMarkSchema): $MarkSchema<T> => {
const schemaCtx = $ctx(schema, id)

@@ -49,3 +51,3 @@ const markSchema = $mark(id, (ctx) => {

const result = [schemaCtx, markSchema] as $MarkSchema
const result = [schemaCtx, markSchema] as $MarkSchema<T>
result.id = markSchema.id

@@ -55,2 +57,3 @@ result.mark = markSchema

result.schema = markSchema.schema
result.ctx = schemaCtx
result.key = schemaCtx.key

@@ -57,0 +60,0 @@ result.extendSchema = (handler): MilkdownPlugin => {

@@ -21,2 +21,3 @@ /* Copyright 2021, Milkdown by Mirone. */

node: $Node
ctx: $Ctx<GetNodeSchema, T>
schema: NodeSchema

@@ -34,2 +35,3 @@ key: $Ctx<GetNodeSchema, T>['key']

/// - `type`: A function witch will return the type of the node schema.
/// - `ctx`: The context of the node schema.
/// - `node`: The node schema plugin.

@@ -52,2 +54,3 @@ /// - `schema`: The node schema.

result.schema = nodeSchema.schema
result.ctx = schemaCtx
result.key = schemaCtx.key

@@ -54,0 +57,0 @@ result.extendSchema = (handler): MilkdownPlugin => {

@@ -26,2 +26,4 @@ /* Copyright 2021, Milkdown by Mirone. */

keymap: Keymap
ctx: $Ctx<KeymapConfig<Key>, `${N}Keymap`>
shortcuts: $Shortcut
}

@@ -38,3 +40,3 @@

const keymapDef = $ctx(key, `${name}Keymap`)
const keymapDef = $ctx<KeymapConfig<Key>, `${N}Keymap`>(key, `${name}Keymap`)

@@ -54,2 +56,4 @@ const shortcuts = $shortcut((ctx) => {

const result = [keymapDef, shortcuts] as $UserKeymap<N, Key>
result.ctx = keymapDef
result.shortcuts = shortcuts
result.key = keymapDef.key

@@ -56,0 +60,0 @@ result.keymap = shortcuts.keymap

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc