This is an automated email from the ASF dual-hosted git repository.
harbs pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/royale-asjs.git
The following commit(s) were added to refs/heads/develop by this push:
new d540b1d423 finished single style beads, fixed color
d540b1d423 is described below
commit d540b1d423e9ddaf170a69e2cbdd965d963b1857
Author: Harbs <[email protected]>
AuthorDate: Wed Feb 25 18:12:50 2026 +0200
finished single style beads, fixed color
---
.../royale/style/stylebeads/SingleStyleBase.as | 4 +++
.../royale/style/stylebeads/StyleBeadBase.as | 30 ++++++++++++++++++++++
.../ForcedColorAdjust.as} | 18 +++++--------
.../style/stylebeads/background/BackgroundColor.as | 8 +++---
.../royale/style/stylebeads/border/BorderColor.as | 22 ++++------------
.../royale/style/stylebeads/border/OutlineColor.as | 22 ++++------------
.../style/stylebeads/interact/AccentColor.as | 28 ++++----------------
.../royale/style/stylebeads/interact/CaretColor.as | 28 ++++----------------
.../{background/BackgroundColor.as => svg/Fill.as} | 21 ++++++++-------
.../BackgroundColor.as => svg/Stroke.as} | 21 ++++++++-------
.../BackgroundColor.as => svg/StrokeWidth.as} | 20 +++++++--------
.../style/stylebeads/typography/TextColor.as | 23 +++++++----------
.../{colors/ColorPair.as => util/StyleData.as} | 15 ++++++-----
13 files changed, 113 insertions(+), 147 deletions(-)
diff --git
a/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/SingleStyleBase.as
b/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/SingleStyleBase.as
index cc65bea977..66396e0c79 100644
---
a/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/SingleStyleBase.as
+++
b/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/SingleStyleBase.as
@@ -18,6 +18,10 @@
////////////////////////////////////////////////////////////////////////////////
package org.apache.royale.style.stylebeads
{
+ import org.apache.royale.debugging.assert;
+ import org.apache.royale.style.util.CSSLookup;
+ import org.apache.royale.style.util.StyleData;
+
abstract public class SingleStyleBase extends StyleBeadBase
{
public function SingleStyleBase(selectorPrefix:String,
rulePrefix:String)
diff --git
a/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/StyleBeadBase.as
b/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/StyleBeadBase.as
index 9abec793f1..042431528c 100644
---
a/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/StyleBeadBase.as
+++
b/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/StyleBeadBase.as
@@ -21,6 +21,9 @@ package org.apache.royale.style.stylebeads
import org.apache.royale.core.Bead;
import org.apache.royale.style.IStyleUIBase;
import org.apache.royale.core.IStrand;
+ import org.apache.royale.debugging.assert;
+ import org.apache.royale.style.util.CSSLookup;
+ import org.apache.royale.style.util.StyleData;
abstract public class StyleBeadBase extends Bead implements IStyleBead
{
@@ -28,6 +31,33 @@ package org.apache.royale.style.stylebeads
{
super();
}
+ protected function
validateColor(value:*,supportsNone:Boolean):StyleData
+ {
+ if(!supportsNone && value == "none")
+ assert(false, "Invalid color value: " + value);
+
+ var selectorVal:String = "" + value;
+ var ruleVal:String = selectorVal;
+ switch(selectorVal)
+ {
+ case "transparent":
+ case "currentColor":
+ case "inherit":
+ case "none":
+ break;
+ case "black":
+ ruleVal = "#000";
+ break;
+ case "white":
+ ruleVal = "#fff";
+ break;
+ default:
+ assert(CSSLookup.has(selectorVal),
"Invalid color value: " + value);
+ ruleVal =
CSSLookup.getProperty(selectorVal);
+ break;
+ }
+ return new StyleData(selectorVal, ruleVal,value);
+ }
abstract public function get selectors():Array;
abstract public function get rules():Array;
}
diff --git
a/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/background/BackgroundColor.as
b/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/access/ForcedColorAdjust.as
similarity index 70%
copy from
frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/background/BackgroundColor.as
copy to
frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/access/ForcedColorAdjust.as
index c12cd2dae2..2fe200e5fc 100644
---
a/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/background/BackgroundColor.as
+++
b/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/access/ForcedColorAdjust.as
@@ -16,26 +16,22 @@
// limitations under the License.
//
////////////////////////////////////////////////////////////////////////////////
-package org.apache.royale.style.stylebeads.background
+package org.apache.royale.style.stylebeads.access
{
import org.apache.royale.style.stylebeads.SingleStyleBase;
import org.apache.royale.debugging.assert;
+ import org.apache.royale.style.util.CSSLookup;
- public class BackgroundColor extends SingleStyleBase
+ public class ForcedColorAdjust extends SingleStyleBase
{
- public function BackgroundColor()
+ public function ForcedColorAdjust()
{
- super("bg", "background-color");
- }
- private function toSelector(value:String):String
- {
- return value.replace(" ", "-");
+ super("forced-color-adjust", "forced-color-adjust");
}
override public function set value(value:*):void
{
- assert(["scroll","fixed","local"].indexOf(value) >= 0,
"Invalid value for background-attachment: " + value);
- calculatedRuleValue = _value = value;
- calculatedSelector = sanitizeSelector(value);
+ assert(["auto","none"].indexOf(value) != -1, "Invalid
value for forced-color-adjust: " + value);
+ calculatedRuleValue = calculatedSelector = _value =
value;
}
}
}
\ No newline at end of file
diff --git
a/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/background/BackgroundColor.as
b/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/background/BackgroundColor.as
index c12cd2dae2..881451a853 100644
---
a/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/background/BackgroundColor.as
+++
b/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/background/BackgroundColor.as
@@ -20,6 +20,7 @@ package org.apache.royale.style.stylebeads.background
{
import org.apache.royale.style.stylebeads.SingleStyleBase;
import org.apache.royale.debugging.assert;
+ import org.apache.royale.style.util.StyleData;
public class BackgroundColor extends SingleStyleBase
{
@@ -33,9 +34,10 @@ package org.apache.royale.style.stylebeads.background
}
override public function set value(value:*):void
{
- assert(["scroll","fixed","local"].indexOf(value) >= 0,
"Invalid value for background-attachment: " + value);
- calculatedRuleValue = _value = value;
- calculatedSelector = sanitizeSelector(value);
+ _value = value;
+ var styleData:StyleData = validateColor(value,false);
+ calculatedRuleValue = styleData.rule;
+ calculatedSelector = styleData.selector;
}
}
}
\ No newline at end of file
diff --git
a/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/border/BorderColor.as
b/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/border/BorderColor.as
index dc74afe203..68d393014c 100644
---
a/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/border/BorderColor.as
+++
b/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/border/BorderColor.as
@@ -20,7 +20,7 @@ package org.apache.royale.style.stylebeads.background
{
import org.apache.royale.style.stylebeads.SingleStyleBase;
import org.apache.royale.debugging.assert;
- import org.apache.royale.style.colors.ColorPair;
+ import org.apache.royale.style.util.StyleData;
public class BorderColor extends SingleStyleBase
{
@@ -33,22 +33,10 @@ package org.apache.royale.style.stylebeads.background
*/
override public function set value(value:*):void
{
- calculatedSelector = calculatedRuleValue = _value =
value;
- switch(value)
- {
- case "inherit":
- case "transparent":
- return;
- case "currentColor":
- calculatedSelector = "current";
- return;
- default:
- assert(value is ColorPair, "The value
must be a ColorPair: " + value);
- var pair:ColorPair = value as ColorPair;
- calculatedRuleValue = pair.value;
- calculatedSelector = pair.name;
- return;
- }
+ _value = value;
+ var styleData:StyleData = validateColor(value,false);
+ calculatedSelector = styleData.selector;
+ calculatedRuleValue = styleData.rule;
}
}
}
\ No newline at end of file
diff --git
a/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/border/OutlineColor.as
b/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/border/OutlineColor.as
index e70e09bebb..d433810719 100644
---
a/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/border/OutlineColor.as
+++
b/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/border/OutlineColor.as
@@ -20,7 +20,7 @@ package org.apache.royale.style.stylebeads.background
{
import org.apache.royale.style.stylebeads.SingleStyleBase;
import org.apache.royale.debugging.assert;
- import org.apache.royale.style.colors.ColorPair;
+ import org.apache.royale.style.util.StyleData;
public class OutlineColor extends SingleStyleBase
{
@@ -33,22 +33,10 @@ package org.apache.royale.style.stylebeads.background
*/
override public function set value(value:*):void
{
- calculatedSelector = calculatedRuleValue = _value =
value;
- switch(value)
- {
- case "inherit":
- case "transparent":
- return;
- case "currentColor":
- calculatedSelector = "current";
- return;
- default:
- assert(value is ColorPair, "The value
must be a ColorPair: " + value);
- var pair:ColorPair = value as ColorPair;
- calculatedRuleValue = pair.value;
- calculatedSelector = pair.name;
- return;
- }
+ _value = value;
+ var styleData:StyleData = validateColor(value,false);
+ calculatedRuleValue = styleData.rule;
+ calculatedSelector = styleData.selector;
}
}
}
\ No newline at end of file
diff --git
a/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/interact/AccentColor.as
b/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/interact/AccentColor.as
index a538401831..695aeffb6a 100644
---
a/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/interact/AccentColor.as
+++
b/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/interact/AccentColor.as
@@ -21,6 +21,7 @@ package org.apache.royale.style.stylebeads.interact
import org.apache.royale.style.stylebeads.SingleStyleBase;
import org.apache.royale.debugging.assert;
import org.apache.royale.style.util.CSSLookup;
+ import org.apache.royale.style.util.StyleData;
public class AccentColor extends SingleStyleBase
{
@@ -30,29 +31,10 @@ package org.apache.royale.style.stylebeads.interact
}
override public function set value(value:*):void
{
- var isVar:Boolean = CSSLookup.has(value);
- assert(isVar ||
['black','white','inherit','currentColor','transparent'].indexOf(value) != -1,
"Invalid value for accent-color: " + value);
- calculatedRuleValue = calculatedSelector = _value =
value;
- if(isVar)
- calculatedRuleValue =
CSSLookup.getProperty(value);
- else
- {
- switch(value)
- {
- case "black":
- calculatedRuleValue = "#000";
- break;
- case "white":
- calculatedRuleValue = "#fff";
- break;
- case "inherit":
- case "currentColor":
- case "transparent":
- break;
- default:
- assert(false, "Invalid value
for accent-color: " + value);
- }
- }
+ _value = value;
+ var styleData:StyleData = validateColor(value,false);
+ calculatedRuleValue = styleData.rule;
+ calculatedSelector = styleData.selector;
}
}
}
\ No newline at end of file
diff --git
a/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/interact/CaretColor.as
b/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/interact/CaretColor.as
index 41bad6de76..89f05b68dc 100644
---
a/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/interact/CaretColor.as
+++
b/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/interact/CaretColor.as
@@ -21,6 +21,7 @@ package org.apache.royale.style.stylebeads.interact
import org.apache.royale.style.stylebeads.SingleStyleBase;
import org.apache.royale.debugging.assert;
import org.apache.royale.style.util.CSSLookup;
+ import org.apache.royale.style.util.StyleData;
public class CaretColor extends SingleStyleBase
{
@@ -30,29 +31,10 @@ package org.apache.royale.style.stylebeads.interact
}
override public function set value(value:*):void
{
- var isVar:Boolean = CSSLookup.has(value);
- assert(isVar ||
['black','white','inherit','currentColor','transparent'].indexOf(value) != -1,
"Invalid value for accent-color: " + value);
- calculatedRuleValue = calculatedSelector = _value =
value;
- if(isVar)
- calculatedRuleValue =
CSSLookup.getProperty(value);
- else
- {
- switch(value)
- {
- case "black":
- calculatedRuleValue = "#000";
- break;
- case "white":
- calculatedRuleValue = "#fff";
- break;
- case "inherit":
- case "currentColor":
- case "transparent":
- break;
- default:
- assert(false, "Invalid value
for accent-color: " + value);
- }
- }
+ _value = value;
+ var styleData:StyleData = validateColor(value,false);
+ calculatedRuleValue = styleData.rule;
+ calculatedSelector = styleData.selector;
}
}
}
\ No newline at end of file
diff --git
a/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/background/BackgroundColor.as
b/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/svg/Fill.as
similarity index 70%
copy from
frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/background/BackgroundColor.as
copy to
frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/svg/Fill.as
index c12cd2dae2..6aba1cd329 100644
---
a/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/background/BackgroundColor.as
+++
b/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/svg/Fill.as
@@ -16,26 +16,25 @@
// limitations under the License.
//
////////////////////////////////////////////////////////////////////////////////
-package org.apache.royale.style.stylebeads.background
+package org.apache.royale.style.stylebeads.svg
{
import org.apache.royale.style.stylebeads.SingleStyleBase;
import org.apache.royale.debugging.assert;
+ import org.apache.royale.style.util.CSSLookup;
+ import org.apache.royale.style.util.StyleData;
- public class BackgroundColor extends SingleStyleBase
+ public class Fill extends SingleStyleBase
{
- public function BackgroundColor()
+ public function Fill()
{
- super("bg", "background-color");
- }
- private function toSelector(value:String):String
- {
- return value.replace(" ", "-");
+ super("fill", "fill");
}
override public function set value(value:*):void
{
- assert(["scroll","fixed","local"].indexOf(value) >= 0,
"Invalid value for background-attachment: " + value);
- calculatedRuleValue = _value = value;
- calculatedSelector = sanitizeSelector(value);
+ _value = value;
+ var styleData:StyleData = validateColor(value,true);
+ calculatedRuleValue = styleData.rule;
+ calculatedSelector = styleData.selector;
}
}
}
\ No newline at end of file
diff --git
a/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/background/BackgroundColor.as
b/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/svg/Stroke.as
similarity index 70%
copy from
frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/background/BackgroundColor.as
copy to
frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/svg/Stroke.as
index c12cd2dae2..bc23c1d6c1 100644
---
a/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/background/BackgroundColor.as
+++
b/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/svg/Stroke.as
@@ -16,26 +16,25 @@
// limitations under the License.
//
////////////////////////////////////////////////////////////////////////////////
-package org.apache.royale.style.stylebeads.background
+package org.apache.royale.style.stylebeads.svg
{
import org.apache.royale.style.stylebeads.SingleStyleBase;
import org.apache.royale.debugging.assert;
+ import org.apache.royale.style.util.CSSLookup;
+ import org.apache.royale.style.util.StyleData;
- public class BackgroundColor extends SingleStyleBase
+ public class Stroke extends SingleStyleBase
{
- public function BackgroundColor()
+ public function Stroke()
{
- super("bg", "background-color");
- }
- private function toSelector(value:String):String
- {
- return value.replace(" ", "-");
+ super("stroke", "stroke");
}
override public function set value(value:*):void
{
- assert(["scroll","fixed","local"].indexOf(value) >= 0,
"Invalid value for background-attachment: " + value);
- calculatedRuleValue = _value = value;
- calculatedSelector = sanitizeSelector(value);
+ _value = value;
+ var styleData:StyleData = validateColor(value,true);
+ calculatedRuleValue = styleData.rule;
+ calculatedSelector = styleData.selector;
}
}
}
\ No newline at end of file
diff --git
a/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/background/BackgroundColor.as
b/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/svg/StrokeWidth.as
similarity index 70%
copy from
frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/background/BackgroundColor.as
copy to
frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/svg/StrokeWidth.as
index c12cd2dae2..8579c2a9eb 100644
---
a/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/background/BackgroundColor.as
+++
b/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/svg/StrokeWidth.as
@@ -16,26 +16,24 @@
// limitations under the License.
//
////////////////////////////////////////////////////////////////////////////////
-package org.apache.royale.style.stylebeads.background
+package org.apache.royale.style.stylebeads.svg
{
import org.apache.royale.style.stylebeads.SingleStyleBase;
import org.apache.royale.debugging.assert;
+ import org.apache.royale.style.util.CSSLookup;
- public class BackgroundColor extends SingleStyleBase
+ public class StrokeWidth extends SingleStyleBase
{
- public function BackgroundColor()
+ public function StrokeWidth()
{
- super("bg", "background-color");
- }
- private function toSelector(value:String):String
- {
- return value.replace(" ", "-");
+ super("stroke", "stroke-width");
}
override public function set value(value:*):void
{
- assert(["scroll","fixed","local"].indexOf(value) >= 0,
"Invalid value for background-attachment: " + value);
- calculatedRuleValue = _value = value;
- calculatedSelector = sanitizeSelector(value);
+ //TODO validate value
+ calculatedRuleValue = calculatedSelector = _value =
value;
+ if(CSSLookup.has(value))
+ calculatedRuleValue =
CSSLookup.getProperty(value);
}
}
}
\ No newline at end of file
diff --git
a/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/typography/TextColor.as
b/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/typography/TextColor.as
index 57feb3562e..fac0141a58 100644
---
a/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/typography/TextColor.as
+++
b/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/typography/TextColor.as
@@ -19,27 +19,22 @@
package org.apache.royale.style.stylebeads.typography
{
import org.apache.royale.style.stylebeads.StyleBeadBase;
+ import org.apache.royale.style.stylebeads.SingleStyleBase;
+ import org.apache.royale.style.util.StyleData;
- public class TextColor extends StyleBeadBase
+ public class TextColor extends SingleStyleBase
{
public function TextColor()
{
- super();
+ super("text", "color");
}
- /**
- * TODO: Figure this out
- * https://tailwindcss.com/docs/color
- */
-
- override public function get selectors():Array
- {
- return [];
- }
-
- override public function get rules():Array
+ override public function set value(value:*):void
{
- return [];
+ _value = value;
+ var styleData:StyleData = validateColor(value,false);
+ calculatedRuleValue = styleData.rule;
+ calculatedSelector = styleData.selector;
}
}
}
\ No newline at end of file
diff --git
a/frameworks/projects/Style/src/main/royale/org/apache/royale/style/colors/ColorPair.as
b/frameworks/projects/Style/src/main/royale/org/apache/royale/style/util/StyleData.as
similarity index 76%
rename from
frameworks/projects/Style/src/main/royale/org/apache/royale/style/colors/ColorPair.as
rename to
frameworks/projects/Style/src/main/royale/org/apache/royale/style/util/StyleData.as
index 2d81c742c4..bbd8343771 100644
---
a/frameworks/projects/Style/src/main/royale/org/apache/royale/style/colors/ColorPair.as
+++
b/frameworks/projects/Style/src/main/royale/org/apache/royale/style/util/StyleData.as
@@ -16,17 +16,20 @@
// limitations under the License.
//
////////////////////////////////////////////////////////////////////////////////
-package org.apache.royale.style.colors
+package org.apache.royale.style.util
{
- public class ColorPair
+ public class StyleData
{
- public function ColorPair(name:String, value:String)
+ public function StyleData(selector:String, rule:String,
value:String, negative:Boolean = false)
{
- super();
- this.name = name;
+ this.selector = selector;
+ this.rule = rule;
this.value = value;
+ this.negative = negative;
}
- public var name:String;
+ public var selector:String;
+ public var rule:String;
public var value:String;
+ public var negative:Boolean;
}
}
\ No newline at end of file