jabroni-outfit 1.4.3 → 1.4.5
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/dist/index.d.ts +10 -1
- package/dist/jabroni-outfit.es.js +99 -83
- package/dist/jabroni-outfit.es.js.map +1 -1
- package/dist/jabroni-outfit.umd.js +7 -7
- package/dist/jabroni-outfit.umd.js.map +1 -1
- package/package.json +3 -14
- package/src/test/example.ts +4 -6
- package/src/ui/index.ts +20 -6
- package/src/ui/types.ts +9 -1
- package/src/ui/vue-templates/App.vue +17 -5
- package/src/ui/vue-templates/RowElement.vue +0 -1
package/package.json
CHANGED
|
@@ -1,17 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "jabroni-outfit",
|
|
3
3
|
"description": "out-of-the-box gui and persistent-state library based on vue",
|
|
4
|
-
"version": "1.4.
|
|
4
|
+
"version": "1.4.5",
|
|
5
5
|
"license": "MIT",
|
|
6
|
-
"keywords": [
|
|
7
|
-
"gui",
|
|
8
|
-
"tweaks",
|
|
9
|
-
"ui",
|
|
10
|
-
"persistent-state",
|
|
11
|
-
"state-management",
|
|
12
|
-
"typescript",
|
|
13
|
-
"vue"
|
|
14
|
-
],
|
|
6
|
+
"keywords": ["gui", "tweaks", "ui", "persistent-state", "state-management", "typescript", "vue"],
|
|
15
7
|
"author": "smartacephale atm.mormon@protonmail.com (https://github.com/smartacephale)",
|
|
16
8
|
"type": "module",
|
|
17
9
|
"homepage": "https://github.com/smartacephale/jabroni-outfit#readme",
|
|
@@ -32,10 +24,7 @@
|
|
|
32
24
|
"types": "./dist/index.d.ts"
|
|
33
25
|
}
|
|
34
26
|
},
|
|
35
|
-
"files": [
|
|
36
|
-
"src/**/*",
|
|
37
|
-
"dist/**/*"
|
|
38
|
-
],
|
|
27
|
+
"files": ["src/**/*", "dist/**/*"],
|
|
39
28
|
"scripts": {
|
|
40
29
|
"dev": "vite",
|
|
41
30
|
"build": "vue-tsc && vite build",
|
package/src/test/example.ts
CHANGED
|
@@ -8,9 +8,7 @@ const example1 = () => {
|
|
|
8
8
|
(defaultSchemeWithPrivateFilter as any).privateFilter.push(
|
|
9
9
|
{ type: "button", innerText: "check access 🔓", callback: () => { } });
|
|
10
10
|
const store = new JabroniOutfitStore(defaultStateWithDurationAndPrivacy);
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
console.log(store, ui);
|
|
11
|
+
new JabroniOutfitUI(store, defaultSchemeWithPrivateFilter);
|
|
14
12
|
|
|
15
13
|
store.subscribe((subj) => {
|
|
16
14
|
const satisfy = /filter/gi.test(Object.keys(subj)[0]);
|
|
@@ -29,12 +27,12 @@ const example2 = () => {
|
|
|
29
27
|
// biome-ignore lint/suspicious/noExplicitAny: <explanation>
|
|
30
28
|
const store = new JabroniOutfitStore(myState as any);
|
|
31
29
|
|
|
32
|
-
|
|
30
|
+
new JabroniOutfitUI(store, {
|
|
33
31
|
gradientColor1: [{ type: "text", model: "stateLocale.gradientColor1", placeholder: "color", labelBefore: "color1" }],
|
|
34
32
|
gradientColor2: [{ type: "text", model: "stateLocale.gradientColor2", placeholder: "color", labelBefore: "color2" }],
|
|
35
33
|
gradientColor3: [{ type: "text", model: "stateLocale.gradientColor3", placeholder: "color", labelBefore: "color3" }],
|
|
36
34
|
gradientEnabled: [{ type: "checkbox", model: "stateLocale.gradientEnabled", labelBefore: "gradient enabled" }],
|
|
37
|
-
});
|
|
35
|
+
}, '#lol', { fixed: false });
|
|
38
36
|
|
|
39
37
|
function drawGradient() {
|
|
40
38
|
// biome-ignore lint/suspicious/noExplicitAny: <explanation>
|
|
@@ -47,5 +45,5 @@ const example2 = () => {
|
|
|
47
45
|
store.subscribe(drawGradient);
|
|
48
46
|
}
|
|
49
47
|
|
|
50
|
-
|
|
48
|
+
example1();
|
|
51
49
|
example2();
|
package/src/ui/index.ts
CHANGED
|
@@ -1,15 +1,29 @@
|
|
|
1
1
|
import { createApp } from "vue";
|
|
2
2
|
import { DefaultScheme } from "./default-scheme";
|
|
3
|
-
import type { Scheme } from "./types";
|
|
3
|
+
import type { Scheme, UIPosition } from "./types";
|
|
4
4
|
import type { JabroniOutfitStore } from "../store/store";
|
|
5
5
|
import App from "./vue-templates/App.vue"
|
|
6
6
|
import { parseDom } from "billy-herrington-utils";
|
|
7
7
|
|
|
8
8
|
export class JabroniOutfitUI {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
9
|
+
private getRoot(rootSelector: string | undefined) {
|
|
10
|
+
let root: string | undefined = rootSelector;
|
|
11
|
+
if (!root) {
|
|
12
|
+
const rootEl = parseDom('<div id="tapermonkey-app" style="position: relative; z-index: 999999;"></div>');
|
|
13
|
+
document.body.appendChild(rootEl);
|
|
14
|
+
root = "#tapermonkey-app";
|
|
15
|
+
}
|
|
16
|
+
document.querySelector(root)?.classList.add('taper-class');
|
|
17
|
+
return root;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
constructor(
|
|
21
|
+
{ state, stateLocale }: JabroniOutfitStore,
|
|
22
|
+
scheme: Scheme = DefaultScheme,
|
|
23
|
+
rootSelector?: string,
|
|
24
|
+
position: UIPosition = { fixed: true, right: true, bottom: true }
|
|
25
|
+
) {
|
|
26
|
+
const app = createApp(App, { state, stateLocale, scheme, position });
|
|
27
|
+
app.mount(this.getRoot(rootSelector));
|
|
14
28
|
}
|
|
15
29
|
}
|
package/src/ui/types.ts
CHANGED
|
@@ -2,20 +2,32 @@
|
|
|
2
2
|
import Config from './icons/Config.vue';
|
|
3
3
|
import Close from './icons/Close.vue';
|
|
4
4
|
import Gen from './Gen.vue';
|
|
5
|
-
import type { Scheme } from '../types';
|
|
5
|
+
import type { Scheme, UIPosition } from '../types';
|
|
6
6
|
import type { Reactive } from 'vue';
|
|
7
7
|
import type { RecordV } from '../../store/types';
|
|
8
8
|
|
|
9
|
-
const { state, stateLocale, scheme } = defineProps<{
|
|
9
|
+
const { state, stateLocale, scheme, position } = defineProps<{
|
|
10
10
|
state: Reactive<RecordV>,
|
|
11
11
|
stateLocale: Reactive<RecordV>,
|
|
12
|
-
scheme?: Scheme
|
|
12
|
+
scheme?: Scheme,
|
|
13
|
+
position: UIPosition
|
|
13
14
|
}>();
|
|
14
15
|
|
|
16
|
+
const optClasses = {
|
|
17
|
+
fixed: 'fixed',
|
|
18
|
+
right: 'right-0',
|
|
19
|
+
left: 'left-0',
|
|
20
|
+
top: 'top-0',
|
|
21
|
+
bottom: 'bottom-0'
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const pos = Object.entries(position).filter(([_, v]) => v)
|
|
25
|
+
.map(([k, _]) => optClasses[k]).join(' ');
|
|
26
|
+
|
|
15
27
|
</script>
|
|
16
28
|
<template>
|
|
17
|
-
<div class="
|
|
18
|
-
:class="state.hidden ? 'hover:bg-gray-600' : ''" v-if="state.uiEnabled">
|
|
29
|
+
<div class="z-9999 rounded bg-zinc-800 max-w-full p-2 m-2"
|
|
30
|
+
:class="`${state.hidden ? 'hover:bg-gray-600' : ''} ${pos}`" v-if="state.uiEnabled">
|
|
19
31
|
|
|
20
32
|
<div class="flex items-center cursor-pointer py-1 px-2 m-1 rounded"
|
|
21
33
|
:class="!state.hidden ? 'hover:bg-zinc-900' : ''" @click="state.hidden = !state.hidden">
|
|
@@ -37,7 +37,6 @@ const updateValue = ({ target: { checked, value } }) => {
|
|
|
37
37
|
if (!model?.startsWith("state")) return;
|
|
38
38
|
const [stateName, stateProp] = model.split('.');
|
|
39
39
|
const val = type === 'checkbox' ? checked : value;
|
|
40
|
-
console.log('change', val);
|
|
41
40
|
props[stateName][stateProp] = val;
|
|
42
41
|
};
|
|
43
42
|
|