New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@xiaobai-world/api

Package Overview
Dependencies
Maintainers
1
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@xiaobai-world/api - npm Package Compare versions

Comparing version 0.0.13 to 0.0.14

136

index.ts

@@ -1,3 +0,102 @@

import { IXiaobaiWorldMessageData, IWindow } from './types'
import axios from 'axios'
/** Xiaobai API */
export interface IXiaobaiApi {
/* Show Popup Menu */
TrackPopupMenu(menus: IContextMenuItem[]): void
FileSystem: XiaobaiFileSystem
}
export interface IXiaobaiWorldMessageData {
XIAOBAI_EVENT: "XIAOBAI_APP_JAVASCRIPT_ENTRY_LOADED",
id: string,
name: string,
title: string,
}
/**
* Right-click menu item
*/
export interface IContextMenuItem {
/** union id */
id: string;
/** Make button gray */
disable: boolean;
/** Button icon */
icon?: string;
/* Button text */
text: string;
/**
* Usually positioned to the right to display shortcuts
*/
describe?: string;
/** callback */
callback(event: IContextMenuItem): any;
/** sub menu */
child?: IContextMenuItem[],
}
/**
* Right-click menu
*/
export interface IContextMenu {
/** Whether the "right click menu" is visible */
visible: boolean;
/** The x coordinate of the menu */
x: number
/** The y coordinate of the menu */
y: number
/** Menu list */
menus: IContextMenuItem[]
}
declare global {
interface Window {
xiaobaiApi: IXiaobaiApi
}
}
/**
* on desktop have mutiple windows, every window has below "IWindow interface",
* each window be the body's directly child
* */
export interface IWindow {
/**
* unique id of window, global unique
*/
id: string;
/** mount point node */
mountPointId: string;
/**
* the name of the application mounted on the window, such as:
* notepad, photoPreview, Calendar, allow repetition in multiple windows
*/
name: string;
title: string,
x: number
y: number
width: number
height: number
active: boolean
visible: boolean
icon: string
animation: boolean
/** before the window is maximized,save the window size for later recovery */
previousWindowSize?: {
x: number,
y: number,
width: number,
height: number
},
/** whether the window has been consumed */
isUsed: boolean,
/** auto start? */
autoStart: boolean,
jsEntry: string,
css: string[]
}
/*

@@ -12,7 +111,2 @@ * because this module inside node_modules,

export type {
IXiaobaiWorldMessageData,
IWindow
}
/**

@@ -34,4 +128,4 @@ * mount app to xiaobai or spa

const node = document.querySelector(id);
const appName = appPackage.name;
if (node && node.getAttribute('app-name') === appName) {
const name = appPackage.name;
if (node && node.getAttribute('app-name') === name) {
render(id)

@@ -43,1 +137,27 @@ }

}
/**
* virtual disk api;
* avoid some users using cloud disk,because the priceis hard to bear. so matain target is save of small size file.
*/
/**
* file system
*/
export class XiaobaiFileSystem {
/** read dir file list */
async readDir(path: String) {
return (await axios.post('/storage/fileSystem/readDir', {
path
})).data.data
}
/** mkdir */
async mkDir(path: String) {
return (await axios.post('/storage/fileSystem/mkdir', {
path
})).data.data
}
}

5

package.json
{
"name": "@xiaobai-world/api",
"version": "0.0.13",
"version": "0.0.14",
"description": "xiaobai world api",

@@ -15,4 +15,5 @@ "main": "index.ts",

"dependencies": {
"@xiaobai-world/types": "0.0.1"
"@xiaobai-world/types": "0.0.1",
"axios": "^0.21.1"
}
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc