@radiantabyss/vue 3.3.19 → 3.3.20

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@radiantabyss/vue",
3
- "version": "3.3.19",
3
+ "version": "3.3.20",
4
4
  "author": "radiantabyss.com",
5
5
  "license": "ISC",
6
6
  "eslintConfig": {
package/src/Bootstrap.js CHANGED
@@ -1,53 +1,54 @@
1
- import Components from './Components.js';
2
- import Directives from './Directives.js';
3
- import Mixins from './Mixins.js';
4
- import Modals from './Modals.js';
5
-
6
- import Alert from './Alert.js';
7
- import Cookie from './Support/Cookie.js';
8
- import Confirm from './Confirm.js';
9
- import Gate from './Support/Gate.js';
10
- import Helpers from './Support/Helpers.js';
11
- import Invoke from './Invoke.js';
12
- import Item from './Support/Item.js';
13
- import Items from './Support/Items.js';
14
- import Modal from './Modal.js';
15
- import Request from './Request.js';
16
- import ReactiveStorage from './Support/ReactiveStorage.js';
17
- import Str from './Support/Str.js';
18
-
19
- import Store from './Store.js';
20
-
21
- export default async (app) => {
22
- //helpers
23
- for ( let key in Helpers ) {
24
- window[key] = Helpers[key];
25
- app.config.globalProperties[key] = Helpers[key];
26
- }
27
-
28
- await Components(app);
29
- await Directives(app);
30
- await Mixins(app);
31
- await Modals(app);
32
-
33
- window.Alert = Alert;
34
- window.Cookie = Cookie;
35
- window.Confirm = Confirm;
36
- window.Gate = Gate;
37
- window.Invoke = Invoke;
38
- window.Item = Item;
39
- window.Items = Items;
40
- window.Modal = Modal;
41
- window.Request = Request;
42
- window.ReactiveStorage = ReactiveStorage;
43
- window.Str = Str;
44
-
45
- //make usable inside template
46
- app.config.globalProperties.Item = Item;
47
- app.config.globalProperties.Items = Items;
48
- app.config.globalProperties.Gate = Gate;
49
- app.config.globalProperties.Modal = Modal;
50
- app.config.globalProperties.Str = Str;
51
-
52
- await Store(app);
53
- };
1
+ //must be imported first: eagerly loaded components reference Mixins.X at definition time
2
+ import Mixins from './Mixins.js';
3
+ import Components from './Components.js';
4
+ import Directives from './Directives.js';
5
+ import Modals from './Modals.js';
6
+
7
+ import Alert from './Alert.js';
8
+ import Cookie from './Support/Cookie.js';
9
+ import Confirm from './Confirm.js';
10
+ import Gate from './Support/Gate.js';
11
+ import Helpers from './Support/Helpers.js';
12
+ import Invoke from './Invoke.js';
13
+ import Item from './Support/Item.js';
14
+ import Items from './Support/Items.js';
15
+ import Modal from './Modal.js';
16
+ import Request from './Request.js';
17
+ import ReactiveStorage from './Support/ReactiveStorage.js';
18
+ import Str from './Support/Str.js';
19
+
20
+ import Store from './Store.js';
21
+
22
+ export default async (app) => {
23
+ //helpers
24
+ for ( let key in Helpers ) {
25
+ window[key] = Helpers[key];
26
+ app.config.globalProperties[key] = Helpers[key];
27
+ }
28
+
29
+ await Components(app);
30
+ await Directives(app);
31
+ await Mixins(app);
32
+ await Modals(app);
33
+
34
+ window.Alert = Alert;
35
+ window.Cookie = Cookie;
36
+ window.Confirm = Confirm;
37
+ window.Gate = Gate;
38
+ window.Invoke = Invoke;
39
+ window.Item = Item;
40
+ window.Items = Items;
41
+ window.Modal = Modal;
42
+ window.Request = Request;
43
+ window.ReactiveStorage = ReactiveStorage;
44
+ window.Str = Str;
45
+
46
+ //make usable inside template
47
+ app.config.globalProperties.Item = Item;
48
+ app.config.globalProperties.Items = Items;
49
+ app.config.globalProperties.Gate = Gate;
50
+ app.config.globalProperties.Modal = Modal;
51
+ app.config.globalProperties.Str = Str;
52
+
53
+ await Store(app);
54
+ };
package/src/Components.js CHANGED
@@ -1,44 +1,44 @@
1
- import Str from './Support/Str.js';
2
-
3
- let context_ra = import.meta.glob('/node_modules/@radiantabyss/vue-components/src/Components/**/*.vue');
4
- let context = import.meta.glob('@/Components/**/*.vue');
5
-
6
- function getComponentName(file) {
7
- let split = file.split('/');
8
- let name = split[split.length - 1].replace('.vue', '')
9
- .replace(/Component$/, '')
10
- .replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g, '$1-$2')
11
- .toLowerCase();
12
-
13
- return Str.trim(name, '-');
14
- }
15
-
16
- export default async (app) => {
17
- //load app components
18
- let files = Object.keys(context);
19
- let components = [];
20
-
21
- for ( let i = 0; i < files.length; i++ ) {
22
- let component = getComponentName(files[i]);
23
- components.push(component);
24
-
25
- let module = await context[files[i]]();
26
- app.component(component, module.default);
27
- }
28
-
29
- //load ra vue components
30
- files = Object.keys(context_ra);
31
-
32
- for ( let i = 0; i < files.length; i++ ) {
33
- let component = getComponentName(files[i]);
34
-
35
- //enable component overloading. if component is already defined in app, continue
36
- if ( components.includes(component) ) {
37
- continue;
38
- }
39
-
40
- let module = await context_ra[files[i]]();
41
- components.push(component);
42
- app.component(component, module.default);
43
- }
44
- }
1
+ import Str from './Support/Str.js';
2
+
3
+ let context_ra = import.meta.glob('/node_modules/@radiantabyss/vue-components/src/Components/**/*.vue', { eager: true });
4
+ let context = import.meta.glob('@/Components/**/*.vue', { eager: true });
5
+
6
+ function getComponentName(file) {
7
+ let split = file.split('/');
8
+ let name = split[split.length - 1].replace('.vue', '')
9
+ .replace(/Component$/, '')
10
+ .replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g, '$1-$2')
11
+ .toLowerCase();
12
+
13
+ return Str.trim(name, '-');
14
+ }
15
+
16
+ export default async (app) => {
17
+ //load app components
18
+ let files = Object.keys(context);
19
+ let components = [];
20
+
21
+ for ( let i = 0; i < files.length; i++ ) {
22
+ let component = getComponentName(files[i]);
23
+ components.push(component);
24
+
25
+ let module = context[files[i]];
26
+ app.component(component, module.default);
27
+ }
28
+
29
+ //load ra vue components
30
+ files = Object.keys(context_ra);
31
+
32
+ for ( let i = 0; i < files.length; i++ ) {
33
+ let component = getComponentName(files[i]);
34
+
35
+ //enable component overloading. if component is already defined in app, continue
36
+ if ( components.includes(component) ) {
37
+ continue;
38
+ }
39
+
40
+ let module = context_ra[files[i]];
41
+ components.push(component);
42
+ app.component(component, module.default);
43
+ }
44
+ }
package/src/Directives.js CHANGED
@@ -1,20 +1,20 @@
1
- import Str from './Support/Str.js';
2
-
3
- let context = import.meta.glob('/app/Directives/**/*.js');
4
-
5
- export default async (app) => {
6
- const files = Object.keys(context);
7
-
8
- for ( let i = 0; i < files.length; i++ ) {
9
- let split = files[i].split('/');
10
- let name = split[split.length - 1].replace('.js', '')
11
- .replace(/Directive$/, '')
12
- .replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g, '$1-$2')
13
- .toLowerCase();
14
-
15
- name = Str.trim(name, '-');
16
-
17
- let module = await context[files[i]]();
18
- app.directive(name, module.default);
19
- }
20
- }
1
+ import Str from './Support/Str.js';
2
+
3
+ let context = import.meta.glob('/app/Directives/**/*.js', { eager: true });
4
+
5
+ export default async (app) => {
6
+ const files = Object.keys(context);
7
+
8
+ for ( let i = 0; i < files.length; i++ ) {
9
+ let split = files[i].split('/');
10
+ let name = split[split.length - 1].replace('.js', '')
11
+ .replace(/Directive$/, '')
12
+ .replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g, '$1-$2')
13
+ .toLowerCase();
14
+
15
+ name = Str.trim(name, '-');
16
+
17
+ let module = context[files[i]];
18
+ app.directive(name, module.default);
19
+ }
20
+ }
package/src/Mixins.js CHANGED
@@ -1,16 +1,18 @@
1
- let Mixins = {};
2
- let context = import.meta.glob('/app/Mixins/**/*.js');
3
-
4
- export default async () => {
5
- const files = Object.keys(context);
6
-
7
- for ( let i = 0; i < files.length; i++ ) {
8
- let split = files[i].split('/');
9
- let name = split[split.length - 1].replace('.js', '')
10
- .replace(/Mixin$/, '');
11
-
12
- let module = await context[files[i]]();
13
- Mixins[name] = module.default;
14
- }
15
- window.Mixins = Mixins;
16
- }
1
+ let Mixins = {};
2
+ let context = import.meta.glob('/app/Mixins/**/*.js', { eager: true });
3
+
4
+ //populate at module evaluation so eagerly loaded components can use Mixins.X in their definition
5
+ const files = Object.keys(context);
6
+
7
+ for ( let i = 0; i < files.length; i++ ) {
8
+ let split = files[i].split('/');
9
+ let name = split[split.length - 1].replace('.js', '')
10
+ .replace(/Mixin$/, '');
11
+
12
+ Mixins[name] = context[files[i]].default;
13
+ }
14
+ window.Mixins = Mixins;
15
+
16
+ export default async () => {
17
+ window.Mixins = Mixins;
18
+ }
package/src/Modals.js CHANGED
@@ -1,19 +1,19 @@
1
- import Str from './Support/Str.js';
2
-
3
- let context = import.meta.glob('/app/Modals/**/*.vue');
4
-
5
- export default async (app) => {
6
- const files = Object.keys(context);
7
-
8
- for ( let i = 0; i < files.length; i++ ) {
9
- let split = files[i].split('/');
10
- let name = split[split.length - 1].replace('.vue', '')
11
- .replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g, '$1-$2')
12
- .toLowerCase();
13
-
14
- name = Str.trim(name, '-');
15
-
16
- let module = await context[files[i]]();
17
- app.component(name, module.default);
18
- }
19
- }
1
+ import Str from './Support/Str.js';
2
+
3
+ let context = import.meta.glob('/app/Modals/**/*.vue', { eager: true });
4
+
5
+ export default async (app) => {
6
+ const files = Object.keys(context);
7
+
8
+ for ( let i = 0; i < files.length; i++ ) {
9
+ let split = files[i].split('/');
10
+ let name = split[split.length - 1].replace('.vue', '')
11
+ .replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g, '$1-$2')
12
+ .toLowerCase();
13
+
14
+ name = Str.trim(name, '-');
15
+
16
+ let module = context[files[i]];
17
+ app.component(name, module.default);
18
+ }
19
+ }
@@ -1,47 +1,47 @@
1
- let Actions = {};
2
- let context = import.meta.glob('/app/Domains/**/*.vue');
3
-
4
- const loadModules = async () => {
5
- const files = Object.keys(context);
6
-
7
- for ( let i = 0; i < files.length; i++ ) {
8
- let split = files[i].split('/');
9
- split.shift();
10
- let name = split[split.length - 1].replace('.vue', '');
11
- split.pop();
12
- split.pop();
13
- split.shift();
14
- split.shift();
15
-
16
- if ( !name.match(/Action$/) || name == 'Action' ) {
17
- continue;
18
- }
19
-
20
- let module = await context[files[i]]();
21
- setNamespace(Actions, name, split, module);
22
- }
23
- }
24
-
25
- function setNamespace(Actions, name, namespace, module) {
26
- if ( !namespace.length ) {
27
- Actions[name] = module.default;
28
- return;
29
- }
30
-
31
- let first = namespace[0].replace(/-/g, ' ').replace(/_/g, ' ').replace(/(^([a-zA-Z\p{M}]))|([ -][a-zA-Z\p{M}])/g,function(s) {
32
- return s.toUpperCase();
33
- }).replace(/ /g, '');
34
-
35
- namespace.shift();
36
-
37
- if ( !Actions[first] ) {
38
- Actions[first] = {};
39
- }
40
-
41
- setNamespace(Actions[first], name, namespace, module);
42
- }
43
-
44
- export default async () => {
45
- await loadModules();
46
- return Actions;
47
- }
1
+ let Actions = {};
2
+ let context = import.meta.glob('/app/Domains/**/*.vue', { eager: true });
3
+
4
+ const loadModules = async () => {
5
+ const files = Object.keys(context);
6
+
7
+ for ( let i = 0; i < files.length; i++ ) {
8
+ let split = files[i].split('/');
9
+ split.shift();
10
+ let name = split[split.length - 1].replace('.vue', '');
11
+ split.pop();
12
+ split.pop();
13
+ split.shift();
14
+ split.shift();
15
+
16
+ if ( !name.match(/Action$/) || name == 'Action' ) {
17
+ continue;
18
+ }
19
+
20
+ let module = context[files[i]];
21
+ setNamespace(Actions, name, split, module);
22
+ }
23
+ }
24
+
25
+ function setNamespace(Actions, name, namespace, module) {
26
+ if ( !namespace.length ) {
27
+ Actions[name] = module.default;
28
+ return;
29
+ }
30
+
31
+ let first = namespace[0].replace(/-/g, ' ').replace(/_/g, ' ').replace(/(^([a-zA-Z\p{M}]))|([ -][a-zA-Z\p{M}])/g,function(s) {
32
+ return s.toUpperCase();
33
+ }).replace(/ /g, '');
34
+
35
+ namespace.shift();
36
+
37
+ if ( !Actions[first] ) {
38
+ Actions[first] = {};
39
+ }
40
+
41
+ setNamespace(Actions[first], name, namespace, module);
42
+ }
43
+
44
+ export default async () => {
45
+ await loadModules();
46
+ return Actions;
47
+ }
@@ -1,41 +1,41 @@
1
- let Middleware = {};
2
- let context = import.meta.glob('/app/Http/Middleware/**/*.js');
3
-
4
- const loadModules = async () => {
5
- const files = Object.keys(context);
6
-
7
- for ( let i = 0; i < files.length; i++ ) {
8
- let split = files[i].split('/');
9
- let name = split[split.length - 1].replace('.js', '').replace('Middleware', '');
10
- let module = await context[files[i]]();
11
- Middleware[name] = module.default;
12
- }
13
- }
14
-
15
- let runMiddleware = async (to, from, i = 0) => {
16
- //reached end, then everything passed
17
- if ( i == to.meta.middleware.length ) {
18
- return;
19
- }
20
-
21
- //middleware doesnt exist
22
- if ( !Middleware[to.meta.middleware[i]] ) {
23
- throw new Error(`${to.meta.middleware[i]} Middleware not found.`);
24
- }
25
-
26
- //run middleware
27
- await Middleware[to.meta.middleware[i]](to, from);
28
- await runMiddleware(to, from, i + 1);
29
- }
30
-
31
- export default async () => {
32
- await loadModules();
33
-
34
- return async (to, from) => {
35
- if ( !to.meta || !to.meta.middleware ) {
36
- return;
37
- }
38
-
39
- return runMiddleware(to, from);
40
- };
41
- }
1
+ let Middleware = {};
2
+ let context = import.meta.glob('/app/Http/Middleware/**/*.js', { eager: true });
3
+
4
+ const loadModules = async () => {
5
+ const files = Object.keys(context);
6
+
7
+ for ( let i = 0; i < files.length; i++ ) {
8
+ let split = files[i].split('/');
9
+ let name = split[split.length - 1].replace('.js', '').replace('Middleware', '');
10
+ let module = context[files[i]];
11
+ Middleware[name] = module.default;
12
+ }
13
+ }
14
+
15
+ let runMiddleware = async (to, from, i = 0) => {
16
+ //reached end, then everything passed
17
+ if ( i == to.meta.middleware.length ) {
18
+ return;
19
+ }
20
+
21
+ //middleware doesnt exist
22
+ if ( !Middleware[to.meta.middleware[i]] ) {
23
+ throw new Error(`${to.meta.middleware[i]} Middleware not found.`);
24
+ }
25
+
26
+ //run middleware
27
+ await Middleware[to.meta.middleware[i]](to, from);
28
+ await runMiddleware(to, from, i + 1);
29
+ }
30
+
31
+ export default async () => {
32
+ await loadModules();
33
+
34
+ return async (to, from) => {
35
+ if ( !to.meta || !to.meta.middleware ) {
36
+ return;
37
+ }
38
+
39
+ return runMiddleware(to, from);
40
+ };
41
+ }
package/src/Store.js CHANGED
@@ -1,54 +1,54 @@
1
- import { createStore } from 'vuex';
2
-
3
- const Modules = {};
4
- let context = import.meta.glob('/app/Store/**/*.js');
5
-
6
- const loadModules = async () => {
7
- const files = Object.keys(context);
8
-
9
- for ( let i = 0; i < files.length; i++ ) {
10
- let split = files[i].split('/');
11
- split.shift();
12
- split.shift();
13
- split.shift();
14
-
15
- let name = split[split.length - 1].replace('.js', '');
16
- split.pop();
17
-
18
- let module = await context[files[i]]();
19
- setNamespace(Modules, name, split, module);
20
- }
21
- }
22
-
23
- function setNamespace(Modules, name, namespace, module) {
24
- if ( !namespace.length ) {
25
- Modules[name] = module.default;
26
- return;
27
- }
28
-
29
- let first = namespace[0].replace(/-/g, ' ').replace(/_/g, ' ').replace(/(^([a-zA-Z\p{M}]))|([ -][a-zA-Z\p{M}])/g,function(s) {
30
- return s.toUpperCase();
31
- }).replace(/ /g, '');
32
-
33
- namespace.shift();
34
-
35
- if ( !Modules[first] ) {
36
- Modules[first] = {
37
- namespaced: true,
38
- modules: {},
39
- };
40
- }
41
-
42
- setNamespace(Modules[first].modules, name, namespace, module);
43
- }
44
-
45
- export default async (app) => {
46
- await loadModules();
47
-
48
- const Store = createStore({
49
- modules: Modules,
50
- });
51
-
52
- window.Store = Store;
53
- app.use(Store);
54
- };
1
+ import { createStore } from 'vuex';
2
+
3
+ const Modules = {};
4
+ let context = import.meta.glob('/app/Store/**/*.js', { eager: true });
5
+
6
+ const loadModules = async () => {
7
+ const files = Object.keys(context);
8
+
9
+ for ( let i = 0; i < files.length; i++ ) {
10
+ let split = files[i].split('/');
11
+ split.shift();
12
+ split.shift();
13
+ split.shift();
14
+
15
+ let name = split[split.length - 1].replace('.js', '');
16
+ split.pop();
17
+
18
+ let module = context[files[i]];
19
+ setNamespace(Modules, name, split, module);
20
+ }
21
+ }
22
+
23
+ function setNamespace(Modules, name, namespace, module) {
24
+ if ( !namespace.length ) {
25
+ Modules[name] = module.default;
26
+ return;
27
+ }
28
+
29
+ let first = namespace[0].replace(/-/g, ' ').replace(/_/g, ' ').replace(/(^([a-zA-Z\p{M}]))|([ -][a-zA-Z\p{M}])/g,function(s) {
30
+ return s.toUpperCase();
31
+ }).replace(/ /g, '');
32
+
33
+ namespace.shift();
34
+
35
+ if ( !Modules[first] ) {
36
+ Modules[first] = {
37
+ namespaced: true,
38
+ modules: {},
39
+ };
40
+ }
41
+
42
+ setNamespace(Modules[first].modules, name, namespace, module);
43
+ }
44
+
45
+ export default async (app) => {
46
+ await loadModules();
47
+
48
+ const Store = createStore({
49
+ modules: Modules,
50
+ });
51
+
52
+ window.Store = Store;
53
+ app.use(Store);
54
+ };