diff --git a/.gitignore b/.gitignore index de54c85..ae2cdfa 100644 --- a/.gitignore +++ b/.gitignore @@ -45,5 +45,4 @@ typings/ # dotenv environment variables file .env -dist/ .DS_Store diff --git a/README.md b/README.md index f95ca75..464827b 100644 --- a/README.md +++ b/README.md @@ -2,3 +2,36 @@ Inspecter webcomponent based on react-inspector +## Installation + +_*npm*_: `npm install inspector-component --save-dev` +_*bower*_: `bower install inspector-component --save-dev` + +## Usage + +```html + + + + +``` + +## Contributing + +1. Fork it! +2. Create your feature branch: `git checkout -b my-new-feature` +3. Commit your changes: `git commit -am 'Add some feature'` +4. Push to the branch: `git push origin my-new-feature` +5. Submit a pull request :D + +## History + +0.1.0: Initial Version + +## Credits + +[react-inspector](https://github.com/xyc/react-inspector) + +## License + +[MIT](./LICENSE) diff --git a/bower.json b/bower.json index 248f30a..4a5f009 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "inspecter-component", - "version": "0.0.0", + "version": "0.1.0", "description": "Inspecter webcomponent based on react-inspector", "license": "MIT", "main": "dist/inspecter-component.js", @@ -9,9 +9,16 @@ ], "ignore": [ "**/.*", - "bower_components" + "bower_components", + "node_modules", + "test", + "tests" ], "dependencies": { "custom-elements": "^1.0.3" - } + }, + "homepage": "https://github.com/pankajpatel/inspector-component", + "authors": [ + "Pankaj Patel (http://pankaj.pro)" + ] } diff --git a/dist/inspector-component.js b/dist/inspector-component.js new file mode 100644 index 0000000..439b9e0 --- /dev/null +++ b/dist/inspector-component.js @@ -0,0 +1 @@ +!function(t){function u(n){if(e[n])return e[n].exports;var r=e[n]={i:n,l:!1,exports:{}};return t[n].call(r.exports,r,r.exports,u),r.l=!0,r.exports}var e={};u.m=t,u.c=e,u.i=function(t){return t},u.d=function(t,e,n){u.o(t,e)||Object.defineProperty(t,e,{configurable:!1,enumerable:!0,get:n})},u.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return u.d(e,"a",e),e},u.o=function(t,u){return Object.prototype.hasOwnProperty.call(t,u)},u.p="",u(u.s=326)}([function(t,u,e){var n=e(2),r=e(24),o=e(12),i=e(13),a=e(25),c=function(t,u,e){var s,f,l,E,A=t&c.F,h=t&c.G,p=t&c.S,v=t&c.P,C=t&c.B,d=h?n:p?n[u]||(n[u]={}):(n[u]||{}).prototype,F=h?r:r[u]||(r[u]={}),y=F.prototype||(F.prototype={});h&&(e=u);for(s in e)f=!A&&d&&void 0!==d[s],l=(f?d:e)[s],E=C&&f?a(l,n):v&&"function"==typeof l?a(Function.call,l):l,d&&i(d,s,l,t&c.U),F[s]!=l&&o(F,s,E),v&&y[s]!=l&&(y[s]=l)};n.core=r,c.F=1,c.G=2,c.S=4,c.P=8,c.B=16,c.W=32,c.U=64,c.R=128,t.exports=c},function(t,u,e){var n=e(4);t.exports=function(t){if(!n(t))throw TypeError(t+" is not an object!");return t}},function(t,u){var e=t.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=e)},function(t,u){t.exports=function(t){try{return!!t()}catch(t){return!0}}},function(t,u){t.exports=function(t){return"object"==typeof t?null!==t:"function"==typeof t}},function(t,u,e){var n=e(59)("wks"),r=e(39),o=e(2).Symbol,i="function"==typeof o;(t.exports=function(t){return n[t]||(n[t]=i&&o[t]||(i?o:r)("Symbol."+t))}).store=n},function(t,u,e){t.exports=!e(3)(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a})},function(t,u,e){var n=e(1),r=e(101),o=e(23),i=Object.defineProperty;u.f=e(6)?Object.defineProperty:function(t,u,e){if(n(t),u=o(u,!0),n(e),r)try{return i(t,u,e)}catch(t){}if("get"in e||"set"in e)throw TypeError("Accessors not supported!");return"value"in e&&(t[u]=e.value),t}},function(t,u,e){var n=e(30),r=Math.min;t.exports=function(t){return t>0?r(n(t),9007199254740991):0}},function(t,u,e){var n=e(19);t.exports=function(t){return Object(n(t))}},function(t,u){var e={}.hasOwnProperty;t.exports=function(t,u){return e.call(t,u)}},function(t,u){t.exports=function(t){if("function"!=typeof t)throw TypeError(t+" is not a function!");return t}},function(t,u,e){var n=e(7),r=e(29);t.exports=e(6)?function(t,u,e){return n.f(t,u,r(1,e))}:function(t,u,e){return t[u]=e,t}},function(t,u,e){var n=e(2),r=e(12),o=e(10),i=e(39)("src"),a=Function.toString,c=(""+a).split("toString");e(24).inspectSource=function(t){return a.call(t)},(t.exports=function(t,u,e,a){var s="function"==typeof e;s&&(o(e,"name")||r(e,"name",u)),t[u]!==e&&(s&&(o(e,i)||r(e,i,t[u]?""+t[u]:c.join(String(u)))),t===n?t[u]=e:a?t[u]?t[u]=e:r(t,u,e):(delete t[u],r(t,u,e)))})(Function.prototype,"toString",function(){return"function"==typeof this&&this[i]||a.call(this)})},function(t,u,e){var n=e(0),r=e(3),o=e(19),i=/"/g,a=function(t,u,e,n){var r=String(o(t)),a="<"+u;return""!==e&&(a+=" "+e+'="'+String(n).replace(i,""")+'"'),a+">"+r+""};t.exports=function(t,u){var e={};e[t]=u(a),n(n.P+n.F*r(function(){var u=""[t]('"');return u!==u.toLowerCase()||u.split('"').length>3}),"String",e)}},function(t,u,e){var n=e(47),r=e(19);t.exports=function(t){return n(r(t))}},function(t,u,e){var n=e(48),r=e(29),o=e(15),i=e(23),a=e(10),c=e(101),s=Object.getOwnPropertyDescriptor;u.f=e(6)?s:function(t,u){if(t=o(t),u=i(u,!0),c)try{return s(t,u)}catch(t){}if(a(t,u))return r(!n.f.call(t,u),t[u])}},function(t,u,e){var n=e(10),r=e(9),o=e(79)("IE_PROTO"),i=Object.prototype;t.exports=Object.getPrototypeOf||function(t){return t=r(t),n(t,o)?t[o]:"function"==typeof t.constructor&&t instanceof t.constructor?t.constructor.prototype:t instanceof Object?i:null}},function(t,u){var e={}.toString;t.exports=function(t){return e.call(t).slice(8,-1)}},function(t,u){t.exports=function(t){if(void 0==t)throw TypeError("Can't call method on "+t);return t}},function(t,u,e){var n=e(3);t.exports=function(t,u){return!!t&&n(function(){u?t.call(null,function(){},1):t.call(null)})}},function(t,u,e){var n=e(25),r=e(47),o=e(9),i=e(8),a=e(139);t.exports=function(t,u){var e=1==t,c=2==t,s=3==t,f=4==t,l=6==t,E=5==t||l,A=u||a;return function(u,a,h){for(var p,v,C=o(u),d=r(C),F=n(a,h,3),y=i(d.length),b=0,g=e?A(u,y):c?A(u,0):void 0;y>b;b++)if((E||b in d)&&(p=d[b],v=F(p,b,C),t))if(e)g[b]=v;else if(v)switch(t){case 3:return!0;case 5:return p;case 6:return b;case 2:g.push(p)}else if(f)return!1;return l?-1:s||f?f:g}}},function(t,u,e){var n=e(0),r=e(24),o=e(3);t.exports=function(t,u){var e=(r.Object||{})[t]||Object[t],i={};i[t]=u(e),n(n.S+n.F*o(function(){e(1)}),"Object",i)}},function(t,u,e){var n=e(4);t.exports=function(t,u){if(!n(t))return t;var e,r;if(u&&"function"==typeof(e=t.toString)&&!n(r=e.call(t)))return r;if("function"==typeof(e=t.valueOf)&&!n(r=e.call(t)))return r;if(!u&&"function"==typeof(e=t.toString)&&!n(r=e.call(t)))return r;throw TypeError("Can't convert object to primitive value")}},function(t,u){var e=t.exports={version:"2.4.0"};"number"==typeof __e&&(__e=e)},function(t,u,e){var n=e(11);t.exports=function(t,u,e){if(n(t),void 0===u)return t;switch(e){case 1:return function(e){return t.call(u,e)};case 2:return function(e,n){return t.call(u,e,n)};case 3:return function(e,n,r){return t.call(u,e,n,r)}}return function(){return t.apply(u,arguments)}}},function(t,u,e){var n=e(117),r=e(0),o=e(59)("metadata"),i=o.store||(o.store=new(e(120))),a=function(t,u,e){var r=i.get(t);if(!r){if(!e)return;i.set(t,r=new n)}var o=r.get(u);if(!o){if(!e)return;r.set(u,o=new n)}return o},c=function(t,u,e){var n=a(u,e,!1);return void 0!==n&&n.has(t)},s=function(t,u,e){var n=a(u,e,!1);return void 0===n?void 0:n.get(t)},f=function(t,u,e,n){a(e,n,!0).set(t,u)},l=function(t,u){var e=a(t,u,!1),n=[];return e&&e.forEach(function(t,u){n.push(u)}),n},E=function(t){return void 0===t||"symbol"==typeof t?t:String(t)},A=function(t){r(r.S,"Reflect",t)};t.exports={store:i,map:a,has:c,get:s,set:f,keys:l,key:E,exp:A}},function(t,u,e){"use strict";if(e(6)){var n=e(32),r=e(2),o=e(3),i=e(0),a=e(60),c=e(86),s=e(25),f=e(31),l=e(29),E=e(12),A=e(36),h=e(30),p=e(8),v=e(38),C=e(23),d=e(10),F=e(114),y=e(46),b=e(4),g=e(9),m=e(71),D=e(33),B=e(17),_=e(34).f,O=e(88),w=e(39),x=e(5),T=e(21),S=e(50),L=e(80),M=e(89),j=e(42),N=e(56),R=e(37),P=e(64),k=e(94),I=e(7),H=e(16),U=I.f,V=H.f,G=r.RangeError,W=r.TypeError,J=r.Uint8Array,z=Array.prototype,K=c.ArrayBuffer,Z=c.DataView,Y=T(0),q=T(2),$=T(3),X=T(4),Q=T(5),tt=T(6),ut=S(!0),et=S(!1),nt=M.values,rt=M.keys,ot=M.entries,it=z.lastIndexOf,at=z.reduce,ct=z.reduceRight,st=z.join,ft=z.sort,lt=z.slice,Et=z.toString,At=z.toLocaleString,ht=x("iterator"),pt=x("toStringTag"),vt=w("typed_constructor"),Ct=w("def_constructor"),dt=a.CONSTR,Ft=a.TYPED,yt=a.VIEW,bt=T(1,function(t,u){return Ot(L(t,t[Ct]),u)}),gt=o(function(){return 1===new J(new Uint16Array([1]).buffer)[0]}),mt=!!J&&!!J.prototype.set&&o(function(){new J(1).set({})}),Dt=function(t,u){if(void 0===t)throw W("Wrong length!");var e=+t,n=p(t);if(u&&!F(e,n))throw G("Wrong length!");return n},Bt=function(t,u){var e=h(t);if(e<0||e%u)throw G("Wrong offset!");return e},_t=function(t){if(b(t)&&Ft in t)return t;throw W(t+" is not a typed array!")},Ot=function(t,u){if(!(b(t)&&vt in t))throw W("It is not a typed array constructor!");return new t(u)},wt=function(t,u){return xt(L(t,t[Ct]),u)},xt=function(t,u){for(var e=0,n=u.length,r=Ot(t,n);n>e;)r[e]=u[e++];return r},Tt=function(t,u,e){U(t,u,{get:function(){return this._d[e]}})},St=function(t){var u,e,n,r,o,i,a=g(t),c=arguments.length,f=c>1?arguments[1]:void 0,l=void 0!==f,E=O(a);if(void 0!=E&&!m(E)){for(i=E.call(a),n=[],u=0;!(o=i.next()).done;u++)n.push(o.value);a=n}for(l&&c>2&&(f=s(f,arguments[2],2)),u=0,e=p(a.length),r=Ot(this,e);e>u;u++)r[u]=l?f(a[u],u):a[u];return r},Lt=function(){for(var t=0,u=arguments.length,e=Ot(this,u);u>t;)e[t]=arguments[t++];return e},Mt=!!J&&o(function(){At.call(new J(1))}),jt=function(){return At.apply(Mt?lt.call(_t(this)):_t(this),arguments)},Nt={copyWithin:function(t,u){return k.call(_t(this),t,u,arguments.length>2?arguments[2]:void 0)},every:function(t){return X(_t(this),t,arguments.length>1?arguments[1]:void 0)},fill:function(t){return P.apply(_t(this),arguments)},filter:function(t){return wt(this,q(_t(this),t,arguments.length>1?arguments[1]:void 0))},find:function(t){return Q(_t(this),t,arguments.length>1?arguments[1]:void 0)},findIndex:function(t){return tt(_t(this),t,arguments.length>1?arguments[1]:void 0)},forEach:function(t){Y(_t(this),t,arguments.length>1?arguments[1]:void 0)},indexOf:function(t){return et(_t(this),t,arguments.length>1?arguments[1]:void 0)},includes:function(t){return ut(_t(this),t,arguments.length>1?arguments[1]:void 0)},join:function(t){return st.apply(_t(this),arguments)},lastIndexOf:function(t){return it.apply(_t(this),arguments)},map:function(t){return bt(_t(this),t,arguments.length>1?arguments[1]:void 0)},reduce:function(t){return at.apply(_t(this),arguments)},reduceRight:function(t){return ct.apply(_t(this),arguments)},reverse:function(){for(var t,u=this,e=_t(u).length,n=Math.floor(e/2),r=0;r1?arguments[1]:void 0)},sort:function(t){return ft.call(_t(this),t)},subarray:function(t,u){var e=_t(this),n=e.length,r=v(t,n);return new(L(e,e[Ct]))(e.buffer,e.byteOffset+r*e.BYTES_PER_ELEMENT,p((void 0===u?n:v(u,n))-r))}},Rt=function(t,u){return wt(this,lt.call(_t(this),t,u))},Pt=function(t){_t(this);var u=Bt(arguments[1],1),e=this.length,n=g(t),r=p(n.length),o=0;if(r+u>e)throw G("Wrong length!");for(;o255?255:255&n),r.v[h](e*u+r.o,n,gt)},x=function(t,u){U(t,u,{get:function(){return O(this,u)},set:function(t){return w(this,u,t)},enumerable:!0})};F?(v=e(function(t,e,n,r){f(t,v,s,"_d");var o,i,a,c,l=0,A=0;if(b(e)){if(!(e instanceof K||"ArrayBuffer"==(c=y(e))||"SharedArrayBuffer"==c))return Ft in e?xt(v,e):St.call(v,e);o=e,A=Bt(n,u);var h=e.byteLength;if(void 0===r){if(h%u)throw G("Wrong length!");if((i=h-A)<0)throw G("Wrong length!")}else if((i=p(r)*u)+A>h)throw G("Wrong length!");a=i/u}else a=Dt(e,!0),i=a*u,o=new K(i);for(E(t,"_d",{b:o,o:A,l:i,e:a,v:new Z(o)});l0?n:e)(t)}},function(t,u){t.exports=function(t,u,e,n){if(!(t instanceof u)||void 0!==n&&n in t)throw TypeError(e+": incorrect invocation!");return t}},function(t,u){t.exports=!1},function(t,u,e){var n=e(1),r=e(107),o=e(67),i=e(79)("IE_PROTO"),a=function(){},c=function(){var t,u=e(66)("iframe"),n=o.length;for(u.style.display="none",e(69).appendChild(u),u.src="javascript:",t=u.contentWindow.document,t.open(),t.write(" + diff --git a/package.json b/package.json index 0d8506c..bc4b0e3 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,8 @@ "generate": "babel src -d lib", "watch": "webpack --progress --watch", "build": "webpack --progress --production", - "story": "ascesis-storybook" + "story": "ascesis-storybook", + "postinstall": "npm run generate" }, "dependencies": { "document-register-element": "^1.5.0", diff --git a/src/object-inspector/ObjectPreview.js b/src/object-inspector/ObjectPreview.js index 2a23b83..c2a8654 100644 --- a/src/object-inspector/ObjectPreview.js +++ b/src/object-inspector/ObjectPreview.js @@ -28,7 +28,7 @@ class ObjectPreview extends HTMLElement { } connectedCallback() { - this.maxProperties = this.getAttribute('max-properties') || 5; + this.maxProperties = this.getAttribute('max-properties') || 3; this._data = (this.getAttribute('data') || 'null'); const data = parse(this._data); this.data = data; @@ -59,6 +59,8 @@ class ObjectPreview extends HTMLElement { }] `); + } else if (typeof object === 'string') { + return ``; } else { let propertyNodes = []; for (let propertyName in object) { diff --git a/src/tree-view/TreeNode.js b/src/tree-view/TreeNode.js index b29ebb1..7ed5da5 100644 --- a/src/tree-view/TreeNode.js +++ b/src/tree-view/TreeNode.js @@ -72,7 +72,7 @@ class TreeNode extends HTMLElement {
${this.expandable ? `` - : (this.shouldShowPlaceholder) && ` `} + : this.shouldShowPlaceholder ? ` ` : ''} ${renderedNode}