Merge branch 'feat/webpack5' of https://github.com/NativeScript/NativeScript into feat/webpack5

This commit is contained in:
Igor Randjelovic
2021-03-05 15:33:41 +01:00
296 changed files with 276353 additions and 54607 deletions

View File

@@ -1,53 +1,57 @@
{
"root": true,
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 2018,
"sourceType": "module",
"project": ["packages/core/tsconfig.json", "packages/webpack/tsconfig.json"]
},
"ignorePatterns": ["**/*"],
"plugins": ["@typescript-eslint", "@nrwl/nx"],
"extends": ["eslint:recommended", "plugin:@typescript-eslint/recommended", "prettier", "prettier/@typescript-eslint"],
"rules": {
"@typescript-eslint/explicit-member-accessibility": "off",
"@typescript-eslint/explicit-function-return-type": "off",
"@typescript-eslint/no-parameter-properties": "off",
"@typescript-eslint/no-empty-function": "off",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-unused-vars": "off",
"@typescript-eslint/no-namespace": "off",
"@typescript-eslint/ban-types": "off",
"@typescript-eslint/ban-ts-comment": "off",
"@typescript-eslint/no-this-alias": "off",
"@typescript-eslint/no-empty-interface": "off",
"@typescript-eslint/triple-slash-reference": "off",
"no-prototype-builtins": "off",
"no-inner-declarations": "off",
"no-constant-condition": "off",
"no-useless-escape": "off",
"@nrwl/nx/enforce-module-boundaries": [
"error",
{
"enforceBuildableLibDependency": true,
"allow": [],
"depConstraints": [
"plugins": ["@nrwl/nx"],
"overrides": [
{
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
"extends": ["plugin:prettier/recommended"],
"parserOptions": {
"project": ["packages/core/tsconfig.json", "packages/webpack/tsconfig.json"]
},
"plugins": ["prettier"],
"rules": {
"prettier/prettier": "warn",
"@typescript-eslint/no-empty-function": "off",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-unused-vars": "off",
"@typescript-eslint/no-namespace": "off",
"@typescript-eslint/ban-types": "off",
"@typescript-eslint/ban-ts-comment": "off",
"@typescript-eslint/no-this-alias": "off",
"@typescript-eslint/no-empty-interface": "off",
"@typescript-eslint/triple-slash-reference": "off",
"no-prototype-builtins": "off",
"no-inner-declarations": "off",
"no-constant-condition": "off",
"no-useless-escape": "off",
"@nrwl/nx/enforce-module-boundaries": [
"error",
{
"sourceTag": "*",
"onlyDependOnLibsWithTags": ["*"]
"enforceBuildableLibDependency": true,
"allow": [],
"depConstraints": [
{
"sourceTag": "*",
"onlyDependOnLibsWithTags": ["*"]
}
]
}
]
}
],
"@typescript-eslint/explicit-module-boundary-types": "off"
},
"overrides": [
},
{
"files": ["*.tsx"],
"rules": {
"@typescript-eslint/no-unused-vars": "off",
"@typescript-eslint/no-any": "off"
}
"files": ["*.ts", "*.tsx"],
"extends": ["plugin:@nrwl/nx/typescript"],
"parserOptions": {
"project": "./tsconfig.*?.json"
},
"rules": {}
},
{
"files": ["*.js", "*.jsx"],
"extends": ["plugin:@nrwl/nx/javascript"],
"rules": {}
}
]
}

View File

@@ -9,11 +9,11 @@ To help the rest of the community review your change, please follow the instruct
## PR Checklist
- [ ] The PR title follows our guidelines: https://github.com/NativeScript/NativeScript/blob/master/CONTRIBUTING.md#commit-messages.
- [ ] The PR title follows our guidelines: https://github.com/NativeScript/NativeScript/blob/master/tools/notes/CONTRIBUTING.md#commit-messages.
- [ ] There is an issue for the bug/feature this PR is for. To avoid wasting your time, it's best to open a suggestion issue first and wait for approval before working on it.
- [ ] You have signed the [CLA](http://www.nativescript.org/cla).
- [ ] All existing tests are passing: https://github.com/NativeScript/NativeScript/blob/master/DevelopmentWorkflow.md#running-unit-tests.
- [ ] Tests for the changes are included - https://github.com/NativeScript/NativeScript/blob/master/WritingUnitTests.md.
- [ ] All existing tests are passing: https://github.com/NativeScript/NativeScript/blob/master/tools/notes/DevelopmentWorkflow.md#running-unit-tests-application.
- [ ] Tests for the changes are included - https://github.com/NativeScript/NativeScript/blob/master/tools/notes/WritingUnitTests.md.
## What is the current behavior?
<!-- Please describe the current behavior that you are modifying, or link to a relevant issue. -->

39
.github/workflows/apps_automated.yml vendored Normal file
View File

@@ -0,0 +1,39 @@
name: 'apps/automated'
on:
push:
branches:
- master
pull_request:
workflow_dispatch:
jobs:
test:
runs-on: macos-latest
steps:
- uses: actions/checkout@v2
- name: Install Python
uses: actions/setup-python@v1
- name: Install NativeScript
run: |
python -m pip install --upgrade pip six
npm i -g nativescript --ignore-scripts
ns usage-reporting disable
ns error-reporting disable
ns doctor
- name: Setup
run: npm run setup
- name: Create Emulator
uses: rigor789/action-create-emulator@master
- name: Test (Android)
run: node tools/scripts/run-automated.js android
- name: Test (iOS)
if: always() # run iOS tests even if Android tests failed
run: node tools/scripts/run-automated.js ios

View File

@@ -3,10 +3,13 @@ name: '@nativescript/core -> npm'
on:
push:
branches: [ 'master' ]
paths:
- 'packages/core/**'
workflow_dispatch:
env:
NPM_TAG: 'next'
jobs:
release:
runs-on: ubuntu-latest
@@ -15,7 +18,7 @@ jobs:
- uses: actions/checkout@v2
- name: Setup
run: npm install
run: npm run setup
- name: Generate Version
working-directory: packages/core
@@ -26,6 +29,7 @@ jobs:
working-directory: packages/core
run: npm version $NPM_VERSION
# TODO: build ui-mobile-base first
- name: Build @nativescript/core
run: npx nx run core:build
@@ -34,6 +38,6 @@ jobs:
env:
NPM_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}
run: |
echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > .npmrc
echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ../../.npmrc
echo "Publishing @nativescript/core@$NPM_VERSION to NPM with tag $NPM_TAG..."
npm publish nativescript-core-$NPM_VERSION.tgz --tag $NPM_TAG --dry-run
npm publish nativescript-core-$NPM_VERSION.tgz --tag $NPM_TAG

View File

@@ -0,0 +1,74 @@
name: 'tns-core-modules -> npm'
on:
push:
branches: [ 'tns-core-modules' ]
paths:
- 'nativescript-core/**'
workflow_dispatch:
env:
NPM_TAG: 'tns-next'
jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Setup
run: npm install
- name: Generate Version
run: |
echo NPM_VERSION=$(node -e "console.log(require('./package.json').version);")-$NPM_TAG-$(date +"%m-%d-%Y")-$GITHUB_RUN_ID >> $GITHUB_ENV
- name: Bump Versions
run: |
# bump root version
npm version --no-git-tag-version $NPM_VERSION
# bump @nativescript/core
cd nativescript-core
npm version --no-git-tag-version $NPM_VERSION
cd ..
# bump tns-core-modules version & @nativescript/core dep
cd tns-core-modules-package
npm version --no-git-tag-version $NPM_VERSION
cat <<EOT > _bump_core.js
const {readFileSync: read, writeFileSync: write} = require('fs'),
p = 'package.json',
pkg = read(p).toString()
ver = process.argv.splice(2).join(' ');
u = pkg.replace(/("@nativescript\/core": ")(?:.+)(")/g, \`\$1\${ver}\$2\`);
console.log(u)
write(p, u);
EOT
node _bump_core.js $NPM_VERSION
# for debugging - just show diff
git diff package.json
cd ..
- name: Build @nativescript/core
run: npm run build-core
- name: Build tns-core-modules
run: npm run build-compat
- name: Publish @nativescript/core
working-directory: dist
env:
NPM_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}
run: |
echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ../.npmrc
ls -al
echo "Publishing @nativescript/core@$NPM_VERSION to NPM with tag $NPM_TAG..."
# npm publish nativescript-core-$NPM_VERSION.tgz --tag $NPM_TAG --dry-run
echo "Publishing tns-core-modules@$NPM_VERSION to NPM with tag $NPM_TAG..."
# npm publish tns-core-modules-$NPM_VERSION.tgz --tag $NPM_TAG --dry-run

45
.github/workflows/npm_release_types.yml vendored Normal file
View File

@@ -0,0 +1,45 @@
# TODO: modify to build android & ios types first and then merge into types
name: '@nativescript/types -> npm'
on:
push:
branches: [ 'master' ]
paths:
- 'packages/types/**'
env:
NPM_TAG: 'next'
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Todo
run: |
echo "TODO: implement action"
# - uses: actions/checkout@v2
#
# - name: Setup
# run: npm install
#
# - name: Generate Version
# working-directory: packages/types
# run: |
# echo NPM_VERSION=$(node -e "console.log(require('./package.json').version);")-$NPM_TAG-$(date +"%m-%d-%Y")-$GITHUB_RUN_ID >> $GITHUB_ENV
#
# - name: Bump Version
# working-directory: packages/types
# run: npm version $NPM_VERSION
#
# - name: Build @nativescript/types
# run: npx nx run core:build
#
# - name: Publish @nativescript/types
# working-directory: dist/packages
# env:
# NPM_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}
# run: |
# echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ../../.npmrc
# echo "Publishing @nativescript/types@$NPM_VERSION to NPM with tag $NPM_TAG..."
# npm publish nativescript-types-$NPM_VERSION.tgz --tag $NPM_TAG

View File

@@ -0,0 +1,41 @@
name: '@nativescript/webpack -> npm'
on:
push:
branches: [ 'master' ]
paths:
- 'packages/webpack/**'
env:
NPM_TAG: 'next'
jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Setup
run: npm install
- name: Generate Version
working-directory: packages/webpack
run: |
echo NPM_VERSION=$(node -e "console.log(require('./package.json').version);")-$NPM_TAG-$(date +"%m-%d-%Y")-$GITHUB_RUN_ID >> $GITHUB_ENV
- name: Bump Version
working-directory: packages/webpack
run: npm version $NPM_VERSION
- name: Build @nativescript/webpack
run: npx nx run webpack:build
- name: Publish @nativescript/webpack
working-directory: dist/packages
env:
NPM_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}
run: |
echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ../../.npmrc
echo "Publishing @nativescript/webpack@$NPM_VERSION to NPM with tag $NPM_TAG..."
npm publish nativescript-webpack.tgz --tag $NPM_TAG --dry-run

8
.gitignore vendored
View File

@@ -9,9 +9,10 @@
**/node_modules
**/package-lock.json
**/yarn.lock
**/pnpm-lock.yaml
# IDEs and editors
/.idea
.idea
.project
.classpath
.c9/
@@ -47,4 +48,7 @@ Thumbs.db
# core
# https://github.com/NativeScript/nativescript-dev-webpack/issues/932
!packages/core/xml/index.js
!packages/core/xml/index.js
# types
ios-typings-prj

1
.husky/.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
_

4
.husky/pre-commit Executable file
View File

@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"
npx lint-staged

View File

@@ -16,9 +16,10 @@ packages/ui-mobile-base
tools/assets/App_Resources
*.cmd
*.md
*.json
package.json
*.js
*.map
*.css
*.scss
*.sh
*.sh
!packages/webpack/templates/*.js

View File

@@ -1,3 +1,173 @@
# [7.3.0](https://github.com/NativeScript/NativeScript/compare/7.2.2-core...7.3.0) (2021-02-27)
### Bug Fixes
* **core:** AndroidTransitionType symbol export handling ([#9252](https://github.com/NativeScript/NativeScript/issues/9252)) ([ac7f041](https://github.com/NativeScript/NativeScript/commit/ac7f041deada46bfe3bbd8359c02e9224155efd8))
### Features
* **android:** types for API Level 30 and cleanup ([#9219](https://github.com/NativeScript/NativeScript/issues/9219)) ([ebcc0e2](https://github.com/NativeScript/NativeScript/commit/ebcc0e2cc0e14d2042582901d36d4cfece7fae58))
### BREAKING CHANGES
* **core:** AndroidTransitionType is now a static member of the Transition class.
BEFORE:
```
import { AndroidTransitionType } from '@nativescript/core/ui/transition';
```
AFTER:
```
import { Transition } from '@nativescript/core';
Transition.AndroidTransitionType.enter; // etc.
```
* **android:** If you were using`native.Array` for any of your own custom plugin typings, you can switch them to `androidNative.Array`
BEFORE:
```
public writeAsync(path: string, bytes: native.Array<number>) ...
```
AFTER:
```
public writeAsync(path: string, bytes: androidNative.Array<number>) ...
```
## [7.2.2](https://github.com/NativeScript/NativeScript/compare/7.2.1-core...7.2.2) (2021-02-27)
### Bug Fixes
* **android:** KeyboardType now respects numbers ([#9240](https://github.com/NativeScript/NativeScript/issues/9240)) ([f08fcb1](https://github.com/NativeScript/NativeScript/commit/f08fcb17b49540126367f75d28499e5904e12106))
* **bottom-navigation:** fragment handling ([#9244](https://github.com/NativeScript/NativeScript/issues/9244)) ([c8ef6f2](https://github.com/NativeScript/NativeScript/commit/c8ef6f2ab3d3cd854a92dfecd0e8b2605c00f3af))
* **xhr:** remove unnecessary throw when event not supported ([#9251](https://github.com/NativeScript/NativeScript/issues/9251)) ([11ef943](https://github.com/NativeScript/NativeScript/commit/11ef94349588aca23e27b2cfaf0a3e4f93df649e))
### Features
* **android:** Add possibility to choose theme in android dialogs ([#9212](https://github.com/NativeScript/NativeScript/issues/9212)) ([e7951b3](https://github.com/NativeScript/NativeScript/commit/e7951b320f4178024a4cb5b92bab0761517a68bb))
* **core:** allow property overrides at runtime ([#9241](https://github.com/NativeScript/NativeScript/issues/9241)) ([c04e1b5](https://github.com/NativeScript/NativeScript/commit/c04e1b59e5f1a1fa48d2048c02821b97807a2c5e))
* add npm scripts for different package managers, ie: yarn, pnpm ([#9230](https://github.com/NativeScript/NativeScript/issues/9230)) ([d7b2c84](https://github.com/NativeScript/NativeScript/commit/d7b2c84da87f9f9381d04886a3ddb0c3f031abfa))
## [7.2.1](https://github.com/NativeScript/NativeScript/compare/7.2.0-core...7.2.1) (2021-02-07)
### Bug Fixes
* **core:** conflicting node global types ([#9197](https://github.com/NativeScript/NativeScript/issues/9197)) ([de7006b](https://github.com/NativeScript/NativeScript/commit/de7006b04d1fb2209b8f6efeafbc2a16d4a1d83d))
# [7.2.0](https://github.com/NativeScript/NativeScript/compare/7.1.4-core...7.2.0) (2021-02-05)
### Bug Fixes
* **core:** ObservableArray splice with start only ([#9159](https://github.com/NativeScript/NativeScript/issues/9159)) ([3ddfb5c](https://github.com/NativeScript/NativeScript/commit/3ddfb5c34a3f7d7ad9d092a87b1cfebbc2ab5b07))
* **ios:** allow navigationFrom event for deep navigation within modal frame ([#9187](https://github.com/NativeScript/NativeScript/issues/9187)) ([8f1455e](https://github.com/NativeScript/NativeScript/commit/8f1455eef71a4feaaffe4fb2aca4e49da0bc0670))
* **ios:** force release of nsdata after saving image ([#9177](https://github.com/NativeScript/NativeScript/issues/9177)) ([e002d72](https://github.com/NativeScript/NativeScript/commit/e002d72d41b7a006788fcd38feb51a7b3c1ef870))
* **ios:** navigation via swipe crash fix ([#9132](https://github.com/NativeScript/NativeScript/issues/9132)) ([28061e3](https://github.com/NativeScript/NativeScript/commit/28061e3d39fe713d78f1191a5c7e31dda7941ac1))
* **ios:** textfield resizing (auto width) on text change ([#9176](https://github.com/NativeScript/NativeScript/issues/9176)) ([c31bab1](https://github.com/NativeScript/NativeScript/commit/c31bab1bf73af7f90ff3c5c90a22b86a682137ea))
* **page:** frame getter for custom Frames ([#9195](https://github.com/NativeScript/NativeScript/issues/9195)) ([6da7d90](https://github.com/NativeScript/NativeScript/commit/6da7d90e256d220db79e245228b91d5fa8e41984))
* **webpack:** --env.uglify works properly now ([#9165](https://github.com/NativeScript/NativeScript/issues/9165)) ([be52cef](https://github.com/NativeScript/NativeScript/commit/be52cefe672aaca6d707c1c3b78cee7ee8abe8f1))
* **webpack:** Angular no longer has issues handling {N} plugins without nativescript in name ([#9172](https://github.com/NativeScript/NativeScript/issues/9172)) ([79a5fc8](https://github.com/NativeScript/NativeScript/commit/79a5fc89750ea467a2d44d5d9b5264c9fdad1a94))
* **webpack:** inspector_modules ([87418cd](https://github.com/NativeScript/NativeScript/commit/87418cdb119e4114285be81999968438d2094929))
### Features
* **android:** FlexboxLayout support for isPassThroughParentEnabled ([#8798](https://github.com/NativeScript/NativeScript/issues/8798)) ([5fe2742](https://github.com/NativeScript/NativeScript/commit/5fe27428e07a267454a5fcfa8584ba688bf0baef))
* **core:** setSelection method for editable text components ([#9175](https://github.com/NativeScript/NativeScript/issues/9175)) ([58b2542](https://github.com/NativeScript/NativeScript/commit/58b254299770b362e0c5baee36000ec81b57335a))
* **ios:** build TNSWidgets as XCFramework ([#9167](https://github.com/NativeScript/NativeScript/issues/9167)) ([04a7641](https://github.com/NativeScript/NativeScript/commit/04a76415b785ca419d057d570fc71f61b7d3bb83))
* **webpack:** allow passing env.appComponents and env.entries ([#8898](https://github.com/NativeScript/NativeScript/issues/8898)) ([90d208c](https://github.com/NativeScript/NativeScript/commit/90d208c115b582e37844494d10b0eaf6a3d74122))
### Performance Improvements
* **android:** faster background color setter ([#9120](https://github.com/NativeScript/NativeScript/issues/9120)) ([e501273](https://github.com/NativeScript/NativeScript/commit/e501273d166b0e6f8b3746d508e97099525cea0a))
## [7.1.4](https://github.com/NativeScript/NativeScript/compare/7.1.3-core...7.1.4) (2021-01-23)
### Bug Fixes
* **ios:** getVisibleViewController maximum call stack exceeded ([#9168](https://github.com/NativeScript/NativeScript/issues/9168)) ([1a3523e](https://github.com/NativeScript/NativeScript/commit/1a3523ef22f15574ce5658429a4c18eb141ab881))
## [7.1.3](https://github.com/NativeScript/NativeScript/compare/7.1.2-core...7.1.3) (2021-01-17)
### Bug Fixes
* **android:** BottomNavigation fragment child already has a parent ([#9148](https://github.com/NativeScript/NativeScript/issues/9148)) ([4690162](https://github.com/NativeScript/NativeScript/commit/4690162384c731d6d652d90a9347cae06c0a0e0c))
## [7.1.2](https://github.com/NativeScript/NativeScript/compare/7.1.1-core...7.1.2) (2021-01-14)
### Bug Fixes
* **webpack:** support other workspace config styles ([7a79a89](https://github.com/NativeScript/NativeScript/commit/7a79a8988b55e7e0896e7ad38f571aba6987edb5))
### Features
* **core:** rollup additional Utils ([882aa42](https://github.com/NativeScript/NativeScript/commit/882aa42e8573615aa5ba89396d0f0cdbb711bed3))
## [7.1.1](https://github.com/NativeScript/NativeScript/compare/7.1.0-core...7.1.1) (2021-01-13)
### Bug Fixes
* **core:** const initializer in an ambient context ([#9136](https://github.com/NativeScript/NativeScript/issues/9136)) ([47ebb1d](https://github.com/NativeScript/NativeScript/commit/47ebb1d262aa9ebf29fe445e57d19910612d047f)), closes [#9135](https://github.com/NativeScript/NativeScript/issues/9135)
# [7.1.0](https://github.com/NativeScript/NativeScript/compare/4.0.0-webpack...7.1.0) (2020-12-30)
### Bug Fixes
* **android:** modal not following activity windowSoftInputMode ([#9042](https://github.com/NativeScript/NativeScript/issues/9042)) ([d09a564](https://github.com/NativeScript/NativeScript/commit/d09a564296669dcffd03cd32b18f7a6454c7c472))
* **android:** ActivityIndicator custom color affecting other indicators on the page ([#9026](https://github.com/NativeScript/NativeScript/issues/9026)) ([e16bc60](https://github.com/NativeScript/NativeScript/commit/e16bc606ef6ed506cbc38e50247a59637d898b50))
* **android:** Tabs selected item color incorrectly applied ([#9040](https://github.com/NativeScript/NativeScript/issues/9040)) ([b47ce0a](https://github.com/NativeScript/NativeScript/commit/b47ce0a97c38547d060fb4626df02d63f518f721))
* **compat:** add screen and device aliases ([#9088](https://github.com/NativeScript/NativeScript/issues/9088)) ([4204ac8](https://github.com/NativeScript/NativeScript/commit/4204ac8308eda902efd787ce96971463eab343ab))
* **core:** notify object now optional ([#9032](https://github.com/NativeScript/NativeScript/issues/9032)) ([539fd1e](https://github.com/NativeScript/NativeScript/commit/539fd1eb293241dc067bfdcc77613b0eb67b099f))
* **ios:** ios 10 tab crash ([#9018](https://github.com/NativeScript/NativeScript/issues/9018)) ([b3f9c0d](https://github.com/NativeScript/NativeScript/commit/b3f9c0d0ac656f413653d79d5eb9fcb1a6e1ca0f))
* **list-view:** handle reusing wrong view ([#9023](https://github.com/NativeScript/NativeScript/issues/9023)) ([64e0aa6](https://github.com/NativeScript/NativeScript/commit/64e0aa6a114c414ad190696919d4b206b637f61f))
* **tabs:** ios safeArea calculation ([#9089](https://github.com/NativeScript/NativeScript/issues/9089)) ([9391b44](https://github.com/NativeScript/NativeScript/commit/9391b44996e833fc63f0b2bc4c6c90e47c12a3b8))
### Features
* **android:** setInterval closer to web spec ([#9044](https://github.com/NativeScript/NativeScript/issues/9044)) ([1769de9](https://github.com/NativeScript/NativeScript/commit/1769de903392ab14ffb6c366ab86dc24b5289e81))
* **ios:** types for latest ios 14.3 with Xcode 12.3 ([#9118](https://github.com/NativeScript/NativeScript/issues/9118)) ([9aad2db](https://github.com/NativeScript/NativeScript/commit/9aad2dbdbcf7e786183af9abbf16b4009c756ae3))
* **ios** iosIgnoreSafeArea property ([#9092](https://github.com/NativeScript/NativeScript/issues/9092)) ([ea67422](https://github.com/NativeScript/NativeScript/commit/ea67422fcf3106db1359a358e897a63827a642f3))
* **core:** queueMacroTask ([#8904](https://github.com/NativeScript/NativeScript/issues/8904)) ([e3dc89f](https://github.com/NativeScript/NativeScript/commit/e3dc89fbfc4dd8030097c7831479eb18cf23d8eb))
* **core:** allow app to start without a root view ([#9056](https://github.com/NativeScript/NativeScript/issues/9056)) ([bd7c686](https://github.com/NativeScript/NativeScript/commit/bd7c686aaf55d26b2b483905bd5e0a453429cabd))
* **frame:** add navigatingTo and navigatedTo events ([#9025](https://github.com/NativeScript/NativeScript/issues/9025)) ([cf96e72](https://github.com/NativeScript/NativeScript/commit/cf96e7252cdf66230cc03ddec907168e47d1f250))
### Performance
* faster color parsing ([c569236](https://github.com/NativeScript/NativeScript/commit/c5692363575821ef588b2260e80ad5bbffe45293))
## [7.0.13](https://github.com/NativeScript/NativeScript/compare/7.0.12-core...7.0.13) (2020-10-28)

76
CODE_OF_CONDUCT.md Normal file
View File

@@ -0,0 +1,76 @@
# Contributor Covenant Code of Conduct
## Our Pledge
In the interest of fostering an open and welcoming environment, we as
contributors and maintainers pledge to making participation in our project and
our community a harassment-free experience for everyone, regardless of age, body
size, disability, ethnicity, sex characteristics, gender identity and expression,
level of experience, education, socio-economic status, nationality, personal
appearance, race, religion, or sexual identity and orientation.
## Our Standards
Examples of behavior that contributes to creating a positive environment
include:
* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members
Examples of unacceptable behavior by participants include:
* The use of sexualized language or imagery and unwelcome sexual attention or
advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic
address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting
## Our Responsibilities
Project maintainers are responsible for clarifying the standards of acceptable
behavior and are expected to take appropriate and fair corrective action in
response to any instances of unacceptable behavior.
Project maintainers have the right and responsibility to remove, edit, or
reject comments, commits, code, wiki edits, issues, and other contributions
that are not aligned to this Code of Conduct, or to ban temporarily or
permanently any contributor for other behaviors that they deem inappropriate,
threatening, offensive, or harmful.
## Scope
This Code of Conduct applies both within project spaces and in public spaces
when an individual is representing the project or its community. Examples of
representing a project or community include using an official project e-mail
address, posting via an official social media account, or acting as an appointed
representative at an online or offline event. Representation of a project may be
further defined and clarified by project maintainers.
## Enforcement
Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by contacting the project team at . All
complaints will be reviewed and investigated and will result in a response that
is deemed necessary and appropriate to the circumstances. The project team is
obligated to maintain confidentiality with regard to the reporter of an incident.
Further details of specific enforcement policies may be posted separately.
Project maintainers who do not follow or enforce the Code of Conduct in good
faith may face temporary or permanent repercussions as determined by other
members of the project's leadership.
## Attribution
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
[homepage]: https://www.contributor-covenant.org
For answers to common questions about this code of conduct, see
https://www.contributor-covenant.org/faq

View File

@@ -1,13 +1,9 @@
<p align="center">
<a href="http://www.nativescript.org">
<img alt="NativeScript" src="https://d1lfyz5kwt8vu9.cloudfront.net/nativescript-logo.png" width="100"/>
<img alt="NativeScript" src="https://d1lfyz5kwt8vu9.cloudfront.net/nativescript-logo-2021.png" width="100"/>
</a>
</p>
<h1 align="center">
NativeScript
</h1>
[![Build Status](https://travis-ci.org/NativeScript/NativeScript.svg?branch=master)](https://travis-ci.org/NativeScript/NativeScript)
@@ -35,7 +31,7 @@ $ npm start
We love you and PR's 🤗 Please follow our [contributing guide](https://github.com/NativeScript/NativeScript/blob/master/tools/notes/CONTRIBUTING.md) and see [our code of governance](https://nativescript.org/governance/) to become as involved as you want to be.
## @nativescript/*
## @nativescript/*
* [@nativescript/core](https://github.com/NativeScript/NativeScript/tree/master/packages/core)
* Core iOS/Android for NativeScript
@@ -63,16 +59,16 @@ We love you and PR's 🤗 Please follow our [contributing guide](https://github.
- [NativeScript marketplace](https://market.nativescript.org/)
- [NativeScript roadmap](https://www.nativescript.org/roadmap)
## Other framework source repos
## Other framework source repositories
Outside of the source centralized in this repo, the NativeScript framework consists of a number of components, all of which are open source and on GitHub. Here are the major ones:
Outside of the source centralized in this repo, the NativeScript framework consists of a number of components, all of which are open source available on GitHub. Here are the major ones:
- **[iOS runtime](https://github.com/NativeScript/ns-v8ios-runtime)**
- [![npm](https://img.shields.io/npm/dm/tns-ios.svg)](https://www.npmjs.com/package/@nativescript/ios)
- This repo contains the NativeScript iOS runtime — the code that hosts NativeScript iOS apps, and allows JavaScript code to be executed on iOS devices. The iOS runtime is written in a fun mix of C++, Objective-C, and more.
- **[Android runtime](https://github.com/NativeScript/android-runtime)**
- [![npm](https://img.shields.io/npm/dm/tns-android.svg)](https://www.npmjs.com/package/tns-android)
- This repo contains the NativeScript Android — the code that hosts NativeScript Android apps, and allows JavaScript code to be executed on Android devices. The Android runtime is written in a fun mix of C++ and Java.
- This repo contains the NativeScript Android runtime — the code that hosts NativeScript Android apps, and allows JavaScript code to be executed on Android devices. The Android runtime is written in a fun mix of C++ and Java.
- **[CLI](//github.com/NativeScript/nativescript-cli)**
- [![npm](https://img.shields.io/npm/dm/nativescript.svg)](https://www.npmjs.com/package/nativescript)
- This repo contains the NativeScript command-line interface, which lets you create, build, and run apps using the NativeScript framework. The CLI is written in TypeScript.
@@ -80,9 +76,9 @@ Outside of the source centralized in this repo, the NativeScript framework consi
- [![Docs](https://img.shields.io/badge/Docs-NativeScript-brightgreen)](https://docs.nativescript.org/)
- This repo contains the NativeScript framework documentation, which is available at <http://docs.nativescript.org/>. The docs are written in Markdown.
In addition to the code that makes up the NativeScript framework itself, we also provide a number of [open-source sample apps](https://www.nativescript.org/app-samples-with-code) that you can reference while building your NativeScript application.
In addition to the code that makes up the NativeScript framework itself, we also provide a number of [open-source sample apps](https://www.nativescript.org/app-samples-with-code) from which you can take reference while building your NativeScript application.
## License
[Apache License 2.0](https://github.com/NativeScript/NativeScript/blob/master/LICENSE)
[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://github.com/NativeScript/NativeScript/blob/master/LICENSE)
<h3 align="center">Made with ❤️</h3>

1
apps/automated/.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
!webpack.custom.config.js

View File

@@ -3,6 +3,7 @@ import { NativeScriptConfig } from '@nativescript/core';
export default {
id: 'org.nativescript.UnitTestApp',
appResourcesPath: '../../tools/assets/App_Resources',
webpackConfigPath: 'webpack.custom.config.js',
android: {
v8Flags: '--expose_gc',
markingMode: 'none',

View File

@@ -14,7 +14,8 @@
"@nativescript/core": "file:../../packages/core"
},
"devDependencies": {
"@nativescript/ios": "7.0.0",
"@nativescript/android": "7.0.1",
"@nativescript/ios": "7.2.0",
"@nativescript/webpack": "file:../../dist/packages/nativescript-webpack.tgz",
"typescript": "file:../../node_modules/typescript"
},

1
apps/automated/src/globals.d.ts vendored Normal file
View File

@@ -0,0 +1 @@
declare var __CI__;

View File

@@ -1,8 +1,8 @@
import * as http from '@nativescript/core/http';
import { Http } from '@nativescript/core';
declare var postMessage: any;
http.getString('https://httpbin.org/get').then(
Http.getString('https://httpbin.org/get').then(
function (r) {
postMessage(r);
},

View File

@@ -1,4 +1,4 @@
import { ImageSource } from '@nativescript/core/image-source';
import { ImageSource } from '@nativescript/core';
import * as TKUnit from '../tk-unit';
import * as http from '@nativescript/core/http';
import * as fs from '@nativescript/core/file-system';
@@ -697,7 +697,7 @@ export var test_getString_WorksProperlyInWorker = function (done) {
done();
};
worker.onerror = function (e) {
console.log('errir received');
console.log('error received');
done(e);
};
};

View File

@@ -1,6 +1,6 @@
import * as transition from '@nativescript/core/ui/transition';
import { Transition } from '@nativescript/core';
export class CustomTransition extends transition.Transition {
export class CustomTransition extends Transition {
constructor(duration: number, curve: any) {
super(duration, curve);
}
@@ -8,13 +8,13 @@ export class CustomTransition extends transition.Transition {
public createAndroidAnimator(transitionType: string): android.animation.Animator {
var scaleValues = Array.create('float', 2);
switch (transitionType) {
case transition.AndroidTransitionType.enter:
case transition.AndroidTransitionType.popEnter:
case Transition.AndroidTransitionType.enter:
case Transition.AndroidTransitionType.popEnter:
scaleValues[0] = 0;
scaleValues[1] = 1;
break;
case transition.AndroidTransitionType.exit:
case transition.AndroidTransitionType.popExit:
case Transition.AndroidTransitionType.exit:
case Transition.AndroidTransitionType.popExit:
scaleValues[0] = 1;
scaleValues[1] = 0;
break;

View File

@@ -32,25 +32,25 @@ allTests['GLOBALS'] = globalsTests;
import * as domNodeTest from './debugger/dom-node-tests';
allTests['DOM-NODE'] = domNodeTest;
import * as profilingTests from './profiling/profiling-tests';
allTests['PROFILING'] = profilingTests;
import * as platformTests from './platform/platform-tests';
allTests['PLATFORM'] = platformTests;
import * as fsTests from './file-system/file-system-tests';
allTests['FILE-SYSTEM'] = fsTests;
// Disabled tests as they have external dependencies
// TODO: find a way to run these tests locally, but don't run them on the CI as they are flaky
// import * as httpTests from "./http/http-tests";
// allTests["HTTP"] = httpTests;
// import * as xhrTests from "./xhr/xhr-tests";
// allTests["XHR"] = xhrTests;
// import * as fetchTests from "./fetch/fetch-tests";
// allTests["FETCH"] = fetchTests;
import * as httpTests from './http/http-tests';
import * as xhrTests from './xhr/xhr-tests';
import * as fetchTests from './fetch/fetch-tests';
import * as timerTests from './timer/timer-tests';
import * as profilingTests from './profiling/profiling-tests';
// don't run these on CI as they are flaky
if (!__CI__) {
allTests['HTTP'] = httpTests;
allTests['XHR'] = xhrTests;
allTests['FETCH'] = fetchTests;
allTests['TIMER'] = timerTests;
allTests['PROFILING'] = profilingTests;
}
import * as appSettingsTests from './application-settings/application-settings-tests';
allTests['APPLICATION-SETTINGS'] = appSettingsTests;
@@ -70,9 +70,6 @@ allTests['VIRTUAL-ARRAY'] = virtualArrayTests;
import * as observableTests from './data/observable-tests';
allTests['OBSERVABLE'] = observableTests;
import * as timerTests from './timer/timer-tests';
allTests['TIMER'] = timerTests;
import * as animationFrameTests from './animation-frame/animation-frame';
allTests['ANIMATION-FRAME'] = animationFrameTests;
@@ -197,8 +194,7 @@ import * as bottomNavigationTestsNew from './ui/bottom-navigation/bottom-navigat
allTests['BOTTOM-NAVIGATION-NEW'] = bottomNavigationTestsNew;
import * as bottomNavigationNavigationTests from './ui/bottom-navigation/bottom-navigation-navigation-tests';
// TODO: uncomment this
// allTests["BOTTOM-NAVIGATION-NAVIGATION"] = bottomNavigationNavigationTests;
isIOS && (allTests['BOTTOM-NAVIGATION-NAVIGATION'] = bottomNavigationNavigationTests);
import * as tabsTests from './ui/tabs/tabs-tests';
allTests['TABS'] = tabsTests;
@@ -300,8 +296,8 @@ import * as bottomNavigationRootTests from './ui/bottom-navigation/bottom-naviga
allTests['BOTTOM-NAVIGATION-ROOT'] = bottomNavigationRootTests;
// Reset root view didn't work with android tabs
// import * as tabsRootTests from "./ui/tabs/tabs-root-tests";
// allTests["TABS-ROOT"] = tabsRootTests;
import * as tabsRootTests from './ui/tabs/tabs-root-tests';
isIOS && (allTests['TABS-ROOT'] = tabsRootTests);
import * as resetRootViewTests from './ui/root-view/reset-root-view-tests';
allTests['RESET-ROOT-VIEW'] = resetRootViewTests;

View File

@@ -155,6 +155,7 @@ export function test_setInterval_callbackCalledDuringPeriod(done) {
export function test_setInterval_callbackCalledWithExtraArgs(done) {
let counter: number = 0;
const rnd: number = Math.random();
const threshold = 100;
const start = TKUnit.time();
const id = timer.setInterval(
@@ -163,10 +164,10 @@ export function test_setInterval_callbackCalledWithExtraArgs(done) {
if (counter === 4) {
const end = TKUnit.time();
timer.clearInterval(id);
done(end - start > 250 ? new Error('setInterval too slow.') : null);
done(end - start > 1000 + threshold ? new Error('setInterval too slow.') : null);
}
},
50,
250,
rnd
);
}
@@ -179,11 +180,11 @@ export function test_setInterval_callbackNotDelayedByBusyWork() {
calls++;
if (firstCall) {
firstCall = false;
TKUnit.wait(0.025);
TKUnit.wait(0.125);
}
}, 50);
}, 250);
TKUnit.wait(0.11);
TKUnit.wait(0.55);
timer.clearInterval(id);
TKUnit.assertEqual(calls, 2, 'Callback should be called multiple times with busy wait');
}

View File

@@ -347,7 +347,7 @@ export function wait(seconds: number): void {
waitUntilReady(() => false, seconds, false);
}
export function waitUntilReady(isReady: () => boolean, timeoutSec: number = 3, shouldThrow: boolean = true) {
export function waitUntilReady(isReady: () => boolean, timeoutSec: number = 5, shouldThrow: boolean = true) {
if (!isReady) {
return;
}

View File

@@ -1,53 +1,53 @@
import * as buttonModule from '@nativescript/core/ui/button';
import * as colorModule from '@nativescript/core/color';
import * as utilsModule from '@nativescript/core/utils/utils';
import * as enums from '@nativescript/core/ui/enums';
import { Color, Button, Utils, Enums } from '@nativescript/core';
export function getNativeText(button: buttonModule.Button): string {
export function getNativeText(button: Button): string {
return button.android.getText();
}
export function getNativeTextWrap(button: buttonModule.Button): boolean {
export function getNativeTextWrap(button: Button): boolean {
return (<android.widget.Button>button.android).getLineCount() === 1;
}
export function getNativeFontSize(button: buttonModule.Button): number {
var density = utilsModule.layout.getDisplayDensity();
export function getNativeFontSize(button: Button): number {
let density = Utils.layout.getDisplayDensity();
return button.android.getTextSize() / density;
}
export function getNativeColor(button: buttonModule.Button): colorModule.Color {
return new colorModule.Color(button.android.getTextColors().getDefaultColor());
export function getNativeColor(button: Button): Color {
return new Color(button.android.getTextColors().getDefaultColor());
}
export function getNativeBackgroundColor(button: buttonModule.Button): colorModule.Color {
var bkg = <any>button.android.getBackground();
if (bkg instanceof org.nativescript.widgets.BorderDrawable) {
return new colorModule.Color((<org.nativescript.widgets.BorderDrawable>bkg).getBackgroundColor());
export function getNativeBackgroundColor(button: Button): Color {
let bg = <any>button.android.getBackground();
if (bg instanceof org.nativescript.widgets.BorderDrawable) {
return new Color(bg.getBackgroundColor());
} else if (bg instanceof android.graphics.drawable.ColorDrawable) {
console.log(bg);
return new Color(bg.getColor());
} else {
return new colorModule.Color(bkg.backgroundColor);
return new Color(bg.backgroundColor);
}
}
export function getNativeTextAlignment(button: buttonModule.Button): string {
var gravity = button.android.getGravity();
export function getNativeTextAlignment(button: Button): string {
let gravity = button.android.getGravity();
if ((gravity & android.view.Gravity.HORIZONTAL_GRAVITY_MASK) === android.view.Gravity.LEFT) {
return enums.TextAlignment.left;
return Enums.TextAlignment.left;
}
if ((gravity & android.view.Gravity.HORIZONTAL_GRAVITY_MASK) === android.view.Gravity.CENTER_HORIZONTAL) {
return enums.TextAlignment.center;
return Enums.TextAlignment.center;
}
if ((gravity & android.view.Gravity.HORIZONTAL_GRAVITY_MASK) === android.view.Gravity.RIGHT) {
return enums.TextAlignment.right;
return Enums.TextAlignment.right;
}
return 'unexpected value';
}
export function performNativeClick(button: buttonModule.Button): void {
export function performNativeClick(button: Button): void {
button.android.performClick();
}

View File

@@ -3,7 +3,7 @@ import * as enums from '@nativescript/core/ui/enums';
import * as colorModule from '@nativescript/core/color';
export function getNativeTextAlignment(label: labelModule.Label): string {
var gravity = label.android.getGravity();
let gravity = label.android.getGravity();
if ((gravity & android.view.Gravity.HORIZONTAL_GRAVITY_MASK) === android.view.Gravity.LEFT) {
return enums.TextAlignment.left;
@@ -21,10 +21,12 @@ export function getNativeTextAlignment(label: labelModule.Label): string {
}
export function getNativeBackgroundColor(label: labelModule.Label): colorModule.Color {
var bkg = <any>label.android.getBackground();
if (bkg instanceof org.nativescript.widgets.BorderDrawable) {
return new colorModule.Color((<org.nativescript.widgets.BorderDrawable>bkg).getBackgroundColor());
let bg = <any>label.android.getBackground();
if (bg instanceof org.nativescript.widgets.BorderDrawable) {
return new colorModule.Color(bg.getBackgroundColor());
} else if (bg instanceof android.graphics.drawable.ColorDrawable) {
return new colorModule.Color(bg.getColor());
} else {
return new colorModule.Color(bkg.backgroundColor);
return new colorModule.Color(bg.backgroundColor);
}
}

View File

@@ -330,8 +330,8 @@ export class LabelTest extends testModule.UITest<LabelModule.Label> {
normalColor = actualColors.getDefaultColor();
TKUnit.assert(normalColor, 'Expected: ' + expColor + ', Actual: ' + normalColor);
const bkg = <org.nativescript.widgets.BorderDrawable>testLabel.android.getBackground();
actualBackgroundColor = bkg.getBackgroundColor();
const bg = testLabel.android.getBackground();
actualBackgroundColor = bg['getBackgroundColor'] ? bg.getBackgroundColor() : bg.getColor();
expBackgroundColor = android.graphics.Color.parseColor(backgroundColor);
TKUnit.assertEqual(actualBackgroundColor, expBackgroundColor);
} else {

View File

@@ -1,74 +1,74 @@
import * as textFieldModule from '@nativescript/core/ui/text-field';
import * as colorModule from '@nativescript/core/color';
import * as utilsModule from '@nativescript/core/utils/utils';
import * as enums from '@nativescript/core/ui/enums';
import { TextField, Color, Utils, Enums } from '@nativescript/core';
export function getNativeText(textField: textFieldModule.TextField): string {
export function getNativeText(textField: TextField): string {
return textField.android.getText().toString();
}
export function getNativeHint(textField: textFieldModule.TextField): string {
export function getNativeHint(textField: TextField): string {
return textField.android.getHint();
}
export function getNativeSecure(textField: textFieldModule.TextField): boolean {
var inputType = textField.android.getInputType();
export function getNativeSecure(textField: TextField): boolean {
let inputType = textField.android.getInputType();
return (inputType & android.text.InputType.TYPE_TEXT_VARIATION_PASSWORD) === android.text.InputType.TYPE_TEXT_VARIATION_PASSWORD || (inputType & android.text.InputType.TYPE_NUMBER_VARIATION_PASSWORD) === android.text.InputType.TYPE_NUMBER_VARIATION_PASSWORD;
}
export function getNativeFontSize(textField: textFieldModule.TextField): number {
var density = utilsModule.layout.getDisplayDensity();
export function getNativeFontSize(textField: TextField): number {
let density = Utils.layout.getDisplayDensity();
return textField.android.getTextSize() / density;
}
export function getNativeColor(textField: textFieldModule.TextField): colorModule.Color {
return new colorModule.Color(textField.android.getTextColors().getDefaultColor());
export function getNativeColor(textField: TextField): Color {
return new Color(textField.android.getTextColors().getDefaultColor());
}
export function getNativePlaceholderColor(textField: textFieldModule.TextField): colorModule.Color {
return new colorModule.Color(textField.android.getHintTextColors().getDefaultColor());
export function getNativePlaceholderColor(textField: TextField): Color {
return new Color(textField.android.getHintTextColors().getDefaultColor());
}
export function getNativeBackgroundColor(textField: textFieldModule.TextField): colorModule.Color {
var bkg = <any>textField.android.getBackground();
if (bkg instanceof org.nativescript.widgets.BorderDrawable) {
return new colorModule.Color((<org.nativescript.widgets.BorderDrawable>bkg).getBackgroundColor());
export function getNativeBackgroundColor(textField: TextField): Color {
let bg = <any>textField.android.getBackground();
if (bg instanceof org.nativescript.widgets.BorderDrawable) {
return new Color(bg.getBackgroundColor());
} else if (bg instanceof android.graphics.drawable.ColorDrawable) {
console.log(bg);
return new Color(bg.getColor());
} else {
return new colorModule.Color(bkg.backgroundColor);
return new Color(bg.backgroundColor);
}
}
export function getNativeTextAlignment(textField: textFieldModule.TextField): string {
export function getNativeTextAlignment(textField: TextField): string {
var gravity = textField.android.getGravity();
if ((gravity & android.view.Gravity.HORIZONTAL_GRAVITY_MASK) === android.view.Gravity.LEFT) {
return enums.TextAlignment.left;
return Enums.TextAlignment.left;
}
if ((gravity & android.view.Gravity.HORIZONTAL_GRAVITY_MASK) === android.view.Gravity.CENTER_HORIZONTAL) {
return enums.TextAlignment.center;
return Enums.TextAlignment.center;
}
if ((gravity & android.view.Gravity.HORIZONTAL_GRAVITY_MASK) === android.view.Gravity.RIGHT) {
return enums.TextAlignment.right;
return Enums.TextAlignment.right;
}
return 'unexpected value';
}
export function getNativeFocus(textField: textFieldModule.TextField): boolean {
export function getNativeFocus(textField: TextField): boolean {
//
return true;
}
export function typeTextNatively(textField: textFieldModule.TextField, text: string): void {
export function typeTextNatively(textField: TextField, text: string): void {
textField.android.requestFocus();
textField.android.setText(text);
textField.android.clearFocus();
}
export function typeTextNativelyWithReturn(textField: textFieldModule.TextField, text: string): void {
export function typeTextNativelyWithReturn(textField: TextField, text: string): void {
//
}

View File

@@ -1,13 +1,10 @@
import * as textViewModule from '@nativescript/core/ui/text-view';
import * as colorModule from '@nativescript/core/color';
import * as utilsModule from '@nativescript/core/utils/utils';
import * as enums from '@nativescript/core/ui/enums';
import { TextView, Color, Utils, Enums } from '@nativescript/core';
export function getNativeText(textView: textViewModule.TextView): string {
export function getNativeText(textView: TextView): string {
return textView.android.getText().toString();
}
export function getNativeEditable(textView: textViewModule.TextView): boolean {
export function getNativeEditable(textView: TextView): boolean {
if (textView.android.getKeyListener()) {
return true;
} else {
@@ -15,53 +12,55 @@ export function getNativeEditable(textView: textViewModule.TextView): boolean {
}
}
export function getNativeHint(textView: textViewModule.TextView): string {
export function getNativeHint(textView: TextView): string {
return textView.android.getHint();
}
export function getNativeFontSize(textView: textViewModule.TextView): number {
var density = utilsModule.layout.getDisplayDensity();
export function getNativeFontSize(textView: TextView): number {
let density = Utils.layout.getDisplayDensity();
return textView.android.getTextSize() / density;
}
export function getNativeColor(textView: textViewModule.TextView): colorModule.Color {
return new colorModule.Color(textView.android.getTextColors().getDefaultColor());
export function getNativeColor(textView: TextView): Color {
return new Color(textView.android.getTextColors().getDefaultColor());
}
export function getNativeBackgroundColor(textView: textViewModule.TextView): colorModule.Color {
var bkg = <any>textView.android.getBackground();
if (bkg instanceof org.nativescript.widgets.BorderDrawable) {
return new colorModule.Color((<org.nativescript.widgets.BorderDrawable>bkg).getBackgroundColor());
export function getNativeBackgroundColor(textView: TextView): Color {
let bg = <any>textView.android.getBackground();
if (bg instanceof org.nativescript.widgets.BorderDrawable) {
return new Color(bg.getBackgroundColor());
} else if (bg instanceof android.graphics.drawable.ColorDrawable) {
return new Color(bg.getColor());
} else {
return new colorModule.Color(bkg.backgroundColor);
return new Color(bg.backgroundColor);
}
}
export function getNativeTextAlignment(textView: textViewModule.TextView): string {
var gravity = textView.android.getGravity();
export function getNativeTextAlignment(textView: TextView): string {
let gravity = textView.android.getGravity();
if ((gravity & android.view.Gravity.HORIZONTAL_GRAVITY_MASK) === android.view.Gravity.LEFT) {
return enums.TextAlignment.left;
return Enums.TextAlignment.left;
}
if ((gravity & android.view.Gravity.HORIZONTAL_GRAVITY_MASK) === android.view.Gravity.CENTER_HORIZONTAL) {
return enums.TextAlignment.center;
return Enums.TextAlignment.center;
}
if ((gravity & android.view.Gravity.HORIZONTAL_GRAVITY_MASK) === android.view.Gravity.RIGHT) {
return enums.TextAlignment.right;
return Enums.TextAlignment.right;
}
return 'unexpected value';
}
export function typeTextNatively(textView: textViewModule.TextView, text: string): void {
export function typeTextNatively(textView: TextView, text: string): void {
textView.android.requestFocus();
textView.android.setText(text);
textView.android.clearFocus();
}
export function getNativeMaxLines(textView: textViewModule.TextView): number {
export function getNativeMaxLines(textView: TextView): number {
return textView.android.getMaxLines();
}

View File

@@ -0,0 +1,19 @@
const webpack = require('webpack');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const webpackConfig = require('./webpack.config');
module.exports = (env) => {
env = env || {};
const baseConfig = webpackConfig(env);
baseConfig.plugins.push(new CopyWebpackPlugin([
{ from: { glob: 'ui/web-view/*.html', dot: false } }
]))
baseConfig.plugins.push(new webpack.DefinePlugin({
__CI__: !!process.env.CI
}))
return baseConfig;
};

View File

@@ -11,6 +11,8 @@
"@nativescript/core": "file:../../packages/core"
},
"devDependencies": {
"@nativescript/android": "7.0.1",
"@nativescript/ios": "7.2.0",
"@nativescript/webpack": "file:../../dist/packages/nativescript-webpack.tgz",
"typescript": "file:../../node_modules/typescript"
}

View File

@@ -11,7 +11,8 @@
"@nativescript/core": "file:../../packages/core"
},
"devDependencies": {
"@nativescript/ios": "7.0.0",
"@nativescript/android": "7.0.1",
"@nativescript/ios": "7.2.0",
"@nativescript/webpack": "file:../../dist/packages/nativescript-webpack.tgz",
"typescript": "file:../../node_modules/typescript"
},

View File

@@ -0,0 +1,11 @@
export function onStackLayoutTapped(args) {
console.log('The StackLayout is tapped (called method: onStackLayoutTapped)');
// Some visual action to execute when the tap is triggered
args.object.backgroundColor = !args.object.backgroundColor || args.object.backgroundColor.toString() !== '#FFFF00' ? '#FFFF00' : '#FFFFFF';
}
export function onFlexLayoutTap(args) {
console.log('The FlexboxLayout is tapped (called method: onFlexLayoutTap)');
// Some visual action to execute when the tap is triggered
args.object.backgroundColor = !args.object.backgroundColor || args.object.backgroundColor.toString() !== '#FFFF00' ? '#FFFF00' : '#FFFFFF';
}

View File

@@ -0,0 +1,14 @@
<Page xmlns="http://schemas.nativescript.org/tns.xsd">
<StackLayout tap="onStackLayoutTapped" backgroundColor="#fff">
<Label text="With 'isPassThroughParentEnabled'" textWrap="true" textAlignment="center" color="#000" fontSize="20"/>
<FlexboxLayout tap="onFlexLayoutTap" isPassThroughParentEnabled="true" alignItems="center" justifyContent="center" height="150" backgroundColor="#fff">
<Label text="Tap Here to trigger the parent tap! (StackLayout)" textWrap="true" fontSize="24"/>
</FlexboxLayout>
<Label text="Without 'isPassThroughParentEnabled'" textWrap="true" textAlignment="center" color="#000" fontSize="20"/>
<FlexboxLayout tap="onFlexLayoutTap" alignItems="center" justifyContent="center" height="150" backgroundColor="#fff">
<Label text="Tap Here to trigger both!" textWrap="true" fontSize="24"/>
</FlexboxLayout>
</StackLayout>
</Page>

View File

@@ -18,6 +18,7 @@ export function loadExamples() {
examples.set('flex-perf', 'flexbox/flexbox-perf-comparison-page');
examples.set('flexbox-4143', 'flexbox/flexbox-4143-page');
examples.set('flexbox-4834', 'flexbox/flexbox-4834-page');
examples.set("flexbox-ispassthroughparent", "flexbox/flexbox-ispassthroughparent-page");
return examples;
}

View File

@@ -1,4 +1,9 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Page>
<ActivityIndicator busy="true" verticalAlignment="center" horizontalAlignment="center"/>
<StackLayout>
<ActivityIndicator busy="true" color="red" verticalAlignment="center" horizontalAlignment="center"/>
<ActivityIndicator busy="true" color="green" verticalAlignment="center" horizontalAlignment="center"/>
<ActivityIndicator busy="true" color="blue" verticalAlignment="center" horizontalAlignment="center"/>
<ActivityIndicator busy="true" color="" verticalAlignment="center" horizontalAlignment="center"/>
</StackLayout>
</Page>

View File

@@ -1,3 +1,12 @@
<Page class="page" >
<Label text="Inner label 1" backgroundColor="blue"/>
</Page>
<GridLayout rows="*, auto">
<Label text="Inner label 1" backgroundColor="blue"/>
<Label text="Inner Bottom label 1"
textAlignment="center"
verticalAlignment="middle"
padding="10"
backgroundColor="crimson"
row="1"/>
</GridLayout>
</Page>

View File

@@ -0,0 +1,24 @@
<Page class="page">
<StackLayout>
<Tabs iosOverflowSafeArea="true" highlightColor="red" offscreenTabLimit="1" automationText="tabNavigation">
<TabStrip highlightColor="green" itemTap="onItemTap">
<TabStripItem title="1"></TabStripItem>
<TabStripItem title="2"></TabStripItem>
<TabStripItem title="3"></TabStripItem>
<TabStripItem title="4"></TabStripItem>
</TabStrip>
<TabContentItem>
<Frame defaultPage="tabs/frame-in-tabs-inner-page-1"></Frame>
</TabContentItem>
<TabContentItem>
<Frame defaultPage="tabs/frame-in-tabs-inner-page-2"></Frame>
</TabContentItem>
<TabContentItem>
<Frame defaultPage="tabs/frame-in-tabs-inner-page-3"></Frame>
</TabContentItem>
<TabContentItem>
<Frame defaultPage="tabs/frame-in-tabs-inner-page-4"></Frame>
</TabContentItem>
</Tabs>
</StackLayout>
</Page>

View File

@@ -31,6 +31,7 @@ export function loadExamples() {
examples.set('nested-bottom-navigation', 'tabs/nested-bottom-navigation-page');
examples.set('custom-tabstrip', 'tabs/custom-tabstrip-page');
examples.set('frame-in-tabs', 'tabs/frame-in-tabs');
examples.set('frame-in-tabs-overflow', 'tabs/frame-in-tabs-overflow');
examples.set('item-color', 'tabs/item-color-page');
examples.set('dynamic-color-change', 'tabs/dynamic-color-change-page');

View File

@@ -0,0 +1,15 @@
import { EventData, Page, Tabs } from '@nativescript/core';
export function goToFirst(args: EventData) {
console.log('---> goToFirst');
const page = <Page>(<any>args.object).page;
const tabsNav = <Tabs>page.getViewById('tabs');
tabsNav.selectedIndex = 0;
}
export function goToSecond(args: EventData) {
console.log('---> goToSecond');
const page = <Page>(<any>args.object).page;
const tabsNav = <Tabs>page.getViewById('tabs');
tabsNav.selectedIndex = 1;
}

View File

@@ -4,7 +4,7 @@
</ActionBar>
<Tabs id="tabs" swipeEnabled="false" automationText="tabNavigation" >
<TabStrip>
<TabStrip selectedItemColor="red" unSelectedItemColor="black">
<TabStripItem title="First Tab 11" iconSource="res://icon"></TabStripItem>
<TabStripItem>
<!-- <Image src="res://icon" /> -->

View File

@@ -4,7 +4,7 @@
</ActionBar>
<Tabs id="tabs" tabsPosition="bottom" automationText="tabNavigation" >
<TabStrip>
<TabStrip selectedItemColor="blue" unSelectedItemColor="gray">
<TabStripItem title="First Tab 11" iconSource="res://icon"></TabStripItem>
<TabStripItem>
<!-- <Image src="res://icon" /> -->

View File

@@ -1,109 +0,0 @@
{
"migrations": [
{
"version": "10.1.0-beta.0",
"description": "Migrate .eslintrc files to use tsconfig with a wildcard",
"factory": "./src/migrations/update-10-1-0/migrate-eslintrc-tsconfig-wildcard",
"package": "@nrwl/workspace",
"name": "migrate-eslintrc-tsconfig-wildcard"
},
{
"version": "10.3.0-beta.0",
"description": "Add @nrwl/cli as dependency",
"factory": "./src/migrations/update-10-3-0/add-cli-dependency",
"package": "@nrwl/workspace",
"name": "add-cli-dependency"
},
{
"version": "10.3.0-beta.0",
"description": "Update typescript to v4",
"factory": "./src/migrations/update-10-3-0/update-typescript",
"package": "@nrwl/workspace",
"name": "update-10-3-0"
},
{
"version": "10.3.0-beta.1",
"description": "Adds .vscode/extensions.json to a workspace",
"factory": "./src/migrations/update-10-3-0/add-vscode-extensions",
"package": "@nrwl/workspace",
"name": "add-vscode-extensions"
},
{
"version": "10.3.0-beta.0",
"description": "Adds `buildableProjectDepsInPackageJsonType` for web and angular package builders",
"factory": "./src/migrations/update-10-3-0/add-buildable-project-deps-in-package-json-type",
"package": "@nrwl/workspace",
"name": "add-buildable-project-deps-in-package-json-type"
},
{
"version": "10.1.0-beta.4",
"description": "Update jest to v26",
"factory": "./src/migrations/update-10-1-0/update-10-1-0",
"package": "@nrwl/jest",
"name": "update-10.1.0"
},
{
"version": "10.2.0",
"description": "Remove deprecated jest builder options",
"factory": "./src/migrations/update-10-2-0/update-10-2-0",
"package": "@nrwl/jest",
"name": "update-10.2.0"
},
{
"version": "10.3.0-beta.1",
"description": "Adds all jest projects into the root jest config",
"factory": "./src/migrations/update-10-3-0/update-projects-property",
"package": "@nrwl/jest",
"name": "update-projects-property"
},
{
"version": "10.3.0-beta.1",
"description": "Update ts-jest to v26.4",
"factory": "./src/migrations/update-10-3-0/update-ts-jest",
"package": "@nrwl/jest",
"name": "update-ts-jest"
},
{
"version": "10.3.0-beta.1",
"description": "Adds a jest extension to the recommended extensions for vscode",
"factory": "./src/migrations/update-10-3-0/add-jest-extension",
"package": "@nrwl/jest",
"name": "add-jest-extension"
},
{
"version": "10.3.0-beta.1",
"description": "Update @typescript-eslint to v4.3",
"factory": "./src/migrations/update-10-3-0/update-10-3-0",
"package": "@nrwl/linter",
"name": "update-10.3.0"
},
{
"version": "10.3.0-beta.0",
"description": "Migrate to the new ESLint builder and ESLint config style",
"factory": "./src/migrations/update-10-3-0/update-eslint-builder-and-config",
"package": "@nrwl/linter",
"name": "update-eslint-builder-and-config"
},
{
"version": "10.3.0-beta.2",
"description": "Add explicit .json file extension to .eslintrc files, not using an extension is deprecated",
"factory": "./src/migrations/update-10-3-0/add-json-ext-to-eslintrc",
"package": "@nrwl/linter",
"name": "add-json-ext-to-eslintrc"
},
{
"version": "10.3.0-beta.3",
"description": "Update implicitDependencies within nx.json to include root .eslintrc.json",
"factory": "./src/migrations/update-10-3-0/add-root-eslintrc-json-to-workspace-implicit-deps",
"package": "@nrwl/linter",
"name": "add-root-eslintrc-json-to-workspace-implicit-deps"
},
{
"version": "10.1.0-beta.1",
"description": "Removes rootDir from node libs' tsconfig",
"factory": "./src/migrations/update-10-1-0/remove-root-dir",
"package": "@nrwl/node",
"name": "remove-root-dir"
}
]
}

View File

@@ -1,74 +1,76 @@
{
"name": "nativescript",
"version": "7.0.13",
"license": "MIT",
"scripts": {
"setup": "npx rimraf hooks node_modules package-lock.json && npm i && ts-patch install && nx run core:setup",
"start": "nps",
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s"
},
"private": true,
"repository": {
"type": "git",
"url": "https://github.com/NativeScript/NativeScript.git"
},
"dependencies": {
"nativescript-theme-core": "^1.0.4"
},
"devDependencies": {
"@nativescript/hook": "^2.0.0",
"@nrwl/cli": "~10.3.1",
"@nrwl/eslint-plugin-nx": "~10.3.0",
"@nrwl/jest": "~10.3.0",
"@nrwl/node": "~10.3.0",
"@nrwl/workspace": "~10.3.0",
"@nstudio/focus": "~10.3.0",
"@nstudio/nps-i": "~1.1.0",
"@types/chai": "^4.2.11",
"@types/jest": "~26.0.8",
"@types/mocha": "^7.0.2",
"@types/node": "~14.0.22",
"@typescript-eslint/eslint-plugin": "~4.3.0",
"@typescript-eslint/parser": "~4.3.0",
"chai": "^4.2.0",
"conventional-changelog-cli": "^2.0.34",
"copyfiles": "^2.4.0",
"css": "^3.0.0",
"css-tree": "^1.0.0-alpha.39",
"dotenv": "~8.2.0",
"eslint": "~7.10.0",
"eslint-config-prettier": "~6.11.0",
"gonzales": "^1.0.7",
"husky": "^4.2.5",
"jest": "~26.2.2",
"lint-staged": "^10.2.11",
"mocha": "^8.0.1",
"mocha-typescript": "^1.1.17",
"module-alias": "^2.2.2",
"nativescript": "~7.0.6",
"node-sass": "~4.14.1",
"parse-css": "git+https://github.com/tabatkins/parse-css.git",
"parserlib": "^1.1.1",
"prettier": "~2.0.5",
"reduce-css-calc": "~2.1.7",
"shady-css-parser": "^0.1.0",
"terser-webpack-plugin": "~3.0.6",
"ts-jest": "26.4.0",
"ts-node": "~8.10.2",
"ts-patch": "^1.2.5",
"tslint": "~6.1.2",
"typescript": "~4.0.3",
"webpack": "~4.44.1",
"webpack-cli": "~3.3.12"
},
"husky": {
"hooks": {
"pre-commit": "npx lint-staged"
}
},
"lint-staged": {
"**/*": [
"nx format:write --files"
]
}
"name": "nativescript",
"version": "7.3.0",
"license": "MIT",
"scripts": {
"clean": "git clean -f -X -d",
"setup": "npm run clean && npm install",
"setup:yarn": "yarn run clean && yarn",
"setup:pnpm": "pnpm run clean && pnpm install",
"postinstall": "ts-patch install && husky install && nx run core:setup",
"start": "nps",
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s"
},
"private": true,
"repository": {
"type": "git",
"url": "https://github.com/NativeScript/NativeScript.git"
},
"dependencies": {
"nativescript-theme-core": "^1.0.4"
},
"devDependencies": {
"@nativescript/hook": "^2.0.0",
"@nrwl/cli": "11.4.0",
"@nrwl/eslint-plugin-nx": "11.4.0",
"@nrwl/jest": "11.4.0",
"@nrwl/node": "11.4.0",
"@nrwl/tao": "11.4.0",
"@nrwl/workspace": "11.4.0",
"@nstudio/focus": "~11.1.0",
"@nstudio/nps-i": "~1.1.0",
"@types/chai": "^4.2.11",
"@types/jest": "~26.0.8",
"@types/mocha": "^7.0.2",
"@types/node": "12.12.38",
"@typescript-eslint/eslint-plugin": "~4.16.0",
"@typescript-eslint/parser": "~4.16.0",
"chai": "^4.2.0",
"conventional-changelog-cli": "^2.1.1",
"copyfiles": "^2.4.0",
"css": "^3.0.0",
"css-tree": "^1.0.0-alpha.39",
"dotenv": "~8.2.0",
"eslint": "~7.21.0",
"eslint-config-prettier": "~8.1.0",
"eslint-plugin-prettier": "^3.3.1",
"gonzales": "^1.0.7",
"husky": "^5.1.3",
"jest": "~26.2.2",
"lint-staged": "^10.5.0",
"mocha": "^8.0.1",
"mocha-typescript": "^1.1.17",
"module-alias": "^2.2.2",
"nativescript": "~7.2.0",
"parse-css": "git+https://github.com/tabatkins/parse-css.git",
"parserlib": "^1.1.1",
"prettier": "~2.2.1",
"reduce-css-calc": "~2.1.7",
"sass": "~1.32.8",
"shady-css-parser": "^0.1.0",
"terser-webpack-plugin": "~3.0.6",
"tree-kill": "^1.2.2",
"ts-jest": "26.4.0",
"ts-node": "9.1.1",
"ts-patch": "^1.3.0",
"tslint": "6.1.3",
"typescript": "~4.0.3",
"webpack": "~4.44.1",
"webpack-cli": "~3.3.12"
},
"lint-staged": {
"**/*": [
"nx format:write --files"
]
}
}

View File

@@ -1 +1,5 @@
{ "extends": "../../.eslintrc", "rules": {}, "ignorePatterns": ["!**/*"] }
{
"extends": "../../.eslintrc",
"rules": {},
"ignorePatterns": ["!**/*"]
}

View File

@@ -0,0 +1,47 @@
import { ObservableArray } from '@nativescript/core/data/observable-array';
import { assert } from 'chai';
describe('observable-array', () => {
describe('splice', () => {
it('removes an item', () => {
const _array = new ObservableArray();
_array.push(1);
_array.push(2);
_array.splice(0, 1);
assert.equal(2, _array.getItem(0));
});
it('replaces an item', () => {
const _array = new ObservableArray();
_array.push(1);
_array.push(2);
_array.splice(0, 1, 3);
assert.equal(3, _array.getItem(0));
});
it('empties on start zero and no delete count', () => {
const _array = new ObservableArray();
_array.push(1);
_array.splice(0);
assert.equal(0, _array.length);
});
it('empties on length set to zero', () => {
const _array = new ObservableArray();
_array.push(1);
_array.push(2);
_array.length = 0;
assert.equal(0, _array.length);
});
});
});

View File

@@ -1,7 +1,7 @@
const _allColors:{[k:string]:number} = {};
const _allColors: { [k: string]: number } = {};
function registerColor(name: string | string[], value: number): number {
if (Array.isArray(name)) {
name.forEach(n=>_allColors[n.toLowerCase()] = value)
name.forEach((n) => (_allColors[n.toLowerCase()] = value));
} else {
_allColors[name.toLowerCase()] = value;
}
@@ -26,144 +26,144 @@ export function getKnownColor(name: string): number {
}
export const Transparent = registerColor('Transparent', 0x00000000);
export const AliceBlue = registerColor('AliceBlue', 0xffF0F8FF);
export const AntiqueWhite = registerColor('AntiqueWhite', 0xffFAEBD7);
export const Aqua = registerColor('Aqua', 0xff00FFFF);
export const Aquamarine = registerColor('Aquamarine', 0xff7FFFD4);
export const Azure = registerColor('Azure', 0xffF0FFFF);
export const Beige = registerColor('Beige', 0xffF5F5DC);
export const Bisque = registerColor('Bisque', 0xffFFE4C4);
export const AliceBlue = registerColor('AliceBlue', 0xfff0f8ff);
export const AntiqueWhite = registerColor('AntiqueWhite', 0xfffaebd7);
export const Aqua = registerColor('Aqua', 0xff00ffff);
export const Aquamarine = registerColor('Aquamarine', 0xff7fffd4);
export const Azure = registerColor('Azure', 0xfff0ffff);
export const Beige = registerColor('Beige', 0xfff5f5dc);
export const Bisque = registerColor('Bisque', 0xffffe4c4);
export const Black = registerColor('Black', 0xff000000);
export const BlanchedAlmond = registerColor('BlanchedAlmond', 0xffFFEBCD);
export const Blue = registerColor('Blue', 0xff0000FF);
export const BlueViolet = registerColor('BlueViolet', 0xff8A2BE2);
export const Brown = registerColor('Brown', 0xffA52A2A);
export const BurlyWood = registerColor('BurlyWood', 0xffDEB887);
export const CadetBlue = registerColor('CadetBlue', 0xff5F9EA0);
export const Chartreuse = registerColor('Chartreuse', 0xff7FFF00);
export const Chocolate = registerColor('Chocolate', 0xffD2691E);
export const Coral = registerColor('Coral', 0xffFF7F50);
export const CornflowerBlue = registerColor('CornflowerBlue', 0xff6495ED);
export const Cornsilk = registerColor('Cornsilk', 0xffFFF8DC);
export const Crimson = registerColor('Crimson', 0xffDC143C);
export const Cyan = registerColor('Cyan', 0xff00FFFF);
export const DarkBlue = registerColor('DarkBlue', 0xff00008B);
export const DarkCyan = registerColor('DarkCyan', 0xff008B8B);
export const DarkGoldenRod = registerColor('DarkGoldenRod', 0xffB8860B);
export const DarkGray = registerColor(['DarkGray', 'DarkGrey'], 0xffA9A9A9);
export const BlanchedAlmond = registerColor('BlanchedAlmond', 0xffffebcd);
export const Blue = registerColor('Blue', 0xff0000ff);
export const BlueViolet = registerColor('BlueViolet', 0xff8a2be2);
export const Brown = registerColor('Brown', 0xffa52a2a);
export const BurlyWood = registerColor('BurlyWood', 0xffdeb887);
export const CadetBlue = registerColor('CadetBlue', 0xff5f9ea0);
export const Chartreuse = registerColor('Chartreuse', 0xff7fff00);
export const Chocolate = registerColor('Chocolate', 0xffd2691e);
export const Coral = registerColor('Coral', 0xffff7f50);
export const CornflowerBlue = registerColor('CornflowerBlue', 0xff6495ed);
export const Cornsilk = registerColor('Cornsilk', 0xfffff8dc);
export const Crimson = registerColor('Crimson', 0xffdc143c);
export const Cyan = registerColor('Cyan', 0xff00ffff);
export const DarkBlue = registerColor('DarkBlue', 0xff00008b);
export const DarkCyan = registerColor('DarkCyan', 0xff008b8b);
export const DarkGoldenRod = registerColor('DarkGoldenRod', 0xffb8860b);
export const DarkGray = registerColor(['DarkGray', 'DarkGrey'], 0xffa9a9a9);
export const DarkGreen = registerColor('DarkGreen', 0xff006400);
export const DarkKhaki = registerColor('DarkKhaki', 0xffBDB76B);
export const DarkMagenta = registerColor('DarkMagenta', 0xff8B008B);
export const DarkOliveGreen = registerColor('DarkOliveGreen', 0xff556B2F);
export const DarkOrange = registerColor('DarkOrange', 0xffFF8C00);
export const DarkOrchid = registerColor('DarkOrchid', 0xff9932CC);
export const DarkRed = registerColor('DarkRed', 0xff8B0000);
export const DarkSalmon = registerColor('DarkSalmon', 0xffE9967A);
export const DarkSeaGreen = registerColor('DarkSeaGreen', 0xff8FBC8F);
export const DarkSlateBlue = registerColor('DarkSlateBlue', 0xff483D8B);
export const DarkSlateGray = registerColor(['DarkSlateGray', 'DarkSlateGrey'], 0xff2F4F4F);
export const DarkTurquoise = registerColor('DarkTurquoise', 0xff00CED1);
export const DarkViolet = registerColor('DarkViolet', 0xff9400D3);
export const DeepPink = registerColor('DeepPink', 0xffFF1493);
export const DeepSkyBlue = registerColor('DeepSkyBlue', 0xff00BFFF);
export const DarkKhaki = registerColor('DarkKhaki', 0xffbdb76b);
export const DarkMagenta = registerColor('DarkMagenta', 0xff8b008b);
export const DarkOliveGreen = registerColor('DarkOliveGreen', 0xff556b2f);
export const DarkOrange = registerColor('DarkOrange', 0xffff8c00);
export const DarkOrchid = registerColor('DarkOrchid', 0xff9932cc);
export const DarkRed = registerColor('DarkRed', 0xff8b0000);
export const DarkSalmon = registerColor('DarkSalmon', 0xffe9967a);
export const DarkSeaGreen = registerColor('DarkSeaGreen', 0xff8fbc8f);
export const DarkSlateBlue = registerColor('DarkSlateBlue', 0xff483d8b);
export const DarkSlateGray = registerColor(['DarkSlateGray', 'DarkSlateGrey'], 0xff2f4f4f);
export const DarkTurquoise = registerColor('DarkTurquoise', 0xff00ced1);
export const DarkViolet = registerColor('DarkViolet', 0xff9400d3);
export const DeepPink = registerColor('DeepPink', 0xffff1493);
export const DeepSkyBlue = registerColor('DeepSkyBlue', 0xff00bfff);
export const DimGray = registerColor(['DimGray', 'DimGrey'], 0xff696969);
export const DodgerBlue = registerColor('DodgerBlue', 0xff1E90FF);
export const FireBrick = registerColor('FireBrick', 0xffB22222);
export const FloralWhite = registerColor('FloralWhite', 0xffFFFAF0);
export const ForestGreen = registerColor('ForestGreen', 0xff228B22);
export const Fuchsia = registerColor('Fuchsia', 0xffFF00FF);
export const Gainsboro = registerColor('Gainsboro', 0xffDCDCDC);
export const GhostWhite = registerColor('GhostWhite', 0xffF8F8FF);
export const Gold = registerColor('Gold', 0xffFFD700);
export const GoldenRod = registerColor('GoldenRod', 0xffDAA520);
export const DodgerBlue = registerColor('DodgerBlue', 0xff1e90ff);
export const FireBrick = registerColor('FireBrick', 0xffb22222);
export const FloralWhite = registerColor('FloralWhite', 0xfffffaf0);
export const ForestGreen = registerColor('ForestGreen', 0xff228b22);
export const Fuchsia = registerColor('Fuchsia', 0xffff00ff);
export const Gainsboro = registerColor('Gainsboro', 0xffdcdcdc);
export const GhostWhite = registerColor('GhostWhite', 0xfff8f8ff);
export const Gold = registerColor('Gold', 0xffffd700);
export const GoldenRod = registerColor('GoldenRod', 0xffdaa520);
export const Gray = registerColor(['Gray', 'Grey'], 0xff808080);
export const Green = registerColor('Green', 0xff008000);
export const GreenYellow = registerColor('GreenYellow', 0xffADFF2F);
export const HoneyDew = registerColor('HoneyDew', 0xffF0FFF0);
export const HotPink = registerColor('HotPink', 0xffFF69B4);
export const IndianRed = registerColor('IndianRed', 0xffCD5C5C);
export const Indigo = registerColor('Indigo', 0xff4B0082);
export const Ivory = registerColor('Ivory', 0xffFFFFF0);
export const Khaki = registerColor('Khaki', 0xffF0E68C);
export const Lavender = registerColor('Lavender', 0xffE6E6FA);
export const LavenderBlush = registerColor('LavenderBlush', 0xffFFF0F5);
export const LawnGreen = registerColor('LawnGreen', 0xff7CFC00);
export const LemonChiffon = registerColor('LemonChiffon', 0xffFFFACD);
export const LightBlue = registerColor('LightBlue', 0xffADD8E6);
export const LightCoral = registerColor('LightCoral', 0xffF08080);
export const LightCyan = registerColor('LightCyan', 0xffE0FFFF);
export const LightGoldenRodYellow = registerColor('LightGoldenRodYellow', 0xffFAFAD2);
export const LightGray = registerColor(['LightGray', 'LightGrey'], 0xffD3D3D3);
export const LightGreen = registerColor('LightGreen', 0xff90EE90);
export const LightPink = registerColor('LightPink', 0xffFFB6C1);
export const LightSalmon = registerColor('LightSalmon', 0xffFFA07A);
export const LightSeaGreen = registerColor('LightSeaGreen', 0xff20B2AA);
export const LightSkyBlue = registerColor('LightSkyBlue', 0xff87CEFA);
export const GreenYellow = registerColor('GreenYellow', 0xffadff2f);
export const HoneyDew = registerColor('HoneyDew', 0xfff0fff0);
export const HotPink = registerColor('HotPink', 0xffff69b4);
export const IndianRed = registerColor('IndianRed', 0xffcd5c5c);
export const Indigo = registerColor('Indigo', 0xff4b0082);
export const Ivory = registerColor('Ivory', 0xfffffff0);
export const Khaki = registerColor('Khaki', 0xfff0e68c);
export const Lavender = registerColor('Lavender', 0xffe6e6fa);
export const LavenderBlush = registerColor('LavenderBlush', 0xfffff0f5);
export const LawnGreen = registerColor('LawnGreen', 0xff7cfc00);
export const LemonChiffon = registerColor('LemonChiffon', 0xfffffacd);
export const LightBlue = registerColor('LightBlue', 0xffadd8e6);
export const LightCoral = registerColor('LightCoral', 0xfff08080);
export const LightCyan = registerColor('LightCyan', 0xffe0ffff);
export const LightGoldenRodYellow = registerColor('LightGoldenRodYellow', 0xfffafad2);
export const LightGray = registerColor(['LightGray', 'LightGrey'], 0xffd3d3d3);
export const LightGreen = registerColor('LightGreen', 0xff90ee90);
export const LightPink = registerColor('LightPink', 0xffffb6c1);
export const LightSalmon = registerColor('LightSalmon', 0xffffa07a);
export const LightSeaGreen = registerColor('LightSeaGreen', 0xff20b2aa);
export const LightSkyBlue = registerColor('LightSkyBlue', 0xff87cefa);
export const LightSlateGray = registerColor(['LightSlateGray', 'LightSlateGrey'], 0xff778899);
export const LightSteelBlue = registerColor('LightSteelBlue', 0xffB0C4DE);
export const LightYellow = registerColor('LightYellow', 0xffFFFFE0);
export const Lime = registerColor('Lime', 0xff00FF00);
export const LimeGreen = registerColor('LimeGreen', 0xff32CD32);
export const Linen = registerColor('Linen', 0xffFAF0E6);
export const Magenta = registerColor('Magenta', 0xffFF00FF);
export const LightSteelBlue = registerColor('LightSteelBlue', 0xffb0c4de);
export const LightYellow = registerColor('LightYellow', 0xffffffe0);
export const Lime = registerColor('Lime', 0xff00ff00);
export const LimeGreen = registerColor('LimeGreen', 0xff32cd32);
export const Linen = registerColor('Linen', 0xfffaf0e6);
export const Magenta = registerColor('Magenta', 0xffff00ff);
export const Maroon = registerColor('Maroon', 0xff800000);
export const MediumAquaMarine = registerColor('MediumAquaMarine', 0xff66CDAA);
export const MediumBlue = registerColor('MediumBlue', 0xff0000CD);
export const MediumOrchid = registerColor('MediumOrchid', 0xffBA55D3);
export const MediumPurple = registerColor('MediumPurple', 0xff9370DB);
export const MediumSeaGreen = registerColor('MediumSeaGreen', 0xff3CB371);
export const MediumSlateBlue = registerColor('MediumSlateBlue', 0xff7B68EE);
export const MediumSpringGreen = registerColor('MediumSpringGreen', 0xff00FA9A);
export const MediumTurquoise = registerColor('MediumTurquoise', 0xff48D1CC);
export const MediumVioletRed = registerColor('MediumVioletRed', 0xffC71585);
export const MediumAquaMarine = registerColor('MediumAquaMarine', 0xff66cdaa);
export const MediumBlue = registerColor('MediumBlue', 0xff0000cd);
export const MediumOrchid = registerColor('MediumOrchid', 0xffba55d3);
export const MediumPurple = registerColor('MediumPurple', 0xff9370db);
export const MediumSeaGreen = registerColor('MediumSeaGreen', 0xff3cb371);
export const MediumSlateBlue = registerColor('MediumSlateBlue', 0xff7b68ee);
export const MediumSpringGreen = registerColor('MediumSpringGreen', 0xff00fa9a);
export const MediumTurquoise = registerColor('MediumTurquoise', 0xff48d1cc);
export const MediumVioletRed = registerColor('MediumVioletRed', 0xffc71585);
export const MidnightBlue = registerColor('MidnightBlue', 0xff191970);
export const MintCream = registerColor('MintCream', 0xffF5FFFA);
export const MistyRose = registerColor('MistyRose', 0xffFFE4E1);
export const Moccasin = registerColor('Moccasin', 0xffFFE4B5);
export const NavajoWhite = registerColor('NavajoWhite', 0xffFFDEAD);
export const MintCream = registerColor('MintCream', 0xfff5fffa);
export const MistyRose = registerColor('MistyRose', 0xffffe4e1);
export const Moccasin = registerColor('Moccasin', 0xffffe4b5);
export const NavajoWhite = registerColor('NavajoWhite', 0xffffdead);
export const Navy = registerColor('Navy', 0xff000080);
export const OldLace = registerColor('OldLace', 0xffFDF5E6);
export const OldLace = registerColor('OldLace', 0xfffdf5e6);
export const Olive = registerColor('Olive', 0xff808000);
export const OliveDrab = registerColor('OliveDrab', 0xff6B8E23);
export const Orange = registerColor('Orange', 0xffFFA500);
export const OrangeRed = registerColor('OrangeRed', 0xffFF4500);
export const Orchid = registerColor('Orchid', 0xffDA70D6);
export const PaleGoldenRod = registerColor('PaleGoldenRod', 0xffEEE8AA);
export const PaleGreen = registerColor('PaleGreen', 0xff98FB98);
export const PaleTurquoise = registerColor('PaleTurquoise', 0xffAFEEEE);
export const PaleVioletRed = registerColor('PaleVioletRed', 0xffDB7093);
export const PapayaWhip = registerColor('PapayaWhip', 0xffFFEFD5);
export const PeachPuff = registerColor('PeachPuff', 0xffFFDAB9);
export const Peru = registerColor('Peru', 0xffCD853F);
export const Pink = registerColor('Pink', 0xffFFC0CB);
export const Plum = registerColor('Plum', 0xffDDA0DD);
export const PowderBlue = registerColor('PowderBlue', 0xffB0E0E6);
export const OliveDrab = registerColor('OliveDrab', 0xff6b8e23);
export const Orange = registerColor('Orange', 0xffffa500);
export const OrangeRed = registerColor('OrangeRed', 0xffff4500);
export const Orchid = registerColor('Orchid', 0xffda70d6);
export const PaleGoldenRod = registerColor('PaleGoldenRod', 0xffeee8aa);
export const PaleGreen = registerColor('PaleGreen', 0xff98fb98);
export const PaleTurquoise = registerColor('PaleTurquoise', 0xffafeeee);
export const PaleVioletRed = registerColor('PaleVioletRed', 0xffdb7093);
export const PapayaWhip = registerColor('PapayaWhip', 0xffffefd5);
export const PeachPuff = registerColor('PeachPuff', 0xffffdab9);
export const Peru = registerColor('Peru', 0xffcd853f);
export const Pink = registerColor('Pink', 0xffffc0cb);
export const Plum = registerColor('Plum', 0xffdda0dd);
export const PowderBlue = registerColor('PowderBlue', 0xffb0e0e6);
export const Purple = registerColor('Purple', 0xff800080);
export const RebeccaPurple = registerColor('RebeccaPurple', 0xff663399);
export const Red = registerColor('Red', 0xffFF0000);
export const RosyBrown = registerColor('RosyBrown', 0xffBC8F8F);
export const RoyalBlue = registerColor('RoyalBlue', 0xff4169E1);
export const SaddleBrown = registerColor('SaddleBrown', 0xff8B4513);
export const Salmon = registerColor('Salmon', 0xffFA8072);
export const SandyBrown = registerColor('SandyBrown', 0xffF4A460);
export const SeaGreen = registerColor('SeaGreen', 0xff2E8B57);
export const SeaShell = registerColor('SeaShell', 0xffFFF5EE);
export const Sienna = registerColor('Sienna', 0xffA0522D);
export const Silver = registerColor('Silver', 0xffC0C0C0);
export const SkyBlue = registerColor('SkyBlue', 0xff87CEEB);
export const SlateBlue = registerColor('SlateBlue', 0xff6A5ACD);
export const Red = registerColor('Red', 0xffff0000);
export const RosyBrown = registerColor('RosyBrown', 0xffbc8f8f);
export const RoyalBlue = registerColor('RoyalBlue', 0xff4169e1);
export const SaddleBrown = registerColor('SaddleBrown', 0xff8b4513);
export const Salmon = registerColor('Salmon', 0xfffa8072);
export const SandyBrown = registerColor('SandyBrown', 0xfff4a460);
export const SeaGreen = registerColor('SeaGreen', 0xff2e8b57);
export const SeaShell = registerColor('SeaShell', 0xfffff5ee);
export const Sienna = registerColor('Sienna', 0xffa0522d);
export const Silver = registerColor('Silver', 0xffc0c0c0);
export const SkyBlue = registerColor('SkyBlue', 0xff87ceeb);
export const SlateBlue = registerColor('SlateBlue', 0xff6a5acd);
export const SlateGray = registerColor(['SlateGray', 'SlateGrey'], 0xff708090);
export const Snow = registerColor('Snow', 0xffFFFAFA);
export const SpringGreen = registerColor('SpringGreen', 0xff00FF7F);
export const SteelBlue = registerColor('SteelBlue', 0xff4682B4);
export const Tan = registerColor('Tan', 0xffD2B48C);
export const Snow = registerColor('Snow', 0xfffffafa);
export const SpringGreen = registerColor('SpringGreen', 0xff00ff7f);
export const SteelBlue = registerColor('SteelBlue', 0xff4682b4);
export const Tan = registerColor('Tan', 0xffd2b48c);
export const Teal = registerColor('Teal', 0xff008080);
export const Thistle = registerColor('Thistle', 0xffD8BFD8);
export const Tomato = registerColor('Tomato', 0xffFF6347);
export const Turquoise = registerColor('Turquoise', 0xff40E0D0);
export const Violet = registerColor('Violet', 0xffEE82EE);
export const Wheat = registerColor('Wheat', 0xffF5DEB3);
export const White = registerColor('White', 0xffFFFFFF);
export const WhiteSmoke = registerColor('WhiteSmoke', 0xffF5F5F5);
export const Yellow = registerColor('Yellow', 0xffFFFF00);
export const YellowGreen = registerColor('YellowGreen', 0xff9ACD32);
export const Thistle = registerColor('Thistle', 0xffd8bfd8);
export const Tomato = registerColor('Tomato', 0xffff6347);
export const Turquoise = registerColor('Turquoise', 0xff40e0d0);
export const Violet = registerColor('Violet', 0xffee82ee);
export const Wheat = registerColor('Wheat', 0xfff5deb3);
export const White = registerColor('White', 0xffffffff);
export const WhiteSmoke = registerColor('WhiteSmoke', 0xfff5f5f5);
export const Yellow = registerColor('Yellow', 0xffffff00);
export const YellowGreen = registerColor('YellowGreen', 0xff9acd32);

View File

@@ -33,7 +33,6 @@ export interface ChangedData<T> extends EventData {
* Number of added items.
*/
addedCount: number;
}
const CHANGE = 'change';
@@ -116,8 +115,8 @@ export class ObservableArray<T> extends Observable {
set length(value: number) {
if (types.isNumber(value) && this._array && this._array.length !== value) {
const added=[];
for (let i=this._array.length;i < value;++i) {
const added = [];
for (let i = this._array.length; i < value; ++i) {
added.push(undefined);
}
this.splice(value, this._array.length - value, ...added);
@@ -247,7 +246,7 @@ export class ObservableArray<T> extends Observable {
*/
splice(start: number, deleteCount?: number, ...items: any): T[] {
const length = this._array.length;
const result = this._array.splice(start, deleteCount, ...items);
const result = arguments.length === 1 ? this._array.splice(start) : this._array.splice(start, deleteCount, ...items);
this.notify(<ChangedData<T>>{
eventName: CHANGE,

View File

@@ -12,13 +12,11 @@ export interface EventData {
object: Observable;
}
export interface NotifyData extends Partial<EventData> {
eventName: string;
object?: Observable;
}
/**
* Data for the "propertyChange" event.
*/

View File

@@ -269,7 +269,7 @@ export class FileSystemAccess {
public write = this.writeSync.bind(this);
public writeAsync(path: string, bytes: native.Array<number>): Promise<void> {
public writeAsync(path: string, bytes: androidNative.Array<number>): Promise<void> {
return new Promise<void>((resolve, reject) => {
try {
org.nativescript.widgets.Async.File.write(
@@ -291,7 +291,7 @@ export class FileSystemAccess {
});
}
public writeSync(path: string, bytes: native.Array<number>, onError?: (error: any) => any) {
public writeSync(path: string, bytes: androidNative.Array<number>, onError?: (error: any) => any) {
try {
const javaFile = new java.io.File(path);
const stream = new java.io.FileOutputStream(javaFile);

View File

@@ -151,13 +151,6 @@ interface ModuleContext {
path: string;
}
// Define a minimal subset of NodeRequire and NodeModule so user apps can compile without
// installing @types/node
interface NodeRequire {
(id: string): any;
}
interface NodeModule {
exports: any;
id: string;
@@ -220,10 +213,6 @@ interface RequireContext {
resolve(id: string): string;
}
interface NodeRequire {
context(path: string, deep?: boolean, filter?: RegExp): RequireContext;
}
declare var __dirname: string;
declare var __filename: string;

View File

@@ -7,7 +7,7 @@ import { Color } from '../color';
// Types.
import { path as fsPath, knownFolders } from '../file-system';
import { isFileOrResourcePath, RESOURCE_PREFIX, layout } from '../utils';
import { isFileOrResourcePath, RESOURCE_PREFIX, layout, releaseNativeObject } from '../utils';
import { getScaledDimensions } from './image-source-common';

View File

@@ -93,7 +93,7 @@ export type { InstrumentationMode, TimerInfo } from './profiling';
export { encoding } from './text';
export * from './trace';
export * from './ui';
import { GC, isFontIconURI, isDataURI, isFileOrResourcePath, executeOnMainThread, mainThreadify, isMainThread, dispatchToMainThread, releaseNativeObject, getModuleName, openFile, openUrl, isRealDevice, layout, ad as androidUtils, iOSNativeHelper as iosUtils, Source } from './utils';
import { GC, isFontIconURI, isDataURI, isFileOrResourcePath, executeOnMainThread, mainThreadify, isMainThread, dispatchToMainThread, releaseNativeObject, getModuleName, openFile, openUrl, isRealDevice, layout, ad as androidUtils, iOSNativeHelper as iosUtils, Source, escapeRegexSymbols, convertString } from './utils';
import { ClassInfo, getClass, getBaseClasses, getClassInfo, isBoolean, isDefined, isFunction, isNullOrUndefined, isNumber, isObject, isString, isUndefined, toUIString, verifyCallback } from './utils/types';
export declare const Utils: {
GC: typeof GC;
@@ -107,6 +107,8 @@ export declare const Utils: {
isMainThread: typeof isMainThread;
dispatchToMainThread: typeof dispatchToMainThread;
releaseNativeObject: typeof releaseNativeObject;
escapeRegexSymbols: typeof escapeRegexSymbols;
convertString: typeof convertString;
getModuleName: typeof getModuleName;
openFile: typeof openFile;
openUrl: typeof openUrl;

View File

@@ -110,7 +110,7 @@ export * from './trace';
export * from './ui';
import { GC, isFontIconURI, isDataURI, isFileOrResourcePath, executeOnMainThread, mainThreadify, isMainThread, dispatchToMainThread, queueMacrotask, releaseNativeObject, getModuleName, openFile, openUrl, isRealDevice, layout, ad as androidUtils, iOSNativeHelper as iosUtils, Source, RESOURCE_PREFIX, FILE_PREFIX } from './utils';
import { GC, isFontIconURI, isDataURI, isFileOrResourcePath, executeOnMainThread, mainThreadify, isMainThread, dispatchToMainThread, queueMacrotask, releaseNativeObject, getModuleName, openFile, openUrl, isRealDevice, layout, ad as androidUtils, iOSNativeHelper as iosUtils, Source, RESOURCE_PREFIX, FILE_PREFIX, escapeRegexSymbols, convertString } from './utils';
import { ClassInfo, getClass, getBaseClasses, getClassInfo, isBoolean, isDefined, isFunction, isNullOrUndefined, isNumber, isObject, isString, isUndefined, toUIString, verifyCallback } from './utils/types';
export const Utils = {
@@ -126,6 +126,8 @@ export const Utils = {
dispatchToMainThread,
queueMacrotask,
releaseNativeObject,
convertString,
escapeRegexSymbols,
getModuleName,
openFile,

View File

@@ -25,7 +25,7 @@ function processFile(file: fs.File) {
const loadContent = () => file.readTextSync();
switch (file.extension.toLocaleLowerCase()) {
case '.js':{
case '.js': {
const noExtPath = filePathRelativeToApp.substr(0, filePathRelativeToApp.length - '.js'.length);
register(filePathRelativeToApp, function () {

View File

@@ -3,7 +3,7 @@
"main": "index",
"types": "index.d.ts",
"description": "NativeScript Core Modules",
"version": "7.0.13",
"version": "7.3.0",
"homepage": "https://nativescript.org",
"repository": {
"type": "git",

View File

@@ -57,6 +57,9 @@ export class Screen {
static mainScreen = new MainScreen();
}
// This retains compatibility with NS6
export const screen = Screen;
class DeviceRef {
private _manufacturer: string;
private _model: string;
@@ -145,5 +148,8 @@ class DeviceRef {
export const Device = new DeviceRef();
// This retains compatibility with NS6
export const device = Device;
export const isAndroid = global.isAndroid;
export const isIOS = global.isIOS;

View File

@@ -121,7 +121,21 @@ export class Screen {
static mainScreen: ScreenMetrics;
}
/**
* An object describing general information about a display.
*
* This retains compatibility with NS6
*/
export const screen: Screen;
/**
* Gets the current device information.
*/
export const Device: IDevice;
/**
* Gets the current device information.
*
* This retains compatibility with NS6
*/
export const device: IDevice;

View File

@@ -119,9 +119,15 @@ class MainScreen {
export const Device = new DeviceRef();
// This retains compatibility with NS6
export const device = Device;
export class Screen {
static mainScreen = new MainScreen();
}
// This retains compatibility with NS6
export const screen = Screen;
export const isAndroid = global.isAndroid;
export const isIOS = global.isIOS;

View File

Binary file not shown.

View File

@@ -1,4 +1,12 @@
platform :ios, '9.0'
platform :ios, '12.0'
use_frameworks!
pod 'MaterialComponents/Tabs', '~> 94.5'
pod 'MaterialComponents/Tabs', '~> 94.5'
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings.delete 'IPHONEOS_DEPLOYMENT_TARGET'
end
end
end

View File

Binary file not shown.

View File

@@ -0,0 +1,44 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>AvailableLibraries</key>
<array>
<dict>
<key>DebugSymbolsPath</key>
<string>dSYMs</string>
<key>LibraryIdentifier</key>
<string>ios-arm64</string>
<key>LibraryPath</key>
<string>TNSWidgets.framework</string>
<key>SupportedArchitectures</key>
<array>
<string>arm64</string>
</array>
<key>SupportedPlatform</key>
<string>ios</string>
</dict>
<dict>
<key>DebugSymbolsPath</key>
<string>dSYMs</string>
<key>LibraryIdentifier</key>
<string>ios-arm64_x86_64-simulator</string>
<key>LibraryPath</key>
<string>TNSWidgets.framework</string>
<key>SupportedArchitectures</key>
<array>
<string>arm64</string>
<string>x86_64</string>
</array>
<key>SupportedPlatform</key>
<string>ios</string>
<key>SupportedPlatformVariant</key>
<string>simulator</string>
</dict>
</array>
<key>CFBundlePackageType</key>
<string>XFWK</string>
<key>XCFrameworkFormatVersion</key>
<string>1.0</string>
</dict>
</plist>

View File

@@ -17,7 +17,7 @@ NS_ASSUME_NONNULL_BEGIN
- (void)writeToFile:(nonnull NSString*) path
atomically:(BOOL)atomically
completion:(void (^) ())callback;
completion:(void (^) (void))callback;
@end

View File

@@ -14,7 +14,7 @@
/**
* Get the milliseconds since the process started.
*/
double __tns_uptime();
double __tns_uptime(void);
/**
* Provides access to NSLog. The runtime implementation of console.log is filtered in release.

View File

@@ -0,0 +1,17 @@
//
// NSObject+Swizzling.h
// TNSWidgets
//
// Created by Manol Donev on 21.08.18.
// Copyright © 2018 Telerik A D. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <objc/runtime.h>
@interface NSObject (Swizzling)
+ (void)swizzleInstanceMethodWithOriginalSelector:(SEL)originalSelector fromClass:(Class)classContainigOriginalSel withSwizzlingSelector:(SEL)swizzlingSelector;
@end

View File

@@ -0,0 +1,18 @@
//
// UIView+PropertyBag.h
// TNSWidgets
//
// Created by Manol Donev on 21.08.18.
// Copyright © 2018 Telerik A D. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
@interface UIView (PropertyBag)
- (id) propertyValueForKey:(NSString*) key;
- (void) setPropertyValue:(id) value forKey:(NSString*) key;
@end

View File

@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleIdentifier</key>
<string>com.apple.xcode.dsym.org.nativescript.TNSWidgets</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundlePackageType</key>
<string>dSYM</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleVersion</key>
<string>1</string>
</dict>
</plist>

View File

@@ -0,0 +1,24 @@
//
// NSData+Async.h
// TNSWidgets
//
// Created by Peter Staev on 7.08.19.
// Copyright © 2019 Telerik A D. All rights reserved.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@interface NSData (Async)
+ (void)dataWithContentsOfFile:(nonnull NSString*)path
completion:(void (^) (NSData*))callback;
- (void)writeToFile:(nonnull NSString*) path
atomically:(BOOL)atomically
completion:(void (^) (void))callback;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,25 @@
//
// NSString+Async.h
// TNSWidgets
//
// Created by Peter Staev on 5.08.19.
// Copyright © 2019 Telerik A D. All rights reserved.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@interface NSString (Async)
+ (void)stringWithContentsOfFile:(nonnull NSString*)path
encoding:(NSStringEncoding)enc
completion:(void (^) (NSString*, NSError*))callback;
- (void)writeToFile:(nonnull NSString*) path
atomically:(BOOL)atomically
encoding:(NSStringEncoding)enc
completion:(void (^) (NSError*))callback;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,16 @@
//
// TNSLabel.h
// TNSWidgets
//
// Created by Hristo Hristov on 6/9/16.
// Copyright © 2016 Telerik A D. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface TNSLabel : UILabel
@property(nonatomic) UIEdgeInsets padding;
@property(nonatomic) UIEdgeInsets borderThickness;
@end

View File

@@ -0,0 +1,29 @@
//
// TNSProcess.h
// TNSWidgets
//
// Created by Panayot Cankov on 15/05/2017.
// Copyright © 2017 Telerik A D. All rights reserved.
//
#ifndef TNSProcess_h
#define TNSProcess_h
#import <Foundation/Foundation.h>
/**
* Get the milliseconds since the process started.
*/
double __tns_uptime(void);
/**
* Provides access to NSLog. The runtime implementation of console.log is filtered in release.
* We rarely need to log in release but in cases such as when logging app startup times in release,
* this will be convenient shortcut to NSLog, NSLog is not exposed.
*
* Please note the {N} CLI may be filtering app output, prefixing the message with "CONSOLE LOG"
* will make the logs visible in "tns run ios --release" builds.
*/
void __nslog(NSString* message);
#endif /* TNSProcess_h */

View File

@@ -0,0 +1,24 @@
//
// TNSWidgets.h
// TNSWidgets
//
// Created by Panayot Cankov on 4/27/16.
// Copyright © 2016 Telerik A D. All rights reserved.
//
#import <UIKit/UIKit.h>
//! Project version number for TNSWidgets.
FOUNDATION_EXPORT double TNSWidgetsVersionNumber;
//! Project version string for TNSWidgets.
FOUNDATION_EXPORT const unsigned char TNSWidgetsVersionString[];
// In this header, you should import all the public headers of your framework using statements like #import <TNSWidgets/PublicHeader.h>
#import "UIImage+TNSBlocks.h"
#import "UIView+PassThroughParent.h"
#import "TNSLabel.h"
#import "TNSProcess.h"
#import "NSString+Async.h"
#import "NSData+Async.h"

View File

@@ -0,0 +1,26 @@
//
// UIImage+UIImage_Async.h
// TKImageAsync
//
// Created by Panayot Cankov on 4/18/16.
// Copyright © 2016 Telerik A D. All rights reserved.
//
@interface UIImage (TNSBlocks)
/**
* Similar to imageNamed: however it runs on a separate queue so the UI thread is not blocked.
* It also draws the UIImage in a small thumb to force decoding potentially avoiding UI hicckups when displayed.
*/
+ (void) tns_safeDecodeImageNamed: (NSString*) name completion: (void (^) (UIImage*))callback;
/**
* Same as imageNamed, however calls to this method are sinchronized to be thread safe in iOS8 along with calls to tns_safeImageNamed and tns_safeDecodeImageNamed:completion:
* imageNamed is thread safe in iOS 9 and later so in later versions this methods simply fallbacks to imageNamed:
*/
+ (UIImage*) tns_safeImageNamed: (NSString*) name;
+ (void) tns_decodeImageWithData: (NSData*) data completion: (void (^) (UIImage*))callback;
+ (void) tns_decodeImageWidthContentsOfFile: (NSString*) file completion: (void (^) (UIImage*))callback;
@end

View File

@@ -0,0 +1,17 @@
//
// UIView+PassThroughParent.h
// TNSWidgets
//
// Created by Manol Donev on 21.08.18.
// Copyright © 2018 Telerik A D. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface UIView (PassThroughParent)
- (BOOL) passThroughParent;
- (void) setPassThroughParent:(BOOL) passThroughParent;
@end

View File

@@ -0,0 +1,6 @@
framework module TNSWidgets {
umbrella header "TNSWidgets.h"
export *
module * { export * }
}

View File

@@ -0,0 +1,17 @@
//
// NSObject+Swizzling.h
// TNSWidgets
//
// Created by Manol Donev on 21.08.18.
// Copyright © 2018 Telerik A D. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <objc/runtime.h>
@interface NSObject (Swizzling)
+ (void)swizzleInstanceMethodWithOriginalSelector:(SEL)originalSelector fromClass:(Class)classContainigOriginalSel withSwizzlingSelector:(SEL)swizzlingSelector;
@end

View File

@@ -0,0 +1,18 @@
//
// UIView+PropertyBag.h
// TNSWidgets
//
// Created by Manol Donev on 21.08.18.
// Copyright © 2018 Telerik A D. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
@interface UIView (PropertyBag)
- (id) propertyValueForKey:(NSString*) key;
- (void) setPropertyValue:(id) value forKey:(NSString*) key;
@end

View File

@@ -0,0 +1,212 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>files</key>
<dict>
<key>Headers/NSData+Async.h</key>
<data>
9BsuK8QsA57YnHHgpWIgaHygSEk=
</data>
<key>Headers/NSString+Async.h</key>
<data>
o8366y9zYMOVyObC3vtKKy/8jxA=
</data>
<key>Headers/TNSLabel.h</key>
<data>
x8V4jT6oNNls+KE3y/DE6ij9eCk=
</data>
<key>Headers/TNSProcess.h</key>
<data>
dHuocpQ4b8KDApobwYNCqXcC6ZE=
</data>
<key>Headers/TNSWidgets.h</key>
<data>
gUvu5bjZg5Aie5iJ1krxFmDrHwk=
</data>
<key>Headers/UIImage+TNSBlocks.h</key>
<data>
OzGlvoGOJcFC6Z+YR5xThjLTUK4=
</data>
<key>Headers/UIView+PassThroughParent.h</key>
<data>
zdxBV/QJg7NPyx04RmZrXsxbHKU=
</data>
<key>Info.plist</key>
<data>
ADh4pPlA/MlPeoqmSDibKmrOKb0=
</data>
<key>Modules/module.modulemap</key>
<data>
ANIiDnbrCY8YCOtOm1xDrUyt8do=
</data>
<key>PrivateHeaders/NSObject+Swizzling.h</key>
<data>
wRUUMHgrTVWHd/e8bDqN8sYZth4=
</data>
<key>PrivateHeaders/UIView+PropertyBag.h</key>
<data>
3USXIiZgky+5k7en+R6oyZ3pP18=
</data>
</dict>
<key>files2</key>
<dict>
<key>Headers/NSData+Async.h</key>
<dict>
<key>hash2</key>
<data>
JdjuVUBed00Ged4cSDzYLXONUlESu+dae9KN0PYJ/nM=
</data>
</dict>
<key>Headers/NSString+Async.h</key>
<dict>
<key>hash2</key>
<data>
1Iuk4atAJ89zujXqrLBvGz7Ny52RXNdD5c1ZMK0SFgs=
</data>
</dict>
<key>Headers/TNSLabel.h</key>
<dict>
<key>hash2</key>
<data>
uaE78Ar4SA7jzBIQrT3lTvBQFOQj1sf1ippa8ldUDqQ=
</data>
</dict>
<key>Headers/TNSProcess.h</key>
<dict>
<key>hash2</key>
<data>
E+JvepkSwLMNO6gdhEdwuzkdVTUqmWp8P5LxHYCFim8=
</data>
</dict>
<key>Headers/TNSWidgets.h</key>
<dict>
<key>hash2</key>
<data>
V99t2zLwRPOs90tbGiQbhbdAFJlW7mp7X2R5337ewUA=
</data>
</dict>
<key>Headers/UIImage+TNSBlocks.h</key>
<dict>
<key>hash2</key>
<data>
MgrX2woetySmXcrrDF290WGxNiW5W3E0B0fsjy8BgNI=
</data>
</dict>
<key>Headers/UIView+PassThroughParent.h</key>
<dict>
<key>hash2</key>
<data>
UfHyaUaTFlNcY5M7lUKwq6bPGuQeVIbjhCCInN1ZEYA=
</data>
</dict>
<key>Modules/module.modulemap</key>
<dict>
<key>hash2</key>
<data>
geXwbECY3V3psdekq89Ia+2j4/OludM5UatqEk+xhhc=
</data>
</dict>
<key>PrivateHeaders/NSObject+Swizzling.h</key>
<dict>
<key>hash2</key>
<data>
S+GqZzjPH/SqyxwzyysFybjZsbwS5lxcTwL04W79IGA=
</data>
</dict>
<key>PrivateHeaders/UIView+PropertyBag.h</key>
<dict>
<key>hash2</key>
<data>
/qFTteGRAX+GloVCipAdNRXPDPDWsNmQ+9USxt99lXE=
</data>
</dict>
</dict>
<key>rules</key>
<dict>
<key>^.*</key>
<true/>
<key>^.*\.lproj/</key>
<dict>
<key>optional</key>
<true/>
<key>weight</key>
<real>1000</real>
</dict>
<key>^.*\.lproj/locversion.plist$</key>
<dict>
<key>omit</key>
<true/>
<key>weight</key>
<real>1100</real>
</dict>
<key>^Base\.lproj/</key>
<dict>
<key>weight</key>
<real>1010</real>
</dict>
<key>^version.plist$</key>
<true/>
</dict>
<key>rules2</key>
<dict>
<key>.*\.dSYM($|/)</key>
<dict>
<key>weight</key>
<real>11</real>
</dict>
<key>^(.*/)?\.DS_Store$</key>
<dict>
<key>omit</key>
<true/>
<key>weight</key>
<real>2000</real>
</dict>
<key>^.*</key>
<true/>
<key>^.*\.lproj/</key>
<dict>
<key>optional</key>
<true/>
<key>weight</key>
<real>1000</real>
</dict>
<key>^.*\.lproj/locversion.plist$</key>
<dict>
<key>omit</key>
<true/>
<key>weight</key>
<real>1100</real>
</dict>
<key>^Base\.lproj/</key>
<dict>
<key>weight</key>
<real>1010</real>
</dict>
<key>^Info\.plist$</key>
<dict>
<key>omit</key>
<true/>
<key>weight</key>
<real>20</real>
</dict>
<key>^PkgInfo$</key>
<dict>
<key>omit</key>
<true/>
<key>weight</key>
<real>20</real>
</dict>
<key>^embedded\.provisionprofile$</key>
<dict>
<key>weight</key>
<real>20</real>
</dict>
<key>^version\.plist$</key>
<dict>
<key>weight</key>
<real>20</real>
</dict>
</dict>
</dict>
</plist>

View File

@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleIdentifier</key>
<string>com.apple.xcode.dsym.org.nativescript.TNSWidgets</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundlePackageType</key>
<string>dSYM</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleVersion</key>
<string>1</string>
</dict>
</plist>

View File

@@ -47,10 +47,12 @@ export class ActivityIndicator extends ActivityIndicatorBase {
return -1;
}
[colorProperty.setNative](value: number | Color) {
if (value instanceof Color) {
this.nativeViewProtected.getIndeterminateDrawable().setColorFilter(value.android, android.graphics.PorterDuff.Mode.SRC_IN);
const color = value instanceof Color ? value.android : value;
const drawable = this.nativeViewProtected.getIndeterminateDrawable().mutate();
if (color) {
drawable.setColorFilter(color, android.graphics.PorterDuff.Mode.SRC_IN);
} else {
this.nativeViewProtected.getIndeterminateDrawable().clearColorFilter();
drawable.clearColorFilter();
}
}
}

View File

@@ -19,9 +19,9 @@ export type TransformFunctionsInfo = {
};
export interface AnimationPromise extends Promise<any>, Cancelable {
then(...args):AnimationPromise
catch(...args):AnimationPromise
};
then(...args): AnimationPromise;
catch(...args): AnimationPromise;
}
export interface Pair {
x: number;

View File

@@ -340,7 +340,7 @@ export class Animation extends AnimationBase {
animators.push(createObjectAnimator(nativeView, 'alpha', propertyAnimation.value));
break;
case Properties.backgroundColor:{
case Properties.backgroundColor: {
backgroundColorProperty._initDefaultNativeValue(style);
ensureArgbEvaluator();

View File

@@ -380,7 +380,7 @@ export class Animation extends AnimationBase {
toValue = NSValue.valueWithCATransform3D(Animation._createNativeAffineTransform(animation));
break;
case Properties.width:
case Properties.height:{
case Properties.height: {
const direction: string = animation.property;
const isHeight: boolean = direction === 'height';
propertyNameToAnimate = 'bounds';

View File

@@ -428,7 +428,7 @@ export class BottomNavigation extends TabNavigationBase {
const fragmentToDetach = this._currentFragment;
if (fragmentToDetach) {
this.destroyItem((<any>fragmentToDetach).index, fragmentToDetach);
this.commitCurrentTransaction();
this.removeFragment(fragmentToDetach);
}
}
@@ -454,28 +454,42 @@ export class BottomNavigation extends TabNavigationBase {
private disposeTabFragments(): void {
const fragmentManager = this._getFragmentManager();
const transaction = fragmentManager.beginTransaction();
const fragments = fragmentManager.getFragments().toArray();
for (let i = 0; i < fragments.length; i++) {
transaction.remove(fragments[i]);
this.removeFragment(fragments[i]);
}
transaction.commitNowAllowingStateLoss();
}
private get currentTransaction(): androidx.fragment.app.FragmentTransaction {
if (!this._currentTransaction) {
const fragmentManager = this._getFragmentManager();
this._currentTransaction = fragmentManager.beginTransaction();
}
return this._currentTransaction;
}
private commitCurrentTransaction(): void {
if (this._currentTransaction) {
this._currentTransaction.commitNowAllowingStateLoss();
this._currentTransaction = null;
private attachFragment(fragment: androidx.fragment.app.Fragment, id?: number, name?: string): void {
const fragmentManager = this._getFragmentManager();
if (fragment) {
if (fragment.isAdded() || fragment.isRemoving()) {
// ignore
} else {
const fragmentExitTransition = fragment.getExitTransition();
if (fragmentExitTransition && fragmentExitTransition instanceof org.nativescript.widgets.CustomTransition) {
fragmentExitTransition.setResetOnTransitionEnd(true);
}
if (fragmentManager) {
if (!fragmentManager.isDestroyed()) {
try {
if (fragmentManager.isStateSaved()) {
if (id && name) {
fragmentManager.beginTransaction().add(id, fragment, name).commitNowAllowingStateLoss();
} else {
fragmentManager.beginTransaction().attach(fragment).commitNowAllowingStateLoss();
}
} else {
if (id && name) {
fragmentManager.beginTransaction().add(id, fragment, name).commitNow();
} else {
fragmentManager.beginTransaction().attach(fragment).commitNow();
}
}
} catch (e) {}
}
}
}
}
}
@@ -495,8 +509,6 @@ export class BottomNavigation extends TabNavigationBase {
const fragment = this.instantiateItem(this._contentView, index);
this.setPrimaryItem(index, fragment);
this.commitCurrentTransaction();
}
private instantiateItem(container: android.view.ViewGroup, position: number): androidx.fragment.app.Fragment {
@@ -505,10 +517,10 @@ export class BottomNavigation extends TabNavigationBase {
const fragmentManager = this._getFragmentManager();
let fragment: androidx.fragment.app.Fragment = fragmentManager.findFragmentByTag(name);
if (fragment != null) {
this.currentTransaction.attach(fragment);
this.attachFragment(fragment);
} else {
fragment = TabFragment.newInstance(this._domId, position);
this.currentTransaction.add(container.getId(), fragment, name);
this.attachFragment(fragment, container.getId(), name);
}
if (fragment !== this._currentFragment) {
@@ -528,7 +540,9 @@ export class BottomNavigation extends TabNavigationBase {
if (fragment != null) {
fragment.setMenuVisibility(true);
fragment.setUserVisibleHint(true);
// commenting out as it fixes rare crash when going
// back from deeply nested/modally shown fragments
// fragment.setUserVisibleHint(true);
}
this._currentFragment = fragment;
@@ -545,7 +559,7 @@ export class BottomNavigation extends TabNavigationBase {
private destroyItem(position: number, fragment: androidx.fragment.app.Fragment): void {
if (fragment) {
this.currentTransaction.detach(fragment);
this.removeFragment(fragment);
if (this._currentFragment === fragment) {
this._currentFragment = null;
}
@@ -555,6 +569,34 @@ export class BottomNavigation extends TabNavigationBase {
this.items[position].canBeLoaded = false;
}
}
private removeFragment(fragment: androidx.fragment.app.Fragment, fragmentManager?: any) {
if (!fragmentManager) {
fragmentManager = this._getFragmentManager();
}
if (fragment) {
if (!fragment.isAdded() || fragment.isRemoving()) {
// ignore
return;
} else {
const fragmentExitTransition = fragment.getExitTransition();
if (fragmentExitTransition && fragmentExitTransition instanceof org.nativescript.widgets.CustomTransition) {
fragmentExitTransition.setResetOnTransitionEnd(true);
}
if (fragment && fragment.isAdded() && !fragment.isRemoving()) {
const pfm = (<any>fragment).getParentFragmentManager ? (<any>fragment).getParentFragmentManager() : fragmentManager;
if (pfm) {
try {
if (pfm.isStateSaved()) {
pfm.beginTransaction().remove(fragment).commitNowAllowingStateLoss();
} else {
pfm.beginTransaction().remove(fragment).commitNow();
}
} catch (e) {}
}
}
}
}
}
private setTabStripItems(items: Array<TabStripItem>) {
if (!this.tabStrip || !items) {

View File

@@ -3,7 +3,7 @@ import * as reduceCSSCalc from 'reduce-css-calc';
import { ViewBase } from '../view-base';
// Types.
import { WrappedValue, PropertyChangeData } from '../../../data/observable';
import { PropertyChangeData, WrappedValue } from '../../../data/observable';
import { Trace } from '../../../trace';
import { Style } from '../../styling/style';
@@ -11,7 +11,7 @@ import { Style } from '../../styling/style';
import { profile } from '../../../profiling';
/**
* Value specifing that Property should be set to its initial value.
* Value specifying that Property should be set to its initial value.
*/
export const unsetValue: any = new Object();
@@ -183,6 +183,7 @@ export class Property<T extends ViewBase, U> implements TypedPropertyDescriptor<
public get: () => U;
public set: (value: U) => void;
public overrideHandlers: (options: PropertyOptions<T, U>) => void;
public enumerable = true;
public configurable = true;
@@ -206,10 +207,26 @@ export class Property<T extends ViewBase, U> implements TypedPropertyDescriptor<
this.defaultValue = defaultValue;
const eventName = propertyName + 'Change';
const equalityComparer = options.equalityComparer;
const affectsLayout: boolean = options.affectsLayout;
const valueChanged = options.valueChanged;
const valueConverter = options.valueConverter;
let equalityComparer = options.equalityComparer;
let affectsLayout: boolean = options.affectsLayout;
let valueChanged = options.valueChanged;
let valueConverter = options.valueConverter;
this.overrideHandlers = function (options: PropertyOptions<T, U>) {
if (typeof options.equalityComparer !== 'undefined') {
equalityComparer = options.equalityComparer;
}
if (typeof options.affectsLayout !== 'undefined') {
affectsLayout = options.affectsLayout;
}
if (typeof options.valueChanged !== 'undefined') {
valueChanged = options.valueChanged;
}
if (typeof options.valueConverter !== 'undefined') {
valueConverter = options.valueConverter;
}
};
const property = this;
@@ -364,14 +381,32 @@ export class CoercibleProperty<T extends ViewBase, U> extends Property<T, U> imp
const coerceKey = Symbol(propertyName + ':coerceKey');
const eventName = propertyName + 'Change';
const affectsLayout: boolean = options.affectsLayout;
const equalityComparer = options.equalityComparer;
const valueChanged = options.valueChanged;
const valueConverter = options.valueConverter;
const coerceCallback = options.coerceValue;
let affectsLayout: boolean = options.affectsLayout;
let equalityComparer = options.equalityComparer;
let valueChanged = options.valueChanged;
let valueConverter = options.valueConverter;
let coerceCallback = options.coerceValue;
const property = this;
this.overrideHandlers = function (options: CoerciblePropertyOptions<T, U>) {
if (typeof options.equalityComparer !== 'undefined') {
equalityComparer = options.equalityComparer;
}
if (typeof options.affectsLayout !== 'undefined') {
affectsLayout = options.affectsLayout;
}
if (typeof options.valueChanged !== 'undefined') {
valueChanged = options.valueChanged;
}
if (typeof options.valueConverter !== 'undefined') {
valueConverter = options.valueConverter;
}
if (typeof options.coerceValue !== 'undefined') {
coerceCallback = options.coerceValue;
}
};
this.coerce = function (target: T): void {
const originalValue: U = coerceKey in target ? target[coerceKey] : defaultValue;
// need that to make coercing but also fire change events
@@ -559,6 +594,8 @@ export class CssProperty<T extends Style, U> implements CssProperty<T, U> {
public readonly defaultValueKey: symbol;
public readonly defaultValue: U;
public overrideHandlers: (options: CssPropertyOptions<T, U>) => void;
constructor(options: CssPropertyOptions<T, U>) {
const propertyName = options.name;
this.name = propertyName;
@@ -587,10 +624,25 @@ export class CssProperty<T extends Style, U> implements CssProperty<T, U> {
this.defaultValue = defaultValue;
const eventName = propertyName + 'Change';
const affectsLayout: boolean = options.affectsLayout;
const equalityComparer = options.equalityComparer;
const valueChanged = options.valueChanged;
const valueConverter = options.valueConverter;
let affectsLayout: boolean = options.affectsLayout;
let equalityComparer = options.equalityComparer;
let valueChanged = options.valueChanged;
let valueConverter = options.valueConverter;
this.overrideHandlers = function (options: CssPropertyOptions<T, U>) {
if (typeof options.equalityComparer !== 'undefined') {
equalityComparer = options.equalityComparer;
}
if (typeof options.affectsLayout !== 'undefined') {
affectsLayout = options.affectsLayout;
}
if (typeof options.valueChanged !== 'undefined') {
valueChanged = options.valueChanged;
}
if (typeof options.valueConverter !== 'undefined') {
valueConverter = options.valueConverter;
}
};
const property = this;
@@ -1015,6 +1067,7 @@ CssAnimationProperty.prototype.isStyleProperty = true;
export class InheritedCssProperty<T extends Style, U> extends CssProperty<T, U> implements InheritedCssProperty<T, U> {
public setInheritedValue: (value: U) => void;
public overrideHandlers: (options: CssPropertyOptions<T, U>) => void;
constructor(options: CssPropertyOptions<T, U>) {
super(options);
@@ -1027,14 +1080,29 @@ export class InheritedCssProperty<T extends Style, U> extends CssProperty<T, U>
const defaultValueKey = this.defaultValueKey;
const eventName = propertyName + 'Change';
const defaultValue: U = options.defaultValue;
const affectsLayout: boolean = options.affectsLayout;
const equalityComparer = options.equalityComparer;
const valueChanged = options.valueChanged;
const valueConverter = options.valueConverter;
let defaultValue: U = options.defaultValue;
let affectsLayout: boolean = options.affectsLayout;
let equalityComparer = options.equalityComparer;
let valueChanged = options.valueChanged;
let valueConverter = options.valueConverter;
const property = this;
this.overrideHandlers = function (options: CssPropertyOptions<T, U>) {
if (typeof options.equalityComparer !== 'undefined') {
equalityComparer = options.equalityComparer;
}
if (typeof options.affectsLayout !== 'undefined') {
affectsLayout = options.affectsLayout;
}
if (typeof options.valueChanged !== 'undefined') {
valueChanged = options.valueChanged;
}
if (typeof options.valueConverter !== 'undefined') {
valueConverter = options.valueConverter;
}
};
const setFunc = (valueSource: ValueSource) =>
function (this: T, boxedValue: any): void {
const view = this.viewRef.get();
@@ -1478,12 +1546,18 @@ export function makeValidator<T>(...values: T[]): (value: any) => value is T {
return (value: any): value is T => set.has(value);
}
export function makeParser<T>(isValid: (value: any) => boolean): (value: any) => T {
export function makeParser<T>(isValid: (value: any) => boolean, allowNumbers = false): (value: any) => T {
return (value) => {
const lower = value && value.toLowerCase();
if (isValid(lower)) {
return lower;
} else {
if (allowNumbers) {
const convNumber = +value;
if (!isNaN(convNumber)) {
return value;
}
}
throw new Error('Invalid value: ' + value);
}
};

View File

@@ -83,6 +83,11 @@ export interface ShowModalOptions {
* An optional parameter specifying whether the modal view can be dismissed when not in full-screen mode.
*/
cancelable?: boolean;
/**
* An optional parameter specifying the windowSoftInputMode of the dialog window
* For possible values see https://developer.android.com/reference/android/view/WindowManager.LayoutParams#softInputMode
*/
windowSoftInputMode?: number;
};
/**
* An optional parameter specifying whether the modal view can be dismissed when not in full-screen mode.

Some files were not shown because too many files have changed in this diff Show More