New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

slate-hyperscript

Package Overview
Dependencies
Maintainers
1
Versions
393
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

slate-hyperscript - npm Package Compare versions

Comparing version 0.9.3 to 0.10.0

8

Changelog.md

@@ -7,2 +7,10 @@ # Changelog

### `0.10.0` — August 22, 2018
###### BREAKING
**Remove all previously deprecated code paths.** This helps to reduce some of the complexity in Slate by not having to handle these code paths anymore. And it helps to reduce file size. When upgrading, it's _highly_ recommended that you upgrade to the previous version first and ensure there are no deprecation warnings being logged, then upgrade to this version.
---
### `0.9.0` — August 22, 2018

@@ -9,0 +17,0 @@

25

dist/slate-hyperscript.js

@@ -279,3 +279,2 @@ (function (global, factory) {

var schema = slate.Schema.create(attributes.schema || {});
var document = children.find(slate.Document.isDocument);

@@ -364,3 +363,3 @@ var selection = children.find(slate.Selection.isSelection) || slate.Selection.create();

var value = slate.Value.fromJSON({ data: data, document: document, selection: selection, schema: schema }, { normalize: normalize });
var value = slate.Value.fromJSON(_extends({ data: data, document: document, selection: selection }, attributes), { normalize: normalize });

@@ -586,15 +585,15 @@ if (anchor || focus) {

Object.keys(blocks).map(function (key) {
creators[key] = normalizeNode(key, blocks[key], 'block');
creators[key] = normalizeNode(blocks[key], 'block');
});
Object.keys(inlines).map(function (key) {
creators[key] = normalizeNode(key, inlines[key], 'inline');
creators[key] = normalizeNode(inlines[key], 'inline');
});
Object.keys(marks).map(function (key) {
creators[key] = normalizeMark(key, marks[key]);
creators[key] = normalizeMark(marks[key]);
});
Object.keys(decorations).map(function (key) {
creators[key] = normalizeNode(key, decorations[key], 'decoration');
creators[key] = normalizeNode(decorations[key], 'decoration');
});

@@ -614,5 +613,4 @@

/**
* Normalize a node creator with `key` and `value`, of `object`.
* Normalize a node creator of `value` and `object`.
*
* @param {String} key
* @param {Function|Object|String} value

@@ -623,3 +621,3 @@ * @param {String} object

function normalizeNode(key, value, object) {
function normalizeNode(value, object) {
if (typeof value == 'function') {

@@ -635,3 +633,3 @@ return value;

return function (tagName, attributes, children) {
var attrKey = attributes.key,
var key = attributes.key,
rest = objectWithoutProperties(attributes, ['key']);

@@ -641,3 +639,3 @@

object: object,
key: attrKey,
key: key,
data: _extends({}, value.data || {}, rest)

@@ -654,5 +652,4 @@ });

/**
* Normalize a mark creator with `key` and `value`.
* Normalize a mark creator of `value`.
*
* @param {String} key
* @param {Function|Object|String} value

@@ -662,3 +659,3 @@ * @return {Function}

function normalizeMark(key, value) {
function normalizeMark(value) {
if (typeof value == 'function') {

@@ -665,0 +662,0 @@ return value;

@@ -1,1 +0,1 @@

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("slate")):"function"==typeof define&&define.amd?define(["exports","slate"],t):t(e.SlateHyperscript={},e.Slate)}(this,function(e,t){"use strict";var n=function(e){return null!=e&&"object"==typeof e&&!1===Array.isArray(e)};function o(e){return!0===n(e)&&"[object Object]"===Object.prototype.toString.call(e)}var r=function(e){var t,n;return!1!==o(e)&&("function"==typeof(t=e.constructor)&&(!1!==o(n=t.prototype)&&!1!==n.hasOwnProperty("isPrototypeOf")))},a=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},c=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},i=function(e,t){var n={};for(var o in e)t.indexOf(o)>=0||Object.prototype.hasOwnProperty.call(e,o)&&(n[o]=e[o]);return n},s=function e(){a(this,e),this.offset=null},f=function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};a(this,e);var n=t.key,o=void 0===n?null:n,r=t.offset,c=void 0===r?null:r,i=t.path,s=void 0===i?null:i;this.key=o,this.offset=c,this.path=s},u=function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};a(this,e);var n=t.key,o=void 0===n?null:n,r=t.offset,c=void 0===r?null:r,i=t.path,s=void 0===i?null:i;this.key=o,this.offset=c,this.path=s},l=function e(n){var o=this;a(this,e),this.combine=function(n){if(!(n instanceof e))throw new Error("misaligned decorations");return t.Decoration.create({anchor:{key:o.key,offset:o.offset},focus:{key:n.key,offset:n.offset},mark:{type:o.type,data:o.data}})};var r=n.key,c=void 0===r?null:r,i=n.data,s=void 0===i?{}:i,f=n.type;this.id=c,this.offset=0,this.type=f,this.data=s},d={anchor:function(e,t,n){return new f(t)},block:function(e,n,o){return t.Block.create(c({},n,{nodes:y(o)}))},cursor:function(e,t,n){return new s},decoration:function(e,t,n){var o=t.key,r=t.data,a=e;if(o)return new l({key:o,type:a,data:r});var c=y(n),i=c[0],s=i.__decorations,f=void 0===s?[]:s,u={anchorOffset:0,focusOffset:c.reduce(function(e,t){return e+t.text.length},0),type:a,data:r};return f.push(u),i.__decorations=f,c},document:function(e,n,o){return t.Document.create(c({},n,{nodes:y(o)}))},focus:function(e,t,n){return new u(t)},inline:function(e,n,o){return t.Inline.create(c({},n,{nodes:y(o)}))},mark:function(e,n,o){return y(o,{marks:t.Mark.createSet([n])})},selection:function(e,n,o){var r=o.find(function(e){return e instanceof f}),a=o.find(function(e){return e instanceof u}),c=n.marks,i=n.focused,s=t.Selection.create({marks:c,isFocused:i,anchor:r&&{key:r.key,offset:r.offset,path:r.path},focus:a&&{key:a.key,offset:a.offset,path:a.path}});return s},text:function(e,t,n){return y(n,{key:t.key})},value:function(e,n,o){var r=n.data,a=n.normalize,c=void 0===a||a,i=t.Schema.create(n.schema||{}),s=o.find(t.Document.isDocument),f=o.find(t.Selection.isSelection)||t.Selection.create(),u=void 0,l=void 0,d=[],h={};if(s&&s.getTexts().forEach(function(e){null!=e.__anchor&&(u=t.Point.create({key:e.key,offset:e.__anchor.offset})),null!=e.__focus&&(l=t.Point.create({key:e.key,offset:e.__focus.offset})),null!=e.__decorations&&e.__decorations.forEach(function(n){var o=n.id,r=void 0;if(o)if(h[o]){var a=h[o];delete h[o],r=t.Decoration.create({anchor:{key:a.key,offset:a.offset},focus:{key:e.key,offset:n.offset},mark:{type:n.type,data:n.data}})}else n.key=e.key,h[o]=n;else r=t.Decoration.create({anchor:{key:e.key,offset:n.anchorOffset},focus:{key:e.key,offset:n.focusOffset},mark:{type:n.type,data:n.data}});r&&d.push(r)})}),Object.keys(h).length>0)throw new Error("Slate hyperscript must have both a start and an end defined for each decoration using the `key=` prop.");if(u&&!l)throw new Error("Slate hyperscript ranges must have both `<anchor />` and `<focus />` defined if one is defined, but you only defined `<anchor />`. For collapsed selections, use `<cursor />` instead.");if(!u&&l)throw new Error("Slate hyperscript ranges must have both `<anchor />` and `<focus />` defined if one is defined, but you only defined `<focus />`. For collapsed selections, use `<cursor />` instead.");var y=t.Value.fromJSON({data:r,document:s,selection:f,schema:i},{normalize:c});return(u||l)&&(f=(f=(f=f.setPoints([u,l])).setIsFocused(!0)).normalize(y.document),y=y.set("selection",f)),d.length>0&&(d=d.map(function(e){return e.normalize(y.document)}),d=t.Decoration.createList(d),y=y.set("decorations",d)),y}};function h(){var e=function(e){var t=e.blocks,n=void 0===t?{}:t,o=e.inlines,a=void 0===o?{}:o,i=e.marks,s=void 0===i?{}:i,f=e.decorations,u=void 0===f?{}:f,l=e.schema,h=c({},d,e.creators||{});return Object.keys(n).map(function(e){h[e]=p(e,n[e],"block")}),Object.keys(a).map(function(e){h[e]=p(e,a[e],"inline")}),Object.keys(s).map(function(e){h[e]=function(e,t){if("function"==typeof t)return t;if("string"==typeof t&&(t={type:t}),r(t))return function(e,n,o){var r=c({},t,{data:c({},t.data||{},n)});return d.mark(e,r,o)};throw new Error("Slate hyperscript mark creators can be either functions, objects or strings, but you passed: "+t)}(0,s[e])}),Object.keys(u).map(function(e){h[e]=p(e,u[e],"decoration")}),h.value=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments[2],o=c({schema:l},t);return d.value(e,o,n)},h}(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{});return function(t,n){for(var o=arguments.length,a=Array(o>2?o-2:0),c=2;c<o;c++)a[c-2]=arguments[c];var i=e[t];if(!i)throw new Error('No hyperscript creator found for tag: "'+t+'"');return null==n&&(n={}),r(n)||(a=[n].concat(a),n={}),i(t,n,a=a.filter(function(e){return Boolean(e)}).reduce(function(e,t){return e.concat(t)},[]))}}function y(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},o=[],r=0,a=e.find(function(e){return"string"!=typeof e}),c=t.Text.isText(a)?a:null,i=n.key?n.key:c?c.key:void 0,d=t.Text.create({key:i,leaves:[{text:"",marks:n.marks}]});function h(e){var t=d,n=t.__anchor,o=t.__focus,r=t.__decorations;null!=n&&(e.__anchor=n),null!=o&&(e.__focus=o),null!=r&&(e.__decorations=r),d=e}return e.forEach(function(a,c){var i=c===e.length-1;if(t.Node.isNode(a)&&!t.Text.isText(a)&&((d.text.length||null!=d.__anchor||null!=d.__focus||d.getMarksAtIndex(0).size)&&o.push(d),o.push(a),d=i?null:t.Text.create({leaves:[{text:"",marks:n.marks}]}),r=0),"string"==typeof a&&(h(d.insertText(d.text.length,a,n.marks)),r+=a.length),t.Text.isText(a)){var y=a.__anchor,p=a.__focus,k=a.__decorations,_=d.text.length;n.key||0!=d.text.length||h(d.set("key",a.key)),a.getLeaves().forEach(function(e){var t=e.marks;n.marks&&(t=t.union(n.marks)),h(d.insertText(_,e.text,t)),_+=e.text.length}),null!=y&&(d.__anchor=new f,d.__anchor.offset=y.offset+r),null!=p&&(d.__focus=new u,d.__focus.offset=p.offset+r),null!=k&&(k.forEach(function(e){e instanceof l?e.offset+=r:(e.anchorOffset+=r,e.focusOffset+=r)}),d.__decorations=d.__decorations||[],d.__decorations=d.__decorations.concat(k)),r+=a.text.length}(a instanceof f||a instanceof s)&&(a.offset=r,d.__anchor=a),(a instanceof u||a instanceof s)&&(a.offset=r,d.__focus=a),a instanceof l&&(a.offset=r,d.__decorations=d.__decorations||[],d.__decorations=d.__decorations.concat(a))}),null!=d&&o.push(d),o}function p(e,t,n){if("function"==typeof t)return t;if("string"==typeof t&&(t={type:t}),r(t))return function(e,o,r){var a=o.key,s=i(o,["key"]),f=c({},t,{object:n,key:a,data:c({},t.data||{},s)});return d[n](e,f,r)};throw new Error("Slate hyperscript "+n+" creators can be either functions, objects or strings, but you passed: "+t)}var k=h();e.default=k,e.createHyperscript=h,Object.defineProperty(e,"__esModule",{value:!0})});
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("slate")):"function"==typeof define&&define.amd?define(["exports","slate"],t):t(e.SlateHyperscript={},e.Slate)}(this,function(e,t){"use strict";var n=function(e){return null!=e&&"object"==typeof e&&!1===Array.isArray(e)};function o(e){return!0===n(e)&&"[object Object]"===Object.prototype.toString.call(e)}var r=function(e){var t,n;return!1!==o(e)&&("function"==typeof(t=e.constructor)&&(!1!==o(n=t.prototype)&&!1!==n.hasOwnProperty("isPrototypeOf")))},a=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},i=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},c=function(e,t){var n={};for(var o in e)t.indexOf(o)>=0||Object.prototype.hasOwnProperty.call(e,o)&&(n[o]=e[o]);return n},s=function e(){a(this,e),this.offset=null},f=function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};a(this,e);var n=t.key,o=void 0===n?null:n,r=t.offset,i=void 0===r?null:r,c=t.path,s=void 0===c?null:c;this.key=o,this.offset=i,this.path=s},u=function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};a(this,e);var n=t.key,o=void 0===n?null:n,r=t.offset,i=void 0===r?null:r,c=t.path,s=void 0===c?null:c;this.key=o,this.offset=i,this.path=s},l=function e(n){var o=this;a(this,e),this.combine=function(n){if(!(n instanceof e))throw new Error("misaligned decorations");return t.Decoration.create({anchor:{key:o.key,offset:o.offset},focus:{key:n.key,offset:n.offset},mark:{type:o.type,data:o.data}})};var r=n.key,i=void 0===r?null:r,c=n.data,s=void 0===c?{}:c,f=n.type;this.id=i,this.offset=0,this.type=f,this.data=s},d={anchor:function(e,t,n){return new f(t)},block:function(e,n,o){return t.Block.create(i({},n,{nodes:y(o)}))},cursor:function(e,t,n){return new s},decoration:function(e,t,n){var o=t.key,r=t.data,a=e;if(o)return new l({key:o,type:a,data:r});var i=y(n),c=i[0],s=c.__decorations,f=void 0===s?[]:s,u={anchorOffset:0,focusOffset:i.reduce(function(e,t){return e+t.text.length},0),type:a,data:r};return f.push(u),c.__decorations=f,i},document:function(e,n,o){return t.Document.create(i({},n,{nodes:y(o)}))},focus:function(e,t,n){return new u(t)},inline:function(e,n,o){return t.Inline.create(i({},n,{nodes:y(o)}))},mark:function(e,n,o){return y(o,{marks:t.Mark.createSet([n])})},selection:function(e,n,o){var r=o.find(function(e){return e instanceof f}),a=o.find(function(e){return e instanceof u}),i=n.marks,c=n.focused,s=t.Selection.create({marks:i,isFocused:c,anchor:r&&{key:r.key,offset:r.offset,path:r.path},focus:a&&{key:a.key,offset:a.offset,path:a.path}});return s},text:function(e,t,n){return y(n,{key:t.key})},value:function(e,n,o){var r=n.data,a=n.normalize,c=void 0===a||a,s=o.find(t.Document.isDocument),f=o.find(t.Selection.isSelection)||t.Selection.create(),u=void 0,l=void 0,d=[],h={};if(s&&s.getTexts().forEach(function(e){null!=e.__anchor&&(u=t.Point.create({key:e.key,offset:e.__anchor.offset})),null!=e.__focus&&(l=t.Point.create({key:e.key,offset:e.__focus.offset})),null!=e.__decorations&&e.__decorations.forEach(function(n){var o=n.id,r=void 0;if(o)if(h[o]){var a=h[o];delete h[o],r=t.Decoration.create({anchor:{key:a.key,offset:a.offset},focus:{key:e.key,offset:n.offset},mark:{type:n.type,data:n.data}})}else n.key=e.key,h[o]=n;else r=t.Decoration.create({anchor:{key:e.key,offset:n.anchorOffset},focus:{key:e.key,offset:n.focusOffset},mark:{type:n.type,data:n.data}});r&&d.push(r)})}),Object.keys(h).length>0)throw new Error("Slate hyperscript must have both a start and an end defined for each decoration using the `key=` prop.");if(u&&!l)throw new Error("Slate hyperscript ranges must have both `<anchor />` and `<focus />` defined if one is defined, but you only defined `<anchor />`. For collapsed selections, use `<cursor />` instead.");if(!u&&l)throw new Error("Slate hyperscript ranges must have both `<anchor />` and `<focus />` defined if one is defined, but you only defined `<focus />`. For collapsed selections, use `<cursor />` instead.");var y=t.Value.fromJSON(i({data:r,document:s,selection:f},n),{normalize:c});return(u||l)&&(f=(f=(f=f.setPoints([u,l])).setIsFocused(!0)).normalize(y.document),y=y.set("selection",f)),d.length>0&&(d=d.map(function(e){return e.normalize(y.document)}),d=t.Decoration.createList(d),y=y.set("decorations",d)),y}};function h(){var e=function(e){var t=e.blocks,n=void 0===t?{}:t,o=e.inlines,a=void 0===o?{}:o,c=e.marks,s=void 0===c?{}:c,f=e.decorations,u=void 0===f?{}:f,l=e.schema,h=i({},d,e.creators||{});return Object.keys(n).map(function(e){h[e]=p(n[e],"block")}),Object.keys(a).map(function(e){h[e]=p(a[e],"inline")}),Object.keys(s).map(function(e){h[e]=function(e){if("function"==typeof e)return e;if("string"==typeof e&&(e={type:e}),r(e))return function(t,n,o){var r=i({},e,{data:i({},e.data||{},n)});return d.mark(t,r,o)};throw new Error("Slate hyperscript mark creators can be either functions, objects or strings, but you passed: "+e)}(s[e])}),Object.keys(u).map(function(e){h[e]=p(u[e],"decoration")}),h.value=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments[2],o=i({schema:l},t);return d.value(e,o,n)},h}(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{});return function(t,n){for(var o=arguments.length,a=Array(o>2?o-2:0),i=2;i<o;i++)a[i-2]=arguments[i];var c=e[t];if(!c)throw new Error('No hyperscript creator found for tag: "'+t+'"');return null==n&&(n={}),r(n)||(a=[n].concat(a),n={}),c(t,n,a=a.filter(function(e){return Boolean(e)}).reduce(function(e,t){return e.concat(t)},[]))}}function y(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},o=[],r=0,a=e.find(function(e){return"string"!=typeof e}),i=t.Text.isText(a)?a:null,c=n.key?n.key:i?i.key:void 0,d=t.Text.create({key:c,leaves:[{text:"",marks:n.marks}]});function h(e){var t=d,n=t.__anchor,o=t.__focus,r=t.__decorations;null!=n&&(e.__anchor=n),null!=o&&(e.__focus=o),null!=r&&(e.__decorations=r),d=e}return e.forEach(function(a,i){var c=i===e.length-1;if(t.Node.isNode(a)&&!t.Text.isText(a)&&((d.text.length||null!=d.__anchor||null!=d.__focus||d.getMarksAtIndex(0).size)&&o.push(d),o.push(a),d=c?null:t.Text.create({leaves:[{text:"",marks:n.marks}]}),r=0),"string"==typeof a&&(h(d.insertText(d.text.length,a,n.marks)),r+=a.length),t.Text.isText(a)){var y=a.__anchor,p=a.__focus,k=a.__decorations,_=d.text.length;n.key||0!=d.text.length||h(d.set("key",a.key)),a.getLeaves().forEach(function(e){var t=e.marks;n.marks&&(t=t.union(n.marks)),h(d.insertText(_,e.text,t)),_+=e.text.length}),null!=y&&(d.__anchor=new f,d.__anchor.offset=y.offset+r),null!=p&&(d.__focus=new u,d.__focus.offset=p.offset+r),null!=k&&(k.forEach(function(e){e instanceof l?e.offset+=r:(e.anchorOffset+=r,e.focusOffset+=r)}),d.__decorations=d.__decorations||[],d.__decorations=d.__decorations.concat(k)),r+=a.text.length}(a instanceof f||a instanceof s)&&(a.offset=r,d.__anchor=a),(a instanceof u||a instanceof s)&&(a.offset=r,d.__focus=a),a instanceof l&&(a.offset=r,d.__decorations=d.__decorations||[],d.__decorations=d.__decorations.concat(a))}),null!=d&&o.push(d),o}function p(e,t){if("function"==typeof e)return e;if("string"==typeof e&&(e={type:e}),r(e))return function(n,o,r){var a=o.key,s=c(o,["key"]),f=i({},e,{object:t,key:a,data:i({},e.data||{},s)});return d[t](n,f,r)};throw new Error("Slate hyperscript "+t+" creators can be either functions, objects or strings, but you passed: "+e)}var k=h();e.default=k,e.createHyperscript=h,Object.defineProperty(e,"__esModule",{value:!0})});
import isPlainObject from 'is-plain-object';
import { Block, Decoration, Document, Inline, Mark, Node, Point, Schema, Selection, Text, Value } from 'slate';
import { Block, Decoration, Document, Inline, Mark, Node, Point, Selection, Text, Value } from 'slate';

@@ -238,3 +238,2 @@ var classCallCheck = function (instance, Constructor) {

var schema = Schema.create(attributes.schema || {});
var document = children.find(Document.isDocument);

@@ -323,3 +322,3 @@ var selection = children.find(Selection.isSelection) || Selection.create();

var value = Value.fromJSON({ data: data, document: document, selection: selection, schema: schema }, { normalize: normalize });
var value = Value.fromJSON(_extends({ data: data, document: document, selection: selection }, attributes), { normalize: normalize });

@@ -545,15 +544,15 @@ if (anchor || focus) {

Object.keys(blocks).map(function (key) {
creators[key] = normalizeNode(key, blocks[key], 'block');
creators[key] = normalizeNode(blocks[key], 'block');
});
Object.keys(inlines).map(function (key) {
creators[key] = normalizeNode(key, inlines[key], 'inline');
creators[key] = normalizeNode(inlines[key], 'inline');
});
Object.keys(marks).map(function (key) {
creators[key] = normalizeMark(key, marks[key]);
creators[key] = normalizeMark(marks[key]);
});
Object.keys(decorations).map(function (key) {
creators[key] = normalizeNode(key, decorations[key], 'decoration');
creators[key] = normalizeNode(decorations[key], 'decoration');
});

@@ -573,5 +572,4 @@

/**
* Normalize a node creator with `key` and `value`, of `object`.
* Normalize a node creator of `value` and `object`.
*
* @param {String} key
* @param {Function|Object|String} value

@@ -582,3 +580,3 @@ * @param {String} object

function normalizeNode(key, value, object) {
function normalizeNode(value, object) {
if (typeof value == 'function') {

@@ -594,3 +592,3 @@ return value;

return function (tagName, attributes, children) {
var attrKey = attributes.key,
var key = attributes.key,
rest = objectWithoutProperties(attributes, ['key']);

@@ -600,3 +598,3 @@

object: object,
key: attrKey,
key: key,
data: _extends({}, value.data || {}, rest)

@@ -613,5 +611,4 @@ });

/**
* Normalize a mark creator with `key` and `value`.
* Normalize a mark creator of `value`.
*
* @param {String} key
* @param {Function|Object|String} value

@@ -621,3 +618,3 @@ * @return {Function}

function normalizeMark(key, value) {
function normalizeMark(value) {
if (typeof value == 'function') {

@@ -624,0 +621,0 @@ return value;

@@ -244,3 +244,2 @@ 'use strict';

var schema = slate.Schema.create(attributes.schema || {});
var document = children.find(slate.Document.isDocument);

@@ -329,3 +328,3 @@ var selection = children.find(slate.Selection.isSelection) || slate.Selection.create();

var value = slate.Value.fromJSON({ data: data, document: document, selection: selection, schema: schema }, { normalize: normalize });
var value = slate.Value.fromJSON(_extends({ data: data, document: document, selection: selection }, attributes), { normalize: normalize });

@@ -551,15 +550,15 @@ if (anchor || focus) {

Object.keys(blocks).map(function (key) {
creators[key] = normalizeNode(key, blocks[key], 'block');
creators[key] = normalizeNode(blocks[key], 'block');
});
Object.keys(inlines).map(function (key) {
creators[key] = normalizeNode(key, inlines[key], 'inline');
creators[key] = normalizeNode(inlines[key], 'inline');
});
Object.keys(marks).map(function (key) {
creators[key] = normalizeMark(key, marks[key]);
creators[key] = normalizeMark(marks[key]);
});
Object.keys(decorations).map(function (key) {
creators[key] = normalizeNode(key, decorations[key], 'decoration');
creators[key] = normalizeNode(decorations[key], 'decoration');
});

@@ -579,5 +578,4 @@

/**
* Normalize a node creator with `key` and `value`, of `object`.
* Normalize a node creator of `value` and `object`.
*
* @param {String} key
* @param {Function|Object|String} value

@@ -588,3 +586,3 @@ * @param {String} object

function normalizeNode(key, value, object) {
function normalizeNode(value, object) {
if (typeof value == 'function') {

@@ -600,3 +598,3 @@ return value;

return function (tagName, attributes, children) {
var attrKey = attributes.key,
var key = attributes.key,
rest = objectWithoutProperties(attributes, ['key']);

@@ -606,3 +604,3 @@

object: object,
key: attrKey,
key: key,
data: _extends({}, value.data || {}, rest)

@@ -619,5 +617,4 @@ });

/**
* Normalize a mark creator with `key` and `value`.
* Normalize a mark creator of `value`.
*
* @param {String} key
* @param {Function|Object|String} value

@@ -627,3 +624,3 @@ * @return {Function}

function normalizeMark(key, value) {
function normalizeMark(value) {
if (typeof value == 'function') {

@@ -630,0 +627,0 @@ return value;

{
"name": "slate-hyperscript",
"description": "A hyperscript helper for creating Slate documents.",
"version": "0.9.3",
"version": "0.10.0",
"license": "MIT",

@@ -16,5 +16,3 @@ "repository": "git://github.com/ianstormtaylor/slate.git",

"dependencies": {
"is-empty": "^1.0.0",
"is-plain-object": "^2.0.4",
"slate-dev-logger": "^0.1.43"
"is-plain-object": "^2.0.4"
},

@@ -26,3 +24,3 @@ "peerDependencies": {

"mocha": "^2.5.3",
"slate": "^0.39.3"
"slate": "^0.40.0"
},

@@ -29,0 +27,0 @@ "scripts": {

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