mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-18 13:51:27 +08:00
Merge branch 'master' of github.com:NativeScript/NativeScript
This commit is contained in:
10
CHANGELOG.md
10
CHANGELOG.md
@ -1,3 +1,13 @@
|
||||
## [8.0.8](https://github.com/NativeScript/NativeScript/compare/8.0.7-core...8.0.8) (2021-06-15)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* stop leaking style scopes ([#9444](https://github.com/NativeScript/NativeScript/issues/9444)) ([b8d8110](https://github.com/NativeScript/NativeScript/commit/b8d8110994ecb5a882e89ae10e7b13070ae4d709)), closes [#9311](https://github.com/NativeScript/NativeScript/issues/9311)
|
||||
* **android:** accessibilityIdentifier ([#9432](https://github.com/NativeScript/NativeScript/issues/9432)) ([9f582ba](https://github.com/NativeScript/NativeScript/commit/9f582ba168dd6f4366e2591a9fed10e1c2443ca4))
|
||||
|
||||
|
||||
|
||||
## [8.0.7](https://github.com/NativeScript/NativeScript/compare/8.0.6-core...8.0.7) (2021-06-02)
|
||||
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "nativescript",
|
||||
"version": "8.0.7",
|
||||
"version": "8.0.8",
|
||||
"license": "MIT",
|
||||
"config": {
|
||||
"npm_alias": "npm"
|
||||
|
@ -3,7 +3,7 @@
|
||||
"main": "index",
|
||||
"types": "index.d.ts",
|
||||
"description": "A JavaScript library providing an easy to use api for interacting with iOS and Android platform APIs.",
|
||||
"version": "8.0.7",
|
||||
"version": "8.0.8",
|
||||
"homepage": "https://nativescript.org",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
@ -501,6 +501,7 @@ export namespace Selector {
|
||||
|
||||
export class RuleSet {
|
||||
tag: string | number;
|
||||
scopedTag: string;
|
||||
constructor(public selectors: SelectorCore[], public declarations: Declaration[]) {
|
||||
this.selectors.forEach((sel) => (sel.ruleset = this));
|
||||
}
|
||||
|
@ -74,6 +74,8 @@ export function mergeCssSelectors(): void {
|
||||
let applicationCssSelectors: RuleSet[] = [];
|
||||
let applicationCssSelectorVersion = 0;
|
||||
let applicationSelectors: RuleSet[] = [];
|
||||
let tagToScopeTag: Map<string | number, string> = new Map();
|
||||
let currentScopeTag: string = null;
|
||||
const applicationAdditionalSelectors: RuleSet[] = [];
|
||||
const applicationKeyframes: any = {};
|
||||
const animationsSymbol = Symbol('animations');
|
||||
@ -313,12 +315,17 @@ export function removeTaggedAdditionalCSS(tag: string | number): boolean {
|
||||
|
||||
export function addTaggedAdditionalCSS(cssText: string, tag?: string | number): boolean {
|
||||
const parsed: RuleSet[] = CSSSource.fromDetect(cssText, applicationKeyframes, undefined).selectors;
|
||||
let tagScope = currentScopeTag || (tag && tagToScopeTag.has(tag) && tagToScopeTag.get(tag)) || null;
|
||||
if (tagScope && tag) {
|
||||
tagToScopeTag.set(tag, tagScope);
|
||||
}
|
||||
let changed = false;
|
||||
if (parsed && parsed.length) {
|
||||
changed = true;
|
||||
if (tag != null) {
|
||||
if (tag != null || tagScope != null) {
|
||||
for (let i = 0; i < parsed.length; i++) {
|
||||
parsed[i].tag = tag;
|
||||
parsed[i].scopedTag = tagScope;
|
||||
}
|
||||
}
|
||||
applicationAdditionalSelectors.push(...parsed);
|
||||
@ -687,6 +694,7 @@ export class StyleScope {
|
||||
private _localCssSelectorsAppliedVersion = 0;
|
||||
private _applicationCssSelectorsAppliedVersion = 0;
|
||||
private _keyframes = new Map<string, Keyframes>();
|
||||
private _cssFiles: string[] = [];
|
||||
|
||||
get css(): string {
|
||||
return this._css;
|
||||
@ -708,8 +716,11 @@ export class StyleScope {
|
||||
if (!cssFileName) {
|
||||
return;
|
||||
}
|
||||
this._cssFiles.push(cssFileName);
|
||||
currentScopeTag = cssFileName;
|
||||
|
||||
const cssSelectors = CSSSource.fromURI(cssFileName, this._keyframes);
|
||||
currentScopeTag = null;
|
||||
this._css = cssSelectors.source;
|
||||
this._localCssSelectors = cssSelectors.selectors;
|
||||
this._localCssSelectorVersion++;
|
||||
@ -731,8 +742,13 @@ export class StyleScope {
|
||||
if (!cssString && !cssFileName) {
|
||||
return;
|
||||
}
|
||||
if (cssFileName) {
|
||||
this._cssFiles.push(cssFileName);
|
||||
currentScopeTag = cssFileName;
|
||||
}
|
||||
|
||||
const parsedCssSelectors = cssString ? CSSSource.fromSource(cssString, this._keyframes, cssFileName) : CSSSource.fromURI(cssFileName, this._keyframes);
|
||||
currentScopeTag = null;
|
||||
this._css = this._css + parsedCssSelectors.source;
|
||||
this._localCssSelectors.push(...parsedCssSelectors.selectors);
|
||||
this._localCssSelectorVersion++;
|
||||
@ -776,7 +792,7 @@ export class StyleScope {
|
||||
@profile
|
||||
private _createSelectors() {
|
||||
const toMerge: RuleSet[][] = [];
|
||||
toMerge.push(applicationCssSelectors);
|
||||
toMerge.push(applicationCssSelectors.filter((v) => !v.scopedTag || this._cssFiles.indexOf(v.scopedTag) >= 0));
|
||||
this._applicationCssSelectorsAppliedVersion = applicationCssSelectorVersion;
|
||||
toMerge.push(this._localCssSelectors);
|
||||
this._localCssSelectorsAppliedVersion = this._localCssSelectorVersion;
|
||||
|
Reference in New Issue
Block a user