mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
Housekeeping node tests, renamed to unit-tests (#4936)
Add parsers for the background css shorthand property, make ViewBase unit testable in node environment
Add background parser and linear-gradient parser
Use sticky regexes
Simplify some types, introduce generic Parsed<T> instead of & TokenRange
Apply each parser to return a { start, end, value } object
Move the css selector parser to the css/parser and unify types
Add the first steps toward building homegrown css parser
Add somewhat standards compliant tokenizer, add baseline, rework and shady css parsers
Enable all tests again, skip flaky perf test
Improve css parser tokenizer by converting some char token types to simple string
Implement 'parse a stylesheet'
Add gonzales css-parser
Add parseLib and css-tree perf
Add a thin parser layer that will convert CSS3 tokens to values, for now output is compatible with rework
Make root tsc green
Return the requires of tns-core-modules to use relative paths for webpack to work
Implement support for '@import 'url-string';
Fix function parser, function-token is no-longer neglected
Make the style-scope be able to load from "css" and "css-ast" modules
Add a loadAppCss event so theme can be added to snapshot separately from loaded
This commit is contained in:
committed by
Hristo Hristov
parent
2eba7c66e4
commit
f7a3a36b9c
@@ -17,7 +17,7 @@ export function hasLaunched(): boolean {
|
||||
|
||||
export { Observable };
|
||||
|
||||
import { UnhandledErrorEventData, iOSApplication, AndroidApplication, CssChangedEventData } from ".";
|
||||
import { UnhandledErrorEventData, iOSApplication, AndroidApplication, CssChangedEventData, LoadAppCSSEventData } from ".";
|
||||
|
||||
export const launchEvent = "launch";
|
||||
export const suspendEvent = "suspend";
|
||||
@@ -66,6 +66,10 @@ export function getCssFileName(): string {
|
||||
return cssFile;
|
||||
}
|
||||
|
||||
export function loadAppCss(): void {
|
||||
events.notify(<LoadAppCSSEventData>{ eventName: "loadAppCss", object: app, cssFile: getCssFileName() });
|
||||
}
|
||||
|
||||
export function addCss(cssText: string): void {
|
||||
events.notify(<CssChangedEventData>{ eventName: "cssChanged", object: app, cssText: cssText });
|
||||
}
|
||||
|
||||
12
tns-core-modules/application/application.d.ts
vendored
12
tns-core-modules/application/application.d.ts
vendored
@@ -141,6 +141,14 @@ export function setCssFileName(cssFile: string): void;
|
||||
*/
|
||||
export function getCssFileName(): string;
|
||||
|
||||
/**
|
||||
* Loads immediately the app.css.
|
||||
* By default the app.css file is loaded shortly after "loaded".
|
||||
* For the Android snapshot the CSS can be parsed during the snapshot generation,
|
||||
* as the CSS does not depend on runtime APIs, and loadAppCss will be called explicitly.
|
||||
*/
|
||||
export function loadAppCss();
|
||||
|
||||
export function addCss(cssText: string): void;
|
||||
|
||||
/**
|
||||
@@ -553,3 +561,7 @@ export function getNativeApplication(): any;
|
||||
* Indicates if the application is allready launched. See also the `application.on("launch", handler)` event.
|
||||
*/
|
||||
export function hasLaunched(): boolean;
|
||||
|
||||
export interface LoadAppCSSEventData extends EventData {
|
||||
cssFile: string;
|
||||
}
|
||||
@@ -1,8 +1,14 @@
|
||||
import { iOSApplication as IOSApplicationDefinition, LaunchEventData, ApplicationEventData, OrientationChangedEventData } from ".";
|
||||
import {
|
||||
iOSApplication as IOSApplicationDefinition,
|
||||
LaunchEventData,
|
||||
ApplicationEventData,
|
||||
OrientationChangedEventData,
|
||||
LoadAppCSSEventData
|
||||
} from ".";
|
||||
|
||||
import {
|
||||
notify, launchEvent, resumeEvent, suspendEvent, exitEvent, lowMemoryEvent,
|
||||
orientationChangedEvent, setApplication, livesync, displayedEvent
|
||||
orientationChangedEvent, setApplication, livesync, displayedEvent, getCssFileName
|
||||
} from "./application-common";
|
||||
|
||||
// First reexport so that app module is initialized.
|
||||
@@ -117,6 +123,7 @@ class IOSApplication implements IOSApplicationDefinition {
|
||||
};
|
||||
|
||||
notify(args);
|
||||
notify(<LoadAppCSSEventData>{ eventName: "loadAppCss", object: <any>this, cssFile: getCssFileName() });
|
||||
|
||||
let rootView = createRootView(args.root);
|
||||
this._window.content = rootView;
|
||||
|
||||
Reference in New Issue
Block a user