@js-toolkit/web-utils 1.47.1 → 1.48.0
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/ConnectionController.d.ts +7 -0
- package/ConnectionController.js +1 -0
- package/fullscreen.js +1 -1
- package/iframe/getAutoConnectClient.js +1 -1
- package/iframe/getAutoConnectHost.js +1 -1
- package/iframe/getAutoConnector.js +1 -1
- package/iframe/utils.d.ts +1 -0
- package/iframe/utils.js +1 -1
- package/media/{mse.d.ts → mse/getMediaSource.d.ts} +0 -2
- package/media/mse/getMediaSource.js +1 -0
- package/media/mse/index.d.ts +2 -0
- package/media/mse/index.js +1 -0
- package/media/mse/isMSESupported.d.ts +1 -0
- package/media/mse/isMSESupported.js +1 -0
- package/package.json +16 -16
- package/{detection → platform}/getIOSVersion.d.ts +1 -1
- package/platform/getIOSVersion.js +1 -0
- package/{detection → platform}/isAirPlayAvailable.d.ts +0 -1
- package/{detection → platform}/isAirPlayAvailable.js +1 -1
- package/{detection → platform}/isAndroid.d.ts +0 -1
- package/{detection → platform}/isAndroid.js +1 -1
- package/{detection → platform}/isIOS.d.ts +0 -1
- package/platform/isIOS.js +1 -0
- package/{detection → platform}/isMacOS.d.ts +0 -1
- package/platform/isMacOS.js +1 -0
- package/{detection → platform}/isMobile.d.ts +0 -1
- package/platform/isMobile.js +1 -0
- package/{detection → platform}/isSafari.d.ts +0 -1
- package/platform/isSafari.js +1 -0
- package/{isStandaloneApp.d.ts → platform/isStandaloneApp.d.ts} +0 -1
- package/{isStandaloneApp.js → platform/isStandaloneApp.js} +1 -1
- package/detection/getIOSVersion.js +0 -1
- package/detection/isIOS.js +0 -1
- package/detection/isMacOS.js +0 -1
- package/detection/isMobile.js +0 -1
- package/detection/isSafari.js +0 -1
- package/media/mse.js +0 -1
- /package/{detection → platform}/getUAParserResult.d.ts +0 -0
- /package/{detection → platform}/getUAParserResult.js +0 -0
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { DataEventEmitter } from '@js-toolkit/utils/DataEventEmitter';
|
|
2
|
+
export declare class ConnectionController extends DataEventEmitter<'online' | 'offline' | 'destroy'> {
|
|
3
|
+
private readonly listener;
|
|
4
|
+
constructor(target?: Window & typeof globalThis);
|
|
5
|
+
isOnline(): boolean;
|
|
6
|
+
destroy(): void;
|
|
7
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{DataEventEmitter}from"@js-toolkit/utils/DataEventEmitter";import{EventEmitterListener}from"./EventEmitterListener";export class ConnectionController extends DataEventEmitter{constructor(t=window){super(),this.listener=new EventEmitterListener(t).on("online",(()=>this.emit("online"))).on("offline",(()=>this.emit("offline")))}isOnline(){return navigator.onLine}destroy(){this.listener.removeAllListeners(),this.emit("destroy"),this.removeAllListeners()}}
|
package/fullscreen.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import{es5ErrorCompat}from"@js-toolkit/utils/es5ErrorCompat";import{promisify}from"@js-toolkit/utils/promisify";export class FullscreenUnavailableError extends Error{constructor(){super("Fullscreen is not available"),es5ErrorCompat(this,FullscreenUnavailableError)}}export var fullscreen;!function(e){e.names=[{requestFullscreenName:"requestFullscreen",exitFullscreenName:"exitFullscreen",fullscreenElementName:"fullscreenElement",fullscreenEnabledName:"fullscreenEnabled",changeEventName:"fullscreenchange",errorEventName:"fullscreenerror"},{requestFullscreenName:"webkitRequestFullscreen",exitFullscreenName:"webkitExitFullscreen",fullscreenElementName:"webkitFullscreenElement",fullscreenEnabledName:"webkitFullscreenEnabled",changeEventName:"webkitfullscreenchange",errorEventName:"webkitfullscreenerror"},{requestFullscreenName:"webkitRequestFullScreen",exitFullscreenName:"webkitCancelFullScreen",fullscreenElementName:"webkitCurrentFullScreenElement",fullscreenEnabledName:"webkitCancelFullScreen",changeEventName:"webkitfullscreenchange",errorEventName:"webkitfullscreenerror"},{requestFullscreenName:"mozRequestFullScreen",exitFullscreenName:"mozCancelFullScreen",fullscreenElementName:"mozFullScreenElement",fullscreenEnabledName:"mozFullScreenEnabled",changeEventName:"mozfullscreenchange",errorEventName:"mozfullscreenerror"},{requestFullscreenName:"msRequestFullscreen",exitFullscreenName:"msExitFullscreen",fullscreenElementName:"msFullscreenElement",fullscreenEnabledName:"msFullscreenEnabled",changeEventName:"MSFullscreenChange",errorEventName:"MSFullscreenError"}].find((({exitFullscreenName:e})=>e in document));const n={change:null===e.names||void 0===e.names?void 0:e.names.changeEventName,error:null===e.names||void 0===e.names?void 0:e.names.errorEventName};function r(){if(!e.names)throw new e.UnavailableError;return Boolean(document[e.names.fullscreenElementName])}function l(e,r,l){const t=n[e];t&&document.addEventListener(t,r,l)}function t(e,r,l){const t=n[e];t&&document.removeEventListener(t,r,l)}function a(n,r){return new Promise(((a,s)=>{if(!e.names)throw new e.UnavailableError;const c=()=>{t("change",c),t("error",u),a()},u=e=>{t("change",c),t("error",u),s(e)};l("change",c),l("error",u);const o=n[e.names.requestFullscreenName](r);o instanceof Promise&&o.then(c,u)}))}function s(){return new Promise(((n,a)=>{if(!e.names)throw new e.UnavailableError;if(!r)return void n();const s=()=>{t("change",s),t("error",c),n()},c=e=>{t("change",s),t("error",c),a(e)};l("change",s),l("error",c);const u=document[e.names.exitFullscreenName]();u instanceof Promise&&u.then(s,c)}))}e.UnavailableError=FullscreenUnavailableError,e.isSupported=function(){return!!e.names},e.isEnabled=function(){return!!e.names&&Boolean(document[e.names.fullscreenEnabledName])},e.isFullscreen=r,e.getElement=function(){if(!e.names)throw new e.UnavailableError;return document[e.names.fullscreenElementName]},e.on=l,e.off=t,e.request=a,e.exit=s,e.toggle=function(e){return promisify((()=>r()?s():a(e)))},e.onChange=function(e){l("change",e)},e.onError=function(e){l("error",e)}}(fullscreen||(fullscreen={}));export default fullscreen;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{v4 as uuid}from"uuid";import{IFRAME_CLIENT_READY,IFRAME_HOST_READY,IFRAME_PING,isPingMessage,isTargetReadyMessage}from"./messages";import{getOriginFromMessage}from"./getOriginFromMessage";export function getAutoConnectClient({data:e,target:s=window.parent,isReady:
|
|
1
|
+
import{v4 as uuid}from"uuid";import{IFRAME_CLIENT_READY,IFRAME_HOST_READY,IFRAME_PING,isPingMessage,isTargetReadyMessage}from"./messages";import{getOriginFromMessage}from"./getOriginFromMessage";import{isWindowProxy}from"./utils";export function getAutoConnectClient({data:e,target:s=window.parent,isReady:o=(()=>!0),onConnect:a,logger:t=console,messagesTypes:i}){const n={Ping:(null==i?void 0:i.Ping)||IFRAME_PING,TargetReady:(null==i?void 0:i.TargetReady)||IFRAME_HOST_READY,SelfReady:(null==i?void 0:i.SelfReady)||IFRAME_CLIENT_READY},r=uuid();let g;const d=(e,s,o)=>{window!==e&&(isWindowProxy(e)?(e.postMessage(s,o),t.debug(`Post message to parent window (origin=${o}):`,s)):(e.postMessage(s),t.debug("Post message to parent MessageEventSource:",s)))},u=i=>{if(!i.source||i.source!==s)return;if(!isPingMessage(i.data,n)&&!isTargetReadyMessage(i.data,n))return;t.debug(`Receive message from parent window (origin=${i.origin}):`,i.data);const u=getOriginFromMessage(i);if(isPingMessage(i.data,n))((e,s,a)=>{o()&&d(e,{uid:r,type:n.SelfReady,data:s},a)})(i.source,e,u);else{m();const{data:e}=i.data;[g]=i.ports,a(e,u,g),t.debug("Iframe connected.")}},m=()=>{window.removeEventListener("message",u)};return window.addEventListener("message",u),{ready:(e="*")=>{d(s,{uid:r,type:n.Ping},e)},destroy:()=>{m(),g&&(g.close(),g.onmessage=null,g.onmessageerror=null)}}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{v4 as uuid}from"uuid";import{onDOMReady}from"../onDOMReady";import{IFRAME_HOST_READY,IFRAME_CLIENT_READY,IFRAME_PING,isPingMessage,isTargetReadyMessage}from"./messages";import{selectFrames}from"./utils";import{getOriginFromMessage}from"./getOriginFromMessage";export function getAutoConnectHost({onSendData:e,logger:o=console,openChannel:s,onConnect:t,messagesTypes:n}){const r={Ping:(null==n?void 0:n.Ping)||IFRAME_PING,TargetReady:(null==n?void 0:n.TargetReady)||IFRAME_CLIENT_READY,SelfReady:(null==n?void 0:n.SelfReady)||IFRAME_HOST_READY};let a,i;const d=uuid(),g=s?new MessageChannel:void 0,u=(e,s,t,n)=>{window!==s&&(s
|
|
1
|
+
import{v4 as uuid}from"uuid";import{onDOMReady}from"../onDOMReady";import{IFRAME_HOST_READY,IFRAME_CLIENT_READY,IFRAME_PING,isPingMessage,isTargetReadyMessage}from"./messages";import{isWindowProxy,selectFrames}from"./utils";import{getOriginFromMessage}from"./getOriginFromMessage";export function getAutoConnectHost({onSendData:e,logger:o=console,openChannel:s,onConnect:t,messagesTypes:n}){const r={Ping:(null==n?void 0:n.Ping)||IFRAME_PING,TargetReady:(null==n?void 0:n.TargetReady)||IFRAME_CLIENT_READY,SelfReady:(null==n?void 0:n.SelfReady)||IFRAME_HOST_READY};let a,i;const d=uuid(),g=s?new MessageChannel:void 0,u=(e,s,t,n)=>{window!==s&&(isWindowProxy(s)?(s.postMessage(e,t,n),o.debug(`Post message to iframe (origin=${t}):`,e)):(s.postMessage(e,n&&{transfer:n}),o.debug("Post message to MessageEventSource:",e)))},l=(e,o)=>{u({uid:d,type:r.Ping},e,o)},m=(e,o,s="*")=>{u({uid:d,type:r.SelfReady,data:e},o,s,g?[g.port2]:void 0)},c=n=>{if(!n.source||n.source===window)return;if(!isPingMessage(n.data,r)&&!isTargetReadyMessage(n.data,r))return;o.debug(`Receive message from iframe (origin=${n.origin}):`,n.data);const a=n.source,i=getOriginFromMessage(n);if(isPingMessage(n.data,r))l(a,i);else{m(e?e(a,i):void 0,a,i);const{data:r}=n.data;setTimeout((()=>{s&&g?t(r,a,i,g.port1):s||t(r,a,i),o.debug("Iframe Host connected.")}),0)}},f=()=>{a&&(a(),a=void 0)};return{start:(...e)=>{if(a)return void o.warn("Already started. You should first call `stop`.");const s=onDOMReady((()=>{i=(()=>{const o="function"==typeof e[0]?e[0]():e;return o.length>0?o:void 0})();const o=i||selectFrames();window.addEventListener("message",c);for(let e=0;e<o.length;e+=1){const s=o[e];s.contentWindow&&l(s.contentWindow,"*")}}));a=()=>{s(),window.removeEventListener("message",c),i=void 0}},stop:f,ready:m,destroy:()=>{f(),g&&(g.port1.close(),g.port2.close(),g.port1.onmessage=null,g.port1.onmessageerror=null)}}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{v4 as uuid}from"uuid";import{onDOMReady}from"../onDOMReady";import{isPingMessage,isTargetReadyMessage}from"./messages";import{findTarget}from"./utils";import{getOriginFromMessage}from"./getOriginFromMessage";export{getClientMessages,getHostMessages}from"./messages";export function getAutoConnector({id:e,label:t,strictTargets:o=!0,messagesTypes:n,channel:s,logger:i=console,onSendData:a,onConnect:r}){const d=e||uuid(),g=t||d,u=new Map,c="open"===s?new Map:void 0;let l,f;const m=(e,t,o,n,s)=>{window!==t&&(t
|
|
1
|
+
import{v4 as uuid}from"uuid";import{onDOMReady}from"../onDOMReady";import{isPingMessage,isTargetReadyMessage}from"./messages";import{findTarget,isWindowProxy}from"./utils";import{getOriginFromMessage}from"./getOriginFromMessage";export{getClientMessages,getHostMessages}from"./messages";export function getAutoConnector({id:e,label:t,strictTargets:o=!0,messagesTypes:n,channel:s,logger:i=console,onSendData:a,onConnect:r}){const d=e||uuid(),g=t||d,u=new Map,c="open"===s?new Map:void 0;let l,f;const m=(e,t,o,n,s)=>{window!==t&&(isWindowProxy(t)?(t.postMessage(e,o,s),i.debug(`${g}: Post message to iframe (uid=${n},origin=${o}):`,e)):(t.postMessage(e,s&&{transfer:s}),i.debug(`${g}: Post message to MessageEventSource (uid=${n}):`,e)))},p=(e,t,o)=>{m({uid:d,type:n.Ping},e,t,o)},v=e=>{var t,f,v,w;if(!e.source||e.source===window)return;if(!isPingMessage(e.data,n)&&!isTargetReadyMessage(e.data,n))return;if(e.data.uid===d)return;const M=e.source,h=e.data.uid;if(i.debug(`${g}: Receive message from iframe (uid=${h},origin=${e.origin}):`,e.data),o&&l){if(!findTarget(M,l))return void i.warn(`${g}: Could not find target (uid=${h}) by message.source.`)}const y=getOriginFromMessage(e);if(isPingMessage(e.data,n)&&!(null===(t=u.get(h))||void 0===t?void 0:t.Ping))return u.set(h,Object.assign(Object.assign({},u.get(h)),{Ping:!0})),void p(M,y,h);let $=!1;if((null===(f=u.get(h))||void 0===f?void 0:f.Ping)&&!(null===(v=u.get(h))||void 0===v?void 0:v.SelfReady)){u.set(h,Object.assign(Object.assign({},u.get(h)),{SelfReady:!0}));const e=c?(()=>{var e;const t=null!==(e=c.get(h))&&void 0!==e?e:new MessageChannel;return c.set(h,t),t.port2})():void 0;((e,t,o,s,i)=>{m({uid:d,type:n.SelfReady,data:e},t,o,s,i?[i]:void 0)})(a?a({target:M,origin:y}):void 0,M,y,h,e),$=!1}if(isTargetReadyMessage(e.data,n)&&(null===(w=u.get(h))||void 0===w?void 0:w.SelfReady)){u.delete(h);const t=(()=>{var t;if("open"===s){const e=null===(t=null==c?void 0:c.get(h))||void 0===t?void 0:t.port1;if(!e)throw new Error("Something went wrong: MessageChannel is not created despite the fact that the `channel` option is `open`.");return e}if("use"===s){const t=e.ports[0];if(!t)throw new Error("MessagePort is not received despite the fact that the `channel` option is `use`. The `channel` option of connector on another side must be equals `open`.");return t}})(),{data:o}=e.data,n=()=>{i.debug(`${g}: Iframe connection established (${d} + ${h}).`),r({data:o,target:M,origin:y},t)};$?setTimeout(n,0):n()}},w=()=>{f&&(f(),f=void 0)};return{start:e=>{if(f)return void i.warn(`${g}: Already started. You should first call \`stop\`.`);const t=()=>{l=(()=>{const t="function"==typeof e?e():e;return t.length>0?t:void 0})(),window.addEventListener("message",v);const t=null!=l?l:[];for(let e=0;e<t.length;e+=1){const o=t[e],n=o instanceof HTMLIFrameElement?o.contentWindow:o;n&&n!==window&&p(n,"*","")}},o="function"==typeof e?onDOMReady(t):t();f=()=>{o&&o(),window.removeEventListener("message",v),l=void 0}},stop:w,destroy:()=>{w(),u.clear(),c&&(c.forEach((e=>{e.port1.close(),e.port2.close()})),c.clear())}}}
|
package/iframe/utils.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
export type Target = HTMLIFrameElement | Window;
|
|
2
2
|
export declare function selectFrames(): HTMLCollectionOf<HTMLIFrameElement>;
|
|
3
3
|
export declare function findTarget<T extends Target>(source: Window, targets: ArrayLike<T>): T | undefined;
|
|
4
|
+
export declare function isWindowProxy(target: MessageEventSource): target is Window;
|
package/iframe/utils.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export function selectFrames(){return document.getElementsByTagName("iframe")}export function findTarget(e,
|
|
1
|
+
export function selectFrames(){return document.getElementsByTagName("iframe")}export function findTarget(e,n){for(let t=0;t<n.length;t+=1){const o=n[t];if((o instanceof HTMLIFrameElement?o.contentWindow:o)===e)return o}}export function isWindowProxy(e){return!(void 0!==window.MessagePort&&e instanceof MessagePort||void 0!==window.ServiceWorker&&e instanceof ServiceWorker)}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export function getMediaSource(){return window.MediaSource||window.WebKitMediaSource}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export*from"./getMediaSource";export*from"./isMSESupported";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function isMSESupported(): boolean;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{getMediaSource}from"./getMediaSource";export function isMSESupported(){var e;return!!(null===(e=getMediaSource())||void 0===e?void 0:e.isTypeSupported)}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@js-toolkit/web-utils",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.48.0",
|
|
4
4
|
"description": "Web utils",
|
|
5
5
|
"author": "VZH",
|
|
6
6
|
"license": "MIT",
|
|
@@ -13,33 +13,33 @@
|
|
|
13
13
|
"copy:configs": "copyfiles package.json .npmignore README.md LICENSE ./dist/",
|
|
14
14
|
"minify": "node-utils-minify --replace ./dist",
|
|
15
15
|
"build": "npm run clean && tsc --build ./tsconfig.json && npm run minify",
|
|
16
|
-
"patch-publish": "npm run build && npm version patch --no-workspaces-update -m 'v%s' && npm run copy:configs && cd ./dist && npm publish --access public && git push origin master --follow-tags",
|
|
17
|
-
"minor-publish": "npm run build && npm version minor --no-workspaces-update -m 'v%s' && npm run copy:configs && cd ./dist && npm publish --access public && git push origin master --follow-tags"
|
|
16
|
+
"patch-publish": "npm run build && npm version patch --force --no-workspaces-update -m 'v%s' && npm run copy:configs && cd ./dist && npm publish --access public && git push origin master --follow-tags",
|
|
17
|
+
"minor-publish": "npm run build && npm version minor --force --no-workspaces-update -m 'v%s' && npm run copy:configs && cd ./dist && npm publish --access public && git push origin master --follow-tags"
|
|
18
18
|
},
|
|
19
19
|
"optionalDependencies": {
|
|
20
20
|
"@js-toolkit/node-utils": "^1.1.4"
|
|
21
21
|
},
|
|
22
22
|
"devDependencies": {
|
|
23
23
|
"@js-toolkit/configs": "^3.87.5",
|
|
24
|
-
"@js-toolkit/utils": "^1.49.
|
|
25
|
-
"@types/ua-parser-js": "^0.7.
|
|
26
|
-
"@types/uuid": "^9.0.
|
|
27
|
-
"@typescript-eslint/eslint-plugin": "^6.4
|
|
28
|
-
"@typescript-eslint/parser": "^6.4
|
|
24
|
+
"@js-toolkit/utils": "^1.49.6",
|
|
25
|
+
"@types/ua-parser-js": "^0.7.37",
|
|
26
|
+
"@types/uuid": "^9.0.4",
|
|
27
|
+
"@typescript-eslint/eslint-plugin": "^6.7.4",
|
|
28
|
+
"@typescript-eslint/parser": "^6.7.4",
|
|
29
29
|
"copyfiles": "^2.4.1",
|
|
30
|
-
"eslint": "^8.
|
|
30
|
+
"eslint": "^8.50.0",
|
|
31
31
|
"eslint-config-airbnb-base": "^15.0.0",
|
|
32
32
|
"eslint-config-prettier": "^9.0.0",
|
|
33
|
-
"eslint-plugin-import": "^2.28.
|
|
33
|
+
"eslint-plugin-import": "^2.28.1",
|
|
34
34
|
"eslint-plugin-prettier": "^5.0.0",
|
|
35
35
|
"eventemitter3": "^5.0.1",
|
|
36
|
-
"prettier": "^3.0.
|
|
36
|
+
"prettier": "^3.0.3",
|
|
37
37
|
"reconnecting-websocket": "^4.4.0",
|
|
38
|
-
"rimraf": "^5.0.
|
|
39
|
-
"terser": "^5.
|
|
40
|
-
"typescript": "^5.
|
|
41
|
-
"ua-parser-js": "^1.0.
|
|
42
|
-
"uuid": "^9.0.
|
|
38
|
+
"rimraf": "^5.0.5",
|
|
39
|
+
"terser": "^5.20.0",
|
|
40
|
+
"typescript": "^5.2.2",
|
|
41
|
+
"ua-parser-js": "^1.0.36",
|
|
42
|
+
"uuid": "^9.0.1",
|
|
43
43
|
"webpack": "^5.88.2",
|
|
44
44
|
"yargs": "^17.7.2"
|
|
45
45
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{getUAParserResult}from"./getUAParserResult";import{isIOS}from"./isIOS";class Semver{constructor(e,r,t){this.major=e,this.minor=r,this.patch=t}toString(){return`${this.major}_${this.minor}_${this.patch}`}}let memo;export function getIOSVersion(){if(void 0===memo){const{os:e}=getUAParserResult(),r=isIOS()&&e.version&&/(\d+)\.(\d+)(?:\.(\d+))?/.exec(e.version);memo=r?new Semver(parseInt(r[1],10)||0,parseInt(r[2],10)||0,parseInt(r[3],10)||0):null}return null!=memo?memo:void 0}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export function isAirPlayAvailable(){return!!window.WebKitPlaybackTargetAvailabilityEvent}
|
|
1
|
+
export function isAirPlayAvailable(){return!!window.WebKitPlaybackTargetAvailabilityEvent}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{getUAParserResult}from"./getUAParserResult";export function isAndroid(){const r=getUAParserResult().os.name;return"Android"===r||"Android-x86"===r}
|
|
1
|
+
import{getUAParserResult}from"./getUAParserResult";export function isAndroid(){const r=getUAParserResult().os.name;return"Android"===r||"Android-x86"===r}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{getUAParserResult}from"./getUAParserResult";import{isMobile}from"./isMobile";export function isIOS(){const e=getUAParserResult();return"iOS"===e.os.name||isMobile()&&"Apple"===e.device.vendor}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{getUAParserResult}from"./getUAParserResult";import{isMobile}from"./isMobile";export function isMacOS(){const e=getUAParserResult().os.name;return("Mac OS"===e||"macOS"===e)&&!isMobile()}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{getUAParserResult}from"./getUAParserResult";export function isMobile(){const e=getUAParserResult(),t=e.device.type;return!!("mobile"===t||"tablet"===t||!t&&"Apple"===e.device.vendor&&navigator.maxTouchPoints&&navigator.maxTouchPoints>2)}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{getUAParserResult}from"./getUAParserResult";import{isIOS}from"./isIOS";import{isMacOS}from"./isMacOS";export function isSafari(){const r=getUAParserResult().browser.name;return"Safari"===r||"Mobile Safari"===r||"WebKit"===r&&(isIOS()||isMacOS())}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export function isStandaloneApp(){return window.matchMedia("(display-mode: standalone)").matches}
|
|
1
|
+
export function isStandaloneApp(){return window.matchMedia("(display-mode: standalone)").matches}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{getUAParserResult}from"./getUAParserResult";import{isIOS}from"./isIOS";class Semver{constructor(e,t,r){this.major=e,this.minor=t,this.patch=r}toString(){return`${this.major}_${this.minor}_${this.patch}`}}let memo;export function getIOSVersion(){if(void 0===memo){const{os:e}=getUAParserResult(),t=isIOS()&&e.version&&/(\d+)\.(\d+)(?:\.(\d+))?/.exec(e.version);memo=t?new Semver(parseInt(t[1],10)||0,parseInt(t[2],10)||0,parseInt(t[3],10)||0):null}return null!=memo?memo:void 0}export default getIOSVersion;
|
package/detection/isIOS.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{getUAParserResult}from"./getUAParserResult";export function isIOS(){return"iOS"===getUAParserResult().os.name}export default isIOS;
|
package/detection/isMacOS.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{getUAParserResult}from"./getUAParserResult";export function isMacOS(){return"Mac OS"===getUAParserResult().os.name}export default isMacOS;
|
package/detection/isMobile.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{getUAParserResult}from"./getUAParserResult";export function isMobile(){const e=getUAParserResult().device.type;return"mobile"===e||"tablet"===e}export default isMobile;
|
package/detection/isSafari.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{getUAParserResult}from"./getUAParserResult";export function isSafari(){const r=getUAParserResult().browser.name;return"Safari"===r||"Mobile Safari"===r}export default isSafari;
|
package/media/mse.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export function getMediaSource(){return window.MediaSource||window.WebKitMediaSource}export function isMSESupported(){return!!getMediaSource()}
|
|
File without changes
|
|
File without changes
|