mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-18 22:01:42 +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)
|
## [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",
|
"name": "nativescript",
|
||||||
"version": "8.0.7",
|
"version": "8.0.8",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"config": {
|
"config": {
|
||||||
"npm_alias": "npm"
|
"npm_alias": "npm"
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
"main": "index",
|
"main": "index",
|
||||||
"types": "index.d.ts",
|
"types": "index.d.ts",
|
||||||
"description": "A JavaScript library providing an easy to use api for interacting with iOS and Android platform APIs.",
|
"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",
|
"homepage": "https://nativescript.org",
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
|
@ -501,6 +501,7 @@ export namespace Selector {
|
|||||||
|
|
||||||
export class RuleSet {
|
export class RuleSet {
|
||||||
tag: string | number;
|
tag: string | number;
|
||||||
|
scopedTag: string;
|
||||||
constructor(public selectors: SelectorCore[], public declarations: Declaration[]) {
|
constructor(public selectors: SelectorCore[], public declarations: Declaration[]) {
|
||||||
this.selectors.forEach((sel) => (sel.ruleset = this));
|
this.selectors.forEach((sel) => (sel.ruleset = this));
|
||||||
}
|
}
|
||||||
|
@ -74,6 +74,8 @@ export function mergeCssSelectors(): void {
|
|||||||
let applicationCssSelectors: RuleSet[] = [];
|
let applicationCssSelectors: RuleSet[] = [];
|
||||||
let applicationCssSelectorVersion = 0;
|
let applicationCssSelectorVersion = 0;
|
||||||
let applicationSelectors: RuleSet[] = [];
|
let applicationSelectors: RuleSet[] = [];
|
||||||
|
let tagToScopeTag: Map<string | number, string> = new Map();
|
||||||
|
let currentScopeTag: string = null;
|
||||||
const applicationAdditionalSelectors: RuleSet[] = [];
|
const applicationAdditionalSelectors: RuleSet[] = [];
|
||||||
const applicationKeyframes: any = {};
|
const applicationKeyframes: any = {};
|
||||||
const animationsSymbol = Symbol('animations');
|
const animationsSymbol = Symbol('animations');
|
||||||
@ -313,12 +315,17 @@ export function removeTaggedAdditionalCSS(tag: string | number): boolean {
|
|||||||
|
|
||||||
export function addTaggedAdditionalCSS(cssText: string, tag?: string | number): boolean {
|
export function addTaggedAdditionalCSS(cssText: string, tag?: string | number): boolean {
|
||||||
const parsed: RuleSet[] = CSSSource.fromDetect(cssText, applicationKeyframes, undefined).selectors;
|
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;
|
let changed = false;
|
||||||
if (parsed && parsed.length) {
|
if (parsed && parsed.length) {
|
||||||
changed = true;
|
changed = true;
|
||||||
if (tag != null) {
|
if (tag != null || tagScope != null) {
|
||||||
for (let i = 0; i < parsed.length; i++) {
|
for (let i = 0; i < parsed.length; i++) {
|
||||||
parsed[i].tag = tag;
|
parsed[i].tag = tag;
|
||||||
|
parsed[i].scopedTag = tagScope;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
applicationAdditionalSelectors.push(...parsed);
|
applicationAdditionalSelectors.push(...parsed);
|
||||||
@ -687,6 +694,7 @@ export class StyleScope {
|
|||||||
private _localCssSelectorsAppliedVersion = 0;
|
private _localCssSelectorsAppliedVersion = 0;
|
||||||
private _applicationCssSelectorsAppliedVersion = 0;
|
private _applicationCssSelectorsAppliedVersion = 0;
|
||||||
private _keyframes = new Map<string, Keyframes>();
|
private _keyframes = new Map<string, Keyframes>();
|
||||||
|
private _cssFiles: string[] = [];
|
||||||
|
|
||||||
get css(): string {
|
get css(): string {
|
||||||
return this._css;
|
return this._css;
|
||||||
@ -708,8 +716,11 @@ export class StyleScope {
|
|||||||
if (!cssFileName) {
|
if (!cssFileName) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
this._cssFiles.push(cssFileName);
|
||||||
|
currentScopeTag = cssFileName;
|
||||||
|
|
||||||
const cssSelectors = CSSSource.fromURI(cssFileName, this._keyframes);
|
const cssSelectors = CSSSource.fromURI(cssFileName, this._keyframes);
|
||||||
|
currentScopeTag = null;
|
||||||
this._css = cssSelectors.source;
|
this._css = cssSelectors.source;
|
||||||
this._localCssSelectors = cssSelectors.selectors;
|
this._localCssSelectors = cssSelectors.selectors;
|
||||||
this._localCssSelectorVersion++;
|
this._localCssSelectorVersion++;
|
||||||
@ -731,8 +742,13 @@ export class StyleScope {
|
|||||||
if (!cssString && !cssFileName) {
|
if (!cssString && !cssFileName) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (cssFileName) {
|
||||||
|
this._cssFiles.push(cssFileName);
|
||||||
|
currentScopeTag = cssFileName;
|
||||||
|
}
|
||||||
|
|
||||||
const parsedCssSelectors = cssString ? CSSSource.fromSource(cssString, this._keyframes, cssFileName) : CSSSource.fromURI(cssFileName, this._keyframes);
|
const parsedCssSelectors = cssString ? CSSSource.fromSource(cssString, this._keyframes, cssFileName) : CSSSource.fromURI(cssFileName, this._keyframes);
|
||||||
|
currentScopeTag = null;
|
||||||
this._css = this._css + parsedCssSelectors.source;
|
this._css = this._css + parsedCssSelectors.source;
|
||||||
this._localCssSelectors.push(...parsedCssSelectors.selectors);
|
this._localCssSelectors.push(...parsedCssSelectors.selectors);
|
||||||
this._localCssSelectorVersion++;
|
this._localCssSelectorVersion++;
|
||||||
@ -776,7 +792,7 @@ export class StyleScope {
|
|||||||
@profile
|
@profile
|
||||||
private _createSelectors() {
|
private _createSelectors() {
|
||||||
const toMerge: RuleSet[][] = [];
|
const toMerge: RuleSet[][] = [];
|
||||||
toMerge.push(applicationCssSelectors);
|
toMerge.push(applicationCssSelectors.filter((v) => !v.scopedTag || this._cssFiles.indexOf(v.scopedTag) >= 0));
|
||||||
this._applicationCssSelectorsAppliedVersion = applicationCssSelectorVersion;
|
this._applicationCssSelectorsAppliedVersion = applicationCssSelectorVersion;
|
||||||
toMerge.push(this._localCssSelectors);
|
toMerge.push(this._localCssSelectors);
|
||||||
this._localCssSelectorsAppliedVersion = this._localCssSelectorVersion;
|
this._localCssSelectorsAppliedVersion = this._localCssSelectorVersion;
|
||||||
|
Reference in New Issue
Block a user