Git Product home page Git Product logo

paper-material's Introduction

Published on NPM Build status Published on webcomponents.org

<paper-material>

paper-material is a container that renders two shadows on top of each other to create the effect of a lifted piece of paper.

โš ๏ธ As of the 2.0 release, this element is deprecated in favour of the shared styles in PolymerElements/paper-styles. Please see the implementation of PolymerElements/paper-button for an example.

See: Documentation, Demo.

Usage

Installation

npm install --save @polymer/paper-material

In an html file

<html>
  <head>
    <script type="module">
      import '@polymer/paper-material/paper-material.js';
    </script>
  </head>
  <body>
    <paper-material elevation="1">
      <div>Some content</div>
    </paper-material>
  </body>
</html>

In a Polymer 3 element

import {PolymerElement, html} from '@polymer/polymer';
import '@polymer/paper-material/paper-material.js';

class SampleElement extends PolymerElement {
  static get template() {
    return html`
      <paper-material elevation="1">
        <div>Some content</div>
      </paper-material>
    `;
  }
}
customElements.define('sample-element', SampleElement);

Contributing

If you want to send a PR to this element, here are the instructions for running the tests and demo locally:

Installation

git clone https://github.com/PolymerElements/paper-material
cd paper-material
npm install
npm install -g polymer-cli

Running the demo locally

polymer serve --npm
open http://127.0.0.1:<port>/demo/

Running the tests

polymer test --npm

paper-material's People

Contributors

abdonrd avatar addyosmani avatar aomarks avatar bartolom avatar bendavis78 avatar bicknellr avatar blasten avatar cdata avatar dependabot[bot] avatar dfreedm avatar e111077 avatar ebidel avatar garlicnation avatar keanulee avatar mbleigh avatar notwaldorf avatar rictic avatar tedium-bot avatar tjsavage avatar tyriar avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

paper-material's Issues

Mixin for paper-material

Would love a mixin for paper-material to easily enable changing stuff like background-color globally.

Animating box-shadow forces paint

The paper-material element animates the box-shadow attribute, which causes paint. There is a better way to do this:

Explained in more detail

Expected outcome

Create a pseudo-element with the new box-shadow, set it's opacity initially to 0 and animate the opacity to 1, so only have 1 paint at the end of the transition if you want to set the box-shadow of the proper element.

Actual outcome

Actual the animation is hardly running at 60FPS

Live Demo

Demo with actual and expected method

Browsers Affected

According to csstriggers.com this is the case in all common browsers in EdgeHTML the actual method doesn't cause Layout but as well a repaint

I hope you fix this because I think there would be some refactoring needed if you do and I really hope you want to do it. (FOR THE PERFORMANCE :D )

mixins in paper-material-shared-styles no longer seem to apply.

Description

the mixins from paper-styles/shadow.html no longer seems to be applied.

Expected outcome

The box shadow is applied.

Actual outcome

No box shadow is applied.

Browsers Affected

(Only tested on chromium based browser. Opera)

  • Chrome
  • Firefox
  • Safari 9
  • Safari 8
  • Safari 7
  • Edge
  • IE 11
  • IE 10

A workaround would be to make the paper-styles/shadow.html into a style module and then include that module in the paper-material-shared-styles.

paper-material crashes depending on the import order

Description

If there are any import after paper-material, anything is rendered. However, if it is the last one, everything is ok. It happens in v2.0-preview

Expected outcome

captura de pantalla 2017-04-04 a las 21 31 02

Actual outcome

captura de pantalla 2017-04-04 a las 21 29 55

Steps to reproduce

  1. Import paper-material.
  2. Import another component.

captura de pantalla 2017-04-04 a las 21 29 39

Import code: https://pastebin.com/zhfw7U2i

Browsers Affected

  • Chrome
  • Firefox
  • Safari 9
  • Safari 8
  • Safari 7
  • Edge
  • IE 11
  • IE 10

paper-material accessibility report

For the most part, this is all totally fine! Since this is really just the design / visual effect and not meant to be interactive, the screen reader tests don't apply.

The one piece of feedback I have is that the animations are pretty tough to see, since the gray is so light. Is there anything we can do to make the animation itself a bit more visible?

Object element directly under a paper-material element causes error "Cannot set property 'parentNode' of undefined"

Description

When placing an object tag directly on a paper-material element it gives the error below. If the object is wrapped in a div there is no error.

"TypeError: Cannot set property 'parentNode' of undefined
at Object.saveChildNodes (https://cdn.rawgit.com/download/polymer-cdn/1.5.0/lib/polymer/polymer-mini.html:486:20)
at HTMLElement._poolContent (https://cdn.rawgit.com/download/polymer-cdn/1.5.0/lib/polymer/polymer-mini.html:1702:17)
at HTMLElement._initFeatures (https://cdn.rawgit.com/download/polymer-cdn/1.5.0/lib/polymer/polymer.html:3574:6)
at HTMLElement.createdCallback (https://cdn.rawgit.com/download/polymer-cdn/1.5.0/lib/polymer/polymer-micro.html:189:6)"

Expected outcome

No Error

Actual outcome

"TypeError: Cannot set property 'parentNode' of undefined
at Object.saveChildNodes (https://cdn.rawgit.com/download/polymer-cdn/1.5.0/lib/polymer/polymer-mini.html:486:20)
at HTMLElement._poolContent (https://cdn.rawgit.com/download/polymer-cdn/1.5.0/lib/polymer/polymer-mini.html:1702:17)
at HTMLElement._initFeatures (https://cdn.rawgit.com/download/polymer-cdn/1.5.0/lib/polymer/polymer.html:3574:6)
at HTMLElement.createdCallback (https://cdn.rawgit.com/download/polymer-cdn/1.5.0/lib/polymer/polymer-micro.html:189:6)"

Live Demo

Error:
https://jsbin.com/bisileliri/edit?html,console,output
Wrapped in div, no Error:
https://jsbin.com/munovituri/edit?html,console,output

Steps to reproduce

  1. Place an object tag directly under a paper-material element

Browsers Affected

This may only be an issue in the latest version of chrome as it never seemed to be an issue in the past (Currently running ChromeOS Version 56.0.2924.53 beta (64-bit) )

  • Chrome

On a chromebook so I cant check other browsers at the moment

  • Firefox
  • Safari 9
  • Safari 8
  • Safari 7
  • Edge
  • IE 11
  • IE 10

paper-material does not change size with neon-animated-pages

Hello,

I am using some paper-material in an app. It looks like this:

<paper-material elevation="2">
  <paper-item>
    Welcome  
    <paper-icon-button on-tap="_onView1Tap"></paper-icon-button>
    <paper-icon-button on-tap="_onView2Tap"></paper-icon-button>
  </paper-item>

  <neon-animated-pages selected="[[ selectedIndex ]]">
    <neon-animatable>
      <div>This is some content. This content will expand and collapse in size.</div>
    </neon-animatable>

    <neon-animatable>
      <div>
        <div>This is some other content. Please notice that there is also animated content here</div>
        <neon-animated-pages selected="[[ index2 ]]">
          <neon-animatable>
            This is page 1
          </neon-animatable>
          <neon-animatable> 
            This is page 2
          </neon-animatable>
        </neon-animated-pages>
      </div>
    </neon-animatable>
  </neon-animated-pages>
</paper-material>

At this time, the paper-material does not expand around the neon-animated-pages content. I understand that its because the neon-animated-pages element has a height of zero. So, I manually set the height at runtime. However, the height of the nested neon-animated-paged element is always zero. I can see the content in the view just fine. However, programmatically, it seems to always be zero.

There seems to be a bug in either a) neon-animated-pages or b) paper-material. Its like paper-material was never intended to have animated content within it.

New release

Hello,

Could I ask for a new release of this element ?

Thank you.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.