xtal-props

WebJar for xtal-props

License

License

MIT
GroupId

GroupId

org.webjars.bowergithub.bahrus
ArtifactId

ArtifactId

xtal-props
Last Version

Last Version

0.0.11
Release Date

Release Date

Type

Type

jar
Description

Description

xtal-props
WebJar for xtal-props
Project URL

Project URL

http://webjars.org
Source Code Management

Source Code Management

https://github.com/bahrus/xtal-props

Download xtal-props

How to add to project

<!-- https://jarcasting.com/artifacts/org.webjars.bowergithub.bahrus/xtal-props/ -->
<dependency>
    <groupId>org.webjars.bowergithub.bahrus</groupId>
    <artifactId>xtal-props</artifactId>
    <version>0.0.11</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.bowergithub.bahrus/xtal-props/
implementation 'org.webjars.bowergithub.bahrus:xtal-props:0.0.11'
// https://jarcasting.com/artifacts/org.webjars.bowergithub.bahrus/xtal-props/
implementation ("org.webjars.bowergithub.bahrus:xtal-props:0.0.11")
'org.webjars.bowergithub.bahrus:xtal-props:jar:0.0.11'
<dependency org="org.webjars.bowergithub.bahrus" name="xtal-props" rev="0.0.11">
  <artifact name="xtal-props" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.bowergithub.bahrus', module='xtal-props', version='0.0.11')
)
libraryDependencies += "org.webjars.bowergithub.bahrus" % "xtal-props" % "0.0.11"
[org.webjars.bowergithub.bahrus/xtal-props "0.0.11"]

Dependencies

compile (8)

Group / Artifact Type Version
org.webjars.bowergithub.vaadin : vaadin-grid jar [3.0.0,4)
org.webjars.bowergithub.polymer : polymer jar [2.0.0,3)
org.webjars.bowergithub.bahrus : if-diff jar [0.0.3,0.0.4)
org.webjars.bowergithub.polymerelements : paper-input jar [2.0.1,3)
org.webjars.bowergithub.bahrus : xtal-sip jar [0.0.12,0.0.13)
org.webjars.bowergithub.bahrus : poly-prep jar [0.0.12,0.0.13)
org.webjars.bowergithub.polymerelements : paper-checkbox jar [2.0.1,3)
org.webjars.bowergithub.polymerelements : paper-dialog jar [2.0.0,3)

Project Modules

There are no modules declared in this project.

Published on webcomponents.org

<xtal-props>

View / Edit a Polymer web component. Debug polymer web components.

<xtal-props> solves a number of use cases:

  • Rapid prototyping via Property Editor. Often we define a nice model for an object, and we want to start testing the model right away, without devoting time to building the UI. Or we want to rapidly build a number of admin screens, and don't want to ever devote much tender loving care to building and maintaining highly customized forms to edit the objects. This component will automatically generate a UI based on the Polymer properties definition.
  • Debugging. Be able to quickly inspect a custom element and see / modify the custom properties associated with it.

Syntax for debugging

To allow opening the property editor on ctrl+click, add the following markup:

<xtal-props debug></xtal-props>

Some additional comments on debugging

Rob Dodson pointed out at the last Polymer summit that reflecting primitive (string, boolean, numeric) properties to attributes (and vice versa), makes debugging much easier (especially for Chrome, where attribute changes flash as they change). I agree.

There is also now a wonderful Polymer Inspector Chrome Extension, and one for Stencil. Hopefully we'll see one soon that works with and and all web components.

Unfortunately, this won't help with the worst case browser scneario: IE11 / Edge.

With these browsers, inspecting an element just produces a white, blank tree.

I recommend trying out $hell.js to help with those browsers, from yours truly. Feedback welcome.

Syntax for auto generating a UI

When defining a Polymer custom element (say "my-component"), just create the static properties, and place the following inside the template:

<dom-module id="my-component">
  <template>
    <xtal-props></xtal-props>
  </template>
</dom-module>

and add the following ready method:

ready() {
  super.ready();
  //this.$.myProps.name = 'my-component';
  const xtalProps = this.shadowRoot.querySelector('xtal-props');
  xtalProps.observe = this;
}

List of features:

  • Auto generate an interface based on the static polymer properties.
    • Readonly support for string, boolean, number properties (Polymer components only).
    • Readonly support nested child object properties.
    • Readonly support for array properties.
    • Edit support for string property.
    • Edit support for boolean property.,
    • Edit support for number property.
    • Edit support nested child object properties.
    • Edit support for array properties.
  • Provide similar support for other custom element libraries.
  • Debug support:
    • Open up an object editor / viewer after ctrl-clicking on a custom element.
    • ctrl-clicking (command-click on a Mac) on a custom element logs the constructor to the console, allowing quick navigation to the function definition.
    • ctrl-clicking on a custom element copies the css path to the clipboard, which allows adding conditional breakpoints.
    • Readonly support for string, boolean, number properties (Polymer components only).
    • Readonly support nested child object properties.
    • Readonly support for array properties.
    • Edit support for string property.
    • Edit support for boolean property.
    • Edit support for number property.
    • Edit support nested child object properties.
    • Edit support for array properties.
    • Support closing debug panel

Install the Polymer-CLI

First, make sure you have the Polymer CLI installed. Then run polymer serve to serve your element locally.

Viewing Your Element

$ polymer serve

Running Tests

$ polymer test

Your application is already set up to be tested via web-component-tester. Run polymer test to run your application's test suite locally.

Versions

Version
0.0.11
0.0.9