pome-ui 2.0.0-preview3 → 2.0.0-preview4
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 +1 -1
- package/pome-cache-query.js +2 -3
- package/pome-cache-query.min.js +1 -1
- package/pome-ui.dev.js +34 -29
- package/pome-ui.dev.min.js +1 -1
- package/pome-ui.js +34 -29
- package/pome-ui.min.js +1 -1
package/pome-ui.js
CHANGED
|
@@ -7,7 +7,7 @@ var Vue=function(e){"use strict";function t(e,t){const n=Object.create(null),o=e
|
|
|
7
7
|
|
|
8
8
|
window.Vue = Vue;
|
|
9
9
|
|
|
10
|
-
function
|
|
10
|
+
function build(options, exports) {
|
|
11
11
|
if (typeof exports == 'undefined') {
|
|
12
12
|
exports = {};
|
|
13
13
|
}
|
|
@@ -22,6 +22,17 @@ function buildPomeloUI(options, exports) {
|
|
|
22
22
|
httpGet: function (url) {
|
|
23
23
|
return fetch(url);
|
|
24
24
|
},
|
|
25
|
+
httpGetSync: function (url) {
|
|
26
|
+
if (useRelativePath) {
|
|
27
|
+
if (url.length && url[0] == '/') {
|
|
28
|
+
url = url.substr(1);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
var xhr = new XMLHttpRequest();
|
|
32
|
+
xhr.open('get', url, false);
|
|
33
|
+
xhr.send();
|
|
34
|
+
return xhr.responseText;
|
|
35
|
+
},
|
|
25
36
|
onNotFound: function (url, options) {
|
|
26
37
|
if (url.indexOf('/404') == 0) {
|
|
27
38
|
throw 'No not-found template found';
|
|
@@ -46,9 +57,6 @@ function buildPomeloUI(options, exports) {
|
|
|
46
57
|
},
|
|
47
58
|
resetDataWhenReuseContainerActiveView(viewName) {
|
|
48
59
|
return true;
|
|
49
|
-
},
|
|
50
|
-
getRoutePath() {
|
|
51
|
-
return '/shared/_routes.json';
|
|
52
60
|
}
|
|
53
61
|
};
|
|
54
62
|
|
|
@@ -119,18 +127,17 @@ function buildPomeloUI(options, exports) {
|
|
|
119
127
|
function root() {
|
|
120
128
|
return _root;
|
|
121
129
|
};
|
|
122
|
-
window._rules = {};
|
|
123
|
-
// Fetch route rules
|
|
124
|
-
var _loadRoutePromise = _httpGet(_options.getRoutePath()).then(function (rules) {
|
|
125
|
-
var rules = JSON.parse(rules);
|
|
126
|
-
if (!window._rules) {
|
|
127
|
-
window._rules = {};
|
|
128
|
-
}
|
|
129
|
-
_combineObject(rules, window._rules);
|
|
130
|
-
}).catch(err => {
|
|
131
|
-
console.error('No route provided. Please prepare /shared/_routes.json file and try again.');
|
|
132
|
-
});
|
|
133
130
|
|
|
131
|
+
exports._rules = [];
|
|
132
|
+
|
|
133
|
+
function useRoutes(url) {
|
|
134
|
+
var rules = _options.httpGetSync(url);
|
|
135
|
+
rules = JSON.parse(rules);
|
|
136
|
+
if (!exports._rules) {
|
|
137
|
+
exports._rules = {};
|
|
138
|
+
}
|
|
139
|
+
_combineObject(rules, exports._rules);
|
|
140
|
+
}
|
|
134
141
|
|
|
135
142
|
// Internal
|
|
136
143
|
function _combineObject(src, dest) {
|
|
@@ -514,22 +521,19 @@ function buildPomeloUI(options, exports) {
|
|
|
514
521
|
UpdateLayout();
|
|
515
522
|
};
|
|
516
523
|
|
|
517
|
-
|
|
518
|
-
return UpdateLayout();
|
|
519
|
-
});
|
|
520
|
-
|
|
524
|
+
return UpdateLayout();
|
|
521
525
|
}
|
|
522
526
|
|
|
523
|
-
function
|
|
527
|
+
function UseConfig(options) {
|
|
524
528
|
_combineObject(options, _options);
|
|
525
529
|
}
|
|
526
530
|
|
|
527
|
-
function
|
|
528
|
-
if (!
|
|
529
|
-
|
|
531
|
+
function MapRoute(rule, view) {
|
|
532
|
+
if (!exports._rules) {
|
|
533
|
+
exports._rules = {};
|
|
530
534
|
}
|
|
531
535
|
|
|
532
|
-
|
|
536
|
+
exports._rules[rule] = view;
|
|
533
537
|
}
|
|
534
538
|
|
|
535
539
|
function ForceUpdate(proxy = exports.root()) {
|
|
@@ -600,11 +604,11 @@ function buildPomeloUI(options, exports) {
|
|
|
600
604
|
return cnt;
|
|
601
605
|
}
|
|
602
606
|
|
|
603
|
-
var keys = Object.getOwnPropertyNames(
|
|
607
|
+
var keys = Object.getOwnPropertyNames(exports._rules);
|
|
604
608
|
for (var i = 0; i < keys.length; ++i) {
|
|
605
609
|
var rule = keys[i];
|
|
606
610
|
var isHash = rule[0] == '#';
|
|
607
|
-
var view =
|
|
611
|
+
var view = exports._rules[keys[i]];
|
|
608
612
|
var matches = matchAll(rule);
|
|
609
613
|
var params = [];
|
|
610
614
|
var patterns = [];
|
|
@@ -1229,16 +1233,17 @@ function buildPomeloUI(options, exports) {
|
|
|
1229
1233
|
}
|
|
1230
1234
|
|
|
1231
1235
|
exports.root = root;
|
|
1232
|
-
exports.
|
|
1233
|
-
exports.
|
|
1236
|
+
exports.useConfig = UseConfig;
|
|
1237
|
+
exports.mapRoute = MapRoute;
|
|
1234
1238
|
exports.matchRoute = MatchRoute;
|
|
1235
1239
|
exports.updateLayout = UpdateLayout;
|
|
1236
1240
|
exports.redirect = Redirect;
|
|
1237
1241
|
exports.loadScript = LoadScript;
|
|
1238
1242
|
exports.forceUpdate = ForceUpdate;
|
|
1239
1243
|
exports.mount = mount;
|
|
1244
|
+
exports.useRoutes = useRoutes;
|
|
1240
1245
|
|
|
1241
1246
|
return exports;
|
|
1242
1247
|
};
|
|
1243
1248
|
|
|
1244
|
-
exports.
|
|
1249
|
+
exports.build = build;
|