clickgo 3.1.3-dev12 → 3.1.5-dev14
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/README.md +1 -1
- package/dist/app/demo/app.js +1 -1
- package/dist/app/demo/config.json +9 -2
- package/dist/app/demo/form/control/text/text.js +1 -0
- package/dist/app/demo/form/control/text/text.xml +1 -1
- package/dist/app/demo/form/event/other/other.js +29 -0
- package/dist/app/demo/form/event/other/other.xml +5 -0
- package/dist/app/demo/form/main.js +51 -51
- package/dist/app/demo/form/main.xml +1 -0
- package/dist/app/demo/form/method/aform/aform.js +2 -13
- package/dist/app/demo/form/method/aform/aform.xml +0 -1
- package/dist/app/demo/form/method/aform/sd.js +25 -0
- package/dist/app/demo/form/method/aform/{test.xml → sd.xml} +3 -2
- package/dist/app/demo/form/method/core/core.js +12 -0
- package/dist/app/demo/form/method/core/core.xml +4 -0
- package/dist/app/demo/form/method/form/form.js +5 -6
- package/dist/app/demo/form/method/form/form.xml +1 -0
- package/dist/app/demo/form/method/form/test.xml +5 -0
- package/dist/app/demo/form/method/fs/fs.js +1 -4
- package/dist/app/demo/form/method/task/task.js +9 -1
- package/dist/app/demo/form/method/task/task.xml +1 -0
- package/dist/app/demo/form/method/tool/tool.js +3 -0
- package/dist/app/demo/form/method/tool/tool.xml +1 -0
- package/dist/app/demo/form/method/zip/zip.js +1 -4
- package/dist/app/task/app.js +1 -1
- package/dist/control/common.cgc +0 -0
- package/dist/control/form.cgc +0 -0
- package/dist/control/monaco.cgc +0 -0
- package/dist/control/property.cgc +0 -0
- package/dist/control/task.cgc +0 -0
- package/dist/global.css +1 -1
- package/dist/index.js +3 -0
- package/dist/index.ts +6 -0
- package/dist/lib/core.js +59 -10
- package/dist/lib/core.ts +67 -10
- package/dist/lib/dom.js +3 -3
- package/dist/lib/dom.ts +4 -4
- package/dist/lib/form.js +240 -215
- package/dist/lib/form.ts +290 -249
- package/dist/lib/fs.js +107 -12
- package/dist/lib/fs.ts +111 -20
- package/dist/lib/native.js +8 -1
- package/dist/lib/native.ts +6 -0
- package/dist/lib/task.js +253 -14
- package/dist/lib/task.ts +298 -12
- package/dist/lib/tool.js +39 -1
- package/dist/lib/tool.ts +45 -0
- package/dist/theme/familiar.cgt +0 -0
- package/package.json +3 -3
- package/types/index.d.ts +70 -52
package/dist/global.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
#cg-wrap{position:fixed;left:0;top:0;--cg:hsl(20, 100%, 65%);--success:hsl(150, 100%, 40%);--success-hover:hsl(150, 100%, 45%);--success-active:hsl(150, 100%, 30%);--success-focus:hsl(150, 100%, 35%);--success-disabled:hsl(150, 0%, 40%);--info:hsl(210, 100%, 50%);--info-hover:hsl(210, 100%, 60%);--info-active:hsl(210, 100%, 40%);--info-focus:hsl(210, 100%, 45%);--info-disabled:hsl(210, 0%, 50%);--warning:hsl(20, 100%, 70%);--warning-hover:hsl(20, 100%, 80%);--warning-active:hsl(20, 100%, 60%);--warning-focus:hsl(20, 100%, 65%);--warning-disabled:hsl(20, 0%, 70%);--danger:hsl(350, 100%, 50%);--danger-hover:hsl(350, 100%, 70%);--danger-active:hsl(350, 100%, 40%);--danger-focus:hsl(350, 100%, 45%);--danger-disabled:hsl(350, 0%, 50%);--system-color:hsl(0, 0%, 95%);--system-background:hsla(0, 0%, 0%, .5);--system-border-color:hsla(0, 0%, 100%, .2);--face:hsl(0, 0%, 95%);--g-color:hsl(0, 0%, 20%);--g-color-hover:hsl(0, 0%, 30%);--g-color-active:hsl(0, 0%, 10%);--g-color-focus:hsl(0, 0%, 15%);--g-color-disabled:hsl(0, 0%, 60%);--g-background:hsl(0, 0%, 95%);--g-background-hover:hsl(0, 0%, 100%);--g-background-active:hsl(0, 0%, 85%);--g-background-kp:hsl(0, 0%, 80%);--g-background-opacity:hsl(0, 0%, 50%, .2);--g-background-focus:hsl(0, 0%, 97.5%);--g-background-disabled:hsl(0, 0%, 75%);--g-border-color:hsl(0, 0%, 40%);--g-border-color-hover:hsl(0, 0%, 50%);--g-border-color-active:hsl(0, 0%, 30%);--g-border-color-focus:hsl(0, 0%, 35%);--g-border-color-disabled:hsl(0, 0%, 60%);--g-plain-color:var(--g-color);--g-plain-color-hover:var(--g-color-hover);--g-plain-color-active:var(--g-color-active);--g-plain-color-focus:var(--g-color-focus);--g-plain-color-disabled:var(--g-color-disabled);--g-plain-background:hsl(0, 0%, 100%);--g-plain-background-hover:hsl(0, 0%, 98%);--g-plain-background-active:hsl(0, 0%, 95%);--g-plain-background-focus:var(--g-plain-background);--g-plain-background-disabled:hsl(0, 0%, 95%);--g-plain-border-color:hsl(0, 0%, 70%);--g-plain-border-color-hover:hsl(0, 0%, 80%);--g-plain-border-color-active:hsl(0, 0%, 60%);--g-plain-border-color-focus:hsl(0, 0%, 65%);--g-plain-border-color-disabled:hsl(0, 0%, 60%)}#cg-form-list{z-index:20020000}#cg-pop-list{z-index:20020001}#cg-simpletask{z-index:20020002}#cg-rectangle{z-index:20020003;box-sizing:border-box;position:absolute;border-radius:3px;box-shadow:0 0 10px rgba(0,0,0,.25);background:rgba(255,255,255,.05);pointer-events:none;opacity:0}#cg-circular{z-index:20020003;box-sizing:border-box;position:absolute;border:solid 3px var(--cg);border-radius:50%;filter:drop-shadow(0 0 3px var(--cg));pointer-events:none;opacity:0}#cg-gesture{z-index:20020003;box-sizing:border-box;position:absolute;border-radius:50%;pointer-events:none;opacity:0;background:var(--system-background);box-shadow:0 5px 20px rgba(0,0,0,.25);transform:scale(0);width:20px;height:20px}#cg-gesture.done{background:rgba(255,255,255,.3);border:solid 3px rgba(0,0,0,.3)}#cg-gesture.ani{transition:all .1s ease-out;transition-property:left,top,transform}#cg-drag{z-index:20020003;box-sizing:border-box;position:absolute;border-radius:3px;pointer-events:none;background:var(--system-background);box-shadow:0 5px 20px rgba(0,0,0,.25);opacity:0;display:flex;justify-content:center;align-items:center}#cg-launcher{z-index:20020004;box-sizing:border-box;position:fixed;background:var(--system-background);-webkit-backdrop-filter:blur(30px) brightness(1.2);backdrop-filter:blur(30px) brightness(1.2);width:100%;height:100%;left:0;top:0;color:var(--system-color);display:none;flex-direction:column;transition:all .1s linear;transform:scale(1.2);opacity:0}#cg-launcher:not(.cg-show){pointer-events:none}#cg-launcher.cg-show{transform:scale(1);opacity:1}.cg-launcher-search{text-align:center;padding:50px}.cg-launcher-sinput{-webkit-appearance:none;appearance:none;padding:10px;height:38px;border:solid 1px var(--system-border-color);background:rgba(0,0,0,0);width:50%;border-radius:3px;color:var(--system-color)}.cg-launcher-sinput::placeholder{color:var(--system-border-color)}.cg-launcher-sinput::selection{background-color:var(--system-color);color:var(--g-color)}.cg-launcher-sinput:focus{outline:none;border-color:var(--system-color)}.cg-launcher-foldername{-webkit-appearance:none;appearance:none;height:38px;font-size:28px !important;border:none;background:rgba(0,0,0,0);width:50%;color:var(--system-color);text-align:center}.cg-launcher-foldername::selection{background-color:var(--system-color);color:var(--g-color)}.cg-launcher-foldername:focus{outline:none}.cg-launcher-item{width:190px;display:inline-flex;vertical-align:middle;margin-bottom:50px}.cg-launcher-inner{flex:1;width:0}.cg-launcher-icon{background-position:center;background-size:80px;height:80px;background-repeat:no-repeat}.cg-launcher-icon:active{filter:brightness(0.6)}.cg-launcher-name{font-size:13px;font-weight:bold;text-shadow:0 0 3px rgba(0,0,0,.6);text-align:center;margin-top:20px}.cg-launcher-icon,.cg-launcher-name{transition:all .1s linear;transition-property:opacity}.cg-launcher-space{width:50px}.cg-launcher-folder{display:flex;justify-content:center;height:80px}.cg-launcher-folder>div{height:80px;width:80px;background:rgba(255,255,255,.3);border-radius:20px;padding:10px 4px 4px 10px;transition:all .1s linear;transition-property:left,top,width,height,opacity;overflow-y:auto}.cg-launcher-folder>div::-webkit-scrollbar{display:none}.cg-launcher-folder>div .cg-launcher-item,.cg-launcher-folder>div .cg-launcher-space{transition:all .1s linear}.cg-launcher-folder>div.cg-show{padding:50px 0 0 50px}.cg-launcher-folder>div:not(.cg-show):active{filter:brightness(0.6)}.cg-launcher-folder>div:not(.cg-show) .cg-launcher-item{width:22px;margin-bottom:6px}.cg-launcher-folder>div:not(.cg-show) .cg-launcher-icon{background-size:16px;height:16px;pointer-events:none}.cg-launcher-folder>div:not(.cg-show) .cg-launcher-name{display:none}.cg-launcher-folder>div:not(.cg-show) .cg-launcher-space{width:6px}.cg-launcher-list{flex:1;height:0;overflow-y:auto;padding:0 0 0 50px}.cg-launcher-list::-webkit-scrollbar{display:none}.cg-launcher-list.cg-folder-open>.cg-launcher-item>.cg-launcher-inner>.cg-launcher-icon,.cg-launcher-list.cg-folder-open>.cg-launcher-item>.cg-launcher-inner>.cg-launcher-name{opacity:0}.cg-launcher-list.cg-folder-open>.cg-launcher-item>.cg-launcher-inner>.cg-launcher-folder>div:not(.cg-show){opacity:0}[data-cg-pop]{position:absolute;box-shadow:0px 5px 20px rgba(0,0,0,.25);transition:.1s ease-out;transition-property:transform,opacity;transform:translateY(-10px);opacity:0}[data-cg-pop]:not([data-cg-open]){pointer-events:none}[data-cg-pop][data-cg-open]{transform:translateY(0px);opacity:1}#cg-
|
|
1
|
+
#cg-wrap{position:fixed;left:0;top:0;--cg:hsl(20, 100%, 65%);--success:hsl(150, 100%, 40%);--success-hover:hsl(150, 100%, 45%);--success-active:hsl(150, 100%, 30%);--success-focus:hsl(150, 100%, 35%);--success-disabled:hsl(150, 0%, 40%);--info:hsl(210, 100%, 50%);--info-hover:hsl(210, 100%, 60%);--info-active:hsl(210, 100%, 40%);--info-focus:hsl(210, 100%, 45%);--info-disabled:hsl(210, 0%, 50%);--warning:hsl(20, 100%, 70%);--warning-hover:hsl(20, 100%, 80%);--warning-active:hsl(20, 100%, 60%);--warning-focus:hsl(20, 100%, 65%);--warning-disabled:hsl(20, 0%, 70%);--danger:hsl(350, 100%, 50%);--danger-hover:hsl(350, 100%, 70%);--danger-active:hsl(350, 100%, 40%);--danger-focus:hsl(350, 100%, 45%);--danger-disabled:hsl(350, 0%, 50%);--system-color:hsl(0, 0%, 95%);--system-background:hsla(0, 0%, 0%, .5);--system-background-hover:hsla(0, 0%, 100%, .05);--system-background-active:hsla(0, 0%, 0%, .2);--system-border-color:hsla(0, 0%, 100%, .2);--face:hsl(0, 0%, 95%);--g-color:hsl(0, 0%, 20%);--g-color-hover:hsl(0, 0%, 30%);--g-color-active:hsl(0, 0%, 10%);--g-color-focus:hsl(0, 0%, 15%);--g-color-disabled:hsl(0, 0%, 60%);--g-background:hsl(0, 0%, 95%);--g-background-hover:hsl(0, 0%, 100%);--g-background-active:hsl(0, 0%, 85%);--g-background-kp:hsl(0, 0%, 80%);--g-background-opacity:hsl(0, 0%, 50%, .2);--g-background-focus:hsl(0, 0%, 97.5%);--g-background-disabled:hsl(0, 0%, 75%);--g-border-color:hsl(0, 0%, 40%);--g-border-color-hover:hsl(0, 0%, 50%);--g-border-color-active:hsl(0, 0%, 30%);--g-border-color-focus:hsl(0, 0%, 35%);--g-border-color-disabled:hsl(0, 0%, 60%);--g-plain-color:var(--g-color);--g-plain-color-hover:var(--g-color-hover);--g-plain-color-active:var(--g-color-active);--g-plain-color-focus:var(--g-color-focus);--g-plain-color-disabled:var(--g-color-disabled);--g-plain-background:hsl(0, 0%, 100%);--g-plain-background-hover:hsl(0, 0%, 98%);--g-plain-background-active:hsl(0, 0%, 95%);--g-plain-background-focus:var(--g-plain-background);--g-plain-background-disabled:hsl(0, 0%, 95%);--g-plain-border-color:hsl(0, 0%, 70%);--g-plain-border-color-hover:hsl(0, 0%, 80%);--g-plain-border-color-active:hsl(0, 0%, 60%);--g-plain-border-color-focus:hsl(0, 0%, 65%);--g-plain-border-color-disabled:hsl(0, 0%, 60%)}#cg-form-list{z-index:20020000}#cg-pop-list{z-index:20020001}#cg-simpletask{z-index:20020002}#cg-rectangle{z-index:20020003;box-sizing:border-box;position:absolute;border-radius:3px;box-shadow:0 0 10px rgba(0,0,0,.25);background:rgba(255,255,255,.05);pointer-events:none;opacity:0}#cg-circular{z-index:20020003;box-sizing:border-box;position:absolute;border:solid 3px var(--cg);border-radius:50%;filter:drop-shadow(0 0 3px var(--cg));pointer-events:none;opacity:0}#cg-gesture{z-index:20020003;box-sizing:border-box;position:absolute;border-radius:50%;pointer-events:none;opacity:0;background:var(--system-background);box-shadow:0 5px 20px rgba(0,0,0,.25);transform:scale(0);width:20px;height:20px}#cg-gesture.done{background:rgba(255,255,255,.3);border:solid 3px rgba(0,0,0,.3)}#cg-gesture.ani{transition:all .1s ease-out;transition-property:left,top,transform}#cg-drag{z-index:20020003;box-sizing:border-box;position:absolute;border-radius:3px;pointer-events:none;background:var(--system-background);box-shadow:0 5px 20px rgba(0,0,0,.25);opacity:0;display:flex;justify-content:center;align-items:center}#cg-launcher{z-index:20020004;box-sizing:border-box;position:fixed;background:var(--system-background);-webkit-backdrop-filter:blur(30px) brightness(1.2);backdrop-filter:blur(30px) brightness(1.2);width:100%;height:100%;left:0;top:0;color:var(--system-color);display:none;flex-direction:column;transition:all .1s linear;transform:scale(1.2);opacity:0}#cg-launcher:not(.cg-show){pointer-events:none}#cg-launcher.cg-show{transform:scale(1);opacity:1}.cg-launcher-search{text-align:center;padding:50px}.cg-launcher-sinput{-webkit-appearance:none;appearance:none;padding:10px;height:38px;border:solid 1px var(--system-border-color);background:rgba(0,0,0,0);width:50%;border-radius:3px;color:var(--system-color)}.cg-launcher-sinput::placeholder{color:var(--system-border-color)}.cg-launcher-sinput::selection{background-color:var(--system-color);color:var(--g-color)}.cg-launcher-sinput:focus{outline:none;border-color:var(--system-color)}.cg-launcher-foldername{-webkit-appearance:none;appearance:none;height:38px;font-size:28px !important;border:none;background:rgba(0,0,0,0);width:50%;color:var(--system-color);text-align:center}.cg-launcher-foldername::selection{background-color:var(--system-color);color:var(--g-color)}.cg-launcher-foldername:focus{outline:none}.cg-launcher-item{width:190px;display:inline-flex;vertical-align:middle;margin-bottom:50px}.cg-launcher-inner{flex:1;width:0}.cg-launcher-icon{background-position:center;background-size:80px;height:80px;background-repeat:no-repeat}.cg-launcher-icon:active{filter:brightness(0.6)}.cg-launcher-name{font-size:13px;font-weight:bold;text-shadow:0 0 3px rgba(0,0,0,.6);text-align:center;margin-top:20px}.cg-launcher-icon,.cg-launcher-name{transition:all .1s linear;transition-property:opacity}.cg-launcher-space{width:50px}.cg-launcher-folder{display:flex;justify-content:center;height:80px}.cg-launcher-folder>div{height:80px;width:80px;background:rgba(255,255,255,.3);border-radius:20px;padding:10px 4px 4px 10px;transition:all .1s linear;transition-property:left,top,width,height,opacity;overflow-y:auto}.cg-launcher-folder>div::-webkit-scrollbar{display:none}.cg-launcher-folder>div .cg-launcher-item,.cg-launcher-folder>div .cg-launcher-space{transition:all .1s linear}.cg-launcher-folder>div.cg-show{padding:50px 0 0 50px}.cg-launcher-folder>div:not(.cg-show):active{filter:brightness(0.6)}.cg-launcher-folder>div:not(.cg-show) .cg-launcher-item{width:22px;margin-bottom:6px}.cg-launcher-folder>div:not(.cg-show) .cg-launcher-icon{background-size:16px;height:16px;pointer-events:none}.cg-launcher-folder>div:not(.cg-show) .cg-launcher-name{display:none}.cg-launcher-folder>div:not(.cg-show) .cg-launcher-space{width:6px}.cg-launcher-list{flex:1;height:0;overflow-y:auto;padding:0 0 0 50px}.cg-launcher-list::-webkit-scrollbar{display:none}.cg-launcher-list.cg-folder-open>.cg-launcher-item>.cg-launcher-inner>.cg-launcher-icon,.cg-launcher-list.cg-folder-open>.cg-launcher-item>.cg-launcher-inner>.cg-launcher-name{opacity:0}.cg-launcher-list.cg-folder-open>.cg-launcher-item>.cg-launcher-inner>.cg-launcher-folder>div:not(.cg-show){opacity:0}[data-cg-pop]{position:absolute;box-shadow:0px 5px 20px rgba(0,0,0,.25);transition:.1s ease-out;transition-property:transform,opacity;transform:translateY(-10px);opacity:0}[data-cg-pop]:not([data-cg-open]){pointer-events:none}[data-cg-pop][data-cg-open]{transform:translateY(0px);opacity:1}#cg-notify{z-index:20020005}.cg-notify-wrap{background:var(--system-background);position:fixed;padding:15px;border-radius:3px;right:0;top:0;width:280px;font-size:14px;display:flex;transition:.1s ease-out;transition-property:transform,opacity;overflow:hidden;color:var(--system-color);box-shadow:0 5px 20px rgba(0,0,0,.25);-webkit-backdrop-filter:blur(30px) brightness(1.2);backdrop-filter:blur(30px) brightness(1.2)}.cg-notify-icon{margin-right:10px;width:16px;height:16px;border-radius:50%}.cg-notify-icon.cg-primary{background:var(--success)}.cg-notify-icon.cg-info{background:var(--info)}.cg-notify-icon.cg-warning{background:var(--warning)}.cg-notify-icon.cg-danger{background:var(--danger)}.cg-notify-icon.cg-progress{background:var(--cg)}.cg-notify-title{font-size:16px;font-weight:bold;padding-bottom:10px}.cg-notify-content{line-height:1.5;word-break:break-word}.cg-notify-progress{position:absolute;bottom:0;left:0;border-radius:1px;background:var(--cg);transition:width 1s ease-out;width:0%;height:2px}#cg-simpletask{left:0;bottom:-46px;width:100%;height:46px;top:initial;background:var(--system-background);-webkit-backdrop-filter:blur(30px) brightness(1.2);backdrop-filter:blur(30px) brightness(1.2);padding:5px 0 5px 5px;display:flex;color:var(--system-color);transition:bottom .1s ease-out;overflow-x:auto;position:fixed}#cg-simpletask::-webkit-scrollbar{display:none}.cg-simpletask-item{background:rgba(0,0,0,.05);border-radius:3px;padding:10px;display:flex;align-items:center;margin-right:5px}.cg-simpletask-item:hover{background:rgba(0,0,0,.1)}.cg-simpletask-item:active{background:rgba(0,0,0,.2)}.cg-simpletask-icon{margin-right:5px;background-size:cover;width:16px;height:16px}#cg-confirm{z-index:20020006;position:fixed;left:0;top:0;width:100%;height:100%;background:var(--system-background);-webkit-backdrop-filter:blur(30px) brightness(1.2);backdrop-filter:blur(30px) brightness(1.2);justify-content:center;align-items:center}#cg-confirm .cg-confirm-box{background:var(--system-background);width:60%;box-shadow:0 5px 20px rgba(0,0,0,.25);font-size:14px;border-radius:3px;overflow:hidden;color:var(--system-color)}#cg-confirm .cg-confirm-box #cg-confirm-content{padding:25px}#cg-confirm .cg-confirm-box .cg-confirm-controls{border-top:solid .5px var(--system-border-color);display:flex}#cg-confirm .cg-confirm-box .cg-confirm-controls>div{padding:20px;flex:1;text-align:center}#cg-confirm .cg-confirm-box .cg-confirm-controls>div:last-child{border-left:solid .5px var(--system-border-color)}#cg-confirm .cg-confirm-box .cg-confirm-controls>div:hover{background:var(--system-background-hover)}#cg-confirm .cg-confirm-box .cg-confirm-controls>div:active{background:var(--system-background-active)}
|
package/dist/index.js
CHANGED
package/dist/index.ts
CHANGED
|
@@ -137,6 +137,12 @@ export abstract class AbstractBoot {
|
|
|
137
137
|
return;
|
|
138
138
|
}
|
|
139
139
|
|
|
140
|
+
/** --- location hash 改变事件 --- */
|
|
141
|
+
public onHashChanged(hash: string): void | Promise<void>;
|
|
142
|
+
public onHashChanged(): void {
|
|
143
|
+
return;
|
|
144
|
+
}
|
|
145
|
+
|
|
140
146
|
/** --- 环境文件准备加载时的事件 --- */
|
|
141
147
|
public onRuntimeFileLoad(url: string): void | Promise<void>;
|
|
142
148
|
public onRuntimeFileLoad(): void {
|
package/dist/lib/core.js
CHANGED
|
@@ -9,7 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.getAvailArea = exports.fetchApp = exports.readApp = exports.trigger = exports.getModule = exports.regModule = exports.boot = exports.getCdn = exports.AbstractApp = exports.config = void 0;
|
|
12
|
+
exports.hash = exports.getAvailArea = exports.fetchApp = exports.readApp = exports.trigger = exports.getModule = exports.regModule = exports.boot = exports.getCdn = exports.AbstractApp = exports.config = void 0;
|
|
13
13
|
const clickgo = require("../clickgo");
|
|
14
14
|
const fs = require("./fs");
|
|
15
15
|
const form = require("./form");
|
|
@@ -51,11 +51,6 @@ class AbstractApp {
|
|
|
51
51
|
});
|
|
52
52
|
}
|
|
53
53
|
run(form) {
|
|
54
|
-
if (typeof form === 'number') {
|
|
55
|
-
const msg = 'Application run error, Form creation failed (' + form.toString() + ').';
|
|
56
|
-
trigger('error', this.taskId, 0, new Error(msg), msg);
|
|
57
|
-
return;
|
|
58
|
-
}
|
|
59
54
|
form.show();
|
|
60
55
|
}
|
|
61
56
|
onError() {
|
|
@@ -106,6 +101,9 @@ class AbstractApp {
|
|
|
106
101
|
onLauncherFolderNameChanged() {
|
|
107
102
|
return;
|
|
108
103
|
}
|
|
104
|
+
onHashChanged() {
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
109
107
|
}
|
|
110
108
|
exports.AbstractApp = AbstractApp;
|
|
111
109
|
function getCdn() {
|
|
@@ -282,7 +280,7 @@ const globalEvents = {
|
|
|
282
280
|
}
|
|
283
281
|
};
|
|
284
282
|
function trigger(name, taskId = 0, formId = 0, param1 = '', param2 = '') {
|
|
285
|
-
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, _8, _9, _10, _11, _12;
|
|
283
|
+
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, _8, _9, _10, _11, _12, _13, _14, _15;
|
|
286
284
|
const eventName = 'on' + name[0].toUpperCase() + name.slice(1);
|
|
287
285
|
switch (name) {
|
|
288
286
|
case 'error': {
|
|
@@ -396,7 +394,7 @@ function trigger(name, taskId = 0, formId = 0, param1 = '', param2 = '') {
|
|
|
396
394
|
if (typeof formId !== 'string') {
|
|
397
395
|
break;
|
|
398
396
|
}
|
|
399
|
-
if (typeof taskId
|
|
397
|
+
if (typeof taskId !== 'string') {
|
|
400
398
|
taskId = taskId.toString();
|
|
401
399
|
}
|
|
402
400
|
exports.boot[eventName](taskId, formId);
|
|
@@ -409,6 +407,20 @@ function trigger(name, taskId = 0, formId = 0, param1 = '', param2 = '') {
|
|
|
409
407
|
}
|
|
410
408
|
break;
|
|
411
409
|
}
|
|
410
|
+
case 'hashChanged': {
|
|
411
|
+
if (typeof taskId !== 'string') {
|
|
412
|
+
break;
|
|
413
|
+
}
|
|
414
|
+
exports.boot[eventName](taskId);
|
|
415
|
+
for (const tid in task.list) {
|
|
416
|
+
const t = task.list[tid];
|
|
417
|
+
(_13 = t.class) === null || _13 === void 0 ? void 0 : _13[eventName](taskId);
|
|
418
|
+
for (const fid in t.forms) {
|
|
419
|
+
(_15 = (_14 = t.forms[fid].vroot)[eventName]) === null || _15 === void 0 ? void 0 : _15.call(_14, taskId);
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
break;
|
|
423
|
+
}
|
|
412
424
|
}
|
|
413
425
|
}
|
|
414
426
|
exports.trigger = trigger;
|
|
@@ -525,6 +537,9 @@ function fetchApp(url, opt = {}) {
|
|
|
525
537
|
}
|
|
526
538
|
const total = config.files.length;
|
|
527
539
|
let loaded = 0;
|
|
540
|
+
if (opt.progress) {
|
|
541
|
+
opt.progress(loaded + 1, total + 1);
|
|
542
|
+
}
|
|
528
543
|
for (const file of config.files) {
|
|
529
544
|
fs.getContent(url + file.slice(1), {
|
|
530
545
|
'current': current
|
|
@@ -549,6 +564,9 @@ function fetchApp(url, opt = {}) {
|
|
|
549
564
|
if (opt.notifyId) {
|
|
550
565
|
form.notifyProgress(opt.notifyId, loaded / total);
|
|
551
566
|
}
|
|
567
|
+
if (opt.progress) {
|
|
568
|
+
opt.progress(loaded + 1, total + 1);
|
|
569
|
+
}
|
|
552
570
|
if (loaded < total) {
|
|
553
571
|
return;
|
|
554
572
|
}
|
|
@@ -559,6 +577,9 @@ function fetchApp(url, opt = {}) {
|
|
|
559
577
|
if (opt.notifyId) {
|
|
560
578
|
form.notifyProgress(opt.notifyId, loaded / total);
|
|
561
579
|
}
|
|
580
|
+
if (opt.progress) {
|
|
581
|
+
opt.progress(loaded + 1, total + 1);
|
|
582
|
+
}
|
|
562
583
|
if (loaded < total) {
|
|
563
584
|
return;
|
|
564
585
|
}
|
|
@@ -567,13 +588,23 @@ function fetchApp(url, opt = {}) {
|
|
|
567
588
|
}
|
|
568
589
|
});
|
|
569
590
|
}
|
|
570
|
-
catch (
|
|
591
|
+
catch (e) {
|
|
592
|
+
console.log('core.fetchApp', e);
|
|
593
|
+
trigger('error', 0, 0, e, e.message);
|
|
571
594
|
return null;
|
|
572
595
|
}
|
|
573
|
-
let icon = '
|
|
596
|
+
let icon = '';
|
|
574
597
|
if (config.icon && (files[config.icon] instanceof Blob)) {
|
|
575
598
|
icon = yield tool.blob2DataUrl(files[config.icon]);
|
|
576
599
|
}
|
|
600
|
+
if (icon === '') {
|
|
601
|
+
const iconBlob = yield fs.getContent('/clickgo/icon.png', {
|
|
602
|
+
'current': current
|
|
603
|
+
});
|
|
604
|
+
if (iconBlob instanceof Blob) {
|
|
605
|
+
icon = yield tool.blob2DataUrl(iconBlob);
|
|
606
|
+
}
|
|
607
|
+
}
|
|
577
608
|
return {
|
|
578
609
|
'type': 'app',
|
|
579
610
|
'config': config,
|
|
@@ -635,3 +666,21 @@ function getAvailArea() {
|
|
|
635
666
|
}
|
|
636
667
|
}
|
|
637
668
|
exports.getAvailArea = getAvailArea;
|
|
669
|
+
function hash(hash, taskId) {
|
|
670
|
+
if (!taskId) {
|
|
671
|
+
return false;
|
|
672
|
+
}
|
|
673
|
+
const t = task.list[taskId];
|
|
674
|
+
if (!t) {
|
|
675
|
+
return false;
|
|
676
|
+
}
|
|
677
|
+
if (!t.runtime.permissions.includes('root') && !t.runtime.permissions.includes('hash')) {
|
|
678
|
+
return false;
|
|
679
|
+
}
|
|
680
|
+
window.location.hash = hash;
|
|
681
|
+
return true;
|
|
682
|
+
}
|
|
683
|
+
exports.hash = hash;
|
|
684
|
+
window.addEventListener('hashchange', function () {
|
|
685
|
+
trigger('hashChanged', window.location.hash ? window.location.hash.slice(1) : '');
|
|
686
|
+
});
|
package/dist/lib/core.ts
CHANGED
|
@@ -73,13 +73,7 @@ export abstract class AbstractApp {
|
|
|
73
73
|
* --- 以某个窗体进行正式启动这个 app(入口 form),不启动则任务也启动失败 ---
|
|
74
74
|
* @param form 窗体对象
|
|
75
75
|
*/
|
|
76
|
-
public run(form: form.AbstractForm
|
|
77
|
-
if (typeof form === 'number') {
|
|
78
|
-
// --- 报错 ---
|
|
79
|
-
const msg = 'Application run error, Form creation failed (' + form.toString() + ').';
|
|
80
|
-
trigger('error', this.taskId, 0, new Error(msg), msg);
|
|
81
|
-
return;
|
|
82
|
-
}
|
|
76
|
+
public run(form: form.AbstractForm): void {
|
|
83
77
|
form.show();
|
|
84
78
|
}
|
|
85
79
|
|
|
@@ -179,6 +173,12 @@ export abstract class AbstractApp {
|
|
|
179
173
|
return;
|
|
180
174
|
}
|
|
181
175
|
|
|
176
|
+
/** --- location hash 改变事件 --- */
|
|
177
|
+
public onHashChanged(hash: string): void | Promise<void>;
|
|
178
|
+
public onHashChanged(): void {
|
|
179
|
+
return;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
182
|
}
|
|
183
183
|
|
|
184
184
|
/** --- CDN 地址 --- */
|
|
@@ -498,7 +498,7 @@ export function trigger(name: types.TGlobalEvent, taskId: number | string | bool
|
|
|
498
498
|
if (typeof formId !== 'string') {
|
|
499
499
|
break;
|
|
500
500
|
}
|
|
501
|
-
if (typeof taskId
|
|
501
|
+
if (typeof taskId !== 'string') {
|
|
502
502
|
taskId = taskId.toString();
|
|
503
503
|
}
|
|
504
504
|
(boot as any)[eventName](taskId, formId);
|
|
@@ -511,6 +511,20 @@ export function trigger(name: types.TGlobalEvent, taskId: number | string | bool
|
|
|
511
511
|
}
|
|
512
512
|
break;
|
|
513
513
|
}
|
|
514
|
+
case 'hashChanged': {
|
|
515
|
+
if (typeof taskId !== 'string') {
|
|
516
|
+
break;
|
|
517
|
+
}
|
|
518
|
+
(boot as any)[eventName](taskId);
|
|
519
|
+
for (const tid in task.list) {
|
|
520
|
+
const t = task.list[tid];
|
|
521
|
+
(t.class as any)?.[eventName](taskId);
|
|
522
|
+
for (const fid in t.forms) {
|
|
523
|
+
t.forms[fid].vroot[eventName]?.(taskId);
|
|
524
|
+
}
|
|
525
|
+
}
|
|
526
|
+
break;
|
|
527
|
+
}
|
|
514
528
|
}
|
|
515
529
|
}
|
|
516
530
|
|
|
@@ -645,6 +659,9 @@ export async function fetchApp(
|
|
|
645
659
|
}
|
|
646
660
|
const total = config.files.length;
|
|
647
661
|
let loaded = 0;
|
|
662
|
+
if (opt.progress) {
|
|
663
|
+
opt.progress(loaded + 1, total + 1) as unknown;
|
|
664
|
+
}
|
|
648
665
|
for (const file of config.files) {
|
|
649
666
|
fs.getContent(url + file.slice(1), {
|
|
650
667
|
'current': current
|
|
@@ -668,6 +685,9 @@ export async function fetchApp(
|
|
|
668
685
|
if (opt.notifyId) {
|
|
669
686
|
form.notifyProgress(opt.notifyId, loaded / total);
|
|
670
687
|
}
|
|
688
|
+
if (opt.progress) {
|
|
689
|
+
opt.progress(loaded + 1, total + 1) as unknown;
|
|
690
|
+
}
|
|
671
691
|
if (loaded < total) {
|
|
672
692
|
return;
|
|
673
693
|
}
|
|
@@ -677,6 +697,9 @@ export async function fetchApp(
|
|
|
677
697
|
if (opt.notifyId) {
|
|
678
698
|
form.notifyProgress(opt.notifyId, loaded / total);
|
|
679
699
|
}
|
|
700
|
+
if (opt.progress) {
|
|
701
|
+
opt.progress(loaded + 1, total + 1) as unknown;
|
|
702
|
+
}
|
|
680
703
|
if (loaded < total) {
|
|
681
704
|
return;
|
|
682
705
|
}
|
|
@@ -685,14 +708,24 @@ export async function fetchApp(
|
|
|
685
708
|
}
|
|
686
709
|
});
|
|
687
710
|
}
|
|
688
|
-
catch {
|
|
711
|
+
catch (e: any) {
|
|
712
|
+
console.log('core.fetchApp', e);
|
|
713
|
+
trigger('error', 0, 0, e, e.message);
|
|
689
714
|
return null;
|
|
690
715
|
}
|
|
691
716
|
|
|
692
|
-
let icon = '
|
|
717
|
+
let icon = '';
|
|
693
718
|
if (config.icon && (files[config.icon] instanceof Blob)) {
|
|
694
719
|
icon = await tool.blob2DataUrl(files[config.icon] as Blob);
|
|
695
720
|
}
|
|
721
|
+
if (icon === '') {
|
|
722
|
+
const iconBlob = await fs.getContent('/clickgo/icon.png', {
|
|
723
|
+
'current': current
|
|
724
|
+
});
|
|
725
|
+
if (iconBlob instanceof Blob) {
|
|
726
|
+
icon = await tool.blob2DataUrl(iconBlob);
|
|
727
|
+
}
|
|
728
|
+
}
|
|
696
729
|
|
|
697
730
|
return {
|
|
698
731
|
'type': 'app',
|
|
@@ -756,3 +789,27 @@ export function getAvailArea(): types.IAvailArea {
|
|
|
756
789
|
};
|
|
757
790
|
}
|
|
758
791
|
}
|
|
792
|
+
|
|
793
|
+
/**
|
|
794
|
+
* --- 修改浏览器 hash ---
|
|
795
|
+
* @param hash 修改的值,不含 #
|
|
796
|
+
* @param taskId 基任务,App 模式下无效
|
|
797
|
+
*/
|
|
798
|
+
export function hash(hash: string, taskId?: number): boolean {
|
|
799
|
+
if (!taskId) {
|
|
800
|
+
return false;
|
|
801
|
+
}
|
|
802
|
+
const t = task.list[taskId];
|
|
803
|
+
if (!t) {
|
|
804
|
+
return false;
|
|
805
|
+
}
|
|
806
|
+
if (!t.runtime.permissions.includes('root') && !t.runtime.permissions.includes('hash')) {
|
|
807
|
+
return false;
|
|
808
|
+
}
|
|
809
|
+
window.location.hash = hash;
|
|
810
|
+
return true;
|
|
811
|
+
}
|
|
812
|
+
|
|
813
|
+
window.addEventListener('hashchange', function() {
|
|
814
|
+
trigger('hashChanged', window.location.hash ? window.location.hash.slice(1) : '');
|
|
815
|
+
});
|
package/dist/lib/dom.js
CHANGED
|
@@ -14,7 +14,7 @@ const clickgo = require("../clickgo");
|
|
|
14
14
|
const form = require("./form");
|
|
15
15
|
const core = require("./core");
|
|
16
16
|
const tool = require("./tool");
|
|
17
|
-
const topClass = ['#cg-form-list', '#cg-pop-list', '#cg-
|
|
17
|
+
const topClass = ['#cg-form-list', '#cg-pop-list', '#cg-notify', '#cg-simpletask', '#cg-launcher'];
|
|
18
18
|
function classUnfold(after, out = []) {
|
|
19
19
|
const arr = [];
|
|
20
20
|
for (const name of topClass) {
|
|
@@ -784,7 +784,7 @@ function bindGesture(oe, before, handler) {
|
|
|
784
784
|
if (offset < 90) {
|
|
785
785
|
return;
|
|
786
786
|
}
|
|
787
|
-
handler(dir);
|
|
787
|
+
handler === null || handler === void 0 ? void 0 : handler(dir);
|
|
788
788
|
}
|
|
789
789
|
});
|
|
790
790
|
}
|
|
@@ -911,7 +911,7 @@ function bindGesture(oe, before, handler) {
|
|
|
911
911
|
return;
|
|
912
912
|
}
|
|
913
913
|
gestureWheel.done = true;
|
|
914
|
-
handler(gestureWheel.dir);
|
|
914
|
+
handler === null || handler === void 0 ? void 0 : handler(gestureWheel.dir);
|
|
915
915
|
yield tool.sleep(500);
|
|
916
916
|
form.elements.gesture.style.opacity = '0';
|
|
917
917
|
form.elements.gesture.classList.remove('ani');
|
package/dist/lib/dom.ts
CHANGED
|
@@ -20,7 +20,7 @@ import * as core from './core';
|
|
|
20
20
|
import * as tool from './tool';
|
|
21
21
|
|
|
22
22
|
/** --- style list 的 div --- */
|
|
23
|
-
const topClass: string[] = ['#cg-form-list', '#cg-pop-list', '#cg-
|
|
23
|
+
const topClass: string[] = ['#cg-form-list', '#cg-pop-list', '#cg-notify', '#cg-simpletask', '#cg-launcher'];
|
|
24
24
|
function classUnfold(after?: string, out: string[] = []): string {
|
|
25
25
|
const arr: string[] = [];
|
|
26
26
|
for (const name of topClass) {
|
|
@@ -902,7 +902,7 @@ const gestureWheel = {
|
|
|
902
902
|
* @param before before 事件,返回 true 则显示 gesture
|
|
903
903
|
* @param handler 执行完毕的话才会回调
|
|
904
904
|
*/
|
|
905
|
-
export function bindGesture(oe: MouseEvent | TouchEvent | WheelEvent, before: (e: MouseEvent | TouchEvent | WheelEvent, dir: 'top' | 'right' | 'bottom' | 'left') => boolean, handler
|
|
905
|
+
export function bindGesture(oe: MouseEvent | TouchEvent | WheelEvent, before: (e: MouseEvent | TouchEvent | WheelEvent, dir: 'top' | 'right' | 'bottom' | 'left') => boolean, handler?: (dir: 'top' | 'right' | 'bottom' | 'left') => void | Promise<void>): void {
|
|
906
906
|
const el = oe.currentTarget as HTMLElement | null;
|
|
907
907
|
if (!el) {
|
|
908
908
|
return;
|
|
@@ -1034,7 +1034,7 @@ export function bindGesture(oe: MouseEvent | TouchEvent | WheelEvent, before: (e
|
|
|
1034
1034
|
if (offset < 90) {
|
|
1035
1035
|
return;
|
|
1036
1036
|
}
|
|
1037
|
-
handler(dir) as any;
|
|
1037
|
+
handler?.(dir) as any;
|
|
1038
1038
|
}
|
|
1039
1039
|
});
|
|
1040
1040
|
}
|
|
@@ -1182,7 +1182,7 @@ export function bindGesture(oe: MouseEvent | TouchEvent | WheelEvent, before: (e
|
|
|
1182
1182
|
return;
|
|
1183
1183
|
}
|
|
1184
1184
|
gestureWheel.done = true;
|
|
1185
|
-
handler(gestureWheel.dir as any) as any;
|
|
1185
|
+
handler?.(gestureWheel.dir as any) as any;
|
|
1186
1186
|
await tool.sleep(500);
|
|
1187
1187
|
form.elements.gesture.style.opacity = '0';
|
|
1188
1188
|
form.elements.gesture.classList.remove('ani');
|