polymer-decorators icon indicating copy to clipboard operation
polymer-decorators copied to clipboard

Support Polymer 3.0 + NPM

Open aomarks opened this issue 9 years ago • 7 comments

We should publish these decorators in their module form (i.e., without the Polymer.decorators global generated files) on NPM, so that they can be used with Polymer 3.0, and we should add instructions to the README demonstrating how to install and use them.

The polymer-decorators package on NPM is already taken by https://github.com/Cu3PO42/polymer-decorators, so we can use @polymer/decorators instead.

We'll also need to distribute Polymer 3.0 type declarations before this will be fully usable, which will require some additional work in https://github.com/Polymer/gen-typescript-declarations.

aomarks avatar Sep 27 '17 05:09 aomarks

Support Polymer 3.0 + NPM

Is there any progress?

pme123 avatar Mar 21 '18 09:03 pme123

Polymer 3 with polymer-decorators works normally. Grieving absence in npm 😔

Use same for implement:

CMD

@echo off
cd ./node_modules/@polymer/decorators
npm install & npm run build & rd /s /q "./node_modules"

Bash

#!/bin/bash
cd ./node_modules/@polymer/decorators;
npm install;
npm run build;
rm -rf ./node_modules;

SergeShkurko avatar Apr 20 '18 11:04 SergeShkurko

Polymer 3 with polymer-decorators works normally.

Hmm, how did you deal with typings? The decorators require that they are applied to something that extends Polymer.Element, which doesn't exist with Polymer 3 because it's exported from a module instead of being in a global namespace.

aomarks avatar Apr 20 '18 21:04 aomarks

Typings from Polymer 2 (They are alike)

For example my 404 component:

import {
  PolymerElement,
  html,
} from '@polymer/polymer/polymer-element'
import {
  customElement,
  property,
} from '@polymer/decorators'
import * as view from './template.pug'

@customElement('app-404')
export default class AppNotFound extends (PolymerElement as new () => Polymer.Element) {

  public static get template() {
    return html([view()])
  }

}

SergeShkurko avatar Apr 21 '18 07:04 SergeShkurko

Grettings aomarks, polymer team is working for "Support Polymer 3.0 + NPM" on polymer-decorators or not? If yes, how we know the progress? Please i need a answer for this.

jagcolombat avatar May 28 '18 22:05 jagcolombat

In the meantime, this fork mays interest you. https://www.npmjs.com/package/darkengines-polymer3-decorators

AFAIK it is enough to build polymer 3 elements, just send PR if you want to improve.

darkengines avatar Jun 06 '18 22:06 darkengines

https://www.npmjs.com/package/@polymer/decorators for Polymer 3.0 is now published

aomarks avatar Aug 11 '18 00:08 aomarks