Software:Polymer (library)

From HandWiki
Revision as of 13:56, 9 February 2024 by Jslovo (talk | contribs) (fix)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Short description: Open-source JavaScript library of Web Components


Polymer
Polymer Project logo
Developer(s)Google[1] and contributors[2]
Initial releaseMay 29, 2015; 9 years ago (2015-05-29)[3]
Stable release
1.x 1.12.0 / 21 May 2019; 5 years ago (2019-05-21)[4]
2.x2.8.0 / 24 June 2019; 5 years ago (2019-06-24)[4]
Repositoryon GitHub
Written inJavaScript, HTML
TypeJavaScript library
License3-Clause BSD[5]
Websitewww.polymer-project.org

Polymer is an open-source JavaScript library for building web applications using Web Components. The library is being developed by Google developers and contributors on GitHub. Modern design principles are implemented as a separate project using Google's Material Design design principles.

Polymer is used by a number of Google services and websites, including YouTube, YouTube Gaming, the redesigned Google Earth (since 2017),[6] Google I/O 2015 and 2016 websites, Google Play Music, redesign of Google Sites[7] and Allo for web (until its shutdown in 2019).[8]

Other notable users include Netflix, Electronics Arts, Comcast, Nuxeo, Coca-Cola, McDonald's, BBVA, IBM and General Electric.

History

Public development of Polymer began in November 2013 with the release of a Promises Polyfill. This steadily expanded into a web design library covering visual styling guidelines (via Material Design), data binding, and a large number of "Core" and "Paper" Web Components. Core components were originally envisioned to encompass generic functionality that would be essential to most websites, while Paper components were intended to provide more specialized components with Material Design concepts forming a key part of their design. A major milestone was reached with the release of Version 0.5, which was considered the first version of the project ready for use by early adopters.[9]

Google continued to revise the design of Polymer after the release of 0.5, with special consideration given to the performance issues a number of developers found. This culminated with the release of Polymer 1.0 in 2015, which was the first "production ready" version of the library.[10] Version 1.0 significantly improved the performance of Polymer, reducing load times by up to 7 times.[11] With version 1.0 Google split the elements from the Polymer project to clearly distinguish the elements catalog from the Polymer polyfill & webcomponents-sugaring library.

On 14–15 September 2015, Google organized a Polymer Summit in Amsterdam.

On 17–18 October 2016, Google organized a Polymer Summit in London.

On 22–23 August 2017, Google organized a Polymer Summit in Copenhagen.

On 2 May 2018, the Polymer team announced that any future development in Polymer will shift away from its two-way binding and its template system, and will focus on LitElement[12] (still part of Polymer[13]) and one-way bindings.[14]

Features

Polymer provides a number of features over vanilla Web Components:

  • Simplified way of creating custom elements
  • Both One-way and Two-way data binding
  • Computed properties
  • Conditional and repeat templates
  • Gesture events

Usage

Polymer has begun to gain increasing recognition in the market, with spikes in use in 2015 and 2016 as documented by the website BuiltWith.[15] Special attention has been paid to its structured design process, allowing for an interoperable "Lego Block" structure.[16] LitElement was developed by the Google Chrome team as part of the Polymer project in 2018. LitElement was designed to be a lightweight and easy-to-use framework for creating web components that can be used with any front-end framework or library.

Custom elements

Custom elements can be created using ES (ECMAScript, most commonly JavaScript) modules with classes. Custom element definition comprises CSS style, HTML template of the element's local DOM, element properties, lifecycle callbacks and JavaScript methods:

import {PolymerElement, html} from '@polymer/polymer'

class HelloElement extends PolymerElement {
    // Define the element's template
    static get template() { 
        return html`
        <style>
        /* Local DOM CSS style */
        </style>
        <!-- Local DOM -->
        `; 
    }
    static get is() { return 'hello-element'; }
    // Define public API properties
    static get properties() {
        return {
            name: {
                type: String
            }
        };
    }
}
window.customElements.define(HelloElement.is, HelloElement);

The element defined above can be used in HTML code:

<hello-element name="World"></hello-element>

See also

References

  1. "AUTHORS.txt" (in en). https://polymer.github.io/AUTHORS.txt. 
  2. "CONTRIBUTORS.txt" (in en). https://polymer.github.io/CONTRIBUTORS.txt. 
  3. "1.0" (in en). https://www.polymer-project.org/blog/2015-05-29-one-dot-oh.html. 
  4. 4.0 4.1 "Releases · Polymer/polymer" (in en). https://github.com/Polymer/polymer/releases. 
  5. "polymer/LICENSE.txt at master" (in en). https://github.com/Polymer/polymer/blob/master/LICENSE.txt. 
  6. Bidelman, Eric (2017-04-18). "Mission accomplished: has been componentized. New @googleearth is built w/ #WebComponents using @polymer.pic.twitter.com/h76ztfynYy". https://twitter.com/ebidel/status/854366654741991424. 
  7. "Meet Google Drive – One place for all your files". https://accounts.google.com/ServiceLogin?service=wise&passive=1209600&continue=https://sites.google.com/new&followup=https://sites.google.com/new. 
  8. "Who's using Polymer?". https://github.com/Polymer/polymer/wiki/Who's-using-Polymer%3F. 
  9. "Polymer gives us a closer look at Google's Material Design UI". Android Authority. http://www.androidauthority.com/polymer-elements-material-design-397858/. 
  10. Steven Max Patterson (29 May 2015). "Google's Polymer 1.0 brings reuse and better branding to Web development". CIO. http://www.cio.com/article/2927587/web-development/google-polymer-brings-reuse-and-better-branding-to-web-development.html. 
  11. "Welcome - Polymer 1.0". https://www.polymer-project.org/1.0/. 
  12. "Roadmap update, part 1: 3.0 and beyond". https://www.polymer-project.org/blog/2018-05-02-roadmap-update.html#libraries. 
  13. "Justin Fagnani on Twitter" (in en). Twitter. https://twitter.com/justinfagnani/status/994358200538349568. 
  14. "Roadmap update, part 2: FAQ - Polymer Project" (in en). https://www.polymer-project.org/blog/2018-05-02-roadmap-faq.html#can-i-keep-using-the-polymer-data-system. 
  15. "Polymer Usage Statistics". March 2019. https://trends.builtwith.com/javascript/Polymer. 
  16. Allie Coyne (13 August 2015). "Inside ING Direct's new lego block app architecture". iTnews. http://www.itnews.com.au/News/407763,inside-ing-directs-new-lego-block-app-architecture.aspx. 

External links