mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
chore: cleanup types
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
import * as TKUnit from '../../tk-unit';
|
import * as TKUnit from '../../tk-unit';
|
||||||
import { createPageAndNavigate } from './action-bar-tests-common';
|
import { createPageAndNavigate } from './action-bar-tests-common';
|
||||||
import { ActionItem } from '@nativescript/core/ui/action-bar';
|
import { ActionItem } from '@nativescript/core/ui/action-bar';
|
||||||
import { Enums } from '@nativescript/core';
|
import { CoreTypes } from '@nativescript/core';
|
||||||
import { Button } from '@nativescript/core/ui/button';
|
import { Button } from '@nativescript/core/ui/button';
|
||||||
|
|
||||||
export * from './action-bar-tests-common';
|
export * from './action-bar-tests-common';
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import * as LabelModule from '@nativescript/core/ui/label';
|
|||||||
import * as helper from '../../ui-helper';
|
import * as helper from '../../ui-helper';
|
||||||
import * as view from '@nativescript/core/ui/core/view';
|
import * as view from '@nativescript/core/ui/core/view';
|
||||||
import * as actionBar from '@nativescript/core/ui/action-bar';
|
import * as actionBar from '@nativescript/core/ui/action-bar';
|
||||||
import { Enums } from '@nativescript/core';
|
import { CoreTypes } from '@nativescript/core';
|
||||||
|
|
||||||
export * from './action-bar-tests-common';
|
export * from './action-bar-tests-common';
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import { StackLayout } from '@nativescript/core/ui/layouts/stack-layout';
|
|||||||
import { Button } from '@nativescript/core/ui/button';
|
import { Button } from '@nativescript/core/ui/button';
|
||||||
import * as TKUnit from '../../tk-unit';
|
import * as TKUnit from '../../tk-unit';
|
||||||
import * as helper from '../../ui-helper';
|
import * as helper from '../../ui-helper';
|
||||||
import { Enums } from '@nativescript/core';
|
import { CoreTypes } from '@nativescript/core';
|
||||||
import * as utils from '@nativescript/core/utils/utils';
|
import * as utils from '@nativescript/core/utils/utils';
|
||||||
import * as testModule from '../../ui-test';
|
import * as testModule from '../../ui-test';
|
||||||
import * as layoutHelper from './layout-helper';
|
import * as layoutHelper from './layout-helper';
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import * as helper from '../../ui-helper';
|
import * as helper from '../../ui-helper';
|
||||||
import * as TKUnit from '../../tk-unit';
|
import * as TKUnit from '../../tk-unit';
|
||||||
|
|
||||||
import { Application, isAndroid, isIOS, Device, Button, Page, ShownModallyData, ShowModalOptions, View, Utils, Enums } from '@nativescript/core';
|
import { Application, isAndroid, isIOS, Device, Button, Page, ShownModallyData, ShowModalOptions, View, Utils, CoreTypes } from '@nativescript/core';
|
||||||
import { _rootModalViews } from '@nativescript/core/ui/core/view/view-common';
|
import { _rootModalViews } from '@nativescript/core/ui/core/view/view-common';
|
||||||
|
|
||||||
const CLASS_NAME = 'class-name';
|
const CLASS_NAME = 'class-name';
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import * as viewModule from '@nativescript/core/ui/core/view';
|
|||||||
import * as pagesModule from '@nativescript/core/ui/page';
|
import * as pagesModule from '@nativescript/core/ui/page';
|
||||||
import * as textViewTestsNative from './text-view-tests-native';
|
import * as textViewTestsNative from './text-view-tests-native';
|
||||||
import * as colorModule from '@nativescript/core/color';
|
import * as colorModule from '@nativescript/core/color';
|
||||||
import { Enums } from '@nativescript/core';
|
import { CoreTypes } from '@nativescript/core';
|
||||||
import * as platform from '@nativescript/core/platform';
|
import * as platform from '@nativescript/core/platform';
|
||||||
|
|
||||||
// >> require-textmodules
|
// >> require-textmodules
|
||||||
|
|||||||
@@ -151,11 +151,13 @@ export function updateAccessibilityProperties(view: View): void {
|
|||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
console.log('--- Accessible element: ', view.constructor.name);
|
|
||||||
console.log('accessibilityLabel: ', view.accessibilityLabel);
|
// NOTE: left here for various core inspection passes while running the toolbox app
|
||||||
console.log('accessibilityRole: ', accessibilityRole);
|
// console.log('--- Accessible element: ', view.constructor.name);
|
||||||
console.log('accessibilityState: ', accessibilityState);
|
// console.log('accessibilityLabel: ', view.accessibilityLabel);
|
||||||
console.log('accessibilityValue: ', view.accessibilityValue);
|
// console.log('accessibilityRole: ', accessibilityRole);
|
||||||
|
// console.log('accessibilityState: ', accessibilityState);
|
||||||
|
// console.log('accessibilityValue: ', view.accessibilityValue);
|
||||||
|
|
||||||
let a11yTraits = UIAccessibilityTraitNone;
|
let a11yTraits = UIAccessibilityTraitNone;
|
||||||
if (RoleTypeMap.has(accessibilityRole)) {
|
if (RoleTypeMap.has(accessibilityRole)) {
|
||||||
@@ -195,9 +197,11 @@ export function updateAccessibilityProperties(view: View): void {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (view.accessibilityLiveRegion) {
|
|
||||||
console.log('accessibilityLiveRegion:', view.accessibilityLiveRegion);
|
// NOTE: left here for various core inspection passes while running the toolbox app
|
||||||
}
|
// if (view.accessibilityLiveRegion) {
|
||||||
|
// console.log('accessibilityLiveRegion:', view.accessibilityLiveRegion);
|
||||||
|
// }
|
||||||
|
|
||||||
if (view.accessibilityMediaSession) {
|
if (view.accessibilityMediaSession) {
|
||||||
a11yTraits |= RoleTypeMap.get(AccessibilityRole.StartsMediaSession);
|
a11yTraits |= RoleTypeMap.get(AccessibilityRole.StartsMediaSession);
|
||||||
@@ -210,8 +214,11 @@ export function updateAccessibilityProperties(view: View): void {
|
|||||||
// if (view.accessibilityTraits) {
|
// if (view.accessibilityTraits) {
|
||||||
// a11yTraits |= inputArrayToBitMask(view.accessibilityTraits, AccessibilityTraitsMap);
|
// a11yTraits |= inputArrayToBitMask(view.accessibilityTraits, AccessibilityTraitsMap);
|
||||||
// }
|
// }
|
||||||
console.log('a11yTraits:', a11yTraits);
|
|
||||||
console.log(' ');
|
// NOTE: left here for various core inspection passes while running the toolbox app
|
||||||
|
// console.log('a11yTraits:', a11yTraits);
|
||||||
|
// console.log(' ');
|
||||||
|
|
||||||
uiView.accessibilityTraits = a11yTraits;
|
uiView.accessibilityTraits = a11yTraits;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
37
packages/core/core-types/index.d.ts
vendored
37
packages/core/core-types/index.d.ts
vendored
@@ -754,6 +754,43 @@ export namespace CoreTypes {
|
|||||||
// WhiteSpaceType: WhiteSpaceType;
|
// WhiteSpaceType: WhiteSpaceType;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated Use `CoreTypes.dip` instead.
|
||||||
|
*/
|
||||||
|
export type dip = number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated Use `CoreTypes.px` instead.
|
||||||
|
*/
|
||||||
|
export type px = number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated Use `CoreTypes.percent` instead.
|
||||||
|
*/
|
||||||
|
export type percent = number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated Use `CoreTypes.LengthDipUnit` instead.
|
||||||
|
*/
|
||||||
|
export type LengthDipUnit = { readonly unit: 'dip'; readonly value: dip };
|
||||||
|
/**
|
||||||
|
* @deprecated Use `CoreTypes.LengthPxUnit` instead.
|
||||||
|
*/
|
||||||
|
export type LengthPxUnit = { readonly unit: 'px'; readonly value: px };
|
||||||
|
/**
|
||||||
|
* @deprecated Use `CoreTypes.LengthPercentUnit` instead.
|
||||||
|
*/
|
||||||
|
export type LengthPercentUnit = { readonly unit: '%'; readonly value: percent };
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated Use `CoreTypes.LengthType` instead.
|
||||||
|
*/
|
||||||
|
export type LengthType = 'auto' | dip | LengthDipUnit | LengthPxUnit;
|
||||||
|
/**
|
||||||
|
* @deprecated Use `CoreTypes.PercentLengthType` instead.
|
||||||
|
*/
|
||||||
|
export type PercentLengthType = 'auto' | dip | LengthDipUnit | LengthPxUnit | LengthPercentUnit;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @deprecated Use `CoreTypes` instead. Enums will be removed in 9.0
|
* @deprecated Use `CoreTypes` instead. Enums will be removed in 9.0
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -310,6 +310,43 @@ export namespace CoreTypes {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @deprecated Use `CoreTypes` instead. Enums will be removed in 9.0
|
* @deprecated Use `CoreTypes.dip` instead.
|
||||||
|
*/
|
||||||
|
export type dip = number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated Use `CoreTypes.px` instead.
|
||||||
|
*/
|
||||||
|
export type px = number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated Use `CoreTypes.percent` instead.
|
||||||
|
*/
|
||||||
|
export type percent = number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated Use `CoreTypes.LengthDipUnit` instead.
|
||||||
|
*/
|
||||||
|
export type LengthDipUnit = { readonly unit: 'dip'; readonly value: dip };
|
||||||
|
/**
|
||||||
|
* @deprecated Use `CoreTypes.LengthPxUnit` instead.
|
||||||
|
*/
|
||||||
|
export type LengthPxUnit = { readonly unit: 'px'; readonly value: px };
|
||||||
|
/**
|
||||||
|
* @deprecated Use `CoreTypes.LengthPercentUnit` instead.
|
||||||
|
*/
|
||||||
|
export type LengthPercentUnit = { readonly unit: '%'; readonly value: percent };
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated Use `CoreTypes.LengthType` instead.
|
||||||
|
*/
|
||||||
|
export type LengthType = 'auto' | dip | LengthDipUnit | LengthPxUnit;
|
||||||
|
/**
|
||||||
|
* @deprecated Use `CoreTypes.PercentLengthType` instead.
|
||||||
|
*/
|
||||||
|
export type PercentLengthType = 'auto' | dip | LengthDipUnit | LengthPxUnit | LengthPercentUnit;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated Use `CoreTypes` instead.
|
||||||
*/
|
*/
|
||||||
export const Enums: typeof CoreTypes = CoreTypes;
|
export const Enums: typeof CoreTypes = CoreTypes;
|
||||||
|
|||||||
2
packages/core/index.d.ts
vendored
2
packages/core/index.d.ts
vendored
@@ -70,7 +70,7 @@ export declare const Connectivity: {
|
|||||||
startMonitoring: typeof startMonitoring;
|
startMonitoring: typeof startMonitoring;
|
||||||
stopMonitoring: typeof stopMonitoring;
|
stopMonitoring: typeof stopMonitoring;
|
||||||
};
|
};
|
||||||
export { CoreTypes, Enums } from './core-types';
|
export * from './core-types';
|
||||||
export { CSSUtils } from './css/system-classes';
|
export { CSSUtils } from './css/system-classes';
|
||||||
export { ObservableArray, ChangeType } from './data/observable-array';
|
export { ObservableArray, ChangeType } from './data/observable-array';
|
||||||
export type { ChangedData } from './data/observable-array';
|
export type { ChangedData } from './data/observable-array';
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ export const Connectivity = {
|
|||||||
stopMonitoring,
|
stopMonitoring,
|
||||||
};
|
};
|
||||||
|
|
||||||
export { CoreTypes, Enums } from './core-types';
|
export * from './core-types';
|
||||||
|
|
||||||
export { CSSUtils } from './css/system-classes';
|
export { CSSUtils } from './css/system-classes';
|
||||||
|
|
||||||
|
|||||||
5
packages/core/ui/enums/enums.d.ts
vendored
Normal file
5
packages/core/ui/enums/enums.d.ts
vendored
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
/**
|
||||||
|
* A lot of plugins still used @nativescript/core/ui/enums/enums
|
||||||
|
* Remove this once @nativescript/eslint-plugin supports automigrating these
|
||||||
|
*/
|
||||||
|
export * from '../../core-types';
|
||||||
5
packages/core/ui/enums/enums.ts
Normal file
5
packages/core/ui/enums/enums.ts
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
/**
|
||||||
|
* A lot of plugins still used @nativescript/core/ui/enums/enums
|
||||||
|
* Remove this once @nativescript/eslint-plugin supports automigrating these
|
||||||
|
*/
|
||||||
|
export * from '../../core-types';
|
||||||
5
packages/core/ui/enums/index.d.ts
vendored
Normal file
5
packages/core/ui/enums/index.d.ts
vendored
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
/**
|
||||||
|
* A lot of plugins still used @nativescript/core/ui/enums
|
||||||
|
* Remove this once @nativescript/eslint-plugin supports automigrating these
|
||||||
|
*/
|
||||||
|
export * from '../../core-types';
|
||||||
5
packages/core/ui/enums/index.ts
Normal file
5
packages/core/ui/enums/index.ts
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
/**
|
||||||
|
* A lot of plugins still used @nativescript/core/ui/enums
|
||||||
|
* Remove this once @nativescript/eslint-plugin supports automigrating these
|
||||||
|
*/
|
||||||
|
export * from '../../core-types';
|
||||||
Reference in New Issue
Block a user