webuix 0.0.15 → 0.0.18
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/build.ts +102 -1
- package/dist/index.cjs.js +1 -1
- package/dist/index.d.ts +351 -30
- package/dist/index.esm.js +1 -1
- package/global.ts +26 -0
- package/package.json +1 -1
package/build.ts
CHANGED
|
@@ -1,7 +1,20 @@
|
|
|
1
1
|
import dts from "bun-plugin-dts";
|
|
2
|
-
import { writeFileSync, readFileSync } from "fs";
|
|
2
|
+
import { writeFileSync, readFileSync, readdirSync, existsSync } from "fs";
|
|
3
|
+
import { resolve, relative } from "path";
|
|
3
4
|
import { execSync } from "child_process";
|
|
4
5
|
import type { BuildConfig } from "bun";
|
|
6
|
+
import { join, relative } from "path";
|
|
7
|
+
|
|
8
|
+
const baseDir = "./src";
|
|
9
|
+
const typesDir = resolve(baseDir, "types");
|
|
10
|
+
const classesDir = resolve(baseDir, "classes");
|
|
11
|
+
const wrappersDir = resolve(baseDir, "wrappers");
|
|
12
|
+
|
|
13
|
+
generateIndexes(baseDir, [
|
|
14
|
+
{ dir: "types", isTypes: true },
|
|
15
|
+
{ dir: "classes" },
|
|
16
|
+
{ dir: "wrappers" },
|
|
17
|
+
]);
|
|
5
18
|
|
|
6
19
|
// Get Git commit count
|
|
7
20
|
const count = parseInt(
|
|
@@ -43,3 +56,91 @@ for (const format of formats) {
|
|
|
43
56
|
process.exit(1);
|
|
44
57
|
});
|
|
45
58
|
}
|
|
59
|
+
|
|
60
|
+
type IndexConfig = {
|
|
61
|
+
dir: string;
|
|
62
|
+
isTypes?: boolean;
|
|
63
|
+
subDirs?: string[];
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
function generateIndexes(baseDir: string, configs: IndexConfig[]) {
|
|
67
|
+
function walk(dir: string): string[] {
|
|
68
|
+
let results: string[] = [];
|
|
69
|
+
for (const file of readdirSync(dir, { withFileTypes: true })) {
|
|
70
|
+
const fullPath = join(dir, file.name);
|
|
71
|
+
if (file.isDirectory()) {
|
|
72
|
+
results = results.concat(walk(fullPath));
|
|
73
|
+
} else {
|
|
74
|
+
results.push(fullPath);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
return results;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
let baseExports: string[] = [];
|
|
81
|
+
|
|
82
|
+
for (const { dir, isTypes = false, subDirs = [] } of configs) {
|
|
83
|
+
const absDir = join(baseDir, dir);
|
|
84
|
+
const files = walk(absDir);
|
|
85
|
+
const imports = files
|
|
86
|
+
.map((file: string) => {
|
|
87
|
+
if (file.endsWith("index.ts")) return;
|
|
88
|
+
if (file.endsWith(".ts")) {
|
|
89
|
+
let relPath =
|
|
90
|
+
"./" +
|
|
91
|
+
relative(absDir, file).replace(/\\/g, "/").replace(/\.ts$/, "");
|
|
92
|
+
return `export ${isTypes ? "type " : ""}* from "${relPath}";`;
|
|
93
|
+
}
|
|
94
|
+
})
|
|
95
|
+
.filter(Boolean)
|
|
96
|
+
.join("\n");
|
|
97
|
+
|
|
98
|
+
const indexFileName = `index.ts`;
|
|
99
|
+
writeFileSync(join(absDir, indexFileName), `/**
|
|
100
|
+
* Automatically generated by the bundler. DO NOT EDIT!
|
|
101
|
+
*/\n
|
|
102
|
+
${imports}`);
|
|
103
|
+
|
|
104
|
+
// Add export from this index to baseDir index
|
|
105
|
+
const relPathToBase =
|
|
106
|
+
"./" +
|
|
107
|
+
relative(baseDir, join(absDir, indexFileName))
|
|
108
|
+
.replace(/\\/g, "/")
|
|
109
|
+
.replace(/\.ts$/, "");
|
|
110
|
+
baseExports.push(
|
|
111
|
+
`export ${isTypes ? "type " : ""}* from "${relPathToBase}";`
|
|
112
|
+
);
|
|
113
|
+
|
|
114
|
+
if (subDirs.length > 0) {
|
|
115
|
+
let exports: string[] = [];
|
|
116
|
+
subDirs.forEach((subDir) => {
|
|
117
|
+
const indexPath = join(baseDir, subDir, "index.ts");
|
|
118
|
+
if (existsSync(indexPath)) {
|
|
119
|
+
const relPath =
|
|
120
|
+
"./" +
|
|
121
|
+
relative(absDir, indexPath)
|
|
122
|
+
.replace(/\\/g, "/")
|
|
123
|
+
.replace(/\.ts$/, "");
|
|
124
|
+
exports.push(`export ${isTypes ? "type " : ""}* from "${relPath}";`);
|
|
125
|
+
}
|
|
126
|
+
});
|
|
127
|
+
if (exports.length > 0) {
|
|
128
|
+
writeFileSync(
|
|
129
|
+
join(absDir, "index.ts"),
|
|
130
|
+
`/**
|
|
131
|
+
* Automatically generated by the bundler. DO NOT EDIT!
|
|
132
|
+
*/\n
|
|
133
|
+
${exports.join("\n")}`
|
|
134
|
+
);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
// Write index.ts in baseDir
|
|
140
|
+
if (baseExports.length > 0) {
|
|
141
|
+
writeFileSync(join(baseDir, "index.ts"), `/**
|
|
142
|
+
* Automatically generated by the bundler. DO NOT EDIT!
|
|
143
|
+
*/\n
|
|
144
|
+
${baseExports.join("\n")}`);
|
|
145
|
+
}
|
|
146
|
+
}
|
package/dist/index.cjs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var{defineProperty:v,getOwnPropertyNames:O,getOwnPropertyDescriptor:_}=Object,x=Object.prototype.hasOwnProperty;var w=new WeakMap,h=(e)=>{var t=w.get(e),n;if(t)return t;if(t=v({},"__esModule",{value:!0}),e&&typeof e==="object"||typeof e==="function")O(e).map((r)=>!x.call(t,r)&&v(t,r,{get:()=>e[r],enumerable:!(n=_(e,r))||n.enumerable}));return w.set(e,t),t};var T=(e,t)=>{for(var n in t)v(e,n,{get:t[n],enumerable:!0,configurable:!0,set:(r)=>t[n]=()=>r})};var R={};T(R,{wrapToReadableStream:()=>E,wrapOutputStream:()=>u,wrapInputStream:()=>y,WebUI:()=>X,WXEventHandler:()=>f,WXEvent:()=>a,Intent:()=>W});module.exports=h(R);var c={chunkSize:1048576,headers:{"Content-Type":"application/octet-stream"}};async function E(e,t={}){let n={...c,...t};return new Promise((r,i)=>{let s;try{if(s=e,!s)throw new Error("Failed to open file input stream")}catch(o){i(o);return}let l=()=>{try{s?.close()}catch(o){console.error("Error during abort cleanup:",o)}i(new DOMException("The operation was aborted.","AbortError"))};if(n.signal){if(n.signal.aborted){l();return}n.signal.addEventListener("abort",l)}let b=new ReadableStream({async pull(o){try{let p=g(s,n.chunkSize);if(!p){o.close(),d();return}o.enqueue(p)}catch(p){d(),o.error(p),i(new Error(`Error reading file chunk: ${p}`))}},cancel(o){console.warn("Stream canceled:",o),d()}});function d(){try{if(n.signal)n.signal.removeEventListener("abort",l);s?.close()}catch(o){console.error(`Error during cleanup: ${o}`)}}r(b)})}function g(e,t){try{let n=t?e.readChunk(t):e.read();if(typeof n==="number")return new Uint8Array([n]);else if(typeof n==="string"){let r=JSON.parse(n);return r&&Array.isArray(r)&&r.length>0?new Uint8Array(r):null}return null}catch(n){throw new Error("Error reading chunk data: "+n)}}async function y(e,t={}){let n={...c,...t};try{let r=await E(e,n);return new Response(r,n)}catch(r){throw new Error(`wrapInputStream failed: ${r}`)}}async function u(e,t){if(!e||typeof e.getReader!=="function")throw new Error("Invalid ReadableStream provided.");if(!t||typeof t.write!=="function"||typeof t.close!=="function")throw new Error("Invalid outputStreamInstance provided. It must be an already opened stream with 'write' and 'close' methods.");let n=new WritableStream({async start(r){console.log("WritableStream started, output stream instance ready.")},async write(r,i){if(r instanceof Uint8Array)for(let s=0;s<r.length;s++)t.write(r[s]);else console.warn("Received non-Uint8Array chunk in WritableStream:",r),i.error(new TypeError("Expected Uint8Array chunks."))},async close(){console.log("WritableStream closed. Flushing and closing native stream.");try{t.flush(),t.close()}catch(r){throw console.error("Error during WritableStream close cleanup:",r),r}},async abort(r){console.error("WritableStream aborted:",r);try{t.close()}catch(i){console.error("Error during WritableStream abort cleanup:",i)}}});try{await e.pipeTo(n),console.log("Piping completed successfully.")}catch(r){let i=r instanceof Error?r:new Error(String(r));throw console.error("Error during stream piping:",i),new Error(`Failed to pipe stream: ${i.message}`)}}class a extends Event{_wxOrigin;_wxData;get wxOrigin(){return this._wxOrigin}set wxOrigin(e){this._wxOrigin=e}get wx(){return this._wxData}set wx(e){this._wxData=e}constructor(e){super(e,{bubbles:!0,cancelable:!0,composed:!0})}}var m={cordova:!1};class f{_initialized=!1;_handlers=new WeakMap;_eventTypes;get eventTypes(){return this._eventTypes}constructor(e=m){if(this._initialized)return;this._initialized=!0,this._eventTypes={WX_ON_BACK:e.cordova?"backbutton":"back",WX_ON_RESUME:"resume",WX_ON_REFRESH:"refresh",WX_ON_PAUSE:"pause",WX_ON_KEYBOARD:"keyboard",WX_ON_INSETS:"insets"},window.addEventListener("message",(t)=>{try{if(typeof t.data!=="string")return;let n=JSON.parse(t.data);if(!n?.type)return;let r=this._eventTypes[n.type]??n.type;this._dispatch(window,r,n)}catch(n){console.error("[WXEvent] Message error:",n)}})}_dispatch(e,t,n){let r=new a(t);r.wx=n.data,r.wxOrigin="system",e.dispatchEvent(r)}on(e,t,n){if(!this._initialized)new f;let r=(s)=>{if(!(s instanceof a)){console.warn("[WXEvent] Event is not a WXEvent:",s);return}if(s.wxOrigin==="system"){if(typeof n==="function")n(s);else if(n&&typeof n.handleEvent==="function")n.handleEvent(s)}};if(!this._handlers.has(e))this._handlers.set(e,new Map);let i=this._handlers.get(e);if(!i.has(t))i.set(t,new Set);return i.get(t).add({handler:n,wrapper:r}),e.addEventListener(t,r),()=>this.off(e,t,n)}off(e,t,n){let r=this._handlers.get(e);if(!r?.has(t))return;for(let i of r.get(t))if(i.handler===n){e.removeEventListener(t,i.wrapper),r.get(t).delete(i);break}}}class W{_action;_interface=null;constructor(e){if(this._action=e,typeof window==="undefined"||!window.$intent||typeof window.$intent.create!=="function")console.warn("window['$intent'] or window['$intent'].create is not defined. Intent functionality may be limited.");else this._interface=window.$intent.create(this._action)}getParsedIntent(){return this._interface}setData(e){if(this._interface&&typeof this._interface.setData==="function")this._interface.setData(e);else console.error("setData method not available on the intent interface.")}setPackage(e){if(this._interface&&typeof this._interface.setPackage==="function")this._interface.setPackage(e);else console.error("setPackage method not available on the intent interface.")}addCategory(e){if(this._interface&&typeof this._interface.addCategory==="function")this._interface.addCategory(e);else console.error("addCategory method not available on the intent interface.")}setType(e){if(this._interface&&typeof this._interface.setType==="function")this._interface.setType(e);else console.error("setType method not available on the intent interface.")}putExtra(e,t){if(this._interface&&typeof this._interface.putExtra==="function")this._interface.putExtra(e,t);else console.error("putExtra method not available on the intent interface.")}getStringExtra(e){if(this._interface&&typeof this._interface.getStringExtra==="function")return this._interface.getStringExtra(e);else return console.error("getStringExtra method not available on the intent interface."),null}getIntExtra(e){if(this._interface&&typeof this._interface.getIntExtra==="function")return this._interface.getIntExtra(e);else return console.error("getIntExtra method not available on the intent interface."),0}getBooleanExtra(e){if(this._interface&&typeof this._interface.getBooleanExtra==="function")return this._interface.getBooleanExtra(e);else return console.error("getBooleanExtra method not available on the intent interface."),!1}static ACTION_MAIN="android.intent.action.MAIN";static ACTION_VIEW="android.intent.action.VIEW";static ACTION_ATTACH_DATA="android.intent.action.ATTACH_DATA";static ACTION_EDIT="android.intent.action.EDIT";static ACTION_PICK="android.intent.action.PICK";static ACTION_CHOOSER="android.intent.action.CHOOSER";static ACTION_GET_CONTENT="android.intent.action.GET_CONTENT";static ACTION_DIAL="android.intent.action.DIAL";static ACTION_CALL="android.intent.action.CALL";static ACTION_SEND="android.intent.action.SEND";static ACTION_SENDTO="android.intent.action.SENDTO";static ACTION_SEND_MULTIPLE="android.intent.action.SEND_MULTIPLE";static ACTION_SYNC="android.intent.action.SYNC";static ACTION_BATTERY_LOW="android.intent.action.BATTERY_LOW";static ACTION_BATTERY_OKAY="android.intent.action.BATTERY_OKAY";static ACTION_BOOT_COMPLETED="android.intent.action.BOOT_COMPLETED";static ACTION_CAMERA_BUTTON="android.intent.action.CAMERA_BUTTON";static ACTION_CLOSE_SYSTEM_DIALOGS="android.intent.action.CLOSE_SYSTEM_DIALOGS";static ACTION_DEVICE_STORAGE_LOW="android.intent.action.DEVICE_STORAGE_LOW";static ACTION_DEVICE_STORAGE_OK="android.intent.action.DEVICE_STORAGE_OK";static ACTION_EXTERNAL_APPLICATIONS_AVAILABLE="android.intent.action.EXTERNAL_APPLICATIONS_AVAILABLE";static ACTION_EXTERNAL_APPLICATIONS_UNAVAILABLE="android.intent.action.EXTERNAL_APPLICATIONS_UNAVAILABLE";static ACTION_LOCALE_CHANGED="android.intent.action.LOCALE_CHANGED";static ACTION_MEDIA_BAD_REMOVAL="android.intent.action.MEDIA_BAD_REMOVAL";static ACTION_MEDIA_BUTTON="android.intent.action.MEDIA_BUTTON";static ACTION_MEDIA_CHECKING="android.intent.action.MEDIA_CHECKING";static ACTION_MEDIA_EJECT="android.intent.action.MEDIA_EJECT";static ACTION_MEDIA_MOUNTED="android.intent.action.MEDIA_MOUNTED";static ACTION_MEDIA_NOFS="android.intent.action.MEDIA_NOFS";static ACTION_MEDIA_REMOVED="android.intent.action.MEDIA_REMOVED";static ACTION_MEDIA_SCANNER_FINISHED="android.intent.action.MEDIA_SCANNER_FINISHED";static ACTION_MEDIA_SCANNER_SCAN_FILE="android.intent.action.MEDIA_SCANNER_SCAN_FILE";static ACTION_MEDIA_SCANNER_STARTED="android.intent.action.MEDIA_SCANNER_STARTED";static ACTION_MEDIA_SHARED="android.intent.action.MEDIA_SHARED";static ACTION_MEDIA_UNMOUNTABLE="android.intent.action.MEDIA_UNMOUNTABLE";static ACTION_MEDIA_UNMOUNTED="android.intent.action.MEDIA_UNMOUNTED";static ACTION_NEW_OUTGOING_CALL="android.intent.action.NEW_OUTGOING_CALL";static ACTION_PACKAGE_ADDED="android.intent.action.PACKAGE_ADDED";static ACTION_PACKAGE_CHANGED="android.intent.action.PACKAGE_CHANGED";static ACTION_PACKAGE_DATA_CLEARED="android.intent.action.PACKAGE_DATA_CLEARED";static ACTION_PACKAGE_FULLY_REMOVED="android.intent.action.PACKAGE_FULLY_REMOVED";static ACTION_PACKAGE_INSTALL="android.intent.action.PACKAGE_INSTALL";static ACTION_PACKAGE_FIRST_LAUNCH="android.intent.action.PACKAGE_FIRST_LAUNCH";static ACTION_PACKAGE_NEEDS_VERIFICATION="android.intent.action.PACKAGE_NEEDS_VERIFICATION";static ACTION_PACKAGE_REMOVED="android.intent.action.PACKAGE_REMOVED";static ACTION_PACKAGE_REPLACED="android.intent.action.PACKAGE_REPLACED";static ACTION_PACKAGE_RESTARTED="android.intent.action.PACKAGE_RESTARTED";static ACTION_PACKAGE_VERIFIED="android.intent.action.PACKAGE_VERIFIED";static ACTION_POWER_CONNECTED="android.intent.action.POWER_CONNECTED";static ACTION_POWER_DISCONNECTED="android.intent.action.POWER_DISCONNECTED";static ACTION_PROVIDER_CHANGED="android.intent.action.PROVIDER_CHANGED";static ACTION_REBOOT="android.intent.action.REBOOT";static ACTION_SCREEN_OFF="android.intent.action.SCREEN_OFF";static ACTION_SCREEN_ON="android.intent.action.SCREEN_ON";static ACTION_SHUTDOWN="android.intent.action.SHUTDOWN";static ACTION_TIME_CHANGED="android.intent.action.TIME_CHANGED";static ACTION_TIME_TICK="android.intent.action.TIME_TICK";static ACTION_TIMEZONE_CHANGED="android.intent.action.TIMEZONE_CHANGED";static ACTION_UID_REMOVED="android.intent.action.UID_REMOVED";static ACTION_USER_BACKGROUND="android.intent.action.USER_BACKGROUND";static ACTION_USER_FOREGROUND="android.intent.action.USER_FOREGROUND";static ACTION_USER_INITIALIZE="android.intent.action.USER_INITIALIZE";static ACTION_USER_PRESENT="android.intent.action.USER_PRESENT";static ACTION_USER_UNLOCKED="android.intent.action.USER_UNLOCKED";static ACTION_WALLPAPER_CHANGED="android.intent.action.WALLPAPER_CHANGED";static ACTION_AIRPLANE_MODE_CHANGED="android.intent.action.AIRPLANE_MODE";static ACTION_ANSWER="android.intent.action.ANSWER";static ACTION_DREAMING_STARTED="android.intent.action.DREAMING_STARTED";static ACTION_DREAMING_STOPPED="android.intent.action.DREAMING_STOPPED";static ACTION_INPUT_METHOD_CHANGED="android.intent.action.INPUT_METHOD_CHANGED";static ACTION_HEADSET_PLUG="android.intent.action.HEADSET_PLUG";static ACTION_MANAGE_PACKAGE_STORAGE="android.intent.action.MANAGE_PACKAGE_STORAGE";static ACTION_MY_PACKAGE_REPLACED="android.intent.action.MY_PACKAGE_REPLACED";static ACTION_PREFERRED_APPLICATIONS_CHANGED="android.intent.action.PREFERRED_APPLICATIONS_CHANGED";static ACTION_RADIO_POWER_RESET="android.intent.action.RADIO_POWER_RESET";static ACTION_UMS_CONNECTED="android.intent.action.UMS_CONNECTED";static ACTION_UMS_DISCONNECTED="android.intent.action.UMS_DISCONNECTED";static ACTION_USER_ADDED="android.intent.action.USER_ADDED";static ACTION_USER_REMOVED="android.intent.action.USER_REMOVED";static ACTION_USER_STOPPED="android.intent.action.USER_STOPPED";static ACTION_VPN_SETTINGS="android.intent.action.VPN_SETTINGS";static ACTION_INSTALL_FAILURE="android.intent.action.INSTALL_FAILURE";static ACTION_INSTALL_PACKAGE="android.intent.action.INSTALL_PACKAGE";static ACTION_UNINSTALL_PACKAGE="android.intent.action.UNINSTALL_PACKAGE";static ACTION_APPLICATION_SETTINGS="android.intent.action.APPLICATION_SETTINGS";static ACTION_DATA_ROAMING_SETTINGS="android.intent.action.DATA_ROAMING_SETTINGS";static ACTION_DATE_SETTINGS="android.intent.action.DATE_SETTINGS";static ACTION_DEVICE_INFO_SETTINGS="android.intent.action.DEVICE_INFO_SETTINGS";static ACTION_DISPLAY_SETTINGS="android.intent.action.DISPLAY_SETTINGS";static ACTION_HOME_SETTINGS="android.intent.action.HOME_SETTINGS";static ACTION_LOCATION_SOURCE_SETTINGS="android.intent.action.LOCATION_SOURCE_SETTINGS";static ACTION_NETWORK_SETTINGS="android.intent.action.NETWORK_SETTINGS";static ACTION_NFC_SETTINGS="android.intent.action.NFC_SETTINGS";static ACTION_PRIVACY_SETTINGS="android.intent.action.PRIVACY_SETTINGS";static ACTION_SEARCH_SETTINGS="android.intent.action.SEARCH_SETTINGS";static ACTION_SECURITY_SETTINGS="android.intent.action.SECURITY_SETTINGS";static ACTION_SETTINGS="android.intent.action.SETTINGS";static ACTION_SOUND_SETTINGS="android.intent.action.SOUND_SETTINGS";static ACTION_SYNC_SETTINGS="android.intent.action.SYNC_SETTINGS";static ACTION_USAGE_ACCESS_SETTINGS="android.intent.action.USAGE_ACCESS_SETTINGS";static ACTION_WIFI_IP_SETTINGS="android.intent.action.WIFI_IP_SETTINGS";static ACTION_WIFI_SETTINGS="android.intent.action.WIFI_SETTINGS";static ACTION_WIRELESS_SETTINGS="android.intent.action.WIRELESS_SETTINGS";static ACTION_BLUETOOTH_SETTINGS="android.intent.action.BLUETOOTH_SETTINGS";static ACTION_ACCESSIBILITY_SETTINGS="android.intent.action.ACCESSIBILITY_SETTINGS";static ACTION_ACCOUNT_SETTINGS="android.intent.action.ACCOUNT_SETTINGS";static ACTION_ADD_ACCOUNT="android.intent.action.ADD_ACCOUNT";static ACTION_APPLICATION_DETAILS_SETTINGS="android.intent.action.APPLICATION_DETAILS_SETTINGS";static ACTION_APPLICATION_DEVELOPMENT_SETTINGS="android.intent.action.APPLICATION_DEVELOPMENT_SETTINGS";static ACTION_WEB_SEARCH="android.intent.action.WEB_SEARCH";static ACTION_CREATE_SHORTCUT="android.intent.action.CREATE_SHORTCUT";static EXTRA_STREAM="android.intent.extra.STREAM";static EXTRA_TEXT="android.intent.extra.TEXT";static EXTRA_EMAIL="android.intent.extra.EMAIL";static EXTRA_CC="android.intent.extra.CC";static EXTRA_BCC="android.intent.extra.BCC";static EXTRA_SUBJECT="android.intent.extra.SUBJECT";static EXTRA_REFERRER="android.intent.extra.REFERRER";static EXTRA_REFERRER_NAME="android.intent.extra.REFERRER_NAME";static EXTRA_PHONE_NUMBER="android.intent.extra.PHONE_NUMBER";static EXTRA_LOCAL_ONLY="android.intent.extra.LOCAL_ONLY";static EXTRA_INITIAL_INTENTS="android.intent.extra.INITIAL_INTENTS";static EXTRA_CHOSEN_COMPONENT="android.intent.extra.CHOSEN_COMPONENT";static EXTRA_SHORTCUT_INTENT="android.intent.extra.SHORTCUT_INTENT";static EXTRA_SHORTCUT_NAME="android.intent.extra.SHORTCUT_NAME";static EXTRA_SHORTCUT_ICON="android.intent.extra.SHORTCUT_ICON";static EXTRA_SHORTCUT_ICON_RESOURCE="android.intent.extra.SHORTCUT_ICON_RESOURCE";static EXTRA_TITLE="android.intent.extra.TITLE";static EXTRA_HTML_TEXT="android.intent.extra.HTML_TEXT";static EXTRA_ASSIST_CONTEXT="android.intent.extra.ASSIST_CONTEXT";static EXTRA_ASSIST_INPUT_DEVICE_ID="android.intent.extra.ASSIST_INPUT_DEVICE_ID";static EXTRA_ASSIST_INPUT_METHOD_MANAGER_SERVICE="android.intent.extra.ASSIST_INPUT_METHOD_MANAGER_SERVICE";static EXTRA_ASSIST_SCREENSHOT="android.intent.extra.ASSIST_SCREENSHOT";static EXTRA_ASSIST_URI="android.intent.extra.ASSIST_URI";static EXTRA_ORIGINATING_URI="android.intent.extra.ORIGINATING_URI";static EXTRA_WEB_SEARCH_INTENT="android.intent.extra.WEB_SEARCH_INTENT";static EXTRA_MEDIA_ALBUM="android.intent.extra.MEDIA_ALBUM";static EXTRA_MEDIA_ARTIST="android.intent.extra.MEDIA_ARTIST";static EXTRA_MEDIA_FOCUS="android.intent.extra.MEDIA_FOCUS";static EXTRA_MEDIA_GENRE="android.intent.extra.MEDIA_GENRE";static EXTRA_MEDIA_TITLE="android.intent.extra.MEDIA_TITLE";static EXTRA_ALARM_COUNT="android.intent.extra.ALARM_COUNT";static EXTRA_CHANGED_COMPONENT_NAME_LIST="android.intent.extra.CHANGED_COMPONENT_NAME_LIST";static EXTRA_CHANGED_PACKAGE_LIST="android.intent.extra.CHANGED_PACKAGE_LIST";static EXTRA_CHANGED_UID_LIST="android.intent.extra.CHANGED_UID_LIST";static EXTRA_DATA_REMOVED="android.intent.extra.DATA_REMOVED";static EXTRA_DONT_KILL_APP="android.intent.extra.DONT_KILL_APP";static EXTRA_INSTALL_RESULT="android.intent.extra.INSTALL_RESULT";static EXTRA_KEY_EVENT="android.intent.extra.KEY_EVENT";static EXTRA_MIME_TYPES="android.intent.extra.MIME_TYPES";static EXTRA_MOUNT_FAILED="android.intent.extra.MOUNT_FAILED";static EXTRA_NOTIFICATION_ID="android.intent.extra.NOTIFICATION_ID";static EXTRA_NOTIFICATION_TAG="android.intent.extra.NOTIFICATION_TAG";static EXTRA_PACKAGES="android.intent.extra.PACKAGES";static EXTRA_REPLACING="android.intent.extra.REPLACING";static EXTRA_SPLIT_NAME="android.intent.extra.SPLIT_NAME";static EXTRA_SUSPENDED_PACKAGE_EXTRAS="android.intent.extra.SUSPENDED_PACKAGE_EXTRAS";static EXTRA_UID="android.intent.extra.UID";static EXTRA_USER="android.intent.extra.USER";static EXTRA_CHANNEL_ID="android.intent.extra.CHANNEL_ID";static EXTRA_REMOTE_INTENT_TOKEN="android.intent.extra.REMOTE_INTENT_TOKEN";static EXTRA_PERMISSION_GROUP_NAME="android.intent.extra.PERMISSION_GROUP_NAME";static EXTRA_PERMISSION_NAME="android.intent.extra.PERMISSION_NAME";static EXTRA_RESTRICTIONS_BUNDLE="android.intent.extra.RESTRICTIONS_BUNDLE";static EXTRA_RESTRICTIONS_INTENT="android.intent.extra.RESTRICTIONS_INTENT";static EXTRA_TIMEZONE="android.intent.extra.TIMEZONE";static EXTRA_DONT_REPLACE_EXISTING_APPLICATION_INFO="android.intent.extra.DONT_REPLACE_EXISTING_APPLICATION_INFO";static EXTRA_SPLASH_SCREEN_THEME="android.intent.extra.SPLASH_SCREEN_THEME";static EXTRA_SPLASH_SCREEN_ICON_ID="android.intent.extra.SPLASH_SCREEN_ICON_ID";static EXTRA_STREAM_MULTIPLE="android.intent.extra.STREAM_MULTIPLE";static EXTRA_EXCLUDE_COMPONENTS="android.intent.extra.EXCLUDE_COMPONENTS";static EXTRA_ALLOW_MULTIPLE="android.intent.extra.ALLOW_MULTIPLE";static EXTRA_PROVISIONING_ACCOUNT_TO_MIGRATE="android.intent.extra.PROVISIONING_ACCOUNT_TO_MIGRATE";static EXTRA_PROVISIONING_DEVICE_ADMIN_COMPONENT_NAME="android.intent.extra.PROVISIONING_DEVICE_ADMIN_COMPONENT_NAME";static EXTRA_PROVISIONING_LEAVE_ALL_SYSTEM_APPS_ENABLED="android.intent.extra.PROVISIONING_LEAVE_ALL_SYSTEM_APPS_ENABLED";static EXTRA_PROVISIONING_LOCALE="android.intent.extra.PROVISIONING_LOCALE";static EXTRA_PROVISIONING_TIME_ZONE="android.intent.extra.PROVISIONING_TIME_ZONE";static EXTRA_PROVISIONING_WIFI_HIDDEN="android.intent.extra.PROVISIONING_WIFI_HIDDEN";static EXTRA_PROVISIONING_WIFI_PASSWORD="android.intent.extra.PROVISIONING_WIFI_PASSWORD";static EXTRA_PROVISIONING_WIFI_SECURITY_TYPE="android.intent.extra.PROVISIONING_WIFI_SECURITY_TYPE";static EXTRA_PROVISIONING_WIFI_SSID="android.intent.extra.PROVISIONING_WIFI_SSID"}class X{_interface=null;constructor(){if(typeof window==="undefined"||!window.webui)console.warn("window['webui'] is not defined. WebUI functionality may be limited.");else this._interface=window.webui}exit(){if(this._interface&&typeof this._interface.exit==="function")this._interface.exit();else console.error("exit method not available on the webui interface.")}setRefreshing(e){if(this._interface&&typeof this._interface.setRefreshing==="function")this._interface.setRefreshing(e);else console.error("setRefreshing method not available on the webui interface.")}get currentRootManager(){if(this._interface&&typeof this._interface.getCurrentRootManager!=="undefined")return this._interface.getCurrentRootManager();else return console.error("currentRootManager getter not available on the webui interface."),null}get currentApplication(){if(this._interface&&typeof this._interface.getCurrentApplication!=="undefined")return this._interface.getCurrentApplication();else return console.error("currentApplication getter not available on the webui interface."),null}getApplication(e){if(this._interface&&typeof this._interface.getApplication==="function")return this._interface.getApplication(e);else return console.error("getApplication method not available on the webui interface."),null}openFile(e){if(this._interface&&typeof this._interface.openFile==="function")this._interface.openFile(e.getParsedIntent());else console.error("openFile method not available on the webui interface.")}startActivity(e){if(this._interface&&typeof this._interface.startActivity==="function")this._interface.startActivity(e.getParsedIntent());else console.error("startActivity method not available on the webui interface.")}}
|
|
1
|
+
var{defineProperty:c,getOwnPropertyNames:b,getOwnPropertyDescriptor:h}=Object,O=Object.prototype.hasOwnProperty;var w=new WeakMap,T=(e)=>{var t=w.get(e),n;if(t)return t;if(t=c({},"__esModule",{value:!0}),e&&typeof e==="object"||typeof e==="function")b(e).map((r)=>!O.call(t,r)&&c(t,r,{get:()=>e[r],enumerable:!(n=h(e,r))||n.enumerable}));return w.set(e,t),t};var m=(e,t)=>{for(var n in t)c(e,n,{get:t[n],enumerable:!0,configurable:!0,set:(r)=>t[n]=()=>r})};var R={};m(R,{wrapToReadableStream:()=>u,wrapOutputStream:()=>I,wrapInputStream:()=>_,readableStreamInit:()=>d,WebUI:()=>W,WXEventHandler:()=>E,WXEvent:()=>p,WXClass:()=>v,Intent:()=>y});module.exports=T(R);class v{constructor(){this.findInterface=this.findInterface.bind(this)}fileToken=Object.keys(window).find((e)=>e.match(/^\$(\w{2})File$/m));fileInputToken=Object.keys(window).find((e)=>e.match(/^\$(\w{2})FileInputStream$/m));moduleToken=this.fileToken?.slice(0,3).toLowerCase();findInterface(){return Object.keys(window).find((e)=>{if(e===this.fileToken||e===this.fileInputToken)return!1;if(e==="$packageManager")return!1;if(e==="$userManager")return!1;if(!this.moduleToken)return!1;return e.toLowerCase().startsWith(this.moduleToken)})}}class y{_action;_interface=null;constructor(e){if(this._action=e,typeof window==="undefined"||!window.$intent||typeof window.$intent.create!=="function")console.warn("window['$intent'] or window['$intent'].create is not defined. Intent functionality may be limited.");else this._interface=window.$intent.create(this._action)}getParsedIntent(){return this._interface}setData(e){if(this._interface&&typeof this._interface.setData==="function")this._interface.setData(e);else console.error("setData method not available on the intent interface.")}setPackage(e){if(this._interface&&typeof this._interface.setPackage==="function")this._interface.setPackage(e);else console.error("setPackage method not available on the intent interface.")}addCategory(e){if(this._interface&&typeof this._interface.addCategory==="function")this._interface.addCategory(e);else console.error("addCategory method not available on the intent interface.")}setType(e){if(this._interface&&typeof this._interface.setType==="function")this._interface.setType(e);else console.error("setType method not available on the intent interface.")}putExtra(e,t){if(this._interface&&typeof this._interface.putExtra==="function")this._interface.putExtra(e,t);else console.error("putExtra method not available on the intent interface.")}getStringExtra(e){if(this._interface&&typeof this._interface.getStringExtra==="function")return this._interface.getStringExtra(e);else return console.error("getStringExtra method not available on the intent interface."),null}getIntExtra(e){if(this._interface&&typeof this._interface.getIntExtra==="function")return this._interface.getIntExtra(e);else return console.error("getIntExtra method not available on the intent interface."),0}getBooleanExtra(e){if(this._interface&&typeof this._interface.getBooleanExtra==="function")return this._interface.getBooleanExtra(e);else return console.error("getBooleanExtra method not available on the intent interface."),!1}static ACTION_MAIN="android.intent.action.MAIN";static ACTION_VIEW="android.intent.action.VIEW";static ACTION_ATTACH_DATA="android.intent.action.ATTACH_DATA";static ACTION_EDIT="android.intent.action.EDIT";static ACTION_PICK="android.intent.action.PICK";static ACTION_CHOOSER="android.intent.action.CHOOSER";static ACTION_GET_CONTENT="android.intent.action.GET_CONTENT";static ACTION_DIAL="android.intent.action.DIAL";static ACTION_CALL="android.intent.action.CALL";static ACTION_SEND="android.intent.action.SEND";static ACTION_SENDTO="android.intent.action.SENDTO";static ACTION_SEND_MULTIPLE="android.intent.action.SEND_MULTIPLE";static ACTION_SYNC="android.intent.action.SYNC";static ACTION_BATTERY_LOW="android.intent.action.BATTERY_LOW";static ACTION_BATTERY_OKAY="android.intent.action.BATTERY_OKAY";static ACTION_BOOT_COMPLETED="android.intent.action.BOOT_COMPLETED";static ACTION_CAMERA_BUTTON="android.intent.action.CAMERA_BUTTON";static ACTION_CLOSE_SYSTEM_DIALOGS="android.intent.action.CLOSE_SYSTEM_DIALOGS";static ACTION_DEVICE_STORAGE_LOW="android.intent.action.DEVICE_STORAGE_LOW";static ACTION_DEVICE_STORAGE_OK="android.intent.action.DEVICE_STORAGE_OK";static ACTION_EXTERNAL_APPLICATIONS_AVAILABLE="android.intent.action.EXTERNAL_APPLICATIONS_AVAILABLE";static ACTION_EXTERNAL_APPLICATIONS_UNAVAILABLE="android.intent.action.EXTERNAL_APPLICATIONS_UNAVAILABLE";static ACTION_LOCALE_CHANGED="android.intent.action.LOCALE_CHANGED";static ACTION_MEDIA_BAD_REMOVAL="android.intent.action.MEDIA_BAD_REMOVAL";static ACTION_MEDIA_BUTTON="android.intent.action.MEDIA_BUTTON";static ACTION_MEDIA_CHECKING="android.intent.action.MEDIA_CHECKING";static ACTION_MEDIA_EJECT="android.intent.action.MEDIA_EJECT";static ACTION_MEDIA_MOUNTED="android.intent.action.MEDIA_MOUNTED";static ACTION_MEDIA_NOFS="android.intent.action.MEDIA_NOFS";static ACTION_MEDIA_REMOVED="android.intent.action.MEDIA_REMOVED";static ACTION_MEDIA_SCANNER_FINISHED="android.intent.action.MEDIA_SCANNER_FINISHED";static ACTION_MEDIA_SCANNER_SCAN_FILE="android.intent.action.MEDIA_SCANNER_SCAN_FILE";static ACTION_MEDIA_SCANNER_STARTED="android.intent.action.MEDIA_SCANNER_STARTED";static ACTION_MEDIA_SHARED="android.intent.action.MEDIA_SHARED";static ACTION_MEDIA_UNMOUNTABLE="android.intent.action.MEDIA_UNMOUNTABLE";static ACTION_MEDIA_UNMOUNTED="android.intent.action.MEDIA_UNMOUNTED";static ACTION_NEW_OUTGOING_CALL="android.intent.action.NEW_OUTGOING_CALL";static ACTION_PACKAGE_ADDED="android.intent.action.PACKAGE_ADDED";static ACTION_PACKAGE_CHANGED="android.intent.action.PACKAGE_CHANGED";static ACTION_PACKAGE_DATA_CLEARED="android.intent.action.PACKAGE_DATA_CLEARED";static ACTION_PACKAGE_FULLY_REMOVED="android.intent.action.PACKAGE_FULLY_REMOVED";static ACTION_PACKAGE_INSTALL="android.intent.action.PACKAGE_INSTALL";static ACTION_PACKAGE_FIRST_LAUNCH="android.intent.action.PACKAGE_FIRST_LAUNCH";static ACTION_PACKAGE_NEEDS_VERIFICATION="android.intent.action.PACKAGE_NEEDS_VERIFICATION";static ACTION_PACKAGE_REMOVED="android.intent.action.PACKAGE_REMOVED";static ACTION_PACKAGE_REPLACED="android.intent.action.PACKAGE_REPLACED";static ACTION_PACKAGE_RESTARTED="android.intent.action.PACKAGE_RESTARTED";static ACTION_PACKAGE_VERIFIED="android.intent.action.PACKAGE_VERIFIED";static ACTION_POWER_CONNECTED="android.intent.action.POWER_CONNECTED";static ACTION_POWER_DISCONNECTED="android.intent.action.POWER_DISCONNECTED";static ACTION_PROVIDER_CHANGED="android.intent.action.PROVIDER_CHANGED";static ACTION_REBOOT="android.intent.action.REBOOT";static ACTION_SCREEN_OFF="android.intent.action.SCREEN_OFF";static ACTION_SCREEN_ON="android.intent.action.SCREEN_ON";static ACTION_SHUTDOWN="android.intent.action.SHUTDOWN";static ACTION_TIME_CHANGED="android.intent.action.TIME_CHANGED";static ACTION_TIME_TICK="android.intent.action.TIME_TICK";static ACTION_TIMEZONE_CHANGED="android.intent.action.TIMEZONE_CHANGED";static ACTION_UID_REMOVED="android.intent.action.UID_REMOVED";static ACTION_USER_BACKGROUND="android.intent.action.USER_BACKGROUND";static ACTION_USER_FOREGROUND="android.intent.action.USER_FOREGROUND";static ACTION_USER_INITIALIZE="android.intent.action.USER_INITIALIZE";static ACTION_USER_PRESENT="android.intent.action.USER_PRESENT";static ACTION_USER_UNLOCKED="android.intent.action.USER_UNLOCKED";static ACTION_WALLPAPER_CHANGED="android.intent.action.WALLPAPER_CHANGED";static ACTION_AIRPLANE_MODE_CHANGED="android.intent.action.AIRPLANE_MODE";static ACTION_ANSWER="android.intent.action.ANSWER";static ACTION_DREAMING_STARTED="android.intent.action.DREAMING_STARTED";static ACTION_DREAMING_STOPPED="android.intent.action.DREAMING_STOPPED";static ACTION_INPUT_METHOD_CHANGED="android.intent.action.INPUT_METHOD_CHANGED";static ACTION_HEADSET_PLUG="android.intent.action.HEADSET_PLUG";static ACTION_MANAGE_PACKAGE_STORAGE="android.intent.action.MANAGE_PACKAGE_STORAGE";static ACTION_MY_PACKAGE_REPLACED="android.intent.action.MY_PACKAGE_REPLACED";static ACTION_PREFERRED_APPLICATIONS_CHANGED="android.intent.action.PREFERRED_APPLICATIONS_CHANGED";static ACTION_RADIO_POWER_RESET="android.intent.action.RADIO_POWER_RESET";static ACTION_UMS_CONNECTED="android.intent.action.UMS_CONNECTED";static ACTION_UMS_DISCONNECTED="android.intent.action.UMS_DISCONNECTED";static ACTION_USER_ADDED="android.intent.action.USER_ADDED";static ACTION_USER_REMOVED="android.intent.action.USER_REMOVED";static ACTION_USER_STOPPED="android.intent.action.USER_STOPPED";static ACTION_VPN_SETTINGS="android.intent.action.VPN_SETTINGS";static ACTION_INSTALL_FAILURE="android.intent.action.INSTALL_FAILURE";static ACTION_INSTALL_PACKAGE="android.intent.action.INSTALL_PACKAGE";static ACTION_UNINSTALL_PACKAGE="android.intent.action.UNINSTALL_PACKAGE";static ACTION_APPLICATION_SETTINGS="android.intent.action.APPLICATION_SETTINGS";static ACTION_DATA_ROAMING_SETTINGS="android.intent.action.DATA_ROAMING_SETTINGS";static ACTION_DATE_SETTINGS="android.intent.action.DATE_SETTINGS";static ACTION_DEVICE_INFO_SETTINGS="android.intent.action.DEVICE_INFO_SETTINGS";static ACTION_DISPLAY_SETTINGS="android.intent.action.DISPLAY_SETTINGS";static ACTION_HOME_SETTINGS="android.intent.action.HOME_SETTINGS";static ACTION_LOCATION_SOURCE_SETTINGS="android.intent.action.LOCATION_SOURCE_SETTINGS";static ACTION_NETWORK_SETTINGS="android.intent.action.NETWORK_SETTINGS";static ACTION_NFC_SETTINGS="android.intent.action.NFC_SETTINGS";static ACTION_PRIVACY_SETTINGS="android.intent.action.PRIVACY_SETTINGS";static ACTION_SEARCH_SETTINGS="android.intent.action.SEARCH_SETTINGS";static ACTION_SECURITY_SETTINGS="android.intent.action.SECURITY_SETTINGS";static ACTION_SETTINGS="android.intent.action.SETTINGS";static ACTION_SOUND_SETTINGS="android.intent.action.SOUND_SETTINGS";static ACTION_SYNC_SETTINGS="android.intent.action.SYNC_SETTINGS";static ACTION_USAGE_ACCESS_SETTINGS="android.intent.action.USAGE_ACCESS_SETTINGS";static ACTION_WIFI_IP_SETTINGS="android.intent.action.WIFI_IP_SETTINGS";static ACTION_WIFI_SETTINGS="android.intent.action.WIFI_SETTINGS";static ACTION_WIRELESS_SETTINGS="android.intent.action.WIRELESS_SETTINGS";static ACTION_BLUETOOTH_SETTINGS="android.intent.action.BLUETOOTH_SETTINGS";static ACTION_ACCESSIBILITY_SETTINGS="android.intent.action.ACCESSIBILITY_SETTINGS";static ACTION_ACCOUNT_SETTINGS="android.intent.action.ACCOUNT_SETTINGS";static ACTION_ADD_ACCOUNT="android.intent.action.ADD_ACCOUNT";static ACTION_APPLICATION_DETAILS_SETTINGS="android.intent.action.APPLICATION_DETAILS_SETTINGS";static ACTION_APPLICATION_DEVELOPMENT_SETTINGS="android.intent.action.APPLICATION_DEVELOPMENT_SETTINGS";static ACTION_WEB_SEARCH="android.intent.action.WEB_SEARCH";static ACTION_CREATE_SHORTCUT="android.intent.action.CREATE_SHORTCUT";static EXTRA_STREAM="android.intent.extra.STREAM";static EXTRA_TEXT="android.intent.extra.TEXT";static EXTRA_EMAIL="android.intent.extra.EMAIL";static EXTRA_CC="android.intent.extra.CC";static EXTRA_BCC="android.intent.extra.BCC";static EXTRA_SUBJECT="android.intent.extra.SUBJECT";static EXTRA_REFERRER="android.intent.extra.REFERRER";static EXTRA_REFERRER_NAME="android.intent.extra.REFERRER_NAME";static EXTRA_PHONE_NUMBER="android.intent.extra.PHONE_NUMBER";static EXTRA_LOCAL_ONLY="android.intent.extra.LOCAL_ONLY";static EXTRA_INITIAL_INTENTS="android.intent.extra.INITIAL_INTENTS";static EXTRA_CHOSEN_COMPONENT="android.intent.extra.CHOSEN_COMPONENT";static EXTRA_SHORTCUT_INTENT="android.intent.extra.SHORTCUT_INTENT";static EXTRA_SHORTCUT_NAME="android.intent.extra.SHORTCUT_NAME";static EXTRA_SHORTCUT_ICON="android.intent.extra.SHORTCUT_ICON";static EXTRA_SHORTCUT_ICON_RESOURCE="android.intent.extra.SHORTCUT_ICON_RESOURCE";static EXTRA_TITLE="android.intent.extra.TITLE";static EXTRA_HTML_TEXT="android.intent.extra.HTML_TEXT";static EXTRA_ASSIST_CONTEXT="android.intent.extra.ASSIST_CONTEXT";static EXTRA_ASSIST_INPUT_DEVICE_ID="android.intent.extra.ASSIST_INPUT_DEVICE_ID";static EXTRA_ASSIST_INPUT_METHOD_MANAGER_SERVICE="android.intent.extra.ASSIST_INPUT_METHOD_MANAGER_SERVICE";static EXTRA_ASSIST_SCREENSHOT="android.intent.extra.ASSIST_SCREENSHOT";static EXTRA_ASSIST_URI="android.intent.extra.ASSIST_URI";static EXTRA_ORIGINATING_URI="android.intent.extra.ORIGINATING_URI";static EXTRA_WEB_SEARCH_INTENT="android.intent.extra.WEB_SEARCH_INTENT";static EXTRA_MEDIA_ALBUM="android.intent.extra.MEDIA_ALBUM";static EXTRA_MEDIA_ARTIST="android.intent.extra.MEDIA_ARTIST";static EXTRA_MEDIA_FOCUS="android.intent.extra.MEDIA_FOCUS";static EXTRA_MEDIA_GENRE="android.intent.extra.MEDIA_GENRE";static EXTRA_MEDIA_TITLE="android.intent.extra.MEDIA_TITLE";static EXTRA_ALARM_COUNT="android.intent.extra.ALARM_COUNT";static EXTRA_CHANGED_COMPONENT_NAME_LIST="android.intent.extra.CHANGED_COMPONENT_NAME_LIST";static EXTRA_CHANGED_PACKAGE_LIST="android.intent.extra.CHANGED_PACKAGE_LIST";static EXTRA_CHANGED_UID_LIST="android.intent.extra.CHANGED_UID_LIST";static EXTRA_DATA_REMOVED="android.intent.extra.DATA_REMOVED";static EXTRA_DONT_KILL_APP="android.intent.extra.DONT_KILL_APP";static EXTRA_INSTALL_RESULT="android.intent.extra.INSTALL_RESULT";static EXTRA_KEY_EVENT="android.intent.extra.KEY_EVENT";static EXTRA_MIME_TYPES="android.intent.extra.MIME_TYPES";static EXTRA_MOUNT_FAILED="android.intent.extra.MOUNT_FAILED";static EXTRA_NOTIFICATION_ID="android.intent.extra.NOTIFICATION_ID";static EXTRA_NOTIFICATION_TAG="android.intent.extra.NOTIFICATION_TAG";static EXTRA_PACKAGES="android.intent.extra.PACKAGES";static EXTRA_REPLACING="android.intent.extra.REPLACING";static EXTRA_SPLIT_NAME="android.intent.extra.SPLIT_NAME";static EXTRA_SUSPENDED_PACKAGE_EXTRAS="android.intent.extra.SUSPENDED_PACKAGE_EXTRAS";static EXTRA_UID="android.intent.extra.UID";static EXTRA_USER="android.intent.extra.USER";static EXTRA_CHANNEL_ID="android.intent.extra.CHANNEL_ID";static EXTRA_REMOTE_INTENT_TOKEN="android.intent.extra.REMOTE_INTENT_TOKEN";static EXTRA_PERMISSION_GROUP_NAME="android.intent.extra.PERMISSION_GROUP_NAME";static EXTRA_PERMISSION_NAME="android.intent.extra.PERMISSION_NAME";static EXTRA_RESTRICTIONS_BUNDLE="android.intent.extra.RESTRICTIONS_BUNDLE";static EXTRA_RESTRICTIONS_INTENT="android.intent.extra.RESTRICTIONS_INTENT";static EXTRA_TIMEZONE="android.intent.extra.TIMEZONE";static EXTRA_DONT_REPLACE_EXISTING_APPLICATION_INFO="android.intent.extra.DONT_REPLACE_EXISTING_APPLICATION_INFO";static EXTRA_SPLASH_SCREEN_THEME="android.intent.extra.SPLASH_SCREEN_THEME";static EXTRA_SPLASH_SCREEN_ICON_ID="android.intent.extra.SPLASH_SCREEN_ICON_ID";static EXTRA_STREAM_MULTIPLE="android.intent.extra.STREAM_MULTIPLE";static EXTRA_EXCLUDE_COMPONENTS="android.intent.extra.EXCLUDE_COMPONENTS";static EXTRA_ALLOW_MULTIPLE="android.intent.extra.ALLOW_MULTIPLE";static EXTRA_PROVISIONING_ACCOUNT_TO_MIGRATE="android.intent.extra.PROVISIONING_ACCOUNT_TO_MIGRATE";static EXTRA_PROVISIONING_DEVICE_ADMIN_COMPONENT_NAME="android.intent.extra.PROVISIONING_DEVICE_ADMIN_COMPONENT_NAME";static EXTRA_PROVISIONING_LEAVE_ALL_SYSTEM_APPS_ENABLED="android.intent.extra.PROVISIONING_LEAVE_ALL_SYSTEM_APPS_ENABLED";static EXTRA_PROVISIONING_LOCALE="android.intent.extra.PROVISIONING_LOCALE";static EXTRA_PROVISIONING_TIME_ZONE="android.intent.extra.PROVISIONING_TIME_ZONE";static EXTRA_PROVISIONING_WIFI_HIDDEN="android.intent.extra.PROVISIONING_WIFI_HIDDEN";static EXTRA_PROVISIONING_WIFI_PASSWORD="android.intent.extra.PROVISIONING_WIFI_PASSWORD";static EXTRA_PROVISIONING_WIFI_SECURITY_TYPE="android.intent.extra.PROVISIONING_WIFI_SECURITY_TYPE";static EXTRA_PROVISIONING_WIFI_SSID="android.intent.extra.PROVISIONING_WIFI_SSID";static CATEGORY_DEFAULT="android.intent.category.DEFAULT";static CATEGORY_BROWSABLE="android.intent.category.BROWSABLE";static CATEGORY_TAB="android.intent.category.TAB";static CATEGORY_ALTERNATIVE="android.intent.category.ALTERNATIVE";static CATEGORY_SELECTED_ALTERNATIVE="android.intent.category.SELECTED_ALTERNATIVE";static CATEGORY_HOME="android.intent.category.HOME";static CATEGORY_LAUNCHER="android.intent.category.LAUNCHER";static CATEGORY_INFO="android.intent.category.INFO";static CATEGORY_MONITOR="android.intent.category.MONITOR";static CATEGORY_APP_BROWSER="android.intent.category.APP_BROWSER";static CATEGORY_APP_CALCULATOR="android.intent.category.APP_CALCULATOR";static CATEGORY_APP_CALENDAR="android.intent.category.APP_CALENDAR";static CATEGORY_APP_CONTACTS="android.intent.category.APP_CONTACTS";static CATEGORY_APP_EMAIL="android.intent.category.APP_EMAIL";static CATEGORY_APP_GALLERY="android.intent.category.APP_GALLERY";static CATEGORY_APP_MAPS="android.intent.category.APP_MAPS";static CATEGORY_APP_MESSAGING="android.intent.category.APP_MESSAGING";static CATEGORY_APP_MUSIC="android.intent.category.APP_MUSIC";static CATEGORY_APP_NFC="android.intent.category.APP_NFC";static CATEGORY_APP_FILES="android.intent.category.APP_FILES";static CATEGORY_OPENABLE="android.intent.category.OPENABLE";static CATEGORY_PREFERENCE="android.intent.category.PREFERENCE";static CATEGORY_TEST="android.intent.category.TEST";static CATEGORY_LIVE_WALLPAPER_SETTINGS="android.intent.category.LIVE_WALLPAPER_SETTINGS";static CATEGORY_INPUT_METHOD_SERVICE="android.intent.category.INPUT_METHOD_SERVICE";static CATEGORY_DEVICE_ADMIN="android.intent.category.DEVICE_ADMIN";static CATEGORY_ACCESSIBILITY_SERVICE="android.intent.category.ACCESSIBILITY_SERVICE";static CATEGORY_VPN_SERVICE="android.intent.category.VPN_SERVICE";static CATEGORY_DREAM="android.intent.category.DREAM";static CATEGORY_LEANBACK_LAUNCHER="android.intent.category.LEANBACK_LAUNCHER";static CATEGORY_LEANBACK_SETTINGS="android.intent.category.LEANBACK_SETTINGS";static CATEGORY_WEARABLE_LAUNCHER="android.intent.category.WEARABLE_LAUNCHER";static CATEGORY_CAR_MODE_LAUNCHER="android.intent.category.CAR_MODE_LAUNCHER"}class W{_interface=null;constructor(){if(typeof window==="undefined"||!window.webui)console.warn("window['webui'] is not defined. WebUI functionality may be limited.");else this._interface=window.webui}exit(){if(this._interface&&typeof this._interface.exit==="function")this._interface.exit();else console.error("exit method not available on the webui interface.")}setRefreshing(e){if(this._interface&&typeof this._interface.setRefreshing==="function")this._interface.setRefreshing(e);else console.error("setRefreshing method not available on the webui interface.")}get currentRootManager(){if(this._interface&&typeof this._interface.getCurrentRootManager!=="undefined")return this._interface.getCurrentRootManager();else return console.error("currentRootManager getter not available on the webui interface."),null}get currentApplication(){if(this._interface&&typeof this._interface.getCurrentApplication!=="undefined")return this._interface.getCurrentApplication();else return console.error("currentApplication getter not available on the webui interface."),null}getApplication(e){if(this._interface&&typeof this._interface.getApplication==="function")return this._interface.getApplication(e);else return console.error("getApplication method not available on the webui interface."),null}openFile(e){if(this._interface&&typeof this._interface.openFile==="function")this._interface.openFile(e.getParsedIntent());else console.error("openFile method not available on the webui interface.")}startActivity(e){if(this._interface&&typeof this._interface.startActivity==="function")this._interface.startActivity(e.getParsedIntent());else console.error("startActivity method not available on the webui interface.")}}class p extends Event{_wxOrigin;_wxData;get wxOrigin(){return this._wxOrigin}set wxOrigin(e){this._wxOrigin=e}get wx(){return this._wxData}set wx(e){this._wxData=e}constructor(e){super(e,{bubbles:!0,cancelable:!0,composed:!0})}}var g={cordova:!1};class E{_initialized=!1;_handlers=new WeakMap;_eventTypes;get eventTypes(){return this._eventTypes}constructor(e=g){if(this._initialized)return;this._initialized=!0,this._eventTypes={WX_ON_BACK:e.cordova?"backbutton":"back",WX_ON_RESUME:"resume",WX_ON_REFRESH:"refresh",WX_ON_PAUSE:"pause",WX_ON_KEYBOARD:"keyboard",WX_ON_INSETS:"insets"},window.addEventListener("message",(t)=>{try{if(typeof t.data!=="string")return;let n=JSON.parse(t.data);if(!n?.type)return;let r=this._eventTypes[n.type]??n.type;this._dispatch(window,r,n)}catch(n){console.error("[WXEvent] Message error:",n)}})}_dispatch(e,t,n){let r=new p(t);r.wx=n.data,r.wxOrigin="system",e.dispatchEvent(r)}on(e,t,n){if(!this._initialized)new E;let r=(s)=>{if(!(s instanceof p)){console.warn("[WXEvent] Event is not a WXEvent:",s);return}if(s.wxOrigin==="system"){if(typeof n==="function")n(s);else if(n&&typeof n.handleEvent==="function")n.handleEvent(s)}};if(!this._handlers.has(e))this._handlers.set(e,new Map);let i=this._handlers.get(e);if(!i.has(t))i.set(t,new Set);return i.get(t).add({handler:n,wrapper:r}),e.addEventListener(t,r),()=>this.off(e,t,n)}off(e,t,n){let r=this._handlers.get(e);if(!r?.has(t))return;for(let i of r.get(t))if(i.handler===n){e.removeEventListener(t,i.wrapper),r.get(t).delete(i);break}}}var d={chunkSize:1048576,headers:{"Content-Type":"application/octet-stream"}};async function u(e,t={}){let n={...d,...t};return new Promise((r,i)=>{let s;try{if(s=e,!s)throw new Error("Failed to open file input stream")}catch(o){i(o);return}let f=()=>{try{s?.close()}catch(o){console.error("Error during abort cleanup:",o)}i(new DOMException("The operation was aborted.","AbortError"))};if(n.signal){if(n.signal.aborted){f();return}n.signal.addEventListener("abort",f)}let X=new ReadableStream({async pull(o){try{let a=x(s,n.chunkSize);if(!a){o.close(),l();return}o.enqueue(a)}catch(a){l(),o.error(a),i(new Error(`Error reading file chunk: ${a}`))}},cancel(o){console.warn("Stream canceled:",o),l()}});function l(){try{if(n.signal)n.signal.removeEventListener("abort",f);s?.close()}catch(o){console.error(`Error during cleanup: ${o}`)}}r(X)})}function x(e,t){try{let n=t?e.readChunk(t):e.read();if(typeof n==="number")return new Uint8Array([n]);else if(typeof n==="string"){let r=JSON.parse(n);return r&&Array.isArray(r)&&r.length>0?new Uint8Array(r):null}return null}catch(n){throw new Error("Error reading chunk data: "+n)}}async function _(e,t={}){let n={...d,...t};try{let r=await u(e,n);return new Response(r,n)}catch(r){throw new Error(`wrapInputStream failed: ${r}`)}}async function I(e,t){if(!e||typeof e.getReader!=="function")throw new Error("Invalid ReadableStream provided.");if(!t||typeof t.write!=="function"||typeof t.close!=="function")throw new Error("Invalid outputStreamInstance provided. It must be an already opened stream with 'write' and 'close' methods.");let n=new WritableStream({async start(r){console.log("WritableStream started, output stream instance ready.")},async write(r,i){if(r instanceof Uint8Array)for(let s=0;s<r.length;s++)t.write(r[s]);else console.warn("Received non-Uint8Array chunk in WritableStream:",r),i.error(new TypeError("Expected Uint8Array chunks."))},async close(){console.log("WritableStream closed. Flushing and closing native stream.");try{t.flush(),t.close()}catch(r){throw console.error("Error during WritableStream close cleanup:",r),r}},async abort(r){console.error("WritableStream aborted:",r);try{t.close()}catch(i){console.error("Error during WritableStream abort cleanup:",i)}}});try{await e.pipeTo(n),console.log("Piping completed successfully.")}catch(r){let i=r instanceof Error?r:new Error(String(r));throw console.error("Error during stream piping:",i),new Error(`Failed to pipe stream: ${i.message}`)}}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,35 @@
|
|
|
1
1
|
// Generated by dts-bundle-generator v9.5.1
|
|
2
2
|
|
|
3
|
+
export interface IntentInterface {
|
|
4
|
+
create(action: string): IntentData;
|
|
5
|
+
}
|
|
6
|
+
export interface IntentData {
|
|
7
|
+
setPackage(packageName: string): void;
|
|
8
|
+
setData(data: string): void;
|
|
9
|
+
addCategory(category: string): void;
|
|
10
|
+
setType(type: string): void;
|
|
11
|
+
getStringExtra(name: string): string | null;
|
|
12
|
+
getIntExtra(name: string, defaultValue?: number): number;
|
|
13
|
+
getBooleanExtra(name: string, defaultValue?: boolean): boolean;
|
|
14
|
+
putExtra(name: string, value: string | number | boolean): void;
|
|
15
|
+
}
|
|
16
|
+
export interface WXApp {
|
|
17
|
+
getPackageName(): string;
|
|
18
|
+
getVersionName(): string;
|
|
19
|
+
getVersionCode(): number;
|
|
20
|
+
}
|
|
21
|
+
export interface ApplicationInterface {
|
|
22
|
+
exit(): void;
|
|
23
|
+
setRefreshing(state: boolean): void;
|
|
24
|
+
getCurrentRootManager(): WXApp;
|
|
25
|
+
getCurrentApplication(): WXApp;
|
|
26
|
+
getApplication(packageName: string): WXApp;
|
|
27
|
+
startActivity(i: IntentData | null): void;
|
|
28
|
+
openFile(i: IntentData | null): void;
|
|
29
|
+
}
|
|
3
30
|
/**
|
|
31
|
+
* @internal
|
|
32
|
+
*
|
|
4
33
|
* This is a private interface which is not accessible in the window object.
|
|
5
34
|
* It is used to define the structure of a file input stream.
|
|
6
35
|
*/
|
|
@@ -15,21 +44,281 @@ export interface FileInputInterfaceStream {
|
|
|
15
44
|
close(): void;
|
|
16
45
|
skip(n: number): number;
|
|
17
46
|
}
|
|
18
|
-
export interface
|
|
19
|
-
|
|
47
|
+
export interface FileInputInterface {
|
|
48
|
+
/**
|
|
49
|
+
* Opens a file for reading.
|
|
50
|
+
* @param path The path to the file to be opened.
|
|
51
|
+
* @returns A FileInputInterfaceStream object if the file is opened successfully, null otherwise.
|
|
52
|
+
*/
|
|
53
|
+
open(path: string): FileInputInterfaceStream | null;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Interface representing file operations and metadata retrieval.
|
|
57
|
+
*/
|
|
58
|
+
export interface FileInterface {
|
|
59
|
+
/**
|
|
60
|
+
* Reads the content of a file as a string.
|
|
61
|
+
* @param path - The path to the file.
|
|
62
|
+
* @returns The file content as a string, or `null` if the file cannot be read.
|
|
63
|
+
*/
|
|
64
|
+
read(path: string): string | null;
|
|
65
|
+
/**
|
|
66
|
+
* Writes a string to a file.
|
|
67
|
+
* @param path - The path to the file.
|
|
68
|
+
* @param data - The string data to write.
|
|
69
|
+
*/
|
|
70
|
+
write(path: string, data: string): void;
|
|
71
|
+
/**
|
|
72
|
+
* Writes binary data to a file.
|
|
73
|
+
* @param path - The path to the file.
|
|
74
|
+
* @param data - An array of bytes to write.
|
|
75
|
+
*/
|
|
76
|
+
writeBytes(path: string, data: number[]): void;
|
|
77
|
+
/**
|
|
78
|
+
* Reads the content of a file as a Base64-encoded string.
|
|
79
|
+
* @param path - The path to the file.
|
|
80
|
+
* @returns The Base64-encoded content, or `null` if the file cannot be read.
|
|
81
|
+
*/
|
|
82
|
+
readAsBase64(path: string): string | null;
|
|
83
|
+
/**
|
|
84
|
+
* Lists the contents of a directory.
|
|
85
|
+
* @param path - The path to the directory.
|
|
86
|
+
* @param delimiter - An optional delimiter for separating entries.
|
|
87
|
+
* @returns A string containing the directory contents, or `null` if the directory cannot be read.
|
|
88
|
+
*/
|
|
89
|
+
list(path: string, delimiter?: string): string | null;
|
|
90
|
+
/**
|
|
91
|
+
* Retrieves the size of a file or directory.
|
|
92
|
+
* @param path - The path to the file or directory.
|
|
93
|
+
* @param recursive - Whether to include the size of subdirectories (if applicable).
|
|
94
|
+
* @returns The size in bytes.
|
|
95
|
+
*/
|
|
96
|
+
size(path: string, recursive?: boolean): number;
|
|
97
|
+
/**
|
|
98
|
+
* Retrieves metadata about a file or directory.
|
|
99
|
+
* @param path - The path to the file or directory.
|
|
100
|
+
* @param total - Whether to include additional metadata (if applicable).
|
|
101
|
+
* @returns A numeric representation of the metadata.
|
|
102
|
+
*/
|
|
103
|
+
stat(path: string, total?: boolean): number;
|
|
104
|
+
/**
|
|
105
|
+
* Deletes a file or directory.
|
|
106
|
+
* @param path - The path to the file or directory.
|
|
107
|
+
* @returns `true` if the deletion was successful, otherwise `false`.
|
|
108
|
+
*/
|
|
109
|
+
delete(path: string): boolean;
|
|
110
|
+
/**
|
|
111
|
+
* Checks if a file or directory exists.
|
|
112
|
+
* @param path - The path to check.
|
|
113
|
+
* @returns `true` if the file or directory exists, otherwise `false`.
|
|
114
|
+
*/
|
|
115
|
+
exists(path: string): boolean;
|
|
116
|
+
/**
|
|
117
|
+
* Checks if a path is a directory.
|
|
118
|
+
* @param path - The path to check.
|
|
119
|
+
* @returns `true` if the path is a directory, otherwise `false`.
|
|
120
|
+
*/
|
|
121
|
+
isDirectory(path: string): boolean;
|
|
122
|
+
/**
|
|
123
|
+
* Checks if a path is a file.
|
|
124
|
+
* @param path - The path to check.
|
|
125
|
+
* @returns `true` if the path is a file, otherwise `false`.
|
|
126
|
+
*/
|
|
127
|
+
isFile(path: string): boolean;
|
|
128
|
+
/**
|
|
129
|
+
* Checks if a path is a symbolic link.
|
|
130
|
+
* @param path - The path to check.
|
|
131
|
+
* @returns `true` if the path is a symbolic link, otherwise `false`.
|
|
132
|
+
*/
|
|
133
|
+
isSymLink(path: string): boolean;
|
|
134
|
+
/**
|
|
135
|
+
* Creates a directory.
|
|
136
|
+
* @param path - The path to the directory.
|
|
137
|
+
* @returns `true` if the directory was created successfully, otherwise `false`.
|
|
138
|
+
*/
|
|
139
|
+
mkdir(path: string): boolean;
|
|
140
|
+
/**
|
|
141
|
+
* Creates a directory and any necessary parent directories.
|
|
142
|
+
* @param path - The path to the directory.
|
|
143
|
+
* @returns `true` if the directories were created successfully, otherwise `false`.
|
|
144
|
+
*/
|
|
145
|
+
mkdirs(path: string): boolean;
|
|
146
|
+
/**
|
|
147
|
+
* Creates a new file.
|
|
148
|
+
* @param path - The path to the file.
|
|
149
|
+
* @returns `true` if the file was created successfully, otherwise `false`.
|
|
150
|
+
*/
|
|
151
|
+
createNewFile(path: string): boolean;
|
|
152
|
+
/**
|
|
153
|
+
* Renames a file or directory.
|
|
154
|
+
* @param target - The current path of the file or directory.
|
|
155
|
+
* @param dest - The new path for the file or directory.
|
|
156
|
+
* @returns `true` if the rename was successful, otherwise `false`.
|
|
157
|
+
*/
|
|
158
|
+
renameTo(target: string, dest: string): boolean;
|
|
159
|
+
/**
|
|
160
|
+
* Copies a file or directory to a new location.
|
|
161
|
+
* @param path - The source path.
|
|
162
|
+
* @param target - The destination path.
|
|
163
|
+
* @param overwrite - Whether to overwrite the destination if it already exists.
|
|
164
|
+
* @returns `true` if the copy was successful, otherwise `false`.
|
|
165
|
+
*/
|
|
166
|
+
copyTo(path: string, target: string, overwrite: boolean): boolean;
|
|
167
|
+
/**
|
|
168
|
+
* Checks if a file is executable.
|
|
169
|
+
* @param path - The path to the file.
|
|
170
|
+
* @returns `true` if the file is executable, otherwise `false`.
|
|
171
|
+
*/
|
|
172
|
+
canExecute(path: string): boolean;
|
|
173
|
+
/**
|
|
174
|
+
* Checks if a file is writable.
|
|
175
|
+
* @param path - The path to the file.
|
|
176
|
+
* @returns `true` if the file is writable, otherwise `false`.
|
|
177
|
+
*/
|
|
178
|
+
canWrite(path: string): boolean;
|
|
179
|
+
/**
|
|
180
|
+
* Checks if a file is readable.
|
|
181
|
+
* @param path - The path to the file.
|
|
182
|
+
* @returns `true` if the file is readable, otherwise `false`.
|
|
183
|
+
*/
|
|
184
|
+
canRead(path: string): boolean;
|
|
185
|
+
/**
|
|
186
|
+
* Checks if a file is hidden.
|
|
187
|
+
* @param path - The path to the file.
|
|
188
|
+
* @returns `true` if the file is hidden, otherwise `false`.
|
|
189
|
+
*/
|
|
190
|
+
isHidden(path: string): boolean;
|
|
20
191
|
}
|
|
21
|
-
export declare function wrapToReadableStream(inputStream: FileInputInterfaceStream, init?: ReadableStreamInit): Promise<ReadableStream<Uint8Array>>;
|
|
22
|
-
export declare function wrapInputStream(inputStream: FileInputInterfaceStream, init?: ReadableStreamInit): Promise<Response>;
|
|
23
192
|
/**
|
|
193
|
+
* @internal
|
|
194
|
+
*
|
|
195
|
+
* Represents a stream interface for file output operations.
|
|
196
|
+
* Provides methods to write data, flush buffered data, and close the stream.
|
|
197
|
+
*
|
|
24
198
|
* This is a private interface which is not accessible in the window object.
|
|
25
|
-
* It is used to define the structure of a file input stream.
|
|
26
199
|
*/
|
|
27
200
|
export interface FileOutputInterfaceStream {
|
|
201
|
+
/**
|
|
202
|
+
* Writes a single byte to the output stream.
|
|
203
|
+
* @param b - The byte value to write.
|
|
204
|
+
*/
|
|
28
205
|
write(b: number): void;
|
|
206
|
+
/**
|
|
207
|
+
* Flushes any buffered data to the underlying file or output destination.
|
|
208
|
+
*/
|
|
29
209
|
flush(): void;
|
|
210
|
+
/**
|
|
211
|
+
* Closes the output stream and releases any associated resources.
|
|
212
|
+
*/
|
|
30
213
|
close(): void;
|
|
31
214
|
}
|
|
32
|
-
|
|
215
|
+
/**
|
|
216
|
+
* Interface for file output operations, providing methods to open files for writing.
|
|
217
|
+
* Implementations should return a {@link FileOutputInterfaceStream} for file manipulation.
|
|
218
|
+
*/
|
|
219
|
+
export interface FileOutputInterface {
|
|
220
|
+
/**
|
|
221
|
+
* Opens a file at the specified path for output.
|
|
222
|
+
* If `append` is true, data will be appended to the file; otherwise, the file will be overwritten.
|
|
223
|
+
*
|
|
224
|
+
* @param path - The path to the file to open.
|
|
225
|
+
* @param append - Whether to append to the file (`true`) or overwrite it (`false`).
|
|
226
|
+
* @returns A {@link FileOutputInterfaceStream} for writing to the file.
|
|
227
|
+
*/
|
|
228
|
+
open(path: string, append: boolean): FileOutputInterfaceStream;
|
|
229
|
+
/**
|
|
230
|
+
* Opens a file at the specified path for output.
|
|
231
|
+
* The default behavior for appending or overwriting is implementation-dependent.
|
|
232
|
+
*
|
|
233
|
+
* @param path - The path to the file to open.
|
|
234
|
+
* @returns A {@link FileOutputInterfaceStream} for writing to the file.
|
|
235
|
+
*/
|
|
236
|
+
open(path: string): FileOutputInterfaceStream;
|
|
237
|
+
}
|
|
238
|
+
export interface ModuleInterface {
|
|
239
|
+
getWindowTopInset(): number;
|
|
240
|
+
getWindowBottomInset(): number;
|
|
241
|
+
getWindowLeftInset(): number;
|
|
242
|
+
getWindowRightInset(): number;
|
|
243
|
+
isLightNavigationBars(): boolean;
|
|
244
|
+
isDarkMode(): boolean;
|
|
245
|
+
setLightNavigationBars(isLight: boolean): void;
|
|
246
|
+
isLightStatusBars(): boolean;
|
|
247
|
+
setLightStatusBars(isLight: boolean): void;
|
|
248
|
+
getSdk(): number;
|
|
249
|
+
shareText(text: string): void;
|
|
250
|
+
shareText(text: string, type: string): void;
|
|
251
|
+
getRecomposeCount(): number;
|
|
252
|
+
/**
|
|
253
|
+
* Reloads the entire WebUI
|
|
254
|
+
*/
|
|
255
|
+
recompose(): void;
|
|
256
|
+
createShortcut(): void;
|
|
257
|
+
createShortcut(title: string | null, icon: string | null): void;
|
|
258
|
+
hasShortcut(): boolean;
|
|
259
|
+
}
|
|
260
|
+
export interface WXApplicationInfo {
|
|
261
|
+
getPackageName(): string;
|
|
262
|
+
getName(): string | null;
|
|
263
|
+
getLabel(): string | null;
|
|
264
|
+
getVersionName(): string | null;
|
|
265
|
+
getVersionCode(): number;
|
|
266
|
+
getNonLocalizedLabel(): string | null;
|
|
267
|
+
getAppComponentFactory(): string | null;
|
|
268
|
+
getBackupAgentName(): string | null;
|
|
269
|
+
getCategory(): number;
|
|
270
|
+
getClassName(): string | null;
|
|
271
|
+
getCompatibleWidthLimitDp(): number;
|
|
272
|
+
getCompileSdkVersion(): number;
|
|
273
|
+
getCompileSdkVersionCodename(): string | null;
|
|
274
|
+
getDataDir(): string | null;
|
|
275
|
+
getDescription(): string | null;
|
|
276
|
+
getDeviceProtectedDataDir(): string | null;
|
|
277
|
+
getEnabled(): Boolean;
|
|
278
|
+
getFlags(): number;
|
|
279
|
+
getLargestWidthLimitDp(): number;
|
|
280
|
+
getManageSpaceActivityName(): string | null;
|
|
281
|
+
getMinSdkVersion(): number;
|
|
282
|
+
getNativeLibraryDir(): string | null;
|
|
283
|
+
getPermission(): string | null;
|
|
284
|
+
getProcessName(): string | null;
|
|
285
|
+
getPublicSourceDir(): string | null;
|
|
286
|
+
getRequiresSmallestWidthDp(): number;
|
|
287
|
+
getSharedLibraryFiles(): string | null;
|
|
288
|
+
getSourceDir(): string | null;
|
|
289
|
+
getSplitNames(): string | null;
|
|
290
|
+
getSplitPublicSourceDirs(): string | null;
|
|
291
|
+
getSplitSourceDirs(): string | null;
|
|
292
|
+
getStorageUuid(): string | null;
|
|
293
|
+
getTargetSdkVersion(): number;
|
|
294
|
+
getTaskAffinity(): string | null;
|
|
295
|
+
getTheme(): number;
|
|
296
|
+
getUiOptions(): number;
|
|
297
|
+
getUid(): number;
|
|
298
|
+
}
|
|
299
|
+
export interface PackageManagerInterface {
|
|
300
|
+
getPackageUid(packageName: string, flags: number, userId: number): number;
|
|
301
|
+
/**
|
|
302
|
+
* Method run heavy operations
|
|
303
|
+
*/
|
|
304
|
+
getApplicationIcon(packageName: string, flags: number, userId: number): FileInputInterfaceStream | null;
|
|
305
|
+
getInstalledPackages(flags: number, userId: number): string;
|
|
306
|
+
getApplicationInfo(packageName: string, flags: number, userId: number): WXApplicationInfo;
|
|
307
|
+
}
|
|
308
|
+
export interface WXUserInfo {
|
|
309
|
+
getName(): string;
|
|
310
|
+
getId(): number;
|
|
311
|
+
isPrimary(): boolean;
|
|
312
|
+
isAdmin(): boolean;
|
|
313
|
+
isEnabled(): boolean;
|
|
314
|
+
}
|
|
315
|
+
export interface UserManagerInterface {
|
|
316
|
+
/**
|
|
317
|
+
* This is a JSON string and needs to be parsed with `JSON.parse(...)`
|
|
318
|
+
*/
|
|
319
|
+
getUsers(): string;
|
|
320
|
+
getUserInfo(userId: number): WXUserInfo;
|
|
321
|
+
}
|
|
33
322
|
export declare class WXEvent<T = any> extends Event {
|
|
34
323
|
private _wxOrigin?;
|
|
35
324
|
private _wxData?;
|
|
@@ -77,25 +366,12 @@ export interface WXEventMap extends Record<WXEventType, Event | null> {
|
|
|
77
366
|
keyboard: WXKeyboardEvent;
|
|
78
367
|
insets: WXInsetsEvent;
|
|
79
368
|
}
|
|
80
|
-
export declare class
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
private _dispatch;
|
|
87
|
-
on<K extends keyof WXEventMap>(element: Window | Element, type: K, handler: WXEventListenerOrWXEventListenerObject<WXEventMap[K]>): () => void;
|
|
88
|
-
off(element: Window | Element, type: WXEventType, handler: WXEventListenerOrWXEventListenerObject): void;
|
|
89
|
-
}
|
|
90
|
-
export interface IntentData {
|
|
91
|
-
setPackage(packageName: string): void;
|
|
92
|
-
setData(data: string): void;
|
|
93
|
-
addCategory(category: string): void;
|
|
94
|
-
setType(type: string): void;
|
|
95
|
-
getStringExtra(name: string): string | null;
|
|
96
|
-
getIntExtra(name: string, defaultValue?: number): number;
|
|
97
|
-
getBooleanExtra(name: string, defaultValue?: boolean): boolean;
|
|
98
|
-
putExtra(name: string, value: string | number | boolean): void;
|
|
369
|
+
export declare class WXClass {
|
|
370
|
+
constructor();
|
|
371
|
+
protected readonly fileToken: string | undefined;
|
|
372
|
+
protected readonly fileInputToken: string | undefined;
|
|
373
|
+
protected readonly moduleToken: string | undefined;
|
|
374
|
+
protected findInterface(): string | undefined;
|
|
99
375
|
}
|
|
100
376
|
export declare class Intent {
|
|
101
377
|
private _action;
|
|
@@ -338,11 +614,39 @@ export declare class Intent {
|
|
|
338
614
|
static readonly EXTRA_PROVISIONING_WIFI_PASSWORD = "android.intent.extra.PROVISIONING_WIFI_PASSWORD";
|
|
339
615
|
static readonly EXTRA_PROVISIONING_WIFI_SECURITY_TYPE = "android.intent.extra.PROVISIONING_WIFI_SECURITY_TYPE";
|
|
340
616
|
static readonly EXTRA_PROVISIONING_WIFI_SSID = "android.intent.extra.PROVISIONING_WIFI_SSID";
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
617
|
+
static readonly CATEGORY_DEFAULT = "android.intent.category.DEFAULT";
|
|
618
|
+
static readonly CATEGORY_BROWSABLE = "android.intent.category.BROWSABLE";
|
|
619
|
+
static readonly CATEGORY_TAB = "android.intent.category.TAB";
|
|
620
|
+
static readonly CATEGORY_ALTERNATIVE = "android.intent.category.ALTERNATIVE";
|
|
621
|
+
static readonly CATEGORY_SELECTED_ALTERNATIVE = "android.intent.category.SELECTED_ALTERNATIVE";
|
|
622
|
+
static readonly CATEGORY_HOME = "android.intent.category.HOME";
|
|
623
|
+
static readonly CATEGORY_LAUNCHER = "android.intent.category.LAUNCHER";
|
|
624
|
+
static readonly CATEGORY_INFO = "android.intent.category.INFO";
|
|
625
|
+
static readonly CATEGORY_MONITOR = "android.intent.category.MONITOR";
|
|
626
|
+
static readonly CATEGORY_APP_BROWSER = "android.intent.category.APP_BROWSER";
|
|
627
|
+
static readonly CATEGORY_APP_CALCULATOR = "android.intent.category.APP_CALCULATOR";
|
|
628
|
+
static readonly CATEGORY_APP_CALENDAR = "android.intent.category.APP_CALENDAR";
|
|
629
|
+
static readonly CATEGORY_APP_CONTACTS = "android.intent.category.APP_CONTACTS";
|
|
630
|
+
static readonly CATEGORY_APP_EMAIL = "android.intent.category.APP_EMAIL";
|
|
631
|
+
static readonly CATEGORY_APP_GALLERY = "android.intent.category.APP_GALLERY";
|
|
632
|
+
static readonly CATEGORY_APP_MAPS = "android.intent.category.APP_MAPS";
|
|
633
|
+
static readonly CATEGORY_APP_MESSAGING = "android.intent.category.APP_MESSAGING";
|
|
634
|
+
static readonly CATEGORY_APP_MUSIC = "android.intent.category.APP_MUSIC";
|
|
635
|
+
static readonly CATEGORY_APP_NFC = "android.intent.category.APP_NFC";
|
|
636
|
+
static readonly CATEGORY_APP_FILES = "android.intent.category.APP_FILES";
|
|
637
|
+
static readonly CATEGORY_OPENABLE = "android.intent.category.OPENABLE";
|
|
638
|
+
static readonly CATEGORY_PREFERENCE = "android.intent.category.PREFERENCE";
|
|
639
|
+
static readonly CATEGORY_TEST = "android.intent.category.TEST";
|
|
640
|
+
static readonly CATEGORY_LIVE_WALLPAPER_SETTINGS = "android.intent.category.LIVE_WALLPAPER_SETTINGS";
|
|
641
|
+
static readonly CATEGORY_INPUT_METHOD_SERVICE = "android.intent.category.INPUT_METHOD_SERVICE";
|
|
642
|
+
static readonly CATEGORY_DEVICE_ADMIN = "android.intent.category.DEVICE_ADMIN";
|
|
643
|
+
static readonly CATEGORY_ACCESSIBILITY_SERVICE = "android.intent.category.ACCESSIBILITY_SERVICE";
|
|
644
|
+
static readonly CATEGORY_VPN_SERVICE = "android.intent.category.VPN_SERVICE";
|
|
645
|
+
static readonly CATEGORY_DREAM = "android.intent.category.DREAM";
|
|
646
|
+
static readonly CATEGORY_LEANBACK_LAUNCHER = "android.intent.category.LEANBACK_LAUNCHER";
|
|
647
|
+
static readonly CATEGORY_LEANBACK_SETTINGS = "android.intent.category.LEANBACK_SETTINGS";
|
|
648
|
+
static readonly CATEGORY_WEARABLE_LAUNCHER = "android.intent.category.WEARABLE_LAUNCHER";
|
|
649
|
+
static readonly CATEGORY_CAR_MODE_LAUNCHER = "android.intent.category.CAR_MODE_LAUNCHER";
|
|
346
650
|
}
|
|
347
651
|
/**
|
|
348
652
|
* Represents the WebUI interface for interacting with native application functionalities.
|
|
@@ -395,5 +699,22 @@ export declare class WebUI {
|
|
|
395
699
|
*/
|
|
396
700
|
startActivity(intent: Intent): void;
|
|
397
701
|
}
|
|
702
|
+
export declare class WXEventHandler {
|
|
703
|
+
private _initialized;
|
|
704
|
+
private _handlers;
|
|
705
|
+
private _eventTypes;
|
|
706
|
+
get eventTypes(): Record<WXEventNativeType, WXEventType>;
|
|
707
|
+
constructor(options?: WXEvenHandlerOptions);
|
|
708
|
+
private _dispatch;
|
|
709
|
+
on<K extends keyof WXEventMap>(element: Window | Element, type: K, handler: WXEventListenerOrWXEventListenerObject<WXEventMap[K]>): () => void;
|
|
710
|
+
off(element: Window | Element, type: WXEventType, handler: WXEventListenerOrWXEventListenerObject): void;
|
|
711
|
+
}
|
|
712
|
+
export interface ReadableStreamInit extends RequestInit {
|
|
713
|
+
chunkSize?: number;
|
|
714
|
+
}
|
|
715
|
+
export declare const readableStreamInit: ReadableStreamInit;
|
|
716
|
+
export declare function wrapToReadableStream(inputStream: FileInputInterfaceStream, init?: ReadableStreamInit): Promise<ReadableStream<Uint8Array>>;
|
|
717
|
+
export declare function wrapInputStream(inputStream: FileInputInterfaceStream, init?: ReadableStreamInit): Promise<Response>;
|
|
718
|
+
export declare function wrapOutputStream(readableStream: ReadableStream<Uint8Array>, outputStreamInstance: FileOutputInterfaceStream): Promise<void>;
|
|
398
719
|
|
|
399
720
|
export {};
|
package/dist/index.esm.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var l={chunkSize:1048576,headers:{"Content-Type":"application/octet-stream"}};async function d(e,n={}){let t={...l,...n};return new Promise((r,i)=>{let s;try{if(s=e,!s)throw new Error("Failed to open file input stream")}catch(o){i(o);return}let E=()=>{try{s?.close()}catch(o){console.error("Error during abort cleanup:",o)}i(new DOMException("The operation was aborted.","AbortError"))};if(t.signal){if(t.signal.aborted){E();return}t.signal.addEventListener("abort",E)}let X=new ReadableStream({async pull(o){try{let a=w(s,t.chunkSize);if(!a){o.close(),f();return}o.enqueue(a)}catch(a){f(),o.error(a),i(new Error(`Error reading file chunk: ${a}`))}},cancel(o){console.warn("Stream canceled:",o),f()}});function f(){try{if(t.signal)t.signal.removeEventListener("abort",E);s?.close()}catch(o){console.error(`Error during cleanup: ${o}`)}}r(X)})}function w(e,n){try{let t=n?e.readChunk(n):e.read();if(typeof t==="number")return new Uint8Array([t]);else if(typeof t==="string"){let r=JSON.parse(t);return r&&Array.isArray(r)&&r.length>0?new Uint8Array(r):null}return null}catch(t){throw new Error("Error reading chunk data: "+t)}}async function y(e,n={}){let t={...l,...n};try{let r=await d(e,t);return new Response(r,t)}catch(r){throw new Error(`wrapInputStream failed: ${r}`)}}async function u(e,n){if(!e||typeof e.getReader!=="function")throw new Error("Invalid ReadableStream provided.");if(!n||typeof n.write!=="function"||typeof n.close!=="function")throw new Error("Invalid outputStreamInstance provided. It must be an already opened stream with 'write' and 'close' methods.");let t=new WritableStream({async start(r){console.log("WritableStream started, output stream instance ready.")},async write(r,i){if(r instanceof Uint8Array)for(let s=0;s<r.length;s++)n.write(r[s]);else console.warn("Received non-Uint8Array chunk in WritableStream:",r),i.error(new TypeError("Expected Uint8Array chunks."))},async close(){console.log("WritableStream closed. Flushing and closing native stream.");try{n.flush(),n.close()}catch(r){throw console.error("Error during WritableStream close cleanup:",r),r}},async abort(r){console.error("WritableStream aborted:",r);try{n.close()}catch(i){console.error("Error during WritableStream abort cleanup:",i)}}});try{await e.pipeTo(t),console.log("Piping completed successfully.")}catch(r){let i=r instanceof Error?r:new Error(String(r));throw console.error("Error during stream piping:",i),new Error(`Failed to pipe stream: ${i.message}`)}}class p extends Event{_wxOrigin;_wxData;get wxOrigin(){return this._wxOrigin}set wxOrigin(e){this._wxOrigin=e}get wx(){return this._wxData}set wx(e){this._wxData=e}constructor(e){super(e,{bubbles:!0,cancelable:!0,composed:!0})}}var b={cordova:!1};class v{_initialized=!1;_handlers=new WeakMap;_eventTypes;get eventTypes(){return this._eventTypes}constructor(e=b){if(this._initialized)return;this._initialized=!0,this._eventTypes={WX_ON_BACK:e.cordova?"backbutton":"back",WX_ON_RESUME:"resume",WX_ON_REFRESH:"refresh",WX_ON_PAUSE:"pause",WX_ON_KEYBOARD:"keyboard",WX_ON_INSETS:"insets"},window.addEventListener("message",(n)=>{try{if(typeof n.data!=="string")return;let t=JSON.parse(n.data);if(!t?.type)return;let r=this._eventTypes[t.type]??t.type;this._dispatch(window,r,t)}catch(t){console.error("[WXEvent] Message error:",t)}})}_dispatch(e,n,t){let r=new p(n);r.wx=t.data,r.wxOrigin="system",e.dispatchEvent(r)}on(e,n,t){if(!this._initialized)new v;let r=(s)=>{if(!(s instanceof p)){console.warn("[WXEvent] Event is not a WXEvent:",s);return}if(s.wxOrigin==="system"){if(typeof t==="function")t(s);else if(t&&typeof t.handleEvent==="function")t.handleEvent(s)}};if(!this._handlers.has(e))this._handlers.set(e,new Map);let i=this._handlers.get(e);if(!i.has(n))i.set(n,new Set);return i.get(n).add({handler:t,wrapper:r}),e.addEventListener(n,r),()=>this.off(e,n,t)}off(e,n,t){let r=this._handlers.get(e);if(!r?.has(n))return;for(let i of r.get(n))if(i.handler===t){e.removeEventListener(n,i.wrapper),r.get(n).delete(i);break}}}class c{_action;_interface=null;constructor(e){if(this._action=e,typeof window==="undefined"||!window.$intent||typeof window.$intent.create!=="function")console.warn("window['$intent'] or window['$intent'].create is not defined. Intent functionality may be limited.");else this._interface=window.$intent.create(this._action)}getParsedIntent(){return this._interface}setData(e){if(this._interface&&typeof this._interface.setData==="function")this._interface.setData(e);else console.error("setData method not available on the intent interface.")}setPackage(e){if(this._interface&&typeof this._interface.setPackage==="function")this._interface.setPackage(e);else console.error("setPackage method not available on the intent interface.")}addCategory(e){if(this._interface&&typeof this._interface.addCategory==="function")this._interface.addCategory(e);else console.error("addCategory method not available on the intent interface.")}setType(e){if(this._interface&&typeof this._interface.setType==="function")this._interface.setType(e);else console.error("setType method not available on the intent interface.")}putExtra(e,n){if(this._interface&&typeof this._interface.putExtra==="function")this._interface.putExtra(e,n);else console.error("putExtra method not available on the intent interface.")}getStringExtra(e){if(this._interface&&typeof this._interface.getStringExtra==="function")return this._interface.getStringExtra(e);else return console.error("getStringExtra method not available on the intent interface."),null}getIntExtra(e){if(this._interface&&typeof this._interface.getIntExtra==="function")return this._interface.getIntExtra(e);else return console.error("getIntExtra method not available on the intent interface."),0}getBooleanExtra(e){if(this._interface&&typeof this._interface.getBooleanExtra==="function")return this._interface.getBooleanExtra(e);else return console.error("getBooleanExtra method not available on the intent interface."),!1}static ACTION_MAIN="android.intent.action.MAIN";static ACTION_VIEW="android.intent.action.VIEW";static ACTION_ATTACH_DATA="android.intent.action.ATTACH_DATA";static ACTION_EDIT="android.intent.action.EDIT";static ACTION_PICK="android.intent.action.PICK";static ACTION_CHOOSER="android.intent.action.CHOOSER";static ACTION_GET_CONTENT="android.intent.action.GET_CONTENT";static ACTION_DIAL="android.intent.action.DIAL";static ACTION_CALL="android.intent.action.CALL";static ACTION_SEND="android.intent.action.SEND";static ACTION_SENDTO="android.intent.action.SENDTO";static ACTION_SEND_MULTIPLE="android.intent.action.SEND_MULTIPLE";static ACTION_SYNC="android.intent.action.SYNC";static ACTION_BATTERY_LOW="android.intent.action.BATTERY_LOW";static ACTION_BATTERY_OKAY="android.intent.action.BATTERY_OKAY";static ACTION_BOOT_COMPLETED="android.intent.action.BOOT_COMPLETED";static ACTION_CAMERA_BUTTON="android.intent.action.CAMERA_BUTTON";static ACTION_CLOSE_SYSTEM_DIALOGS="android.intent.action.CLOSE_SYSTEM_DIALOGS";static ACTION_DEVICE_STORAGE_LOW="android.intent.action.DEVICE_STORAGE_LOW";static ACTION_DEVICE_STORAGE_OK="android.intent.action.DEVICE_STORAGE_OK";static ACTION_EXTERNAL_APPLICATIONS_AVAILABLE="android.intent.action.EXTERNAL_APPLICATIONS_AVAILABLE";static ACTION_EXTERNAL_APPLICATIONS_UNAVAILABLE="android.intent.action.EXTERNAL_APPLICATIONS_UNAVAILABLE";static ACTION_LOCALE_CHANGED="android.intent.action.LOCALE_CHANGED";static ACTION_MEDIA_BAD_REMOVAL="android.intent.action.MEDIA_BAD_REMOVAL";static ACTION_MEDIA_BUTTON="android.intent.action.MEDIA_BUTTON";static ACTION_MEDIA_CHECKING="android.intent.action.MEDIA_CHECKING";static ACTION_MEDIA_EJECT="android.intent.action.MEDIA_EJECT";static ACTION_MEDIA_MOUNTED="android.intent.action.MEDIA_MOUNTED";static ACTION_MEDIA_NOFS="android.intent.action.MEDIA_NOFS";static ACTION_MEDIA_REMOVED="android.intent.action.MEDIA_REMOVED";static ACTION_MEDIA_SCANNER_FINISHED="android.intent.action.MEDIA_SCANNER_FINISHED";static ACTION_MEDIA_SCANNER_SCAN_FILE="android.intent.action.MEDIA_SCANNER_SCAN_FILE";static ACTION_MEDIA_SCANNER_STARTED="android.intent.action.MEDIA_SCANNER_STARTED";static ACTION_MEDIA_SHARED="android.intent.action.MEDIA_SHARED";static ACTION_MEDIA_UNMOUNTABLE="android.intent.action.MEDIA_UNMOUNTABLE";static ACTION_MEDIA_UNMOUNTED="android.intent.action.MEDIA_UNMOUNTED";static ACTION_NEW_OUTGOING_CALL="android.intent.action.NEW_OUTGOING_CALL";static ACTION_PACKAGE_ADDED="android.intent.action.PACKAGE_ADDED";static ACTION_PACKAGE_CHANGED="android.intent.action.PACKAGE_CHANGED";static ACTION_PACKAGE_DATA_CLEARED="android.intent.action.PACKAGE_DATA_CLEARED";static ACTION_PACKAGE_FULLY_REMOVED="android.intent.action.PACKAGE_FULLY_REMOVED";static ACTION_PACKAGE_INSTALL="android.intent.action.PACKAGE_INSTALL";static ACTION_PACKAGE_FIRST_LAUNCH="android.intent.action.PACKAGE_FIRST_LAUNCH";static ACTION_PACKAGE_NEEDS_VERIFICATION="android.intent.action.PACKAGE_NEEDS_VERIFICATION";static ACTION_PACKAGE_REMOVED="android.intent.action.PACKAGE_REMOVED";static ACTION_PACKAGE_REPLACED="android.intent.action.PACKAGE_REPLACED";static ACTION_PACKAGE_RESTARTED="android.intent.action.PACKAGE_RESTARTED";static ACTION_PACKAGE_VERIFIED="android.intent.action.PACKAGE_VERIFIED";static ACTION_POWER_CONNECTED="android.intent.action.POWER_CONNECTED";static ACTION_POWER_DISCONNECTED="android.intent.action.POWER_DISCONNECTED";static ACTION_PROVIDER_CHANGED="android.intent.action.PROVIDER_CHANGED";static ACTION_REBOOT="android.intent.action.REBOOT";static ACTION_SCREEN_OFF="android.intent.action.SCREEN_OFF";static ACTION_SCREEN_ON="android.intent.action.SCREEN_ON";static ACTION_SHUTDOWN="android.intent.action.SHUTDOWN";static ACTION_TIME_CHANGED="android.intent.action.TIME_CHANGED";static ACTION_TIME_TICK="android.intent.action.TIME_TICK";static ACTION_TIMEZONE_CHANGED="android.intent.action.TIMEZONE_CHANGED";static ACTION_UID_REMOVED="android.intent.action.UID_REMOVED";static ACTION_USER_BACKGROUND="android.intent.action.USER_BACKGROUND";static ACTION_USER_FOREGROUND="android.intent.action.USER_FOREGROUND";static ACTION_USER_INITIALIZE="android.intent.action.USER_INITIALIZE";static ACTION_USER_PRESENT="android.intent.action.USER_PRESENT";static ACTION_USER_UNLOCKED="android.intent.action.USER_UNLOCKED";static ACTION_WALLPAPER_CHANGED="android.intent.action.WALLPAPER_CHANGED";static ACTION_AIRPLANE_MODE_CHANGED="android.intent.action.AIRPLANE_MODE";static ACTION_ANSWER="android.intent.action.ANSWER";static ACTION_DREAMING_STARTED="android.intent.action.DREAMING_STARTED";static ACTION_DREAMING_STOPPED="android.intent.action.DREAMING_STOPPED";static ACTION_INPUT_METHOD_CHANGED="android.intent.action.INPUT_METHOD_CHANGED";static ACTION_HEADSET_PLUG="android.intent.action.HEADSET_PLUG";static ACTION_MANAGE_PACKAGE_STORAGE="android.intent.action.MANAGE_PACKAGE_STORAGE";static ACTION_MY_PACKAGE_REPLACED="android.intent.action.MY_PACKAGE_REPLACED";static ACTION_PREFERRED_APPLICATIONS_CHANGED="android.intent.action.PREFERRED_APPLICATIONS_CHANGED";static ACTION_RADIO_POWER_RESET="android.intent.action.RADIO_POWER_RESET";static ACTION_UMS_CONNECTED="android.intent.action.UMS_CONNECTED";static ACTION_UMS_DISCONNECTED="android.intent.action.UMS_DISCONNECTED";static ACTION_USER_ADDED="android.intent.action.USER_ADDED";static ACTION_USER_REMOVED="android.intent.action.USER_REMOVED";static ACTION_USER_STOPPED="android.intent.action.USER_STOPPED";static ACTION_VPN_SETTINGS="android.intent.action.VPN_SETTINGS";static ACTION_INSTALL_FAILURE="android.intent.action.INSTALL_FAILURE";static ACTION_INSTALL_PACKAGE="android.intent.action.INSTALL_PACKAGE";static ACTION_UNINSTALL_PACKAGE="android.intent.action.UNINSTALL_PACKAGE";static ACTION_APPLICATION_SETTINGS="android.intent.action.APPLICATION_SETTINGS";static ACTION_DATA_ROAMING_SETTINGS="android.intent.action.DATA_ROAMING_SETTINGS";static ACTION_DATE_SETTINGS="android.intent.action.DATE_SETTINGS";static ACTION_DEVICE_INFO_SETTINGS="android.intent.action.DEVICE_INFO_SETTINGS";static ACTION_DISPLAY_SETTINGS="android.intent.action.DISPLAY_SETTINGS";static ACTION_HOME_SETTINGS="android.intent.action.HOME_SETTINGS";static ACTION_LOCATION_SOURCE_SETTINGS="android.intent.action.LOCATION_SOURCE_SETTINGS";static ACTION_NETWORK_SETTINGS="android.intent.action.NETWORK_SETTINGS";static ACTION_NFC_SETTINGS="android.intent.action.NFC_SETTINGS";static ACTION_PRIVACY_SETTINGS="android.intent.action.PRIVACY_SETTINGS";static ACTION_SEARCH_SETTINGS="android.intent.action.SEARCH_SETTINGS";static ACTION_SECURITY_SETTINGS="android.intent.action.SECURITY_SETTINGS";static ACTION_SETTINGS="android.intent.action.SETTINGS";static ACTION_SOUND_SETTINGS="android.intent.action.SOUND_SETTINGS";static ACTION_SYNC_SETTINGS="android.intent.action.SYNC_SETTINGS";static ACTION_USAGE_ACCESS_SETTINGS="android.intent.action.USAGE_ACCESS_SETTINGS";static ACTION_WIFI_IP_SETTINGS="android.intent.action.WIFI_IP_SETTINGS";static ACTION_WIFI_SETTINGS="android.intent.action.WIFI_SETTINGS";static ACTION_WIRELESS_SETTINGS="android.intent.action.WIRELESS_SETTINGS";static ACTION_BLUETOOTH_SETTINGS="android.intent.action.BLUETOOTH_SETTINGS";static ACTION_ACCESSIBILITY_SETTINGS="android.intent.action.ACCESSIBILITY_SETTINGS";static ACTION_ACCOUNT_SETTINGS="android.intent.action.ACCOUNT_SETTINGS";static ACTION_ADD_ACCOUNT="android.intent.action.ADD_ACCOUNT";static ACTION_APPLICATION_DETAILS_SETTINGS="android.intent.action.APPLICATION_DETAILS_SETTINGS";static ACTION_APPLICATION_DEVELOPMENT_SETTINGS="android.intent.action.APPLICATION_DEVELOPMENT_SETTINGS";static ACTION_WEB_SEARCH="android.intent.action.WEB_SEARCH";static ACTION_CREATE_SHORTCUT="android.intent.action.CREATE_SHORTCUT";static EXTRA_STREAM="android.intent.extra.STREAM";static EXTRA_TEXT="android.intent.extra.TEXT";static EXTRA_EMAIL="android.intent.extra.EMAIL";static EXTRA_CC="android.intent.extra.CC";static EXTRA_BCC="android.intent.extra.BCC";static EXTRA_SUBJECT="android.intent.extra.SUBJECT";static EXTRA_REFERRER="android.intent.extra.REFERRER";static EXTRA_REFERRER_NAME="android.intent.extra.REFERRER_NAME";static EXTRA_PHONE_NUMBER="android.intent.extra.PHONE_NUMBER";static EXTRA_LOCAL_ONLY="android.intent.extra.LOCAL_ONLY";static EXTRA_INITIAL_INTENTS="android.intent.extra.INITIAL_INTENTS";static EXTRA_CHOSEN_COMPONENT="android.intent.extra.CHOSEN_COMPONENT";static EXTRA_SHORTCUT_INTENT="android.intent.extra.SHORTCUT_INTENT";static EXTRA_SHORTCUT_NAME="android.intent.extra.SHORTCUT_NAME";static EXTRA_SHORTCUT_ICON="android.intent.extra.SHORTCUT_ICON";static EXTRA_SHORTCUT_ICON_RESOURCE="android.intent.extra.SHORTCUT_ICON_RESOURCE";static EXTRA_TITLE="android.intent.extra.TITLE";static EXTRA_HTML_TEXT="android.intent.extra.HTML_TEXT";static EXTRA_ASSIST_CONTEXT="android.intent.extra.ASSIST_CONTEXT";static EXTRA_ASSIST_INPUT_DEVICE_ID="android.intent.extra.ASSIST_INPUT_DEVICE_ID";static EXTRA_ASSIST_INPUT_METHOD_MANAGER_SERVICE="android.intent.extra.ASSIST_INPUT_METHOD_MANAGER_SERVICE";static EXTRA_ASSIST_SCREENSHOT="android.intent.extra.ASSIST_SCREENSHOT";static EXTRA_ASSIST_URI="android.intent.extra.ASSIST_URI";static EXTRA_ORIGINATING_URI="android.intent.extra.ORIGINATING_URI";static EXTRA_WEB_SEARCH_INTENT="android.intent.extra.WEB_SEARCH_INTENT";static EXTRA_MEDIA_ALBUM="android.intent.extra.MEDIA_ALBUM";static EXTRA_MEDIA_ARTIST="android.intent.extra.MEDIA_ARTIST";static EXTRA_MEDIA_FOCUS="android.intent.extra.MEDIA_FOCUS";static EXTRA_MEDIA_GENRE="android.intent.extra.MEDIA_GENRE";static EXTRA_MEDIA_TITLE="android.intent.extra.MEDIA_TITLE";static EXTRA_ALARM_COUNT="android.intent.extra.ALARM_COUNT";static EXTRA_CHANGED_COMPONENT_NAME_LIST="android.intent.extra.CHANGED_COMPONENT_NAME_LIST";static EXTRA_CHANGED_PACKAGE_LIST="android.intent.extra.CHANGED_PACKAGE_LIST";static EXTRA_CHANGED_UID_LIST="android.intent.extra.CHANGED_UID_LIST";static EXTRA_DATA_REMOVED="android.intent.extra.DATA_REMOVED";static EXTRA_DONT_KILL_APP="android.intent.extra.DONT_KILL_APP";static EXTRA_INSTALL_RESULT="android.intent.extra.INSTALL_RESULT";static EXTRA_KEY_EVENT="android.intent.extra.KEY_EVENT";static EXTRA_MIME_TYPES="android.intent.extra.MIME_TYPES";static EXTRA_MOUNT_FAILED="android.intent.extra.MOUNT_FAILED";static EXTRA_NOTIFICATION_ID="android.intent.extra.NOTIFICATION_ID";static EXTRA_NOTIFICATION_TAG="android.intent.extra.NOTIFICATION_TAG";static EXTRA_PACKAGES="android.intent.extra.PACKAGES";static EXTRA_REPLACING="android.intent.extra.REPLACING";static EXTRA_SPLIT_NAME="android.intent.extra.SPLIT_NAME";static EXTRA_SUSPENDED_PACKAGE_EXTRAS="android.intent.extra.SUSPENDED_PACKAGE_EXTRAS";static EXTRA_UID="android.intent.extra.UID";static EXTRA_USER="android.intent.extra.USER";static EXTRA_CHANNEL_ID="android.intent.extra.CHANNEL_ID";static EXTRA_REMOTE_INTENT_TOKEN="android.intent.extra.REMOTE_INTENT_TOKEN";static EXTRA_PERMISSION_GROUP_NAME="android.intent.extra.PERMISSION_GROUP_NAME";static EXTRA_PERMISSION_NAME="android.intent.extra.PERMISSION_NAME";static EXTRA_RESTRICTIONS_BUNDLE="android.intent.extra.RESTRICTIONS_BUNDLE";static EXTRA_RESTRICTIONS_INTENT="android.intent.extra.RESTRICTIONS_INTENT";static EXTRA_TIMEZONE="android.intent.extra.TIMEZONE";static EXTRA_DONT_REPLACE_EXISTING_APPLICATION_INFO="android.intent.extra.DONT_REPLACE_EXISTING_APPLICATION_INFO";static EXTRA_SPLASH_SCREEN_THEME="android.intent.extra.SPLASH_SCREEN_THEME";static EXTRA_SPLASH_SCREEN_ICON_ID="android.intent.extra.SPLASH_SCREEN_ICON_ID";static EXTRA_STREAM_MULTIPLE="android.intent.extra.STREAM_MULTIPLE";static EXTRA_EXCLUDE_COMPONENTS="android.intent.extra.EXCLUDE_COMPONENTS";static EXTRA_ALLOW_MULTIPLE="android.intent.extra.ALLOW_MULTIPLE";static EXTRA_PROVISIONING_ACCOUNT_TO_MIGRATE="android.intent.extra.PROVISIONING_ACCOUNT_TO_MIGRATE";static EXTRA_PROVISIONING_DEVICE_ADMIN_COMPONENT_NAME="android.intent.extra.PROVISIONING_DEVICE_ADMIN_COMPONENT_NAME";static EXTRA_PROVISIONING_LEAVE_ALL_SYSTEM_APPS_ENABLED="android.intent.extra.PROVISIONING_LEAVE_ALL_SYSTEM_APPS_ENABLED";static EXTRA_PROVISIONING_LOCALE="android.intent.extra.PROVISIONING_LOCALE";static EXTRA_PROVISIONING_TIME_ZONE="android.intent.extra.PROVISIONING_TIME_ZONE";static EXTRA_PROVISIONING_WIFI_HIDDEN="android.intent.extra.PROVISIONING_WIFI_HIDDEN";static EXTRA_PROVISIONING_WIFI_PASSWORD="android.intent.extra.PROVISIONING_WIFI_PASSWORD";static EXTRA_PROVISIONING_WIFI_SECURITY_TYPE="android.intent.extra.PROVISIONING_WIFI_SECURITY_TYPE";static EXTRA_PROVISIONING_WIFI_SSID="android.intent.extra.PROVISIONING_WIFI_SSID"}class W{_interface=null;constructor(){if(typeof window==="undefined"||!window.webui)console.warn("window['webui'] is not defined. WebUI functionality may be limited.");else this._interface=window.webui}exit(){if(this._interface&&typeof this._interface.exit==="function")this._interface.exit();else console.error("exit method not available on the webui interface.")}setRefreshing(e){if(this._interface&&typeof this._interface.setRefreshing==="function")this._interface.setRefreshing(e);else console.error("setRefreshing method not available on the webui interface.")}get currentRootManager(){if(this._interface&&typeof this._interface.getCurrentRootManager!=="undefined")return this._interface.getCurrentRootManager();else return console.error("currentRootManager getter not available on the webui interface."),null}get currentApplication(){if(this._interface&&typeof this._interface.getCurrentApplication!=="undefined")return this._interface.getCurrentApplication();else return console.error("currentApplication getter not available on the webui interface."),null}getApplication(e){if(this._interface&&typeof this._interface.getApplication==="function")return this._interface.getApplication(e);else return console.error("getApplication method not available on the webui interface."),null}openFile(e){if(this._interface&&typeof this._interface.openFile==="function")this._interface.openFile(e.getParsedIntent());else console.error("openFile method not available on the webui interface.")}startActivity(e){if(this._interface&&typeof this._interface.startActivity==="function")this._interface.startActivity(e.getParsedIntent());else console.error("startActivity method not available on the webui interface.")}}export{d as wrapToReadableStream,u as wrapOutputStream,y as wrapInputStream,W as WebUI,v as WXEventHandler,p as WXEvent,c as Intent};
|
|
1
|
+
class w{constructor(){this.findInterface=this.findInterface.bind(this)}fileToken=Object.keys(window).find((e)=>e.match(/^\$(\w{2})File$/m));fileInputToken=Object.keys(window).find((e)=>e.match(/^\$(\w{2})FileInputStream$/m));moduleToken=this.fileToken?.slice(0,3).toLowerCase();findInterface(){return Object.keys(window).find((e)=>{if(e===this.fileToken||e===this.fileInputToken)return!1;if(e==="$packageManager")return!1;if(e==="$userManager")return!1;if(!this.moduleToken)return!1;return e.toLowerCase().startsWith(this.moduleToken)})}}class v{_action;_interface=null;constructor(e){if(this._action=e,typeof window==="undefined"||!window.$intent||typeof window.$intent.create!=="function")console.warn("window['$intent'] or window['$intent'].create is not defined. Intent functionality may be limited.");else this._interface=window.$intent.create(this._action)}getParsedIntent(){return this._interface}setData(e){if(this._interface&&typeof this._interface.setData==="function")this._interface.setData(e);else console.error("setData method not available on the intent interface.")}setPackage(e){if(this._interface&&typeof this._interface.setPackage==="function")this._interface.setPackage(e);else console.error("setPackage method not available on the intent interface.")}addCategory(e){if(this._interface&&typeof this._interface.addCategory==="function")this._interface.addCategory(e);else console.error("addCategory method not available on the intent interface.")}setType(e){if(this._interface&&typeof this._interface.setType==="function")this._interface.setType(e);else console.error("setType method not available on the intent interface.")}putExtra(e,n){if(this._interface&&typeof this._interface.putExtra==="function")this._interface.putExtra(e,n);else console.error("putExtra method not available on the intent interface.")}getStringExtra(e){if(this._interface&&typeof this._interface.getStringExtra==="function")return this._interface.getStringExtra(e);else return console.error("getStringExtra method not available on the intent interface."),null}getIntExtra(e){if(this._interface&&typeof this._interface.getIntExtra==="function")return this._interface.getIntExtra(e);else return console.error("getIntExtra method not available on the intent interface."),0}getBooleanExtra(e){if(this._interface&&typeof this._interface.getBooleanExtra==="function")return this._interface.getBooleanExtra(e);else return console.error("getBooleanExtra method not available on the intent interface."),!1}static ACTION_MAIN="android.intent.action.MAIN";static ACTION_VIEW="android.intent.action.VIEW";static ACTION_ATTACH_DATA="android.intent.action.ATTACH_DATA";static ACTION_EDIT="android.intent.action.EDIT";static ACTION_PICK="android.intent.action.PICK";static ACTION_CHOOSER="android.intent.action.CHOOSER";static ACTION_GET_CONTENT="android.intent.action.GET_CONTENT";static ACTION_DIAL="android.intent.action.DIAL";static ACTION_CALL="android.intent.action.CALL";static ACTION_SEND="android.intent.action.SEND";static ACTION_SENDTO="android.intent.action.SENDTO";static ACTION_SEND_MULTIPLE="android.intent.action.SEND_MULTIPLE";static ACTION_SYNC="android.intent.action.SYNC";static ACTION_BATTERY_LOW="android.intent.action.BATTERY_LOW";static ACTION_BATTERY_OKAY="android.intent.action.BATTERY_OKAY";static ACTION_BOOT_COMPLETED="android.intent.action.BOOT_COMPLETED";static ACTION_CAMERA_BUTTON="android.intent.action.CAMERA_BUTTON";static ACTION_CLOSE_SYSTEM_DIALOGS="android.intent.action.CLOSE_SYSTEM_DIALOGS";static ACTION_DEVICE_STORAGE_LOW="android.intent.action.DEVICE_STORAGE_LOW";static ACTION_DEVICE_STORAGE_OK="android.intent.action.DEVICE_STORAGE_OK";static ACTION_EXTERNAL_APPLICATIONS_AVAILABLE="android.intent.action.EXTERNAL_APPLICATIONS_AVAILABLE";static ACTION_EXTERNAL_APPLICATIONS_UNAVAILABLE="android.intent.action.EXTERNAL_APPLICATIONS_UNAVAILABLE";static ACTION_LOCALE_CHANGED="android.intent.action.LOCALE_CHANGED";static ACTION_MEDIA_BAD_REMOVAL="android.intent.action.MEDIA_BAD_REMOVAL";static ACTION_MEDIA_BUTTON="android.intent.action.MEDIA_BUTTON";static ACTION_MEDIA_CHECKING="android.intent.action.MEDIA_CHECKING";static ACTION_MEDIA_EJECT="android.intent.action.MEDIA_EJECT";static ACTION_MEDIA_MOUNTED="android.intent.action.MEDIA_MOUNTED";static ACTION_MEDIA_NOFS="android.intent.action.MEDIA_NOFS";static ACTION_MEDIA_REMOVED="android.intent.action.MEDIA_REMOVED";static ACTION_MEDIA_SCANNER_FINISHED="android.intent.action.MEDIA_SCANNER_FINISHED";static ACTION_MEDIA_SCANNER_SCAN_FILE="android.intent.action.MEDIA_SCANNER_SCAN_FILE";static ACTION_MEDIA_SCANNER_STARTED="android.intent.action.MEDIA_SCANNER_STARTED";static ACTION_MEDIA_SHARED="android.intent.action.MEDIA_SHARED";static ACTION_MEDIA_UNMOUNTABLE="android.intent.action.MEDIA_UNMOUNTABLE";static ACTION_MEDIA_UNMOUNTED="android.intent.action.MEDIA_UNMOUNTED";static ACTION_NEW_OUTGOING_CALL="android.intent.action.NEW_OUTGOING_CALL";static ACTION_PACKAGE_ADDED="android.intent.action.PACKAGE_ADDED";static ACTION_PACKAGE_CHANGED="android.intent.action.PACKAGE_CHANGED";static ACTION_PACKAGE_DATA_CLEARED="android.intent.action.PACKAGE_DATA_CLEARED";static ACTION_PACKAGE_FULLY_REMOVED="android.intent.action.PACKAGE_FULLY_REMOVED";static ACTION_PACKAGE_INSTALL="android.intent.action.PACKAGE_INSTALL";static ACTION_PACKAGE_FIRST_LAUNCH="android.intent.action.PACKAGE_FIRST_LAUNCH";static ACTION_PACKAGE_NEEDS_VERIFICATION="android.intent.action.PACKAGE_NEEDS_VERIFICATION";static ACTION_PACKAGE_REMOVED="android.intent.action.PACKAGE_REMOVED";static ACTION_PACKAGE_REPLACED="android.intent.action.PACKAGE_REPLACED";static ACTION_PACKAGE_RESTARTED="android.intent.action.PACKAGE_RESTARTED";static ACTION_PACKAGE_VERIFIED="android.intent.action.PACKAGE_VERIFIED";static ACTION_POWER_CONNECTED="android.intent.action.POWER_CONNECTED";static ACTION_POWER_DISCONNECTED="android.intent.action.POWER_DISCONNECTED";static ACTION_PROVIDER_CHANGED="android.intent.action.PROVIDER_CHANGED";static ACTION_REBOOT="android.intent.action.REBOOT";static ACTION_SCREEN_OFF="android.intent.action.SCREEN_OFF";static ACTION_SCREEN_ON="android.intent.action.SCREEN_ON";static ACTION_SHUTDOWN="android.intent.action.SHUTDOWN";static ACTION_TIME_CHANGED="android.intent.action.TIME_CHANGED";static ACTION_TIME_TICK="android.intent.action.TIME_TICK";static ACTION_TIMEZONE_CHANGED="android.intent.action.TIMEZONE_CHANGED";static ACTION_UID_REMOVED="android.intent.action.UID_REMOVED";static ACTION_USER_BACKGROUND="android.intent.action.USER_BACKGROUND";static ACTION_USER_FOREGROUND="android.intent.action.USER_FOREGROUND";static ACTION_USER_INITIALIZE="android.intent.action.USER_INITIALIZE";static ACTION_USER_PRESENT="android.intent.action.USER_PRESENT";static ACTION_USER_UNLOCKED="android.intent.action.USER_UNLOCKED";static ACTION_WALLPAPER_CHANGED="android.intent.action.WALLPAPER_CHANGED";static ACTION_AIRPLANE_MODE_CHANGED="android.intent.action.AIRPLANE_MODE";static ACTION_ANSWER="android.intent.action.ANSWER";static ACTION_DREAMING_STARTED="android.intent.action.DREAMING_STARTED";static ACTION_DREAMING_STOPPED="android.intent.action.DREAMING_STOPPED";static ACTION_INPUT_METHOD_CHANGED="android.intent.action.INPUT_METHOD_CHANGED";static ACTION_HEADSET_PLUG="android.intent.action.HEADSET_PLUG";static ACTION_MANAGE_PACKAGE_STORAGE="android.intent.action.MANAGE_PACKAGE_STORAGE";static ACTION_MY_PACKAGE_REPLACED="android.intent.action.MY_PACKAGE_REPLACED";static ACTION_PREFERRED_APPLICATIONS_CHANGED="android.intent.action.PREFERRED_APPLICATIONS_CHANGED";static ACTION_RADIO_POWER_RESET="android.intent.action.RADIO_POWER_RESET";static ACTION_UMS_CONNECTED="android.intent.action.UMS_CONNECTED";static ACTION_UMS_DISCONNECTED="android.intent.action.UMS_DISCONNECTED";static ACTION_USER_ADDED="android.intent.action.USER_ADDED";static ACTION_USER_REMOVED="android.intent.action.USER_REMOVED";static ACTION_USER_STOPPED="android.intent.action.USER_STOPPED";static ACTION_VPN_SETTINGS="android.intent.action.VPN_SETTINGS";static ACTION_INSTALL_FAILURE="android.intent.action.INSTALL_FAILURE";static ACTION_INSTALL_PACKAGE="android.intent.action.INSTALL_PACKAGE";static ACTION_UNINSTALL_PACKAGE="android.intent.action.UNINSTALL_PACKAGE";static ACTION_APPLICATION_SETTINGS="android.intent.action.APPLICATION_SETTINGS";static ACTION_DATA_ROAMING_SETTINGS="android.intent.action.DATA_ROAMING_SETTINGS";static ACTION_DATE_SETTINGS="android.intent.action.DATE_SETTINGS";static ACTION_DEVICE_INFO_SETTINGS="android.intent.action.DEVICE_INFO_SETTINGS";static ACTION_DISPLAY_SETTINGS="android.intent.action.DISPLAY_SETTINGS";static ACTION_HOME_SETTINGS="android.intent.action.HOME_SETTINGS";static ACTION_LOCATION_SOURCE_SETTINGS="android.intent.action.LOCATION_SOURCE_SETTINGS";static ACTION_NETWORK_SETTINGS="android.intent.action.NETWORK_SETTINGS";static ACTION_NFC_SETTINGS="android.intent.action.NFC_SETTINGS";static ACTION_PRIVACY_SETTINGS="android.intent.action.PRIVACY_SETTINGS";static ACTION_SEARCH_SETTINGS="android.intent.action.SEARCH_SETTINGS";static ACTION_SECURITY_SETTINGS="android.intent.action.SECURITY_SETTINGS";static ACTION_SETTINGS="android.intent.action.SETTINGS";static ACTION_SOUND_SETTINGS="android.intent.action.SOUND_SETTINGS";static ACTION_SYNC_SETTINGS="android.intent.action.SYNC_SETTINGS";static ACTION_USAGE_ACCESS_SETTINGS="android.intent.action.USAGE_ACCESS_SETTINGS";static ACTION_WIFI_IP_SETTINGS="android.intent.action.WIFI_IP_SETTINGS";static ACTION_WIFI_SETTINGS="android.intent.action.WIFI_SETTINGS";static ACTION_WIRELESS_SETTINGS="android.intent.action.WIRELESS_SETTINGS";static ACTION_BLUETOOTH_SETTINGS="android.intent.action.BLUETOOTH_SETTINGS";static ACTION_ACCESSIBILITY_SETTINGS="android.intent.action.ACCESSIBILITY_SETTINGS";static ACTION_ACCOUNT_SETTINGS="android.intent.action.ACCOUNT_SETTINGS";static ACTION_ADD_ACCOUNT="android.intent.action.ADD_ACCOUNT";static ACTION_APPLICATION_DETAILS_SETTINGS="android.intent.action.APPLICATION_DETAILS_SETTINGS";static ACTION_APPLICATION_DEVELOPMENT_SETTINGS="android.intent.action.APPLICATION_DEVELOPMENT_SETTINGS";static ACTION_WEB_SEARCH="android.intent.action.WEB_SEARCH";static ACTION_CREATE_SHORTCUT="android.intent.action.CREATE_SHORTCUT";static EXTRA_STREAM="android.intent.extra.STREAM";static EXTRA_TEXT="android.intent.extra.TEXT";static EXTRA_EMAIL="android.intent.extra.EMAIL";static EXTRA_CC="android.intent.extra.CC";static EXTRA_BCC="android.intent.extra.BCC";static EXTRA_SUBJECT="android.intent.extra.SUBJECT";static EXTRA_REFERRER="android.intent.extra.REFERRER";static EXTRA_REFERRER_NAME="android.intent.extra.REFERRER_NAME";static EXTRA_PHONE_NUMBER="android.intent.extra.PHONE_NUMBER";static EXTRA_LOCAL_ONLY="android.intent.extra.LOCAL_ONLY";static EXTRA_INITIAL_INTENTS="android.intent.extra.INITIAL_INTENTS";static EXTRA_CHOSEN_COMPONENT="android.intent.extra.CHOSEN_COMPONENT";static EXTRA_SHORTCUT_INTENT="android.intent.extra.SHORTCUT_INTENT";static EXTRA_SHORTCUT_NAME="android.intent.extra.SHORTCUT_NAME";static EXTRA_SHORTCUT_ICON="android.intent.extra.SHORTCUT_ICON";static EXTRA_SHORTCUT_ICON_RESOURCE="android.intent.extra.SHORTCUT_ICON_RESOURCE";static EXTRA_TITLE="android.intent.extra.TITLE";static EXTRA_HTML_TEXT="android.intent.extra.HTML_TEXT";static EXTRA_ASSIST_CONTEXT="android.intent.extra.ASSIST_CONTEXT";static EXTRA_ASSIST_INPUT_DEVICE_ID="android.intent.extra.ASSIST_INPUT_DEVICE_ID";static EXTRA_ASSIST_INPUT_METHOD_MANAGER_SERVICE="android.intent.extra.ASSIST_INPUT_METHOD_MANAGER_SERVICE";static EXTRA_ASSIST_SCREENSHOT="android.intent.extra.ASSIST_SCREENSHOT";static EXTRA_ASSIST_URI="android.intent.extra.ASSIST_URI";static EXTRA_ORIGINATING_URI="android.intent.extra.ORIGINATING_URI";static EXTRA_WEB_SEARCH_INTENT="android.intent.extra.WEB_SEARCH_INTENT";static EXTRA_MEDIA_ALBUM="android.intent.extra.MEDIA_ALBUM";static EXTRA_MEDIA_ARTIST="android.intent.extra.MEDIA_ARTIST";static EXTRA_MEDIA_FOCUS="android.intent.extra.MEDIA_FOCUS";static EXTRA_MEDIA_GENRE="android.intent.extra.MEDIA_GENRE";static EXTRA_MEDIA_TITLE="android.intent.extra.MEDIA_TITLE";static EXTRA_ALARM_COUNT="android.intent.extra.ALARM_COUNT";static EXTRA_CHANGED_COMPONENT_NAME_LIST="android.intent.extra.CHANGED_COMPONENT_NAME_LIST";static EXTRA_CHANGED_PACKAGE_LIST="android.intent.extra.CHANGED_PACKAGE_LIST";static EXTRA_CHANGED_UID_LIST="android.intent.extra.CHANGED_UID_LIST";static EXTRA_DATA_REMOVED="android.intent.extra.DATA_REMOVED";static EXTRA_DONT_KILL_APP="android.intent.extra.DONT_KILL_APP";static EXTRA_INSTALL_RESULT="android.intent.extra.INSTALL_RESULT";static EXTRA_KEY_EVENT="android.intent.extra.KEY_EVENT";static EXTRA_MIME_TYPES="android.intent.extra.MIME_TYPES";static EXTRA_MOUNT_FAILED="android.intent.extra.MOUNT_FAILED";static EXTRA_NOTIFICATION_ID="android.intent.extra.NOTIFICATION_ID";static EXTRA_NOTIFICATION_TAG="android.intent.extra.NOTIFICATION_TAG";static EXTRA_PACKAGES="android.intent.extra.PACKAGES";static EXTRA_REPLACING="android.intent.extra.REPLACING";static EXTRA_SPLIT_NAME="android.intent.extra.SPLIT_NAME";static EXTRA_SUSPENDED_PACKAGE_EXTRAS="android.intent.extra.SUSPENDED_PACKAGE_EXTRAS";static EXTRA_UID="android.intent.extra.UID";static EXTRA_USER="android.intent.extra.USER";static EXTRA_CHANNEL_ID="android.intent.extra.CHANNEL_ID";static EXTRA_REMOTE_INTENT_TOKEN="android.intent.extra.REMOTE_INTENT_TOKEN";static EXTRA_PERMISSION_GROUP_NAME="android.intent.extra.PERMISSION_GROUP_NAME";static EXTRA_PERMISSION_NAME="android.intent.extra.PERMISSION_NAME";static EXTRA_RESTRICTIONS_BUNDLE="android.intent.extra.RESTRICTIONS_BUNDLE";static EXTRA_RESTRICTIONS_INTENT="android.intent.extra.RESTRICTIONS_INTENT";static EXTRA_TIMEZONE="android.intent.extra.TIMEZONE";static EXTRA_DONT_REPLACE_EXISTING_APPLICATION_INFO="android.intent.extra.DONT_REPLACE_EXISTING_APPLICATION_INFO";static EXTRA_SPLASH_SCREEN_THEME="android.intent.extra.SPLASH_SCREEN_THEME";static EXTRA_SPLASH_SCREEN_ICON_ID="android.intent.extra.SPLASH_SCREEN_ICON_ID";static EXTRA_STREAM_MULTIPLE="android.intent.extra.STREAM_MULTIPLE";static EXTRA_EXCLUDE_COMPONENTS="android.intent.extra.EXCLUDE_COMPONENTS";static EXTRA_ALLOW_MULTIPLE="android.intent.extra.ALLOW_MULTIPLE";static EXTRA_PROVISIONING_ACCOUNT_TO_MIGRATE="android.intent.extra.PROVISIONING_ACCOUNT_TO_MIGRATE";static EXTRA_PROVISIONING_DEVICE_ADMIN_COMPONENT_NAME="android.intent.extra.PROVISIONING_DEVICE_ADMIN_COMPONENT_NAME";static EXTRA_PROVISIONING_LEAVE_ALL_SYSTEM_APPS_ENABLED="android.intent.extra.PROVISIONING_LEAVE_ALL_SYSTEM_APPS_ENABLED";static EXTRA_PROVISIONING_LOCALE="android.intent.extra.PROVISIONING_LOCALE";static EXTRA_PROVISIONING_TIME_ZONE="android.intent.extra.PROVISIONING_TIME_ZONE";static EXTRA_PROVISIONING_WIFI_HIDDEN="android.intent.extra.PROVISIONING_WIFI_HIDDEN";static EXTRA_PROVISIONING_WIFI_PASSWORD="android.intent.extra.PROVISIONING_WIFI_PASSWORD";static EXTRA_PROVISIONING_WIFI_SECURITY_TYPE="android.intent.extra.PROVISIONING_WIFI_SECURITY_TYPE";static EXTRA_PROVISIONING_WIFI_SSID="android.intent.extra.PROVISIONING_WIFI_SSID";static CATEGORY_DEFAULT="android.intent.category.DEFAULT";static CATEGORY_BROWSABLE="android.intent.category.BROWSABLE";static CATEGORY_TAB="android.intent.category.TAB";static CATEGORY_ALTERNATIVE="android.intent.category.ALTERNATIVE";static CATEGORY_SELECTED_ALTERNATIVE="android.intent.category.SELECTED_ALTERNATIVE";static CATEGORY_HOME="android.intent.category.HOME";static CATEGORY_LAUNCHER="android.intent.category.LAUNCHER";static CATEGORY_INFO="android.intent.category.INFO";static CATEGORY_MONITOR="android.intent.category.MONITOR";static CATEGORY_APP_BROWSER="android.intent.category.APP_BROWSER";static CATEGORY_APP_CALCULATOR="android.intent.category.APP_CALCULATOR";static CATEGORY_APP_CALENDAR="android.intent.category.APP_CALENDAR";static CATEGORY_APP_CONTACTS="android.intent.category.APP_CONTACTS";static CATEGORY_APP_EMAIL="android.intent.category.APP_EMAIL";static CATEGORY_APP_GALLERY="android.intent.category.APP_GALLERY";static CATEGORY_APP_MAPS="android.intent.category.APP_MAPS";static CATEGORY_APP_MESSAGING="android.intent.category.APP_MESSAGING";static CATEGORY_APP_MUSIC="android.intent.category.APP_MUSIC";static CATEGORY_APP_NFC="android.intent.category.APP_NFC";static CATEGORY_APP_FILES="android.intent.category.APP_FILES";static CATEGORY_OPENABLE="android.intent.category.OPENABLE";static CATEGORY_PREFERENCE="android.intent.category.PREFERENCE";static CATEGORY_TEST="android.intent.category.TEST";static CATEGORY_LIVE_WALLPAPER_SETTINGS="android.intent.category.LIVE_WALLPAPER_SETTINGS";static CATEGORY_INPUT_METHOD_SERVICE="android.intent.category.INPUT_METHOD_SERVICE";static CATEGORY_DEVICE_ADMIN="android.intent.category.DEVICE_ADMIN";static CATEGORY_ACCESSIBILITY_SERVICE="android.intent.category.ACCESSIBILITY_SERVICE";static CATEGORY_VPN_SERVICE="android.intent.category.VPN_SERVICE";static CATEGORY_DREAM="android.intent.category.DREAM";static CATEGORY_LEANBACK_LAUNCHER="android.intent.category.LEANBACK_LAUNCHER";static CATEGORY_LEANBACK_SETTINGS="android.intent.category.LEANBACK_SETTINGS";static CATEGORY_WEARABLE_LAUNCHER="android.intent.category.WEARABLE_LAUNCHER";static CATEGORY_CAR_MODE_LAUNCHER="android.intent.category.CAR_MODE_LAUNCHER"}class y{_interface=null;constructor(){if(typeof window==="undefined"||!window.webui)console.warn("window['webui'] is not defined. WebUI functionality may be limited.");else this._interface=window.webui}exit(){if(this._interface&&typeof this._interface.exit==="function")this._interface.exit();else console.error("exit method not available on the webui interface.")}setRefreshing(e){if(this._interface&&typeof this._interface.setRefreshing==="function")this._interface.setRefreshing(e);else console.error("setRefreshing method not available on the webui interface.")}get currentRootManager(){if(this._interface&&typeof this._interface.getCurrentRootManager!=="undefined")return this._interface.getCurrentRootManager();else return console.error("currentRootManager getter not available on the webui interface."),null}get currentApplication(){if(this._interface&&typeof this._interface.getCurrentApplication!=="undefined")return this._interface.getCurrentApplication();else return console.error("currentApplication getter not available on the webui interface."),null}getApplication(e){if(this._interface&&typeof this._interface.getApplication==="function")return this._interface.getApplication(e);else return console.error("getApplication method not available on the webui interface."),null}openFile(e){if(this._interface&&typeof this._interface.openFile==="function")this._interface.openFile(e.getParsedIntent());else console.error("openFile method not available on the webui interface.")}startActivity(e){if(this._interface&&typeof this._interface.startActivity==="function")this._interface.startActivity(e.getParsedIntent());else console.error("startActivity method not available on the webui interface.")}}class p extends Event{_wxOrigin;_wxData;get wxOrigin(){return this._wxOrigin}set wxOrigin(e){this._wxOrigin=e}get wx(){return this._wxData}set wx(e){this._wxData=e}constructor(e){super(e,{bubbles:!0,cancelable:!0,composed:!0})}}var W={cordova:!1};class c{_initialized=!1;_handlers=new WeakMap;_eventTypes;get eventTypes(){return this._eventTypes}constructor(e=W){if(this._initialized)return;this._initialized=!0,this._eventTypes={WX_ON_BACK:e.cordova?"backbutton":"back",WX_ON_RESUME:"resume",WX_ON_REFRESH:"refresh",WX_ON_PAUSE:"pause",WX_ON_KEYBOARD:"keyboard",WX_ON_INSETS:"insets"},window.addEventListener("message",(n)=>{try{if(typeof n.data!=="string")return;let t=JSON.parse(n.data);if(!t?.type)return;let r=this._eventTypes[t.type]??t.type;this._dispatch(window,r,t)}catch(t){console.error("[WXEvent] Message error:",t)}})}_dispatch(e,n,t){let r=new p(n);r.wx=t.data,r.wxOrigin="system",e.dispatchEvent(r)}on(e,n,t){if(!this._initialized)new c;let r=(s)=>{if(!(s instanceof p)){console.warn("[WXEvent] Event is not a WXEvent:",s);return}if(s.wxOrigin==="system"){if(typeof t==="function")t(s);else if(t&&typeof t.handleEvent==="function")t.handleEvent(s)}};if(!this._handlers.has(e))this._handlers.set(e,new Map);let i=this._handlers.get(e);if(!i.has(n))i.set(n,new Set);return i.get(n).add({handler:t,wrapper:r}),e.addEventListener(n,r),()=>this.off(e,n,t)}off(e,n,t){let r=this._handlers.get(e);if(!r?.has(n))return;for(let i of r.get(n))if(i.handler===t){e.removeEventListener(n,i.wrapper),r.get(n).delete(i);break}}}var l={chunkSize:1048576,headers:{"Content-Type":"application/octet-stream"}};async function E(e,n={}){let t={...l,...n};return new Promise((r,i)=>{let s;try{if(s=e,!s)throw new Error("Failed to open file input stream")}catch(o){i(o);return}let d=()=>{try{s?.close()}catch(o){console.error("Error during abort cleanup:",o)}i(new DOMException("The operation was aborted.","AbortError"))};if(t.signal){if(t.signal.aborted){d();return}t.signal.addEventListener("abort",d)}let u=new ReadableStream({async pull(o){try{let a=X(s,t.chunkSize);if(!a){o.close(),f();return}o.enqueue(a)}catch(a){f(),o.error(a),i(new Error(`Error reading file chunk: ${a}`))}},cancel(o){console.warn("Stream canceled:",o),f()}});function f(){try{if(t.signal)t.signal.removeEventListener("abort",d);s?.close()}catch(o){console.error(`Error during cleanup: ${o}`)}}r(u)})}function X(e,n){try{let t=n?e.readChunk(n):e.read();if(typeof t==="number")return new Uint8Array([t]);else if(typeof t==="string"){let r=JSON.parse(t);return r&&Array.isArray(r)&&r.length>0?new Uint8Array(r):null}return null}catch(t){throw new Error("Error reading chunk data: "+t)}}async function M(e,n={}){let t={...l,...n};try{let r=await E(e,t);return new Response(r,t)}catch(r){throw new Error(`wrapInputStream failed: ${r}`)}}async function S(e,n){if(!e||typeof e.getReader!=="function")throw new Error("Invalid ReadableStream provided.");if(!n||typeof n.write!=="function"||typeof n.close!=="function")throw new Error("Invalid outputStreamInstance provided. It must be an already opened stream with 'write' and 'close' methods.");let t=new WritableStream({async start(r){console.log("WritableStream started, output stream instance ready.")},async write(r,i){if(r instanceof Uint8Array)for(let s=0;s<r.length;s++)n.write(r[s]);else console.warn("Received non-Uint8Array chunk in WritableStream:",r),i.error(new TypeError("Expected Uint8Array chunks."))},async close(){console.log("WritableStream closed. Flushing and closing native stream.");try{n.flush(),n.close()}catch(r){throw console.error("Error during WritableStream close cleanup:",r),r}},async abort(r){console.error("WritableStream aborted:",r);try{n.close()}catch(i){console.error("Error during WritableStream abort cleanup:",i)}}});try{await e.pipeTo(t),console.log("Piping completed successfully.")}catch(r){let i=r instanceof Error?r:new Error(String(r));throw console.error("Error during stream piping:",i),new Error(`Failed to pipe stream: ${i.message}`)}}export{E as wrapToReadableStream,S as wrapOutputStream,M as wrapInputStream,l as readableStreamInit,y as WebUI,c as WXEventHandler,p as WXEvent,w as WXClass,v as Intent};
|
package/global.ts
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { ApplicationInterface } from "./src/types/ApplicationInterface";
|
|
2
|
+
import type { FileInputInterface } from "./src/types/FileInputInterface";
|
|
3
|
+
import type { FileInterface } from "./src/types/FileInterface";
|
|
4
|
+
import type { FileOutputInterface } from "./src/types/FileOutputInterface";
|
|
5
|
+
import type { IntentInterface } from "./src/types/IntentInterface";
|
|
6
|
+
import type { ModuleInterface } from "./src/types/ModuleInterface";
|
|
7
|
+
|
|
8
|
+
export {};
|
|
9
|
+
|
|
10
|
+
export type ModuleInterfaceToken = `$${string}`;
|
|
11
|
+
export type FileInterfaceToken = `$${string}File`;
|
|
12
|
+
export type FileInputInterfaceToken = `$${string}FileInputStream`;
|
|
13
|
+
export type FileOutputInterfaceToken = `$${string}FileOutputStream`;
|
|
14
|
+
|
|
15
|
+
export type MimeType = `${string}/${string}`;
|
|
16
|
+
|
|
17
|
+
declare global {
|
|
18
|
+
interface Window {
|
|
19
|
+
webui: ApplicationInterface;
|
|
20
|
+
[`$intent`]: IntentInterface;
|
|
21
|
+
[key: ModuleInterfaceToken]: ModuleInterface;
|
|
22
|
+
[key: FileInterfaceToken]: FileInterface;
|
|
23
|
+
[key: FileInputInterfaceToken]: FileInputInterface;
|
|
24
|
+
[key: FileOutputInterfaceToken]: FileOutputInterface;
|
|
25
|
+
}
|
|
26
|
+
}
|