slate-hyperscript
Advanced tools
Comparing version 0.67.0 to 0.76.2-2022311131653
import { createHyperscript, HyperscriptCreators, HyperscriptShorthands } from './hyperscript'; | ||
import { createEditor } from './creators'; | ||
import { createEditor, createText } from './creators'; | ||
/** | ||
@@ -16,3 +16,3 @@ * The default hyperscript factory that ships with Slate, without custom tags. | ||
selection: typeof import("./creators").createSelection; | ||
text: typeof import("./creators").createText; | ||
text: typeof createText; | ||
} | { | ||
@@ -28,5 +28,5 @@ anchor: typeof import("./creators").createAnchor; | ||
selection: typeof import("./creators").createSelection; | ||
text: typeof import("./creators").createText; | ||
text: typeof createText; | ||
})[S]>; | ||
export { jsx, createHyperscript, createEditor, HyperscriptCreators, HyperscriptShorthands, }; | ||
export { jsx, createHyperscript, createEditor, createText, HyperscriptCreators, HyperscriptShorthands, }; | ||
//# sourceMappingURL=index.d.ts.map |
import { isPlainObject } from 'is-plain-object'; | ||
import { Range, Node, Text, Element, createEditor as createEditor$1 } from 'slate'; | ||
import { Text, Range, Node, Element, createEditor as createEditor$1 } from 'slate'; | ||
@@ -416,3 +416,3 @@ function _defineProperty(obj, key, value) { | ||
export { createEditor, createHyperscript, jsx }; | ||
export { createEditor, createHyperscript, createText, jsx }; | ||
//# sourceMappingURL=index.es.js.map |
@@ -746,3 +746,4 @@ 'use strict'; | ||
exports.createHyperscript = createHyperscript; | ||
exports.createText = createText; | ||
exports.jsx = jsx; | ||
//# sourceMappingURL=index.js.map |
@@ -778,2 +778,3 @@ (function (global, factory) { | ||
exports.createHyperscript = createHyperscript; | ||
exports.createText = createText; | ||
exports.jsx = jsx; | ||
@@ -780,0 +781,0 @@ |
@@ -8,2 +8,2 @@ !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("slate")):"function"==typeof define&&define.amd?define(["exports","slate"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).SlateHyperscript={},t.Slate)}(this,(function(t,e){"use strict";function r(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function n(t,e){return t(e={exports:{}},e.exports),e.exports}var o=n((function(t){function e(r){return"function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?(t.exports=e=function(t){return typeof t},t.exports.default=t.exports,t.exports.__esModule=!0):(t.exports=e=function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},t.exports.default=t.exports,t.exports.__esModule=!0),e(r)}t.exports=e,t.exports.default=t.exports,t.exports.__esModule=!0})),u=r(o),i=r(n((function(t){t.exports=function(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t},t.exports.default=t.exports,t.exports.__esModule=!0}))); | ||
*/ | ||
function s(t){return"[object Object]"===Object.prototype.toString.call(t)}function f(t){var e,r;return!1!==s(t)&&(void 0===(e=t.constructor)||!1!==s(r=e.prototype)&&!1!==r.hasOwnProperty("isPrototypeOf"))}var a=n((function(t){t.exports=function(t){if(Array.isArray(t))return t},t.exports.default=t.exports,t.exports.__esModule=!0}));r(a);var c=n((function(t){t.exports=function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,u=[],i=!0,s=!1;try{for(r=r.call(t);!(i=(n=r.next()).done)&&(u.push(n.value),!e||u.length!==e);i=!0);}catch(t){s=!0,o=t}finally{try{i||null==r.return||r.return()}finally{if(s)throw o}}return u}},t.exports.default=t.exports,t.exports.__esModule=!0}));r(c);var l=n((function(t){t.exports=function(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n},t.exports.default=t.exports,t.exports.__esModule=!0}));r(l);var p=n((function(t){t.exports=function(t,e){if(t){if("string"==typeof t)return l(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?l(t,e):void 0}},t.exports.default=t.exports,t.exports.__esModule=!0}));r(p);var d=n((function(t){t.exports=function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")},t.exports.default=t.exports,t.exports.__esModule=!0}));r(d);var h=r(n((function(t){t.exports=function(t,e){return a(t)||c(t,e)||p(t,e)||d()},t.exports.default=t.exports,t.exports.__esModule=!0}))),y=n((function(t){function e(r,n){return t.exports=e=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},t.exports.default=t.exports,t.exports.__esModule=!0,e(r,n)}t.exports=e,t.exports.default=t.exports,t.exports.__esModule=!0}));r(y);var x=r(n((function(t){t.exports=function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&y(t,e)},t.exports.default=t.exports,t.exports.__esModule=!0}))),v=n((function(t){t.exports=function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t},t.exports.default=t.exports,t.exports.__esModule=!0}));r(v);var b=r(n((function(t){var e=o.default;t.exports=function(t,r){if(r&&("object"===e(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");return v(t)},t.exports.default=t.exports,t.exports.__esModule=!0}))),g=r(n((function(t){function e(r){return t.exports=e=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},t.exports.default=t.exports,t.exports.__esModule=!0,e(r)}t.exports=e,t.exports.default=t.exports,t.exports.__esModule=!0}))),w=r(n((function(t){t.exports=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},t.exports.default=t.exports,t.exports.__esModule=!0})));function O(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=g(t);if(e){var o=g(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return b(this,r)}}var m=new WeakMap,j=new WeakMap,_=function t(){w(this,t)},P=function(t){x(r,t);var e=O(r);function r(){var t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};w(this,r),t=e.call(this);var o=n.offset,u=n.path;return t.offset=o,t.path=u,t}return r}(_),S=function(t){x(r,t);var e=O(r);function r(){var t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};w(this,r),t=e.call(this);var o=n.offset,u=n.path;return t.offset=o,t.path=u,t}return r}(_),M=function(t){return j.get(t)};function E(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function T(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?E(Object(r),!0).forEach((function(e){i(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):E(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function A(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,e){if(!t)return;if("string"==typeof t)return R(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return R(t,e)}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var u,i=!0,s=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return i=t.done,t},e:function(t){s=!0,u=t},f:function(){try{i||null==r.return||r.return()}finally{if(s)throw u}}}}function R(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}var D=new WeakSet,I=function(t){var r,n=[],o=function t(r){if(null!=r){var o=n[n.length-1];if("string"==typeof r){var u={text:r};D.add(u),r=u}if(e.Text.isText(r)){var i=r;e.Text.isText(o)&&D.has(o)&&D.has(i)&&e.Text.equals(o,i,{loose:!0})?o.text+=i.text:n.push(i)}else if(e.Element.isElement(r))n.push(r);else{if(!(r instanceof _))throw new Error("Unexpected hyperscript child object: ".concat(r));var s=n[n.length-1];e.Text.isText(s)||(t(""),s=n[n.length-1]),r instanceof P?function(t,e){var r=t.text.length;m.set(t,[r,e])}(s,r):r instanceof S&&function(t,e){var r=t.text.length;j.set(t,[r,e])}(s,r)}}},u=A(t.flat(1/0));try{for(u.s();!(r=u.n()).done;){o(r.value)}}catch(t){u.e(t)}finally{u.f()}return n};function k(t,e,r){return T(T({},e),{},{children:I(r)})}var B=function(t){return function(r,n,o){var u,i,s=[],f=A(o);try{for(f.s();!(i=f.n()).done;){var a=i.value;e.Range.isRange(a)?u=a:s.push(a)}}catch(t){f.e(t)}finally{f.f()}var c=I(s),l={},p=t();Object.assign(p,n),p.children=c;var d,y,x=A(e.Node.texts(p));try{for(x.s();!(d=x.n()).done;){var v=h(d.value,2),b=v[0],g=v[1],w=(y=b,m.get(y)),O=M(b);if(null!=w){var j=h(w,1)[0];l.anchor={path:g,offset:j}}if(null!=O){var _=h(O,1)[0];l.focus={path:g,offset:_}}}}catch(t){x.e(t)}finally{x.f()}if(l.anchor&&!l.focus)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(!l.anchor&&l.focus)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.");return null!=u?p.selection=u:e.Range.isRange(l)&&(p.selection=l),p}};function C(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function U(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?C(Object(r),!0).forEach((function(e){i(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):C(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}var W={anchor:function(t,e,r){return new P(e)},cursor:function(t,e,r){return[new P(e),new S(e)]},editor:B(e.createEditor),element:k,focus:function(t,e,r){return new S(e)},fragment:function(t,e,r){return I(r)},selection:function(t,e,r){var n=r.find((function(t){return t instanceof P})),o=r.find((function(t){return t instanceof S}));if(!n||null==n.offset||null==n.path)throw new Error("The <selection> hyperscript tag must have an <anchor> tag as a child with `path` and `offset` attributes defined.");if(!o||null==o.offset||null==o.path)throw new Error("The <selection> hyperscript tag must have a <focus> tag as a child with `path` and `offset` attributes defined.");return T({anchor:{offset:n.offset,path:n.path},focus:{offset:o.offset,path:o.path}},e)},text:function(t,r,n){var o=I(n);if(o.length>1)throw new Error("The <text> hyperscript tag must only contain a single node's worth of children.");var u=h(o,1)[0];if(null==u&&(u={text:""}),!e.Text.isText(u))throw new Error("\n The <text> hyperscript tag can only contain text content as children.");return D.delete(u),Object.assign(u,r),u}},q=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=t.elements,r=void 0===e?{}:e,n=H(r),o=U(U(U({},W),n),t.creators),u=F(o);return u},F=function(t){return function(e,r){for(var n=arguments.length,o=new Array(n>2?n-2:0),u=2;u<n;u++)o[u-2]=arguments[u];var i=t[e];if(!i)throw new Error("No hyperscript creator found for tag: <".concat(e,">"));null==r&&(r={}),f(r)||(o=[r].concat(o),r={});var s=i(e,r,o=o.filter((function(t){return Boolean(t)})).flat());return s}},H=function(t){var e={},r=function(r){var n=t[r];if("object"!==u(n))throw new Error("Properties specified for a hyperscript shorthand should be an object, but for the custom element <".concat(r,"> tag you passed: ").concat(n));e[r]=function(t,e,r){return k(0,U(U({},n),e),r)}};for(var n in t)r(n);return e},N=q();t.createEditor=B,t.createHyperscript=q,t.jsx=N,Object.defineProperty(t,"__esModule",{value:!0})})); | ||
function s(t){return"[object Object]"===Object.prototype.toString.call(t)}function f(t){var e,r;return!1!==s(t)&&(void 0===(e=t.constructor)||!1!==s(r=e.prototype)&&!1!==r.hasOwnProperty("isPrototypeOf"))}var a=n((function(t){t.exports=function(t){if(Array.isArray(t))return t},t.exports.default=t.exports,t.exports.__esModule=!0}));r(a);var c=n((function(t){t.exports=function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,u=[],i=!0,s=!1;try{for(r=r.call(t);!(i=(n=r.next()).done)&&(u.push(n.value),!e||u.length!==e);i=!0);}catch(t){s=!0,o=t}finally{try{i||null==r.return||r.return()}finally{if(s)throw o}}return u}},t.exports.default=t.exports,t.exports.__esModule=!0}));r(c);var l=n((function(t){t.exports=function(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n},t.exports.default=t.exports,t.exports.__esModule=!0}));r(l);var p=n((function(t){t.exports=function(t,e){if(t){if("string"==typeof t)return l(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?l(t,e):void 0}},t.exports.default=t.exports,t.exports.__esModule=!0}));r(p);var d=n((function(t){t.exports=function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")},t.exports.default=t.exports,t.exports.__esModule=!0}));r(d);var h=r(n((function(t){t.exports=function(t,e){return a(t)||c(t,e)||p(t,e)||d()},t.exports.default=t.exports,t.exports.__esModule=!0}))),y=n((function(t){function e(r,n){return t.exports=e=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},t.exports.default=t.exports,t.exports.__esModule=!0,e(r,n)}t.exports=e,t.exports.default=t.exports,t.exports.__esModule=!0}));r(y);var x=r(n((function(t){t.exports=function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&y(t,e)},t.exports.default=t.exports,t.exports.__esModule=!0}))),v=n((function(t){t.exports=function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t},t.exports.default=t.exports,t.exports.__esModule=!0}));r(v);var b=r(n((function(t){var e=o.default;t.exports=function(t,r){if(r&&("object"===e(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");return v(t)},t.exports.default=t.exports,t.exports.__esModule=!0}))),g=r(n((function(t){function e(r){return t.exports=e=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},t.exports.default=t.exports,t.exports.__esModule=!0,e(r)}t.exports=e,t.exports.default=t.exports,t.exports.__esModule=!0}))),w=r(n((function(t){t.exports=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},t.exports.default=t.exports,t.exports.__esModule=!0})));function O(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=g(t);if(e){var o=g(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return b(this,r)}}var m=new WeakMap,j=new WeakMap,_=function t(){w(this,t)},P=function(t){x(r,t);var e=O(r);function r(){var t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};w(this,r),t=e.call(this);var o=n.offset,u=n.path;return t.offset=o,t.path=u,t}return r}(_),S=function(t){x(r,t);var e=O(r);function r(){var t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};w(this,r),t=e.call(this);var o=n.offset,u=n.path;return t.offset=o,t.path=u,t}return r}(_),M=function(t){return j.get(t)};function E(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function T(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?E(Object(r),!0).forEach((function(e){i(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):E(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function A(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,e){if(!t)return;if("string"==typeof t)return R(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return R(t,e)}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var u,i=!0,s=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return i=t.done,t},e:function(t){s=!0,u=t},f:function(){try{i||null==r.return||r.return()}finally{if(s)throw u}}}}function R(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}var D=new WeakSet,I=function(t){var r,n=[],o=function t(r){if(null!=r){var o=n[n.length-1];if("string"==typeof r){var u={text:r};D.add(u),r=u}if(e.Text.isText(r)){var i=r;e.Text.isText(o)&&D.has(o)&&D.has(i)&&e.Text.equals(o,i,{loose:!0})?o.text+=i.text:n.push(i)}else if(e.Element.isElement(r))n.push(r);else{if(!(r instanceof _))throw new Error("Unexpected hyperscript child object: ".concat(r));var s=n[n.length-1];e.Text.isText(s)||(t(""),s=n[n.length-1]),r instanceof P?function(t,e){var r=t.text.length;m.set(t,[r,e])}(s,r):r instanceof S&&function(t,e){var r=t.text.length;j.set(t,[r,e])}(s,r)}}},u=A(t.flat(1/0));try{for(u.s();!(r=u.n()).done;){o(r.value)}}catch(t){u.e(t)}finally{u.f()}return n};function k(t,e,r){return T(T({},e),{},{children:I(r)})}function B(t,r,n){var o=I(n);if(o.length>1)throw new Error("The <text> hyperscript tag must only contain a single node's worth of children.");var u=h(o,1)[0];if(null==u&&(u={text:""}),!e.Text.isText(u))throw new Error("\n The <text> hyperscript tag can only contain text content as children.");return D.delete(u),Object.assign(u,r),u}var C=function(t){return function(r,n,o){var u,i,s=[],f=A(o);try{for(f.s();!(i=f.n()).done;){var a=i.value;e.Range.isRange(a)?u=a:s.push(a)}}catch(t){f.e(t)}finally{f.f()}var c=I(s),l={},p=t();Object.assign(p,n),p.children=c;var d,y,x=A(e.Node.texts(p));try{for(x.s();!(d=x.n()).done;){var v=h(d.value,2),b=v[0],g=v[1],w=(y=b,m.get(y)),O=M(b);if(null!=w){var j=h(w,1)[0];l.anchor={path:g,offset:j}}if(null!=O){var _=h(O,1)[0];l.focus={path:g,offset:_}}}}catch(t){x.e(t)}finally{x.f()}if(l.anchor&&!l.focus)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(!l.anchor&&l.focus)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.");return null!=u?p.selection=u:e.Range.isRange(l)&&(p.selection=l),p}};function U(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function W(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?U(Object(r),!0).forEach((function(e){i(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):U(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}var q={anchor:function(t,e,r){return new P(e)},cursor:function(t,e,r){return[new P(e),new S(e)]},editor:C(e.createEditor),element:k,focus:function(t,e,r){return new S(e)},fragment:function(t,e,r){return I(r)},selection:function(t,e,r){var n=r.find((function(t){return t instanceof P})),o=r.find((function(t){return t instanceof S}));if(!n||null==n.offset||null==n.path)throw new Error("The <selection> hyperscript tag must have an <anchor> tag as a child with `path` and `offset` attributes defined.");if(!o||null==o.offset||null==o.path)throw new Error("The <selection> hyperscript tag must have a <focus> tag as a child with `path` and `offset` attributes defined.");return T({anchor:{offset:n.offset,path:n.path},focus:{offset:o.offset,path:o.path}},e)},text:B},F=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=t.elements,r=void 0===e?{}:e,n=N(r),o=W(W(W({},q),n),t.creators),u=H(o);return u},H=function(t){return function(e,r){for(var n=arguments.length,o=new Array(n>2?n-2:0),u=2;u<n;u++)o[u-2]=arguments[u];var i=t[e];if(!i)throw new Error("No hyperscript creator found for tag: <".concat(e,">"));null==r&&(r={}),f(r)||(o=[r].concat(o),r={});var s=i(e,r,o=o.filter((function(t){return Boolean(t)})).flat());return s}},N=function(t){var e={},r=function(r){var n=t[r];if("object"!==u(n))throw new Error("Properties specified for a hyperscript shorthand should be an object, but for the custom element <".concat(r,"> tag you passed: ").concat(n));e[r]=function(t,e,r){return k(0,W(W({},n),e),r)}};for(var n in t)r(n);return e},$=F();t.createEditor=C,t.createHyperscript=F,t.createText=B,t.jsx=$,Object.defineProperty(t,"__esModule",{value:!0})})); |
{ | ||
"name": "slate-hyperscript", | ||
"description": "A hyperscript helper for creating Slate documents.", | ||
"version": "0.67.0", | ||
"version": "0.76.2-2022311131653", | ||
"license": "MIT", | ||
@@ -21,7 +21,7 @@ "repository": "git://github.com/ianstormtaylor/slate.git", | ||
"@babel/runtime": "^7.7.4", | ||
"slate": "^0.66.0", | ||
"slate": "^0.76.1-2022311131653", | ||
"source-map-loader": "^0.2.4" | ||
}, | ||
"peerDependencies": { | ||
"slate": ">=0.65.3" | ||
"slate": ">=0.76.1-2022311131653" | ||
}, | ||
@@ -28,0 +28,0 @@ "umdGlobals": { |
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
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
1779
140023
16