@radiantabyss/vue 3.3.20 → 4.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.
- package/package.json +31 -28
- package/src/Bootstrap.js +11 -5
- package/src/Components.js +1 -1
- package/src/Directives.js +1 -1
- package/src/Invoke.js +89 -89
- package/src/Modals.js +1 -1
- package/src/Routing/Route.js +77 -77
- package/src/Routing/RouteCrud.js +15 -15
- package/src/Routing/Router.js +115 -115
- package/src/Support/Helpers.js +0 -25
- package/src/Support/Item.js +0 -67
- package/src/Support/Items.js +0 -363
- package/src/Support/Str.js +0 -382
package/package.json
CHANGED
|
@@ -1,28 +1,31 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@radiantabyss/vue",
|
|
3
|
-
"version": "
|
|
4
|
-
"author": "radiantabyss.com",
|
|
5
|
-
"license": "ISC",
|
|
6
|
-
"eslintConfig": {
|
|
7
|
-
"root": true,
|
|
8
|
-
"env": {
|
|
9
|
-
"node": true
|
|
10
|
-
},
|
|
11
|
-
"extends": [
|
|
12
|
-
"plugin:vue/essential",
|
|
13
|
-
"eslint:recommended"
|
|
14
|
-
],
|
|
15
|
-
"rules": {},
|
|
16
|
-
"parserOptions": {
|
|
17
|
-
"parser": "babel-eslint"
|
|
18
|
-
},
|
|
19
|
-
"globals": {
|
|
20
|
-
"Alert": "writable",
|
|
21
|
-
"Cookie": "writable",
|
|
22
|
-
"Item": "writable",
|
|
23
|
-
"Items": "writable",
|
|
24
|
-
"Request": "writable",
|
|
25
|
-
"StorageHandler": "writable"
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "@radiantabyss/vue",
|
|
3
|
+
"version": "4.0.1",
|
|
4
|
+
"author": "radiantabyss.com",
|
|
5
|
+
"license": "ISC",
|
|
6
|
+
"eslintConfig": {
|
|
7
|
+
"root": true,
|
|
8
|
+
"env": {
|
|
9
|
+
"node": true
|
|
10
|
+
},
|
|
11
|
+
"extends": [
|
|
12
|
+
"plugin:vue/essential",
|
|
13
|
+
"eslint:recommended"
|
|
14
|
+
],
|
|
15
|
+
"rules": {},
|
|
16
|
+
"parserOptions": {
|
|
17
|
+
"parser": "babel-eslint"
|
|
18
|
+
},
|
|
19
|
+
"globals": {
|
|
20
|
+
"Alert": "writable",
|
|
21
|
+
"Cookie": "writable",
|
|
22
|
+
"Item": "writable",
|
|
23
|
+
"Items": "writable",
|
|
24
|
+
"Request": "writable",
|
|
25
|
+
"StorageHandler": "writable"
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
"dependencies": {
|
|
29
|
+
"@radiantabyss/support": "^1.0.0"
|
|
30
|
+
}
|
|
31
|
+
}
|
package/src/Bootstrap.js
CHANGED
|
@@ -10,12 +10,13 @@ import Confirm from './Confirm.js';
|
|
|
10
10
|
import Gate from './Support/Gate.js';
|
|
11
11
|
import Helpers from './Support/Helpers.js';
|
|
12
12
|
import Invoke from './Invoke.js';
|
|
13
|
-
import Item from './Support/Item.js';
|
|
14
|
-
import Items from './Support/Items.js';
|
|
15
13
|
import Modal from './Modal.js';
|
|
16
14
|
import Request from './Request.js';
|
|
17
15
|
import ReactiveStorage from './Support/ReactiveStorage.js';
|
|
18
|
-
|
|
16
|
+
|
|
17
|
+
import Item from '@radiantabyss/support/src/Item.js';
|
|
18
|
+
import Items from '@radiantabyss/support/src/Items.js';
|
|
19
|
+
import Str from '@radiantabyss/support/src/Str.js';
|
|
19
20
|
|
|
20
21
|
import Store from './Store.js';
|
|
21
22
|
|
|
@@ -36,13 +37,18 @@ export default async (app) => {
|
|
|
36
37
|
window.Confirm = Confirm;
|
|
37
38
|
window.Gate = Gate;
|
|
38
39
|
window.Invoke = Invoke;
|
|
39
|
-
window.Item = Item;
|
|
40
|
-
window.Items = Items;
|
|
41
40
|
window.Modal = Modal;
|
|
42
41
|
window.Request = Request;
|
|
43
42
|
window.ReactiveStorage = ReactiveStorage;
|
|
44
43
|
window.Str = Str;
|
|
45
44
|
|
|
45
|
+
window.Item = Item;
|
|
46
|
+
window.Items = Items;
|
|
47
|
+
window.pluck = Items.pluck;
|
|
48
|
+
window.spread = Items.spread;
|
|
49
|
+
window.keyBy = Items.keyBy;
|
|
50
|
+
window.groupBy = Items.groupBy;
|
|
51
|
+
|
|
46
52
|
//make usable inside template
|
|
47
53
|
app.config.globalProperties.Item = Item;
|
|
48
54
|
app.config.globalProperties.Items = Items;
|
package/src/Components.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import Str from '
|
|
1
|
+
import Str from '@radiantabyss/support/src/Str.js';
|
|
2
2
|
|
|
3
3
|
let context_ra = import.meta.glob('/node_modules/@radiantabyss/vue-components/src/Components/**/*.vue', { eager: true });
|
|
4
4
|
let context = import.meta.glob('@/Components/**/*.vue', { eager: true });
|
package/src/Directives.js
CHANGED
package/src/Invoke.js
CHANGED
|
@@ -1,89 +1,89 @@
|
|
|
1
|
-
import Str from '
|
|
2
|
-
|
|
3
|
-
let sprite_version = import.meta.env.VITE_SPRITE_VERSION;
|
|
4
|
-
|
|
5
|
-
const invoke = async function(method, edge, payload = {}, display_errors = false) {
|
|
6
|
-
let _button;
|
|
7
|
-
if ( payload._button !== undefined ) {
|
|
8
|
-
_button = payload._button;
|
|
9
|
-
delete payload._button;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
let _event;
|
|
13
|
-
if ( payload._event !== undefined ) {
|
|
14
|
-
_event = payload._event;
|
|
15
|
-
_event.preventDefault();
|
|
16
|
-
|
|
17
|
-
if ( _button === undefined ) {
|
|
18
|
-
_button = _event.target;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
delete payload._event;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
if ( _button !== undefined ) {
|
|
25
|
-
if ( _button.disabled ) {
|
|
26
|
-
return;
|
|
27
|
-
}
|
|
28
|
-
_button.disabled = true;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
let _button_html;
|
|
32
|
-
if ( typeof _button !== 'undefined' ) {
|
|
33
|
-
_button_html = _button.innerHTML;
|
|
34
|
-
|
|
35
|
-
if ( payload._replace_html ) {
|
|
36
|
-
_button.innerHTML = `<svg class="svg-request-spinner"><use xlink:href="/sprites.svg?v=${sprite_version}#request-spinner"></use></svg>`;
|
|
37
|
-
}
|
|
38
|
-
else {
|
|
39
|
-
_button.innerHTML += ` <svg class="svg-request-spinner"><use xlink:href="/sprites.svg?v=${sprite_version}#request-spinner"></use></svg>`;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
try {
|
|
44
|
-
delete payload._event;
|
|
45
|
-
let data = await IPC.invoke('invoke', {
|
|
46
|
-
method,
|
|
47
|
-
path: edge,
|
|
48
|
-
payload: JSON.stringify(payload),
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
if ( _button !== undefined ) {
|
|
52
|
-
_button.disabled = false;
|
|
53
|
-
_button.innerHTML = _button_html;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
return data;
|
|
57
|
-
}
|
|
58
|
-
catch(e) {
|
|
59
|
-
if ( typeof e == 'object' ) {
|
|
60
|
-
e = e.message;
|
|
61
|
-
}
|
|
62
|
-
else {
|
|
63
|
-
e = e.toString().replace('Error: Error invoking remote method \'invoke\': ', '');
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
if ( display_errors ) {
|
|
67
|
-
Alert.error(Str.nl2br(e), 7000);
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
if ( _button !== undefined ) {
|
|
71
|
-
_button.disabled = false;
|
|
72
|
-
_button.innerHTML = _button_html;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
throw e;
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
let self = {
|
|
80
|
-
get(edge, payload = {}, display_errors = false) {
|
|
81
|
-
return invoke('GET', edge, payload, display_errors);
|
|
82
|
-
},
|
|
83
|
-
|
|
84
|
-
post(edge, payload = {}, display_errors = true) {
|
|
85
|
-
return invoke('POST', edge, payload, display_errors);
|
|
86
|
-
},
|
|
87
|
-
};
|
|
88
|
-
|
|
89
|
-
export default self;
|
|
1
|
+
import Str from '@radiantabyss/support/src/Str.js';
|
|
2
|
+
|
|
3
|
+
let sprite_version = import.meta.env.VITE_SPRITE_VERSION;
|
|
4
|
+
|
|
5
|
+
const invoke = async function(method, edge, payload = {}, display_errors = false) {
|
|
6
|
+
let _button;
|
|
7
|
+
if ( payload._button !== undefined ) {
|
|
8
|
+
_button = payload._button;
|
|
9
|
+
delete payload._button;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
let _event;
|
|
13
|
+
if ( payload._event !== undefined ) {
|
|
14
|
+
_event = payload._event;
|
|
15
|
+
_event.preventDefault();
|
|
16
|
+
|
|
17
|
+
if ( _button === undefined ) {
|
|
18
|
+
_button = _event.target;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
delete payload._event;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
if ( _button !== undefined ) {
|
|
25
|
+
if ( _button.disabled ) {
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
_button.disabled = true;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
let _button_html;
|
|
32
|
+
if ( typeof _button !== 'undefined' ) {
|
|
33
|
+
_button_html = _button.innerHTML;
|
|
34
|
+
|
|
35
|
+
if ( payload._replace_html ) {
|
|
36
|
+
_button.innerHTML = `<svg class="svg-request-spinner"><use xlink:href="/sprites.svg?v=${sprite_version}#request-spinner"></use></svg>`;
|
|
37
|
+
}
|
|
38
|
+
else {
|
|
39
|
+
_button.innerHTML += ` <svg class="svg-request-spinner"><use xlink:href="/sprites.svg?v=${sprite_version}#request-spinner"></use></svg>`;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
try {
|
|
44
|
+
delete payload._event;
|
|
45
|
+
let data = await IPC.invoke('invoke', {
|
|
46
|
+
method,
|
|
47
|
+
path: edge,
|
|
48
|
+
payload: JSON.stringify(payload),
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
if ( _button !== undefined ) {
|
|
52
|
+
_button.disabled = false;
|
|
53
|
+
_button.innerHTML = _button_html;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
return data;
|
|
57
|
+
}
|
|
58
|
+
catch(e) {
|
|
59
|
+
if ( typeof e == 'object' ) {
|
|
60
|
+
e = e.message;
|
|
61
|
+
}
|
|
62
|
+
else {
|
|
63
|
+
e = e.toString().replace('Error: Error invoking remote method \'invoke\': ', '');
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
if ( display_errors ) {
|
|
67
|
+
Alert.error(Str.nl2br(e), 7000);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
if ( _button !== undefined ) {
|
|
71
|
+
_button.disabled = false;
|
|
72
|
+
_button.innerHTML = _button_html;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
throw e;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
let self = {
|
|
80
|
+
get(edge, payload = {}, display_errors = false) {
|
|
81
|
+
return invoke('GET', edge, payload, display_errors);
|
|
82
|
+
},
|
|
83
|
+
|
|
84
|
+
post(edge, payload = {}, display_errors = true) {
|
|
85
|
+
return invoke('POST', edge, payload, display_errors);
|
|
86
|
+
},
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
export default self;
|
package/src/Modals.js
CHANGED
package/src/Routing/Route.js
CHANGED
|
@@ -1,77 +1,77 @@
|
|
|
1
|
-
import Str from '
|
|
2
|
-
|
|
3
|
-
let group_middleware = null;
|
|
4
|
-
|
|
5
|
-
function addRoute(path, action, middleware, name, throw_error) {
|
|
6
|
-
if ( !action ) {
|
|
7
|
-
throw `Action missing for ${path}`;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
//format path
|
|
11
|
-
path = path.replace(/\{([\s\S]+?)\}/g, ':$1');
|
|
12
|
-
|
|
13
|
-
//get action
|
|
14
|
-
action = action.replace(/\\/g, '.').replace(/\//g, '.');
|
|
15
|
-
let split = action.split('.');
|
|
16
|
-
let namespace = split.slice(0, -1);
|
|
17
|
-
let action_name = name || split[split.length - 1];
|
|
18
|
-
let domain = namespace.length ? Str.slug(namespace[0]) : '';
|
|
19
|
-
|
|
20
|
-
if ( namespace.length ) {
|
|
21
|
-
action_name = namespace.join('/') + '/' + action_name;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
let component;
|
|
25
|
-
try {
|
|
26
|
-
component = getAction(Actions, split[split.length - 1], namespace, action_name);
|
|
27
|
-
}
|
|
28
|
-
catch(e) {
|
|
29
|
-
if ( throw_error ) {
|
|
30
|
-
throw `Action ${action_name} doesn't exist.`;
|
|
31
|
-
}
|
|
32
|
-
return;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
RouteFiles[__route_file].push({
|
|
36
|
-
name: action_name,
|
|
37
|
-
component,
|
|
38
|
-
path,
|
|
39
|
-
meta: {
|
|
40
|
-
domain,
|
|
41
|
-
middleware,
|
|
42
|
-
settings: component.settings ? component.settings : {},
|
|
43
|
-
},
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
function getAction(Actions, name, namespace, action_name) {
|
|
48
|
-
if ( !namespace.length ) {
|
|
49
|
-
let action = Actions[name];
|
|
50
|
-
|
|
51
|
-
action.name = action_name.replace(/\\/g, '.');
|
|
52
|
-
return action;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
let first = namespace[0];
|
|
56
|
-
namespace.shift();
|
|
57
|
-
|
|
58
|
-
return getAction(Actions[first], name, namespace, action_name);
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
let self = {
|
|
62
|
-
get(path, action, middleware = [], name = '', throw_error = true) {
|
|
63
|
-
if ( group_middleware ) {
|
|
64
|
-
middleware = middleware.concat(group_middleware);
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
addRoute(path, action, middleware, name, throw_error);
|
|
68
|
-
},
|
|
69
|
-
|
|
70
|
-
group(middleware, callback) {
|
|
71
|
-
group_middleware = middleware;
|
|
72
|
-
callback();
|
|
73
|
-
group_middleware = null;
|
|
74
|
-
},
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
export default self;
|
|
1
|
+
import Str from '@radiantabyss/support/src/Str.js';
|
|
2
|
+
|
|
3
|
+
let group_middleware = null;
|
|
4
|
+
|
|
5
|
+
function addRoute(path, action, middleware, name, throw_error) {
|
|
6
|
+
if ( !action ) {
|
|
7
|
+
throw `Action missing for ${path}`;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
//format path
|
|
11
|
+
path = path.replace(/\{([\s\S]+?)\}/g, ':$1');
|
|
12
|
+
|
|
13
|
+
//get action
|
|
14
|
+
action = action.replace(/\\/g, '.').replace(/\//g, '.');
|
|
15
|
+
let split = action.split('.');
|
|
16
|
+
let namespace = split.slice(0, -1);
|
|
17
|
+
let action_name = name || split[split.length - 1];
|
|
18
|
+
let domain = namespace.length ? Str.slug(namespace[0]) : '';
|
|
19
|
+
|
|
20
|
+
if ( namespace.length ) {
|
|
21
|
+
action_name = namespace.join('/') + '/' + action_name;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
let component;
|
|
25
|
+
try {
|
|
26
|
+
component = getAction(Actions, split[split.length - 1], namespace, action_name);
|
|
27
|
+
}
|
|
28
|
+
catch(e) {
|
|
29
|
+
if ( throw_error ) {
|
|
30
|
+
throw `Action ${action_name} doesn't exist.`;
|
|
31
|
+
}
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
RouteFiles[__route_file].push({
|
|
36
|
+
name: action_name,
|
|
37
|
+
component,
|
|
38
|
+
path,
|
|
39
|
+
meta: {
|
|
40
|
+
domain,
|
|
41
|
+
middleware,
|
|
42
|
+
settings: component.settings ? component.settings : {},
|
|
43
|
+
},
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function getAction(Actions, name, namespace, action_name) {
|
|
48
|
+
if ( !namespace.length ) {
|
|
49
|
+
let action = Actions[name];
|
|
50
|
+
|
|
51
|
+
action.name = action_name.replace(/\\/g, '.');
|
|
52
|
+
return action;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
let first = namespace[0];
|
|
56
|
+
namespace.shift();
|
|
57
|
+
|
|
58
|
+
return getAction(Actions[first], name, namespace, action_name);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
let self = {
|
|
62
|
+
get(path, action, middleware = [], name = '', throw_error = true) {
|
|
63
|
+
if ( group_middleware ) {
|
|
64
|
+
middleware = middleware.concat(group_middleware);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
addRoute(path, action, middleware, name, throw_error);
|
|
68
|
+
},
|
|
69
|
+
|
|
70
|
+
group(middleware, callback) {
|
|
71
|
+
group_middleware = middleware;
|
|
72
|
+
callback();
|
|
73
|
+
group_middleware = null;
|
|
74
|
+
},
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export default self;
|
package/src/Routing/RouteCrud.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import Str from '
|
|
2
|
-
|
|
3
|
-
let self = {
|
|
4
|
-
run(domain) {
|
|
5
|
-
domain = domain.replace(/\\/g, '.').replace(/\//g, '.');
|
|
6
|
-
let prefix = Str.kebab(domain).replace(/\./g, '/');
|
|
7
|
-
|
|
8
|
-
Route.get(`/${prefix}`, `${domain}.ListAction`, [], '', false);
|
|
9
|
-
Route.get(`/${prefix}/new/{id?}`, `${domain}.NewAction`, [], '', false);
|
|
10
|
-
Route.get(`/${prefix}/edit/{id}`, `${domain}.EditAction`, [], '', false);
|
|
11
|
-
Route.get(`/${prefix}/single/{id}`, `${domain}.SingleAction`, [], '', false);
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export default self;
|
|
1
|
+
import Str from '@radiantabyss/support/src/Str.js';
|
|
2
|
+
|
|
3
|
+
let self = {
|
|
4
|
+
run(domain) {
|
|
5
|
+
domain = domain.replace(/\\/g, '.').replace(/\//g, '.');
|
|
6
|
+
let prefix = Str.kebab(domain).replace(/\./g, '/');
|
|
7
|
+
|
|
8
|
+
Route.get(`/${prefix}`, `${domain}.ListAction`, [], '', false);
|
|
9
|
+
Route.get(`/${prefix}/new/{id?}`, `${domain}.NewAction`, [], '', false);
|
|
10
|
+
Route.get(`/${prefix}/edit/{id}`, `${domain}.EditAction`, [], '', false);
|
|
11
|
+
Route.get(`/${prefix}/single/{id}`, `${domain}.SingleAction`, [], '', false);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export default self;
|