googlearchive / polyup

A helpful assistant for migrating from Polymer v0.5 to 1.0. Does many of the boring mechanical parts for you.
http://polymerlabs.github.io/polyup/
BSD 3-Clause "New" or "Revised" License
38 stars 9 forks source link

Uncaught Element name could not be inferred. (polymer.concat.js: 9342) #98

Open ocampesato opened 9 years ago

ocampesato commented 9 years ago

I ran polyup on this code:

<polymer-element name="svg-graphics" attributes="width height">
 <template>
   <style>
     :host { display:block; }
     .slice { }
   </style>

   <svg id="svg" width="{{width}}" height="{{height}}">
      <template repeat="{{shape in shapes}}">
        <ellipse cx="{{shape.cx}}" cy="{{shape.cy}}"
                 rx="{{shape.rx}}" ry="{{shape.ry}}"
                 style="fill:{{shape.fill}}"/>
      </template>
    </svg>
  </template>

  <script>
     (function() {
       var mainColors = ["#f00", "#ff0", "#00f"];

       Polymer('svg-graphics',{
         colors : null,
         shapes : null,
         observe : {
           width : 'render'
         },
         getShapes : function() {
           var basePointX  = 250, basePointY = 250;
           var currentX    = 0, currentY     = 0;
           var offsetX     = 0, offsetY      = 0;
           var radius      = 0, spiralCount  = 4;
           var Constant    = 0.25, angle     = 0;
           var deltaAngle  = 1, maxAngle     = 721;

           var offsetX=0, offsetY=0, index=0;
           var majorAxis=40, minorAxis=60;
           var shapes=[], color="", colors = ["#f00", "#ff0"];

           for(angle=0; angle<maxAngle; angle+=deltaAngle) {
             radius   = Constant*angle;
             offsetX  = radius*Math.cos(angle*Math.PI/180);
             offsetY  = radius*Math.sin(angle*Math.PI/180);
             currentX = basePointX+offsetX;
             currentY = basePointY-offsetY;

             // an index into the array of colors
             index = Math.floor(angle/deltaAngle);

             // append an (x,y) pair of values that
             // represent the upper-left vertex
             shapes.push({cx:currentX,  cy:currentY,
                          rx:majorAxis, ry:minorAxis,
                          fill:colors[index%colors.length]});
           }

           return shapes;
         },
         render : function() {
           this.shapes = this.getShapes();
         }
     })
   })();
  </script>
</polymer-element>

The output was wrong because: ==> see error message in the title of this bug <==

NOTE: I saved the converted code in PolyArchOvals1.html and then launched this HTML Web page:

<!doctype html>
<html>
 <head>
  <meta name="viewport"
    content="width=device-width, minimum-scale=1.0, initial-scale=1.0, user-scalable=yes">
  <title>Archimedean Graphics</title>

  <script src="bower_components/platform/platform.js"></script>
  <link rel="import" href="bower_components/polymer/polymer.html">
  <link rel="import" href="PolyArchOvals1.html">
 </head>

 <body unresolved>
   <svg-graphics width="800" height="600"></svg-graphics>
 </body>
</html>
rictic commented 9 years ago

Hm, I'm having trouble reproducing this error. When I go to the online demo at http://polymerlabs.github.io/polyup/ and paste in your code it seems to work fine.

What version of polyup are you using?

ocampesato commented 9 years ago

Hello Peter, Thanks for the speedy reply, and I'm using the online version of polyup, and then launch a local web server, and then open the short HTML Web page that imports the polymer-specific code. Here's my bower.json file, which I'm thinking might be the culprit:{  "name": "angular_polymer",  "dependencies": {    "angular": "~1.4",    "core-elements": "Polymer/core-elements",    "paper-elements": "Polymer/paper-elements",    "polymer": "Polymer/polymer#^1.1.0"  },  "resolutions": {    "polymer": "~0.4.0",    "core-component-page": "^0.5",    "core-ajax": "^0.5",    "core-animated-pages": "^0.5",    "core-animation": "^0.5",    "web-animations-js": "1.0.6",    "core-collapse": "^0.5",    "core-doc-viewer": "^0.5",    "context-free-parser": "^0.5"  }} Oswald

 On Thursday, September 24, 2015 8:37 PM, Peter Burns <notifications@github.com> wrote:

Hm, I'm having trouble reproducing this error. When I go to the online demo at http://polymerlabs.github.io/polyup/ and paste in your code it seems to work fine.What version of polyup are you using?— Reply to this email directly or view it on GitHub.

rictic commented 9 years ago

I'm not sure I follow, bu the intended use of polyup is as a node binary, as follows:

  npm install -g polyup
  polyup PolyArchOvals1.html --overwrite

That will overwrite your code on disk with the upgrade (make sure you're using source control!).

Then you want to upgrade your bower file to point to Polymer 1.0, and the elements as well. Check out the AfterUseGuide.md file in this repo.

ocampesato commented 9 years ago

Hello Peter, I followed your instructions and still get the same error;(   The attached zip file contains a screenshot of the error, the two HTML Web pages, and bower.json. Would you be so kind as to let me know if the version numbers in 'resolutions' are correct, and if not, how I can specify the correct version numbers? Thanks!

Oswald

 On Thursday, September 24, 2015 8:59 PM, Peter Burns <notifications@github.com> wrote:

I'm not sure I follow, bu the intended use of polyup is as a node binary, as follows: npm install -g polyup polyup PolyArchOvals1.html --overwrite That will overwrite your code on disk with the upgrade (make sure you're using source control!).Then you want to upgrade your bower file to point to Polymer 1.0, and the elements as well. Check out the AfterUseGuide.md file in this repo.— Reply to this email directly or view it on GitHub.

rictic commented 9 years ago

Sorry, I don't see the attached zip file and I can't work out where exactly this is going wrong.

Can you clarify how you're using polyup?

ocampesato commented 9 years ago

Hello Peter, I've attached a zip file and hopefully this time it will show up:) I'm using the online Web page for polyup, and I just copy/pasted the contents of the polymer version 0.5 file PolyArchOvals1.html and generated a polymer version 1.0 of this file that is imported into ArchOvals1.html, both of which are shown below, as well as bower.json. ===> bower.json:{  "name": "angular_polymer",  "dependencies": {    "angular": "~1.4",    "core-elements": "Polymer/core-elements",    "paper-elements": "Polymer/paper-elements",    "polymer": "Polymer/polymer#^1.1.0"  },  "resolutions": {    "polymer": "~0.4.0",    "core-component-page": "^0.5",    "core-ajax": "^0.5",    "core-animated-pages": "^0.5",    "core-animation": "^0.5",    "web-animations-js": "1.0.6",    "core-collapse": "^0.5",    "core-doc-viewer": "^0.5",    "context-free-parser": "^0.5"  }} ===> ArchOvals1.html:<!doctype html>   <meta name="viewport"    content="width=device-width, minimum-scale=1.0, initial-scale=1.0, user-scalable=yes">  Archimedean Graphics               ===> PolyArchOvals1.html:

     
 On Tuesday, September 29, 2015 3:13 PM, Peter Burns <notifications@github.com> wrote:

Sorry, I don't see the attached zip file and I can't work out where exactly this is going wrong.Can you clarify how you're using polyup?— Reply to this email directly or view it on GitHub.

rictic commented 9 years ago

I don't think github comments support zip attachments.

What generates polymer.concat.js?

ocampesato commented 9 years ago

Peter, I don't have a file called polymer.concat.js - is that generated by the online version of polyup? I've also included inline copies of ArchOvals1.html, PolyArchOvals1.html, and bower.json. Can you check if you can launch ArchOvals1.html and see the graphics (after running bower install)? Oswald

 On Tuesday, September 29, 2015 6:14 PM, Peter Burns <notifications@github.com> wrote:

I don't think github comments support zip attachments.What generates polymer.concat.js?— Reply to this email directly or view it on GitHub.