royale-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Harbs <harbs.li...@gmail.com>
Subject Re: [royale-asjs] branch develop updated: Added utility function to dynamically add CSS selectors
Date Mon, 04 Jun 2018 09:59:26 GMT
The Royale build pulls the externs from that repo. We have lots of changes on top of Google
externs that we need. We used to use patch files, but it was cumbersome. Applying the changes
directly to a fork works better.

I was just letting you know that if your build does not work, you might need to clear out
your local cache.

HTH,
Harbs

> On Jun 4, 2018, at 12:30 PM, Carlos Rovira <carlosrovira@apache.org> wrote:
> 
> ok, but then don't understand that we have code that is not usable by our
> own.
> I think if that code can't be used, it should be as well in Royale-extras
> libs, so people wanting to use should grab both the modified closure
> compiler and the library with code that uses it
> 
> make this sense?
> 
> Thanks
> 
> 2018-06-04 11:10 GMT+02:00 Harbs <harbs.lists@gmail.com <mailto:harbs.lists@gmail.com>>:
> 
>> FYI, this requires changes to the externs committed here:
>> https://github.com/royale-extras/closure-compiler/commit/ <https://github.com/royale-extras/closure-compiler/commit/>
>> 323c6b5f37973fac2bd611bfeb6f80359e3bbc98 <https://github.com/royale- <https://github.com/royale->
>> extras/closure-compiler/commit/323c6b5f37973fac2bd611bfeb6f80359e3bbc98>
>> 
>>> On Jun 4, 2018, at 12:04 PM, Carlos Rovira <carlosrovira@apache.org>
>> wrote:
>>> 
>>> Great! This seems to be very useful!
>>> 
>>> thanks! :)
>>> 
>>> 2018-06-04 10:22 GMT+02:00 <harbs@apache.org>:
>>> 
>>>> 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 50ca711  Added utility function to dynamically add CSS selectors
>>>> 50ca711 is described below
>>>> 
>>>> commit 50ca711de856475536ea26934023ccb2ebdfc360
>>>> Author: Harbs <harbs@in-tools.com>
>>>> AuthorDate: Mon Jun 4 11:22:53 2018 +0300
>>>> 
>>>>   Added utility function to dynamically add CSS selectors
>>>> 
>>>>   I’m not sure if there’s a good way to do this for swf.
>>>> ---
>>>> .../projects/Core/src/main/royale/CoreClasses.as   |  2 +
>>>> .../apache/royale/utils/css/addDynamicSelector.as  | 57
>>>> ++++++++++++++++++++++
>>>> 2 files changed, 59 insertions(+)
>>>> 
>>>> diff --git a/frameworks/projects/Core/src/main/royale/CoreClasses.as
>>>> b/frameworks/projects/Core/src/main/royale/CoreClasses.as
>>>> index a0a0b58..ee14d3a 100644
>>>> --- a/frameworks/projects/Core/src/main/royale/CoreClasses.as
>>>> +++ b/frameworks/projects/Core/src/main/royale/CoreClasses.as
>>>> @@ -303,6 +303,8 @@ internal class CoreClasses
>>>>       import org.apache.royale.utils.date.addSeconds; addSeconds;
>>>>       import org.apache.royale.utils.date.addYears; addYears;
>>>> 
>>>> +       import org.apache.royale.utils.css.addDynamicSelector;
>>>> addDynamicSelector;
>>>> +
>>>>    import org.apache.royale.core.TextLineMetrics; TextLineMetrics;
>>>>    import org.apache.royale.utils.ClassSelectorList;
>> ClassSelectorList;
>>>> }
>>>> diff --git a/frameworks/projects/Core/src/main/royale/org/apache/
>>>> royale/utils/css/addDynamicSelector.as b/frameworks/projects/Core/
>>>> src/main/royale/org/apache/royale/utils/css/addDynamicSelector.as
>>>> new file mode 100644
>>>> index 0000000..b7e495a
>>>> --- /dev/null
>>>> +++ b/frameworks/projects/Core/src/main/royale/org/apache/
>>>> royale/utils/css/addDynamicSelector.as
>>>> @@ -0,0 +1,57 @@
>>>> +///////////////////////////////////////////////////////////
>>>> /////////////////////
>>>> +//
>>>> +//  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.
>>>> +//
>>>> +///////////////////////////////////////////////////////////
>>>> /////////////////////
>>>> +package org.apache.royale.utils.css
>>>> +{
>>>> +    import org.apache.royale.core.IUIBase;
>>>> +
>>>> +    /**
>>>> +     *  Adds a CSS selector dynamically at runtime.
>>>> +     *
>>>> +     *  @param selector The CSS selector.
>>>> +     *
>>>> +     *  @param rule The CSS rule to apply.
>>>> +     *
>>>> +     *  @langversion 3.0
>>>> +     *  @productversion Royale 0.9.3
>>>> +     *  @royaleignorecoercion CSSStyleSheet
>>>> +        *  @royaleignorecoercion HTMLStyleElement
>>>> +     */
>>>> +    public function addDynamicSelector(selector:String,
>> rule:String):void
>>>> +    {
>>>> +        COMPILE::JS
>>>> +        {
>>>> +            var selectorString:String = selector + ' { ' + rule + ' }'
>>>> +            var element:HTMLStyleElement = document.getElementById("
>> royale_dynamic_css")
>>>> as HTMLStyleElement;
>>>> +            if(element)
>>>> +            {
>>>> +                var sheet:CSSStyleSheet = element.sheet as
>> CSSStyleSheet;
>>>> +                sheet.insertRule(selectorString);
>>>> +            }
>>>> +            else
>>>> +            {
>>>> +                               var style:HTMLStyleElement =
>>>> document.createElement('style') as HTMLStyleElement;
>>>> +                               style.type = 'text/css';
>>>> +                style.id = "royale_dynamic_css";
>>>> +                               style.innerHTML = selectorString;
>>>> +                               document.getElementsByTagName(
>>>> 'head')[0].appendChild(style);
>>>> +            }
>>>> +        }
>>>> +    }
>>>> +
>>>> +}
>>>> 
>>>> --
>>>> To stop receiving notification emails like this one, please contact
>>>> harbs@apache.org.
>>>> 
>>> 
>>> 
>>> 
>>> --
>>> Carlos Rovira
>>> http://about.me/carlosrovira
>> 
>> 
> 
> 
> -- 
> Carlos Rovira
> http://about.me/carlosrovira <http://about.me/carlosrovira>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message