@deot/vc-components 1.0.52 → 1.0.53
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/dist/index.cjs +18 -12
- package/dist/index.d.ts +8 -4
- package/dist/index.iife.js +18 -12
- package/dist/index.js +18 -12
- package/dist/index.umd.cjs +18 -12
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -73,6 +73,10 @@ const defaults$2 = {
|
|
|
73
73
|
},
|
|
74
74
|
TableColumn: {
|
|
75
75
|
line: nil
|
|
76
|
+
},
|
|
77
|
+
Snapshot: {
|
|
78
|
+
source: nil,
|
|
79
|
+
download: nil
|
|
76
80
|
}
|
|
77
81
|
};
|
|
78
82
|
|
|
@@ -12122,7 +12126,8 @@ const props$H = {
|
|
|
12122
12126
|
default: "anonymous",
|
|
12123
12127
|
validator: (v) => /^(|anonymous|use-credentials)$/.test(v)
|
|
12124
12128
|
},
|
|
12125
|
-
|
|
12129
|
+
source: Function,
|
|
12130
|
+
download: Function,
|
|
12126
12131
|
// 传递给snap-dom的配置项
|
|
12127
12132
|
options: {
|
|
12128
12133
|
type: Object,
|
|
@@ -12142,19 +12147,20 @@ const Snapshot = /* @__PURE__ */ vue.defineComponent({
|
|
|
12142
12147
|
slots,
|
|
12143
12148
|
expose
|
|
12144
12149
|
}) {
|
|
12150
|
+
const instance = vue.getCurrentInstance();
|
|
12145
12151
|
const current = vue.ref();
|
|
12146
|
-
const
|
|
12152
|
+
const snapdom = vue.ref();
|
|
12147
12153
|
|
|
12148
12154
|
// 网络的图片如果没有加上crossOrigin,且没有放在第一个就会出现问题(Safari)
|
|
12149
12155
|
const refresh = async () => {
|
|
12150
12156
|
if (!props.crossOrigin) return;
|
|
12151
|
-
const transformSource = props.
|
|
12157
|
+
const transformSource = props.source || VcInstance.options.Snapshot?.source || (v => v);
|
|
12152
12158
|
return Promise.all(Array.from(current.value.querySelectorAll('img')).map(node => {
|
|
12153
12159
|
return new Promise(resolve => {
|
|
12154
12160
|
(async () => {
|
|
12155
12161
|
let url;
|
|
12156
12162
|
try {
|
|
12157
|
-
url = await transformSource(node.src);
|
|
12163
|
+
url = await transformSource(node.src, 'image');
|
|
12158
12164
|
} catch (e) {
|
|
12159
12165
|
console.error(e);
|
|
12160
12166
|
}
|
|
@@ -12172,22 +12178,22 @@ const Snapshot = /* @__PURE__ */ vue.defineComponent({
|
|
|
12172
12178
|
};
|
|
12173
12179
|
const toDataURL = async () => {
|
|
12174
12180
|
await refresh();
|
|
12175
|
-
return
|
|
12181
|
+
return snapdom.value.toRaw();
|
|
12176
12182
|
};
|
|
12177
12183
|
const download = async options => {
|
|
12178
12184
|
await refresh();
|
|
12179
|
-
const _download = VcInstance.options.Snapshot?.download || (() => false);
|
|
12180
|
-
const allow = _download(options);
|
|
12185
|
+
const _download = props.download || VcInstance.options.Snapshot?.download || (() => false);
|
|
12186
|
+
const allow = _download(instance, options);
|
|
12181
12187
|
if (allow && allow.then) {
|
|
12182
12188
|
allow.catch(() => {
|
|
12183
|
-
|
|
12189
|
+
snapdom.value.download(options);
|
|
12184
12190
|
});
|
|
12185
12191
|
return;
|
|
12186
12192
|
}
|
|
12187
|
-
allow ||
|
|
12193
|
+
allow || snapdom.value.download(options);
|
|
12188
12194
|
};
|
|
12189
12195
|
expose({
|
|
12190
|
-
|
|
12196
|
+
snapdom,
|
|
12191
12197
|
refresh,
|
|
12192
12198
|
toDataURL,
|
|
12193
12199
|
download
|
|
@@ -12196,9 +12202,9 @@ const Snapshot = /* @__PURE__ */ vue.defineComponent({
|
|
|
12196
12202
|
try {
|
|
12197
12203
|
let snapDOM = window.snapdom || (await import('@zumer/snapdom'));
|
|
12198
12204
|
snapDOM = snapDOM.snapdom || snapDOM;
|
|
12199
|
-
|
|
12205
|
+
snapdom.value = await snapDOM(current.value, props.options);
|
|
12200
12206
|
emit('ready', {
|
|
12201
|
-
instance
|
|
12207
|
+
instance,
|
|
12202
12208
|
dependencies: {
|
|
12203
12209
|
snapDOM
|
|
12204
12210
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -8427,7 +8427,8 @@ type: StringConstructor;
|
|
|
8427
8427
|
default: string;
|
|
8428
8428
|
validator: (v: any) => boolean;
|
|
8429
8429
|
};
|
|
8430
|
-
|
|
8430
|
+
source: FunctionConstructor;
|
|
8431
|
+
download: FunctionConstructor;
|
|
8431
8432
|
options: {
|
|
8432
8433
|
type: ObjectConstructor;
|
|
8433
8434
|
default: () => {};
|
|
@@ -8442,7 +8443,8 @@ type: StringConstructor;
|
|
|
8442
8443
|
default: string;
|
|
8443
8444
|
validator: (v: any) => boolean;
|
|
8444
8445
|
};
|
|
8445
|
-
|
|
8446
|
+
source: FunctionConstructor;
|
|
8447
|
+
download: FunctionConstructor;
|
|
8446
8448
|
options: {
|
|
8447
8449
|
type: ObjectConstructor;
|
|
8448
8450
|
default: () => {};
|
|
@@ -13308,7 +13310,8 @@ type: StringConstructor;
|
|
|
13308
13310
|
default: string;
|
|
13309
13311
|
validator: (v: any) => boolean;
|
|
13310
13312
|
};
|
|
13311
|
-
|
|
13313
|
+
source: FunctionConstructor;
|
|
13314
|
+
download: FunctionConstructor;
|
|
13312
13315
|
options: {
|
|
13313
13316
|
type: ObjectConstructor;
|
|
13314
13317
|
default: () => {};
|
|
@@ -13323,7 +13326,8 @@ type: StringConstructor;
|
|
|
13323
13326
|
default: string;
|
|
13324
13327
|
validator: (v: any) => boolean;
|
|
13325
13328
|
};
|
|
13326
|
-
|
|
13329
|
+
source: FunctionConstructor;
|
|
13330
|
+
download: FunctionConstructor;
|
|
13327
13331
|
options: {
|
|
13328
13332
|
type: ObjectConstructor;
|
|
13329
13333
|
default: () => {};
|
package/dist/index.iife.js
CHANGED
|
@@ -35,6 +35,10 @@ var VcComponents = (function (exports, vue) {
|
|
|
35
35
|
},
|
|
36
36
|
TableColumn: {
|
|
37
37
|
line: nil
|
|
38
|
+
},
|
|
39
|
+
Snapshot: {
|
|
40
|
+
source: nil,
|
|
41
|
+
download: nil
|
|
38
42
|
}
|
|
39
43
|
};
|
|
40
44
|
|
|
@@ -20665,7 +20669,8 @@ var VcComponents = (function (exports, vue) {
|
|
|
20665
20669
|
default: "anonymous",
|
|
20666
20670
|
validator: (v) => /^(|anonymous|use-credentials)$/.test(v)
|
|
20667
20671
|
},
|
|
20668
|
-
|
|
20672
|
+
source: Function,
|
|
20673
|
+
download: Function,
|
|
20669
20674
|
// 传递给snap-dom的配置项
|
|
20670
20675
|
options: {
|
|
20671
20676
|
type: Object,
|
|
@@ -20685,19 +20690,20 @@ var VcComponents = (function (exports, vue) {
|
|
|
20685
20690
|
slots,
|
|
20686
20691
|
expose
|
|
20687
20692
|
}) {
|
|
20693
|
+
const instance = vue.getCurrentInstance();
|
|
20688
20694
|
const current = vue.ref();
|
|
20689
|
-
const
|
|
20695
|
+
const snapdom = vue.ref();
|
|
20690
20696
|
|
|
20691
20697
|
// 网络的图片如果没有加上crossOrigin,且没有放在第一个就会出现问题(Safari)
|
|
20692
20698
|
const refresh = async () => {
|
|
20693
20699
|
if (!props.crossOrigin) return;
|
|
20694
|
-
const transformSource = props.
|
|
20700
|
+
const transformSource = props.source || VcInstance.options.Snapshot?.source || (v => v);
|
|
20695
20701
|
return Promise.all(Array.from(current.value.querySelectorAll('img')).map(node => {
|
|
20696
20702
|
return new Promise(resolve => {
|
|
20697
20703
|
(async () => {
|
|
20698
20704
|
let url;
|
|
20699
20705
|
try {
|
|
20700
|
-
url = await transformSource(node.src);
|
|
20706
|
+
url = await transformSource(node.src, 'image');
|
|
20701
20707
|
} catch (e) {
|
|
20702
20708
|
console.error(e);
|
|
20703
20709
|
}
|
|
@@ -20715,22 +20721,22 @@ var VcComponents = (function (exports, vue) {
|
|
|
20715
20721
|
};
|
|
20716
20722
|
const toDataURL = async () => {
|
|
20717
20723
|
await refresh();
|
|
20718
|
-
return
|
|
20724
|
+
return snapdom.value.toRaw();
|
|
20719
20725
|
};
|
|
20720
20726
|
const download = async options => {
|
|
20721
20727
|
await refresh();
|
|
20722
|
-
const _download = VcInstance.options.Snapshot?.download || (() => false);
|
|
20723
|
-
const allow = _download(options);
|
|
20728
|
+
const _download = props.download || VcInstance.options.Snapshot?.download || (() => false);
|
|
20729
|
+
const allow = _download(instance, options);
|
|
20724
20730
|
if (allow && allow.then) {
|
|
20725
20731
|
allow.catch(() => {
|
|
20726
|
-
|
|
20732
|
+
snapdom.value.download(options);
|
|
20727
20733
|
});
|
|
20728
20734
|
return;
|
|
20729
20735
|
}
|
|
20730
|
-
allow ||
|
|
20736
|
+
allow || snapdom.value.download(options);
|
|
20731
20737
|
};
|
|
20732
20738
|
expose({
|
|
20733
|
-
|
|
20739
|
+
snapdom,
|
|
20734
20740
|
refresh,
|
|
20735
20741
|
toDataURL,
|
|
20736
20742
|
download
|
|
@@ -20739,9 +20745,9 @@ var VcComponents = (function (exports, vue) {
|
|
|
20739
20745
|
try {
|
|
20740
20746
|
let snapDOM = window.snapdom || (await Promise.resolve().then(() => snapdom$1));
|
|
20741
20747
|
snapDOM = snapDOM.snapdom || snapDOM;
|
|
20742
|
-
|
|
20748
|
+
snapdom.value = await snapDOM(current.value, props.options);
|
|
20743
20749
|
emit('ready', {
|
|
20744
|
-
instance
|
|
20750
|
+
instance,
|
|
20745
20751
|
dependencies: {
|
|
20746
20752
|
snapDOM
|
|
20747
20753
|
}
|
package/dist/index.js
CHANGED
|
@@ -51,6 +51,10 @@ const defaults$2 = {
|
|
|
51
51
|
},
|
|
52
52
|
TableColumn: {
|
|
53
53
|
line: nil
|
|
54
|
+
},
|
|
55
|
+
Snapshot: {
|
|
56
|
+
source: nil,
|
|
57
|
+
download: nil
|
|
54
58
|
}
|
|
55
59
|
};
|
|
56
60
|
|
|
@@ -12100,7 +12104,8 @@ const props$H = {
|
|
|
12100
12104
|
default: "anonymous",
|
|
12101
12105
|
validator: (v) => /^(|anonymous|use-credentials)$/.test(v)
|
|
12102
12106
|
},
|
|
12103
|
-
|
|
12107
|
+
source: Function,
|
|
12108
|
+
download: Function,
|
|
12104
12109
|
// 传递给snap-dom的配置项
|
|
12105
12110
|
options: {
|
|
12106
12111
|
type: Object,
|
|
@@ -12120,19 +12125,20 @@ const Snapshot = /* @__PURE__ */ defineComponent({
|
|
|
12120
12125
|
slots,
|
|
12121
12126
|
expose
|
|
12122
12127
|
}) {
|
|
12128
|
+
const instance = getCurrentInstance();
|
|
12123
12129
|
const current = ref();
|
|
12124
|
-
const
|
|
12130
|
+
const snapdom = ref();
|
|
12125
12131
|
|
|
12126
12132
|
// 网络的图片如果没有加上crossOrigin,且没有放在第一个就会出现问题(Safari)
|
|
12127
12133
|
const refresh = async () => {
|
|
12128
12134
|
if (!props.crossOrigin) return;
|
|
12129
|
-
const transformSource = props.
|
|
12135
|
+
const transformSource = props.source || VcInstance.options.Snapshot?.source || (v => v);
|
|
12130
12136
|
return Promise.all(Array.from(current.value.querySelectorAll('img')).map(node => {
|
|
12131
12137
|
return new Promise(resolve => {
|
|
12132
12138
|
(async () => {
|
|
12133
12139
|
let url;
|
|
12134
12140
|
try {
|
|
12135
|
-
url = await transformSource(node.src);
|
|
12141
|
+
url = await transformSource(node.src, 'image');
|
|
12136
12142
|
} catch (e) {
|
|
12137
12143
|
console.error(e);
|
|
12138
12144
|
}
|
|
@@ -12150,22 +12156,22 @@ const Snapshot = /* @__PURE__ */ defineComponent({
|
|
|
12150
12156
|
};
|
|
12151
12157
|
const toDataURL = async () => {
|
|
12152
12158
|
await refresh();
|
|
12153
|
-
return
|
|
12159
|
+
return snapdom.value.toRaw();
|
|
12154
12160
|
};
|
|
12155
12161
|
const download = async options => {
|
|
12156
12162
|
await refresh();
|
|
12157
|
-
const _download = VcInstance.options.Snapshot?.download || (() => false);
|
|
12158
|
-
const allow = _download(options);
|
|
12163
|
+
const _download = props.download || VcInstance.options.Snapshot?.download || (() => false);
|
|
12164
|
+
const allow = _download(instance, options);
|
|
12159
12165
|
if (allow && allow.then) {
|
|
12160
12166
|
allow.catch(() => {
|
|
12161
|
-
|
|
12167
|
+
snapdom.value.download(options);
|
|
12162
12168
|
});
|
|
12163
12169
|
return;
|
|
12164
12170
|
}
|
|
12165
|
-
allow ||
|
|
12171
|
+
allow || snapdom.value.download(options);
|
|
12166
12172
|
};
|
|
12167
12173
|
expose({
|
|
12168
|
-
|
|
12174
|
+
snapdom,
|
|
12169
12175
|
refresh,
|
|
12170
12176
|
toDataURL,
|
|
12171
12177
|
download
|
|
@@ -12174,9 +12180,9 @@ const Snapshot = /* @__PURE__ */ defineComponent({
|
|
|
12174
12180
|
try {
|
|
12175
12181
|
let snapDOM = window.snapdom || (await import('@zumer/snapdom'));
|
|
12176
12182
|
snapDOM = snapDOM.snapdom || snapDOM;
|
|
12177
|
-
|
|
12183
|
+
snapdom.value = await snapDOM(current.value, props.options);
|
|
12178
12184
|
emit('ready', {
|
|
12179
|
-
instance
|
|
12185
|
+
instance,
|
|
12180
12186
|
dependencies: {
|
|
12181
12187
|
snapDOM
|
|
12182
12188
|
}
|
package/dist/index.umd.cjs
CHANGED
|
@@ -38,6 +38,10 @@
|
|
|
38
38
|
},
|
|
39
39
|
TableColumn: {
|
|
40
40
|
line: nil
|
|
41
|
+
},
|
|
42
|
+
Snapshot: {
|
|
43
|
+
source: nil,
|
|
44
|
+
download: nil
|
|
41
45
|
}
|
|
42
46
|
};
|
|
43
47
|
|
|
@@ -20668,7 +20672,8 @@
|
|
|
20668
20672
|
default: "anonymous",
|
|
20669
20673
|
validator: (v) => /^(|anonymous|use-credentials)$/.test(v)
|
|
20670
20674
|
},
|
|
20671
|
-
|
|
20675
|
+
source: Function,
|
|
20676
|
+
download: Function,
|
|
20672
20677
|
// 传递给snap-dom的配置项
|
|
20673
20678
|
options: {
|
|
20674
20679
|
type: Object,
|
|
@@ -20688,19 +20693,20 @@
|
|
|
20688
20693
|
slots,
|
|
20689
20694
|
expose
|
|
20690
20695
|
}) {
|
|
20696
|
+
const instance = vue.getCurrentInstance();
|
|
20691
20697
|
const current = vue.ref();
|
|
20692
|
-
const
|
|
20698
|
+
const snapdom = vue.ref();
|
|
20693
20699
|
|
|
20694
20700
|
// 网络的图片如果没有加上crossOrigin,且没有放在第一个就会出现问题(Safari)
|
|
20695
20701
|
const refresh = async () => {
|
|
20696
20702
|
if (!props.crossOrigin) return;
|
|
20697
|
-
const transformSource = props.
|
|
20703
|
+
const transformSource = props.source || VcInstance.options.Snapshot?.source || (v => v);
|
|
20698
20704
|
return Promise.all(Array.from(current.value.querySelectorAll('img')).map(node => {
|
|
20699
20705
|
return new Promise(resolve => {
|
|
20700
20706
|
(async () => {
|
|
20701
20707
|
let url;
|
|
20702
20708
|
try {
|
|
20703
|
-
url = await transformSource(node.src);
|
|
20709
|
+
url = await transformSource(node.src, 'image');
|
|
20704
20710
|
} catch (e) {
|
|
20705
20711
|
console.error(e);
|
|
20706
20712
|
}
|
|
@@ -20718,22 +20724,22 @@
|
|
|
20718
20724
|
};
|
|
20719
20725
|
const toDataURL = async () => {
|
|
20720
20726
|
await refresh();
|
|
20721
|
-
return
|
|
20727
|
+
return snapdom.value.toRaw();
|
|
20722
20728
|
};
|
|
20723
20729
|
const download = async options => {
|
|
20724
20730
|
await refresh();
|
|
20725
|
-
const _download = VcInstance.options.Snapshot?.download || (() => false);
|
|
20726
|
-
const allow = _download(options);
|
|
20731
|
+
const _download = props.download || VcInstance.options.Snapshot?.download || (() => false);
|
|
20732
|
+
const allow = _download(instance, options);
|
|
20727
20733
|
if (allow && allow.then) {
|
|
20728
20734
|
allow.catch(() => {
|
|
20729
|
-
|
|
20735
|
+
snapdom.value.download(options);
|
|
20730
20736
|
});
|
|
20731
20737
|
return;
|
|
20732
20738
|
}
|
|
20733
|
-
allow ||
|
|
20739
|
+
allow || snapdom.value.download(options);
|
|
20734
20740
|
};
|
|
20735
20741
|
expose({
|
|
20736
|
-
|
|
20742
|
+
snapdom,
|
|
20737
20743
|
refresh,
|
|
20738
20744
|
toDataURL,
|
|
20739
20745
|
download
|
|
@@ -20742,9 +20748,9 @@
|
|
|
20742
20748
|
try {
|
|
20743
20749
|
let snapDOM = window.snapdom || (await Promise.resolve().then(() => snapdom$1));
|
|
20744
20750
|
snapDOM = snapDOM.snapdom || snapDOM;
|
|
20745
|
-
|
|
20751
|
+
snapdom.value = await snapDOM(current.value, props.options);
|
|
20746
20752
|
emit('ready', {
|
|
20747
|
-
instance
|
|
20753
|
+
instance,
|
|
20748
20754
|
dependencies: {
|
|
20749
20755
|
snapDOM
|
|
20750
20756
|
}
|