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 83b6756c24 size style beads
83b6756c24 is described below
commit 83b6756c24d1a064d98f6e6cbafb590af256da83
Author: Harbs <[email protected]>
AuthorDate: Sun Feb 22 15:52:36 2026 +0200
size style beads
---
.../Style/src/main/resources/basic-manifest.xml | 11 +++-
.../royale/style/stylebeads/FlexContainerStyle.as | 14 ----
.../stylebeads/{SizeStyle.as => HeightStyle.as} | 22 +++----
.../stylebeads/{SizeStyle.as => MaxHeight.as} | 22 +++----
.../style/stylebeads/{SizeStyle.as => MaxWidth.as} | 28 ++++----
.../style/stylebeads/MeasurementStyleBase.as | 74 ++++++++++++++++++++++
.../stylebeads/{SizeStyle.as => MinHeight.as} | 22 +++----
.../style/stylebeads/{SizeStyle.as => MinWidth.as} | 28 ++++----
.../apache/royale/style/stylebeads/SizeStyle.as | 20 +++---
.../stylebeads/{SizeStyle.as => WidthStyle.as} | 22 +++----
.../MeasurementStyleBase.as => util/ContentFit.as} | 28 ++++----
11 files changed, 170 insertions(+), 121 deletions(-)
diff --git a/frameworks/projects/Style/src/main/resources/basic-manifest.xml
b/frameworks/projects/Style/src/main/resources/basic-manifest.xml
index cd0f5b46b7..9125edab90 100644
--- a/frameworks/projects/Style/src/main/resources/basic-manifest.xml
+++ b/frameworks/projects/Style/src/main/resources/basic-manifest.xml
@@ -20,5 +20,14 @@
<componentPackage>
-
+ <component id="FlexContainerStyle"
class="org.apache.royale.style.stylebeads.FlexContainerStyle"/>
+ <component id="FlexItemStyle"
class="org.apache.royale.style.stylebeads.FlexItemStyle"/>
+ <component id="HeightStyle"
class="org.apache.royale.style.stylebeads.HeightStyle"/>
+ <component id="MaxHeight"
class="org.apache.royale.style.stylebeads.MaxHeight"/>
+ <component id="MaxWidth"
class="org.apache.royale.style.stylebeads.MaxWidth"/>
+ <component id="MinHeight"
class="org.apache.royale.style.stylebeads.MinHeight"/>
+ <component id="MinWidth"
class="org.apache.royale.style.stylebeads.MinWidth"/>
+ <component id="PositionStyle"
class="org.apache.royale.style.stylebeads.PositionStyle"/>
+ <component id="SizeStyle"
class="org.apache.royale.style.stylebeads.SizeStyle"/>
+ <component id="WidthStyle"
class="org.apache.royale.style.stylebeads.WidthStyle"/>
</componentPackage>
diff --git
a/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/FlexContainerStyle.as
b/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/FlexContainerStyle.as
index fa128c7491..ae7f35b424 100644
---
a/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/FlexContainerStyle.as
+++
b/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/FlexContainerStyle.as
@@ -96,20 +96,6 @@ package org.apache.royale.style.stylebeads
private var _value:String;
- /**
- * Possible selectors:
- * flex-direction if wrap is undefined.
- * flex-flow: row nowrap | row wrap | row wrap-reverse | column
nowrap | column wrap | column wrap-reverse
- * flex-flow: row;
-flex-flow: row-reverse;
-flex-flow: column;
-flex-flow: column-reverse;
-
-
-flex-flow: row nowrap;
-flex-flow: column wrap;
-flex-flow: column-reverse wrap-reverse;
- */
private function stringify(sep:String):String
{
var wrapStr:String = wrap ? "wrap" : "nowrap";
diff --git
a/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/SizeStyle.as
b/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/HeightStyle.as
similarity index 72%
copy from
frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/SizeStyle.as
copy to
frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/HeightStyle.as
index 3b0ef87be9..4c821e06cf 100644
---
a/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/SizeStyle.as
+++
b/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/HeightStyle.as
@@ -18,36 +18,32 @@
////////////////////////////////////////////////////////////////////////////////
package org.apache.royale.style.stylebeads
{
- public class SizeStyle extends StyleBeadBase
+ public class HeightStyle extends MeasurementStyleBase
{
- public function SizeStyle()
+ public function HeightStyle()
{
super();
}
- private var _value:String;
- //TODO:
- [[Inspectable(category="General", enumeration="",
defaultValue="")]]
- public function get value():String
+ [[Inspectable(category="General",
enumeration="max-content,min-content,fit-content,stretch,none,65ch,640px,768px,1024px,1280px,1536px",
defaultValue="none")]]
+ public function get fit():String
{
- return _value;
+ return _strVal;
}
- public function set value(value:String):void
+ public function set fit(value:String):void
{
- _value = value;
+ _strVal = value;
}
override public function get selectors():Array
{
- return ["." + value];
+ return [".h-" + toSelector()];
}
override public function get rules():Array
{
- //TODO
- return null;
+ return ["height:" + toRuleVal() + ";"];
}
-
}
}
\ No newline at end of file
diff --git
a/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/SizeStyle.as
b/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/MaxHeight.as
similarity index 74%
copy from
frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/SizeStyle.as
copy to
frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/MaxHeight.as
index 3b0ef87be9..bf023d6d83 100644
---
a/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/SizeStyle.as
+++
b/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/MaxHeight.as
@@ -18,36 +18,32 @@
////////////////////////////////////////////////////////////////////////////////
package org.apache.royale.style.stylebeads
{
- public class SizeStyle extends StyleBeadBase
+ public class MaxHeight extends MeasurementStyleBase
{
- public function SizeStyle()
+ public function MaxHeight()
{
super();
}
- private var _value:String;
- //TODO:
- [[Inspectable(category="General", enumeration="",
defaultValue="")]]
- public function get value():String
+ [[Inspectable(category="General",
enumeration="max-content,min-content,fit-content,stretch,none",
defaultValue="none")]]
+ public function get fit():String
{
- return _value;
+ return _strVal;
}
- public function set value(value:String):void
+ public function set fit(value:String):void
{
- _value = value;
+ _strVal = value;
}
override public function get selectors():Array
{
- return ["." + value];
+ return [".max-h-" + toSelector()];
}
override public function get rules():Array
{
- //TODO
- return null;
+ return ["max-height:" + toRuleVal() + ";"];
}
-
}
}
\ No newline at end of file
diff --git
a/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/SizeStyle.as
b/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/MaxWidth.as
similarity index 61%
copy from
frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/SizeStyle.as
copy to
frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/MaxWidth.as
index 3b0ef87be9..7fc4fb6197 100644
---
a/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/SizeStyle.as
+++
b/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/MaxWidth.as
@@ -18,36 +18,38 @@
////////////////////////////////////////////////////////////////////////////////
package org.apache.royale.style.stylebeads
{
- public class SizeStyle extends StyleBeadBase
+ public class MaxWidth extends MeasurementStyleBase
{
- public function SizeStyle()
+ public static const PROSE:String = "65ch";
+ public static const SCREEN_SM:String = "640px";
+ public static const SCREEN_MD:String = "768px";
+ public static const SCREEN_LG:String = "1024px";
+ public static const SCREEN_XL:String = "1280px";
+ public static const SCREEN_2XL:String = "1536px";
+ public function MaxWidth()
{
super();
}
- private var _value:String;
- //TODO:
- [[Inspectable(category="General", enumeration="",
defaultValue="")]]
- public function get value():String
+ [[Inspectable(category="General",
enumeration="max-content,min-content,fit-content,stretch,none,65ch,640px,768px,1024px,1280px,1536px",
defaultValue="none")]]
+ public function get fit():String
{
- return _value;
+ return _strVal;
}
- public function set value(value:String):void
+ public function set fit(value:String):void
{
- _value = value;
+ _strVal = value;
}
override public function get selectors():Array
{
- return ["." + value];
+ return [".max-w-" + toSelector()];
}
override public function get rules():Array
{
- //TODO
- return null;
+ return ["max-width:" + toRuleVal() + ";"];
}
-
}
}
\ No newline at end of file
diff --git
a/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/MeasurementStyleBase.as
b/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/MeasurementStyleBase.as
index c401d31c74..f7c934432d 100644
---
a/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/MeasurementStyleBase.as
+++
b/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/MeasurementStyleBase.as
@@ -19,6 +19,7 @@
package org.apache.royale.style.stylebeads
{
import org.apache.royale.style.util.CSSUnit;
+ import org.apache.royale.debugging.assert;
abstract public class MeasurementStyleBase extends StyleBeadBase
implements IMeasurementStyleBead
{
@@ -26,6 +27,8 @@ package org.apache.royale.style.stylebeads
{
super();
}
+
+ protected var _strVal:String;
private var _unit:String;
public function get unit():String
@@ -37,5 +40,76 @@ package org.apache.royale.style.stylebeads
{
_unit = value;
}
+
+ private var _percentSize:Number;
+ /**
+ * The percent size of the measurement.
+ */
+ public function get percentSize():Number
+ {
+ return _percentSize;
+ }
+
+ public function set percentSize(value:Number):void
+ {
+ _percentSize = Math.round(value * 100) / 100;
+ }
+
+ public function get fractionalSize():Number
+ {
+ return isNaN(_percentSize) ? 0 : _percentSize / 100;
+ }
+
+ public function set fractionalSize(value:Number):void
+ {
+ percentSize = value * 100;
+ }
+
+ private var _stepSize:Number = 4;
+
+ public function get stepSize():Number
+ {
+ return _stepSize;
+ }
+
+ public function set stepSize(value:Number):void
+ {
+ _stepSize = value;
+ }
+
+ private var _stepValue:Number;
+ [Inspectable(category="General", defaultValue="NaN",
minValue="0", maxValue="1000")]
+ public function get stepValue():Number
+ {
+ return _stepValue;
+ }
+ public function set stepValue(value:Number):void
+ {
+ _stepValue = value;
+ }
+ protected function toSelector():String
+ {
+ if (!isNaN(_percentSize))
+ return percentSize + "%";
+ if (!isNaN(_stepValue))
+ return unit + "-" + stepSize + "-" + stepValue;
+ if(_strVal)
+ return _strVal;
+
+ assert(false, "MeasurementStyleBase: No valid
measurement value.");
+ return "";
+ }
+ protected function toRuleVal():String
+ {
+ if (!isNaN(_percentSize))
+ return percentSize + "%";
+ if (!isNaN(_stepValue))
+ return (stepValue*stepSize) + unit;
+ if(_strVal)
+ return _strVal;
+
+ return "";
+ }
+
}
}
\ No newline at end of file
diff --git
a/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/SizeStyle.as
b/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/MinHeight.as
similarity index 72%
copy from
frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/SizeStyle.as
copy to
frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/MinHeight.as
index 3b0ef87be9..d3761c40dd 100644
---
a/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/SizeStyle.as
+++
b/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/MinHeight.as
@@ -18,36 +18,32 @@
////////////////////////////////////////////////////////////////////////////////
package org.apache.royale.style.stylebeads
{
- public class SizeStyle extends StyleBeadBase
+ public class MinHeight extends MeasurementStyleBase
{
- public function SizeStyle()
+ public function MinHeight()
{
super();
}
- private var _value:String;
- //TODO:
- [[Inspectable(category="General", enumeration="",
defaultValue="")]]
- public function get value():String
+ [[Inspectable(category="General",
enumeration="max-content,min-content,fit-content,stretch,none,65ch,640px,768px,1024px,1280px,1536px",
defaultValue="none")]]
+ public function get fit():String
{
- return _value;
+ return _strVal;
}
- public function set value(value:String):void
+ public function set fit(value:String):void
{
- _value = value;
+ _strVal = value;
}
override public function get selectors():Array
{
- return ["." + value];
+ return [".min-w-" + toSelector()];
}
override public function get rules():Array
{
- //TODO
- return null;
+ return ["min-width:" + toRuleVal() + ";"];
}
-
}
}
\ No newline at end of file
diff --git
a/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/SizeStyle.as
b/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/MinWidth.as
similarity index 61%
copy from
frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/SizeStyle.as
copy to
frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/MinWidth.as
index 3b0ef87be9..3b987524b3 100644
---
a/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/SizeStyle.as
+++
b/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/MinWidth.as
@@ -18,36 +18,38 @@
////////////////////////////////////////////////////////////////////////////////
package org.apache.royale.style.stylebeads
{
- public class SizeStyle extends StyleBeadBase
+ public class MinWidth extends MeasurementStyleBase
{
- public function SizeStyle()
+ public static const PROSE:String = "65ch";
+ public static const SCREEN_SM:String = "640px";
+ public static const SCREEN_MD:String = "768px";
+ public static const SCREEN_LG:String = "1024px";
+ public static const SCREEN_XL:String = "1280px";
+ public static const SCREEN_2XL:String = "1536px";
+ public function MinWidth()
{
super();
}
- private var _value:String;
- //TODO:
- [[Inspectable(category="General", enumeration="",
defaultValue="")]]
- public function get value():String
+ [[Inspectable(category="General",
enumeration="max-content,min-content,fit-content,stretch,none,65ch,640px,768px,1024px,1280px,1536px",
defaultValue="none")]]
+ public function get fit():String
{
- return _value;
+ return _strVal;
}
- public function set value(value:String):void
+ public function set fit(value:String):void
{
- _value = value;
+ _strVal = value;
}
override public function get selectors():Array
{
- return ["." + value];
+ return [".min-w-" + toSelector()];
}
override public function get rules():Array
{
- //TODO
- return null;
+ return ["min-width:" + toRuleVal() + ";"];
}
-
}
}
\ No newline at end of file
diff --git
a/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/SizeStyle.as
b/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/SizeStyle.as
index 3b0ef87be9..b36b329f81 100644
---
a/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/SizeStyle.as
+++
b/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/SizeStyle.as
@@ -18,35 +18,33 @@
////////////////////////////////////////////////////////////////////////////////
package org.apache.royale.style.stylebeads
{
- public class SizeStyle extends StyleBeadBase
+ public class SizeStyle extends MeasurementStyleBase
{
public function SizeStyle()
{
super();
}
- private var _value:String;
- //TODO:
- [[Inspectable(category="General", enumeration="",
defaultValue="")]]
- public function get value():String
+ [[Inspectable(category="General",
enumeration="max-content,min-content,fit-content,stretch,none,65ch,640px,768px,1024px,1280px,1536px",
defaultValue="none")]]
+ public function get fit():String
{
- return _value;
+ return _strVal;
}
- public function set value(value:String):void
+ public function set fit(value:String):void
{
- _value = value;
+ _strVal = value;
}
override public function get selectors():Array
{
- return ["." + value];
+ return [".size-" + toSelector()];
}
override public function get rules():Array
{
- //TODO
- return null;
+ var val:String = toRuleVal();
+ return ["width:" + val + ";", "height:" + val + ";"];
}
}
diff --git
a/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/SizeStyle.as
b/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/WidthStyle.as
similarity index 72%
copy from
frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/SizeStyle.as
copy to
frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/WidthStyle.as
index 3b0ef87be9..fcced82554 100644
---
a/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/SizeStyle.as
+++
b/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/WidthStyle.as
@@ -18,36 +18,32 @@
////////////////////////////////////////////////////////////////////////////////
package org.apache.royale.style.stylebeads
{
- public class SizeStyle extends StyleBeadBase
+ public class WidthStyle extends MeasurementStyleBase
{
- public function SizeStyle()
+ public function WidthStyle()
{
super();
}
- private var _value:String;
- //TODO:
- [[Inspectable(category="General", enumeration="",
defaultValue="")]]
- public function get value():String
+ [[Inspectable(category="General",
enumeration="max-content,min-content,fit-content,stretch,none,65ch,640px,768px,1024px,1280px,1536px",
defaultValue="none")]]
+ public function get fit():String
{
- return _value;
+ return _strVal;
}
- public function set value(value:String):void
+ public function set fit(value:String):void
{
- _value = value;
+ _strVal = value;
}
override public function get selectors():Array
{
- return ["." + value];
+ return [".w-" + toSelector()];
}
override public function get rules():Array
{
- //TODO
- return null;
+ return ["width:" + toRuleVal() + ";"];
}
-
}
}
\ No newline at end of file
diff --git
a/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/MeasurementStyleBase.as
b/frameworks/projects/Style/src/main/royale/org/apache/royale/style/util/ContentFit.as
similarity index 67%
copy from
frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/MeasurementStyleBase.as
copy to
frameworks/projects/Style/src/main/royale/org/apache/royale/style/util/ContentFit.as
index c401d31c74..8512bfb85b 100644
---
a/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/MeasurementStyleBase.as
+++
b/frameworks/projects/Style/src/main/royale/org/apache/royale/style/util/ContentFit.as
@@ -16,26 +16,20 @@
// limitations under the License.
//
////////////////////////////////////////////////////////////////////////////////
-package org.apache.royale.style.stylebeads
+package org.apache.royale.style.util
{
- import org.apache.royale.style.util.CSSUnit;
-
- abstract public class MeasurementStyleBase extends StyleBeadBase
implements IMeasurementStyleBead
+ public class ContentFit
{
- public function MeasurementStyleBase()
+ public function ContentFit()
{
- super();
- }
- private var _unit:String;
-
- public function get unit():String
- {
- return _unit || CSSUnit.PX;
- }
-
- public function set unit(value:String):void
- {
- _unit = value;
+ // Static only class.
}
+ public static const COVER:String = "cover";
+ public static const CONTAIN:String = "contain";
+ public static const FILL:String = "fill";
+ public static const NONE:String = "none";
+ public static const SCALE_DOWN:String = "scale-down";
+ public static const MIN_CONTENT:String = "min-content";
+ public static const MAX_CONTENT:String = "max-content";
}
}
\ No newline at end of file