Skip to content

Commit 3e9d9c7

Browse files
committed
[build] 7.2.4
1 parent f02fa0e commit 3e9d9c7

13 files changed

+1704
-50
lines changed

Diff for: dist/vue-class-component.cjs.js

+439
Large diffs are not rendered by default.

Diff for: dist/vue-class-component.common.js

+10-12
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* vue-class-component v7.2.3
2+
* vue-class-component v7.2.4
33
* (c) 2015-present Evan You
44
* @license MIT
55
*/
@@ -149,17 +149,15 @@ function collectDataFromConstructor(vm, Component) {
149149
}
150150

151151
keys.forEach(function (key) {
152-
if (key.charAt(0) !== '_') {
153-
Object.defineProperty(_this, key, {
154-
get: function get() {
155-
return vm[key];
156-
},
157-
set: function set(value) {
158-
vm[key] = value;
159-
},
160-
configurable: true
161-
});
162-
}
152+
Object.defineProperty(_this, key, {
153+
get: function get() {
154+
return vm[key];
155+
},
156+
set: function set(value) {
157+
vm[key] = value;
158+
},
159+
configurable: true
160+
});
163161
});
164162
}; // should be acquired class property values
165163

Diff for: dist/vue-class-component.d.ts

+80
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
import { ComponentOptions } from 'vue';
2+
import { ComponentPublicInstance } from 'vue';
3+
import { SetupContext } from 'vue';
4+
import { UnwrapRef } from 'vue';
5+
import { VNode } from 'vue';
6+
7+
export declare interface ClassComponentHooks {
8+
data?(): object;
9+
beforeCreate?(): void;
10+
created?(): void;
11+
beforeMount?(): void;
12+
mounted?(): void;
13+
beforeUnmount?(): void;
14+
unmounted?(): void;
15+
beforeUpdate?(): void;
16+
updated?(): void;
17+
activated?(): void;
18+
deactivated?(): void;
19+
render?(): VNode | void;
20+
errorCaptured?(err: Error, vm: Vue, info: string): boolean | undefined;
21+
serverPrefetch?(): Promise<unknown>;
22+
}
23+
24+
export declare function createDecorator(factory: (options: ComponentOptions, key: string, index: number) => void): VueDecorator;
25+
26+
export declare type ExtractInstance<T> = T extends VueMixin<infer V> ? V : never;
27+
28+
export declare type MixedVueBase<Mixins extends VueMixin[]> = Mixins extends (infer T)[] ? VueBase<UnionToIntersection<ExtractInstance<T>> & Vue> & PropsMixin : never;
29+
30+
export declare function mixins<T extends VueMixin[]>(...Ctors: T): MixedVueBase<T>;
31+
32+
export declare function Options<V extends Vue>(options: ComponentOptions & ThisType<V>): <VC extends VueBase>(target: VC) => VC;
33+
34+
export declare interface PropsMixin {
35+
new <Props = unknown>(...args: any[]): {
36+
$props: Props;
37+
};
38+
}
39+
40+
export declare function setup<R>(setupFn: () => R): UnwrapRef<R>;
41+
42+
export declare type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends (k: infer I) => void ? I : never;
43+
44+
export declare type Vue<Props = unknown> = ComponentPublicInstance<{}, {}, {}, {}, {}, Record<string, any>, Props> & ClassComponentHooks;
45+
46+
export declare const Vue: VueConstructor;
47+
48+
export declare type VueBase<V extends Vue = Vue> = VueMixin<V> & (new (...args: any[]) => V);
49+
50+
export declare interface VueConstructor extends VueStatic {
51+
new <Props = unknown>(prop: Props, ctx: SetupContext): Vue<Props>;
52+
}
53+
54+
export declare interface VueDecorator {
55+
(Ctor: VueBase): void;
56+
(target: Vue, key: string): void;
57+
(target: Vue, key: string, index: number): void;
58+
}
59+
60+
export declare type VueMixin<V extends Vue = Vue> = VueStatic & {
61+
prototype: V;
62+
};
63+
64+
export declare interface VueStatic {
65+
/* Excluded from this release type: __vccCache */
66+
/* Excluded from this release type: __vccBase */
67+
/* Excluded from this release type: __vccDecorators */
68+
/* Excluded from this release type: __vccMixins */
69+
/* Excluded from this release type: __vccHooks */
70+
/* Excluded from this release type: __vccOpts */
71+
/* Excluded from this release type: render */
72+
/* Excluded from this release type: ssrRender */
73+
/* Excluded from this release type: __file */
74+
/* Excluded from this release type: __cssModules */
75+
/* Excluded from this release type: __scopeId */
76+
/* Excluded from this release type: __hmrId */
77+
registerHooks(keys: string[]): void;
78+
}
79+
80+
export { }

Diff for: dist/vue-class-component.esm-browser.js

+260
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,260 @@
1+
/**
2+
* vue-class-component v8.0.0-alpha.6
3+
* (c) 2015-present Evan You
4+
* @license MIT
5+
*/
6+
import { reactive } from 'vue';
7+
8+
function _defineProperty(obj, key, value) {
9+
if (key in obj) {
10+
Object.defineProperty(obj, key, {
11+
value: value,
12+
enumerable: true,
13+
configurable: true,
14+
writable: true
15+
});
16+
} else {
17+
obj[key] = value;
18+
}
19+
20+
return obj;
21+
}
22+
23+
function ownKeys(object, enumerableOnly) {
24+
var keys = Object.keys(object);
25+
26+
if (Object.getOwnPropertySymbols) {
27+
var symbols = Object.getOwnPropertySymbols(object);
28+
if (enumerableOnly) symbols = symbols.filter(function (sym) {
29+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
30+
});
31+
keys.push.apply(keys, symbols);
32+
}
33+
34+
return keys;
35+
}
36+
37+
function _objectSpread2(target) {
38+
for (var i = 1; i < arguments.length; i++) {
39+
var source = arguments[i] != null ? arguments[i] : {};
40+
41+
if (i % 2) {
42+
ownKeys(Object(source), true).forEach(function (key) {
43+
_defineProperty(target, key, source[key]);
44+
});
45+
} else if (Object.getOwnPropertyDescriptors) {
46+
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
47+
} else {
48+
ownKeys(Object(source)).forEach(function (key) {
49+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
50+
});
51+
}
52+
}
53+
54+
return target;
55+
}
56+
57+
function defineGetter(obj, key, getter) {
58+
Object.defineProperty(obj, key, {
59+
get: getter,
60+
enumerable: false,
61+
configurable: true
62+
});
63+
}
64+
65+
function defineProxy(proxy, key, target) {
66+
Object.defineProperty(proxy, key, {
67+
get: () => target[key],
68+
set: value => {
69+
target[key] = value;
70+
},
71+
enumerable: true,
72+
configurable: true
73+
});
74+
}
75+
76+
function getSuperOptions(Ctor) {
77+
var superProto = Object.getPrototypeOf(Ctor.prototype);
78+
79+
if (!superProto) {
80+
return undefined;
81+
}
82+
83+
var Super = superProto.constructor;
84+
return Super.__vccOpts;
85+
}
86+
87+
class VueImpl {
88+
constructor(props, ctx) {
89+
defineGetter(this, '$props', () => props);
90+
defineGetter(this, '$attrs', () => ctx.attrs);
91+
defineGetter(this, '$slots', () => ctx.slots);
92+
defineGetter(this, '$emit', () => ctx.emit);
93+
Object.keys(props).forEach(key => {
94+
Object.defineProperty(this, key, {
95+
enumerable: false,
96+
configurable: true,
97+
writable: true,
98+
value: props[key]
99+
});
100+
});
101+
}
102+
/** @internal */
103+
104+
105+
static get __vccOpts() {
106+
// Early return if `this` is base class as it does not have any options
107+
if (this === Vue) {
108+
return {};
109+
}
110+
111+
var cache = this.hasOwnProperty('__vccCache') && this.__vccCache;
112+
113+
if (cache) {
114+
return cache;
115+
}
116+
117+
var Ctor = this; // If the options are provided via decorator use it as a base
118+
119+
var options = this.__vccCache = this.hasOwnProperty('__vccBase') ? _objectSpread2({}, this.__vccBase) : {}; // Handle super class options
120+
121+
options.extends = getSuperOptions(Ctor); // Handle mixins
122+
123+
var mixins = this.hasOwnProperty('__vccMixins') && this.__vccMixins;
124+
125+
if (mixins) {
126+
options.mixins = options.mixins ? options.mixins.concat(mixins) : mixins;
127+
}
128+
129+
options.methods = _objectSpread2({}, options.methods);
130+
options.computed = _objectSpread2({}, options.computed);
131+
var proto = Ctor.prototype;
132+
Object.getOwnPropertyNames(proto).forEach(key => {
133+
if (key === 'constructor') {
134+
return;
135+
} // hooks
136+
137+
138+
if (Ctor.__vccHooks.indexOf(key) > -1) {
139+
options[key] = proto[key];
140+
return;
141+
}
142+
143+
var descriptor = Object.getOwnPropertyDescriptor(proto, key); // methods
144+
145+
if (typeof descriptor.value === 'function') {
146+
options.methods[key] = descriptor.value;
147+
return;
148+
} // computed properties
149+
150+
151+
if (descriptor.get || descriptor.set) {
152+
options.computed[key] = {
153+
get: descriptor.get,
154+
set: descriptor.set
155+
};
156+
return;
157+
}
158+
});
159+
160+
options.setup = function (props, ctx) {
161+
var data = new Ctor(props, ctx);
162+
var dataKeys = Object.keys(data);
163+
var plainData = reactive({}); // Initialize reactive data and convert constructor `this` to a proxy
164+
165+
dataKeys.forEach(key => {
166+
// Skip if the value is undefined not to make it reactive.
167+
// If the value has `__s`, it's a value from `setup` helper, proceed it later.
168+
if (data[key] === undefined || data[key] && data[key].__s) {
169+
return;
170+
}
171+
172+
plainData[key] = data[key];
173+
defineProxy(data, key, plainData);
174+
}); // Invoke composition functions
175+
176+
dataKeys.forEach(key => {
177+
if (data[key] && data[key].__s) {
178+
plainData[key] = data[key].__s();
179+
}
180+
});
181+
return plainData;
182+
};
183+
184+
var decorators = this.hasOwnProperty('__vccDecorators') && this.__vccDecorators;
185+
186+
if (decorators) {
187+
decorators.forEach(fn => fn(options));
188+
} // from Vue Loader
189+
190+
191+
var injections = ['render', 'ssrRender', '__file', '__cssModules', '__scopeId', '__hmrId'];
192+
injections.forEach(key => {
193+
if (Ctor[key]) {
194+
options[key] = Ctor[key];
195+
}
196+
});
197+
return options;
198+
}
199+
200+
static registerHooks(keys) {
201+
this.__vccHooks.push(...keys);
202+
}
203+
204+
}
205+
/** @internal */
206+
207+
208+
VueImpl.__vccHooks = ['data', 'beforeCreate', 'created', 'beforeMount', 'mounted', 'beforeUnmount', 'unmounted', 'beforeUpdate', 'updated', 'activated', 'deactivated', 'render', 'errorCaptured', 'serverPrefetch'];
209+
var Vue = VueImpl;
210+
211+
function Options(options) {
212+
return Component => {
213+
Component.__vccBase = options;
214+
return Component;
215+
};
216+
}
217+
function createDecorator(factory) {
218+
return (target, key, index) => {
219+
var Ctor = typeof target === 'function' ? target : target.constructor;
220+
221+
if (!Ctor.__vccDecorators) {
222+
Ctor.__vccDecorators = [];
223+
}
224+
225+
if (typeof index !== 'number') {
226+
index = undefined;
227+
}
228+
229+
Ctor.__vccDecorators.push(options => factory(options, key, index));
230+
};
231+
}
232+
function mixins() {
233+
for (var _len = arguments.length, Ctors = new Array(_len), _key = 0; _key < _len; _key++) {
234+
Ctors[_key] = arguments[_key];
235+
}
236+
237+
var _a;
238+
239+
return _a = class MixedVue extends Vue {
240+
constructor(props, ctx) {
241+
super(props, ctx);
242+
Ctors.forEach(Ctor => {
243+
var data = new Ctor(props, ctx);
244+
Object.keys(data).forEach(key => {
245+
this[key] = data[key];
246+
});
247+
});
248+
}
249+
250+
}, _a.__vccMixins = Ctors.map(Ctor => Ctor.__vccOpts), _a;
251+
}
252+
function setup(setupFn) {
253+
// Hack to delay the invocation of setup function.
254+
// Will be called after dealing with class properties.
255+
return {
256+
__s: setupFn
257+
};
258+
}
259+
260+
export { Options, Vue, createDecorator, mixins, setup };

Diff for: dist/vue-class-component.esm-browser.prod.js

+6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)