This commit is contained in:
darenhsu
2022-07-17 13:16:16 +08:00
parent 84759556ff
commit befd344ab0
28070 changed files with 4008428 additions and 1 deletions
+95
View File
@@ -0,0 +1,95 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _measurable = _interopRequireDefault(require("../../mixins/measurable"));
var _toggleable = _interopRequireDefault(require("../../mixins/toggleable"));
var _intersect = _interopRequireDefault(require("../../directives/intersect"));
var _mixins = _interopRequireDefault(require("../../util/mixins"));
var _helpers = require("../../util/helpers");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
var _default2 = (0, _mixins.default)(_measurable.default, _toggleable.default).extend({
name: 'VLazy',
directives: {
intersect: _intersect.default
},
props: {
options: {
type: Object,
// For more information on types, navigate to:
// https://developer.mozilla.org/en-US/docs/Web/API/Intersection_Observer_API
default: function _default() {
return {
root: undefined,
rootMargin: undefined,
threshold: undefined
};
}
},
tag: {
type: String,
default: 'div'
},
transition: {
type: String,
default: 'fade-transition'
}
},
computed: {
styles: function styles() {
return _objectSpread({}, this.measurableStyles);
}
},
methods: {
genContent: function genContent() {
var slot = (0, _helpers.getSlot)(this);
/* istanbul ignore if */
if (!this.transition) return slot;
var children = [];
if (this.isActive) children.push(slot);
return this.$createElement('transition', {
props: {
name: this.transition
}
}, children);
},
onObserve: function onObserve(entries, observer, isIntersecting) {
if (this.isActive) return;
this.isActive = isIntersecting;
}
},
render: function render(h) {
return h(this.tag, {
staticClass: 'v-lazy',
attrs: this.$attrs,
directives: [{
name: 'intersect',
value: {
handler: this.onObserve,
options: this.options
}
}],
on: this.$listeners,
style: this.styles
}, [this.genContent()]);
}
});
exports.default = _default2;
//# sourceMappingURL=VLazy.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"sources":["../../../src/components/VLazy/VLazy.ts"],"names":[],"mappings":";;;;;;;AACA;;AACA;;AAGA;;AAGA;;AACA;;;;;;;;;;gBAMe,qBACb,mBADa,EAEb,mBAFa,EAGb,MAHa,CAGN;AACP,EAAA,IAAI,EAAE,OADC;AAGP,EAAA,UAAU,EAAE;AAAE,IAAA,SAAS,EAAT;AAAF,GAHL;AAKP,EAAA,KAAK,EAAE;AACL,IAAA,OAAO,EAAE;AACP,MAAA,IAAI,EAAE,MADC;AAEP;AACA;AACA,MAAA,OAAO,EAAE;AAAA,eAAO;AACd,UAAA,IAAI,EAAE,SADQ;AAEd,UAAA,UAAU,EAAE,SAFE;AAGd,UAAA,SAAS,EAAE;AAHG,SAAP;AAAA;AAJF,KADJ;AAWL,IAAA,GAAG,EAAE;AACH,MAAA,IAAI,EAAE,MADH;AAEH,MAAA,OAAO,EAAE;AAFN,KAXA;AAeL,IAAA,UAAU,EAAE;AACV,MAAA,IAAI,EAAE,MADI;AAEV,MAAA,OAAO,EAAE;AAFC;AAfP,GALA;AA0BP,EAAA,QAAQ,EAAE;AACR,IAAA,MADQ,oBACF;AACJ,+BACK,KAAK,gBADV;AAGD;AALO,GA1BH;AAkCP,EAAA,OAAO,EAAE;AACP,IAAA,UADO,wBACG;AACR,UAAM,IAAI,GAAG,sBAAQ,IAAR,CAAb;AAEA;;AACA,UAAI,CAAC,KAAK,UAAV,EAAsB,OAAO,IAAP;AAEtB,UAAM,QAAQ,GAAG,EAAjB;AAEA,UAAI,KAAK,QAAT,EAAmB,QAAQ,CAAC,IAAT,CAAc,IAAd;AAEnB,aAAO,KAAK,cAAL,CAAoB,YAApB,EAAkC;AACvC,QAAA,KAAK,EAAE;AAAE,UAAA,IAAI,EAAE,KAAK;AAAb;AADgC,OAAlC,EAEJ,QAFI,CAAP;AAGD,KAdM;AAeP,IAAA,SAfO,qBAgBL,OAhBK,EAiBL,QAjBK,EAkBL,cAlBK,EAkBkB;AAEvB,UAAI,KAAK,QAAT,EAAmB;AAEnB,WAAK,QAAL,GAAgB,cAAhB;AACD;AAvBM,GAlCF;AA4DP,EAAA,MA5DO,kBA4DC,CA5DD,EA4DE;AACP,WAAO,CAAC,CAAC,KAAK,GAAN,EAAW;AACjB,MAAA,WAAW,EAAE,QADI;AAEjB,MAAA,KAAK,EAAE,KAAK,MAFK;AAGjB,MAAA,UAAU,EAAE,CAAC;AACX,QAAA,IAAI,EAAE,WADK;AAEX,QAAA,KAAK,EAAE;AACL,UAAA,OAAO,EAAE,KAAK,SADT;AAEL,UAAA,OAAO,EAAE,KAAK;AAFT;AAFI,OAAD,CAHK;AAUjB,MAAA,EAAE,EAAE,KAAK,UAVQ;AAWjB,MAAA,KAAK,EAAE,KAAK;AAXK,KAAX,EAYL,CAAC,KAAK,UAAL,EAAD,CAZK,CAAR;AAaD;AA1EM,CAHM,C","sourcesContent":["// Mixins\nimport Measurable from '../../mixins/measurable'\nimport Toggleable from '../../mixins/toggleable'\n\n// Directives\nimport intersect from '../../directives/intersect'\n\n// Utilities\nimport mixins from '../../util/mixins'\nimport { getSlot } from '../../util/helpers'\n\n// Types\nimport { VNode } from 'vue'\nimport { PropValidator } from 'vue/types/options'\n\nexport default mixins(\n Measurable,\n Toggleable\n).extend({\n name: 'VLazy',\n\n directives: { intersect },\n\n props: {\n options: {\n type: Object,\n // For more information on types, navigate to:\n // https://developer.mozilla.org/en-US/docs/Web/API/Intersection_Observer_API\n default: () => ({\n root: undefined,\n rootMargin: undefined,\n threshold: undefined,\n }),\n } as PropValidator<IntersectionObserverInit>,\n tag: {\n type: String,\n default: 'div',\n },\n transition: {\n type: String,\n default: 'fade-transition',\n },\n },\n\n computed: {\n styles (): object {\n return {\n ...this.measurableStyles,\n }\n },\n },\n\n methods: {\n genContent () {\n const slot = getSlot(this)\n\n /* istanbul ignore if */\n if (!this.transition) return slot\n\n const children = []\n\n if (this.isActive) children.push(slot)\n\n return this.$createElement('transition', {\n props: { name: this.transition },\n }, children)\n },\n onObserve (\n entries: IntersectionObserverEntry[],\n observer: IntersectionObserver,\n isIntersecting: boolean,\n ) {\n if (this.isActive) return\n\n this.isActive = isIntersecting\n },\n },\n\n render (h): VNode {\n return h(this.tag, {\n staticClass: 'v-lazy',\n attrs: this.$attrs,\n directives: [{\n name: 'intersect',\n value: {\n handler: this.onObserve,\n options: this.options,\n },\n }],\n on: this.$listeners,\n style: this.styles,\n }, [this.genContent()])\n },\n})\n"],"sourceRoot":"","file":"VLazy.js"}
+20
View File
@@ -0,0 +1,20 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "VLazy", {
enumerable: true,
get: function get() {
return _VLazy.default;
}
});
exports.default = void 0;
var _VLazy = _interopRequireDefault(require("./VLazy"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var _default = _VLazy.default;
exports.default = _default;
//# sourceMappingURL=index.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"sources":["../../../src/components/VLazy/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA;;;;eAGe,c","sourcesContent":["import VLazy from './VLazy'\n\nexport { VLazy }\nexport default VLazy\n"],"sourceRoot":"","file":"index.js"}