Skip to content

Commit

Permalink
Fixes and Release
Browse files Browse the repository at this point in the history
* fixed for string data
* watchable data attribute
* logger right in the box
* ready for bower
  • Loading branch information
Pankaj Patel committed Aug 5, 2017
1 parent 80e11a4 commit 663edf5
Show file tree
Hide file tree
Showing 8 changed files with 51 additions and 7 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,4 @@ typings/
# dotenv environment variables file
.env

dist/
.DS_Store
33 changes: 33 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
<script src="bower_components/inspector-components/dist/inspector-component.js"></script>

<inspector-component data='["56dcf573b09c217d39fd7621", "Hello World"]'></inspector-component>
<inspector-component data='{"_id":"56dcf573b09c217d39fd7621", "name":"Hello World"}'></inspector-component>
```

## 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)
13 changes: 10 additions & 3 deletions bower.json
Original file line number Diff line number Diff line change
@@ -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",
Expand All @@ -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 <[email protected]> (http://pankaj.pro)"
]
}
1 change: 1 addition & 0 deletions dist/inspector-component.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
<script src="./dist/inspector-component.js"></script>
</head>
<body>
<inspector-component data="Hello World"></inspector-component>
<inspector-component data='["56dcf573b09c217d39fd7621", "Hello World"]'></inspector-component>
<inspector-component data='{"_id":"56dcf573b09c217d39fd7621", "name":"Hello World"}'></inspector-component>
<inspector-component data='{"_id":"56dcf573b09c217d39fd7621","name":"Howard Christensen","email":"[email protected]","phone":"+1 (830) 529-3176","address":"511 Royce Street, Hilltop, Tennessee, 9712","friends":[{"_id":"56dcf573b09c217d39fd7621","name":"Howard Christensen","email":"[email protected]","phone":"+1 (830) 529-3176","address":"511 Royce Street, Hilltop, Tennessee, 9712"}]}'></inspector-component>
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
4 changes: 3 additions & 1 deletion src/object-inspector/ObjectPreview.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -59,6 +59,8 @@ class ObjectPreview extends HTMLElement {
}]
</span>
`);
} else if (typeof object === 'string') {
return `<object-value data='${object}' ></object-value>`;
} else {
let propertyNodes = [];
for (let propertyName in object) {
Expand Down
2 changes: 1 addition & 1 deletion src/tree-view/TreeNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ class TreeNode extends HTMLElement {
<div style='${toCss(styles.treeNodePreviewContainer)}' path='${this.path}' class="clickableNode">
${this.expandable
? `<tree-arrow expanded='${this.expanded}' styles='${JSON.stringify(styles.treeNodeArrow)}'></tree-arrow>`
: (this.shouldShowPlaceholder) && `<span style='${toCss(styles.treeNodePlaceholder)}'>&nbsp;</span>`}
: this.shouldShowPlaceholder ? `<span style='${toCss(styles.treeNodePlaceholder)}'>&nbsp;</span>` : ''}
${renderedNode}
</div>
<div class='child-nodes'>
Expand Down

0 comments on commit 663edf5

Please sign in to comment.