jabroni-outfit 1.4.9 → 1.6.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/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2024 smartacephale
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ MIT License
2
+
3
+ Copyright (c) 2024 smartacephale
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,126 +1,131 @@
1
- <h1 align="center">Jabroni Outfit</h1>
2
- <h3 align="center">out-of-the-box gui and persistent-state library</h3>
3
- <p align="center"><a href="https://smartacephale.github.io/jabroni-outfit/">https://smartacephale.github.io/jabroni-outfit/</a></p>
4
- <p align="center">
5
- <img src="https://i.imgur.com/hCyUJvd.png" alt="Sublime's custom image"/>
6
- </p>
7
-
8
- ### Introduction
9
-
10
- The `jabroni-outfit` library is a versatile tool for creating user interfaces with persistent state management. It provides a simple and efficient way to define state variables, build UI controls, and automatically update the UI based on state changes.
11
-
12
- ### Key Features
13
-
14
- - **State Management:**
15
- - Define state variables with properties like `value`, `persistent`, and `watch`.
16
- - Easily manage and update state values throughout your application.
17
- - **UI Creation:**
18
- - Create UI controls (e.g., text inputs, checkboxes) based on state variables.
19
- - Automatically update the UI whenever state values change.
20
- - **Persistence:**
21
- - Store state values persistently across application sessions.
22
- - **Flexibility:**
23
- - Customize the UI and state management to fit your specific needs.
24
-
25
- ### Usage
26
-
27
- **1. Import the Library:**
28
-
29
- ```javascript
30
- import { JabroniOutfitStore, JabroniOutfitUI } from 'jabroni-outfit';
31
- ```
32
- or umd cdn:
33
- ```javascript
34
- <script src="https://unpkg.com/jabroni-outfit@latest/dist/jabroni-outfit.umd.js"></script>
35
- ...
36
- const { JabroniOutfitStore, JabroniOutfitUI } = window.jabronioutfit;
37
- ```
38
-
39
- **2. Define State Variables:**
40
-
41
- Create an object containing state variables. Each variable has properties:
42
-
43
- - `value`: The current value of the state variable.
44
- - `persistent`: Boolean indicating if the value should be stored persistently.
45
- - `watch`: Boolean indicating if the UI should update when the value changes.
46
-
47
- ```javascript
48
- const myState = {
49
- gradientColor1: { value: "red", persistent: false, watch: true },
50
- // ... other state variables
51
- };
52
- ```
53
-
54
- **3. Create a Store:**
55
-
56
- Instantiate a `JabroniOutfitStore` object with your state definition.
57
-
58
- ```javascript
59
- const store = new JabroniOutfitStore(myState);
60
- ```
61
-
62
- **4. Create UI Controls:**
63
-
64
- Define an object mapping state variables to UI control configurations.
65
-
66
- ```javascript
67
- const uiConfig = {
68
- gradientColor1: [{ type: "text", model: "stateLocale.gradientColor1" }],
69
- // ... other UI controls
70
- };
71
- ```
72
-
73
- **5. Create the UI:**
74
-
75
- Instantiate a `JabroniOutfitUI` object with the store and UI configuration.
76
-
77
- ```javascript
78
- const ui = new JabroniOutfitUI(store, uiConfig);
79
- ```
80
-
81
- **6. Subscribe to reactive data:**
82
-
83
- Use the `subscribe` method on the store to trigger updates whenever the state changes.
84
-
85
- ```javascript
86
- store.subscribe(() => {
87
- // ...
88
- });
89
- ```
90
-
91
- ### Example
92
-
93
- ```javascript
94
- const {
95
- JabroniOutfitStore,
96
- JabroniOutfitUI,
97
- defaultStateWithDurationAndPrivacy,
98
- defaultSchemeWithPrivateFilter
99
- } = window.jabronioutfit;
100
-
101
- const myState = {
102
- gradientColor1: { value: "red", persistent: false, watch: true },
103
- gradientColor2: { value: "coral", persistent: false, watch: true },
104
- gradientColor3: { value: "orange", persistent: false, watch: true },
105
- gradientEnabled: { value: true, persistent: false, watch: true },
106
- uiEnabled: { value: true, persistent: true, watch: true }
107
- }
108
-
109
- const store = new JabroniOutfitStore(myState);
110
-
111
- const ui = new JabroniOutfitUI(store, {
112
- gradientColor1: [{ type: "text", model: "stateLocale.gradientColor1", placeholder: "color", labelBefore: "color1" }],
113
- gradientColor2: [{ type: "text", model: "stateLocale.gradientColor2", placeholder: "color", labelBefore: "color2" }],
114
- gradientColor3: [{ type: "text", model: "stateLocale.gradientColor3", placeholder: "color", labelBefore: "color3" }],
115
- gradientEnabled: [{ type: "checkbox", model: "stateLocale.gradientEnabled", labelBefore: "gradient enabled" }],
116
- });
117
-
118
- function drawGradient() {
119
- const { gradientColor1, gradientColor2, gradientColor3, gradientEnabled } = store.stateLocale;
120
- if (!gradientEnabled) { document.body.style.background = 'coral'; return; }
121
- document.body.style.background = `radial-gradient(${gradientColor1}, ${gradientColor2}, ${gradientColor3})`;
122
- }
123
-
124
- drawGradient();
125
- store.subscribe(drawGradient);
126
- ```
1
+ <h1 align="center">Jabroni Outfit</h1>
2
+ <h3 align="center">out-of-the-box gui and persistent-state library</h3>
3
+ <p align="center"><a href="https://smartacephale.github.io/jabroni-outfit/">https://smartacephale.github.io/jabroni-outfit/</a></p>
4
+ <p align="center">
5
+ <img src="https://i.imgur.com/hCyUJvd.png" alt="Sublime's custom image"/>
6
+ </p>
7
+
8
+ ### Introduction
9
+
10
+ The `jabroni-outfit` library is a versatile tool for creating user interfaces with persistent state management. It provides a simple and efficient way to define state variables, build UI controls, and automatically update the UI based on state changes.
11
+
12
+ ### Key Features
13
+
14
+ - **State Management:**
15
+ - Define state variables with properties like `value`, `persistent`, and `watch`.
16
+ - Easily manage and update state values throughout your application.
17
+ - **UI Creation:**
18
+ - Create UI controls (e.g., text inputs, checkboxes) based on state variables.
19
+ - Automatically update the UI whenever state values change.
20
+ - **Persistence:**
21
+ - Store state values persistently across application sessions.
22
+ - **Flexibility:**
23
+ - Customize the UI and state management to fit your specific needs.
24
+
25
+ ### Usage
26
+
27
+ **1. Import the Library:**
28
+
29
+ ```javascript
30
+ import { JabroniOutfitStore, JabroniOutfitUI } from 'jabroni-outfit';
31
+ ```
32
+ or umd cdn:
33
+ ```javascript
34
+ <script src="https://unpkg.com/jabroni-outfit@latest/dist/jabroni-outfit.umd.js"></script>
35
+ ...
36
+ const { JabroniOutfitStore, JabroniOutfitUI } = window.jabronioutfit;
37
+ ```
38
+
39
+ **2. Define State Variables:**
40
+
41
+ Create an object containing state variables. Each variable has properties:
42
+
43
+ - `value`: The current value of the state variable.
44
+ - `persistent`: Boolean indicating if the value should be stored persistently.
45
+ - `watch`: Boolean indicating if the UI should update when the value changes.
46
+
47
+ ```javascript
48
+ const myState = {
49
+ gradientColor1: { value: "red", persistent: false, watch: true },
50
+ // ... other state variables
51
+ };
52
+ ```
53
+
54
+ **3. Create a Store:**
55
+
56
+ Instantiate a `JabroniOutfitStore` object with your state definition.
57
+
58
+ ```javascript
59
+ const store = new JabroniOutfitStore(myState);
60
+ ```
61
+
62
+ **4. Create UI Controls:**
63
+
64
+ Define an object mapping state variables to UI control configurations.
65
+
66
+ ```javascript
67
+ const uiConfig = {
68
+ gradientColor1: [{ type: "text", model: "localState.gradientColor1" }],
69
+ // ... other UI controls
70
+ };
71
+ ```
72
+
73
+ **5. Create the UI:**
74
+
75
+ Instantiate a `JabroniOutfitUI` object with the store and UI configuration.
76
+
77
+ ```javascript
78
+ const ui = new JabroniOutfitUI(store, uiConfig);
79
+ ```
80
+
81
+ **6. Subscribe to reactive data:**
82
+
83
+ Use the `subscribe` method on the store to trigger updates whenever the state changes.
84
+
85
+ ```javascript
86
+ store.subscribe(() => {
87
+ // ...
88
+ });
89
+ ```
90
+
91
+ ### Example
92
+
93
+ ```javascript
94
+
95
+ const {
96
+ JabroniOutfitStore,
97
+ JabroniOutfitUI
98
+ } = window.jabronioutfit;
99
+
100
+ const customState = {
101
+ gradientColor1: { value: "red", persistent: false, watch: true, type: "string" },
102
+ gradientColor2: { value: "coral", persistent: false, watch: true, type: "string" },
103
+ gradientColor3: { value: "orange", persistent: false, watch: true, type: "string" },
104
+ gradientEnabled: { value: true, persistent: false, watch: true, type: "boolean" },
105
+ uiEnabled: { value: true, persistent: true, watch: true, type: "boolean" }
106
+ }
107
+
108
+ const store = new JabroniOutfitStore(customState);
109
+
110
+ const customScheme = {
111
+ gradientColor1: [{ type: "text", model: "localState.gradientColor1", placeholder: "color", labelBefore: "color1" }],
112
+ gradientColor2: [{ type: "text", model: "localState.gradientColor2", placeholder: "color", labelBefore: "color2" }],
113
+ gradientColor3: [{ type: "text", model: "localState.gradientColor3", placeholder: "color", labelBefore: "color3" }],
114
+ gradientEnabled: [{ type: "checkbox", model: "localState.gradientEnabled", labelBefore: "gradient enabled" }],
115
+ };
116
+
117
+ new JabroniOutfitUI(store, customScheme, '#lol');
118
+
119
+ function drawGradient() {
120
+ // biome-ignore lint/suspicious/noExplicitAny: <explanation>
121
+ const { gradientColor1, gradientColor2, gradientColor3, gradientEnabled } = store.localState;
122
+ if (!gradientEnabled) { document.body.style.background = 'blue'; return; }
123
+ document.body.style.background = `radial-gradient(${gradientColor1}, ${gradientColor2}, ${gradientColor3})`;
124
+ }
125
+
126
+ drawGradient();
127
+
128
+ store.subscribe(() => {
129
+ drawGradient();
130
+ });
131
+ ```
package/dist/index.d.ts CHANGED
@@ -1,21 +1,30 @@
1
+ import { createApp } from 'vue';
1
2
  import { Reactive } from 'vue';
2
3
 
3
4
  export declare const DefaultScheme: Scheme;
4
5
 
5
- export declare const defaultSchemeWithPrivateFilter: {};
6
+ export declare const defaultSchemeWithPrivacyFilter: {};
7
+
8
+ export declare const defaultSchemeWithPrivacyFilterWithHD: {};
9
+
10
+ export declare const defaultSchemeWithPrivacyFilterWithHDwithSort: {};
6
11
 
7
12
  export declare const defaultStateInclExclMiscPagination: StateOptions;
8
13
 
9
14
  export declare const defaultStateWithDuration: StateOptions;
10
15
 
16
+ export declare const defaultStateWithDurationAndHD: StateOptions;
17
+
11
18
  export declare const defaultStateWithDurationAndPrivacy: StateOptions;
12
19
 
13
- export declare const extendDefaultScheme: (newScheme: Scheme) => {};
20
+ export declare const defaultStateWithDurationAndPrivacyAndHD: StateOptions;
21
+
22
+ export declare const extendScheme: (scheme: Scheme, newScheme: Scheme) => {};
14
23
 
15
24
  export declare class JabroniOutfitStore {
16
25
  private callbacks;
17
26
  state: Reactive<RecordV> | undefined;
18
- stateLocale: Reactive<RecordV> | undefined;
27
+ localState: Reactive<RecordV> | undefined;
19
28
  constructor(options?: StateOptions);
20
29
  subscribe(callback: NotifyApply): void;
21
30
  notify(subject: RecordV): void;
@@ -23,8 +32,9 @@ export declare class JabroniOutfitStore {
23
32
  }
24
33
 
25
34
  export declare class JabroniOutfitUI {
35
+ app: ReturnType<typeof createApp>;
26
36
  private getRoot;
27
- constructor({ state, stateLocale }: JabroniOutfitStore, scheme?: Scheme, rootSelector?: string, position?: UIPosition);
37
+ constructor({ state, localState }: JabroniOutfitStore, scheme?: Scheme, rootSelector?: string, position?: UIPosition);
28
38
  }
29
39
 
30
40
  declare type NotifyApply = (input: RecordV) => void;