@web-utils/component 2.9.3 → 2.9.5

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@web-utils/component",
3
3
  "description": "Web Components",
4
- "version": "2.9.3",
4
+ "version": "2.9.5",
5
5
  "author": "Simple",
6
6
  "license": "MIT",
7
7
  "type": "module",
@@ -0,0 +1,83 @@
1
+ var o = (t, e, s) => new Promise((u, r) => {
2
+ var c = (n) => {
3
+ try {
4
+ a(s.next(n));
5
+ } catch (i) {
6
+ r(i);
7
+ }
8
+ }, _ = (n) => {
9
+ try {
10
+ a(s.throw(n));
11
+ } catch (i) {
12
+ r(i);
13
+ }
14
+ }, a = (n) => n.done ? u(n.value) : Promise.resolve(n.value).then(c, _);
15
+ a((s = s.apply(t, e)).next());
16
+ });
17
+ import { drawToCanvas as p, genDataURL as d, genSVG as h } from "@web-utils/integrations/qrcode";
18
+ import { n as f } from "../chunks/vueComponentNormalizer.446f5dc4.mjs";
19
+ const m = {
20
+ name: "VueQrCode",
21
+ props: {
22
+ /**
23
+ * 二维码内容字符串
24
+ */
25
+ text: {
26
+ type: String,
27
+ default: "0"
28
+ },
29
+ /**
30
+ * 生成二维码配置选项
31
+ * {@link https://github.com/soldair/node-qrcode#qr-code-options}
32
+ */
33
+ options: Object,
34
+ /**
35
+ * 组件根元素标签
36
+ */
37
+ tag: {
38
+ type: String,
39
+ default: "canvas"
40
+ }
41
+ },
42
+ watch: {
43
+ $props: {
44
+ deep: !0,
45
+ immediate: !0,
46
+ handler: "generate"
47
+ }
48
+ },
49
+ methods: {
50
+ generate() {
51
+ return o(this, null, function* () {
52
+ yield this.$nextTick();
53
+ const { options: t, tag: e } = this;
54
+ e === "canvas" ? yield p(this.$el, this.text, t) : e === "img" ? this.$el.src = yield d(this.text, t) : this.$el.innerHTML = yield h(this.text, t);
55
+ });
56
+ }
57
+ },
58
+ render(t) {
59
+ return t(this.tag, this.$slots.default);
60
+ }
61
+ };
62
+ let g, v;
63
+ const l = {};
64
+ var x = /* @__PURE__ */ f(
65
+ m,
66
+ g,
67
+ v,
68
+ !1,
69
+ w,
70
+ null,
71
+ null,
72
+ null
73
+ );
74
+ function w(t) {
75
+ for (let e in l)
76
+ this[e] = l[e];
77
+ }
78
+ const S = /* @__PURE__ */ function() {
79
+ return x.exports;
80
+ }();
81
+ export {
82
+ S as default
83
+ };
@@ -0,0 +1,187 @@
1
+ var f = Object.defineProperty;
2
+ var h = Object.getOwnPropertySymbols;
3
+ var m = Object.prototype.hasOwnProperty, g = Object.prototype.propertyIsEnumerable;
4
+ var c = (e, i, t) => i in e ? f(e, i, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[i] = t, u = (e, i) => {
5
+ for (var t in i || (i = {}))
6
+ m.call(i, t) && c(e, t, i[t]);
7
+ if (h)
8
+ for (var t of h(i))
9
+ g.call(i, t) && c(e, t, i[t]);
10
+ return e;
11
+ };
12
+ var d = (e, i, t) => new Promise((r, o) => {
13
+ var n = (s) => {
14
+ try {
15
+ a(t.next(s));
16
+ } catch (p) {
17
+ o(p);
18
+ }
19
+ }, l = (s) => {
20
+ try {
21
+ a(t.throw(s));
22
+ } catch (p) {
23
+ o(p);
24
+ }
25
+ }, a = (s) => s.done ? r(s.value) : Promise.resolve(s.value).then(n, l);
26
+ a((t = t.apply(e, i)).next());
27
+ });
28
+ import "video.js/dist/video-js.min.css";
29
+ import v from "video.js";
30
+ import _ from "video.js/dist/lang/zh-CN.json";
31
+ import b from "lodash/defaults";
32
+ import { n as O } from "../chunks/vueComponentNormalizer.446f5dc4.mjs";
33
+ var $ = function() {
34
+ var e = this, i = e.$createElement, t = e._self._c || i;
35
+ return t("div", {
36
+ staticClass: "video-player video-player-box"
37
+ }, [t("video", {
38
+ ref: "video",
39
+ staticClass: "video-js"
40
+ })]);
41
+ }, x = [];
42
+ v.addLanguage("zh", _);
43
+ const A = [
44
+ "loadeddata",
45
+ "canplay",
46
+ "canplaythrough",
47
+ "play",
48
+ "pause",
49
+ "waiting",
50
+ "playing",
51
+ "ended",
52
+ "error"
53
+ ], T = {
54
+ name: "VueVideoPlayer",
55
+ props: {
56
+ crossOrigin: {
57
+ type: String,
58
+ default: ""
59
+ },
60
+ playsInline: {
61
+ type: Boolean,
62
+ default: !1
63
+ },
64
+ autoplay: {
65
+ type: Boolean,
66
+ default: !0
67
+ },
68
+ volume: {
69
+ type: Number,
70
+ default: 1
71
+ },
72
+ src: String,
73
+ options: Object,
74
+ events: {
75
+ type: Array,
76
+ default: () => []
77
+ },
78
+ globalOptions: {
79
+ type: Object,
80
+ default: () => ({
81
+ // autoplay: false,
82
+ controls: !0,
83
+ // preload: 'auto',
84
+ // fluid: false,
85
+ // muted: false,
86
+ playbackRates: [0.7, 1, 1.5, 2],
87
+ controlBar: {
88
+ remainingTimeDisplay: !1,
89
+ playToggle: {},
90
+ progressControl: {},
91
+ fullscreenToggle: {},
92
+ volumeMenuButton: {
93
+ inline: !1,
94
+ vertical: !0
95
+ }
96
+ },
97
+ techOrder: ["html5"],
98
+ plugins: {}
99
+ })
100
+ },
101
+ globalEvents: {
102
+ type: Array,
103
+ default: () => []
104
+ }
105
+ },
106
+ data() {
107
+ return {
108
+ player: null
109
+ };
110
+ },
111
+ computed: {
112
+ videoOptions() {
113
+ return b({
114
+ language: "zh",
115
+ autoplay: this.autoplay,
116
+ sources: [{ src: this.src }]
117
+ }, u(u({}, this.globalOptions), this.options));
118
+ }
119
+ },
120
+ watch: {
121
+ videoOptions: {
122
+ immediate: !0,
123
+ deep: !0,
124
+ handler: "initialize"
125
+ }
126
+ },
127
+ activated() {
128
+ var e;
129
+ (e = this.player) == null || e.play();
130
+ },
131
+ deactivated() {
132
+ var e;
133
+ (e = this.player) == null || e.pause();
134
+ },
135
+ beforeDestroy() {
136
+ this.dispose();
137
+ },
138
+ methods: {
139
+ initialize() {
140
+ return d(this, null, function* () {
141
+ var n, l;
142
+ if (yield this.$nextTick(), !((l = (n = this.videoOptions) == null ? void 0 : n.sources) != null && l.length))
143
+ return;
144
+ if (this.player) {
145
+ this.player.options(this.videoOptions);
146
+ return;
147
+ }
148
+ this.playsInline && (this.$refs.video.setAttribute("playsinline", this.playsInline), this.$refs.video.setAttribute("webkit-playsinline", this.playsInline), this.$refs.video.setAttribute("x5-playsinline", this.playsInline), this.$refs.video.setAttribute("x5-video-player-type", "h5"), this.$refs.video.setAttribute("x5-video-player-fullscreen", !1)), this.crossOrigin && (this.$refs.video.crossOrigin = this.crossOrigin, this.$refs.video.setAttribute("crossOrigin", this.crossOrigin));
149
+ const { events: e, globalEvents: i, volume: t } = this, r = (...a) => this.$emit(...a), o = A.concat(e).concat(i);
150
+ this.player = v(this.$refs.video, this.videoOptions, function() {
151
+ this.volume(t);
152
+ for (let a = 0; a < o.length; a++) {
153
+ const s = o[a];
154
+ this.on(s, () => r(s, this));
155
+ }
156
+ this.on("timeupdate", () => r("timeupdate", this.currentTime(), this)), r("ready", this);
157
+ });
158
+ });
159
+ },
160
+ dispose() {
161
+ return d(this, null, function* () {
162
+ var e;
163
+ (e = this.player) != null && e.dispose && (this.player.techName_ !== "Flash" && this.player.pause(), this.player.dispose(), this.player = null);
164
+ });
165
+ }
166
+ }
167
+ }, y = {};
168
+ var V = /* @__PURE__ */ O(
169
+ T,
170
+ $,
171
+ x,
172
+ !1,
173
+ z,
174
+ null,
175
+ null,
176
+ null
177
+ );
178
+ function z(e) {
179
+ for (let i in y)
180
+ this[i] = y[i];
181
+ }
182
+ const B = /* @__PURE__ */ function() {
183
+ return V.exports;
184
+ }();
185
+ export {
186
+ B as default
187
+ };
@@ -0,0 +1 @@
1
+ .video-player-box{width:100%;height:100%}.video-player-box .video-js{width:100%;height:100%;background-color:#404040}
package/web-types.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "$schema": "https://json.schemastore.org/web-types",
3
3
  "framework": "vue",
4
4
  "name": "@web-utils/component",
5
- "version": "2.9.3",
5
+ "version": "2.9.5",
6
6
  "contributions": {
7
7
  "html": {
8
8
  "description-markup": "markdown",
@@ -19770,6 +19770,44 @@
19770
19770
  }
19771
19771
  ]
19772
19772
  },
19773
+ {
19774
+ "name": "VueQrCode",
19775
+ "description": "",
19776
+ "attributes": [
19777
+ {
19778
+ "name": "text",
19779
+ "description": "二维码内容字符串",
19780
+ "value": {
19781
+ "kind": "expression",
19782
+ "type": "string"
19783
+ },
19784
+ "default": "'0'"
19785
+ },
19786
+ {
19787
+ "name": "options",
19788
+ "description": "生成二维码配置选项\n{@link https://github.com/soldair/node-qrcode#qr-code-options}",
19789
+ "value": {
19790
+ "kind": "expression",
19791
+ "type": "object"
19792
+ },
19793
+ "default": ""
19794
+ },
19795
+ {
19796
+ "name": "tag",
19797
+ "description": "组件根元素标签",
19798
+ "value": {
19799
+ "kind": "expression",
19800
+ "type": "string"
19801
+ },
19802
+ "default": "'canvas'"
19803
+ }
19804
+ ],
19805
+ "slots": [
19806
+ {
19807
+ "name": "default"
19808
+ }
19809
+ ]
19810
+ },
19773
19811
  {
19774
19812
  "name": "VueTagsInput",
19775
19813
  "description": "",
@@ -20599,6 +20637,84 @@
20599
20637
  }
20600
20638
  ]
20601
20639
  },
20640
+ {
20641
+ "name": "VueVideoPlayer",
20642
+ "description": "",
20643
+ "attributes": [
20644
+ {
20645
+ "name": "crossOrigin",
20646
+ "value": {
20647
+ "kind": "expression",
20648
+ "type": "string"
20649
+ },
20650
+ "default": "''"
20651
+ },
20652
+ {
20653
+ "name": "playsInline",
20654
+ "value": {
20655
+ "kind": "expression",
20656
+ "type": "boolean"
20657
+ },
20658
+ "default": "false"
20659
+ },
20660
+ {
20661
+ "name": "autoplay",
20662
+ "value": {
20663
+ "kind": "expression",
20664
+ "type": "boolean"
20665
+ },
20666
+ "default": "true"
20667
+ },
20668
+ {
20669
+ "name": "volume",
20670
+ "value": {
20671
+ "kind": "expression",
20672
+ "type": "number"
20673
+ },
20674
+ "default": "1"
20675
+ },
20676
+ {
20677
+ "name": "src",
20678
+ "value": {
20679
+ "kind": "expression",
20680
+ "type": "string"
20681
+ },
20682
+ "default": ""
20683
+ },
20684
+ {
20685
+ "name": "options",
20686
+ "value": {
20687
+ "kind": "expression",
20688
+ "type": "object"
20689
+ },
20690
+ "default": ""
20691
+ },
20692
+ {
20693
+ "name": "events",
20694
+ "value": {
20695
+ "kind": "expression",
20696
+ "type": "array"
20697
+ },
20698
+ "default": "[]"
20699
+ },
20700
+ {
20701
+ "name": "globalOptions",
20702
+ "value": {
20703
+ "kind": "expression",
20704
+ "type": "object"
20705
+ },
20706
+ "default": "{\r\n // autoplay: false,\r\n controls: true,\r\n\r\n // preload: 'auto',\r\n // fluid: false,\r\n // muted: false,\r\n playbackRates: [0.7, 1.0, 1.5, 2.0],\r\n\r\n controlBar: {\r\n remainingTimeDisplay: false,\r\n playToggle: {},\r\n progressControl: {},\r\n fullscreenToggle: {},\r\n volumeMenuButton: {\r\n inline: false,\r\n vertical: true\r\n }\r\n },\r\n\r\n techOrder: ['html5'],\r\n plugins: {}\r\n}"
20707
+ },
20708
+ {
20709
+ "name": "globalEvents",
20710
+ "value": {
20711
+ "kind": "expression",
20712
+ "type": "array"
20713
+ },
20714
+ "default": "[]"
20715
+ }
20716
+ ]
20717
+ },
20602
20718
  {
20603
20719
  "name": "Watermark",
20604
20720
  "description": "",