royale-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From carlosrov...@apache.org
Subject [royale-asjs] 20/24: fix new classlist utility methods
Date Sun, 18 Mar 2018 15:38:34 GMT
This is an automated email from the ASF dual-hosted git repository.

carlosrovira pushed a commit to branch feature/jewel-ui-set
in repository https://gitbox.apache.org/repos/asf/royale-asjs.git

commit ea46b06ade2ab7441b894487876d637672c4e0b4
Author: Carlos Rovira <carlosrovira@apache.org>
AuthorDate: Fri Mar 16 16:05:16 2018 +0100

    fix new classlist utility methods
---
 examples/royale/JewelExample/pom.xml                |  4 ++--
 .../apache/royale/utils/cssclasslist/addStyles.as   | 12 ++++++++----
 .../royale/utils/cssclasslist/removeAllStyles.as    | 10 +++++++---
 .../royale/utils/cssclasslist/removeStyles.as       | 12 ++++++++----
 .../apache/royale/utils/cssclasslist/toggleStyle.as | 10 +++++++---
 .../main/royale/org/apache/royale/core/UIBase.as    |  2 +-
 .../main/royale/org/apache/royale/jewel/Button.as   |  6 +++---
 .../Jewel/src/main/sass/jewel-framework.sass        | 21 ---------------------
 .../JewelTheme/src/main/resources/defaults.css      |  1 -
 .../JewelTheme/src/main/sass/components/_label.sass |  2 +-
 10 files changed, 37 insertions(+), 43 deletions(-)

diff --git a/examples/royale/JewelExample/pom.xml b/examples/royale/JewelExample/pom.xml
index 31fd5b8..19f1837 100644
--- a/examples/royale/JewelExample/pom.xml
+++ b/examples/royale/JewelExample/pom.xml
@@ -97,13 +97,13 @@
       <type>swc</type>
       <scope>theme</scope>
     </dependency>
-    <!-- <dependency>
+    <dependency>
       <groupId>org.apache.royale.framework</groupId>
       <artifactId>JewelBlueTheme</artifactId>
       <version>0.9.3-SNAPSHOT</version>
       <type>swc</type>
       <scope>theme</scope>
-    </dependency> -->
+    </dependency>
   </dependencies>
 
 </project>
diff --git a/frameworks/projects/Core/src/main/royale/org/apache/royale/utils/cssclasslist/addStyles.as
b/frameworks/projects/Core/src/main/royale/org/apache/royale/utils/cssclasslist/addStyles.as
index aa995a0..aa07062 100644
--- a/frameworks/projects/Core/src/main/royale/org/apache/royale/utils/cssclasslist/addStyles.as
+++ b/frameworks/projects/Core/src/main/royale/org/apache/royale/utils/cssclasslist/addStyles.as
@@ -18,7 +18,10 @@
 ////////////////////////////////////////////////////////////////////////////////
 package org.apache.royale.utils.cssclasslist
 {
-    import org.apache.royale.core.IUIBase;
+    COMPILE::JS
+    {
+        import org.apache.royale.core.WrappedHTMLElement;
+    }
     
     /**
      *  Add one or more styles to the component. If the specified class already 
@@ -30,17 +33,18 @@ package org.apache.royale.utils.cssclasslist
      *  @langversion 3.0
      *  @productversion Royale 0.9.3
      */
-    public function addStyles(wrapper:IUIBase, value:String):void
+    COMPILE::JS
+    public function addStyles(element:WrappedHTMLElement, value:String):void
     {
         if (value == "") return;
         
         if (value.indexOf(" ") >= 0)
         {
             var classes:Array = value.split(" ");
-            wrapper.element.classList.add.apply(wrapper.element.classList, classes);
+            element.classList.add.apply(element.classList, classes);
         } else
         {
-            wrapper.element.classList.add(value);
+            element.classList.add(value);
         }
     }
 
diff --git a/frameworks/projects/Core/src/main/royale/org/apache/royale/utils/cssclasslist/removeAllStyles.as
b/frameworks/projects/Core/src/main/royale/org/apache/royale/utils/cssclasslist/removeAllStyles.as
index 4d19c79..fc34fde 100644
--- a/frameworks/projects/Core/src/main/royale/org/apache/royale/utils/cssclasslist/removeAllStyles.as
+++ b/frameworks/projects/Core/src/main/royale/org/apache/royale/utils/cssclasslist/removeAllStyles.as
@@ -18,7 +18,10 @@
 ////////////////////////////////////////////////////////////////////////////////
 package org.apache.royale.utils.cssclasslist
 {
-    import org.apache.royale.core.IUIBase;
+    COMPILE::JS
+    {
+        import org.apache.royale.core.WrappedHTMLElement;
+    }
 
     /**
      *  Removes all styles
@@ -28,9 +31,10 @@ package org.apache.royale.utils.cssclasslist
      *  @playerversion AIR 2.6
      *  @productversion Royale 0.9.3
      */
-    public function removeAllStyles(wrapper:IUIBase):void
+    COMPILE::JS
+    public function removeAllStyles(element:WrappedHTMLElement):void
     {
-        var classList:DOMTokenList = wrapper.element.classList;
+        var classList:DOMTokenList = element.classList;
         var i:int;
         for( i = classList.length -1; i > 0; i-- )
         {
diff --git a/frameworks/projects/Core/src/main/royale/org/apache/royale/utils/cssclasslist/removeStyles.as
b/frameworks/projects/Core/src/main/royale/org/apache/royale/utils/cssclasslist/removeStyles.as
index 21f59e0..badf5dd 100644
--- a/frameworks/projects/Core/src/main/royale/org/apache/royale/utils/cssclasslist/removeStyles.as
+++ b/frameworks/projects/Core/src/main/royale/org/apache/royale/utils/cssclasslist/removeStyles.as
@@ -18,7 +18,10 @@
 ////////////////////////////////////////////////////////////////////////////////
 package org.apache.royale.utils.cssclasslist
 {
-    import org.apache.royale.core.IUIBase;
+    COMPILE::JS
+    {
+        import org.apache.royale.core.WrappedHTMLElement;
+    }
 
     /**
      *  Removes one or more styles from the component. Removing a class that does not 
@@ -30,17 +33,18 @@ package org.apache.royale.utils.cssclasslist
      *  @langversion 3.0
      *  @productversion Royale 0.9.3
      */
-    public function removeStyles(wrapper:IUIBase, value:String):void
+    COMPILE::JS
+    public function removeStyles(element:WrappedHTMLElement, value:String):void
     {
         if (value == "") return;
 
         if (value.indexOf(" ") >= 0)
         {
             var classes:Array = value.split(" ");
-            wrapper.element.classList.remove.apply(wrapper.element.classList, classes);
+            element.classList.remove.apply(element.classList, classes);
         } else
         {
-            wrapper.element.classList.remove(value);
+            element.classList.remove(value);
         }
     }
 }
diff --git a/frameworks/projects/Core/src/main/royale/org/apache/royale/utils/cssclasslist/toggleStyle.as
b/frameworks/projects/Core/src/main/royale/org/apache/royale/utils/cssclasslist/toggleStyle.as
index 8ef9224..85d7331 100644
--- a/frameworks/projects/Core/src/main/royale/org/apache/royale/utils/cssclasslist/toggleStyle.as
+++ b/frameworks/projects/Core/src/main/royale/org/apache/royale/utils/cssclasslist/toggleStyle.as
@@ -18,7 +18,10 @@
 ////////////////////////////////////////////////////////////////////////////////
 package org.apache.royale.utils.cssclasslist
 {
-    import org.apache.royale.core.IUIBase;
+    COMPILE::JS
+    {
+        import org.apache.royale.core.WrappedHTMLElement;
+    }
 
     /**
      *  Adds or removes a single style. 
@@ -32,8 +35,9 @@ package org.apache.royale.utils.cssclasslist
      *  @langversion 3.0
      *  @productversion Royale 0.9.3
      */
-    public function toggleStyle(wrapper:IUIBase, value:String, force:Boolean = false):Boolean
+    COMPILE::JS
+    public function toggleStyle(element:WrappedHTMLElement, value:String, force:Boolean =
false):Boolean
     {
-        return wrapper.element.classList.toggle(value, force);
+        return element.classList.toggle(value, force);
     }
 }
diff --git a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/core/UIBase.as b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/core/UIBase.as
index c14e113..7b37fab 100644
--- a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/core/UIBase.as
+++ b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/core/UIBase.as
@@ -1085,7 +1085,7 @@ package org.apache.royale.core
         COMPILE::JS
         protected function setClassName(value:String):void
         {
-            addStyles(this, value);
+            addStyles(element, value);
         }
 
         
diff --git a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/Button.as b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/Button.as
index 4059764..2d5c831 100644
--- a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/Button.as
+++ b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/Button.as
@@ -88,7 +88,7 @@ package org.apache.royale.jewel
 
                 COMPILE::JS
                 {
-                    toggleStyle(this, "primary", value);
+                    toggleStyle(element, "primary", value);
                 }
             }
         }
@@ -118,7 +118,7 @@ package org.apache.royale.jewel
 
                 COMPILE::JS
                 {
-                    toggleStyle(this, "secondary", value);
+                    toggleStyle(element, "secondary", value);
                 }
             }
         }
@@ -148,7 +148,7 @@ package org.apache.royale.jewel
 
                 COMPILE::JS
                 {
-                    toggleStyle(this, "emphasized", value);
+                    toggleStyle(element, "emphasized", value);
                 }
             }
         }
diff --git a/frameworks/projects/Jewel/src/main/sass/jewel-framework.sass b/frameworks/projects/Jewel/src/main/sass/jewel-framework.sass
deleted file mode 100644
index 10e81d9..0000000
--- a/frameworks/projects/Jewel/src/main/sass/jewel-framework.sass
+++ /dev/null
@@ -1,21 +0,0 @@
-/**
- *  Licensed to the Apache Software Foundation (ASF) under one or more
- *  contributor license agreements.  See the NOTICE file distributed with
- *  this work for additional information regarding copyright ownership.
- *  The ASF licenses this file to You under the Apache License, Version 2.0
- *  (the "License"); you may not use this file except in compliance with
- *  the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- */
-
-// Variables
-    
-// Global
-@import "global"
diff --git a/frameworks/themes/JewelTheme/src/main/resources/defaults.css b/frameworks/themes/JewelTheme/src/main/resources/defaults.css
index 9022239..714ec69 100644
--- a/frameworks/themes/JewelTheme/src/main/resources/defaults.css
+++ b/frameworks/themes/JewelTheme/src/main/resources/defaults.css
@@ -221,7 +221,6 @@
  * Jewel Label
  */
 .jewel.label {
-  IBeadView: ClassReference("org.apache.royale.beads.views.LabelViewBead");
   font-family: "Lato", sans-serif;
   font-size: 0.75rem;
 }
diff --git a/frameworks/themes/JewelTheme/src/main/sass/components/_label.sass b/frameworks/themes/JewelTheme/src/main/sass/components/_label.sass
index 27906d1..bb933f8 100644
--- a/frameworks/themes/JewelTheme/src/main/sass/components/_label.sass
+++ b/frameworks/themes/JewelTheme/src/main/sass/components/_label.sass
@@ -22,7 +22,7 @@
  */
 .jewel.label
 	//IBeadView: ClassReference("org.apache.royale.html.beads.TextFieldView")
-	IBeadView: ClassReference("org.apache.royale.beads.views.LabelViewBead")
+	//IBeadView: ClassReference("org.apache.royale.beads.views.LabelViewBead")
 	font:
 		family: $font-stack
 		size: $font-size
\ No newline at end of file

-- 
To stop receiving notification emails like this one, please contact
carlosrovira@apache.org.

Mime
View raw message