app-devtools 0.11.0 → 0.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/main.js +10 -609
  2. package/package.json +1 -1
package/dist/main.js CHANGED
@@ -1,3 +1,10 @@
1
+ import dayjs from 'dayjs';
2
+ import { dequal } from 'dequal';
3
+ import { nanoid } from 'nanoid';
4
+ import { parse } from 'regexparam';
5
+ import * as diff from 'diff';
6
+ import tinykeys from 'tinykeys';
7
+
1
8
  const sharedConfig = {};
2
9
 
3
10
  const equalFn = (a, b) => a === b;
@@ -966,18 +973,6 @@ function cleanChildren(parent, current, marker, replacement) {
966
973
 
967
974
  var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
968
975
 
969
- var dayjs_minExports = {};
970
- var dayjs_min = {
971
- get exports(){ return dayjs_minExports; },
972
- set exports(v){ dayjs_minExports = v; },
973
- };
974
-
975
- (function (module, exports) {
976
- !function(t,e){module.exports=e();}(commonjsGlobal,(function(){var t=1e3,e=6e4,n=36e5,r="millisecond",i="second",s="minute",u="hour",a="day",o="week",f="month",h="quarter",c="year",d="date",l="Invalid Date",$=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,y=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,M={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(t){var e=["th","st","nd","rd"],n=t%100;return "["+t+(e[(n-20)%10]||e[n]||e[0])+"]"}},m=function(t,e,n){var r=String(t);return !r||r.length>=e?t:""+Array(e+1-r.length).join(n)+t},v={s:m,z:function(t){var e=-t.utcOffset(),n=Math.abs(e),r=Math.floor(n/60),i=n%60;return (e<=0?"+":"-")+m(r,2,"0")+":"+m(i,2,"0")},m:function t(e,n){if(e.date()<n.date())return -t(n,e);var r=12*(n.year()-e.year())+(n.month()-e.month()),i=e.clone().add(r,f),s=n-i<0,u=e.clone().add(r+(s?-1:1),f);return +(-(r+(n-i)/(s?i-u:u-i))||0)},a:function(t){return t<0?Math.ceil(t)||0:Math.floor(t)},p:function(t){return {M:f,y:c,w:o,d:a,D:d,h:u,m:s,s:i,ms:r,Q:h}[t]||String(t||"").toLowerCase().replace(/s$/,"")},u:function(t){return void 0===t}},g="en",D={};D[g]=M;var p=function(t){return t instanceof _},S=function t(e,n,r){var i;if(!e)return g;if("string"==typeof e){var s=e.toLowerCase();D[s]&&(i=s),n&&(D[s]=n,i=s);var u=e.split("-");if(!i&&u.length>1)return t(u[0])}else {var a=e.name;D[a]=e,i=a;}return !r&&i&&(g=i),i||!r&&g},w=function(t,e){if(p(t))return t.clone();var n="object"==typeof e?e:{};return n.date=t,n.args=arguments,new _(n)},O=v;O.l=S,O.i=p,O.w=function(t,e){return w(t,{locale:e.$L,utc:e.$u,x:e.$x,$offset:e.$offset})};var _=function(){function M(t){this.$L=S(t.locale,null,!0),this.parse(t);}var m=M.prototype;return m.parse=function(t){this.$d=function(t){var e=t.date,n=t.utc;if(null===e)return new Date(NaN);if(O.u(e))return new Date;if(e instanceof Date)return new Date(e);if("string"==typeof e&&!/Z$/i.test(e)){var r=e.match($);if(r){var i=r[2]-1||0,s=(r[7]||"0").substring(0,3);return n?new Date(Date.UTC(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,s)):new Date(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,s)}}return new Date(e)}(t),this.$x=t.x||{},this.init();},m.init=function(){var t=this.$d;this.$y=t.getFullYear(),this.$M=t.getMonth(),this.$D=t.getDate(),this.$W=t.getDay(),this.$H=t.getHours(),this.$m=t.getMinutes(),this.$s=t.getSeconds(),this.$ms=t.getMilliseconds();},m.$utils=function(){return O},m.isValid=function(){return !(this.$d.toString()===l)},m.isSame=function(t,e){var n=w(t);return this.startOf(e)<=n&&n<=this.endOf(e)},m.isAfter=function(t,e){return w(t)<this.startOf(e)},m.isBefore=function(t,e){return this.endOf(e)<w(t)},m.$g=function(t,e,n){return O.u(t)?this[e]:this.set(n,t)},m.unix=function(){return Math.floor(this.valueOf()/1e3)},m.valueOf=function(){return this.$d.getTime()},m.startOf=function(t,e){var n=this,r=!!O.u(e)||e,h=O.p(t),l=function(t,e){var i=O.w(n.$u?Date.UTC(n.$y,e,t):new Date(n.$y,e,t),n);return r?i:i.endOf(a)},$=function(t,e){return O.w(n.toDate()[t].apply(n.toDate("s"),(r?[0,0,0,0]:[23,59,59,999]).slice(e)),n)},y=this.$W,M=this.$M,m=this.$D,v="set"+(this.$u?"UTC":"");switch(h){case c:return r?l(1,0):l(31,11);case f:return r?l(1,M):l(0,M+1);case o:var g=this.$locale().weekStart||0,D=(y<g?y+7:y)-g;return l(r?m-D:m+(6-D),M);case a:case d:return $(v+"Hours",0);case u:return $(v+"Minutes",1);case s:return $(v+"Seconds",2);case i:return $(v+"Milliseconds",3);default:return this.clone()}},m.endOf=function(t){return this.startOf(t,!1)},m.$set=function(t,e){var n,o=O.p(t),h="set"+(this.$u?"UTC":""),l=(n={},n[a]=h+"Date",n[d]=h+"Date",n[f]=h+"Month",n[c]=h+"FullYear",n[u]=h+"Hours",n[s]=h+"Minutes",n[i]=h+"Seconds",n[r]=h+"Milliseconds",n)[o],$=o===a?this.$D+(e-this.$W):e;if(o===f||o===c){var y=this.clone().set(d,1);y.$d[l]($),y.init(),this.$d=y.set(d,Math.min(this.$D,y.daysInMonth())).$d;}else l&&this.$d[l]($);return this.init(),this},m.set=function(t,e){return this.clone().$set(t,e)},m.get=function(t){return this[O.p(t)]()},m.add=function(r,h){var d,l=this;r=Number(r);var $=O.p(h),y=function(t){var e=w(l);return O.w(e.date(e.date()+Math.round(t*r)),l)};if($===f)return this.set(f,this.$M+r);if($===c)return this.set(c,this.$y+r);if($===a)return y(1);if($===o)return y(7);var M=(d={},d[s]=e,d[u]=n,d[i]=t,d)[$]||1,m=this.$d.getTime()+r*M;return O.w(m,this)},m.subtract=function(t,e){return this.add(-1*t,e)},m.format=function(t){var e=this,n=this.$locale();if(!this.isValid())return n.invalidDate||l;var r=t||"YYYY-MM-DDTHH:mm:ssZ",i=O.z(this),s=this.$H,u=this.$m,a=this.$M,o=n.weekdays,f=n.months,h=function(t,n,i,s){return t&&(t[n]||t(e,r))||i[n].slice(0,s)},c=function(t){return O.s(s%12||12,t,"0")},d=n.meridiem||function(t,e,n){var r=t<12?"AM":"PM";return n?r.toLowerCase():r},$={YY:String(this.$y).slice(-2),YYYY:this.$y,M:a+1,MM:O.s(a+1,2,"0"),MMM:h(n.monthsShort,a,f,3),MMMM:h(f,a),D:this.$D,DD:O.s(this.$D,2,"0"),d:String(this.$W),dd:h(n.weekdaysMin,this.$W,o,2),ddd:h(n.weekdaysShort,this.$W,o,3),dddd:o[this.$W],H:String(s),HH:O.s(s,2,"0"),h:c(1),hh:c(2),a:d(s,u,!0),A:d(s,u,!1),m:String(u),mm:O.s(u,2,"0"),s:String(this.$s),ss:O.s(this.$s,2,"0"),SSS:O.s(this.$ms,3,"0"),Z:i};return r.replace(y,(function(t,e){return e||$[t]||i.replace(":","")}))},m.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},m.diff=function(r,d,l){var $,y=O.p(d),M=w(r),m=(M.utcOffset()-this.utcOffset())*e,v=this-M,g=O.m(this,M);return g=($={},$[c]=g/12,$[f]=g,$[h]=g/3,$[o]=(v-m)/6048e5,$[a]=(v-m)/864e5,$[u]=v/n,$[s]=v/e,$[i]=v/t,$)[y]||v,l?g:O.a(g)},m.daysInMonth=function(){return this.endOf(f).$D},m.$locale=function(){return D[this.$L]},m.locale=function(t,e){if(!t)return this.$L;var n=this.clone(),r=S(t,e,!0);return r&&(n.$L=r),n},m.clone=function(){return O.w(this.$d,this)},m.toDate=function(){return new Date(this.valueOf())},m.toJSON=function(){return this.isValid()?this.toISOString():null},m.toISOString=function(){return this.$d.toISOString()},m.toString=function(){return this.$d.toUTCString()},M}(),T=_.prototype;return w.prototype=T,[["$ms",r],["$s",i],["$m",s],["$H",u],["$W",a],["$M",f],["$y",c],["$D",d]].forEach((function(t){T[t[1]]=function(e){return this.$g(e,t[0],t[1])};})),w.extend=function(t,e){return t.$i||(t(e,_,w),t.$i=!0),w},w.locale=S,w.isDayjs=p,w.unix=function(t){return w(1e3*t)},w.en=D[g],w.Ls=D,w.p={},w}));
977
- } (dayjs_min));
978
-
979
- const dayjs = dayjs_minExports;
980
-
981
976
  var relativeTimeExports = {};
982
977
  var relativeTime$1 = {
983
978
  get exports(){ return relativeTimeExports; },
@@ -1038,7 +1033,7 @@ function parseUnit(value, defaultUnit = "px") {
1038
1033
  return typeof value === "string" ? String(value) : Array.isArray(value) ? value.map((item) => `${item}${defaultUnit}`).join(" ") : `${value}${defaultUnit}`;
1039
1034
  }
1040
1035
 
1041
- let e$1={data:""},t$1=t=>"object"==typeof window?((t?t.querySelector("#_goober"):window._goober)||Object.assign((t||document.head).appendChild(document.createElement("style")),{innerHTML:" ",id:"_goober"})).firstChild:t||e$1,l=/(?:([\u0080-\uFFFF\w-%@]+) *:? *([^{;]+?);|([^;}{]*?) *{)|(}\s*)/g,a=/\/\*[^]*?\*\/| +/g,n$1=/\n+/g,o$1=(e,t)=>{let r="",l="",a="";for(let n in e){let c=e[n];"@"==n[0]?"i"==n[1]?r=n+" "+c+";":l+="f"==n[1]?o$1(c,n):n+"{"+o$1(c,"k"==n[1]?"":t)+"}":"object"==typeof c?l+=o$1(c,t?t.replace(/([^,])+/g,e=>n.replace(/(^:.*)|([^,])+/g,t=>/&/.test(t)?t.replace(/&/g,e):e?e+" "+t:t)):n):null!=c&&(n=/^--/.test(n)?n:n.replace(/[A-Z]/g,"-$&").toLowerCase(),a+=o$1.p?o$1.p(n,c):n+":"+c+";");}return r+(t&&a?t+"{"+a+"}":a)+l},c={},s=e=>{if("object"==typeof e){let t="";for(let r in e)t+=r+s(e[r]);return t}return e},i$1=(e,t,r,i,p)=>{let u=s(e),d=c[u]||(c[u]=(e=>{let t=0,r=11;for(;t<e.length;)r=101*r+e.charCodeAt(t++)>>>0;return "go"+r})(u));if(!c[d]){let t=u!==e?e:(e=>{let t,r,o=[{}];for(;t=l.exec(e.replace(a,""));)t[4]?o.shift():t[3]?(r=t[3].replace(n$1," ").trim(),o.unshift(o[0][r]=o[0][r]||{})):o[0][t[1]]=t[2].replace(n$1," ").trim();return o[0]})(e);c[d]=o$1(p?{["@keyframes "+d]:t}:t,r?"":"."+d);}let f=r&&c.g?c.g:null;return r&&(c.g=c[d]),((e,t,r,l)=>{l?t.data=t.data.replace(l,e):-1===t.data.indexOf(e)&&(t.data=r?e+t.data:t.data+e);})(c[d],t,i,f),d},p=(e,t,r)=>e.reduce((e,l,a)=>{let n=t[a];if(n&&n.call){let e=n(r),t=e&&e.props&&e.props.className||/^go/.test(e)&&e;n=t?"."+t:e&&"object"==typeof e?e.props?"":o$1(e,""):!1===e?"":e;}return e+l+(null==n?"":n)},"");function u(e){let r=this||{},l=e.call?e(r.p):e;return i$1(l.unshift?l.raw?p(l,[].slice.call(arguments,1),r.p):l.reduce((e,t)=>Object.assign(e,t&&t.call?t(r.p):t),{}):l,t$1(r.target),r.g,r.o,r.k)}u.bind({g:1});u.bind({k:1});
1036
+ let e={data:""},t=t=>"object"==typeof window?((t?t.querySelector("#_goober"):window._goober)||Object.assign((t||document.head).appendChild(document.createElement("style")),{innerHTML:" ",id:"_goober"})).firstChild:t||e,l=/(?:([\u0080-\uFFFF\w-%@]+) *:? *([^{;]+?);|([^;}{]*?) *{)|(}\s*)/g,a=/\/\*[^]*?\*\/| +/g,n=/\n+/g,o=(e,t)=>{let r="",l="",a="";for(let n in e){let c=e[n];"@"==n[0]?"i"==n[1]?r=n+" "+c+";":l+="f"==n[1]?o(c,n):n+"{"+o(c,"k"==n[1]?"":t)+"}":"object"==typeof c?l+=o(c,t?t.replace(/([^,])+/g,e=>n.replace(/(^:.*)|([^,])+/g,t=>/&/.test(t)?t.replace(/&/g,e):e?e+" "+t:t)):n):null!=c&&(n=/^--/.test(n)?n:n.replace(/[A-Z]/g,"-$&").toLowerCase(),a+=o.p?o.p(n,c):n+":"+c+";");}return r+(t&&a?t+"{"+a+"}":a)+l},c={},s=e=>{if("object"==typeof e){let t="";for(let r in e)t+=r+s(e[r]);return t}return e},i=(e,t,r,i,p)=>{let u=s(e),d=c[u]||(c[u]=(e=>{let t=0,r=11;for(;t<e.length;)r=101*r+e.charCodeAt(t++)>>>0;return "go"+r})(u));if(!c[d]){let t=u!==e?e:(e=>{let t,r,o=[{}];for(;t=l.exec(e.replace(a,""));)t[4]?o.shift():t[3]?(r=t[3].replace(n," ").trim(),o.unshift(o[0][r]=o[0][r]||{})):o[0][t[1]]=t[2].replace(n," ").trim();return o[0]})(e);c[d]=o(p?{["@keyframes "+d]:t}:t,r?"":"."+d);}let f=r&&c.g?c.g:null;return r&&(c.g=c[d]),((e,t,r,l)=>{l?t.data=t.data.replace(l,e):-1===t.data.indexOf(e)&&(t.data=r?e+t.data:t.data+e);})(c[d],t,i,f),d},p=(e,t,r)=>e.reduce((e,l,a)=>{let n=t[a];if(n&&n.call){let e=n(r),t=e&&e.props&&e.props.className||/^go/.test(e)&&e;n=t?"."+t:e&&"object"==typeof e?e.props?"":o(e,""):!1===e?"":e;}return e+l+(null==n?"":n)},"");function u(e){let r=this||{},l=e.call?e(r.p):e;return i(l.unshift?l.raw?p(l,[].slice.call(arguments,1),r.p):l.reduce((e,t)=>Object.assign(e,t&&t.call?t(r.p):t),{}):l,t(r.target),r.g,r.o,r.k)}u.bind({g:1});u.bind({k:1});
1042
1037
 
1043
1038
  const _tmpl$$a = /*#__PURE__*/template(`<div></div>`);
1044
1039
  const style = u`
@@ -1454,91 +1449,6 @@ const fonts = {
1454
1449
  decorative: '"Fira Code", monospaced'
1455
1450
  };
1456
1451
 
1457
- var has = Object.prototype.hasOwnProperty;
1458
-
1459
- function find(iter, tar, key) {
1460
- for (key of iter.keys()) {
1461
- if (dequal(key, tar)) return key;
1462
- }
1463
- }
1464
-
1465
- function dequal(foo, bar) {
1466
- var ctor, len, tmp;
1467
- if (foo === bar) return true;
1468
-
1469
- if (foo && bar && (ctor=foo.constructor) === bar.constructor) {
1470
- if (ctor === Date) return foo.getTime() === bar.getTime();
1471
- if (ctor === RegExp) return foo.toString() === bar.toString();
1472
-
1473
- if (ctor === Array) {
1474
- if ((len=foo.length) === bar.length) {
1475
- while (len-- && dequal(foo[len], bar[len]));
1476
- }
1477
- return len === -1;
1478
- }
1479
-
1480
- if (ctor === Set) {
1481
- if (foo.size !== bar.size) {
1482
- return false;
1483
- }
1484
- for (len of foo) {
1485
- tmp = len;
1486
- if (tmp && typeof tmp === 'object') {
1487
- tmp = find(bar, tmp);
1488
- if (!tmp) return false;
1489
- }
1490
- if (!bar.has(tmp)) return false;
1491
- }
1492
- return true;
1493
- }
1494
-
1495
- if (ctor === Map) {
1496
- if (foo.size !== bar.size) {
1497
- return false;
1498
- }
1499
- for (len of foo) {
1500
- tmp = len[0];
1501
- if (tmp && typeof tmp === 'object') {
1502
- tmp = find(bar, tmp);
1503
- if (!tmp) return false;
1504
- }
1505
- if (!dequal(len[1], bar.get(tmp))) {
1506
- return false;
1507
- }
1508
- }
1509
- return true;
1510
- }
1511
-
1512
- if (ctor === ArrayBuffer) {
1513
- foo = new Uint8Array(foo);
1514
- bar = new Uint8Array(bar);
1515
- } else if (ctor === DataView) {
1516
- if ((len=foo.byteLength) === bar.byteLength) {
1517
- while (len-- && foo.getInt8(len) === bar.getInt8(len));
1518
- }
1519
- return len === -1;
1520
- }
1521
-
1522
- if (ArrayBuffer.isView(foo)) {
1523
- if ((len=foo.byteLength) === bar.byteLength) {
1524
- while (len-- && foo[len] === bar[len]);
1525
- }
1526
- return len === -1;
1527
- }
1528
-
1529
- if (!ctor || typeof foo === 'object') {
1530
- len = 0;
1531
- for (ctor in foo) {
1532
- if (has.call(foo, ctor) && ++len && !has.call(bar, ctor)) return false;
1533
- if (!(ctor in bar) || !dequal(foo[ctor], bar[ctor])) return false;
1534
- }
1535
- return Object.keys(bar).length === len;
1536
- }
1537
- }
1538
-
1539
- return foo !== foo && bar !== bar;
1540
- }
1541
-
1542
1452
  function reconcile(original, newItems, key) {
1543
1453
  if (!original) {
1544
1454
  return newItems;
@@ -1779,21 +1689,6 @@ function getTypeIcon(type, subType) {
1779
1689
  };
1780
1690
  }
1781
1691
 
1782
- let nanoid = (size = 21) =>
1783
- crypto.getRandomValues(new Uint8Array(size)).reduce((id, byte) => {
1784
- byte &= 63;
1785
- if (byte < 36) {
1786
- id += byte.toString(36);
1787
- } else if (byte < 62) {
1788
- id += (byte - 26).toString(36).toUpperCase();
1789
- } else if (byte > 62) {
1790
- id += '-';
1791
- } else {
1792
- id += '_';
1793
- }
1794
- return id
1795
- }, '');
1796
-
1797
1692
  function assertIsNotNullish(value) {
1798
1693
  if (value === null || value === void 0) {
1799
1694
  throw new Error("Value is null or undefined");
@@ -1811,33 +1706,6 @@ function tryExpression(expression, onError) {
1811
1706
  }
1812
1707
  }
1813
1708
 
1814
- function parse(str, loose) {
1815
- if (str instanceof RegExp) return { keys:false, pattern:str };
1816
- var c, o, tmp, ext, keys=[], pattern='', arr = str.split('/');
1817
- arr[0] || arr.shift();
1818
-
1819
- while (tmp = arr.shift()) {
1820
- c = tmp[0];
1821
- if (c === '*') {
1822
- keys.push('wild');
1823
- pattern += '/(.*)';
1824
- } else if (c === ':') {
1825
- o = tmp.indexOf('?', 1);
1826
- ext = tmp.indexOf('.', 1);
1827
- keys.push( tmp.substring(1, !!~o ? o : !!~ext ? ext : tmp.length) );
1828
- pattern += !!~o && !~ext ? '(?:/([^/]+?))?' : '/([^/]+?)';
1829
- if (!!~ext) pattern += (!!~o ? '?' : '') + '\\' + tmp.substring(ext);
1830
- } else {
1831
- pattern += '/' + tmp;
1832
- }
1833
- }
1834
-
1835
- return {
1836
- keys: keys,
1837
- pattern: new RegExp('^' + pattern + (loose ? '(?=$|\/)' : '\/?$'), 'i')
1838
- };
1839
- }
1840
-
1841
1709
  function matchURLPattern(url, pattern) {
1842
1710
  const regex = parse(pattern);
1843
1711
  return exec(url, regex);
@@ -2668,476 +2536,11 @@ function getRequestPayload(request) {
2668
2536
  return JSON.stringify(payload);
2669
2537
  }
2670
2538
 
2671
- function Diff$1() {}
2672
- Diff$1.prototype = {
2673
- diff: function diff(oldString, newString) {
2674
- var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
2675
- var callback = options.callback;
2676
-
2677
- if (typeof options === 'function') {
2678
- callback = options;
2679
- options = {};
2680
- }
2681
-
2682
- this.options = options;
2683
- var self = this;
2684
-
2685
- function done(value) {
2686
- if (callback) {
2687
- setTimeout(function () {
2688
- callback(undefined, value);
2689
- }, 0);
2690
- return true;
2691
- } else {
2692
- return value;
2693
- }
2694
- } // Allow subclasses to massage the input prior to running
2695
-
2696
-
2697
- oldString = this.castInput(oldString);
2698
- newString = this.castInput(newString);
2699
- oldString = this.removeEmpty(this.tokenize(oldString));
2700
- newString = this.removeEmpty(this.tokenize(newString));
2701
- var newLen = newString.length,
2702
- oldLen = oldString.length;
2703
- var editLength = 1;
2704
- var maxEditLength = newLen + oldLen;
2705
-
2706
- if (options.maxEditLength) {
2707
- maxEditLength = Math.min(maxEditLength, options.maxEditLength);
2708
- }
2709
-
2710
- var bestPath = [{
2711
- newPos: -1,
2712
- components: []
2713
- }]; // Seed editLength = 0, i.e. the content starts with the same values
2714
-
2715
- var oldPos = this.extractCommon(bestPath[0], newString, oldString, 0);
2716
-
2717
- if (bestPath[0].newPos + 1 >= newLen && oldPos + 1 >= oldLen) {
2718
- // Identity per the equality and tokenizer
2719
- return done([{
2720
- value: this.join(newString),
2721
- count: newString.length
2722
- }]);
2723
- } // Main worker method. checks all permutations of a given edit length for acceptance.
2724
-
2725
-
2726
- function execEditLength() {
2727
- for (var diagonalPath = -1 * editLength; diagonalPath <= editLength; diagonalPath += 2) {
2728
- var basePath = void 0;
2729
-
2730
- var addPath = bestPath[diagonalPath - 1],
2731
- removePath = bestPath[diagonalPath + 1],
2732
- _oldPos = (removePath ? removePath.newPos : 0) - diagonalPath;
2733
-
2734
- if (addPath) {
2735
- // No one else is going to attempt to use this value, clear it
2736
- bestPath[diagonalPath - 1] = undefined;
2737
- }
2738
-
2739
- var canAdd = addPath && addPath.newPos + 1 < newLen,
2740
- canRemove = removePath && 0 <= _oldPos && _oldPos < oldLen;
2741
-
2742
- if (!canAdd && !canRemove) {
2743
- // If this path is a terminal then prune
2744
- bestPath[diagonalPath] = undefined;
2745
- continue;
2746
- } // Select the diagonal that we want to branch from. We select the prior
2747
- // path whose position in the new string is the farthest from the origin
2748
- // and does not pass the bounds of the diff graph
2749
-
2750
-
2751
- if (!canAdd || canRemove && addPath.newPos < removePath.newPos) {
2752
- basePath = clonePath(removePath);
2753
- self.pushComponent(basePath.components, undefined, true);
2754
- } else {
2755
- basePath = addPath; // No need to clone, we've pulled it from the list
2756
-
2757
- basePath.newPos++;
2758
- self.pushComponent(basePath.components, true, undefined);
2759
- }
2760
-
2761
- _oldPos = self.extractCommon(basePath, newString, oldString, diagonalPath); // If we have hit the end of both strings, then we are done
2762
-
2763
- if (basePath.newPos + 1 >= newLen && _oldPos + 1 >= oldLen) {
2764
- return done(buildValues(self, basePath.components, newString, oldString, self.useLongestToken));
2765
- } else {
2766
- // Otherwise track this path as a potential candidate and continue.
2767
- bestPath[diagonalPath] = basePath;
2768
- }
2769
- }
2770
-
2771
- editLength++;
2772
- } // Performs the length of edit iteration. Is a bit fugly as this has to support the
2773
- // sync and async mode which is never fun. Loops over execEditLength until a value
2774
- // is produced, or until the edit length exceeds options.maxEditLength (if given),
2775
- // in which case it will return undefined.
2776
-
2777
-
2778
- if (callback) {
2779
- (function exec() {
2780
- setTimeout(function () {
2781
- if (editLength > maxEditLength) {
2782
- return callback();
2783
- }
2784
-
2785
- if (!execEditLength()) {
2786
- exec();
2787
- }
2788
- }, 0);
2789
- })();
2790
- } else {
2791
- while (editLength <= maxEditLength) {
2792
- var ret = execEditLength();
2793
-
2794
- if (ret) {
2795
- return ret;
2796
- }
2797
- }
2798
- }
2799
- },
2800
- pushComponent: function pushComponent(components, added, removed) {
2801
- var last = components[components.length - 1];
2802
-
2803
- if (last && last.added === added && last.removed === removed) {
2804
- // We need to clone here as the component clone operation is just
2805
- // as shallow array clone
2806
- components[components.length - 1] = {
2807
- count: last.count + 1,
2808
- added: added,
2809
- removed: removed
2810
- };
2811
- } else {
2812
- components.push({
2813
- count: 1,
2814
- added: added,
2815
- removed: removed
2816
- });
2817
- }
2818
- },
2819
- extractCommon: function extractCommon(basePath, newString, oldString, diagonalPath) {
2820
- var newLen = newString.length,
2821
- oldLen = oldString.length,
2822
- newPos = basePath.newPos,
2823
- oldPos = newPos - diagonalPath,
2824
- commonCount = 0;
2825
-
2826
- while (newPos + 1 < newLen && oldPos + 1 < oldLen && this.equals(newString[newPos + 1], oldString[oldPos + 1])) {
2827
- newPos++;
2828
- oldPos++;
2829
- commonCount++;
2830
- }
2831
-
2832
- if (commonCount) {
2833
- basePath.components.push({
2834
- count: commonCount
2835
- });
2836
- }
2837
-
2838
- basePath.newPos = newPos;
2839
- return oldPos;
2840
- },
2841
- equals: function equals(left, right) {
2842
- if (this.options.comparator) {
2843
- return this.options.comparator(left, right);
2844
- } else {
2845
- return left === right || this.options.ignoreCase && left.toLowerCase() === right.toLowerCase();
2846
- }
2847
- },
2848
- removeEmpty: function removeEmpty(array) {
2849
- var ret = [];
2850
-
2851
- for (var i = 0; i < array.length; i++) {
2852
- if (array[i]) {
2853
- ret.push(array[i]);
2854
- }
2855
- }
2856
-
2857
- return ret;
2858
- },
2859
- castInput: function castInput(value) {
2860
- return value;
2861
- },
2862
- tokenize: function tokenize(value) {
2863
- return value.split('');
2864
- },
2865
- join: function join(chars) {
2866
- return chars.join('');
2867
- }
2868
- };
2869
-
2870
- function buildValues(diff, components, newString, oldString, useLongestToken) {
2871
- var componentPos = 0,
2872
- componentLen = components.length,
2873
- newPos = 0,
2874
- oldPos = 0;
2875
-
2876
- for (; componentPos < componentLen; componentPos++) {
2877
- var component = components[componentPos];
2878
-
2879
- if (!component.removed) {
2880
- if (!component.added && useLongestToken) {
2881
- var value = newString.slice(newPos, newPos + component.count);
2882
- value = value.map(function (value, i) {
2883
- var oldValue = oldString[oldPos + i];
2884
- return oldValue.length > value.length ? oldValue : value;
2885
- });
2886
- component.value = diff.join(value);
2887
- } else {
2888
- component.value = diff.join(newString.slice(newPos, newPos + component.count));
2889
- }
2890
-
2891
- newPos += component.count; // Common case
2892
-
2893
- if (!component.added) {
2894
- oldPos += component.count;
2895
- }
2896
- } else {
2897
- component.value = diff.join(oldString.slice(oldPos, oldPos + component.count));
2898
- oldPos += component.count; // Reverse add and remove so removes are output first to match common convention
2899
- // The diffing algorithm is tied to add then remove output and this is the simplest
2900
- // route to get the desired output with minimal overhead.
2901
-
2902
- if (componentPos && components[componentPos - 1].added) {
2903
- var tmp = components[componentPos - 1];
2904
- components[componentPos - 1] = components[componentPos];
2905
- components[componentPos] = tmp;
2906
- }
2907
- }
2908
- } // Special case handle for when one terminal is ignored (i.e. whitespace).
2909
- // For this case we merge the terminal into the prior string and drop the change.
2910
- // This is only available for string mode.
2911
-
2912
-
2913
- var lastComponent = components[componentLen - 1];
2914
-
2915
- if (componentLen > 1 && typeof lastComponent.value === 'string' && (lastComponent.added || lastComponent.removed) && diff.equals('', lastComponent.value)) {
2916
- components[componentLen - 2].value += lastComponent.value;
2917
- components.pop();
2918
- }
2919
-
2920
- return components;
2921
- }
2922
-
2923
- function clonePath(path) {
2924
- return {
2925
- newPos: path.newPos,
2926
- components: path.components.slice(0)
2927
- };
2928
- }
2929
-
2930
- //
2931
- // Ranges and exceptions:
2932
- // Latin-1 Supplement, 0080–00FF
2933
- // - U+00D7 × Multiplication sign
2934
- // - U+00F7 ÷ Division sign
2935
- // Latin Extended-A, 0100–017F
2936
- // Latin Extended-B, 0180–024F
2937
- // IPA Extensions, 0250–02AF
2938
- // Spacing Modifier Letters, 02B0–02FF
2939
- // - U+02C7 ˇ &#711; Caron
2940
- // - U+02D8 ˘ &#728; Breve
2941
- // - U+02D9 ˙ &#729; Dot Above
2942
- // - U+02DA ˚ &#730; Ring Above
2943
- // - U+02DB ˛ &#731; Ogonek
2944
- // - U+02DC ˜ &#732; Small Tilde
2945
- // - U+02DD ˝ &#733; Double Acute Accent
2946
- // Latin Extended Additional, 1E00–1EFF
2947
-
2948
- var extendedWordChars = /^[A-Za-z\xC0-\u02C6\u02C8-\u02D7\u02DE-\u02FF\u1E00-\u1EFF]+$/;
2949
- var reWhitespace = /\S/;
2950
- var wordDiff = new Diff$1();
2951
-
2952
- wordDiff.equals = function (left, right) {
2953
- if (this.options.ignoreCase) {
2954
- left = left.toLowerCase();
2955
- right = right.toLowerCase();
2956
- }
2957
-
2958
- return left === right || this.options.ignoreWhitespace && !reWhitespace.test(left) && !reWhitespace.test(right);
2959
- };
2960
-
2961
- wordDiff.tokenize = function (value) {
2962
- // All whitespace symbols except newline group into one token, each newline - in separate token
2963
- var tokens = value.split(/([^\S\r\n]+|[()[\]{}'"\r\n]|\b)/); // Join the boundary splits that we do not consider to be boundaries. This is primarily the extended Latin character set.
2964
-
2965
- for (var i = 0; i < tokens.length - 1; i++) {
2966
- // If we have an empty string in the next field and we have only word chars before and after, merge
2967
- if (!tokens[i + 1] && tokens[i + 2] && extendedWordChars.test(tokens[i]) && extendedWordChars.test(tokens[i + 2])) {
2968
- tokens[i] += tokens[i + 2];
2969
- tokens.splice(i + 1, 2);
2970
- i--;
2971
- }
2972
- }
2973
-
2974
- return tokens;
2975
- };
2976
-
2977
- var lineDiff = new Diff$1();
2978
-
2979
- lineDiff.tokenize = function (value) {
2980
- var retLines = [],
2981
- linesAndNewlines = value.split(/(\n|\r\n)/); // Ignore the final empty token that occurs if the string ends with a new line
2982
-
2983
- if (!linesAndNewlines[linesAndNewlines.length - 1]) {
2984
- linesAndNewlines.pop();
2985
- } // Merge the content and line separators into single tokens
2986
-
2987
-
2988
- for (var i = 0; i < linesAndNewlines.length; i++) {
2989
- var line = linesAndNewlines[i];
2990
-
2991
- if (i % 2 && !this.options.newlineIsToken) {
2992
- retLines[retLines.length - 1] += line;
2993
- } else {
2994
- if (this.options.ignoreWhitespace) {
2995
- line = line.trim();
2996
- }
2997
-
2998
- retLines.push(line);
2999
- }
3000
- }
3001
-
3002
- return retLines;
3003
- };
3004
-
3005
- var sentenceDiff = new Diff$1();
3006
-
3007
- sentenceDiff.tokenize = function (value) {
3008
- return value.split(/(\S.+?[.!?])(?=\s+|$)/);
3009
- };
3010
-
3011
- var cssDiff = new Diff$1();
3012
-
3013
- cssDiff.tokenize = function (value) {
3014
- return value.split(/([{}:;,]|\s+)/);
3015
- };
3016
-
3017
- function _typeof(obj) {
3018
- "@babel/helpers - typeof";
3019
-
3020
- if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
3021
- _typeof = function (obj) {
3022
- return typeof obj;
3023
- };
3024
- } else {
3025
- _typeof = function (obj) {
3026
- return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
3027
- };
3028
- }
3029
-
3030
- return _typeof(obj);
3031
- }
3032
-
3033
- var objectPrototypeToString = Object.prototype.toString;
3034
- var jsonDiff = new Diff$1(); // Discriminate between two lines of pretty-printed, serialized JSON where one of them has a
3035
- // dangling comma and the other doesn't. Turns out including the dangling comma yields the nicest output:
3036
-
3037
- jsonDiff.useLongestToken = true;
3038
- jsonDiff.tokenize = lineDiff.tokenize;
3039
-
3040
- jsonDiff.castInput = function (value) {
3041
- var _this$options = this.options,
3042
- undefinedReplacement = _this$options.undefinedReplacement,
3043
- _this$options$stringi = _this$options.stringifyReplacer,
3044
- stringifyReplacer = _this$options$stringi === void 0 ? function (k, v) {
3045
- return typeof v === 'undefined' ? undefinedReplacement : v;
3046
- } : _this$options$stringi;
3047
- return typeof value === 'string' ? value : JSON.stringify(canonicalize(value, null, null, stringifyReplacer), stringifyReplacer, ' ');
3048
- };
3049
-
3050
- jsonDiff.equals = function (left, right) {
3051
- return Diff$1.prototype.equals.call(jsonDiff, left.replace(/,([\r\n])/g, '$1'), right.replace(/,([\r\n])/g, '$1'));
3052
- };
3053
-
3054
- function diffJson(oldObj, newObj, options) {
3055
- return jsonDiff.diff(oldObj, newObj, options);
3056
- } // This function handles the presence of circular references by bailing out when encountering an
3057
- // object that is already on the "stack" of items being processed. Accepts an optional replacer
3058
-
3059
- function canonicalize(obj, stack, replacementStack, replacer, key) {
3060
- stack = stack || [];
3061
- replacementStack = replacementStack || [];
3062
-
3063
- if (replacer) {
3064
- obj = replacer(key, obj);
3065
- }
3066
-
3067
- var i;
3068
-
3069
- for (i = 0; i < stack.length; i += 1) {
3070
- if (stack[i] === obj) {
3071
- return replacementStack[i];
3072
- }
3073
- }
3074
-
3075
- var canonicalizedObj;
3076
-
3077
- if ('[object Array]' === objectPrototypeToString.call(obj)) {
3078
- stack.push(obj);
3079
- canonicalizedObj = new Array(obj.length);
3080
- replacementStack.push(canonicalizedObj);
3081
-
3082
- for (i = 0; i < obj.length; i += 1) {
3083
- canonicalizedObj[i] = canonicalize(obj[i], stack, replacementStack, replacer, key);
3084
- }
3085
-
3086
- stack.pop();
3087
- replacementStack.pop();
3088
- return canonicalizedObj;
3089
- }
3090
-
3091
- if (obj && obj.toJSON) {
3092
- obj = obj.toJSON();
3093
- }
3094
-
3095
- if (_typeof(obj) === 'object' && obj !== null) {
3096
- stack.push(obj);
3097
- canonicalizedObj = {};
3098
- replacementStack.push(canonicalizedObj);
3099
-
3100
- var sortedKeys = [],
3101
- _key;
3102
-
3103
- for (_key in obj) {
3104
- /* istanbul ignore else */
3105
- if (obj.hasOwnProperty(_key)) {
3106
- sortedKeys.push(_key);
3107
- }
3108
- }
3109
-
3110
- sortedKeys.sort();
3111
-
3112
- for (i = 0; i < sortedKeys.length; i += 1) {
3113
- _key = sortedKeys[i];
3114
- canonicalizedObj[_key] = canonicalize(obj[_key], stack, replacementStack, replacer, _key);
3115
- }
3116
-
3117
- stack.pop();
3118
- replacementStack.pop();
3119
- } else {
3120
- canonicalizedObj = obj;
3121
- }
3122
-
3123
- return canonicalizedObj;
3124
- }
3125
-
3126
- var arrayDiff = new Diff$1();
3127
-
3128
- arrayDiff.tokenize = function (value) {
3129
- return value.slice();
3130
- };
3131
-
3132
- arrayDiff.join = arrayDiff.removeEmpty = function (value) {
3133
- return value;
3134
- };
3135
-
3136
2539
  function getDiff(from, to) {
3137
2540
  if (dequal(from, to)) {
3138
2541
  return "no changes";
3139
2542
  }
3140
- const diffs = diffJson(
2543
+ const diffs = diff.diffJson(
3141
2544
  typeof from === "object" && from !== null ? from : String(from),
3142
2545
  typeof to === "object" && to !== null ? to : String(to)
3143
2546
  );
@@ -4083,13 +3486,11 @@ function unmountApp() {
4083
3486
  unmount();
4084
3487
  }
4085
3488
 
4086
- var t=["Shift","Meta","Alt","Control"],e="object"==typeof navigator&&/Mac|iPod|iPhone|iPad/.test(navigator.platform)?"Meta":"Control";function n(t,e){return "function"==typeof t.getModifierState&&t.getModifierState(e)}function r(t){return t.trim().split(" ").map(function(t){var n=t.split(/\b\+/),r=n.pop();return [n=n.map(function(t){return "$mod"===t?e:t}),r]})}function o(e,o){var i;void 0===o&&(o={});var u=null!=(i=o.timeout)?i:1e3,a=Object.keys(e).map(function(t){return [r(t),e[t]]}),f=new Map,c=null;return function(e){e instanceof KeyboardEvent&&(a.forEach(function(r){var o=r[0],i=r[1],u=f.get(o)||o;!function(e,r){return !(r[1].toUpperCase()!==e.key.toUpperCase()&&r[1]!==e.code||r[0].find(function(t){return !n(e,t)})||t.find(function(t){return !r[0].includes(t)&&r[1]!==t&&n(e,t)}))}(e,u[0])?n(e,e.key)||f.delete(o):u.length>1?f.set(o,u.slice(1)):(f.delete(o),i(e));}),c&&clearTimeout(c),c=setTimeout(f.clear.bind(f),u));}}function i(t,e,n){var r;void 0===n&&(n={});var i=null!=(r=n.event)?r:"keydown",u=o(e,n);return t.addEventListener(i,u),function(){t.removeEventListener(i,u);}}
4087
-
4088
3489
  function initializeDevTools({
4089
3490
  callsProcessor,
4090
3491
  shortcut
4091
3492
  }) {
4092
- i(window, {
3493
+ tinykeys(window, {
4093
3494
  [shortcut]: (e) => {
4094
3495
  e.preventDefault();
4095
3496
  const active = document.activeElement;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "app-devtools",
3
- "version": "0.11.0",
3
+ "version": "0.12.0",
4
4
  "description": "",
5
5
  "packageManager": "pnpm@6.29.1",
6
6
  "license": "MIT",