t2ym/i18n-behavior

[4.0] Extract I18N interface without dependency on Polymer library

Closed this issue · 1 comments

t2ym commented

[4.0] Extract I18N interface without dependency on Polymer library

Status

  • Part of t2ym/i18n-element#63
  • WIP in 4.0-develop branch
  • NPM package
    • npm install i18n-behavior@next or npm install i18n-behavior@4.0.0-pre.19
      • @polymer/polymer as a peer dependency
      • Compatible with i18n-element@^4.0.0-pre
      • Not compatible with i18n-element@3.0.0

Tasks

  • Depend on i18n-format@4.0.0-pre.*
  • Remove Polymer dependency from i18n-attr-repo
    • Convert to a vanilla web component
    • TBD
  • Remove Polymer dependency from i18n-preference
    • Convert to a vanilla web component
    • Remove <iron-localstorage> dependency from i18n-preference
    • Re-implement "storage" event handler for the vanilla web component
    • TBD
  • Remove <iron-ajax> dependency from I18nBehavior
  • Extract Polymer-independent interfaces to i18n-controller.js
  • Move @polymer/polymer from dependencies to devDependencies
  • Drop Safari 9 support
  • Documentation
    • Decent comments
    • API Docs page
  • TBD

Design Issues

  • Polymer dependency as an NPM package
    • As all users of I18nBehavior should depend on @polymer/polymer NPM package, it should be acceptable to move @polymer/polymer from dependencies to devDependencies
    • @polymer/polymer should be added to peerDependencies
    • i18n-element@4 package will depend on i18n-behavior@4 but Polymer library will NOT be installed nor loaded unless an Polymer element, which depends on @polymer/polymer NPM package, imports i18n-element@4 or i18n-behavior@4
    • This is not a normal configuration but should be practical
    • There must be explicit documentation on this configuration to avoid any unexpected missing @polymer/polymer package errors
  • Are importMeta properties for i18n-preference and i18n-attr-repo required? No

Issues

  • Fail to import I18nBehavior@4.0.0-pre.12 via import { I18nBehavior } from "i18n-behavior"
    • Root Cause: the main module was changed to i18n-controller.js in i18n-behavior@4.0.0-pre.12
    • Fix: The main module is reverted to i18n-behavior.js at i18n-behavior@4.0.0-pre.13
t2ym commented

i18n-behavior.js is the main module again at 4.0.0-pre.13

  • Do not import i18n-bahavior@4.0.0-pre.12 with import { I18nBehavior } from "i18n-behavior" omitting the script file name
  • The main module of i18n-behavior@4.0.0-pre.12 is i18n-controller.js
i18n-behavior Main Module @polymer/polymer Notes
4.0.0-pre.13 i18n-behavior.js peerDependencies
4.0.0-pre.12 i18n-controller.js devDependencies No import "i18n-behavior"
4.0.0-pre.11 i18n-behavior.js devDependencies