@shijiu/jsview-vue 0.9.631 → 1.9.627
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/dom/bin/jsview-browser-debug-dom.min.js +1 -1
- package/dom/bin/jsview-dom.min.js +1 -1
- package/dom/{target_core_revision.js → target_core_revision.mjs} +6 -6
- package/index.d.ts +1 -0
- package/index.js +1 -10
- package/loader/jsview-main.js +1 -1
- package/loader/loader.js +0 -1
- package/package.json +3 -3
- package/patches/node_modules/@vue/compiler-sfc/dist/compiler-sfc.cjs.js +17225 -2182
- package/patches/node_modules/@vue/compiler-sfc/dist/jsview-css-to-js.js +10 -12
- package/patches/node_modules/@vue/compiler-sfc/dist/jsview-style-format.js +5 -1
- package/patches/node_modules/@vue/compiler-sfc/dist/jsview-style-types.js +6 -1
- package/patches/node_modules/@vue/runtime-core/dist/runtime-core.esm-bundler.js +6972 -7050
- package/patches/node_modules/@vue/runtime-dom/dist/runtime-dom.esm-bundler.js +221 -117
- package/patches/node_modules/postcss-js/objectifier.js +4 -4
- package/samples/Basic/App.vue +2 -2
- package/samples/Basic/components/FontStyle.css +1 -1
- package/samples/Basic/components/anim/AnimGroup.vue +4 -4
- package/samples/Basic/components/div/DivGroup1.vue +4 -4
- package/samples/Basic/components/div/DivGroup2.vue +5 -5
- package/samples/Basic/components/img/ImageGroup.vue +2 -2
- package/samples/Basic/components/panel/Panel1.vue +6 -6
- package/samples/Basic/components/panel/Panel2.vue +2 -2
- package/samples/Basic/components/text/TextGroup1.vue +4 -4
- package/samples/Basic/components/text/TextGroup2.vue +2 -2
- package/samples/Basic/components/text/TextOverflow.vue +2 -2
- package/samples/DemoHomepage/App.vue +1 -1
- package/samples/DemoHomepage/components/BodyFrame.vue +0 -2
- package/samples/DemoHomepage/router.js +36 -51
- package/samples/DemoHomepage/views/Homepage.vue +9 -5
- package/samples/HashHistory/router.js +6 -6
- package/samples/Input/App.vue +17 -8
- package/samples/Input/InputPanel.vue +11 -18
- package/samples/MetroWidgetDemos/PingPong/App.vue +3 -3
- package/samples/MetroWidgetDemos/PingPong/AppPage.vue +2 -17
- package/samples/MetroWidgetDemos/PingPong/AppTab.vue +10 -3
- package/samples/MetroWidgetDemos/PingPong/{TabItem.vue → Item.vue} +10 -2
- package/samples/MetroWidgetDemos/PingPong/ViewSwiper.vue +2 -2
- package/samples/Preload/App.vue +11 -16
- package/samples/SprayView/App.vue +2 -2
- package/samples/TextureAnimation/App2.vue +14 -42
- package/samples/VideoDemo/App.vue +2 -2
- package/samples/VisibleSensorDemo/App.vue +25 -92
- package/scripts/jsview-post-install.js +5 -5
- package/scripts/jsview-run-android.js +12 -11
- package/utils/JsViewEngineWidget/JsvFocusBlock.vue +56 -52
- package/utils/JsViewEngineWidget/JsvFocusManager.js +1 -1
- package/utils/JsViewPlugin/JsvPlayer/JsvMedia.js +2 -36
- package/utils/JsViewPlugin/JsvPlayer/JsvPlayer.vue +0 -14
- package/utils/JsViewPlugin/JsvPlayer/index.js +1 -8
- package/utils/JsViewPlugin/JsvPlayer/version.js +4 -4
- package/utils/JsViewVueTools/JsvHashHistory.js +12 -12
- package/utils/JsViewVueTools/index.d.ts +5 -1
- package/utils/JsViewVueTools/index.js +1 -2
- package/utils/JsViewVueWidget/BrowserDebugWidget/BrowserPreload.vue +1 -11
- package/utils/JsViewVueWidget/JsvActorMove/JsvActorMove.vue +2 -2
- package/utils/JsViewVueWidget/JsvInput/Cursor.vue +2 -4
- package/utils/JsViewVueWidget/JsvInput/JsvInput.vue +12 -13
- package/utils/JsViewVueWidget/JsvPreload/JsvPreload.vue +41 -37
- package/utils/JsViewVueWidget/JsvTextureAnim/JsvTextureAnim.vue +8 -1
- package/utils/JsViewVueWidget/JsvVisibleSensor/JsvVisibleSensor.vue +1 -1
- package/utils/index.d.ts +3 -0
- package/utils/index.js +10 -0
- package/dom/jsv-browser-debug-dom.js_1 +0 -8
- package/dom/jsv-dom.js_1 +0 -6
- package/dom/jsv-forge-define.js_1 +0 -6
- package/patches/node_modules/@babel/preset-env/lib/available-plugins.js +0 -219
- package/patches/node_modules/@vue/cli-plugin-typescript/index.js +0 -100
- package/patches/node_modules/@vue/cli-service/lib/commands/serve.js +0 -395
- package/patches/node_modules/@vue/cli-service/lib/config/app.js +0 -272
- package/patches/node_modules/@vue/cli-service/lib/config/assets.js +0 -70
- package/patches/node_modules/@vue/cli-service/lib/config/base.js +0 -212
- package/patches/node_modules/vue-loader/dist/resolveScript.js +0 -70
- package/samples/Collision/App.vue +0 -452
- package/samples/ImpactStop/App.vue +0 -435
- package/samples/TextureAnimation/assets/light.png +0 -0
- package/samples/TextureAnimation/assets/light2.png +0 -0
- package/utils/JsViewVueTools/JsvImpactTracer.js +0 -113
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { camelize, warn, callWithAsyncErrorHandling, defineComponent, nextTick, createVNode, getCurrentInstance, watchPostEffect, onMounted, onUnmounted, Fragment, Static, h, BaseTransition, useTransitionState, onUpdated, toRaw, getTransitionRawChildren, setTransitionHooks, resolveTransitionHooks, createRenderer, isRuntimeOnly, createHydrationRenderer } from '@vue/runtime-core';
|
|
2
2
|
export * from '@vue/runtime-core';
|
|
3
|
-
import { isString, isArray, hyphenate, capitalize, isSpecialBooleanAttr, includeBooleanAttr, isOn, isModelListener, isFunction, camelize as camelize$1,
|
|
3
|
+
import { isString, isArray, hyphenate, capitalize, isSpecialBooleanAttr, includeBooleanAttr, isOn, isModelListener, isFunction, toNumber, camelize as camelize$1, extend, EMPTY_OBJ, isObject, invokeArrayFns, looseIndexOf, isSet, looseEqual, isHTMLTag, isSVGTag } from '@vue/shared';
|
|
4
4
|
|
|
5
5
|
const svgNS = 'http://www.w3.org/2000/svg';
|
|
6
6
|
const doc = (typeof document !== 'undefined' ? document : null);
|
|
7
|
-
const
|
|
7
|
+
const templateContainer = doc && /*#__PURE__*/ doc.createElement('template');
|
|
8
8
|
const nodeOps = {
|
|
9
9
|
insert: (child, parent, anchor) => {
|
|
10
10
|
parent.insertBefore(child, anchor || null);
|
|
@@ -37,8 +37,9 @@ const nodeOps = {
|
|
|
37
37
|
querySelector: selector => doc.querySelector(selector),
|
|
38
38
|
setScopeId(el, id) {
|
|
39
39
|
el.setAttribute(id, '');
|
|
40
|
-
},
|
|
41
|
-
cloneNode_JSV_REMOVED(el) {
|
|
42
40
|
// QCode Removed
|
|
41
|
+
},
|
|
42
|
+
// JsView Removed >>>
|
|
43
|
+
/* cloneNode(el) {
|
|
43
44
|
const cloned = el.cloneNode(true);
|
|
44
45
|
// #3072
|
|
45
46
|
// - in `patchDOMProp`, we store the actual value in the `el._value` property.
|
|
@@ -53,19 +54,30 @@ const nodeOps = {
|
|
|
53
54
|
cloned._value = el._value;
|
|
54
55
|
}
|
|
55
56
|
return cloned;
|
|
56
|
-
},
|
|
57
|
+
}, */
|
|
58
|
+
// JsView Removed <<<
|
|
57
59
|
// __UNSAFE__
|
|
58
60
|
// Reason: innerHTML.
|
|
59
61
|
// Static content here can only come from compiled templates.
|
|
60
62
|
// As long as the user only uses trusted templates, this is safe.
|
|
61
|
-
insertStaticContent(content, parent, anchor, isSVG) {
|
|
63
|
+
insertStaticContent(content, parent, anchor, isSVG, start, end) {
|
|
62
64
|
// <parent> before | first ... last | anchor </parent>
|
|
63
65
|
const before = anchor ? anchor.previousSibling : parent.lastChild;
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
66
|
+
// #5308 can only take cached path if:
|
|
67
|
+
// - has a single root node
|
|
68
|
+
// - nextSibling info is still available
|
|
69
|
+
if (start && (start === end || start.nextSibling)) {
|
|
70
|
+
// cached
|
|
71
|
+
while (true) {
|
|
72
|
+
parent.insertBefore(start.cloneNode(true), anchor);
|
|
73
|
+
if (start === end || !(start = start.nextSibling))
|
|
74
|
+
break;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
else {
|
|
78
|
+
// fresh insert
|
|
79
|
+
templateContainer.innerHTML = isSVG ? `<svg>${content}</svg>` : content;
|
|
80
|
+
const template = templateContainer.content;
|
|
69
81
|
if (isSVG) {
|
|
70
82
|
// remove outer svg wrapper
|
|
71
83
|
const wrapper = template.firstChild;
|
|
@@ -74,9 +86,8 @@ const nodeOps = {
|
|
|
74
86
|
}
|
|
75
87
|
template.removeChild(wrapper);
|
|
76
88
|
}
|
|
77
|
-
|
|
89
|
+
parent.insertBefore(template, anchor);
|
|
78
90
|
}
|
|
79
|
-
parent.insertBefore(template.cloneNode(true), anchor);
|
|
80
91
|
return [
|
|
81
92
|
// first
|
|
82
93
|
before ? before.nextSibling : parent.firstChild,
|
|
@@ -109,22 +120,8 @@ function patchClass(el, value, isSVG) {
|
|
|
109
120
|
|
|
110
121
|
function patchStyle(el, prev, next) {
|
|
111
122
|
const style = el.style;
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
}
|
|
115
|
-
else if (isString(next)) {
|
|
116
|
-
if (prev !== next) {
|
|
117
|
-
const current = style.display;
|
|
118
|
-
style.cssText = next;
|
|
119
|
-
// indicates that the `display` of the element is controlled by `v-show`,
|
|
120
|
-
// so we always keep the current `display` value regardless of the `style` value,
|
|
121
|
-
// thus handing over control to `v-show`.
|
|
122
|
-
if ('_vod' in el) {
|
|
123
|
-
style.display = current;
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
else {
|
|
123
|
+
const isCssString = isString(next);
|
|
124
|
+
if (next && !isCssString) {
|
|
128
125
|
for (const key in next) {
|
|
129
126
|
setStyle(style, key, next[key]);
|
|
130
127
|
}
|
|
@@ -136,6 +133,23 @@ function patchStyle(el, prev, next) {
|
|
|
136
133
|
}
|
|
137
134
|
}
|
|
138
135
|
}
|
|
136
|
+
else {
|
|
137
|
+
const currentDisplay = style.display;
|
|
138
|
+
if (isCssString) {
|
|
139
|
+
if (prev !== next) {
|
|
140
|
+
style.cssText = next;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
else if (prev) {
|
|
144
|
+
el.removeAttribute('style');
|
|
145
|
+
}
|
|
146
|
+
// indicates that the `display` of the element is controlled by `v-show`,
|
|
147
|
+
// so we always keep the current `display` value regardless of the `style`
|
|
148
|
+
// value, thus handing over control to `v-show`.
|
|
149
|
+
if ('_vod' in el) {
|
|
150
|
+
style.display = currentDisplay;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
139
153
|
}
|
|
140
154
|
const importantRE = /\s*!important$/;
|
|
141
155
|
function setStyle(style, name, val) {
|
|
@@ -143,6 +157,8 @@ function setStyle(style, name, val) {
|
|
|
143
157
|
val.forEach(v => setStyle(style, name, v));
|
|
144
158
|
}
|
|
145
159
|
else {
|
|
160
|
+
if (val == null)
|
|
161
|
+
val = '';
|
|
146
162
|
if (name.startsWith('--')) {
|
|
147
163
|
// custom property definition
|
|
148
164
|
style.setProperty(name, val);
|
|
@@ -217,12 +233,19 @@ prevChildren, parentComponent, parentSuspense, unmountChildren) {
|
|
|
217
233
|
el[key] = value == null ? '' : value;
|
|
218
234
|
return;
|
|
219
235
|
}
|
|
220
|
-
if (key === 'value' &&
|
|
236
|
+
if (key === 'value' &&
|
|
237
|
+
el.tagName !== 'PROGRESS' &&
|
|
238
|
+
// custom elements may use _value internally
|
|
239
|
+
!el.tagName.includes('-')) {
|
|
221
240
|
// store value as _value as well since
|
|
222
241
|
// non-string values will be stringified.
|
|
223
242
|
el._value = value;
|
|
224
243
|
const newValue = value == null ? '' : value;
|
|
225
|
-
if (el.value !== newValue
|
|
244
|
+
if (el.value !== newValue ||
|
|
245
|
+
// #4956: always set for OPTION elements because its value falls back to
|
|
246
|
+
// textContent if no value attribute is present. And setting .value for
|
|
247
|
+
// OPTION has no side effect
|
|
248
|
+
el.tagName === 'OPTION') {
|
|
226
249
|
el.value = newValue;
|
|
227
250
|
}
|
|
228
251
|
if (value == null) {
|
|
@@ -230,31 +253,28 @@ prevChildren, parentComponent, parentSuspense, unmountChildren) {
|
|
|
230
253
|
}
|
|
231
254
|
return;
|
|
232
255
|
}
|
|
256
|
+
let needRemove = false;
|
|
233
257
|
if (value === '' || value == null) {
|
|
234
258
|
const type = typeof el[key];
|
|
235
259
|
if (type === 'boolean') {
|
|
236
260
|
// e.g. <select multiple> compiles to { multiple: '' }
|
|
237
|
-
|
|
238
|
-
return;
|
|
261
|
+
value = includeBooleanAttr(value);
|
|
239
262
|
}
|
|
240
263
|
else if (value == null && type === 'string') {
|
|
241
264
|
// e.g. <div :id="null">
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
return;
|
|
265
|
+
value = '';
|
|
266
|
+
needRemove = true;
|
|
245
267
|
}
|
|
246
268
|
else if (type === 'number') {
|
|
247
269
|
// e.g. <img :width="null">
|
|
248
270
|
// the value of some IDL attr must be greater than 0, e.g. input.size = 0 -> error
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
}
|
|
252
|
-
catch (_a) { }
|
|
253
|
-
el.removeAttribute(key);
|
|
254
|
-
return;
|
|
271
|
+
value = 0;
|
|
272
|
+
needRemove = true;
|
|
255
273
|
}
|
|
256
274
|
}
|
|
257
|
-
// some properties perform value validation and throw
|
|
275
|
+
// some properties perform value validation and throw,
|
|
276
|
+
// some properties has getter, no setter, will error in 'use strict'
|
|
277
|
+
// eg. <select :type="null"></select> <select :willValidate="null"></select>
|
|
258
278
|
try {
|
|
259
279
|
el[key] = value;
|
|
260
280
|
}
|
|
@@ -264,31 +284,35 @@ prevChildren, parentComponent, parentSuspense, unmountChildren) {
|
|
|
264
284
|
`value ${value} is invalid.`, e);
|
|
265
285
|
}
|
|
266
286
|
}
|
|
287
|
+
needRemove && el.removeAttribute(key);
|
|
267
288
|
}
|
|
268
289
|
|
|
269
290
|
// Async edge case fix requires storing an event listener's attach timestamp.
|
|
270
|
-
|
|
271
|
-
let
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
291
|
+
const [_getNow, skipTimestampCheck] = /*#__PURE__*/ (() => {
|
|
292
|
+
let _getNow = Date.now;
|
|
293
|
+
let skipTimestampCheck = false;
|
|
294
|
+
if (typeof window !== 'undefined') {
|
|
295
|
+
// Determine what event timestamp the browser is using. Annoyingly, the
|
|
296
|
+
// timestamp can either be hi-res (relative to page load) or low-res
|
|
297
|
+
// (relative to UNIX epoch), so in order to compare time we have to use the
|
|
298
|
+
// same timestamp type when saving the flush timestamp.
|
|
299
|
+
if (Date.now() > document.createEvent('Event').timeStamp) {
|
|
300
|
+
// if the low-res timestamp which is bigger than the event timestamp
|
|
301
|
+
// (which is evaluated AFTER) it means the event is using a hi-res timestamp,
|
|
302
|
+
// and we need to use the hi-res version for event listeners as well.
|
|
303
|
+
_getNow = performance.now.bind(performance);
|
|
304
|
+
}
|
|
305
|
+
// #3485: Firefox <= 53 has incorrect Event.timeStamp implementation
|
|
306
|
+
// and does not fire microtasks in between event propagation, so safe to exclude.
|
|
307
|
+
const ffMatch = navigator.userAgent.match(/firefox\/(\d+)/i);
|
|
308
|
+
skipTimestampCheck = !!(ffMatch && Number(ffMatch[1]) <= 53);
|
|
309
|
+
}
|
|
310
|
+
return [_getNow, skipTimestampCheck];
|
|
311
|
+
})();
|
|
288
312
|
// To avoid the overhead of repeatedly calling performance.now(), we cache
|
|
289
313
|
// and use the same timestamp for all event listeners attached in the same tick.
|
|
290
314
|
let cachedNow = 0;
|
|
291
|
-
const p = Promise.resolve();
|
|
315
|
+
const p = /*#__PURE__*/ Promise.resolve();
|
|
292
316
|
const reset = () => {
|
|
293
317
|
cachedNow = 0;
|
|
294
318
|
};
|
|
@@ -358,7 +382,7 @@ function patchStopImmediatePropagation(e, value) {
|
|
|
358
382
|
originalStop.call(e);
|
|
359
383
|
e._stopped = true;
|
|
360
384
|
};
|
|
361
|
-
return value.map(fn => (e) => !e._stopped && fn(e));
|
|
385
|
+
return value.map(fn => (e) => !e._stopped && fn && fn(e));
|
|
362
386
|
}
|
|
363
387
|
else {
|
|
364
388
|
return value;
|
|
@@ -413,13 +437,13 @@ function shouldSetAsProp(el, key, value, isSVG) {
|
|
|
413
437
|
}
|
|
414
438
|
return false;
|
|
415
439
|
}
|
|
416
|
-
//
|
|
417
|
-
//
|
|
418
|
-
//
|
|
419
|
-
//
|
|
440
|
+
// these are enumerated attrs, however their corresponding DOM properties
|
|
441
|
+
// are actually booleans - this leads to setting it with a string "false"
|
|
442
|
+
// value leading it to be coerced to `true`, so we need to always treat
|
|
443
|
+
// them as attributes.
|
|
420
444
|
// Note that `contentEditable` doesn't have this problem: its DOM
|
|
421
445
|
// property is also enumerated string values.
|
|
422
|
-
if (key === 'spellcheck' || key === 'draggable') {
|
|
446
|
+
if (key === 'spellcheck' || key === 'draggable' || key === 'translate') {
|
|
423
447
|
return false;
|
|
424
448
|
}
|
|
425
449
|
// #1787, #2840 form property on form elements is readonly and must be set as
|
|
@@ -442,11 +466,11 @@ function shouldSetAsProp(el, key, value, isSVG) {
|
|
|
442
466
|
return key in el;
|
|
443
467
|
}
|
|
444
468
|
|
|
445
|
-
function defineCustomElement(options,
|
|
469
|
+
function defineCustomElement(options, hydrate) {
|
|
446
470
|
const Comp = defineComponent(options);
|
|
447
471
|
class VueCustomElement extends VueElement {
|
|
448
472
|
constructor(initialProps) {
|
|
449
|
-
super(Comp, initialProps,
|
|
473
|
+
super(Comp, initialProps, hydrate);
|
|
450
474
|
}
|
|
451
475
|
}
|
|
452
476
|
VueCustomElement.def = Comp;
|
|
@@ -469,6 +493,7 @@ class VueElement extends BaseClass {
|
|
|
469
493
|
this._instance = null;
|
|
470
494
|
this._connected = false;
|
|
471
495
|
this._resolved = false;
|
|
496
|
+
this._numberProps = null;
|
|
472
497
|
if (this.shadowRoot && hydrate) {
|
|
473
498
|
hydrate(this._createVNode(), this.shadowRoot);
|
|
474
499
|
}
|
|
@@ -479,23 +504,11 @@ class VueElement extends BaseClass {
|
|
|
479
504
|
}
|
|
480
505
|
this.attachShadow({ mode: 'open' });
|
|
481
506
|
}
|
|
482
|
-
// set initial attrs
|
|
483
|
-
for (let i = 0; i < this.attributes.length; i++) {
|
|
484
|
-
this._setAttr(this.attributes[i].name);
|
|
485
|
-
}
|
|
486
|
-
// watch future attr changes
|
|
487
|
-
const observer = new MutationObserver(mutations => {
|
|
488
|
-
for (const m of mutations) {
|
|
489
|
-
this._setAttr(m.attributeName);
|
|
490
|
-
}
|
|
491
|
-
});
|
|
492
|
-
observer.observe(this, { attributes: true });
|
|
493
507
|
}
|
|
494
508
|
connectedCallback() {
|
|
495
509
|
this._connected = true;
|
|
496
510
|
if (!this._instance) {
|
|
497
511
|
this._resolveDef();
|
|
498
|
-
render(this._createVNode(), this.shadowRoot);
|
|
499
512
|
}
|
|
500
513
|
}
|
|
501
514
|
disconnectedCallback() {
|
|
@@ -514,17 +527,40 @@ class VueElement extends BaseClass {
|
|
|
514
527
|
if (this._resolved) {
|
|
515
528
|
return;
|
|
516
529
|
}
|
|
530
|
+
this._resolved = true;
|
|
531
|
+
// set initial attrs
|
|
532
|
+
for (let i = 0; i < this.attributes.length; i++) {
|
|
533
|
+
this._setAttr(this.attributes[i].name);
|
|
534
|
+
}
|
|
535
|
+
// watch future attr changes
|
|
536
|
+
new MutationObserver(mutations => {
|
|
537
|
+
for (const m of mutations) {
|
|
538
|
+
this._setAttr(m.attributeName);
|
|
539
|
+
}
|
|
540
|
+
}).observe(this, { attributes: true });
|
|
517
541
|
const resolve = (def) => {
|
|
518
|
-
|
|
542
|
+
const { props, styles } = def;
|
|
543
|
+
const hasOptions = !isArray(props);
|
|
544
|
+
const rawKeys = props ? (hasOptions ? Object.keys(props) : props) : [];
|
|
545
|
+
// cast Number-type props set before resolve
|
|
546
|
+
let numberProps;
|
|
547
|
+
if (hasOptions) {
|
|
548
|
+
for (const key in this._props) {
|
|
549
|
+
const opt = props[key];
|
|
550
|
+
if (opt === Number || (opt && opt.type === Number)) {
|
|
551
|
+
this._props[key] = toNumber(this._props[key]);
|
|
552
|
+
(numberProps || (numberProps = Object.create(null)))[key] = true;
|
|
553
|
+
}
|
|
554
|
+
}
|
|
555
|
+
}
|
|
556
|
+
this._numberProps = numberProps;
|
|
519
557
|
// check if there are props set pre-upgrade or connect
|
|
520
558
|
for (const key of Object.keys(this)) {
|
|
521
559
|
if (key[0] !== '_') {
|
|
522
|
-
this._setProp(key, this[key]);
|
|
560
|
+
this._setProp(key, this[key], true, false);
|
|
523
561
|
}
|
|
524
562
|
}
|
|
525
|
-
const { props, styles } = def;
|
|
526
563
|
// defining getter/setters on prototype
|
|
527
|
-
const rawKeys = props ? (isArray(props) ? props : Object.keys(props)) : [];
|
|
528
564
|
for (const key of rawKeys.map(camelize$1)) {
|
|
529
565
|
Object.defineProperty(this, key, {
|
|
530
566
|
get() {
|
|
@@ -535,7 +571,10 @@ class VueElement extends BaseClass {
|
|
|
535
571
|
}
|
|
536
572
|
});
|
|
537
573
|
}
|
|
574
|
+
// apply CSS
|
|
538
575
|
this._applyStyles(styles);
|
|
576
|
+
// initial render
|
|
577
|
+
this._update();
|
|
539
578
|
};
|
|
540
579
|
const asyncDef = this._def.__asyncLoader;
|
|
541
580
|
if (asyncDef) {
|
|
@@ -546,7 +585,11 @@ class VueElement extends BaseClass {
|
|
|
546
585
|
}
|
|
547
586
|
}
|
|
548
587
|
_setAttr(key) {
|
|
549
|
-
|
|
588
|
+
let value = this.getAttribute(key);
|
|
589
|
+
if (this._numberProps && this._numberProps[key]) {
|
|
590
|
+
value = toNumber(value);
|
|
591
|
+
}
|
|
592
|
+
this._setProp(camelize$1(key), value, false);
|
|
550
593
|
}
|
|
551
594
|
/**
|
|
552
595
|
* @internal
|
|
@@ -557,11 +600,11 @@ class VueElement extends BaseClass {
|
|
|
557
600
|
/**
|
|
558
601
|
* @internal
|
|
559
602
|
*/
|
|
560
|
-
_setProp(key, val, shouldReflect = true) {
|
|
603
|
+
_setProp(key, val, shouldReflect = true, shouldUpdate = true) {
|
|
561
604
|
if (val !== this._props[key]) {
|
|
562
605
|
this._props[key] = val;
|
|
563
|
-
if (this._instance) {
|
|
564
|
-
|
|
606
|
+
if (shouldUpdate && this._instance) {
|
|
607
|
+
this._update();
|
|
565
608
|
}
|
|
566
609
|
// reflect
|
|
567
610
|
if (shouldReflect) {
|
|
@@ -577,6 +620,9 @@ class VueElement extends BaseClass {
|
|
|
577
620
|
}
|
|
578
621
|
}
|
|
579
622
|
}
|
|
623
|
+
_update() {
|
|
624
|
+
render(this._createVNode(), this.shadowRoot);
|
|
625
|
+
}
|
|
580
626
|
_createVNode() {
|
|
581
627
|
const vnode = createVNode(this._def, extend({}, this._props));
|
|
582
628
|
if (!this._instance) {
|
|
@@ -586,7 +632,7 @@ class VueElement extends BaseClass {
|
|
|
586
632
|
// HMR
|
|
587
633
|
if ((process.env.NODE_ENV !== 'production')) {
|
|
588
634
|
instance.ceReload = newStyles => {
|
|
589
|
-
//
|
|
635
|
+
// always reset styles
|
|
590
636
|
if (this._styles) {
|
|
591
637
|
this._styles.forEach(s => this.shadowRoot.removeChild(s));
|
|
592
638
|
this._styles.length = 0;
|
|
@@ -597,7 +643,7 @@ class VueElement extends BaseClass {
|
|
|
597
643
|
if (!this._def.__asyncLoader) {
|
|
598
644
|
// reload
|
|
599
645
|
this._instance = null;
|
|
600
|
-
|
|
646
|
+
this._update();
|
|
601
647
|
}
|
|
602
648
|
};
|
|
603
649
|
}
|
|
@@ -787,6 +833,8 @@ function resolveTransitionProps(rawProps) {
|
|
|
787
833
|
done && done();
|
|
788
834
|
};
|
|
789
835
|
const finishLeave = (el, done) => {
|
|
836
|
+
el._isLeaving = false;
|
|
837
|
+
removeTransitionClass(el, leaveFromClass);
|
|
790
838
|
removeTransitionClass(el, leaveToClass);
|
|
791
839
|
removeTransitionClass(el, leaveActiveClass);
|
|
792
840
|
done && done();
|
|
@@ -819,12 +867,17 @@ function resolveTransitionProps(rawProps) {
|
|
|
819
867
|
onEnter: makeEnterHook(false),
|
|
820
868
|
onAppear: makeEnterHook(true),
|
|
821
869
|
onLeave(el, done) {
|
|
870
|
+
el._isLeaving = true;
|
|
822
871
|
const resolve = () => finishLeave(el, done);
|
|
823
872
|
addTransitionClass(el, leaveFromClass);
|
|
824
873
|
// force reflow so *-leave-from classes immediately take effect (#2593)
|
|
825
874
|
forceReflow();
|
|
826
875
|
addTransitionClass(el, leaveActiveClass);
|
|
827
876
|
nextFrame(() => {
|
|
877
|
+
if (!el._isLeaving) {
|
|
878
|
+
// cancelled
|
|
879
|
+
return;
|
|
880
|
+
}
|
|
828
881
|
removeTransitionClass(el, leaveFromClass);
|
|
829
882
|
addTransitionClass(el, leaveToClass);
|
|
830
883
|
if (!hasExplicitCallback(onLeave)) {
|
|
@@ -1117,7 +1170,8 @@ function hasCSSTransform(el, root, moveClass) {
|
|
|
1117
1170
|
}
|
|
1118
1171
|
|
|
1119
1172
|
const getModelAssigner = (vnode) => {
|
|
1120
|
-
const fn = vnode.props['onUpdate:modelValue']
|
|
1173
|
+
const fn = vnode.props['onUpdate:modelValue'] ||
|
|
1174
|
+
(false );
|
|
1121
1175
|
return isArray(fn) ? value => invokeArrayFns(fn, value) : fn;
|
|
1122
1176
|
};
|
|
1123
1177
|
function onCompositionStart(e) {
|
|
@@ -1127,14 +1181,9 @@ function onCompositionEnd(e) {
|
|
|
1127
1181
|
const target = e.target;
|
|
1128
1182
|
if (target.composing) {
|
|
1129
1183
|
target.composing = false;
|
|
1130
|
-
|
|
1184
|
+
target.dispatchEvent(new Event('input'));
|
|
1131
1185
|
}
|
|
1132
1186
|
}
|
|
1133
|
-
function trigger(el, type) {
|
|
1134
|
-
const e = document.createEvent('HTMLEvents');
|
|
1135
|
-
e.initEvent(type, true, true);
|
|
1136
|
-
el.dispatchEvent(e);
|
|
1137
|
-
}
|
|
1138
1187
|
// We are exporting the v-model runtime directly as vnode hooks so that it can
|
|
1139
1188
|
// be tree-shaken in case v-model is never used.
|
|
1140
1189
|
const vModelText = {
|
|
@@ -1148,7 +1197,7 @@ const vModelText = {
|
|
|
1148
1197
|
if (trim) {
|
|
1149
1198
|
domValue = domValue.trim();
|
|
1150
1199
|
}
|
|
1151
|
-
|
|
1200
|
+
if (castToNumber) {
|
|
1152
1201
|
domValue = toNumber(domValue);
|
|
1153
1202
|
}
|
|
1154
1203
|
el._assign(domValue);
|
|
@@ -1177,7 +1226,7 @@ const vModelText = {
|
|
|
1177
1226
|
// avoid clearing unresolved text. #2302
|
|
1178
1227
|
if (el.composing)
|
|
1179
1228
|
return;
|
|
1180
|
-
if (document.activeElement === el) {
|
|
1229
|
+
if (document.activeElement === el && el.type !== 'range') {
|
|
1181
1230
|
if (lazy) {
|
|
1182
1231
|
return;
|
|
1183
1232
|
}
|
|
@@ -1348,29 +1397,63 @@ const vModelDynamic = {
|
|
|
1348
1397
|
callModelHook(el, binding, vnode, prevVNode, 'updated');
|
|
1349
1398
|
}
|
|
1350
1399
|
};
|
|
1351
|
-
function
|
|
1352
|
-
|
|
1353
|
-
switch (el.tagName) {
|
|
1400
|
+
function resolveDynamicModel(tagName, type) {
|
|
1401
|
+
switch (tagName) {
|
|
1354
1402
|
case 'SELECT':
|
|
1355
|
-
|
|
1356
|
-
break;
|
|
1403
|
+
return vModelSelect;
|
|
1357
1404
|
case 'TEXTAREA':
|
|
1358
|
-
|
|
1359
|
-
break;
|
|
1405
|
+
return vModelText;
|
|
1360
1406
|
default:
|
|
1361
|
-
switch (
|
|
1407
|
+
switch (type) {
|
|
1362
1408
|
case 'checkbox':
|
|
1363
|
-
|
|
1364
|
-
break;
|
|
1409
|
+
return vModelCheckbox;
|
|
1365
1410
|
case 'radio':
|
|
1366
|
-
|
|
1367
|
-
break;
|
|
1411
|
+
return vModelRadio;
|
|
1368
1412
|
default:
|
|
1369
|
-
|
|
1413
|
+
return vModelText;
|
|
1370
1414
|
}
|
|
1371
1415
|
}
|
|
1416
|
+
}
|
|
1417
|
+
function callModelHook(el, binding, vnode, prevVNode, hook) {
|
|
1418
|
+
const modelToUse = resolveDynamicModel(el.tagName, vnode.props && vnode.props.type);
|
|
1372
1419
|
const fn = modelToUse[hook];
|
|
1373
1420
|
fn && fn(el, binding, vnode, prevVNode);
|
|
1421
|
+
}
|
|
1422
|
+
// SSR vnode transforms, only used when user includes client-oriented render
|
|
1423
|
+
// function in SSR
|
|
1424
|
+
function initVModelForSSR() {
|
|
1425
|
+
vModelText.getSSRProps = ({ value }) => ({ value });
|
|
1426
|
+
vModelRadio.getSSRProps = ({ value }, vnode) => {
|
|
1427
|
+
if (vnode.props && looseEqual(vnode.props.value, value)) {
|
|
1428
|
+
return { checked: true };
|
|
1429
|
+
}
|
|
1430
|
+
};
|
|
1431
|
+
vModelCheckbox.getSSRProps = ({ value }, vnode) => {
|
|
1432
|
+
if (isArray(value)) {
|
|
1433
|
+
if (vnode.props && looseIndexOf(value, vnode.props.value) > -1) {
|
|
1434
|
+
return { checked: true };
|
|
1435
|
+
}
|
|
1436
|
+
}
|
|
1437
|
+
else if (isSet(value)) {
|
|
1438
|
+
if (vnode.props && value.has(vnode.props.value)) {
|
|
1439
|
+
return { checked: true };
|
|
1440
|
+
}
|
|
1441
|
+
}
|
|
1442
|
+
else if (value) {
|
|
1443
|
+
return { checked: true };
|
|
1444
|
+
}
|
|
1445
|
+
};
|
|
1446
|
+
vModelDynamic.getSSRProps = (binding, vnode) => {
|
|
1447
|
+
if (typeof vnode.type !== 'string') {
|
|
1448
|
+
return;
|
|
1449
|
+
}
|
|
1450
|
+
const modelToUse = resolveDynamicModel(
|
|
1451
|
+
// resolveDynamicModel expects an uppercase tag name, but vnode.type is lowercase
|
|
1452
|
+
vnode.type.toUpperCase(), vnode.props && vnode.props.type);
|
|
1453
|
+
if (modelToUse.getSSRProps) {
|
|
1454
|
+
return modelToUse.getSSRProps(binding, vnode);
|
|
1455
|
+
}
|
|
1456
|
+
};
|
|
1374
1457
|
}
|
|
1375
1458
|
|
|
1376
1459
|
const systemModifiers = ['ctrl', 'shift', 'alt', 'meta'];
|
|
@@ -1466,9 +1549,18 @@ const vShow = {
|
|
|
1466
1549
|
};
|
|
1467
1550
|
function setDisplay(el, value) {
|
|
1468
1551
|
el.style.display = value ? el._vod : 'none';
|
|
1552
|
+
}
|
|
1553
|
+
// SSR vnode transforms, only used when user includes client-oriented render
|
|
1554
|
+
// function in SSR
|
|
1555
|
+
function initVShowForSSR() {
|
|
1556
|
+
vShow.getSSRProps = ({ value }) => {
|
|
1557
|
+
if (!value) {
|
|
1558
|
+
return { style: { display: 'none' } };
|
|
1559
|
+
}
|
|
1560
|
+
};
|
|
1469
1561
|
}
|
|
1470
1562
|
|
|
1471
|
-
const rendererOptions = extend({ patchProp }, nodeOps);
|
|
1563
|
+
const rendererOptions = /*#__PURE__*/ extend({ patchProp }, nodeOps);
|
|
1472
1564
|
// lazy create the renderer - this makes core renderer logic tree-shakable
|
|
1473
1565
|
// in case the user only imports reactivity utilities from Vue.
|
|
1474
1566
|
let renderer;
|
|
@@ -1591,6 +1683,18 @@ function normalizeContainer(container) {
|
|
|
1591
1683
|
warn(`mounting on a ShadowRoot with \`{mode: "closed"}\` may lead to unpredictable bugs`);
|
|
1592
1684
|
}
|
|
1593
1685
|
return container;
|
|
1594
|
-
}
|
|
1686
|
+
}
|
|
1687
|
+
let ssrDirectiveInitialized = false;
|
|
1688
|
+
/**
|
|
1689
|
+
* @internal
|
|
1690
|
+
*/
|
|
1691
|
+
const initDirectivesForSSR = () => {
|
|
1692
|
+
if (!ssrDirectiveInitialized) {
|
|
1693
|
+
ssrDirectiveInitialized = true;
|
|
1694
|
+
initVModelForSSR();
|
|
1695
|
+
initVShowForSSR();
|
|
1696
|
+
}
|
|
1697
|
+
}
|
|
1698
|
+
;
|
|
1595
1699
|
|
|
1596
|
-
export { Transition, TransitionGroup, VueElement, createApp, createSSRApp, defineCustomElement, defineSSRCustomElement, hydrate, render, useCssModule, useCssVars, vModelCheckbox, vModelDynamic, vModelRadio, vModelSelect, vModelText, vShow, withKeys, withModifiers };
|
|
1700
|
+
export { Transition, TransitionGroup, VueElement, createApp, createSSRApp, defineCustomElement, defineSSRCustomElement, hydrate, initDirectivesForSSR, render, useCssModule, useCssVars, vModelCheckbox, vModelDynamic, vModelRadio, vModelSelect, vModelText, vShow, withKeys, withModifiers };
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
let camelcase = require('camelcase-css')
|
|
2
2
|
|
|
3
3
|
let UNITLESS = {
|
|
4
|
-
|
|
4
|
+
// JsView Added >>>
|
|
5
5
|
left: true,
|
|
6
6
|
top: true,
|
|
7
7
|
width: true,
|
|
8
8
|
height: true,
|
|
9
|
-
|
|
9
|
+
// JsView Added <<<
|
|
10
10
|
|
|
11
11
|
boxFlex: true,
|
|
12
12
|
boxFlexGroup: true,
|
|
@@ -32,7 +32,7 @@ let UNITLESS = {
|
|
|
32
32
|
strokeWidth: true
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
-
function atRule
|
|
35
|
+
function atRule(node) {
|
|
36
36
|
if (typeof node.nodes === 'undefined') {
|
|
37
37
|
return true
|
|
38
38
|
} else {
|
|
@@ -40,7 +40,7 @@ function atRule (node) {
|
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
-
function process
|
|
43
|
+
function process(node) {
|
|
44
44
|
let name
|
|
45
45
|
let result = {}
|
|
46
46
|
|
package/samples/Basic/App.vue
CHANGED
|
@@ -49,8 +49,8 @@
|
|
|
49
49
|
import { jJsvRuntimeBridge } from "jsview";
|
|
50
50
|
import { reactive, onMounted } from "vue";
|
|
51
51
|
import { useRouter } from "vue-router";
|
|
52
|
-
import Panel1 from "./components/panel/Panel1";
|
|
53
|
-
import Panel2 from "./components/panel/Panel2";
|
|
52
|
+
import Panel1 from "./components/panel/Panel1.vue";
|
|
53
|
+
import Panel2 from "./components/panel/Panel2.vue";
|
|
54
54
|
|
|
55
55
|
const router = useRouter();
|
|
56
56
|
const itemSides = {
|