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

clickgo

Package Overview
Dependencies
Maintainers
1
Versions
214
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

clickgo - npm Package Compare versions

Comparing version 3.0.6-dev7 to 3.0.7-dev8

3

dist/app/task/form/bar/bar.js

@@ -27,2 +27,5 @@ "use strict";

exports.methods = {
showLauncher: function () {
clickgo.form.showLauncher();
},
itemClick: function (appIndex) {

@@ -29,0 +32,0 @@ return __awaiter(this, void 0, void 0, function* () {

@@ -26,3 +26,4 @@ "use strict";

'desktop.wallpaper': null,
'desktop.path': null
'desktop.path': null,
'launcher.list': []
};

@@ -36,3 +37,4 @@ exports.config = clickgo.vue.reactive({

'desktop.wallpaper': null,
'desktop.path': null
'desktop.path': null,
'launcher.list': []
});

@@ -250,3 +252,4 @@ exports.cdn = '';

taskStartedHandler: null,
taskEndedHandler: null
taskEndedHandler: null,
launcherFolderNameChangedHandler: null
};

@@ -290,3 +293,3 @@ function setSystemEventListener(name, func, formId, taskId) {

function trigger(name, taskId = 0, formId = 0, param1 = '', param2 = '') {
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4;
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7;
switch (name) {

@@ -441,2 +444,28 @@ case 'error': {

}
case 'launcherFolderNameChanged': {
if (typeof formId !== 'string') {
break;
}
if (typeof taskId === 'number') {
taskId = taskId.toString();
}
const r = (_5 = exports.globalEvents.launcherFolderNameChangedHandler) === null || _5 === void 0 ? void 0 : _5.call(exports.globalEvents, taskId, formId);
if (r && (r instanceof Promise)) {
r.catch(function (e) {
console.log(e);
});
}
for (const tid in task.list) {
const t = task.list[tid];
for (const fid in t.forms) {
const r = (_7 = (_6 = t.forms[fid].events)[name]) === null || _7 === void 0 ? void 0 : _7.call(_6, taskId, formId);
if (r instanceof Promise) {
r.catch(function (e) {
console.log(e);
});
}
}
}
break;
}
}

@@ -443,0 +472,0 @@ }

@@ -31,3 +31,4 @@ /**

'desktop.wallpaper': null,
'desktop.path': null
'desktop.path': null,
'launcher.list': []
};

@@ -41,3 +42,4 @@ export const config: types.IConfig = clickgo.vue.reactive({

'desktop.wallpaper': null,
'desktop.path': null
'desktop.path': null,
'launcher.list': []
});

@@ -276,3 +278,4 @@

taskStartedHandler: null,
taskEndedHandler: null
taskEndedHandler: null,
launcherFolderNameChangedHandler: null
};

@@ -491,2 +494,28 @@

}
case 'launcherFolderNameChanged': {
if (typeof formId !== 'string') {
break;
}
if (typeof taskId === 'number') {
taskId = taskId.toString();
}
const r = globalEvents.launcherFolderNameChangedHandler?.(taskId, formId);
if (r && (r instanceof Promise)) {
r.catch(function(e) {
console.log(e);
});
}
for (const tid in task.list) {
const t = task.list[tid];
for (const fid in t.forms) {
const r = t.forms[fid].events[name]?.(taskId, formId);
if (r instanceof Promise) {
r.catch(function(e) {
console.log(e);
});
}
}
}
break;
}
}

@@ -493,0 +522,0 @@ }

9

dist/lib/dom.js

@@ -7,6 +7,9 @@ "use strict";

const core = require("./core");
const topClass = ['#cg-form-list', '#cg-pop-list', '#cg-system', '#cg-simpletask'];
function classUnfold(after) {
const topClass = ['#cg-form-list', '#cg-pop-list', '#cg-system', '#cg-simpletask', '#cg-launcher'];
function classUnfold(after, out = []) {
const arr = [];
for (const name of topClass) {
if (out.includes(name)) {
continue;
}
arr.push(name + (after ? (' ' + after) : ''));

@@ -24,3 +27,3 @@ }

${classUnfold('img')} {vertical-align: bottom;}
${classUnfold('::selection')} {background-color: rgba(0, 0, 0, .1);}
${classUnfold('::selection', ['#cg-launcher'])} {background-color: rgba(0, 0, 0, .1);}
${classUnfold('*')}, ${classUnfold('*::after')}, ${classUnfold('*::before')} {box-sizing: border-box; -webkit-tap-highlight-color: rgba(0, 0, 0, 0); flex-shrink: 0;}

@@ -27,0 +30,0 @@ ${classUnfold()}, ${classUnfold('input')}, ${classUnfold('textarea')} {font-family: "Lucida Sans Unicode", "Helvetica Neue","Helvetica","PingFang SC","Hiragino Sans GB","Noto Sans CJK SC","Noto Sans CJK","Source Han Sans","WenQuanYi Micro Hei","Microsoft YaHei",sans-serif; font-size: 12px; line-height: 1; -webkit-font-smoothing: antialiased;}

@@ -22,6 +22,9 @@ /**

/** --- style list 的 div --- */
const topClass: string[] = ['#cg-form-list', '#cg-pop-list', '#cg-system', '#cg-simpletask'];
function classUnfold(after?: string): string {
const topClass: string[] = ['#cg-form-list', '#cg-pop-list', '#cg-system', '#cg-simpletask', '#cg-launcher'];
function classUnfold(after?: string, out: string[] = []): string {
const arr: string[] = [];
for (const name of topClass) {
if (out.includes(name)) {
continue;
}
arr.push(name + (after ? (' ' + after) : ''));

@@ -44,3 +47,3 @@ }

${classUnfold('img')} {vertical-align: bottom;}
${classUnfold('::selection')} {background-color: rgba(0, 0, 0, .1);}
${classUnfold('::selection', ['#cg-launcher'])} {background-color: rgba(0, 0, 0, .1);}
${classUnfold('*')}, ${classUnfold('*::after')}, ${classUnfold('*::before')} {box-sizing: border-box; -webkit-tap-highlight-color: rgba(0, 0, 0, 0); flex-shrink: 0;}

@@ -47,0 +50,0 @@ ${classUnfold()}, ${classUnfold('input')}, ${classUnfold('textarea')} {font-family: "Lucida Sans Unicode", "Helvetica Neue","Helvetica","PingFang SC","Hiragino Sans GB","Noto Sans CJK SC","Noto Sans CJK","Source Han Sans","WenQuanYi Micro Hei","Microsoft YaHei",sans-serif; font-size: 12px; line-height: 1; -webkit-font-smoothing: antialiased;}

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.cgInnerReceive = exports.cgInnerGetSends = exports.size = exports.restore = exports.min = exports.max = exports.clearListener = exports.off = exports.once = exports.on = exports.send = exports.getListeners = exports.getToken = void 0;
exports.size = exports.restore = exports.min = exports.max = exports.invoke = exports.getToken = void 0;
const clickgo = require("../clickgo");
let sendId = 0;
let sendList = [];
const listeners = {};
const token = (Math.random() * 100000000000000 * (100 + Math.round(Math.random() * (999 - 100)))).toString(32);

@@ -13,161 +10,24 @@ function getToken() {

exports.getToken = getToken;
function getListeners() {
const list = [];
for (const name in listeners) {
for (const item of listeners[name]) {
list.push({
'id': item.id,
'name': name,
'once': item.once,
'taskId': item.taskId
});
}
}
return list;
}
exports.getListeners = getListeners;
function send(name, param, handler, taskId) {
function invoke(name, ...param) {
if (!clickgo.getNative()) {
return 0;
}
const id = ++sendId;
sendList.push({
'id': id,
'name': name,
'param': param
});
if (handler) {
on(name, handler, id, true, taskId);
}
return id;
}
exports.send = send;
function on(name, handler, id, once = false, taskId) {
if (!clickgo.getNative()) {
return;
}
if (!listeners[name]) {
listeners[name] = [];
}
listeners[name].push({
'id': id !== null && id !== void 0 ? id : 0,
'once': once,
'taskId': taskId,
'handler': handler
});
return window.clickgoNative.invoke(name, ...param);
}
exports.on = on;
function once(name, handler, id, taskId) {
on(name, handler, id, true, taskId);
}
exports.once = once;
function off(name, handler, taskId) {
if (!listeners[name]) {
return;
}
for (let i = 0; i < listeners[name].length; ++i) {
if (listeners[name][i].handler !== handler) {
continue;
}
if (taskId && (listeners[name][i].taskId !== taskId)) {
continue;
}
listeners[name].splice(i, 1);
if (listeners[name].length === 0) {
delete listeners[name];
break;
}
--i;
}
}
exports.off = off;
function clearListener(taskId) {
if (!taskId) {
return;
}
for (const name in listeners) {
for (let i = 0; i < listeners[name].length; ++i) {
if (listeners[name][i].taskId !== taskId) {
continue;
}
listeners[name].splice(i, 1);
if (listeners[name].length === 0) {
delete listeners[name];
break;
}
}
}
}
exports.clearListener = clearListener;
exports.invoke = invoke;
function max() {
send('cg-set-state', JSON.stringify({
'token': token,
'state': 'max'
}));
invoke('cg-set-state', token, 'max');
}
exports.max = max;
function min() {
send('cg-set-state', JSON.stringify({
'token': token,
'state': 'min'
}));
invoke('cg-set-state', token, 'min');
}
exports.min = min;
function restore() {
send('cg-set-state', JSON.stringify({
'token': token,
'state': 'restore'
}));
invoke('cg-set-state', token, 'restore');
}
exports.restore = restore;
function size(width, height) {
send('cg-set-size', JSON.stringify({
'token': token,
'width': width,
'height': height
}));
invoke('cg-set-size', token, width, height);
}
exports.size = size;
function cgInnerGetSends() {
const json = JSON.stringify(sendList);
sendList = [];
return json;
}
exports.cgInnerGetSends = cgInnerGetSends;
function cgInnerReceive(id, name, result) {
if (!listeners[name]) {
return;
}
for (let i = 0; i < listeners[name].length; ++i) {
const item = listeners[name][i];
if (item.id > 0) {
if (item.id !== id) {
continue;
}
const r = item.handler(result);
if (r instanceof Promise) {
r.catch(function (e) {
console.log(e);
});
}
}
else {
const r = item.handler(result);
if (r instanceof Promise) {
r.catch(function (e) {
console.log(e);
});
}
}
if (item.once) {
listeners[name].splice(i, 1);
--i;
}
}
}
exports.cgInnerReceive = cgInnerReceive;
window.clickGoNative = {
isReady: true,
cgInnerGetSends: cgInnerGetSends,
cgInnerReceive: cgInnerReceive
};

@@ -18,19 +18,2 @@ /**

/** --- 最后一个 send ID --- */
let sendId = 0;
// --- sendList 一定会被清理 ---
let sendList: Array<{
'id': number;
'name': string;
'param': string | undefined;
}> = [];
/** --- 监听的 listener,需要调用者手动清理(或者 task 结束后自动会被清理,未设置 taskId 的则不会自动清理) --- */
const listeners: Record<string, Array<{
'id': number;
'once': boolean;
'taskId'?: number;
'handler': (param?: string) => void | Promise<void>;
}>> = {};
const token = (Math.random() * 100000000000000 * (100 + Math.round(Math.random() * (999 - 100)))).toString(32);

@@ -45,214 +28,26 @@ /**

/**
* --- 获取已经创建的监听列表 ---
*/
export function getListeners(): Array<{ 'id': number; 'name': string; 'once': boolean; 'taskId'?: number; }> {
const list = [];
for (const name in listeners) {
for (const item of listeners[name]) {
list.push({
'id': item.id,
'name': name,
'once': item.once,
'taskId': item.taskId
});
}
}
return list;
}
/**
* --- 向 native 发送指令 ---
* @param name 指令名
* @param param 参数
* @param handler 回调
* @param taskId 仅在任务活跃时可监听,App 模式下无效
*/
export function send(
name: string,
param?: string,
handler?: (param?: string) => void | Promise<void>,
taskId?: number
): number {
export function invoke(name: string, ...param: any[]): any {
if (!clickgo.getNative()) {
return 0;
}
const id = ++sendId;
sendList.push({
'id': id,
'name': name,
'param': param
});
if (handler) {
on(name, handler, id, true, taskId);
}
return id;
}
/**
* --- 监听 native 传递的指令 ---
* @param name 指令名
* @param handler 指令接收回调
* @param id 可选,监听特定 id 的指令
* @param once 可选,默认为非一次性监听
* @param taskId 仅在任务活跃时可监听,App 模式下无效
*/
export function on(
name: string,
handler: (param?: string) => void | Promise<void>,
id?: number,
once: boolean = false,
taskId?: number
): void {
if (!clickgo.getNative()) {
return;
}
if (!listeners[name]) {
listeners[name] = [];
}
listeners[name].push({
'id': id ?? 0,
'once': once,
'taskId': taskId,
'handler': handler
});
return (window as any).clickgoNative.invoke(name, ...param);
}
/**
* --- 监听一次 native 传递的指令 ---
* @param name 指令名
* @param handler 指令接收回调
* @param id 可选,监听特定 id 的指令
* @param taskId 仅在任务活跃时可监听,App 模式下无效
*/
export function once(
name: string,
handler: (param?: string) => void | Promise<void>,
id?: number,
taskId?: number
): void {
on(name, handler, id, true, taskId);
}
/**
* --- 取消监听 native 指令 ---
* @param name 指令名
* @param handler 绑定监听时的回调函数
* @param taskId 校验 taskId,为空则不校验,但 App 模式下无效
*/
export function off(name: string, handler: (param?: string) => void | Promise<void>, taskId?: number): void {
if (!listeners[name]) {
return;
}
for (let i = 0; i < listeners[name].length; ++i) {
if (listeners[name][i].handler !== handler) {
continue;
}
if (taskId && (listeners[name][i].taskId !== taskId)) {
continue;
}
listeners[name].splice(i, 1);
if (listeners[name].length === 0) {
delete listeners[name];
break;
}
--i;
}
}
/**
* --- 清除某个 task 当中的全部本地监听 ---
* @param taskId 要清除的 task id,App 模式下无效
*/
export function clearListener(taskId?: number): void {
if (!taskId) {
return;
}
for (const name in listeners) {
for (let i = 0; i < listeners[name].length; ++i) {
if (listeners[name][i].taskId !== taskId) {
continue;
}
listeners[name].splice(i, 1);
if (listeners[name].length === 0) {
delete listeners[name];
break;
}
}
}
}
// --- 常见操作 ---
export function max(): void {
send('cg-set-state', JSON.stringify({
'token': token,
'state': 'max'
}));
invoke('cg-set-state', token, 'max');
}
export function min(): void {
send('cg-set-state', JSON.stringify({
'token': token,
'state': 'min'
}));
invoke('cg-set-state', token, 'min');
}
export function restore(): void {
send('cg-set-state', JSON.stringify({
'token': token,
'state': 'restore'
}));
invoke('cg-set-state', token, 'restore');
}
export function size(width: number, height: number): void {
send('cg-set-size', JSON.stringify({
'token': token,
'width': width,
'height': height
}));
invoke('cg-set-size', token, width, height);
}
// --- 以下为供 native 调用的内部函数 ---
// --- 将 send 值全部提交给 native ---
export function cgInnerGetSends(): string {
const json = JSON.stringify(sendList);
sendList = [];
return json;
}
// --- 供 native 调用的回调数据(执行结果) ---
export function cgInnerReceive(id: number, name: string, result?: string): void {
if (!listeners[name]) {
return;
}
for (let i = 0; i < listeners[name].length; ++i) {
const item = listeners[name][i];
if (item.id > 0) {
if (item.id !== id) {
continue;
}
const r = item.handler(result);
if (r instanceof Promise) {
r.catch(function(e) {
console.log(e);
});
}
}
else {
const r = item.handler(result);
if (r instanceof Promise) {
r.catch(function(e) {
console.log(e);
});
}
}
if (item.once) {
listeners[name].splice(i, 1);
--i;
}
}
}
(window as any).clickGoNative = {
isReady: true,
cgInnerGetSends: cgInnerGetSends,
cgInnerReceive: cgInnerReceive
};

@@ -308,11 +308,7 @@ "use strict";

if (task.id === 1) {
clickgo.native.send('cg-init', clickgo.native.getToken());
native.invoke('cg-init', native.getToken());
}
if (clickgo.getNative() && opt.sync) {
f.vroot.$refs.form.isNativeSync = true;
clickgo.native.send('cg-set-size', JSON.stringify({
'token': clickgo.native.getToken(),
'width': f.vroot.$refs.form.widthData,
'height': f.vroot.$refs.form.heightData
}));
native.invoke('cg-set-size', native.getToken(), f.vroot.$refs.form.widthData, f.vroot.$refs.form.heightData);
window.addEventListener('resize', function () {

@@ -333,5 +329,3 @@ f.vroot.$refs.form.setPropData('width', window.innerWidth);

if (clickgo.getNative() && task.main) {
clickgo.native.send('cg-main-close', JSON.stringify({
'token': clickgo.native.getToken()
}));
native.invoke('cg-close', native.getToken());
}

@@ -367,3 +361,2 @@ const fid = form.getMaxZIndexID({

}
native.clearListener(taskId);
dom.clearWatchSize(taskId);

@@ -370,0 +363,0 @@ delete exports.list[taskId];

@@ -375,3 +375,3 @@ /**

if (task.id === 1) {
clickgo.native.send('cg-init', clickgo.native.getToken());
native.invoke('cg-init', native.getToken());
}

@@ -381,7 +381,3 @@ // --- 提交 sync ---

f.vroot.$refs.form.isNativeSync = true;
clickgo.native.send('cg-set-size', JSON.stringify({
'token': clickgo.native.getToken(),
'width': f.vroot.$refs.form.widthData,
'height': f.vroot.$refs.form.heightData
}));
native.invoke('cg-set-size', native.getToken(), f.vroot.$refs.form.widthData, f.vroot.$refs.form.heightData);
window.addEventListener('resize', function(): void {

@@ -406,5 +402,3 @@ f.vroot.$refs.form.setPropData('width', window.innerWidth);

if (clickgo.getNative() && task.main) {
clickgo.native.send('cg-main-close', JSON.stringify({
'token': clickgo.native.getToken()
}));
native.invoke('cg-close', native.getToken());
}

@@ -446,3 +440,2 @@ // --- 获取最大的 z index 窗体,并让他获取焦点 ---

// --- 移除各类监听 ---
native.clearListener(taskId);
dom.clearWatchSize(taskId);

@@ -449,0 +442,0 @@ // --- 移除 task ---

{
"name": "clickgo",
"version": "3.0.6-dev7",
"version": "3.0.7-dev8",
"description": "Background interface, software interface, mobile phone APP interface operation library.",

@@ -5,0 +5,0 @@ "keywords": [

@@ -22,3 +22,3 @@ # ClickGo

```html
<script src="https://cdn.jsdelivr.net/npm/@litert/loader@3.3.0/dist/loader.min.js?path=index&npm={'clickgo':'3.0.6-dev7'}"></script>
<script src="https://cdn.jsdelivr.net/npm/@litert/loader@3.3.0/dist/loader.min.js?path=index&npm={'clickgo':'3.0.7-dev8'}"></script>
```

@@ -25,0 +25,0 @@

@@ -64,6 +64,8 @@ export let control: typeof import('../dist/lib/control');

taskEndedHandler: null | ((taskId: number) => void | Promise<void>);
/** --- launcher 的文件夹名称被修改后触发 --- */
launcherFolderNameChangedHandler: null | ((id: string, name: string) => void | Promise<void>);
}
/** --- Core Config 属性列表 --- */
export type TConfigName = 'locale' | 'task.position' | 'task.pin' | 'desktop.icon.storage' | 'desktop.icon.recycler' | 'desktop.wallpaper' | 'desktop.path';
export type TConfigName = 'locale' | 'task.position' | 'task.pin' | 'desktop.icon.storage' | 'desktop.icon.recycler' | 'desktop.wallpaper' | 'desktop.path' | 'launcher.list';

@@ -79,6 +81,16 @@ /** --- Config 对象 --- */

['desktop.path']: string | null;
['launcher.list']: IConfigLauncherItem[];
}
/** --- Launcher 的 item 对象 --- */
export interface IConfigLauncherItem {
'id'?: string;
'name': string;
'path'?: string;
'icon'?: string;
'list'?: Array<{ 'id'?: string; 'name': string; 'path': string; 'icon': string; }>;
}
/** --- 全局事件类型 --- */
export type TGlobalEvent = 'error' | 'screenResize' | 'configChanged' | 'formCreated' | 'formRemoved' | 'formTitleChanged' | 'formIconChanged' | 'formStateMinChanged' | 'formStateMaxChanged' | 'formShowChanged' | 'formFocused' | 'formBlurred' | 'formFlash' | 'taskStarted' | 'taskEnded';
export type TGlobalEvent = 'error' | 'screenResize' | 'configChanged' | 'formCreated' | 'formRemoved' | 'formTitleChanged' | 'formIconChanged' | 'formStateMinChanged' | 'formStateMaxChanged' | 'formShowChanged' | 'formFocused' | 'formBlurred' | 'formFlash' | 'taskStarted' | 'taskEnded' | 'launcherFolderNameChanged';

@@ -632,2 +644,3 @@ export interface ICoreFetchAppOptions {

): void;
h(tag: string, props?: Record<string, any> | any[], list?: any[]): any;
}

@@ -634,0 +647,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

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