Skip to content

Commit 69c3bc7

Browse files
Mihail0vnormansander
authored andcommitted
Fixed rollup build trouble (KitchenStories#15)
1 parent 2c47d98 commit 69c3bc7

File tree

4 files changed

+134
-124
lines changed

4 files changed

+134
-124
lines changed

dist/js/vue-gallery-slideshow.js

+130-122
Original file line numberDiff line numberDiff line change
@@ -125,149 +125,157 @@
125125
}
126126
};
127127

128-
function normalizeComponent(compiledTemplate, injectStyle, defaultExport, scopeId, isFunctionalTemplate, moduleIdentifier /* server only */, isShadowMode, createInjector, createInjectorSSR, createInjectorShadow) {
129-
if (typeof isShadowMode === 'function') {
130-
createInjectorSSR = createInjector;
131-
createInjector = isShadowMode;
132-
isShadowMode = false;
133-
}
134-
// Vue.extend constructor export interop
135-
const options = typeof defaultExport === 'function' ? defaultExport.options : defaultExport;
136-
// render functions
137-
if (compiledTemplate && compiledTemplate.render) {
138-
options.render = compiledTemplate.render;
139-
options.staticRenderFns = compiledTemplate.staticRenderFns;
140-
options._compiled = true;
141-
// functional template
142-
if (isFunctionalTemplate) {
143-
options.functional = true;
144-
}
145-
}
146-
// scopedId
147-
if (scopeId) {
148-
options._scopeId = scopeId;
149-
}
150-
let hook;
151-
if (moduleIdentifier) {
152-
// server build
153-
hook = function (context) {
154-
// 2.3 injection
155-
context =
156-
context || // cached call
157-
(this.$vnode && this.$vnode.ssrContext) || // stateful
158-
(this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext); // functional
159-
// 2.2 with runInNewContext: true
160-
if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
161-
context = __VUE_SSR_CONTEXT__;
162-
}
163-
// inject component styles
164-
if (injectStyle) {
165-
injectStyle.call(this, createInjectorSSR(context));
166-
}
167-
// register component module identifier for async chunk inference
168-
if (context && context._registeredComponents) {
169-
context._registeredComponents.add(moduleIdentifier);
170-
}
171-
};
172-
// used by ssr in case component is cached and beforeCreate
173-
// never gets called
174-
options._ssrRegister = hook;
175-
}
176-
else if (injectStyle) {
177-
hook = isShadowMode
178-
? function () {
179-
injectStyle.call(this, createInjectorShadow(this.$root.$options.shadowRoot));
180-
}
181-
: function (context) {
182-
injectStyle.call(this, createInjector(context));
183-
};
128+
function normalizeComponent(template, style, script, scopeId, isFunctionalTemplate, moduleIdentifier
129+
/* server only */
130+
, shadowMode, createInjector, createInjectorSSR, createInjectorShadow) {
131+
if (typeof shadowMode !== 'boolean') {
132+
createInjectorSSR = createInjector;
133+
createInjector = shadowMode;
134+
shadowMode = false;
135+
} // Vue.extend constructor export interop.
136+
137+
138+
var options = typeof script === 'function' ? script.options : script; // render functions
139+
140+
if (template && template.render) {
141+
options.render = template.render;
142+
options.staticRenderFns = template.staticRenderFns;
143+
options._compiled = true; // functional template
144+
145+
if (isFunctionalTemplate) {
146+
options.functional = true;
184147
}
185-
if (hook) {
186-
if (options.functional) {
187-
// register for functional component in vue file
188-
const originalRender = options.render;
189-
options.render = function renderWithStyleInjection(h, context) {
190-
hook.call(context);
191-
return originalRender(h, context);
192-
};
193-
}
194-
else {
195-
// inject component registration as beforeCreate hook
196-
const existing = options.beforeCreate;
197-
options.beforeCreate = existing ? [].concat(existing, hook) : [hook];
198-
}
148+
} // scopedId
149+
150+
151+
if (scopeId) {
152+
options._scopeId = scopeId;
153+
}
154+
155+
var hook;
156+
157+
if (moduleIdentifier) {
158+
// server build
159+
hook = function hook(context) {
160+
// 2.3 injection
161+
context = context || // cached call
162+
this.$vnode && this.$vnode.ssrContext || // stateful
163+
this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext; // functional
164+
// 2.2 with runInNewContext: true
165+
166+
if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
167+
context = __VUE_SSR_CONTEXT__;
168+
} // inject component styles
169+
170+
171+
if (style) {
172+
style.call(this, createInjectorSSR(context));
173+
} // register component module identifier for async chunk inference
174+
175+
176+
if (context && context._registeredComponents) {
177+
context._registeredComponents.add(moduleIdentifier);
178+
}
179+
}; // used by ssr in case component is cached and beforeCreate
180+
// never gets called
181+
182+
183+
options._ssrRegister = hook;
184+
} else if (style) {
185+
hook = shadowMode ? function () {
186+
style.call(this, createInjectorShadow(this.$root.$options.shadowRoot));
187+
} : function (context) {
188+
style.call(this, createInjector(context));
189+
};
190+
}
191+
192+
if (hook) {
193+
if (options.functional) {
194+
// register for functional component in vue file
195+
var originalRender = options.render;
196+
197+
options.render = function renderWithStyleInjection(h, context) {
198+
hook.call(context);
199+
return originalRender(h, context);
200+
};
201+
} else {
202+
// inject component registration as beforeCreate hook
203+
var existing = options.beforeCreate;
204+
options.beforeCreate = existing ? [].concat(existing, hook) : [hook];
199205
}
200-
return defaultExport;
206+
}
207+
208+
return script;
201209
}
202210

203-
const isOldIE = typeof navigator !== 'undefined' &&
204-
/msie [6-9]\\b/.test(navigator.userAgent.toLowerCase());
211+
var normalizeComponent_1 = normalizeComponent;
212+
213+
var isOldIE = typeof navigator !== 'undefined' && /msie [6-9]\\b/.test(navigator.userAgent.toLowerCase());
205214
function createInjector(context) {
206-
return (id, style) => addStyle(id, style);
215+
return function (id, style) {
216+
return addStyle(id, style);
217+
};
207218
}
208-
const HEAD = document.head || document.getElementsByTagName('head')[0];
209-
const styles = {};
219+
var HEAD = document.head || document.getElementsByTagName('head')[0];
220+
var styles = {};
221+
210222
function addStyle(id, css) {
211-
const group = isOldIE ? css.media || 'default' : id;
212-
const style = styles[group] || (styles[group] = { ids: new Set(), styles: [] });
213-
if (!style.ids.has(id)) {
214-
style.ids.add(id);
215-
let code = css.source;
216-
if (css.map) {
217-
// https://developer.chrome.com/devtools/docs/javascript-debugging
218-
// this makes source maps inside style tags work properly in Chrome
219-
code += '\n/*# sourceURL=' + css.map.sources[0] + ' */';
220-
// http://stackoverflow.com/a/26603875
221-
code +=
222-
'\n/*# sourceMappingURL=data:application/json;base64,' +
223-
btoa(unescape(encodeURIComponent(JSON.stringify(css.map)))) +
224-
' */';
225-
}
226-
if (!style.element) {
227-
style.element = document.createElement('style');
228-
style.element.type = 'text/css';
229-
if (css.media)
230-
style.element.setAttribute('media', css.media);
231-
HEAD.appendChild(style.element);
232-
}
233-
if ('styleSheet' in style.element) {
234-
style.styles.push(code);
235-
style.element.styleSheet.cssText = style.styles
236-
.filter(Boolean)
237-
.join('\n');
238-
}
239-
else {
240-
const index = style.ids.size - 1;
241-
const textNode = document.createTextNode(code);
242-
const nodes = style.element.childNodes;
243-
if (nodes[index])
244-
style.element.removeChild(nodes[index]);
245-
if (nodes.length)
246-
style.element.insertBefore(textNode, nodes[index]);
247-
else
248-
style.element.appendChild(textNode);
249-
}
223+
var group = isOldIE ? css.media || 'default' : id;
224+
var style = styles[group] || (styles[group] = {
225+
ids: new Set(),
226+
styles: []
227+
});
228+
229+
if (!style.ids.has(id)) {
230+
style.ids.add(id);
231+
var code = css.source;
232+
233+
if (css.map) {
234+
// https://developer.chrome.com/devtools/docs/javascript-debugging
235+
// this makes source maps inside style tags work properly in Chrome
236+
code += '\n/*# sourceURL=' + css.map.sources[0] + ' */'; // http://stackoverflow.com/a/26603875
237+
238+
code += '\n/*# sourceMappingURL=data:application/json;base64,' + btoa(unescape(encodeURIComponent(JSON.stringify(css.map)))) + ' */';
239+
}
240+
241+
if (!style.element) {
242+
style.element = document.createElement('style');
243+
style.element.type = 'text/css';
244+
if (css.media) style.element.setAttribute('media', css.media);
245+
HEAD.appendChild(style.element);
250246
}
247+
248+
if ('styleSheet' in style.element) {
249+
style.styles.push(code);
250+
style.element.styleSheet.cssText = style.styles.filter(Boolean).join('\n');
251+
} else {
252+
var index = style.ids.size - 1;
253+
var textNode = document.createTextNode(code);
254+
var nodes = style.element.childNodes;
255+
if (nodes[index]) style.element.removeChild(nodes[index]);
256+
if (nodes.length) style.element.insertBefore(textNode, nodes[index]);else style.element.appendChild(textNode);
257+
}
258+
}
251259
}
252260

261+
var browser = createInjector;
262+
253263
/* script */
254264
var __vue_script__ = script;
255-
// For security concerns, we use only base name in production mode. See https://github.com/vuejs/rollup-plugin-vue/issues/258
256-
script.__file = "GallerySlideshow.vue";
257265

258266
/* template */
259267
var __vue_render__ = function __vue_render__() {
260-
var _vm = this;var _h = _vm.$createElement;var _c = _vm._self._c || _h;return _c('transition', { attrs: { "name": "modal" } }, [_vm.imgIndex !== null ? _c('div', { staticClass: "vgs", on: { "click": _vm.close } }, [_c('button', { staticClass: "vgs__close", on: { "click": _vm.close } }, [_vm._v("×")]), _vm._v(" "), _vm.isMultiple ? _c('button', { staticClass: "vgs__prev", on: { "click": function click($event) {
268+
var _vm = this;var _h = _vm.$createElement;var _c = _vm._self._c || _h;return _c('transition', { attrs: { "name": "modal" } }, [_vm.imgIndex !== null ? _c('div', { staticClass: "vgs", on: { "click": _vm.close } }, [_c('button', { staticClass: "vgs__close", attrs: { "type": "button" }, on: { "click": _vm.close } }, [_vm._v("×")]), _vm._v(" "), _vm.isMultiple ? _c('button', { staticClass: "vgs__prev", attrs: { "type": "button" }, on: { "click": function click($event) {
261269
$event.stopPropagation();return _vm.onPrev($event);
262270
} } }, [_vm._v("‹")]) : _vm._e(), _vm._v(" "), _vm.images ? _c('div', { staticClass: "vgs__container", on: { "click": function click($event) {
263271
$event.stopPropagation();return _vm.onNext($event);
264272
} } }, [_c('img', { staticClass: "vgs__container__img", attrs: { "src": _vm.imageUrl }, on: { "click": function click($event) {
265273
$event.stopPropagation();return _vm.onNext($event);
266-
} } })]) : _vm._e(), _vm._v(" "), _vm.isMultiple ? _c('button', { staticClass: "vgs__next", on: { "click": function click($event) {
274+
} } })]) : _vm._e(), _vm._v(" "), _vm.isMultiple ? _c('button', { staticClass: "vgs__next", attrs: { "type": "button" }, on: { "click": function click($event) {
267275
$event.stopPropagation();return _vm.onNext($event);
268276
} } }, [_vm._v("›")]) : _vm._e(), _vm._v(" "), _vm.isMultiple ? _c('div', { ref: "gallery", staticClass: "vgs__gallery" }, [_vm.images ? _c('div', { staticClass: "vgs__gallery__title" }, [_vm._v(_vm._s(_vm.imgIndex + 1) + " / " + _vm._s(_vm.images.length))]) : _vm._e(), _vm._v(" "), _vm.images ? _c('div', { staticClass: "vgs__gallery__container", style: { transform: 'translate(' + _vm.galleryXPos + 'px, 0)' } }, _vm._l(_vm.images, function (image, i) {
269277
return _c('img', { key: i, staticClass: "vgs__gallery__container__img", class: { 'vgs__gallery__container__img--active': i === _vm.imgIndex }, attrs: { "src": image }, on: { "click": function click($event) {
270-
$event.stopPropagation();_vm.onClickThumb(image, i);
278+
$event.stopPropagation();return _vm.onClickThumb(image, i);
271279
} } });
272280
}), 0) : _vm._e()]) : _vm._e()]) : _vm._e()]);
273281
};
@@ -276,7 +284,7 @@
276284
/* style */
277285
var __vue_inject_styles__ = function __vue_inject_styles__(inject) {
278286
if (!inject) return;
279-
inject("data-v-3aec641d_0", { source: ".vgs{transition:opacity .2s ease;position:fixed;z-index:9998;top:0;left:0;width:100%;min-height:100%;height:100vh;background-color:rgba(0,0,0,.8);display:table}.vgs__close{color:#fff;position:absolute;top:0;right:0;background-color:transparent;border:none;font-size:25px;width:50px;height:50px;cursor:pointer;z-index:999}.vgs__close:focus{outline:0}.vgs__next,.vgs__prev{position:absolute;top:50%;margin-top:-25px;width:50px;height:50px;z-index:999;cursor:pointer;font-size:40px;color:#fff;background-color:transparent;border:none}.vgs__next:focus,.vgs__prev:focus{outline:0}.vgs__prev{left:0}.vgs__next{right:0}.vgs__container{position:absolute;overflow:hidden;cursor:pointer;overflow:hidden;max-width:100vh;margin:.5rem auto 0;left:.5rem;right:.5rem;height:60vh;border-radius:12px;background-color:#000}@media (max-width:767px){.vgs__container{width:100%;max-width:100%;top:50%;margin-top:-140px;left:0;right:0;border-radius:0;height:280px}}.vgs__container__img{width:100%;height:100%;object-fit:contain}.vgs__gallery{overflow-x:hidden;overflow-y:hidden;position:absolute;bottom:10px;margin:auto;max-width:100vh;white-space:nowrap;left:.5rem;right:.5rem}@media (max-width:767px){.vgs__gallery{display:none}}.vgs__gallery__title{color:#fff;margin-bottom:.5rem}.vgs__gallery__container{overflow:visible;display:block;height:100px;white-space:nowrap;transition:all .2s ease-in-out;width:100%}.vgs__gallery__container__img{width:100px;height:100px;object-fit:cover;display:inline-block;float:none;margin-right:20px;cursor:pointer;opacity:.6;border-radius:8px}.vgs__gallery__container__img--active{width:100px;display:inline-block;float:none;opacity:1}.modal-enter{opacity:0}.modal-leave-active{opacity:0}", map: undefined, media: undefined });
287+
inject("data-v-4488c8a8_0", { source: ".vgs{transition:opacity .2s ease;position:fixed;z-index:9998;top:0;left:0;width:100%;min-height:100%;height:100vh;background-color:rgba(0,0,0,.8);display:table}.vgs__close{color:#fff;position:absolute;top:0;right:0;background-color:transparent;border:none;font-size:25px;width:50px;height:50px;cursor:pointer;z-index:999}.vgs__close:focus{outline:0}.vgs__next,.vgs__prev{position:absolute;top:50%;margin-top:-25px;width:50px;height:50px;z-index:999;cursor:pointer;font-size:40px;color:#fff;background-color:transparent;border:none}.vgs__next:focus,.vgs__prev:focus{outline:0}.vgs__prev{left:0}.vgs__next{right:0}.vgs__container{position:absolute;overflow:hidden;cursor:pointer;overflow:hidden;max-width:100vh;margin:.5rem auto 0;left:.5rem;right:.5rem;height:60vh;border-radius:12px;background-color:#000}@media (max-width:767px){.vgs__container{width:100%;max-width:100%;top:50%;margin-top:-140px;left:0;right:0;border-radius:0;height:280px}}.vgs__container__img{width:100%;height:100%;object-fit:contain}.vgs__gallery{overflow-x:hidden;overflow-y:hidden;position:absolute;bottom:10px;margin:auto;max-width:100vh;white-space:nowrap;left:.5rem;right:.5rem}@media (max-width:767px){.vgs__gallery{display:none}}.vgs__gallery__title{color:#fff;margin-bottom:.5rem}.vgs__gallery__container{overflow:visible;display:block;height:100px;white-space:nowrap;transition:all .2s ease-in-out;width:100%}.vgs__gallery__container__img{width:100px;height:100px;object-fit:cover;display:inline-block;float:none;margin-right:20px;cursor:pointer;opacity:.6;border-radius:8px}.vgs__gallery__container__img--active{width:100px;display:inline-block;float:none;opacity:1}.modal-enter{opacity:0}.modal-leave-active{opacity:0}", map: undefined, media: undefined });
280288
};
281289
/* scoped */
282290
var __vue_scope_id__ = undefined;
@@ -286,7 +294,7 @@
286294
var __vue_is_functional_template__ = false;
287295
/* style inject SSR */
288296

289-
var GallerySlideshow = normalizeComponent({ render: __vue_render__, staticRenderFns: __vue_staticRenderFns__ }, __vue_inject_styles__, __vue_script__, __vue_scope_id__, __vue_is_functional_template__, __vue_module_identifier__, createInjector, undefined);
297+
var GallerySlideshow = normalizeComponent_1({ render: __vue_render__, staticRenderFns: __vue_staticRenderFns__ }, __vue_inject_styles__, __vue_script__, __vue_scope_id__, __vue_is_functional_template__, __vue_module_identifier__, browser, undefined);
290298

291299
return GallerySlideshow;
292300

0 commit comments

Comments
 (0)