-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
2,045 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<markdown [data]="(readme | async) || ''" /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import {CommonModule} from '@angular/common'; | ||
import {ChangeDetectionStrategy, Component} from '@angular/core'; | ||
import {MarkdownModule} from 'ngx-markdown'; | ||
|
||
@Component({ | ||
standalone: true, | ||
selector: 'platform-page', | ||
imports: [CommonModule, MarkdownModule], | ||
templateUrl: './index.html', | ||
changeDetection: ChangeDetectionStrategy.OnPush, | ||
}) | ||
export default class CommonPage { | ||
protected readonly readme = import( | ||
'../../../../../../libs/platform/README.md?raw' | ||
).then((a) => a.default.replace('![logo](logo.svg) ', '')) as any as Promise<string>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# ![ng-web-apis logo](https://raw.githubusercontent.com/taiga-family/ng-web-apis/main/libs/platform/logo.svg) Platform | ||
|
||
## Install | ||
|
||
```bash | ||
npm i @ng-web-apis/platform | ||
``` | ||
|
||
- `isApple` | ||
- `isIos` |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"$schema": "../../node_modules/ng-packagr/ng-package.schema.json", | ||
"assets": [ | ||
"logo.svg", | ||
"README.md" | ||
], | ||
"dest": "../../dist/platform", | ||
"lib": { | ||
"entryFile": "src/index.ts" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{ | ||
"name": "@ng-web-apis/platfrorm", | ||
"version": "4.6.5", | ||
"description": "A basic library for web apis", | ||
"keywords": [ | ||
"angular", | ||
"ng", | ||
"web", | ||
"platform" | ||
], | ||
"homepage": "https://github.com/taiga-family/ng-web-apis/blob/main/libs/platform/README.md", | ||
"bugs": "https://github.com/taiga-family/ng-web-apis/issues", | ||
"repository": "https://github.com/taiga-family/ng-web-apis", | ||
"license": "Apache-2.0", | ||
"publishConfig": { | ||
"access": "public" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
{ | ||
"name": "platform", | ||
"$schema": "../../node_modules/nx/schemas/project-schema.json", | ||
"sourceRoot": "libs/platform", | ||
"projectType": "library", | ||
"targets": { | ||
"build": { | ||
"executor": "@nx/rollup:rollup", | ||
"outputs": ["{workspaceRoot}/dist/{projectName}"], | ||
"options": { | ||
"project": "{projectRoot}/package.json", | ||
"outputPath": "dist/{projectName}", | ||
"entryFile": "{projectRoot}/src/index.ts", | ||
"tsConfig": "{projectRoot}/tsconfig.lib.json", | ||
"format": ["esm", "cjs"], | ||
"compiler": "tsc", | ||
"external": "all", | ||
"assets": [ | ||
{ | ||
"glob": "{projectRoot}/README.md", | ||
"input": ".", | ||
"output": "." | ||
} | ||
] | ||
} | ||
}, | ||
"publish": { | ||
"executor": "nx:run-commands", | ||
"options": { | ||
"parallel": false, | ||
"commands": ["cp ./LICENSE ./dist/{projectName}", "npm publish ./dist/{projectName} --ignore-scripts"] | ||
}, | ||
"dependsOn": [ | ||
{ | ||
"target": "build", | ||
"params": "ignore", | ||
"dependencies": false | ||
} | ||
] | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export * from './is-apple'; | ||
export * from './is-ios'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
/** | ||
* @description: | ||
* All Chrome / Chromium-based browsers will return MacIntel on macOS, | ||
* no matter what the hardware architecture is. See the source code here: | ||
* https://source.chromium.org/chromium/chromium/src/+/master:third_party/blink/renderer/core/frame/navigator_id.cc;l=64;drc=703d3c472cf27470dad21a3f2c8972aca3732cd6 | ||
* But maybe in future years, it will be changed to MacM1 | ||
* | ||
* Documentation: | ||
* https://developer.mozilla.org/en-US/docs/Web/API/Navigator/platform | ||
*/ | ||
export function isApple(navigator: Navigator): boolean { | ||
return navigator.platform.startsWith('Mac') || navigator.platform === 'iPhone'; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import {isApple} from './is-apple'; | ||
|
||
const IOS_REG_EXP = /ipad|iphone|ipod/; | ||
|
||
export function isIos(navigator: Navigator): boolean { | ||
return ( | ||
IOS_REG_EXP.test(navigator.userAgent.toLowerCase()) || | ||
(isApple(navigator) && navigator.maxTouchPoints > 1) | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"extends": "../../tsconfig.build.json", | ||
"files": ["src/index.ts"], | ||
"include": ["src/*"] | ||
} |
Oops, something went wrong.