Skip to content
This repository has been archived by the owner on Jan 13, 2020. It is now read-only.

Commit

Permalink
Initial commit.
Browse files Browse the repository at this point in the history
  • Loading branch information
brettstimmerman committed Apr 29, 2011
0 parents commit 16a23ba
Show file tree
Hide file tree
Showing 20 changed files with 1,714 additions and 0 deletions.
7 changes: 7 additions & 0 deletions HISTORY.md
@@ -0,0 +1,7 @@
Inspector History
=================

0.1.0 (2011-04-29)
------------------

* Initial release.
25 changes: 25 additions & 0 deletions LICENSE
@@ -0,0 +1,25 @@
Copyright (c) 2011 Brett Stimmerman (brettstimmerman@gmail.com).
All rights reserved.

Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:

* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this
list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.
* Neither the name of this project nor the names of its contributors may be used
to endorse or promote products derived from this software without specific
prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
129 changes: 129 additions & 0 deletions README.md
@@ -0,0 +1,129 @@
Inspector
=========

<img
src="https://github.com/brettstimmerman/Inspector/raw/master/screenshot.png"
style="float: right; margin: -3.6em 0 0 1em" alt="Screenshot" />

Inspector is a real-time attribute inspector widget for YUI 3.

Hook Inspector up to any class that implements the Attribute interface, such as
Base- and Widget-derived classes, and watch its attribute values change as the
application runs.

Toggle Inspector's Pause checkbox to freeze attribute values (they still might
change behind the scenes, just not in Inspector).

Use Inspector's attribute filter to narrow the attribute list.

Collapse Inspector to get it out of your way, or drag it by the header to a new
location.

<br clear="all"/>

Usage
-----

Add the `yui3-skin-sam` class to your `body`, then:

YUI().use('base', 'gallery-inspector', function (Y) {
// 1. Define an object with attributes. Base is a good place to start.
var Test = Y.Base.create('test', Y.Base, [], {}, {
ATTRS: {
foo: {
value: 'bar'
},
baz: {
value: true
}
}
}),
// 2. Instantiate the object
test = new Test(),
// 3. Hook it up to an Inspector
inspector = new Y.Inspector({
host: test
}).render();
// 4. Then watch it in real-time as attributes change
Y.later(2500, test, function () {
this.setAttrs({
foo: 'not bar',
baz: false
});
});
});

Or, using the plugin:

YUI().use('gallery-inspector-plugin', function (Y) {
// Instantiate a Base- or Widget-based object ...
obj.plug(Y.Plugin.Inspector);
});

Configuration
-------------

* __exclude__: Array of attribute names to exclude from view.
* __include__: Array of attribute names to include. Opposite of, and overrides
_exclude_.

These are the most interesting. Have a look at the source for more.

Supported Browsers
------------------

* Firefox 3.6+
* Chrome
* Internet Explorer 9+
* Safari 5+

Other browsers may work, but haven't been tested.

Known Issues
------------

* Inspecting arrays, functions and most non-native objects is not supported
(yet).

Links
-----

* https://github.com/brettstimmerman/inspector
* https://github.com/yui/yui3-gallery/tree/master/src/gallery-inspector
* http://yuilibrary.com/gallery/show/inspector

License
-------

Copyright (c) 2011 Brett Stimmerman (brettstimmerman@gmail.com).
All rights reserved.

Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:

* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this
list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.
* Neither the name of this project nor the names of its contributors may be used
to endorse or promote products derived from this software without specific
prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
64 changes: 64 additions & 0 deletions assets/gallery-inspector-core.css
@@ -0,0 +1,64 @@
.yui3-skin-sam .yui3-inspector {
position: absolute;
right: 0;
top: 0;
}

.yui3-skin-sam .yui3-inspector-hidden { display: none; }

.yui3-skin-sam .yui3-inspector-hd {
padding: 6px 10px;
position: relative;
text-align: right;
}

.yui3-skin-sam .yui3-inspector-title {
margin: 0;
float: left;
line-height: 1.7;
}

.yui3-skin-sam .yui3-inspector-bd {
position: relative;
overflow: auto;
overflow-x: auto;
overflow-y: scroll;
}

.yui3-skin-sam .yui3-inspector-ft {
font-size: 12px;
padding: 4px 6px 3px;
position: relative;
}

.yui3-skin-sam .yui3-inspector-filter {
float: right;
height: 1.1em;
margin: -1px 5px 0 0;
width: 50%;
}

.yui3-skin-sam .yui3-inspector table {
width: 100%;
border-collapse: collapse;
table-layout: fixed;
padding: 0;
}

.yui3-skin-sam .yui3-inspector-value-cell {
font: normal 12px/1.3 Monaco, Consolas, monospace;
}

.yui3-skin-sam .yui3-inspector th,
.yui3-skin-sam .yui3-inspector td {
padding: 4px 6px;
word-wrap: break-word;
text-align: left;
vertical-align: top;
}

.yui3-skin-sam .yui3-dd-draggable .yui3-inspector-hd { cursor: move; }
.yui3-skin-sam .yui3-dd-locked .yui3-inspector-hd { cursor: default; }

.yui3-skin-sam .yui3-inspector-collapsed .yui3-inspector-bd,
.yui3-skin-sam .yui3-inspector-collapsed .yui3-inspector-ft { display: none; }
85 changes: 85 additions & 0 deletions assets/skins/sam/gallery-inspector-skin.css
@@ -0,0 +1,85 @@
.yui3-skin-sam .yui3-inspectorplugin-content,
.yui3-skin-sam .yui3-inspector-content {
-moz-border-radius: 7px;
-webkit-border-radius: 7px;
-moz-box-shadow: 0 0 3px #888;
-webkit-box-shadow: 0 0 3px #888;
background: #ddd;
border: 1px solid #888;
border-radius: 7px;
box-shadow: 0 0 3px #888;
font: normal 13px/1.3 Arial, sans-serif;
}

.yui3-skin-sam .yui3-inspector-hd {
-moz-border-radius-topright: 7px;
-moz-border-radius-topleft: 7px;
-webkit-border-top-right-radius: 7px;
-webkit-border-top-left-radius: 7px;
border-bottom: 1px solid #888;
border-top-right-radius: 7px;
border-top-left-radius: 7px;
}

.yui3-skin-sam .yui3-inspector-destroyed {
color: #800;
text-decoration: line-through;
}

.yui3-skin-sam .yui3-inspector-bd { background: #f3f3f3; }

.yui3-skin-sam .yui3-inspector-ft { border-top: 1px solid #888; }

.yui3-skin-sam .yui3-inspector-hd,
.yui3-skin-sam .yui3-inspector-ft {
background: #e3e3e3;
background: -moz-linear-gradient(top, #fff, #bbb);
background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#fff), to(#bbb));
}

.yui3-skin-sam .yui3-inspector-collapsed .yui3-inspector-hd,
.yui3-skin-sam .yui3-inspector-ft {
-moz-border-radius-bottomright: 7px;
-moz-border-radius-bottomleft: 7px;
-webkit-border-bottom-right-radius: 7px;
-webkit-border-bottom-left-radius: 7px;
border-bottom-right-radius: 7px;
border-bottom-left-radius: 7px;
}

.yui3-skin-sam .yui3-inspector table { border-bottom: 1px solid #ccc; }

.yui3-skin-sam .yui3-inspector th { border-right: 1px solid #ccc; }

.yui3-skin-sam .yui3-inspector thead th {
background: #e6e6e6;
background: -moz-linear-gradient(top, #fff, #ccc);
background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#fff), to(#ccc));
border-bottom: 1px solid #bbb;
}

.yui3-skin-sam .yui3-inspector thead th:first-child {
border-right: 1px solid #bbb;
}

.yui3-skin-sam .yui3-inspector-even { background: #efeff6 }
.yui3-skin-sam .yui3-inspector-odd { background: #fff }

.yui3-skin-sam .yui3-inspector-type-array,
.yui3-skin-sam .yui3-inspector-type-object { color: #333; }

.yui3-skin-sam .yui3-inspector-type-error { color: #f00; }

.yui3-skin-sam .yui3-inspector-type-boolean,
.yui3-skin-sam .yui3-inspector-type-number { color: #008; }

.yui3-skin-sam .yui3-inspector-type-regexp,
.yui3-skin-sam .yui3-inspector-type-string { color: #800; }

.yui3-skin-sam .yui3-inspector-type-node { color: #060; }

.yui3-skin-sam .yui3-inspector-type-null,
.yui3-skin-sam .yui3-inspector-type-undefined {
color: #555;
font-style: italic;
}
26 changes: 26 additions & 0 deletions build.xml
@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<project name="YUI" default="local">
<description>Inspector - Build All</description>

<macrodef name="build-inspector">
<attribute name="target"/>
<sequential>
<subant target="@{target}">
<fileset dir="." includes="inspector*.xml"/>
</subant>
</sequential>
</macrodef>

<target name="local">
<build-inspector target="local"/>
</target>
<target name="deploy">
<build-inspector target="deploy"/>
</target>
<target name="all">
<build-inspector target="all"/>
</target>
<target name="clean">
<build-inspector target="clean"/>
</target>
</project>
32 changes: 32 additions & 0 deletions docs.sh
@@ -0,0 +1,32 @@
#!/bin/sh
# The location of your yuidoc install
yuidoc_home=../../../yuidoc

# The location of the files to parse. Parses subdirectories, but will fail if
# there are duplicate file names in these directories. You can specify multiple
# source trees:
# parser_in="%HOME/www/yui/src %HOME/www/event/src"
parser_in=js

# The location to output the parser data. This output is a file containing a
# json string, and copies of the parsed files.
parser_out=build_api_parser

# The directory to put the html file outputted by the generator
generator_out=build_api

# The location of the template files. Any subdirectories here will be copied
# verbatim to the destination directory.
template=$yuidoc_home/template

# The version of your project to display within the documentation.
version=0.1.0

# The version of YUI the project is using. This effects the output for
# YUI configuration attributes. This should start with '2' or '3'.
yuiversion=3

##############################################################################
# add -s to the end of the line to show items marked private

$yuidoc_home/bin/yuidoc.py $parser_in -p $parser_out -o $generator_out -t $template -v $version -Y $yuiversion

0 comments on commit 16a23ba

Please sign in to comment.