dullcatmen-wujie-vue-setup 0.0.1

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.
@@ -0,0 +1,184 @@
1
+ function _array_like_to_array(arr, len) {
2
+ if (len == null || len > arr.length) len = arr.length;
3
+ for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
4
+ return arr2;
5
+ }
6
+ function _array_without_holes(arr) {
7
+ if (Array.isArray(arr)) return _array_like_to_array(arr);
8
+ }
9
+ function _iterable_to_array(iter) {
10
+ if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
11
+ }
12
+ function _non_iterable_spread() {
13
+ throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
14
+ }
15
+ function _to_consumable_array(arr) {
16
+ return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_spread();
17
+ }
18
+ function _unsupported_iterable_to_array(o, minLen) {
19
+ if (!o) return;
20
+ if (typeof o === "string") return _array_like_to_array(o, minLen);
21
+ var n = Object.prototype.toString.call(o).slice(8, -1);
22
+ if (n === "Object" && o.constructor) n = o.constructor.name;
23
+ if (n === "Map" || n === "Set") return Array.from(n);
24
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
25
+ }
26
+ import { defineComponent, h, onMounted, onBeforeUnmount, getCurrentInstance, watch } from "vue";
27
+ import { startApp, bus } from "wujie";
28
+ var wujie = defineComponent({
29
+ props: {
30
+ width: {
31
+ type: String,
32
+ default: ""
33
+ },
34
+ height: {
35
+ type: String,
36
+ default: ""
37
+ },
38
+ name: {
39
+ type: String,
40
+ default: "",
41
+ required: true
42
+ },
43
+ loading: {
44
+ type: HTMLElement,
45
+ default: undefined
46
+ },
47
+ url: {
48
+ type: String,
49
+ default: "",
50
+ required: true
51
+ },
52
+ sync: {
53
+ type: Boolean,
54
+ default: undefined
55
+ },
56
+ prefix: {
57
+ type: Object,
58
+ default: undefined
59
+ },
60
+ alive: {
61
+ type: Boolean,
62
+ default: undefined
63
+ },
64
+ props: {
65
+ type: Object,
66
+ default: undefined
67
+ },
68
+ attrs: {
69
+ type: Object,
70
+ default: undefined
71
+ },
72
+ replace: {
73
+ type: Function,
74
+ default: undefined
75
+ },
76
+ fetch: {
77
+ type: Function,
78
+ default: undefined
79
+ },
80
+ fiber: {
81
+ type: Boolean,
82
+ default: undefined
83
+ },
84
+ degrade: {
85
+ type: Boolean,
86
+ default: undefined
87
+ },
88
+ plugins: {
89
+ type: Array,
90
+ default: null
91
+ },
92
+ beforeLoad: {
93
+ type: Function,
94
+ default: null
95
+ },
96
+ beforeMount: {
97
+ type: Function,
98
+ default: null
99
+ },
100
+ afterMount: {
101
+ type: Function,
102
+ default: null
103
+ },
104
+ beforeUnmount: {
105
+ type: Function,
106
+ default: null
107
+ },
108
+ afterUnmount: {
109
+ type: Function,
110
+ default: null
111
+ },
112
+ activated: {
113
+ type: Function,
114
+ default: null
115
+ },
116
+ deactivated: {
117
+ type: Function,
118
+ default: null
119
+ }
120
+ },
121
+ setup: function setup(props, param) {
122
+ var emit = param.emit;
123
+ var instance = getCurrentInstance();
124
+ var init = function init() {
125
+ startApp({
126
+ name: props.name,
127
+ url: props.url,
128
+ el: instance === null || instance === void 0 ? void 0 : instance.refs.wujie,
129
+ loading: props.loading,
130
+ alive: props.alive,
131
+ fetch: props.fetch,
132
+ props: props.props,
133
+ attrs: props.attrs,
134
+ replace: props.replace,
135
+ sync: props.sync,
136
+ prefix: props.prefix,
137
+ fiber: props.fiber,
138
+ degrade: props.degrade,
139
+ plugins: props.plugins,
140
+ beforeLoad: props.beforeLoad,
141
+ beforeMount: props.beforeMount,
142
+ afterMount: props.afterMount,
143
+ beforeUnmount: props.beforeUnmount,
144
+ afterUnmount: props.afterUnmount,
145
+ activated: props.activated,
146
+ deactivated: props.deactivated
147
+ });
148
+ };
149
+ watch([
150
+ props.name,
151
+ props.url
152
+ ], function() {
153
+ init();
154
+ });
155
+ var handlerEmit = function handlerEmit(event) {
156
+ for(var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++){
157
+ args[_key - 1] = arguments[_key];
158
+ }
159
+ emit.apply(void 0, [
160
+ event
161
+ ].concat(_to_consumable_array(args)));
162
+ };
163
+ onMounted(function() {
164
+ bus.$onAll(handlerEmit);
165
+ init();
166
+ });
167
+ onBeforeUnmount(function() {
168
+ bus.$offAll(handlerEmit);
169
+ });
170
+ return function() {
171
+ return h("div", {
172
+ style: {
173
+ width: props.width,
174
+ height: props.height
175
+ },
176
+ ref: "wujie"
177
+ });
178
+ };
179
+ }
180
+ });
181
+ wujie.install = function(app) {
182
+ app.component('WujieVue', wujie);
183
+ };
184
+ export default wujie;
package/index.d.ts ADDED
@@ -0,0 +1,12 @@
1
+ // import { bus, preloadApp, destroyApp, setupApp } from "wujie";
2
+ import type { App } from 'vue';
3
+
4
+ declare const WujieVue: {
5
+ // bus: typeof bus;
6
+ // setupApp: typeof setupApp;
7
+ // preloadApp: typeof preloadApp;
8
+ // destroyApp: typeof destroyApp;
9
+ install: (app: App) => void
10
+ };
11
+
12
+ export default WujieVue;
package/lib/index.js ADDED
@@ -0,0 +1,296 @@
1
+ (function webpackUniversalModuleDefinition(root, factory) {
2
+ if(typeof exports === 'object' && typeof module === 'object')
3
+ module.exports = factory(require("vue"), require("wujie"));
4
+ else if(typeof define === 'function' && define.amd)
5
+ define("wujievue", ["vue", "wujie"], factory);
6
+ else if(typeof exports === 'object')
7
+ exports["wujievue"] = factory(require("vue"), require("wujie"));
8
+ else
9
+ root["wujievue"] = factory(root["vue"], root["wujie"]);
10
+ })(self, (__WEBPACK_EXTERNAL_MODULE__1__, __WEBPACK_EXTERNAL_MODULE__2__) => {
11
+ return /******/ (() => { // webpackBootstrap
12
+ /******/ "use strict";
13
+ /******/ var __webpack_modules__ = ([
14
+ /* 0 */,
15
+ /* 1 */
16
+ /***/ ((module) => {
17
+
18
+ module.exports = __WEBPACK_EXTERNAL_MODULE__1__;
19
+
20
+ /***/ }),
21
+ /* 2 */
22
+ /***/ ((module) => {
23
+
24
+ module.exports = __WEBPACK_EXTERNAL_MODULE__2__;
25
+
26
+ /***/ })
27
+ /******/ ]);
28
+ /************************************************************************/
29
+ /******/ // The module cache
30
+ /******/ var __webpack_module_cache__ = {};
31
+ /******/
32
+ /******/ // The require function
33
+ /******/ function __webpack_require__(moduleId) {
34
+ /******/ // Check if module is in cache
35
+ /******/ var cachedModule = __webpack_module_cache__[moduleId];
36
+ /******/ if (cachedModule !== undefined) {
37
+ /******/ return cachedModule.exports;
38
+ /******/ }
39
+ /******/ // Create a new module (and put it into the cache)
40
+ /******/ var module = __webpack_module_cache__[moduleId] = {
41
+ /******/ // no module.id needed
42
+ /******/ // no module.loaded needed
43
+ /******/ exports: {}
44
+ /******/ };
45
+ /******/
46
+ /******/ // Execute the module function
47
+ /******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
48
+ /******/
49
+ /******/ // Return the exports of the module
50
+ /******/ return module.exports;
51
+ /******/ }
52
+ /******/
53
+ /************************************************************************/
54
+ /******/ /* webpack/runtime/compat get default export */
55
+ /******/ (() => {
56
+ /******/ // getDefaultExport function for compatibility with non-harmony modules
57
+ /******/ __webpack_require__.n = (module) => {
58
+ /******/ var getter = module && module.__esModule ?
59
+ /******/ () => (module['default']) :
60
+ /******/ () => (module);
61
+ /******/ __webpack_require__.d(getter, { a: getter });
62
+ /******/ return getter;
63
+ /******/ };
64
+ /******/ })();
65
+ /******/
66
+ /******/ /* webpack/runtime/define property getters */
67
+ /******/ (() => {
68
+ /******/ // define getter functions for harmony exports
69
+ /******/ __webpack_require__.d = (exports, definition) => {
70
+ /******/ for(var key in definition) {
71
+ /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
72
+ /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
73
+ /******/ }
74
+ /******/ }
75
+ /******/ };
76
+ /******/ })();
77
+ /******/
78
+ /******/ /* webpack/runtime/hasOwnProperty shorthand */
79
+ /******/ (() => {
80
+ /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
81
+ /******/ })();
82
+ /******/
83
+ /******/ /* webpack/runtime/make namespace object */
84
+ /******/ (() => {
85
+ /******/ // define __esModule on exports
86
+ /******/ __webpack_require__.r = (exports) => {
87
+ /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
88
+ /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
89
+ /******/ }
90
+ /******/ Object.defineProperty(exports, '__esModule', { value: true });
91
+ /******/ };
92
+ /******/ })();
93
+ /******/
94
+ /************************************************************************/
95
+ var __webpack_exports__ = {};
96
+ // This entry needs to be wrapped in an IIFE because it needs to be isolated against other modules in the chunk.
97
+ (() => {
98
+ __webpack_require__.r(__webpack_exports__);
99
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
100
+ /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
101
+ /* harmony export */ });
102
+ /* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(1);
103
+ /* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(vue__WEBPACK_IMPORTED_MODULE_0__);
104
+ /* harmony import */ var wujie__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(2);
105
+ /* harmony import */ var wujie__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(wujie__WEBPACK_IMPORTED_MODULE_1__);
106
+ function _array_like_to_array(arr, len) {
107
+ if (len == null || len > arr.length) len = arr.length;
108
+ for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
109
+ return arr2;
110
+ }
111
+ function _array_without_holes(arr) {
112
+ if (Array.isArray(arr)) return _array_like_to_array(arr);
113
+ }
114
+ function _iterable_to_array(iter) {
115
+ if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
116
+ }
117
+ function _non_iterable_spread() {
118
+ throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
119
+ }
120
+ function _to_consumable_array(arr) {
121
+ return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_spread();
122
+ }
123
+ function _unsupported_iterable_to_array(o, minLen) {
124
+ if (!o) return;
125
+ if (typeof o === "string") return _array_like_to_array(o, minLen);
126
+ var n = Object.prototype.toString.call(o).slice(8, -1);
127
+ if (n === "Object" && o.constructor) n = o.constructor.name;
128
+ if (n === "Map" || n === "Set") return Array.from(n);
129
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
130
+ }
131
+
132
+
133
+ var wujie = (0,vue__WEBPACK_IMPORTED_MODULE_0__.defineComponent)({
134
+ props: {
135
+ width: {
136
+ type: String,
137
+ default: ""
138
+ },
139
+ height: {
140
+ type: String,
141
+ default: ""
142
+ },
143
+ name: {
144
+ type: String,
145
+ default: "",
146
+ required: true
147
+ },
148
+ loading: {
149
+ type: HTMLElement,
150
+ default: undefined
151
+ },
152
+ url: {
153
+ type: String,
154
+ default: "",
155
+ required: true
156
+ },
157
+ sync: {
158
+ type: Boolean,
159
+ default: undefined
160
+ },
161
+ prefix: {
162
+ type: Object,
163
+ default: undefined
164
+ },
165
+ alive: {
166
+ type: Boolean,
167
+ default: undefined
168
+ },
169
+ props: {
170
+ type: Object,
171
+ default: undefined
172
+ },
173
+ attrs: {
174
+ type: Object,
175
+ default: undefined
176
+ },
177
+ replace: {
178
+ type: Function,
179
+ default: undefined
180
+ },
181
+ fetch: {
182
+ type: Function,
183
+ default: undefined
184
+ },
185
+ fiber: {
186
+ type: Boolean,
187
+ default: undefined
188
+ },
189
+ degrade: {
190
+ type: Boolean,
191
+ default: undefined
192
+ },
193
+ plugins: {
194
+ type: Array,
195
+ default: null
196
+ },
197
+ beforeLoad: {
198
+ type: Function,
199
+ default: null
200
+ },
201
+ beforeMount: {
202
+ type: Function,
203
+ default: null
204
+ },
205
+ afterMount: {
206
+ type: Function,
207
+ default: null
208
+ },
209
+ beforeUnmount: {
210
+ type: Function,
211
+ default: null
212
+ },
213
+ afterUnmount: {
214
+ type: Function,
215
+ default: null
216
+ },
217
+ activated: {
218
+ type: Function,
219
+ default: null
220
+ },
221
+ deactivated: {
222
+ type: Function,
223
+ default: null
224
+ }
225
+ },
226
+ setup: function setup(props, param) {
227
+ var emit = param.emit;
228
+ var instance = (0,vue__WEBPACK_IMPORTED_MODULE_0__.getCurrentInstance)();
229
+ var init = function init() {
230
+ (0,wujie__WEBPACK_IMPORTED_MODULE_1__.startApp)({
231
+ name: props.name,
232
+ url: props.url,
233
+ el: instance === null || instance === void 0 ? void 0 : instance.refs.wujie,
234
+ loading: props.loading,
235
+ alive: props.alive,
236
+ fetch: props.fetch,
237
+ props: props.props,
238
+ attrs: props.attrs,
239
+ replace: props.replace,
240
+ sync: props.sync,
241
+ prefix: props.prefix,
242
+ fiber: props.fiber,
243
+ degrade: props.degrade,
244
+ plugins: props.plugins,
245
+ beforeLoad: props.beforeLoad,
246
+ beforeMount: props.beforeMount,
247
+ afterMount: props.afterMount,
248
+ beforeUnmount: props.beforeUnmount,
249
+ afterUnmount: props.afterUnmount,
250
+ activated: props.activated,
251
+ deactivated: props.deactivated
252
+ });
253
+ };
254
+ (0,vue__WEBPACK_IMPORTED_MODULE_0__.watch)([
255
+ props.name,
256
+ props.url
257
+ ], function() {
258
+ init();
259
+ });
260
+ var handlerEmit = function handlerEmit(event) {
261
+ for(var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++){
262
+ args[_key - 1] = arguments[_key];
263
+ }
264
+ emit.apply(void 0, [
265
+ event
266
+ ].concat(_to_consumable_array(args)));
267
+ };
268
+ (0,vue__WEBPACK_IMPORTED_MODULE_0__.onMounted)(function() {
269
+ wujie__WEBPACK_IMPORTED_MODULE_1__.bus.$onAll(handlerEmit);
270
+ init();
271
+ });
272
+ (0,vue__WEBPACK_IMPORTED_MODULE_0__.onBeforeUnmount)(function() {
273
+ wujie__WEBPACK_IMPORTED_MODULE_1__.bus.$offAll(handlerEmit);
274
+ });
275
+ return function() {
276
+ return (0,vue__WEBPACK_IMPORTED_MODULE_0__.h)("div", {
277
+ style: {
278
+ width: props.width,
279
+ height: props.height
280
+ },
281
+ ref: "wujie"
282
+ });
283
+ };
284
+ }
285
+ });
286
+ wujie.install = function(app) {
287
+ app.component('WujieVue', wujie);
288
+ };
289
+ /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (wujie);
290
+
291
+ })();
292
+
293
+ /******/ return __webpack_exports__;
294
+ /******/ })()
295
+ ;
296
+ });
package/package.json ADDED
@@ -0,0 +1,33 @@
1
+ {
2
+ "name": "dullcatmen-wujie-vue-setup",
3
+ "version": "0.0.1",
4
+ "description": "",
5
+ "main": "lib/index.js",
6
+ "module": "esm/index.js",
7
+ "scripts": {
8
+ "test": "echo \"Error: no test specified\" && exit 1",
9
+ "lib": "webpack",
10
+ "esm": "swc src/index.ts -d esm"
11
+ },
12
+ "files": [
13
+ "lib",
14
+ "esm",
15
+ "index.d.ts"
16
+ ],
17
+ "keywords": [],
18
+ "author": "",
19
+ "license": "ISC",
20
+ "packageManager": "pnpm@10.12.1",
21
+ "dependencies": {
22
+ "wujie": "^2.1.0"
23
+ },
24
+ "devDependencies": {
25
+ "@swc/core": "^1.15.41",
26
+ "swc-loader": "^0.2.7",
27
+ "ts-loader": "^9.6.1",
28
+ "typescript": "^6.0.3",
29
+ "vue": "^3.5.38",
30
+ "webpack": "^5.107.2",
31
+ "webpack-cli": "^7.0.3"
32
+ }
33
+ }