@spectrum-web-components/shared 0.13.1 → 0.13.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -2
- package/src/index.d.ts +1 -0
- package/src/index.js +1 -0
- package/src/index.js.map +1 -1
- package/src/platform.d.ts +8 -0
- package/src/platform.js +54 -0
- package/src/platform.js.map +1 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@spectrum-web-components/shared",
|
|
3
|
-
"version": "0.13.
|
|
3
|
+
"version": "0.13.2",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -49,5 +49,5 @@
|
|
|
49
49
|
"types": "./src/index.d.ts",
|
|
50
50
|
"customElements": "custom-elements.json",
|
|
51
51
|
"sideEffects": false,
|
|
52
|
-
"gitHead": "
|
|
52
|
+
"gitHead": "5ad16bd185710525afa48bd76099cb0ebde4c4cb"
|
|
53
53
|
}
|
package/src/index.d.ts
CHANGED
package/src/index.js
CHANGED
|
@@ -16,5 +16,6 @@ export * from './get-active-element.js';
|
|
|
16
16
|
export * from './like-anchor.js';
|
|
17
17
|
export * from './observe-slot-presence.js';
|
|
18
18
|
export * from './observe-slot-text.js';
|
|
19
|
+
export * from './platform.js';
|
|
19
20
|
export * from './reparent-children.js';
|
|
20
21
|
//# sourceMappingURL=index.js.map
|
package/src/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;EAUE;AAEF,cAAc,yBAAyB,CAAC;AACxC,cAAc,oBAAoB,CAAC;AACnC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,yBAAyB,CAAC;AACxC,cAAc,kBAAkB,CAAC;AACjC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,wBAAwB,CAAC;AACvC,cAAc,wBAAwB,CAAC","sourcesContent":["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nexport * from './first-focusable-in.js';\nexport * from './focus-visible.js';\nexport * from './focusable.js';\nexport * from './get-active-element.js';\nexport * from './like-anchor.js';\nexport * from './observe-slot-presence.js';\nexport * from './observe-slot-text.js';\nexport * from './reparent-children.js';\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;EAUE;AAEF,cAAc,yBAAyB,CAAC;AACxC,cAAc,oBAAoB,CAAC;AACnC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,yBAAyB,CAAC;AACxC,cAAc,kBAAkB,CAAC;AACjC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,wBAAwB,CAAC;AACvC,cAAc,eAAe,CAAC;AAC9B,cAAc,wBAAwB,CAAC","sourcesContent":["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nexport * from './first-focusable-in.js';\nexport * from './focus-visible.js';\nexport * from './focusable.js';\nexport * from './get-active-element.js';\nexport * from './like-anchor.js';\nexport * from './observe-slot-presence.js';\nexport * from './observe-slot-text.js';\nexport * from './platform.js';\nexport * from './reparent-children.js';\n"]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare function isMac(): boolean;
|
|
2
|
+
export declare function isIPhone(): boolean;
|
|
3
|
+
export declare function isIPad(): boolean;
|
|
4
|
+
export declare function isIOS(): boolean;
|
|
5
|
+
export declare function isAppleDevice(): boolean;
|
|
6
|
+
export declare function isWebKit(): boolean;
|
|
7
|
+
export declare function isChrome(): boolean;
|
|
8
|
+
export declare function isAndroid(): boolean;
|
package/src/platform.js
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2020 Adobe. All rights reserved.
|
|
3
|
+
This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
+
of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
|
|
7
|
+
Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
+
the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
+
OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
+
governing permissions and limitations under the License.
|
|
11
|
+
*/
|
|
12
|
+
function testUserAgent(re) {
|
|
13
|
+
return typeof window !== 'undefined' && window.navigator != null
|
|
14
|
+
? re.test(window.navigator.userAgent)
|
|
15
|
+
: false;
|
|
16
|
+
}
|
|
17
|
+
function testPlatform(re) {
|
|
18
|
+
return typeof window !== 'undefined' && window.navigator != null
|
|
19
|
+
? re.test(window.navigator.platform)
|
|
20
|
+
: false;
|
|
21
|
+
}
|
|
22
|
+
/* c8 ignore next 3 */
|
|
23
|
+
export function isMac() {
|
|
24
|
+
return testPlatform(/^Mac/);
|
|
25
|
+
}
|
|
26
|
+
export function isIPhone() {
|
|
27
|
+
return testPlatform(/^iPhone/);
|
|
28
|
+
}
|
|
29
|
+
/* c8 ignore next 7 */
|
|
30
|
+
export function isIPad() {
|
|
31
|
+
return (testPlatform(/^iPad/) ||
|
|
32
|
+
// iPadOS 13 lies and says it's a Mac, but we can distinguish by detecting touch support.
|
|
33
|
+
(isMac() && navigator.maxTouchPoints > 1));
|
|
34
|
+
}
|
|
35
|
+
/* c8 ignore next 3 */
|
|
36
|
+
export function isIOS() {
|
|
37
|
+
return isIPhone() || isIPad();
|
|
38
|
+
}
|
|
39
|
+
/* c8 ignore next 3 */
|
|
40
|
+
export function isAppleDevice() {
|
|
41
|
+
return isMac() || isIOS();
|
|
42
|
+
}
|
|
43
|
+
/* c8 ignore next 3 */
|
|
44
|
+
export function isWebKit() {
|
|
45
|
+
return testUserAgent(/AppleWebKit/) && !isChrome();
|
|
46
|
+
}
|
|
47
|
+
/* c8 ignore next 3 */
|
|
48
|
+
export function isChrome() {
|
|
49
|
+
return testUserAgent(/Chrome/);
|
|
50
|
+
}
|
|
51
|
+
export function isAndroid() {
|
|
52
|
+
return testUserAgent(/Android/);
|
|
53
|
+
}
|
|
54
|
+
//# sourceMappingURL=platform.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"platform.js","sourceRoot":"","sources":["platform.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;EAUE;AAEF,SAAS,aAAa,CAAC,EAAU;IAC7B,OAAO,OAAO,MAAM,KAAK,WAAW,IAAI,MAAM,CAAC,SAAS,IAAI,IAAI;QAC5D,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,SAAS,CAAC;QACrC,CAAC,CAAC,KAAK,CAAC;AAChB,CAAC;AAED,SAAS,YAAY,CAAC,EAAU;IAC5B,OAAO,OAAO,MAAM,KAAK,WAAW,IAAI,MAAM,CAAC,SAAS,IAAI,IAAI;QAC5D,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC;QACpC,CAAC,CAAC,KAAK,CAAC;AAChB,CAAC;AAED,sBAAsB;AACtB,MAAM,UAAU,KAAK;IACjB,OAAO,YAAY,CAAC,MAAM,CAAC,CAAC;AAChC,CAAC;AAED,MAAM,UAAU,QAAQ;IACpB,OAAO,YAAY,CAAC,SAAS,CAAC,CAAC;AACnC,CAAC;AAED,sBAAsB;AACtB,MAAM,UAAU,MAAM;IAClB,OAAO,CACH,YAAY,CAAC,OAAO,CAAC;QACrB,yFAAyF;QACzF,CAAC,KAAK,EAAE,IAAI,SAAS,CAAC,cAAc,GAAG,CAAC,CAAC,CAC5C,CAAC;AACN,CAAC;AAED,sBAAsB;AACtB,MAAM,UAAU,KAAK;IACjB,OAAO,QAAQ,EAAE,IAAI,MAAM,EAAE,CAAC;AAClC,CAAC;AAED,sBAAsB;AACtB,MAAM,UAAU,aAAa;IACzB,OAAO,KAAK,EAAE,IAAI,KAAK,EAAE,CAAC;AAC9B,CAAC;AAED,sBAAsB;AACtB,MAAM,UAAU,QAAQ;IACpB,OAAO,aAAa,CAAC,aAAa,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC;AACvD,CAAC;AAED,sBAAsB;AACtB,MAAM,UAAU,QAAQ;IACpB,OAAO,aAAa,CAAC,QAAQ,CAAC,CAAC;AACnC,CAAC;AAED,MAAM,UAAU,SAAS;IACrB,OAAO,aAAa,CAAC,SAAS,CAAC,CAAC;AACpC,CAAC","sourcesContent":["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nfunction testUserAgent(re: RegExp): boolean {\n return typeof window !== 'undefined' && window.navigator != null\n ? re.test(window.navigator.userAgent)\n : false;\n}\n\nfunction testPlatform(re: RegExp): boolean {\n return typeof window !== 'undefined' && window.navigator != null\n ? re.test(window.navigator.platform)\n : false;\n}\n\n/* c8 ignore next 3 */\nexport function isMac(): boolean {\n return testPlatform(/^Mac/);\n}\n\nexport function isIPhone(): boolean {\n return testPlatform(/^iPhone/);\n}\n\n/* c8 ignore next 7 */\nexport function isIPad(): boolean {\n return (\n testPlatform(/^iPad/) ||\n // iPadOS 13 lies and says it's a Mac, but we can distinguish by detecting touch support.\n (isMac() && navigator.maxTouchPoints > 1)\n );\n}\n\n/* c8 ignore next 3 */\nexport function isIOS(): boolean {\n return isIPhone() || isIPad();\n}\n\n/* c8 ignore next 3 */\nexport function isAppleDevice(): boolean {\n return isMac() || isIOS();\n}\n\n/* c8 ignore next 3 */\nexport function isWebKit(): boolean {\n return testUserAgent(/AppleWebKit/) && !isChrome();\n}\n\n/* c8 ignore next 3 */\nexport function isChrome(): boolean {\n return testUserAgent(/Chrome/);\n}\n\nexport function isAndroid(): boolean {\n return testUserAgent(/Android/);\n}\n"]}
|