zois-core 1.1.9 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +23 -2
- package/dist/changelogs.js +167 -0
- package/dist/core-subscreen/coreSubscreen.js +81 -0
- package/dist/core-subscreen/developmentSubscreen.js +22 -0
- package/dist/core-subscreen/generalSubscreen.js +23 -0
- package/dist/core-subscreen/mainSubscreen.js +58 -0
- package/dist/core-subscreen/shards/coreButtonShard.js +30 -0
- package/dist/core-subscreen/shards/coreCheckboxShard.js +33 -0
- package/dist/core-subscreen/shards/coreInputListShard.js +38 -0
- package/dist/core-subscreen/shards/coreSelectShard.js +17 -0
- package/dist/core-subscreen/shards/coreTextShard.js +9 -0
- package/dist/core-subscreen/shards/index.js +5 -0
- package/dist/core-subscreen/toastsSubscreen.js +112 -0
- package/dist/core.js +178 -0
- package/dist/dialogs.js +110 -0
- package/dist/index.js +202 -1
- package/dist/localization.js +71 -0
- package/dist/logging.js +31 -0
- package/dist/messaging.js +234 -1
- package/dist/modSdk.js +63 -0
- package/dist/shard-modules/attributesModule.js +16 -0
- package/dist/shard-modules/centerModule.js +12 -0
- package/dist/shard-modules/clickModule.js +14 -0
- package/dist/shard-modules/counterUpModule.js +37 -0
- package/dist/shard-modules/dynamicClassModule.js +15 -0
- package/dist/shard-modules/index.js +9 -0
- package/dist/shard-modules/multiClickModule.js +41 -0
- package/dist/shard-modules/shardModule.js +12 -0
- package/dist/shard-modules/styleModule.js +20 -0
- package/dist/shard-modules/typeModule.js +37 -0
- package/dist/shards/backNextButtonShard.js +99 -0
- package/dist/shards/buttonShard.js +118 -0
- package/dist/shards/cardShard.js +35 -0
- package/dist/shards/checkboxShard.js +139 -0
- package/dist/shards/containerShard.js +16 -0
- package/dist/shards/imageShard.js +98 -0
- package/dist/shards/index.js +13 -0
- package/dist/shards/inputListShard.js +162 -0
- package/dist/shards/inputShard.js +33 -0
- package/dist/shards/selectShard.js +126 -0
- package/dist/shards/shard.js +79 -0
- package/dist/shards/svgShard.js +47 -0
- package/dist/shards/tabsShard.js +59 -0
- package/dist/shards/textShard.js +27 -0
- package/dist/styles.css +209 -1
- package/dist/toasts.js +188 -0
- package/dist/types/changelogs.d.ts +1 -0
- package/dist/types/core-subscreen/coreSubscreen.d.ts +15 -0
- package/dist/types/core-subscreen/developmentSubscreen.d.ts +5 -0
- package/dist/types/core-subscreen/generalSubscreen.d.ts +5 -0
- package/dist/types/core-subscreen/mainSubscreen.d.ts +6 -0
- package/dist/types/core-subscreen/shards/coreButtonShard.d.ts +5 -0
- package/dist/types/core-subscreen/shards/coreCheckboxShard.d.ts +6 -0
- package/dist/types/core-subscreen/shards/coreInputListShard.d.ts +6 -0
- package/dist/types/core-subscreen/shards/coreSelectShard.d.ts +5 -0
- package/dist/types/core-subscreen/shards/coreTextShard.d.ts +4 -0
- package/dist/types/core-subscreen/shards/index.d.ts +5 -0
- package/dist/types/core-subscreen/toastsSubscreen.d.ts +5 -0
- package/dist/types/core.d.ts +18 -0
- package/dist/types/dialogs.d.ts +29 -0
- package/dist/types/index.d.ts +55 -3
- package/dist/types/localization.d.ts +4 -0
- package/dist/types/logging.d.ts +16 -0
- package/dist/types/messaging.d.ts +5 -3
- package/dist/types/{modsApi.d.ts → modSdk.d.ts} +2 -2
- package/dist/types/shard-modules/attributesModule.d.ts +7 -0
- package/dist/types/shard-modules/centerModule.d.ts +5 -0
- package/dist/types/shard-modules/clickModule.d.ts +7 -0
- package/dist/types/shard-modules/counterUpModule.d.ts +13 -0
- package/dist/types/shard-modules/dynamicClassModule.d.ts +8 -0
- package/dist/types/{ui-modules → shard-modules}/index.d.ts +2 -0
- package/dist/types/shard-modules/multiClickModule.d.ts +12 -0
- package/dist/types/shard-modules/shardModule.d.ts +7 -0
- package/dist/types/shard-modules/styleModule.d.ts +8 -0
- package/dist/types/shard-modules/typeModule.d.ts +11 -0
- package/dist/types/shards/backNextButtonShard.d.ts +14 -0
- package/dist/types/shards/buttonShard.d.ts +20 -0
- package/dist/types/shards/cardShard.d.ts +10 -0
- package/dist/types/shards/checkboxShard.d.ts +19 -0
- package/dist/types/shards/containerShard.d.ts +7 -0
- package/dist/types/shards/imageShard.d.ts +11 -0
- package/dist/types/shards/index.d.ts +13 -0
- package/dist/types/shards/inputListShard.d.ts +16 -0
- package/dist/types/shards/inputShard.d.ts +14 -0
- package/dist/types/shards/selectShard.d.ts +17 -0
- package/dist/types/shards/shard.d.ts +21 -0
- package/dist/types/shards/svgShard.d.ts +12 -0
- package/dist/types/shards/tabsShard.d.ts +17 -0
- package/dist/types/shards/textShard.d.ts +13 -0
- package/dist/types/toasts.d.ts +21 -0
- package/dist/types/ui.d.ts +30 -147
- package/dist/ui.js +351 -11
- package/dist/validation.js +31 -1
- package/dist/wardrobe.js +167 -1
- package/package.json +44 -26
- package/scripts/generateChangelog.mjs +80 -0
- package/dist/modsApi.js +0 -1
- package/dist/modules.js +0 -1
- package/dist/popups.js +0 -1
- package/dist/types/modules.d.ts +0 -18
- package/dist/types/popups.d.ts +0 -48
- package/dist/types/ui-modules/attributesModule.d.ts +0 -6
- package/dist/types/ui-modules/centerModule.d.ts +0 -4
- package/dist/types/ui-modules/clickModule.d.ts +0 -6
- package/dist/types/ui-modules/counterUpModule.d.ts +0 -12
- package/dist/types/ui-modules/dynamicClassModule.d.ts +0 -7
- package/dist/types/ui-modules/styleModule.d.ts +0 -7
- package/dist/types/ui-modules/typeModule.d.ts +0 -10
- package/dist/ui-modules/attributesModule.js +0 -1
- package/dist/ui-modules/centerModule.js +0 -1
- package/dist/ui-modules/clickModule.js +0 -1
- package/dist/ui-modules/counterUpModule.js +0 -1
- package/dist/ui-modules/dynamicClassModule.js +0 -1
- package/dist/ui-modules/index.js +0 -1
- package/dist/ui-modules/styleModule.js +0 -1
- package/dist/ui-modules/typeModule.js +0 -1
package/package.json
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "zois-core",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "The core for the my mods, which contains a shared code reused in all my mods",
|
|
5
|
+
"bin": {
|
|
6
|
+
"generate-changelog": "scripts/generateChangelog.mjs"
|
|
7
|
+
},
|
|
5
8
|
"author": "Zoi",
|
|
6
9
|
"license": "MIT",
|
|
7
10
|
"files": [
|
|
@@ -12,57 +15,72 @@
|
|
|
12
15
|
"import": "./dist/index.js",
|
|
13
16
|
"types": "./dist/types/index.d.ts"
|
|
14
17
|
},
|
|
18
|
+
"./core": {
|
|
19
|
+
"import": "./dist/core.js",
|
|
20
|
+
"types": "./dist/types/core.d.ts"
|
|
21
|
+
},
|
|
15
22
|
"./messaging": {
|
|
16
23
|
"import": "./dist/messaging.js",
|
|
17
24
|
"types": "./dist/types/messaging.d.ts"
|
|
18
25
|
},
|
|
19
|
-
"./
|
|
20
|
-
"import": "./dist/
|
|
21
|
-
"types": "./dist/types/
|
|
26
|
+
"./mod-sdk": {
|
|
27
|
+
"import": "./dist/modSdk.js",
|
|
28
|
+
"types": "./dist/types/modSdk.d.ts"
|
|
22
29
|
},
|
|
23
30
|
"./ui": {
|
|
24
31
|
"import": "./dist/ui.js",
|
|
25
32
|
"types": "./dist/types/ui.d.ts"
|
|
26
33
|
},
|
|
27
|
-
"./
|
|
28
|
-
"import": "./dist/
|
|
29
|
-
"types": "./dist/types/
|
|
34
|
+
"./shard-modules": {
|
|
35
|
+
"import": "./dist/shard-modules/index.js",
|
|
36
|
+
"types": "./dist/types/shard-modules/index.d.ts"
|
|
30
37
|
},
|
|
31
|
-
"./
|
|
32
|
-
"import": "./dist/
|
|
33
|
-
"types": "./dist/types/
|
|
38
|
+
"./shards": {
|
|
39
|
+
"import": "./dist/shards/index.js",
|
|
40
|
+
"types": "./dist/types/shards/index.d.ts"
|
|
34
41
|
},
|
|
35
42
|
"./wardrobe": {
|
|
36
43
|
"import": "./dist/wardrobe.js",
|
|
37
44
|
"types": "./dist/types/wardrobe.d.ts"
|
|
38
45
|
},
|
|
39
|
-
"./
|
|
40
|
-
"import": "./dist/
|
|
41
|
-
"types": "./dist/types/
|
|
46
|
+
"./dialogs": {
|
|
47
|
+
"import": "./dist/dialogs.js",
|
|
48
|
+
"types": "./dist/types/dialogs.d.ts"
|
|
49
|
+
},
|
|
50
|
+
"./toasts": {
|
|
51
|
+
"import": "./dist/toasts.js",
|
|
52
|
+
"types": "./dist/types/toasts.d.ts"
|
|
42
53
|
},
|
|
43
54
|
"./validation": {
|
|
44
55
|
"import": "./dist/validation.js",
|
|
45
56
|
"types": "./dist/types/validation.d.ts"
|
|
57
|
+
},
|
|
58
|
+
"./logging": {
|
|
59
|
+
"import": "./dist/logging.js",
|
|
60
|
+
"types": "./dist/types/logging.d.ts"
|
|
61
|
+
},
|
|
62
|
+
"./localization": {
|
|
63
|
+
"import": "./dist/localization.js",
|
|
64
|
+
"types": "./dist/types/localization.d.ts"
|
|
65
|
+
},
|
|
66
|
+
"./changelogs": {
|
|
67
|
+
"import": "./dist/changelogs.js",
|
|
68
|
+
"types": "./dist/types/changelogs.d.ts"
|
|
46
69
|
}
|
|
47
70
|
},
|
|
48
71
|
"dependencies": {
|
|
49
72
|
"bondage-club-mod-sdk": "^1.2.0",
|
|
50
73
|
"class-transformer": "^0.5.1",
|
|
51
|
-
"class-validator": "^0.14.
|
|
52
|
-
"lucide": "^
|
|
53
|
-
"
|
|
54
|
-
"react": "^19.1.0",
|
|
55
|
-
"react-dom": "^19.1.0",
|
|
56
|
-
"reflect-metadata": "^0.2.2",
|
|
57
|
-
"zustand": "^5.0.5"
|
|
74
|
+
"class-validator": "^0.14.4",
|
|
75
|
+
"lucide": "^1.24.0",
|
|
76
|
+
"reflect-metadata": "^0.2.2"
|
|
58
77
|
},
|
|
59
78
|
"devDependencies": {
|
|
60
|
-
"
|
|
61
|
-
"
|
|
62
|
-
"
|
|
63
|
-
"
|
|
64
|
-
"
|
|
65
|
-
"typescript": "^5.8.3"
|
|
79
|
+
"bc-stubs": "130.0.0-Beta.1",
|
|
80
|
+
"esbuild": "^0.28.1",
|
|
81
|
+
"nodemon": "^3.1.14",
|
|
82
|
+
"simple-git": "^3.36.0",
|
|
83
|
+
"typescript": "^5.9.3"
|
|
66
84
|
},
|
|
67
85
|
"scripts": {
|
|
68
86
|
"build": "node scripts/build.mjs"
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import simpleGit from "simple-git";
|
|
2
|
+
import fs from "fs/promises";
|
|
3
|
+
import path from "path";
|
|
4
|
+
|
|
5
|
+
const git = simpleGit({ baseDir: process.cwd() });
|
|
6
|
+
|
|
7
|
+
async function getUnpushedCommits() {
|
|
8
|
+
try {
|
|
9
|
+
const branchSummary = await git.branch();
|
|
10
|
+
const currentBranch = branchSummary.current;
|
|
11
|
+
|
|
12
|
+
const remoteBranch = `origin/${currentBranch}`;
|
|
13
|
+
|
|
14
|
+
try {
|
|
15
|
+
const log = await git.log([`${remoteBranch}..HEAD`]);
|
|
16
|
+
return log.all;
|
|
17
|
+
} catch (err) {
|
|
18
|
+
console.warn("No remote tracking branch found, returning all commits.");
|
|
19
|
+
const log = await git.log();
|
|
20
|
+
return log.all;
|
|
21
|
+
}
|
|
22
|
+
} catch (error) {
|
|
23
|
+
console.error("Error getting unpushed commits:", error.message);
|
|
24
|
+
return [];
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
async function getCommitsFromHash(hash) {
|
|
29
|
+
try {
|
|
30
|
+
const log = await git.log({
|
|
31
|
+
from: hash,
|
|
32
|
+
to: "HEAD"
|
|
33
|
+
});
|
|
34
|
+
return log.all;
|
|
35
|
+
} catch (error) {
|
|
36
|
+
console.error(`Error getting commits from hash ${hash}:`, error.message);
|
|
37
|
+
return [];
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
async function generateChangelog() {
|
|
42
|
+
const args = process.argv.slice(2);
|
|
43
|
+
let commits = [];
|
|
44
|
+
|
|
45
|
+
if (args.length > 0 && args[0].startsWith("--from=")) {
|
|
46
|
+
const hash = args[0].split("=")[1];
|
|
47
|
+
if (hash) {
|
|
48
|
+
console.log(`Generating changelog from commit ${hash}...`);
|
|
49
|
+
commits = await getCommitsFromHash(hash);
|
|
50
|
+
} else {
|
|
51
|
+
console.error("Invalid --from= hash provided.");
|
|
52
|
+
process.exit(1);
|
|
53
|
+
}
|
|
54
|
+
} else {
|
|
55
|
+
console.log("Generating changelog for unpushed commits...");
|
|
56
|
+
commits = await getUnpushedCommits();
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
const changelog = commits.map((commit) => ({
|
|
60
|
+
hash: commit.hash,
|
|
61
|
+
author: commit.author_name || commit.author || "Unknown",
|
|
62
|
+
message: commit.message || commit.body || "",
|
|
63
|
+
date: commit.date
|
|
64
|
+
}));
|
|
65
|
+
|
|
66
|
+
const outputPath = path.join(process.cwd(), "changelog.json");
|
|
67
|
+
|
|
68
|
+
await fs.writeFile(
|
|
69
|
+
outputPath,
|
|
70
|
+
JSON.stringify(changelog, null, 2),
|
|
71
|
+
"utf-8"
|
|
72
|
+
);
|
|
73
|
+
|
|
74
|
+
console.log(`Generated changelog.json. (${changelog.length} commits)`);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
generateChangelog().catch((err) => {
|
|
78
|
+
console.error("❌ Script failed:", err.message);
|
|
79
|
+
process.exit(1);
|
|
80
|
+
});
|
package/dist/modsApi.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import s from"bondage-club-mod-sdk";import{MOD_DATA as i}from"./index";import{getCurrentSubscreen as a}from"./ui";var d=(n=>(n[n.OBSERVE=0]="OBSERVE",n[n.ADD_BEHAVIOR=1]="ADD_BEHAVIOR",n[n.MODIFY_BEHAVIOR=5]="MODIFY_BEHAVIOR",n[n.OVERRIDE_BEHAVIOR=10]="OVERRIDE_BEHAVIOR",n[n.TOP=100]="TOP",n))(d||{});let o;function T(){o=s.registerMod({name:i.name,fullName:i.fullName,version:i.version,repository:i.repository}),c("GameKeyDown",1,(e,t)=>{const r=a();return CommonKey.IsPressed(e[0],"Escape")&&r?(r.exit(),!1):t(e)})}function c(e,t,r){if(!o)throw new Error("zois-core is not registered");return o.hookFunction(e,t,r)}function h(e,t){if(!o)throw new Error("zois-core is not registered");o.patchFunction(e,t)}function I(e,t,r){if(!o)throw new Error("zois-core is not registered");return o.callOriginal(e,t)}function x(){return s.getModsInfo()}function E(e){return!!s.getModsInfo().find(t=>t.name===e)}export{d as HookPriority,I as callOriginal,E as findModByName,x as getLoadedMods,c as hookFunction,o as modSdk,h as patchFunction,T as registerMod};
|
package/dist/modules.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
class r{overrideProperties(e,t){return e}layoutEffect(e,t){}effect(e,t){}}export{r as BaseModule};
|
package/dist/popups.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{getRelativeX as D,getRelativeY as x}from"./ui";import{MOD_DATA as d}from"./index";import{useState as p,useEffect as u,useRef as E}from"react";import k from"react-dom/client";import{create as S}from"zustand";import{CircleAlert as I,CircleCheck as O,CircleX as P,Info as z}from"lucide-react";import{Fragment as f,jsx as i,jsxs as l}from"react/jsx-runtime";const R=({children:s})=>{const[e,o]=p({}),r=window.ZOISCORE.useToastsStore(t=>t.clearToasts);return u(()=>{const t=()=>{o({fontFamily:CommonGetFontName(),bottom:x(5)+"px",left:D(5)+"px"})};return window.addEventListener("resize",t),t(),()=>{window.removeEventListener("resize",t)}},[]),i("div",{className:"zcToastsContainer",style:e,onClick:()=>{document.querySelectorAll(".zcToast").forEach(t=>{t.classList.add("exiting")}),setTimeout(r,300)},children:s})},M=({type:s,theme:e})=>{switch(s){case"info":return i(z,{style:{flexShrink:0,width:"1.65em",height:"1.65em",fill:e?e.iconFillColor:"#addbff",stroke:e?e.iconStrokeColor:"#385073"}});case"success":return i(O,{style:{flexShrink:0,width:"1.65em",height:"1.65em",fill:e?e.iconFillColor:"#c3ffc3",stroke:e?e.iconStrokeColor:"#028f74"}});case"warning":return i(I,{style:{flexShrink:0,width:"1.65em",height:"1.65em",fill:e?e.iconFillColor:"#ffdfaf",stroke:e?e.iconStrokeColor:"#9c7633"}});case"error":return i(P,{style:{flexShrink:0,width:"1.65em",height:"1.65em",fill:e?e.iconFillColor:"#ffb2b2",stroke:e?e.iconStrokeColor:"#7f2828"}});case"spinner":return i("div",{style:{flexShrink:0,width:"1.65em",height:"1.65em",boxSizing:"border-box",border:"2px solid",borderRadius:"100%",borderColor:`transparent ${e?e.iconFillColor:"rgb(154 154 255)"}`,animation:"zcSpin 0.65s linear infinite"}})}},F=({title:s,message:e,type:o,duration:r,theme:t})=>{const[n,a]=p({}),[c,m]=p(!1),h=t?t.backgroundColor:o==="success"?"#3ece7e":o==="warning"?"#debf72":o==="error"?"rgb(212, 46, 107)":"rgb(80, 80, 223)",C=t?t.titleColor:o==="info"||o==="spinner"?"rgb(47, 46, 104)":o==="success"?"#244428":o==="error"?"rgb(113, 2, 2)":"#5e4328",T=t?t.messageColor:o==="info"||o==="spinner"?"#b8b8ff":o==="success"?"#c7f9c7":o==="error"?"rgb(255, 152, 152)":"#ffeec5";return u(()=>{const g=()=>{const w=MainCanvas.canvas.clientWidth,b=MainCanvas.canvas.clientHeight,v=Math.min(w,b)/100;a({position:"relative",width:"100%",fontSize:3*v+"px",padding:1.5*v+"px",background:h})};window.addEventListener("resize",g),g();const y=setTimeout(()=>m(!0),r);return()=>{clearTimeout(y),window.removeEventListener("resize",g)}},[]),l("div",{className:`zcToast ${c&&"exiting"}`,"data-zc-toast-type":o,style:n,children:[l("div",{style:{display:"flex",alignItems:"center",gap:"1vw",position:"relative",zIndex:5},children:[i(M,{type:o,theme:t}),l("div",{children:[s&&e&&l(f,{children:[i("p",{style:{color:C,fontWeight:"bold"},children:s}),i("p",{style:{color:T,fontSize:"70%",fontWeight:"bold",overflowWrap:"anywhere",marginTop:"0.25em"},children:e})]}),(!s&&e||s&&!e)&&i("p",{style:{position:"relative",zIndex:5,color:T,fontWeight:"bold",overflowWrap:"anywhere"},children:s||e})]})]}),o!=="spinner"&&i("div",{className:"zcToast-ProgressBar",style:{animation:`zcToast-progress ${r}ms linear 0s 1 alternate none`,position:"absolute",top:0,left:0,height:"100%",borderRadius:"4px",background:t?t.progressBarColor:o==="info"?"rgb(103, 103, 234)":o==="success"?"#34bc71":o==="warning"?"#d0af5e":"rgb(183, 40, 92)"}})]})};function W({dialog:s}){const e=window.ZOISCORE.useDialogStore(a=>a.clearDialog),[o,r]=p(""),t=E(null),n=a=>{a.key==="Enter"&&(e(),s.promise.resolve(s.type==="prompt"?o:!0))};return u(()=>(document.body.style.pointerEvents="none",s.type==="prompt"&&t.current instanceof HTMLInputElement&&t.current.focus(),document.addEventListener("keypress",n),()=>{document.body.style.pointerEvents="",document.removeEventListener("keypress",n)}),[]),l(f,{children:[l("dialog",{className:"zcDialog","data-zc-dialog-type":s.type,style:{fontFamily:CommonGetFontName()},children:[i("p",{children:s.message}),s.type==="prompt"&&i("input",{ref:t,type:"text",style:{color:"white",marginTop:"1px",width:"90%",background:"rgb(82, 89, 104)",border:"none",borderRadius:"4px",padding:"0.45em"},onChange:a=>r(a.currentTarget.value)}),l("div",{style:{display:"flex",justifyContent:"end",columnGap:"0.75em",width:"100%",padding:"1em"},children:[i("button",{onClick:()=>{e(),s.promise.resolve(!1)},children:"Cancel"}),i("button",{onClick:()=>{e(),s.promise.resolve(s.type==="prompt"?o:!0)},children:"Ok"})]})]}),i("div",{style:{position:"fixed",top:"0",left:"0",width:"100%",height:"100%",zIndex:"20",opacity:"0.5",background:"black"}})]})}class L{generateToastId(){return crypto.randomUUID()}process({title:e,message:o,duration:r,type:t,id:n,theme:a}){const{addToast:c,removeToast:m}=window.ZOISCORE.useToastsStore.getState();c({id:n,title:e,message:o,duration:r,type:t,theme:a}),setTimeout(()=>m(n),r+300)}info({title:e,message:o,duration:r}){const t=this.generateToastId(),n=d.singleToastsTheme;this.process({title:e,message:o,duration:r,type:"info",id:t,theme:n})}success({title:e,message:o,duration:r}){const t=this.generateToastId(),n=d.singleToastsTheme;this.process({title:e,message:o,duration:r,type:"success",id:t,theme:n})}warn({title:e,message:o,duration:r}){const t=this.generateToastId(),n=d.singleToastsTheme;this.process({title:e,message:o,duration:r,type:"warning",id:t,theme:n})}error({title:e,message:o,duration:r}){const t=this.generateToastId(),n=d.singleToastsTheme;this.process({title:e,message:o,duration:r,type:"error",id:t,theme:n})}spinner({title:e,message:o}){const r=this.generateToastId(),t=d.singleToastsTheme;return this.process({title:e,message:o,duration:1e6,type:"spinner",id:r,theme:t}),r}removeSpinner(e){const{removeToast:o}=window.ZOISCORE.useToastsStore.getState();o(e)}}class N{prompt({message:e}){const{setDialog:o}=window.ZOISCORE.useDialogStore.getState();return new Promise((r,t)=>{o({type:"prompt",message:e,promise:{resolve:r,reject:t}})})}confirm({message:e}){const{setDialog:o}=window.ZOISCORE.useDialogStore.getState();return new Promise((r,t)=>{o({type:"confirm",message:e,promise:{resolve:r,reject:t}})})}}function Z(){const s=window.ZOISCORE.useToastsStore(o=>o.toasts),e=window.ZOISCORE.useDialogStore(o=>o.dialog);return l(f,{children:[i(R,{children:s.map(({title:o,message:r,type:t,duration:n,id:a,theme:c})=>i(F,{id:a,title:o,message:r,type:t,duration:n,theme:c},a))}),e&&i(W,{dialog:e})]})}class A extends HTMLElement{disconnectedCallback(){ServerShowBeep("VirtualDOM was removed, chaos is coming...",5e3,{})}}const ee=S(s=>({toasts:[],addToast:e=>s(o=>({toasts:[...o.toasts,e]})),removeToast:e=>s(o=>({toasts:o.toasts.filter(r=>r.id!==e)})),clearToasts:()=>s({toasts:[]})})),oe=S(s=>({dialog:null,setDialog:e=>s({dialog:e}),clearDialog:()=>s({dialog:null})}));function te(){customElements.define("zc-virtual-dom",A);const s=document.createElement("zc-virtual-dom");document.body.append(s),k.createRoot(document.getElementsByTagName("zc-virtual-dom")[0]).render(i(Z,{}))}const se=new L,re=new N;export{re as dialogsManager,te as initVirtualDOM,se as toastsManager,oe as useDialogStore,ee as useToastsStore};
|
package/dist/types/modules.d.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { Anchor } from "./ui";
|
|
2
|
-
export interface Context {
|
|
3
|
-
anchor?: Anchor;
|
|
4
|
-
x?: number;
|
|
5
|
-
y?: number;
|
|
6
|
-
width?: number;
|
|
7
|
-
height?: number;
|
|
8
|
-
padding?: number;
|
|
9
|
-
fontSize?: number | "auto";
|
|
10
|
-
place?: boolean;
|
|
11
|
-
element: HTMLElement;
|
|
12
|
-
}
|
|
13
|
-
export type ModuleTarget = HTMLElement | SVGElement;
|
|
14
|
-
export declare abstract class BaseModule {
|
|
15
|
-
overrideProperties(context: Context, target: ModuleTarget): Context;
|
|
16
|
-
layoutEffect(context: Context, target: ModuleTarget): void;
|
|
17
|
-
effect(context: Context, target: ModuleTarget): void;
|
|
18
|
-
}
|
package/dist/types/popups.d.ts
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { ModData } from "./index";
|
|
2
|
-
interface ToastProps {
|
|
3
|
-
id: string;
|
|
4
|
-
title?: string;
|
|
5
|
-
message: string;
|
|
6
|
-
type: "info" | "warning" | "error" | "success" | "spinner";
|
|
7
|
-
duration: number;
|
|
8
|
-
theme?: ModData["singleToastsTheme"];
|
|
9
|
-
}
|
|
10
|
-
interface DialogProps {
|
|
11
|
-
type: "prompt" | "confirm";
|
|
12
|
-
message: string;
|
|
13
|
-
promise: {
|
|
14
|
-
resolve: (data: any) => void;
|
|
15
|
-
reject: (data: any) => void;
|
|
16
|
-
};
|
|
17
|
-
}
|
|
18
|
-
declare class ToastsManager {
|
|
19
|
-
private generateToastId;
|
|
20
|
-
private process;
|
|
21
|
-
info({ title, message, duration }: Omit<ToastProps, "type" | "id" | "theme">): void;
|
|
22
|
-
success({ title, message, duration }: Omit<ToastProps, "type" | "id" | "theme">): void;
|
|
23
|
-
warn({ title, message, duration }: Omit<ToastProps, "type" | "id" | "theme">): void;
|
|
24
|
-
error({ title, message, duration }: Omit<ToastProps, "type" | "id" | "theme">): void;
|
|
25
|
-
spinner({ title, message }: Omit<ToastProps, "type" | "id" | "duration" | "theme">): string;
|
|
26
|
-
removeSpinner(id: string): void;
|
|
27
|
-
}
|
|
28
|
-
declare class DialogsManager {
|
|
29
|
-
prompt({ message }: Omit<DialogProps, "type" | "promise">): Promise<string | false>;
|
|
30
|
-
confirm({ message }: Omit<DialogProps, "type" | "promise">): Promise<boolean>;
|
|
31
|
-
}
|
|
32
|
-
export interface ToastsStore {
|
|
33
|
-
toasts: ToastProps[];
|
|
34
|
-
addToast: (toast: ToastProps) => void;
|
|
35
|
-
removeToast: (id: string) => void;
|
|
36
|
-
clearToasts: () => void;
|
|
37
|
-
}
|
|
38
|
-
export interface DialogStore {
|
|
39
|
-
dialog: DialogProps | null;
|
|
40
|
-
setDialog: (props: DialogProps) => void;
|
|
41
|
-
clearDialog: () => void;
|
|
42
|
-
}
|
|
43
|
-
export declare const useToastsStore: import("zustand").UseBoundStore<import("zustand").StoreApi<ToastsStore>>;
|
|
44
|
-
export declare const useDialogStore: import("zustand").UseBoundStore<import("zustand").StoreApi<DialogStore>>;
|
|
45
|
-
export declare function initVirtualDOM(): void;
|
|
46
|
-
export declare const toastsManager: ToastsManager;
|
|
47
|
-
export declare const dialogsManager: DialogsManager;
|
|
48
|
-
export {};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { BaseModule, Context, ModuleTarget } from "../modules";
|
|
2
|
-
interface CounterUpModuleProps {
|
|
3
|
-
duration: number;
|
|
4
|
-
endValue: number;
|
|
5
|
-
formattingFunction?: (value: number) => string;
|
|
6
|
-
}
|
|
7
|
-
export declare class CounterUpModule extends BaseModule {
|
|
8
|
-
private props;
|
|
9
|
-
constructor(props: CounterUpModuleProps);
|
|
10
|
-
effect(context: Context, target: ModuleTarget): void;
|
|
11
|
-
}
|
|
12
|
-
export {};
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { DynamicClassStyles } from "../ui";
|
|
2
|
-
import { BaseModule, Context, ModuleTarget } from "../modules";
|
|
3
|
-
export declare class DynamicClassModule extends BaseModule {
|
|
4
|
-
private style;
|
|
5
|
-
constructor(style: DynamicClassStyles);
|
|
6
|
-
layoutEffect(context: Context, target: ModuleTarget): void;
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { BaseModule, Context, ModuleTarget } from "../modules";
|
|
2
|
-
export declare class StyleModule extends BaseModule {
|
|
3
|
-
private style;
|
|
4
|
-
constructor(style: Partial<CSSStyleDeclaration>);
|
|
5
|
-
private applyStyle;
|
|
6
|
-
layoutEffect(context: Context, target: ModuleTarget): void;
|
|
7
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { BaseModule, Context, ModuleTarget } from "../modules";
|
|
2
|
-
interface TypeModuleProps {
|
|
3
|
-
duration: number;
|
|
4
|
-
}
|
|
5
|
-
export declare class TypeModule extends BaseModule {
|
|
6
|
-
private props;
|
|
7
|
-
constructor(props: TypeModuleProps);
|
|
8
|
-
effect(context: Context, target: ModuleTarget): void;
|
|
9
|
-
}
|
|
10
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{BaseModule as o}from"../modules";class c extends o{constructor(e){super();this.attributes=e}layoutEffect(e,r){for(const t of Object.keys(this.attributes))r.setAttribute(t,this.attributes[t])}}export{c as AttributesModule};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{BaseModule as r}from"../modules";class l extends r{overrideProperties(e){return e.element.style.cssText+="transform: translate(-50%, -50%);",e.x=1e3,e.y=500,e}}export{l as CenterModule};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{BaseModule as o}from"zois-core/modules";class i extends o{constructor(t){super();this.callback=t}layoutEffect(t,e){e.addEventListener("click",()=>this.callback(e))}}export{i as ClickModule};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{BaseModule as d}from"../modules";function f(n,a,r,e){if(!n)throw new Error("Element not found");let s=0,o,t;const i=m=>{o||(o=m);const l=m-o;let u=Math.min(l/r,1);const c=u*(2-u),p=parseInt(s+(a-s)*c);n.textContent=typeof e=="function"?e(p):p.toString(),u<1&&(t=requestAnimationFrame(i))};t&&cancelAnimationFrame(t),t=requestAnimationFrame(i)}class x extends d{constructor(r){super();this.props=r}effect(r,e){f(e,this.props.endValue,this.props.duration,this.props.formattingFunction)}}export{x as CounterUpModule};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{addDynamicClass as s}from"../ui";import{BaseModule as a}from"../modules";class y extends a{constructor(t){super();this.style=t}layoutEffect(t,e){s(e,this.style)}}export{y as DynamicClassModule};
|
package/dist/ui-modules/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export*from"./centerModule";export*from"./counterUpModule";export*from"./typeModule";export*from"./styleModule";export*from"./dynamicClassModule";export*from"./attributesModule";export*from"./clickModule";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{BaseModule as a}from"../modules";class u extends a{constructor(o){super();this.style=o}applyStyle(o,t){for(const e of Object.keys(t))!isNaN(e)||typeof t[e]=="function"||(o.style[e]=t[e])}layoutEffect(o,t){this.applyStyle(t,this.style)}}export{u as StyleModule};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{BaseModule as d}from"../modules";function l(e,o){if(!e)throw new Error("Element not found");const t=e.textContent;e.textContent="\xA0",e.classList.add("zcCursor");let r,n;const s=u=>{r||(r=u);const c=u-r;let a=Math.min(c/o,1);const i=t.slice(0,parseInt(t.length*a));i.trim()!==""&&(e.textContent=i),a<1?n=requestAnimationFrame(s):setTimeout(()=>e.classList.remove("zcCursor"),o/t.length)};n=requestAnimationFrame(s)}class x extends d{constructor(t){super();this.props=t}effect(t,r){l(r,this.props.duration)}}export{x as TypeModule};
|