polymer-rails 1.0.5 → 1.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e40e30b7007b492a4b32e84754661b1441b7af1a
4
- data.tar.gz: 1999c495dddebfa76d167862a416e06119be8278
3
+ metadata.gz: 34b3a9b27e37403a1b24f10c0af3fb503784a9bc
4
+ data.tar.gz: 33e91cef11bad49853814766cec2690a346d5a4b
5
5
  SHA512:
6
- metadata.gz: 08f7e97bcac7c8b53ffae4a644f1c6be4784a0b05b175a5dd0686cbe5ec2ed838369e451893ae3e56e221c4a7fa5fb1cd421b210f0c89683916bd595ce7cc679
7
- data.tar.gz: e93d4fe5e29818b0f6473319fa5e83b62db7f5f7671c64afd41b0907bf5eb89e9f7591b5a39ce4c119fed07850b723f8be904e2c27a3ec48045138a04fb0167b
6
+ metadata.gz: 4ef26bbb7540e7aafe2a16fba3a4d431b2eee367576a543763dcceb6b7ed3d82040ecf40f002bfb2030cb5487b1c2540f760505c498cacf02eb8883fe9d8315a
7
+ data.tar.gz: 4737d13cacccdee39fbdeb5d1dbbb6379312960486ed08cbdd81f6cffc4d2c5e7a13fdae8d2724400cf68599b56df43a23a0e148d39fa19721ffaf0d27709c8f
@@ -13,6 +13,21 @@ document.body.removeAttribute('unresolved');
13
13
  if (window.WebComponents) {
14
14
  addEventListener('WebComponentsReady', resolve);
15
15
  } else {
16
+ if (document.readyState =<!--
17
+ @license
18
+ Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
19
+ This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
20
+ The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
21
+ The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
22
+ Code distributed by Google as part of the polymer project is also
23
+ subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
24
+ --><script>(function () {
25
+ function resolve() {
26
+ document.body.removeAttribute('unresolved');
27
+ }
28
+ if (window.WebComponents) {
29
+ addEventListener('WebComponentsReady', resolve);
30
+ } else {
16
31
  if (document.readyState === 'interactive' || document.readyState === 'complete') {
17
32
  resolve();
18
33
  } else {
@@ -506,6 +521,520 @@ debouncer.stop();
506
521
  }
507
522
  }
508
523
  });
524
+ Polymer.version = '1.0.6';
525
+ Polymer.Base._addFeature({
526
+ _registerFeatures: function () {
527
+ this._prepIs();
528
+ this._prepAttributes();
529
+ this._prepBehaviors();
530
+ this._prepExtends();
531
+ this._prepConstructor();
532
+ },
533
+ _prepBehavior: function (b) {
534
+ this._addHostAttributes(b.hostAttributes);
535
+ },
536
+ _marshalBehavior: function (b) {
537
+ },
538
+ _initFeatures: function () {
539
+ this._marshalHostAttributes();
540
+ this._setupDebouncers();
541
+ this._marshalBehaviors();
542
+ }
543
+ });</script>
544
+
545
+ == 'interactive' || document.readyState === 'complete') {
546
+ resolve();
547
+ } else {
548
+ addEventListener('DOMContentLoaded', resolve);
549
+ }
550
+ }
551
+ }());
552
+ Polymer = {
553
+ Settings: function () {
554
+ var user = window.Polymer || {};
555
+ location.search.slice(1).split('&').forEach(function (o) {
556
+ o = o.split('=');
557
+ o[0] && (user[o[0]] = o[1] || true);
558
+ });
559
+ var wantShadow = user.dom === 'shadow';
560
+ var hasShadow = Boolean(Element.prototype.createShadowRoot);
561
+ var nativeShadow = hasShadow && !window.ShadowDOMPolyfill;
562
+ var useShadow = wantShadow && hasShadow;
563
+ var hasNativeImports = Boolean('import' in document.createElement('link'));
564
+ var useNativeImports = hasNativeImports;
565
+ var useNativeCustomElements = !window.CustomElements || window.CustomElements.useNative;
566
+ return {
567
+ wantShadow: wantShadow,
568
+ hasShadow: hasShadow,
569
+ nativeShadow: nativeShadow,
570
+ useShadow: useShadow,
571
+ useNativeShadow: useShadow && nativeShadow,
572
+ useNativeImports: useNativeImports,
573
+ useNativeCustomElements: useNativeCustomElements
574
+ };
575
+ }()
576
+ };
577
+ (function () {
578
+ var userPolymer = window.Polymer;
579
+ window.Polymer = function (prototype) {
580
+ var ctor = desugar(prototype);
581
+ prototype = ctor.prototype;
582
+ var options = { prototype: prototype };
583
+ if (prototype.extends) {
584
+ options.extends = prototype.extends;
585
+ }
586
+ Polymer.telemetry._registrate(prototype);
587
+ document.registerElement(prototype.is, options);
588
+ return ctor;
589
+ };
590
+ var desugar = function (prototype) {
591
+ prototype = Polymer.Base.chainObject(prototype, Polymer.Base);
592
+ prototype.registerCallback();
593
+ return prototype.constructor;
594
+ };
595
+ window.Polymer = Polymer;
596
+ if (userPolymer) {
597
+ for (var i in userPolymer) {
598
+ Polymer[i] = userPolymer[i];
599
+ }
600
+ }
601
+ Polymer.Class = desugar;
602
+ }());
603
+ Polymer.telemetry = {
604
+ registrations: [],
605
+ _regLog: function (prototype) {
606
+ console.log('[' + prototype.is + ']: registered');
607
+ },
608
+ _registrate: function (prototype) {
609
+ this.registrations.push(prototype);
610
+ Polymer.log && this._regLog(prototype);
611
+ },
612
+ dumpRegistrations: function () {
613
+ this.registrations.forEach(this._regLog);
614
+ }
615
+ };
616
+ Object.defineProperty(window, 'currentImport', {
617
+ enumerable: true,
618
+ configurable: true,
619
+ get: function () {
620
+ return (document._currentScript || document.currentScript).ownerDocument;
621
+ }
622
+ });
623
+ Polymer.Base = {
624
+ _addFeature: function (feature) {
625
+ this.extend(this, feature);
626
+ },
627
+ registerCallback: function () {
628
+ this._registerFeatures();
629
+ this._doBehavior('registered');
630
+ },
631
+ createdCallback: function () {
632
+ Polymer.telemetry.instanceCount++;
633
+ this.root = this;
634
+ this._doBehavior('created');
635
+ this._initFeatures();
636
+ },
637
+ attachedCallback: function () {
638
+ this.isAttached = true;
639
+ this._doBehavior('attached');
640
+ },
641
+ detachedCallback: function () {
642
+ this.isAttached = false;
643
+ this._doBehavior('detached');
644
+ },
645
+ attributeChangedCallback: function (name) {
646
+ this._setAttributeToProperty(this, name);
647
+ this._doBehavior('attributeChanged', arguments);
648
+ },
649
+ extend: function (prototype, api) {
650
+ if (prototype && api) {
651
+ Object.getOwnPropertyNames(api).forEach(function (n) {
652
+ this.copyOwnProperty(n, api, prototype);
653
+ }, this);
654
+ }
655
+ return prototype || api;
656
+ },
657
+ mixin: function (target, source) {
658
+ for (var i in source) {
659
+ target[i] = source[i];
660
+ }
661
+ return target;
662
+ },
663
+ copyOwnProperty: function (name, source, target) {
664
+ var pd = Object.getOwnPropertyDescriptor(source, name);
665
+ if (pd) {
666
+ Object.defineProperty(target, name, pd);
667
+ }
668
+ },
669
+ _log: console.log.apply.bind(console.log, console),
670
+ _warn: console.warn.apply.bind(console.warn, console),
671
+ _error: console.error.apply.bind(console.error, console),
672
+ _logf: function () {
673
+ return this._logPrefix.concat([this.is]).concat(Array.prototype.slice.call(arguments, 0));
674
+ }
675
+ };
676
+ Polymer.Base._logPrefix = function () {
677
+ var color = window.chrome || /firefox/i.test(navigator.userAgent);
678
+ return color ? [
679
+ '%c[%s::%s]:',
680
+ 'font-weight: bold; background-color:#EEEE00;'
681
+ ] : ['[%s::%s]:'];
682
+ }();
683
+ Polymer.Base.chainObject = function (object, inherited) {
684
+ if (object && inherited && object !== inherited) {
685
+ if (!Object.__proto__) {
686
+ object = Polymer.Base.extend(Object.create(inherited), object);
687
+ }
688
+ object.__proto__ = inherited;
689
+ }
690
+ return object;
691
+ };
692
+ Polymer.Base = Polymer.Base.chainObject(Polymer.Base, HTMLElement.prototype);
693
+ Polymer.telemetry.instanceCount = 0;
694
+ (function () {
695
+ var modules = {};
696
+ var DomModule = function () {
697
+ return document.createElement('dom-module');
698
+ };
699
+ DomModule.prototype = Object.create(HTMLElement.prototype);
700
+ DomModule.prototype.constructor = DomModule;
701
+ DomModule.prototype.createdCallback = function () {
702
+ var id = this.id || this.getAttribute('name') || this.getAttribute('is');
703
+ if (id) {
704
+ this.id = id;
705
+ modules[id] = this;
706
+ }
707
+ };
708
+ DomModule.prototype.import = function (id, slctr) {
709
+ var m = modules[id];
710
+ if (!m) {
711
+ forceDocumentUpgrade();
712
+ m = modules[id];
713
+ }
714
+ if (m && slctr) {
715
+ m = m.querySelector(slctr);
716
+ }
717
+ return m;
718
+ };
719
+ var cePolyfill = window.CustomElements && !CustomElements.useNative;
720
+ if (cePolyfill) {
721
+ var ready = CustomElements.ready;
722
+ CustomElements.ready = true;
723
+ }
724
+ document.registerElement('dom-module', DomModule);
725
+ if (cePolyfill) {
726
+ CustomElements.ready = ready;
727
+ }
728
+ function forceDocumentUpgrade() {
729
+ if (cePolyfill) {
730
+ var script = document._currentScript || document.currentScript;
731
+ if (script) {
732
+ CustomElements.upgradeAll(script.ownerDocument);
733
+ }
734
+ }
735
+ }
736
+ }());
737
+ Polymer.Base._addFeature({
738
+ _prepIs: function () {
739
+ if (!this.is) {
740
+ var module = (document._currentScript || document.currentScript).parentNode;
741
+ if (module.localName === 'dom-module') {
742
+ var id = module.id || module.getAttribute('name') || module.getAttribute('is');
743
+ this.is = id;
744
+ }
745
+ }
746
+ }
747
+ });
748
+ Polymer.Base._addFeature({
749
+ behaviors: [],
750
+ _prepBehaviors: function () {
751
+ if (this.behaviors.length) {
752
+ this.behaviors = this._flattenBehaviorsList(this.behaviors);
753
+ }
754
+ this._prepAllBehaviors(this.behaviors);
755
+ },
756
+ _flattenBehaviorsList: function (behaviors) {
757
+ var flat = [];
758
+ behaviors.forEach(function (b) {
759
+ if (b instanceof Array) {
760
+ flat = flat.concat(this._flattenBehaviorsList(b));
761
+ } else if (b) {
762
+ flat.push(b);
763
+ } else {
764
+ this._warn(this._logf('_flattenBehaviorsList', 'behavior is null, check for missing or 404 import'));
765
+ }
766
+ }, this);
767
+ return flat;
768
+ },
769
+ _prepAllBehaviors: function (behaviors) {
770
+ for (var i = behaviors.length - 1; i >= 0; i--) {
771
+ this._mixinBehavior(behaviors[i]);
772
+ }
773
+ for (var i = 0, l = behaviors.length; i < l; i++) {
774
+ this._prepBehavior(behaviors[i]);
775
+ }
776
+ this._prepBehavior(this);
777
+ },
778
+ _mixinBehavior: function (b) {
779
+ Object.getOwnPropertyNames(b).forEach(function (n) {
780
+ switch (n) {
781
+ case 'hostAttributes':
782
+ case 'registered':
783
+ case 'properties':
784
+ case 'observers':
785
+ case 'listeners':
786
+ case 'created':
787
+ case 'attached':
788
+ case 'detached':
789
+ case 'attributeChanged':
790
+ case 'configure':
791
+ case 'ready':
792
+ break;
793
+ default:
794
+ if (!this.hasOwnProperty(n)) {
795
+ this.copyOwnProperty(n, b, this);
796
+ }
797
+ break;
798
+ }
799
+ }, this);
800
+ },
801
+ _doBehavior: function (name, args) {
802
+ this.behaviors.forEach(function (b) {
803
+ this._invokeBehavior(b, name, args);
804
+ }, this);
805
+ this._invokeBehavior(this, name, args);
806
+ },
807
+ _invokeBehavior: function (b, name, args) {
808
+ var fn = b[name];
809
+ if (fn) {
810
+ fn.apply(this, args || Polymer.nar);
811
+ }
812
+ },
813
+ _marshalBehaviors: function () {
814
+ this.behaviors.forEach(function (b) {
815
+ this._marshalBehavior(b);
816
+ }, this);
817
+ this._marshalBehavior(this);
818
+ }
819
+ });
820
+ Polymer.Base._addFeature({
821
+ _prepExtends: function () {
822
+ if (this.extends) {
823
+ this.__proto__ = this._getExtendedPrototype(this.extends);
824
+ }
825
+ },
826
+ _getExtendedPrototype: function (tag) {
827
+ return this._getExtendedNativePrototype(tag);
828
+ },
829
+ _nativePrototypes: {},
830
+ _getExtendedNativePrototype: function (tag) {
831
+ var p = this._nativePrototypes[tag];
832
+ if (!p) {
833
+ var np = this.getNativePrototype(tag);
834
+ p = this.extend(Object.create(np), Polymer.Base);
835
+ this._nativePrototypes[tag] = p;
836
+ }
837
+ return p;
838
+ },
839
+ getNativePrototype: function (tag) {
840
+ return Object.getPrototypeOf(document.createElement(tag));
841
+ }
842
+ });
843
+ Polymer.Base._addFeature({
844
+ _prepConstructor: function () {
845
+ this._factoryArgs = this.extends ? [
846
+ this.extends,
847
+ this.is
848
+ ] : [this.is];
849
+ var ctor = function () {
850
+ return this._factory(arguments);
851
+ };
852
+ if (this.hasOwnProperty('extends')) {
853
+ ctor.extends = this.extends;
854
+ }
855
+ Object.defineProperty(this, 'constructor', {
856
+ value: ctor,
857
+ writable: true,
858
+ configurable: true
859
+ });
860
+ ctor.prototype = this;
861
+ },
862
+ _factory: function (args) {
863
+ var elt = document.createElement.apply(document, this._factoryArgs);
864
+ if (this.factoryImpl) {
865
+ this.factoryImpl.apply(elt, args);
866
+ }
867
+ return elt;
868
+ }
869
+ });
870
+ Polymer.nob = Object.create(null);
871
+ Polymer.Base._addFeature({
872
+ properties: {},
873
+ getPropertyInfo: function (property) {
874
+ var info = this._getPropertyInfo(property, this.properties);
875
+ if (!info) {
876
+ this.behaviors.some(function (b) {
877
+ return info = this._getPropertyInfo(property, b.properties);
878
+ }, this);
879
+ }
880
+ return info || Polymer.nob;
881
+ },
882
+ _getPropertyInfo: function (property, properties) {
883
+ var p = properties && properties[property];
884
+ if (typeof p === 'function') {
885
+ p = properties[property] = { type: p };
886
+ }
887
+ if (p) {
888
+ p.defined = true;
889
+ }
890
+ return p;
891
+ }
892
+ });
893
+ Polymer.CaseMap = {
894
+ _caseMap: {},
895
+ dashToCamelCase: function (dash) {
896
+ var mapped = Polymer.CaseMap._caseMap[dash];
897
+ if (mapped) {
898
+ return mapped;
899
+ }
900
+ if (dash.indexOf('-') < 0) {
901
+ return Polymer.CaseMap._caseMap[dash] = dash;
902
+ }
903
+ return Polymer.CaseMap._caseMap[dash] = dash.replace(/-([a-z])/g, function (m) {
904
+ return m[1].toUpperCase();
905
+ });
906
+ },
907
+ camelToDashCase: function (camel) {
908
+ var mapped = Polymer.CaseMap._caseMap[camel];
909
+ if (mapped) {
910
+ return mapped;
911
+ }
912
+ return Polymer.CaseMap._caseMap[camel] = camel.replace(/([a-z][A-Z])/g, function (g) {
913
+ return g[0] + '-' + g[1].toLowerCase();
914
+ });
915
+ }
916
+ };
917
+ Polymer.Base._addFeature({
918
+ _prepAttributes: function () {
919
+ this._aggregatedAttributes = {};
920
+ },
921
+ _addHostAttributes: function (attributes) {
922
+ if (attributes) {
923
+ this.mixin(this._aggregatedAttributes, attributes);
924
+ }
925
+ },
926
+ _marshalHostAttributes: function () {
927
+ this._applyAttributes(this, this._aggregatedAttributes);
928
+ },
929
+ _applyAttributes: function (node, attr$) {
930
+ for (var n in attr$) {
931
+ if (!this.hasAttribute(n) && n !== 'class') {
932
+ this.serializeValueToAttribute(attr$[n], n, this);
933
+ }
934
+ }
935
+ },
936
+ _marshalAttributes: function () {
937
+ this._takeAttributesToModel(this);
938
+ },
939
+ _takeAttributesToModel: function (model) {
940
+ for (var i = 0, l = this.attributes.length; i < l; i++) {
941
+ this._setAttributeToProperty(model, this.attributes[i].name);
942
+ }
943
+ },
944
+ _setAttributeToProperty: function (model, attrName) {
945
+ if (!this._serializing) {
946
+ var propName = Polymer.CaseMap.dashToCamelCase(attrName);
947
+ var info = this.getPropertyInfo(propName);
948
+ if (info.defined || this._propertyEffects && this._propertyEffects[propName]) {
949
+ var val = this.getAttribute(attrName);
950
+ model[propName] = this.deserialize(val, info.type);
951
+ }
952
+ }
953
+ },
954
+ _serializing: false,
955
+ reflectPropertyToAttribute: function (name) {
956
+ this._serializing = true;
957
+ this.serializeValueToAttribute(this[name], Polymer.CaseMap.camelToDashCase(name));
958
+ this._serializing = false;
959
+ },
960
+ serializeValueToAttribute: function (value, attribute, node) {
961
+ var str = this.serialize(value);
962
+ (node || this)[str === undefined ? 'removeAttribute' : 'setAttribute'](attribute, str);
963
+ },
964
+ deserialize: function (value, type) {
965
+ switch (type) {
966
+ case Number:
967
+ value = Number(value);
968
+ break;
969
+ case Boolean:
970
+ value = value !== null;
971
+ break;
972
+ case Object:
973
+ try {
974
+ value = JSON.parse(value);
975
+ } catch (x) {
976
+ }
977
+ break;
978
+ case Array:
979
+ try {
980
+ value = JSON.parse(value);
981
+ } catch (x) {
982
+ value = null;
983
+ console.warn('Polymer::Attributes: couldn`t decode Array as JSON');
984
+ }
985
+ break;
986
+ case Date:
987
+ value = new Date(value);
988
+ break;
989
+ case String:
990
+ default:
991
+ break;
992
+ }
993
+ return value;
994
+ },
995
+ serialize: function (value) {
996
+ switch (typeof value) {
997
+ case 'boolean':
998
+ return value ? '' : undefined;
999
+ case 'object':
1000
+ if (value instanceof Date) {
1001
+ return value;
1002
+ } else if (value) {
1003
+ try {
1004
+ return JSON.stringify(value);
1005
+ } catch (x) {
1006
+ return '';
1007
+ }
1008
+ }
1009
+ default:
1010
+ return value != null ? value : undefined;
1011
+ }
1012
+ }
1013
+ });
1014
+ Polymer.Base._addFeature({
1015
+ _setupDebouncers: function () {
1016
+ this._debouncers = {};
1017
+ },
1018
+ debounce: function (jobName, callback, wait) {
1019
+ this._debouncers[jobName] = Polymer.Debounce.call(this, this._debouncers[jobName], callback, wait);
1020
+ },
1021
+ isDebouncerActive: function (jobName) {
1022
+ var debouncer = this._debouncers[jobName];
1023
+ return debouncer && debouncer.finish;
1024
+ },
1025
+ flushDebouncer: function (jobName) {
1026
+ var debouncer = this._debouncers[jobName];
1027
+ if (debouncer) {
1028
+ debouncer.complete();
1029
+ }
1030
+ },
1031
+ cancelDebouncer: function (jobName) {
1032
+ var debouncer = this._debouncers[jobName];
1033
+ if (debouncer) {
1034
+ debouncer.stop();
1035
+ }
1036
+ }
1037
+ });
509
1038
  Polymer.version = '1.0.5';
510
1039
  Polymer.Base._addFeature({
511
1040
  _registerFeatures: function () {