[4.0] Remove dependency on Polymer library
Closed this issue · 0 comments
t2ym commented
[4.0] Remove dependency on Polymer library
Status
- Part of t2ym/i18n-element#63
- WIP in 4.0-develop branch
- NPM package
npm install i18n-number@next
ornpm install i18n-number@4.0.0-pre.6
Tasks
- Move
@polymer/polymer
from dependencies to devDependencies - Drop Safari 9 support
- Remove
intl
package dependency
- Remove
-
bower.json
withBSD-2-Clause
aslicense
- Add
lit-html
dependency - Remove
intl
loading mechanism - Convert to
lit-html
rendering- Remove
@polymer/polymer
imports - Convert properties and observers
- Remove
- Support IE11 and Edge with custom elements v1 polyfill
-
Temporarily insertpolyfill.js
contents fromi18n-element/polyfill.js
- Import a separate
polyfill.js
from an independent npm module forpolyfill.js
- Create npm package
wc-putty
and import
- Create npm package
-
- Convert tests
- No Polymer methods
- Add some waits
- Convert demo
- Remove
intl
fromextraDependencies
inpolymer.json
- Remove
- Documentation
- Decent comments
- API Docs page
Design Issues
- How to port
notifyPath()
feature from Polymer?- Just call
_onOptionsPropertyChanged()
- Just call
- Is
reflectToAttribute
feature required? No -
root
property forshadowRoot
to imitate a Polymer element - Should
attachShadow()
be put off until the first rendering likei18n-format
? Yesi18n-element
tests fail with<plural-gender-element>
- Should assignment of
this.lang
with the default value be put off untilconnectedCallback
? Yes - Is
importMeta
property necessary? No.
Issues
-
document.createElement('i18n-number')
fails with "The result must not have attributes"- Fix: Put off setting
this.lang
in the constructor to the next microtask timing - Fix: Add
'null'
guards forlang
property
- Fix: Put off setting
-
lang
attribute/property is unexpectedly set to"en"
window.t = document.createElement('template');
t.innerHTML = '<i18n-number id="overridden-lang" lang="fr">12.34</i18n-number>'
document.body.appendChild(t.content);
document.querySelector('i18n-number#overridden-lang').lang === 'fr' // must be true, actually false
- Root Cause:
lang
has to be set atconnectedCallback
instead of the microtask timing after constructor