pome-ui 2.0.0-preview46 → 2.0.0-preview47
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-ui.dev.js +107 -3
- package/pome-ui.dev.min.js +13 -13
- package/pome-ui.js +107 -3
- package/pome-ui.min.js +4 -4
package/package.json
CHANGED
package/pome-ui.dev.js
CHANGED
|
@@ -18123,6 +18123,7 @@ function build(options, exports) {
|
|
|
18123
18123
|
var _options = {
|
|
18124
18124
|
resolveModulesParallelly: true,
|
|
18125
18125
|
removeStyleWhenUnmount: false,
|
|
18126
|
+
preloadCss: true,
|
|
18126
18127
|
mobile: function () {
|
|
18127
18128
|
return false;
|
|
18128
18129
|
},
|
|
@@ -18177,6 +18178,15 @@ function build(options, exports) {
|
|
|
18177
18178
|
|
|
18178
18179
|
var _css = {};
|
|
18179
18180
|
|
|
18181
|
+
var _cssCloakInjected = false;
|
|
18182
|
+
function _ensureCssCloakStyle() {
|
|
18183
|
+
if (_cssCloakInjected) return;
|
|
18184
|
+
_cssCloakInjected = true;
|
|
18185
|
+
var style = document.createElement('style');
|
|
18186
|
+
style.textContent = '._pome-css-cloak{visibility:hidden!important}';
|
|
18187
|
+
document.head.appendChild(style);
|
|
18188
|
+
}
|
|
18189
|
+
|
|
18180
18190
|
function _httpCached(url) {
|
|
18181
18191
|
return !!_cache[url];
|
|
18182
18192
|
}
|
|
@@ -18476,7 +18486,16 @@ function build(options, exports) {
|
|
|
18476
18486
|
var components = component.components || [];
|
|
18477
18487
|
var directives = component.directives || [];
|
|
18478
18488
|
var _ret;
|
|
18479
|
-
|
|
18489
|
+
|
|
18490
|
+
// Preload page's own CSS before mount
|
|
18491
|
+
var pageCssPromise = Promise.resolve();
|
|
18492
|
+
var viewName = url + (mobile ? '.m' : '');
|
|
18493
|
+
if (_options.preloadCss && component.style) {
|
|
18494
|
+
pageCssPromise = appendCssReferenceAsync(viewName, component.style);
|
|
18495
|
+
}
|
|
18496
|
+
|
|
18497
|
+
return Promise.all([pageCssPromise, _loadComponents(components, url)]).then(function (results) {
|
|
18498
|
+
var components = results[1];
|
|
18480
18499
|
var ret = Vue.createApp(component);
|
|
18481
18500
|
|
|
18482
18501
|
for (var i = 0; i < components.length; ++i) {
|
|
@@ -19070,6 +19089,71 @@ function build(options, exports) {
|
|
|
19070
19089
|
} catch (ex) { }
|
|
19071
19090
|
}
|
|
19072
19091
|
|
|
19092
|
+
function internalAppendCssReferenceAsync(viewName, href) {
|
|
19093
|
+
if (document.querySelectorAll('link[data-style="' + viewName + '"][href="' + href + '"]').length) {
|
|
19094
|
+
return Promise.resolve();
|
|
19095
|
+
}
|
|
19096
|
+
|
|
19097
|
+
return new Promise(function (resolve) {
|
|
19098
|
+
var link = document.createElement('link');
|
|
19099
|
+
link.rel = 'stylesheet';
|
|
19100
|
+
link.type = 'text/' + getStyleSheetType(href);
|
|
19101
|
+
link.setAttribute('data-style', viewName);
|
|
19102
|
+
function onReady() {
|
|
19103
|
+
requestAnimationFrame(function () {
|
|
19104
|
+
resolve();
|
|
19105
|
+
});
|
|
19106
|
+
}
|
|
19107
|
+
link.onload = onReady;
|
|
19108
|
+
link.onerror = onReady;
|
|
19109
|
+
link.href = href;
|
|
19110
|
+
try {
|
|
19111
|
+
document.querySelector('head').appendChild(link);
|
|
19112
|
+
} catch (ex) {
|
|
19113
|
+
resolve();
|
|
19114
|
+
}
|
|
19115
|
+
});
|
|
19116
|
+
}
|
|
19117
|
+
|
|
19118
|
+
function appendCssReferenceAsync(view, style) {
|
|
19119
|
+
var promises = [];
|
|
19120
|
+
if (typeof style == 'boolean') {
|
|
19121
|
+
var href = view + '.css';
|
|
19122
|
+
if (_options.version) {
|
|
19123
|
+
href += '?v=' + _options.version;
|
|
19124
|
+
}
|
|
19125
|
+
promises.push(internalAppendCssReferenceAsync(view, href));
|
|
19126
|
+
} else if (typeof style == 'string') {
|
|
19127
|
+
var href = parseMacroPath(view, style);
|
|
19128
|
+
href = resolveRelativePath(href, getContainingFolder(view));
|
|
19129
|
+
if (_options.version) {
|
|
19130
|
+
if (href.indexOf('>') < 0) {
|
|
19131
|
+
href += '?v=' + _options.version;
|
|
19132
|
+
} else {
|
|
19133
|
+
href += '&v=' + _options.version;
|
|
19134
|
+
}
|
|
19135
|
+
}
|
|
19136
|
+
promises.push(internalAppendCssReferenceAsync(view, href));
|
|
19137
|
+
} else if (style instanceof Array) {
|
|
19138
|
+
for (var i = 0; i < style.length; ++i) {
|
|
19139
|
+
if (typeof style[i] != 'string') {
|
|
19140
|
+
continue;
|
|
19141
|
+
}
|
|
19142
|
+
var href = parseMacroPath(view, style[i]);
|
|
19143
|
+
href = resolveRelativePath(href, getContainingFolder(view));
|
|
19144
|
+
if (_options.version) {
|
|
19145
|
+
if (href.indexOf('>') < 0) {
|
|
19146
|
+
href += '?v=' + _options.version;
|
|
19147
|
+
} else {
|
|
19148
|
+
href += '&v=' + _options.version;
|
|
19149
|
+
}
|
|
19150
|
+
}
|
|
19151
|
+
promises.push(internalAppendCssReferenceAsync(view, href));
|
|
19152
|
+
}
|
|
19153
|
+
}
|
|
19154
|
+
return Promise.all(promises);
|
|
19155
|
+
}
|
|
19156
|
+
|
|
19073
19157
|
function getStyleSheetType(styleSheetUrl) {
|
|
19074
19158
|
var questionMarkIndex = styleSheetUrl.lastIndexOf('?');
|
|
19075
19159
|
if (questionMarkIndex >= 0) {
|
|
@@ -19121,7 +19205,11 @@ function build(options, exports) {
|
|
|
19121
19205
|
_css[view] = 0;
|
|
19122
19206
|
}
|
|
19123
19207
|
if (_css[view] == 0) {
|
|
19124
|
-
|
|
19208
|
+
if (_options.preloadCss) {
|
|
19209
|
+
this._cssLoadPromise = appendCssReferenceAsync(view, options.style);
|
|
19210
|
+
} else {
|
|
19211
|
+
appendCssReference(view, options.style);
|
|
19212
|
+
}
|
|
19125
19213
|
}
|
|
19126
19214
|
++_css[view];
|
|
19127
19215
|
this.createdPromise = Promise.resolve();
|
|
@@ -19136,6 +19224,18 @@ function build(options, exports) {
|
|
|
19136
19224
|
|
|
19137
19225
|
var originalMounted = options.mounted;
|
|
19138
19226
|
options.mounted = function () {
|
|
19227
|
+
// CSS cloak: hide element until CSS is fully loaded
|
|
19228
|
+
if (_options.preloadCss && this._cssLoadPromise) {
|
|
19229
|
+
_ensureCssCloakStyle();
|
|
19230
|
+
var el = this.$el;
|
|
19231
|
+
if (el && el.nodeType === 1) {
|
|
19232
|
+
el.classList.add('_pome-css-cloak');
|
|
19233
|
+
this._cssLoadPromise.then(function () {
|
|
19234
|
+
el.classList.remove('_pome-css-cloak');
|
|
19235
|
+
});
|
|
19236
|
+
}
|
|
19237
|
+
}
|
|
19238
|
+
|
|
19139
19239
|
// Remove opening class if needed
|
|
19140
19240
|
if (options.delayOpen) {
|
|
19141
19241
|
var self = this;
|
|
@@ -19460,7 +19560,11 @@ function build(options, exports) {
|
|
|
19460
19560
|
_hookSetup(_opt);
|
|
19461
19561
|
_patchComponent(c, _opt);
|
|
19462
19562
|
_hookData(_opt);
|
|
19463
|
-
|
|
19563
|
+
var cssPreloadPromise = Promise.resolve();
|
|
19564
|
+
if (_options.preloadCss && _opt.style) {
|
|
19565
|
+
cssPreloadPromise = appendCssReferenceAsync(c, _opt.style);
|
|
19566
|
+
}
|
|
19567
|
+
return Promise.all([cssPreloadPromise, _resolveModules(_opt.modules, c)]);
|
|
19464
19568
|
}).then(function () {
|
|
19465
19569
|
// Recursively load sub-components for this component
|
|
19466
19570
|
var subComponentRefs = _opt.components || [];
|