@lukaskj/xmonkey 2.0.1

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.
Files changed (62) hide show
  1. package/README.md +3 -0
  2. package/dist/cjs/decorators/console-script.decorator.d.ts +3 -0
  3. package/dist/cjs/decorators/console-script.decorator.js +13 -0
  4. package/dist/cjs/decorators/ui-script.decorator.d.ts +4 -0
  5. package/dist/cjs/decorators/ui-script.decorator.js +25 -0
  6. package/dist/cjs/esbuild/build.d.ts +1 -0
  7. package/dist/cjs/esbuild/build.js +100 -0
  8. package/dist/cjs/esbuild/plugins/xmonkey-strip-metadata-plugin.d.ts +2 -0
  9. package/dist/cjs/esbuild/plugins/xmonkey-strip-metadata-plugin.js +142 -0
  10. package/dist/cjs/esbuild/plugins/xmonkey-styles-plugin.d.ts +2 -0
  11. package/dist/cjs/esbuild/plugins/xmonkey-styles-plugin.js +85 -0
  12. package/dist/cjs/example-scripts/example-console-script.d.ts +4 -0
  13. package/dist/cjs/example-scripts/example-console-script.js +87 -0
  14. package/dist/cjs/example-scripts/example-ui-script.d.ts +6 -0
  15. package/dist/cjs/example-scripts/example-ui-script.js +40 -0
  16. package/dist/cjs/index.d.ts +3 -0
  17. package/dist/cjs/index.js +27 -0
  18. package/dist/cjs/interfaces/console-script.interface.d.ts +6 -0
  19. package/dist/cjs/interfaces/console-script.interface.js +7 -0
  20. package/dist/cjs/interfaces/index.d.ts +2 -0
  21. package/dist/cjs/interfaces/index.js +18 -0
  22. package/dist/cjs/interfaces/ui-script.interface.d.ts +5 -0
  23. package/dist/cjs/interfaces/ui-script.interface.js +2 -0
  24. package/dist/cjs/types.d.ts +28 -0
  25. package/dist/cjs/types.js +2 -0
  26. package/dist/cjs/ui/x-monkey-window-component.d.ts +7 -0
  27. package/dist/cjs/ui/x-monkey-window-component.js +18 -0
  28. package/dist/cjs/utils/is-null-or-undefined.d.ts +2 -0
  29. package/dist/cjs/utils/is-null-or-undefined.js +9 -0
  30. package/dist/cjs/utils/sleep.d.ts +1 -0
  31. package/dist/cjs/utils/sleep.js +7 -0
  32. package/dist/esm/decorators/console-script.decorator.d.ts +3 -0
  33. package/dist/esm/decorators/console-script.decorator.js +9 -0
  34. package/dist/esm/decorators/ui-script.decorator.d.ts +4 -0
  35. package/dist/esm/decorators/ui-script.decorator.js +21 -0
  36. package/dist/esm/esbuild/build.d.ts +1 -0
  37. package/dist/esm/esbuild/build.js +73 -0
  38. package/dist/esm/esbuild/plugins/xmonkey-strip-metadata-plugin.d.ts +2 -0
  39. package/dist/esm/esbuild/plugins/xmonkey-strip-metadata-plugin.js +138 -0
  40. package/dist/esm/esbuild/plugins/xmonkey-styles-plugin.d.ts +2 -0
  41. package/dist/esm/esbuild/plugins/xmonkey-styles-plugin.js +81 -0
  42. package/dist/esm/example-scripts/example-console-script.d.ts +4 -0
  43. package/dist/esm/example-scripts/example-console-script.js +84 -0
  44. package/dist/esm/example-scripts/example-ui-script.d.ts +6 -0
  45. package/dist/esm/example-scripts/example-ui-script.js +37 -0
  46. package/dist/esm/index.d.ts +3 -0
  47. package/dist/esm/index.js +11 -0
  48. package/dist/esm/interfaces/console-script.interface.d.ts +6 -0
  49. package/dist/esm/interfaces/console-script.interface.js +6 -0
  50. package/dist/esm/interfaces/index.d.ts +2 -0
  51. package/dist/esm/interfaces/index.js +2 -0
  52. package/dist/esm/interfaces/ui-script.interface.d.ts +5 -0
  53. package/dist/esm/interfaces/ui-script.interface.js +1 -0
  54. package/dist/esm/types.d.ts +28 -0
  55. package/dist/esm/types.js +1 -0
  56. package/dist/esm/ui/x-monkey-window-component.d.ts +7 -0
  57. package/dist/esm/ui/x-monkey-window-component.js +14 -0
  58. package/dist/esm/utils/is-null-or-undefined.d.ts +2 -0
  59. package/dist/esm/utils/is-null-or-undefined.js +4 -0
  60. package/dist/esm/utils/sleep.d.ts +1 -0
  61. package/dist/esm/utils/sleep.js +3 -0
  62. package/package.json +85 -0
@@ -0,0 +1,28 @@
1
+ export type ScriptInfo = {
2
+ "@name": string;
3
+ "@namespace": string;
4
+ "@match": string;
5
+ "@version": string;
6
+ "@author": string;
7
+ "@description": string;
8
+ "@grant"?: string[];
9
+ [k: string]: unknown;
10
+ };
11
+ export type NonFunctionPropertyNames<T> = {
12
+ [K in keyof T]: T[K] extends Function ? never : K;
13
+ }[keyof T];
14
+ export type NonFunctionProperties<T> = Pick<T, NonFunctionPropertyNames<T>>;
15
+ export type FunctionPropertyNames<T> = {
16
+ [K in keyof T]: T[K] extends Function ? K : never;
17
+ }[keyof T];
18
+ export type ClassConstructor<T> = {
19
+ new (..._: any[]): T;
20
+ };
21
+ export type Self<T> = ClassConstructor<T>;
22
+ export type AnyObject = {
23
+ [key: string]: any;
24
+ };
25
+ export type AnyType = string | number | boolean | AnyObject;
26
+ export type WithRequired<T, K extends keyof T> = T & {
27
+ [P in K]-?: T[P];
28
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,7 @@
1
+ import { ComponentChildren } from "preact";
2
+ type VProps = {
3
+ title: string;
4
+ children?: ComponentChildren;
5
+ };
6
+ export declare function XMonkeyWindowComponent(props: VProps): import("preact").JSX.Element;
7
+ export {};
@@ -0,0 +1,14 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "preact/jsx-runtime";
2
+ import { useState } from "preact/hooks";
3
+ export function XMonkeyWindowComponent(props) {
4
+ var _a = useState(false), minimized = _a[0], setMinimized = _a[1];
5
+ function toggleMinimize() {
6
+ setMinimized(!minimized);
7
+ }
8
+ return (_jsxs("div", { className: "xmwr_c d--f fd--c ai--c jc--sb", children: [_jsxs("div", { className: "xmwr-h w-100 m0 d--f fd--r jc--c bg-primary noselect", children: [_jsx("div", { className: "xmwr-title m0", children: props.title }), _jsx(MinimizeButton, { toggleMinimize: toggleMinimize, minimized: minimized })] }), _jsx("div", { className: "xmwr-b w-100 d--f jc--c " + (minimized ? "b-collapsed" : ""), children: props.children })] }));
9
+ }
10
+ function MinimizeButton(_a) {
11
+ var minimized = _a.minimized, toggleMinimize = _a.toggleMinimize;
12
+ var minimizeChar = minimized ? "+" : "-";
13
+ return (_jsx("div", { className: "xmwr-x m0", onClick: function () { return toggleMinimize(); }, children: minimizeChar }));
14
+ }
@@ -0,0 +1,2 @@
1
+ export declare const isNullOrUndefined: (value: any) => value is null | undefined;
2
+ export declare function isNullOrEmptyOrUndefined(value?: any | null): value is null | undefined;
@@ -0,0 +1,4 @@
1
+ export var isNullOrUndefined = function (value) { return value === null || value === undefined; };
2
+ export function isNullOrEmptyOrUndefined(value) {
3
+ return isNullOrUndefined(value) || value === "" || value.toString().trim() === "";
4
+ }
@@ -0,0 +1 @@
1
+ export declare function sleep(ms: number): Promise<void>;
@@ -0,0 +1,3 @@
1
+ export function sleep(ms) {
2
+ return new Promise(function (resolve) { return setTimeout(resolve, ms); });
3
+ }
package/package.json ADDED
@@ -0,0 +1,85 @@
1
+ {
2
+ "name": "@lukaskj/xmonkey",
3
+ "version": "2.0.1",
4
+ "author": "lukaskj",
5
+ "license": "ISC",
6
+ "scripts": {
7
+ "clean": "rimraf dist coverage .rollup.cache",
8
+ "prebuild": "pnpm run clean",
9
+ "prepublish": "pnpm run build",
10
+ "build:old": "node esbuild/build.mjs",
11
+ "build": "pnpm build:esm && pnpm build:cjs",
12
+ "build:esm": "tsc -p tsconfig.build.json --outDir dist/esm",
13
+ "build:cjs": "tsc -p tsconfig.build.json --module CommonJS --outDir dist/cjs",
14
+ "build:prod": "pnpm run lint && pnpm run build",
15
+ "build:dev": "DEBUG=1 node esbuild/build.mjs",
16
+ "build:debug": "DEBUG=1 node esbuild/build.mjs",
17
+ "dev": "nodemon",
18
+ "start": "tsx --watch ./src/index.ts",
19
+ "format": "prettier --write src/",
20
+ "lint": "tsc --noEmit && eslint \"{src,apps,libs,test}/**/*.{ts,tsx}\" --fix",
21
+ "test": "jest --config ./jest.config.js --maxWorkers=1",
22
+ "test:watch": "pnpm run test -- --watch",
23
+ "test:cov": "pnpm run test -- --coverage",
24
+ "test:debug": "-- node --inspect=0.0.0.0:5001 -r ts-node/register node_modules/jest/bin/jest.js --runInBand --config ./jest.config.js",
25
+ "prepare": "husky"
26
+ },
27
+ "dependencies": {
28
+ "esbuild-sass-plugin": "^3.1.0",
29
+ "preact": "^10.19.6",
30
+ "postcss": "^8.4.35",
31
+ "postcss-modules": "^6.0.0",
32
+ "esbuild": "^0.20.1"
33
+ },
34
+ "devDependencies": {
35
+ "@faker-js/faker": "^8.4.1",
36
+ "@types/jest": "^29.5.12",
37
+ "@types/node": "^20.11.25",
38
+ "@typescript-eslint/eslint-plugin": "^7.1.1",
39
+ "@typescript-eslint/parser": "^7.1.1",
40
+ "eslint": "^8.57.0",
41
+ "eslint-config-prettier": "^9.1.0",
42
+ "eslint-plugin-import": "^2.29.1",
43
+ "eslint-plugin-jest": "^27.9.0",
44
+ "eslint-plugin-prettier": "^5.1.3",
45
+ "husky": "^9.0.11",
46
+ "jest": "^29.7.0",
47
+ "lint-staged": "^15.2.2",
48
+ "nodemon": "^3.1.0",
49
+ "prettier": "^3.2.5",
50
+ "rimraf": "^5.0.5",
51
+ "ts-jest": "^29.1.2",
52
+ "tsx": "^4.7.1",
53
+ "typescript": "^5.3.0"
54
+ },
55
+ "engines": {
56
+ "node": ">=20"
57
+ },
58
+ "repository": {
59
+ "type": "git",
60
+ "url": "git+https://github.com/lukaskj/xmonkey.git"
61
+ },
62
+ "bugs": {
63
+ "url": "https://github.com/lukaskj/xmonkey/issues"
64
+ },
65
+ "homepage": "https://github.com/lukaskj/xmonkey#readme",
66
+ "lint-staged": {
67
+ "*.{js,mjs,ts,tsx,jsx}": "eslint --fix"
68
+ },
69
+ "exports": {
70
+ ".": "./dist/**/*",
71
+ "./decorators": "./dist/decorators/*",
72
+ "./interfaces": "./dist/interfaces/*"
73
+ },
74
+ "main": "dist/cjs/index.js",
75
+ "module": "dist/esm/index.js",
76
+ "types": "dist/index.d.js",
77
+ "files": [
78
+ "dist",
79
+ "!**/test/**",
80
+ "!node_modules"
81
+ ],
82
+ "bin": {
83
+ "xmonkey": "dist/cjs/index.js"
84
+ }
85
+ }