diff --git a/.prettierignore b/.prettierignore
index 53c37a16608c014b2cf0bd2d5dfcafe953cdd857..90d45b85ab68b448ea675818af859fa9a8ebaf50 100644
--- a/.prettierignore
+++ b/.prettierignore
@@ -1 +1,2 @@
-dist
\ No newline at end of file
+dist
+lib
\ No newline at end of file
diff --git a/packages/uni-app-plus/__tests__/service/dom/dom.spec.ts b/packages/uni-app-plus/__tests__/service/dom/dom.spec.ts
index 38b1f31b49c9865dc67ff793f5f41d239b22f06e..b97377b5a3a1ef9d26643a896f4e8ca2f72f6463 100644
--- a/packages/uni-app-plus/__tests__/service/dom/dom.spec.ts
+++ b/packages/uni-app-plus/__tests__/service/dom/dom.spec.ts
@@ -23,6 +23,9 @@ describe('dom', () => {
route: 'pages/index/index',
version: 1,
locale: 'zh_CN',
+ platform: 'ios',
+ pixelRatio: 1,
+ windowWidth: 375,
disableScroll: false,
onPageScroll: false,
onPageReachBottom: false,
diff --git a/packages/uni-app-plus/__tests__/service/index.spec.ts b/packages/uni-app-plus/__tests__/service/index.spec.ts
index 24ec2f379b9bfad5ef58e7ed08673a735702fa36..33a6a73fa5e048012fa8dd22d47d7c59bd0aca6d 100644
--- a/packages/uni-app-plus/__tests__/service/index.spec.ts
+++ b/packages/uni-app-plus/__tests__/service/index.spec.ts
@@ -19,6 +19,9 @@ const defaultPageNodeOptions = {
route: 'pages/index/index',
version: 1,
locale: 'zh_CN',
+ platform: 'ios',
+ pixelRatio: 1,
+ windowWidth: 375,
disableScroll: false,
onPageScroll: false,
onPageReachBottom: false,
diff --git a/packages/uni-app-plus/dist/style.css b/packages/uni-app-plus/dist/style.css
index f0b3f0e53aa93459d778e6623a39f6a66a20c54e..d199d7552670780269e5d866d8395879aead9d9f 100644
--- a/packages/uni-app-plus/dist/style.css
+++ b/packages/uni-app-plus/dist/style.css
@@ -115,6 +115,94 @@ uni-view {
uni-view[hidden] {
display: none;
}
+uni-audio {
+ display: none;
+}
+
+uni-audio[controls] {
+ display: inline-block;
+}
+
+uni-audio[hidden] {
+ display: none;
+}
+
+.uni-audio-default {
+ max-width: 100%;
+ min-width: 302px;
+ height: 65px;
+ background: #fcfcfc;
+ border: 1px solid #e0e0e0;
+ border-radius: 2.5px;
+ display: inline-block;
+ overflow: hidden;
+}
+
+.uni-audio-left {
+ width: 65px;
+ height: 65px;
+ float: left;
+ background-color: #e6e6e6;
+ background-size: 100% 100%;
+ background-position: 50% 50%;
+}
+
+.uni-audio-button {
+ width: 24px;
+ height: 24px;
+ margin: 20.5px;
+ background-size: cover;
+}
+
+.uni-audio-button.play {
+ background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAB4dJREFUaAXNWg1MlVUYvpcfIRCJ+MnCaOBl8dOcOCEQZ9kmI5cQG5Yb6MifKbMaGVobOtlibTWHDpgpxBUwF07826iFsMkYJhg559JdGiQSkUzSBA0QkZ7n4/u+nXsvwf3jwru99/y/3/N+3znvec97rlbjABofH38GYtaAV4MjwDqwH9gHTBoE3wd3gA3gi+B6rVY7hHR2CKD9wFngs+BHYGuJYziWMqiscwgP8wLvBQ+AHUWURZle1mqhtXQAhLui7xZwPvgFsBENDg7+Drp069at2z09Pf03b978u6mpqZ+dVq1aFRAVFeW/aNGigNDQ0JfDwsISfXx8wowETBT+QpIPLsf0GpuomvrXIgUAPhhizoGXi+II+tq1az/o9fpLFRUVd8S26fJZWVkLN2/enBgTE/PW/PnzF5v0b0P5HSjxp0m9WXFaBQD+NYw6C1bf+vDwcF9DQ4N+/fr19ciPm0m1osLT01N76tSpNaD3PTw8FgpD+TXSoESrUGeWnVIBgM/EiDKwJ0eiPNrS0nJsw4YNNd3d3aOscxSFhIS4V1dXpyckJGRB5jxZ7jDSbVDiW7lslriY1cgVMvjjKErgR0dH/zl06NCuFStWfOdo8HwkZVL2wYMHP3ny5AlNLonPPi5jkSpMfyb9AhjAadMIlsBjrndmZ2fnnThxos9UwEyUMzIynj9y5EgB1gb3ExK/xBuTTSczBQCeC/ZnsDTnCR6f9YMbN25QiNMoOjras7W1tcjb2ztcfijXRKzpwjaaQgBPU0lrI4HntOGbdzZ4AuYzt2/fvm9sbOweyyBiOidjlCr4Y6QAyrTzkqlEx9GSkpJ9zpo2BGNKfHZRUdF+1D+W24iNGFVSpxAAcxekryK9/cuXLx/FoqpWe85iBlPpvbi4uB0yBE4lHabSvyyLX2AXyhJ42nmYytPsMBcI+80ZWKZeGQsxEqtEkgJ4+3Sm9sh1Gm5SM2EqFfnWpsRSV1dXIYzbI2NWv0AqGiXXl+4Bd1ihs0XZu3fvHhgYGNBXVVUlWDTAyk7p6ekNIyMj7fIwYiVmIwWkNvo2trgHAQEBy+CghW7cuPGLvr6+L3fu3PmSJNBBP8R09erVHwVxEwrgU/AwkqQ00DFT8lamqkEICgqKKy4u1sMU7li6dKnVLvL/Pbe0tLRFaEsidi1+UlB5ng3ctBYsWLBV6GRxFnJ4yjIj7CX36uvrS1NTU+uwEM3ara3Al/gaTl+EPC6Vi/hNRUhHR8dPSt5Rqbu7+3Nr1679rL+//3BBQYHyYJvFd3V1iTNkNRV4RZF2G6TkHZ36+vpG5uXlHcah59Pk5GSbj5AY3y1gi6ACisOk4UlKaJyJrBYnsuTa2trjzc3N7/r7+9N1sYo6OzsfCAN0VEB9GzwGCo0zlnV1dfVOTEzMhn3Xl5eXx1rzIBOMflRAsv8UopxhrRFoT18vL68QHCu/am9vz7FUjglGHyow6xQcHBxjKwgqwKCTRIweKHlnpZhGDfC7LP4CJhgH3QCUxzd/AmboA0kP8zNNcDt+w8ZUvHv37l+tedaSJUueFfrfpwJ0oSVLxLiN0DgjWWxsDxobG79JSUn53haXRafT+QrAOjiFDEoFg05K3tEpduoxg8FweuXKlRlJSUm1toAnpvDwcB55FTJQAdUFYMRMaXFkil34l9zc3K2RkZElV65ceWSPbCz414XxF6kAXWfpdMNwHyNmQge7skNDQ3dOnjy5PzAwMLewsLDLLmEYDJMb5ObmFiXLIeZ6FxzNGOK+IFeyk91f4enTpyNtbW3HIiIiNsHCNCmy7U1zcnKWCTIuEDu/AOn8RKLRMFbJcJ9StjRlBIN94Y40ZmZmboqNja3iScrS8dP1IyaEWt4W+kmYaYVILHA/8GGglbHKdevWqV+FHaYjOGofw811hcfZOV1fW9pxzE1wcXGJlscSq6SA+qZhJfai8nN2wNHtDhb0pt7eXoe9Qcq1lRg3hRvNkLtyytuHfAHlKVOI+UIwQxYaRolramrSmZ8LhLefJIAnRmKVSFUAHbiq8yeqNRpGiWE5XlXKs5WWlZUthu3/SHh+voxVqlKnEEuYRvTPee5czjKjxDCr2bMVnYNF9IO7fRRQAokHxIuPeCig3t4YKcAeUCIYiRrcffjwYUd8fPyHzo6PwuJ4XL9+/QAWrjILOHWmDu5SAWjHa500sBSNZoibUWKGvNnuDOKbNwFPLLytITYjUteAWIuOvNbZptQxxF1ZWXnYGWuCc57TRnjzhMFbGmIyI7MpJPbAdMpEuQzsKdc/hi+jT0tLO+NoE0tTSWsjL9h58vP45qe8YppSAQqBEmaXfAy0MlbJcJ+tXqUMUMMdlpsUIuE78JYVO89mznn7LvmUh8gL+xzKknVS6hmrZLiPETNrr1npmNG3oXsg7LCKaFobx1yzKhKhBE3sFnA+mCFuI4IyBuyWzYjb/MHQh+lFN09SPIxgirxIlxhepeIWiHL41vPBFl90i4MtykOROfVXA4tAT9YJisyJP3tMu4gnA29aB2UY4V4DXg1m/FMH9gMrMSd6jwwe8PxtAPMU6JC/2/wHuyI2cMsNBRIAAAAASUVORK5CYII=);
+}
+
+.uni-audio-button.pause {
+ background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAABatJREFUaAXVWl1IpFUYnllZGUf3wlz6MXER1ES7s83VUDJw6KpdaSTDwMnYFSK6KNirooHullKQCNzQRjZ/wom1u9ALQ0mT1ktFdEBWXLdibaH1jwmx5zme83W+z2Hm+7bZmc8X3jl/73vO837n/z3j9aSBjo6O8lBNC7gZXAUuBxeCz4FJj8APwTHwCngaPOX1evcRZocAuhAcAt8G74KdEnWoyzpobGYIjfnBn4D/BqeLWBfr9Du1wmtXAZXnQPY9cBj8HNhEe3t7sbW1tfn19fW7m5ubD5aXl7dnZmYeUKipqel8dXV1UUlJyfmysrILFRUV9X6/n8PMSveREQYPYHgdWgsTpW0ZAPDPQ3kC/JJeCUEvLi7+NDg4+EskEvldL0sVD4VCz3Z1db1SW1v7egJj7kD/Coy4l6qelAYAfB0quQ02vno8Hr8/OTkZaWtrmzo4ODhK1Uiycp/P5x0fH28JBAKh3Nxcow3osDdaYcRCMv2kBgD8O1D+BuyTlcTn5+cj7e3t0Y2NjX+SVey0rLS09OzY2Fiwvr4+BN1cqX+A8CqM+E6mTwRnTuTIDAn+FpIC/OHh4V+9vb0fNzQ0jKYbPJtknaybbbAtCYNt35JYZJY5SNgDctj8DFEBfnd3d627u/vT4eHhP8zqTybV0dHxTH9//+f5+fkVsgX2xKuJhtMJAwCeE/Y3sBiPBF9XV/fh0tISK8kY1dTU+BYWFvo0IzgnLlontmkIATyXSq42Ajy7kl8+0+D5ldgm29aGEzFNSIwUEWQyADlc59VSGe/r6/ssU8PmGI75l20TA3LjsoTYiNEgYwjBMu6CPKuIr4/Vph+TasyQzGJkbm7ubaxO1yQEDqVyDKU9pvUe+AhpAZ7rPJbKHyjgBuKyTUwSCzESqyBhAL4+D1PXZZ6Hm9STWCpV/U5DYiEmTe+6xOwRQwiJEAq/pQCPB0VFRdf+7w7LutJJ3LG3t7dvaseOdzGMImoIXVaN8WzjNvDERkzEpnAiFJjP4OvzMhJQBTyYqbjdEDov7+/vf4+6pu0wZQcGBi7arV/JWbAFiN2Lnzcg8COFuGkVFBSo2a70UoYEhC5+OqWgJoAv+mdeXt5bWpat6M7Ozk1tc7vMIfSa0lxdXf1VxZ2ETsGz7sfRoV4sFtMxNtOAF1hAugs6jrn3lxcmDV0VDTBuRrxJaYWujFowltMA40LNa6ArUWugLBgLaYByfXjUHVaTd13UgvEcDTjVRAPodBJE74GKuzW0YHxEA+gxE0TXh4q7NbRgfEgDeIQWRL+Nirs1tGCM0YAVBZZOJxV3a2jBuEIDphVYesxU3EnIY4ETeco+jg71LBinacAUWNxueFSlx4yCTmh0dPRLJ4AoOzIy8oWTNihLbNpxmpin1H2AnrcrFJqdnf0KM901tzFiUoQ94M3GxsYPZHoC94FW9gBJnEYZoa8SBy1hGNNuIWIiNg2PwKwbIPYDdhF9lZqgK6LEpA0fYv3PAHQF94IbCikdrcXFxWdVOtsh/abEpOG4ITGbvBI9EBA3f3qJo9FoUFPIapROX81zTYzEKkgNIQ8s4qwOH2d7PPQS9/T0vKjS2QqJQXqsFYSwxCrSpsmK6yVdi7zx0APmoVuvs7Pz/Wx55+jkHRoa+jonJ+cp4gHdAV+CAcbrjckASsCI0+vcpQGw7h6CVrDwRvMCTS8xvwbLM0Fsy+KZJha+1hCbiYw5oOdCkM86V1UejWBXZmJOsA22pXkeCIOvNAmfmk4MIQWaIYZTwiemYDAY3dracsUTU1IDpBGn95FP9Yac2KfzmVUzgkssHxfCYOGGR2gQvXp0jNG3lOyh+wKosrLykmWMq3q4SYXBth+6laLtEL3hqr8a2AZuFYQhrvizR8pJbAWeKA1j6OFuATeDq8D09hWClc+Jp0ceGHn/5hWWt8C0/N3mX15C4bDnCIuAAAAAAElFTkSuQmCC);
+}
+
+.uni-audio-right {
+ box-sizing: border-box;
+ height: 65px;
+ margin-left: 65px;
+ padding: 11px 16.5px 13.5px 15px;
+ overflow: hidden;
+}
+
+.uni-audio-time {
+ margin-top: 3.5px;
+ height: 16.5px;
+ font-size: 12px;
+ color: #888888;
+ float: right;
+}
+
+.uni-audio-info {
+ margin-right: 70px;
+ overflow: hidden;
+}
+
+.uni-audio-name {
+ height: 22.5px;
+ line-height: 22.5px;
+ margin-bottom: 3.5px;
+ font-size: 14px;
+ color: #353535;
+ overflow: hidden;
+ white-space: nowrap;
+ text-overflow: ellipsis;
+}
+
+.uni-audio-author {
+ height: 14.5px;
+ line-height: 14.5px;
+ font-size: 12px;
+ color: #888888;
+ overflow: hidden;
+ white-space: nowrap;
+ text-overflow: ellipsis;
+}
uni-button {
position: relative;
display: block;
@@ -379,3 +467,1344 @@ uni-button[loading][native]:before {
border-color: rgba(230, 67, 64, 0.6);
background-color: transparent;
}
+uni-canvas {
+ width: 300px;
+ height: 150px;
+ display: block;
+ position: relative;
+}
+
+uni-canvas > .uni-canvas-canvas {
+ position: absolute;
+ top: 0;
+ left: 0;
+ width: 100%;
+ height: 100%;
+}
+uni-checkbox {
+ -webkit-tap-highlight-color: transparent;
+ display: inline-block;
+ cursor: pointer;
+}
+
+uni-checkbox[hidden] {
+ display: none;
+}
+
+uni-checkbox[disabled] {
+ cursor: not-allowed;
+}
+
+.uni-checkbox-wrapper {
+ display: inline-flex;
+ align-items: center;
+ vertical-align: middle;
+}
+
+.uni-checkbox-input {
+ margin-right: 5px;
+ -webkit-appearance: none;
+ appearance: none;
+ outline: 0;
+ border: 1px solid #d1d1d1;
+ background-color: #ffffff;
+ border-radius: 3px;
+ width: 22px;
+ height: 22px;
+ position: relative;
+}
+
+.uni-checkbox-input svg {
+ color: #007aff;
+ font-size: 22px;
+ position: absolute;
+ top: 50%;
+ left: 50%;
+ transform: translate(-50%, -48%) scale(0.73);
+}
+
+uni-checkbox:not([disabled]) .uni-checkbox-input:hover {
+ border-color: #007aff;
+}
+
+.uni-checkbox-input.uni-checkbox-input-disabled {
+ background-color: #e1e1e1;
+}
+
+.uni-checkbox-input.uni-checkbox-input-disabled:before {
+ color: #adadad;
+}
+
+uni-checkbox-group {
+ display: block;
+}
+uni-checkbox-group {
+ display: block;
+}
+
+uni-checkbox-group[hidden] {
+ display: none;
+}
+.ql-container {
+ display: block;
+ position: relative;
+ box-sizing: border-box;
+ -webkit-user-select: text;
+ user-select: text;
+ outline: none;
+ overflow: hidden;
+ width: 100%;
+ height: 200px;
+ min-height: 200px;
+}
+.ql-container[hidden] {
+ display: none;
+}
+.ql-container .ql-editor {
+ position: relative;
+ font-size: inherit;
+ line-height: inherit;
+ font-family: inherit;
+ min-height: inherit;
+ width: 100%;
+ height: 100%;
+ padding: 0;
+ overflow-x: hidden;
+ overflow-y: auto;
+ -webkit-tap-highlight-color: transparent;
+ -webkit-touch-callout: none;
+ -webkit-overflow-scrolling: touch;
+}
+.ql-container .ql-editor::-webkit-scrollbar {
+ width: 0 !important;
+}
+.ql-container .ql-editor.scroll-disabled {
+ overflow: hidden;
+}
+.ql-container .ql-image-overlay {
+ display: flex;
+ position: absolute;
+ box-sizing: border-box;
+ border: 1px dashed #ccc;
+ justify-content: center;
+ align-items: center;
+ -webkit-user-select: none;
+ user-select: none;
+}
+.ql-container .ql-image-overlay .ql-image-size {
+ position: absolute;
+ padding: 4px 8px;
+ text-align: center;
+ background-color: #fff;
+ color: #888;
+ border: 1px solid #ccc;
+ box-sizing: border-box;
+ opacity: 0.8;
+ right: 4px;
+ top: 4px;
+ font-size: 12px;
+ display: inline-block;
+ width: auto;
+}
+.ql-container .ql-image-overlay .ql-image-toolbar {
+ position: relative;
+ text-align: center;
+ box-sizing: border-box;
+ background: #000;
+ border-radius: 5px;
+ color: #fff;
+ font-size: 0;
+ min-height: 24px;
+ z-index: 100;
+}
+.ql-container .ql-image-overlay .ql-image-toolbar span {
+ display: inline-block;
+ cursor: pointer;
+ padding: 5px;
+ font-size: 12px;
+ border-right: 1px solid #fff;
+}
+.ql-container .ql-image-overlay .ql-image-toolbar span:last-child {
+ border-right: 0;
+}
+.ql-container .ql-image-overlay .ql-image-toolbar span.triangle-up {
+ padding: 0;
+ position: absolute;
+ top: -12px;
+ left: 50%;
+ transform: translatex(-50%);
+ width: 0;
+ height: 0;
+ border-width: 6px;
+ border-style: solid;
+ border-color: transparent transparent black transparent;
+}
+.ql-container .ql-image-overlay .ql-image-handle {
+ position: absolute;
+ height: 12px;
+ width: 12px;
+ border-radius: 50%;
+ border: 1px solid #ccc;
+ box-sizing: border-box;
+ background: #fff;
+}
+.ql-container img {
+ display: inline-block;
+ max-width: 100%;
+}
+.ql-clipboard p {
+ margin: 0;
+ padding: 0;
+}
+.ql-editor {
+ box-sizing: border-box;
+ height: 100%;
+ outline: none;
+ overflow-y: auto;
+ tab-size: 4;
+ -moz-tab-size: 4;
+ text-align: left;
+ white-space: pre-wrap;
+ word-wrap: break-word;
+}
+.ql-editor > * {
+ cursor: text;
+}
+.ql-editor p,
+.ql-editor ol,
+.ql-editor ul,
+.ql-editor pre,
+.ql-editor blockquote,
+.ql-editor h1,
+.ql-editor h2,
+.ql-editor h3,
+.ql-editor h4,
+.ql-editor h5,
+.ql-editor h6 {
+ margin: 0;
+ padding: 0;
+ counter-reset: list-1 list-2 list-3 list-4 list-5 list-6 list-7 list-8 list-9;
+}
+.ql-editor ol > li,
+.ql-editor ul > li {
+ list-style-type: none;
+}
+.ql-editor ul > li::before {
+ content: '\2022';
+}
+.ql-editor ul[data-checked=true],
+.ql-editor ul[data-checked=false] {
+ pointer-events: none;
+}
+.ql-editor ul[data-checked=true] > li *,
+.ql-editor ul[data-checked=false] > li * {
+ pointer-events: all;
+}
+.ql-editor ul[data-checked=true] > li::before,
+.ql-editor ul[data-checked=false] > li::before {
+ color: #777;
+ cursor: pointer;
+ pointer-events: all;
+}
+.ql-editor ul[data-checked=true] > li::before {
+ content: '\2611';
+}
+.ql-editor ul[data-checked=false] > li::before {
+ content: '\2610';
+}
+.ql-editor li::before {
+ display: inline-block;
+ white-space: nowrap;
+ width: 2em;
+}
+.ql-editor ol li {
+ counter-reset: list-1 list-2 list-3 list-4 list-5 list-6 list-7 list-8 list-9;
+ counter-increment: list-0;
+}
+.ql-editor ol li:before {
+ content: counter(list-0, decimal) '. ';
+}
+.ql-editor ol li.ql-indent-1 {
+ counter-increment: list-1;
+}
+.ql-editor ol li.ql-indent-1:before {
+ content: counter(list-1, lower-alpha) '. ';
+}
+.ql-editor ol li.ql-indent-1 {
+ counter-reset: list-2 list-3 list-4 list-5 list-6 list-7 list-8 list-9;
+}
+.ql-editor ol li.ql-indent-2 {
+ counter-increment: list-2;
+}
+.ql-editor ol li.ql-indent-2:before {
+ content: counter(list-2, lower-roman) '. ';
+}
+.ql-editor ol li.ql-indent-2 {
+ counter-reset: list-3 list-4 list-5 list-6 list-7 list-8 list-9;
+}
+.ql-editor ol li.ql-indent-3 {
+ counter-increment: list-3;
+}
+.ql-editor ol li.ql-indent-3:before {
+ content: counter(list-3, decimal) '. ';
+}
+.ql-editor ol li.ql-indent-3 {
+ counter-reset: list-4 list-5 list-6 list-7 list-8 list-9;
+}
+.ql-editor ol li.ql-indent-4 {
+ counter-increment: list-4;
+}
+.ql-editor ol li.ql-indent-4:before {
+ content: counter(list-4, lower-alpha) '. ';
+}
+.ql-editor ol li.ql-indent-4 {
+ counter-reset: list-5 list-6 list-7 list-8 list-9;
+}
+.ql-editor ol li.ql-indent-5 {
+ counter-increment: list-5;
+}
+.ql-editor ol li.ql-indent-5:before {
+ content: counter(list-5, lower-roman) '. ';
+}
+.ql-editor ol li.ql-indent-5 {
+ counter-reset: list-6 list-7 list-8 list-9;
+}
+.ql-editor ol li.ql-indent-6 {
+ counter-increment: list-6;
+}
+.ql-editor ol li.ql-indent-6:before {
+ content: counter(list-6, decimal) '. ';
+}
+.ql-editor ol li.ql-indent-6 {
+ counter-reset: list-7 list-8 list-9;
+}
+.ql-editor ol li.ql-indent-7 {
+ counter-increment: list-7;
+}
+.ql-editor ol li.ql-indent-7:before {
+ content: counter(list-7, lower-alpha) '. ';
+}
+.ql-editor ol li.ql-indent-7 {
+ counter-reset: list-8 list-9;
+}
+.ql-editor ol li.ql-indent-8 {
+ counter-increment: list-8;
+}
+.ql-editor ol li.ql-indent-8:before {
+ content: counter(list-8, lower-roman) '. ';
+}
+.ql-editor ol li.ql-indent-8 {
+ counter-reset: list-9;
+}
+.ql-editor ol li.ql-indent-9 {
+ counter-increment: list-9;
+}
+.ql-editor ol li.ql-indent-9:before {
+ content: counter(list-9, decimal) '. ';
+}
+.ql-editor .ql-indent-1:not(.ql-direction-rtl) {
+ padding-left: 2em;
+}
+.ql-editor li.ql-indent-1:not(.ql-direction-rtl) {
+ padding-left: 2em;
+}
+.ql-editor .ql-indent-1.ql-direction-rtl.ql-align-right {
+ padding-right: 2em;
+}
+.ql-editor li.ql-indent-1.ql-direction-rtl.ql-align-right {
+ padding-right: 2em;
+}
+.ql-editor .ql-indent-2:not(.ql-direction-rtl) {
+ padding-left: 4em;
+}
+.ql-editor li.ql-indent-2:not(.ql-direction-rtl) {
+ padding-left: 4em;
+}
+.ql-editor .ql-indent-2.ql-direction-rtl.ql-align-right {
+ padding-right: 4em;
+}
+.ql-editor li.ql-indent-2.ql-direction-rtl.ql-align-right {
+ padding-right: 4em;
+}
+.ql-editor .ql-indent-3:not(.ql-direction-rtl) {
+ padding-left: 6em;
+}
+.ql-editor li.ql-indent-3:not(.ql-direction-rtl) {
+ padding-left: 6em;
+}
+.ql-editor .ql-indent-3.ql-direction-rtl.ql-align-right {
+ padding-right: 6em;
+}
+.ql-editor li.ql-indent-3.ql-direction-rtl.ql-align-right {
+ padding-right: 6em;
+}
+.ql-editor .ql-indent-4:not(.ql-direction-rtl) {
+ padding-left: 8em;
+}
+.ql-editor li.ql-indent-4:not(.ql-direction-rtl) {
+ padding-left: 8em;
+}
+.ql-editor .ql-indent-4.ql-direction-rtl.ql-align-right {
+ padding-right: 8em;
+}
+.ql-editor li.ql-indent-4.ql-direction-rtl.ql-align-right {
+ padding-right: 8em;
+}
+.ql-editor .ql-indent-5:not(.ql-direction-rtl) {
+ padding-left: 10em;
+}
+.ql-editor li.ql-indent-5:not(.ql-direction-rtl) {
+ padding-left: 10em;
+}
+.ql-editor .ql-indent-5.ql-direction-rtl.ql-align-right {
+ padding-right: 10em;
+}
+.ql-editor li.ql-indent-5.ql-direction-rtl.ql-align-right {
+ padding-right: 10em;
+}
+.ql-editor .ql-indent-6:not(.ql-direction-rtl) {
+ padding-left: 12em;
+}
+.ql-editor li.ql-indent-6:not(.ql-direction-rtl) {
+ padding-left: 12em;
+}
+.ql-editor .ql-indent-6.ql-direction-rtl.ql-align-right {
+ padding-right: 12em;
+}
+.ql-editor li.ql-indent-6.ql-direction-rtl.ql-align-right {
+ padding-right: 12em;
+}
+.ql-editor .ql-indent-7:not(.ql-direction-rtl) {
+ padding-left: 14em;
+}
+.ql-editor li.ql-indent-7:not(.ql-direction-rtl) {
+ padding-left: 14em;
+}
+.ql-editor .ql-indent-7.ql-direction-rtl.ql-align-right {
+ padding-right: 14em;
+}
+.ql-editor li.ql-indent-7.ql-direction-rtl.ql-align-right {
+ padding-right: 14em;
+}
+.ql-editor .ql-indent-8:not(.ql-direction-rtl) {
+ padding-left: 16em;
+}
+.ql-editor li.ql-indent-8:not(.ql-direction-rtl) {
+ padding-left: 16em;
+}
+.ql-editor .ql-indent-8.ql-direction-rtl.ql-align-right {
+ padding-right: 16em;
+}
+.ql-editor li.ql-indent-8.ql-direction-rtl.ql-align-right {
+ padding-right: 16em;
+}
+.ql-editor .ql-indent-9:not(.ql-direction-rtl) {
+ padding-left: 18em;
+}
+.ql-editor li.ql-indent-9:not(.ql-direction-rtl) {
+ padding-left: 18em;
+}
+.ql-editor .ql-indent-9.ql-direction-rtl.ql-align-right {
+ padding-right: 18em;
+}
+.ql-editor li.ql-indent-9.ql-direction-rtl.ql-align-right {
+ padding-right: 18em;
+}
+.ql-editor .ql-direction-rtl {
+ direction: rtl;
+ text-align: inherit;
+}
+.ql-editor .ql-align-center {
+ text-align: center;
+}
+.ql-editor .ql-align-justify {
+ text-align: justify;
+}
+.ql-editor .ql-align-right {
+ text-align: right;
+}
+.ql-editor.ql-blank::before {
+ color: rgba(0, 0, 0, 0.6);
+ content: attr(data-placeholder);
+ font-style: italic;
+ pointer-events: none;
+ position: absolute;
+}
+.ql-container.ql-disabled .ql-editor ul[data-checked] > li::before {
+ pointer-events: none;
+}
+.ql-clipboard {
+ left: -100000px;
+ height: 1px;
+ overflow-y: hidden;
+ position: absolute;
+ top: 50%;
+}
+uni-icon {
+ display: inline-block;
+ font-size: 0;
+ box-sizing: border-box;
+}
+
+uni-icon[hidden] {
+ display: none;
+}
+uni-image {
+ width: 320px;
+ height: 240px;
+ display: inline-block;
+ overflow: hidden;
+ position: relative;
+}
+
+uni-image[hidden] {
+ display: none;
+}
+
+uni-image > div {
+ width: 100%;
+ height: 100%;
+}
+
+uni-image > img {
+ -webkit-touch-callout: none;
+ -webkit-user-select: none;
+ user-select: none;
+ display: block;
+ position: absolute;
+ top: 0;
+ left: 0;
+ width: 100%;
+ height: 100%;
+ opacity: 0;
+}
+
+uni-image > .uni-image-will-change {
+ will-change: transform;
+}
+uni-input {
+ display: block;
+ font-size: 16px;
+ line-height: 1.4em;
+ height: 1.4em;
+ min-height: 1.4em;
+ overflow: hidden;
+}
+
+uni-input[hidden] {
+ display: none;
+}
+
+.uni-input-wrapper,
+.uni-input-placeholder,
+.uni-input-form,
+.uni-input-input {
+ outline: none;
+ border: none;
+ padding: 0;
+ margin: 0;
+ text-decoration: inherit;
+}
+
+.uni-input-wrapper,
+.uni-input-form {
+ display: flex;
+ position: relative;
+ width: 100%;
+ height: 100%;
+ flex-direction: column;
+ justify-content: center;
+}
+
+.uni-input-placeholder,
+.uni-input-input {
+ width: 100%;
+}
+
+.uni-input-placeholder {
+ position: absolute;
+ top: auto !important;
+ left: 0;
+ color: gray;
+ overflow: hidden;
+ text-overflow: clip;
+ white-space: pre;
+ word-break: keep-all;
+ pointer-events: none;
+ line-height: inherit;
+}
+
+.uni-input-input {
+ position: relative;
+ display: block;
+ height: 100%;
+ background: none;
+ color: inherit;
+ opacity: 1;
+ font: inherit;
+ line-height: inherit;
+ letter-spacing: inherit;
+ text-align: inherit;
+ text-indent: inherit;
+ text-transform: inherit;
+ text-shadow: inherit;
+}
+
+.uni-input-input[type='search']::-webkit-search-cancel-button {
+ display: none;
+}
+
+.uni-input-input::-webkit-outer-spin-button,
+.uni-input-input::-webkit-inner-spin-button {
+ -webkit-appearance: none;
+ appearance: none;
+ margin: 0;
+}
+
+.uni-input-input[type='number'] {
+ -moz-appearance: textfield;
+}
+
+.uni-input-input:disabled {
+ /* 用于重置iOS14以下禁用状态文字颜色 */
+ -webkit-text-fill-color: currentcolor;
+}
+.uni-label-pointer {
+ cursor: pointer;
+}
+uni-movable-area {
+ display: block;
+ position: relative;
+ width: 10px;
+ height: 10px;
+}
+
+uni-movable-area[hidden] {
+ display: none;
+}
+uni-movable-view {
+ display: inline-block;
+ width: 10px;
+ height: 10px;
+ top: 0px;
+ left: 0px;
+ position: absolute;
+ cursor: grab;
+}
+
+uni-movable-view[hidden] {
+ display: none;
+}
+uni-navigator {
+ height: auto;
+ width: auto;
+ display: block;
+ cursor: pointer;
+}
+
+uni-navigator[hidden] {
+ display: none;
+}
+
+.navigator-hover {
+ background-color: rgba(0, 0, 0, 0.1);
+ opacity: 0.7;
+}
+uni-picker-view {
+ display: block;
+}
+
+.uni-picker-view-wrapper {
+ display: flex;
+ position: relative;
+ overflow: hidden;
+ height: 100%;
+}
+
+uni-picker-view[hidden] {
+ display: none;
+}
+uni-picker-view-column {
+ flex: 1;
+ position: relative;
+ height: 100%;
+ overflow: hidden;
+}
+
+uni-picker-view-column[hidden] {
+ display: none;
+}
+
+.uni-picker-view-group {
+ height: 100%;
+ overflow: hidden;
+}
+
+.uni-picker-view-mask {
+ transform: translateZ(0);
+}
+
+.uni-picker-view-indicator,
+.uni-picker-view-mask {
+ position: absolute;
+ left: 0;
+ width: 100%;
+ z-index: 3;
+ pointer-events: none;
+}
+
+.uni-picker-view-mask {
+ top: 0;
+ height: 100%;
+ margin: 0 auto;
+ background: linear-gradient(
+ 180deg,
+ hsla(0, 0%, 100%, 0.95),
+ hsla(0, 0%, 100%, 0.6)
+ ),
+ linear-gradient(0deg, hsla(0, 0%, 100%, 0.95), hsla(0, 0%, 100%, 0.6));
+ background-position: top, bottom;
+ background-size: 100% 102px;
+ background-repeat: no-repeat;
+}
+
+.uni-picker-view-indicator {
+ height: 34px;
+ /* top: 102px; */
+ top: 50%;
+ transform: translateY(-50%);
+}
+
+.uni-picker-view-content {
+ position: absolute;
+ top: 0;
+ left: 0;
+ width: 100%;
+ will-change: transform;
+ padding: 102px 0;
+ cursor: pointer;
+}
+
+.uni-picker-view-content > * {
+ height: 34px;
+ overflow: hidden;
+}
+
+.uni-picker-view-indicator:after,
+.uni-picker-view-indicator:before {
+ content: ' ';
+ position: absolute;
+ left: 0;
+ right: 0;
+ height: 1px;
+ color: #e5e5e5;
+}
+
+.uni-picker-view-indicator:before {
+ top: 0;
+ border-top: 1px solid #e5e5e5;
+ transform-origin: 0 0;
+ transform: scaleY(0.5);
+}
+
+.uni-picker-view-indicator:after {
+ bottom: 0;
+ border-bottom: 1px solid #e5e5e5;
+ transform-origin: 0 100%;
+ transform: scaleY(0.5);
+}
+
+.uni-picker-view-indicator:after,
+.uni-picker-view-indicator:before {
+ content: ' ';
+ position: absolute;
+ left: 0;
+ right: 0;
+ height: 1px;
+ color: #e5e5e5;
+}
+uni-progress {
+ display: flex;
+ align-items: center;
+}
+
+uni-progress[hidden] {
+ display: none;
+}
+
+.uni-progress-bar {
+ flex: 1;
+}
+
+.uni-progress-inner-bar {
+ width: 0;
+ height: 100%;
+}
+
+.uni-progress-info {
+ margin-top: 0;
+ margin-bottom: 0;
+ min-width: 2em;
+ margin-left: 15px;
+ font-size: 16px;
+}
+uni-radio {
+ -webkit-tap-highlight-color: transparent;
+ display: inline-block;
+ cursor: pointer;
+}
+
+uni-radio[hidden] {
+ display: none;
+}
+
+uni-radio[disabled] {
+ cursor: not-allowed;
+}
+
+.uni-radio-wrapper {
+ display: inline-flex;
+ align-items: center;
+ vertical-align: middle;
+}
+
+.uni-radio-input {
+ -webkit-appearance: none;
+ appearance: none;
+ margin-right: 5px;
+ outline: 0;
+ border: 1px solid #d1d1d1;
+ background-color: #ffffff;
+ border-radius: 50%;
+ width: 22px;
+ height: 22px;
+ position: relative;
+}
+
+uni-radio:not([disabled]) .uni-radio-input:hover {
+ border-color: #007aff;
+}
+
+.uni-radio-input svg {
+ color: #ffffff;
+ font-size: 18px;
+ position: absolute;
+ top: 50%;
+ left: 50%;
+ transform: translate(-50%, -48%) scale(0.73);
+}
+
+.uni-radio-input.uni-radio-input-disabled {
+ background-color: #e1e1e1;
+ border-color: #d1d1d1;
+}
+
+.uni-radio-input.uni-radio-input-disabled:before {
+ color: #adadad;
+}
+uni-radio-group {
+ display: block;
+}
+uni-radio-group[hidden] {
+ display: none;
+}
+uni-scroll-view {
+ display: block;
+ width: 100%;
+}
+
+uni-scroll-view[hidden] {
+ display: none;
+}
+
+.uni-scroll-view {
+ position: relative;
+ -webkit-overflow-scrolling: touch;
+ width: 100%;
+ /* display: flex; 时在安卓下会导致scrollWidth和offsetWidth一样 */
+ height: 100%;
+ max-height: inherit;
+}
+
+.uni-scroll-view-content {
+ width: 100%;
+ height: 100%;
+}
+
+.uni-scroll-view-refresher {
+ position: relative;
+ overflow: hidden;
+}
+
+.uni-scroll-view-refresh {
+ position: absolute;
+ top: 0;
+ left: 0;
+ right: 0;
+ bottom: 0;
+ display: flex;
+ flex-direction: row;
+ justify-content: center;
+ align-items: center;
+}
+
+.uni-scroll-view-refresh-inner {
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ line-height: 0;
+ width: 40px;
+ height: 40px;
+ border-radius: 50%;
+ background-color: #fff;
+ box-shadow: 0 1px 6px rgba(0, 0, 0, 0.117647),
+ 0 1px 4px rgba(0, 0, 0, 0.117647);
+}
+
+.uni-scroll-view-refresh__spinner {
+ transform-origin: center center;
+ animation: uni-scroll-view-refresh-rotate 2s linear infinite;
+}
+
+.uni-scroll-view-refresh__spinner > circle {
+ stroke: currentColor;
+ stroke-linecap: round;
+ animation: uni-scroll-view-refresh-dash 2s linear infinite;
+}
+
+@keyframes uni-scroll-view-refresh-rotate {
+ 0% {
+ transform: rotate(0deg);
+ }
+
+ 100% {
+ transform: rotate(360deg);
+ }
+}
+
+@keyframes uni-scroll-view-refresh-dash {
+ 0% {
+ stroke-dasharray: 1, 200;
+ stroke-dashoffset: 0;
+ }
+
+ 50% {
+ stroke-dasharray: 89, 200;
+ stroke-dashoffset: -35px;
+ }
+
+ 100% {
+ stroke-dasharray: 89, 200;
+ stroke-dashoffset: -124px;
+ }
+}
+uni-slider {
+ margin: 10px 18px;
+ padding: 0;
+ display: block;
+}
+
+uni-slider[hidden] {
+ display: none;
+}
+
+uni-slider .uni-slider-wrapper {
+ display: flex;
+ align-items: center;
+ min-height: 16px;
+}
+
+uni-slider .uni-slider-tap-area {
+ flex: 1;
+ padding: 8px 0;
+}
+
+uni-slider .uni-slider-handle-wrapper {
+ position: relative;
+ height: 2px;
+ border-radius: 5px;
+ background-color: #e9e9e9;
+ cursor: pointer;
+ transition: background-color 0.3s ease;
+ -webkit-tap-highlight-color: transparent;
+}
+
+uni-slider .uni-slider-track {
+ height: 100%;
+ border-radius: 6px;
+ background-color: #007aff;
+ transition: background-color 0.3s ease;
+}
+
+uni-slider .uni-slider-handle,
+uni-slider .uni-slider-thumb {
+ position: absolute;
+ left: 50%;
+ top: 50%;
+ cursor: pointer;
+ border-radius: 50%;
+ transition: border-color 0.3s ease;
+}
+
+uni-slider .uni-slider-handle {
+ width: 28px;
+ height: 28px;
+ margin-top: -14px;
+ margin-left: -14px;
+ background-color: transparent;
+ z-index: 3;
+ cursor: grab;
+}
+
+uni-slider .uni-slider-thumb {
+ z-index: 2;
+ box-shadow: 0 0 4px rgba(0, 0, 0, 0.2);
+}
+
+uni-slider .uni-slider-step {
+ position: absolute;
+ width: 100%;
+ height: 2px;
+ background: transparent;
+ z-index: 1;
+}
+
+uni-slider .uni-slider-value {
+ width: 3ch;
+ color: #888;
+ font-size: 14px;
+ margin-left: 1em;
+}
+
+uni-slider .uni-slider-disabled .uni-slider-track {
+ background-color: #ccc;
+}
+
+uni-slider .uni-slider-disabled .uni-slider-thumb {
+ background-color: #fff;
+ border-color: #ccc;
+}
+uni-swiper {
+ display: block;
+ height: 150px;
+}
+
+uni-swiper[hidden] {
+ display: none;
+}
+
+.uni-swiper-wrapper {
+ overflow: hidden;
+ position: relative;
+ width: 100%;
+ height: 100%;
+ transform: translateZ(0);
+}
+
+.uni-swiper-slides {
+ position: absolute;
+ left: 0;
+ top: 0;
+ right: 0;
+ bottom: 0;
+}
+
+.uni-swiper-slide-frame {
+ position: absolute;
+ left: 0;
+ top: 0;
+ width: 100%;
+ height: 100%;
+ will-change: transform;
+}
+
+.uni-swiper-dots {
+ position: absolute;
+ font-size: 0;
+}
+
+.uni-swiper-dots-horizontal {
+ left: 50%;
+ bottom: 10px;
+ text-align: center;
+ white-space: nowrap;
+ transform: translate(-50%, 0);
+}
+
+.uni-swiper-dots-horizontal .uni-swiper-dot {
+ margin-right: 8px;
+}
+
+.uni-swiper-dots-horizontal .uni-swiper-dot:last-child {
+ margin-right: 0;
+}
+
+.uni-swiper-dots-vertical {
+ right: 10px;
+ top: 50%;
+ text-align: right;
+ transform: translate(0, -50%);
+}
+
+.uni-swiper-dots-vertical .uni-swiper-dot {
+ display: block;
+ margin-bottom: 9px;
+}
+
+.uni-swiper-dots-vertical .uni-swiper-dot:last-child {
+ margin-bottom: 0;
+}
+
+.uni-swiper-dot {
+ display: inline-block;
+ width: 8px;
+ height: 8px;
+ cursor: pointer;
+ transition-property: background-color;
+ transition-timing-function: ease;
+ background: rgba(0, 0, 0, 0.3);
+ border-radius: 50%;
+}
+
+.uni-swiper-dot-active {
+ background-color: #000000;
+}
+uni-swiper-item {
+ display: block;
+ overflow: hidden;
+ will-change: transform;
+ position: absolute;
+ width: 100%;
+ height: 100%;
+ cursor: grab;
+}
+
+uni-swiper-item[hidden] {
+ display: none;
+}
+uni-switch {
+ -webkit-tap-highlight-color: transparent;
+ display: inline-block;
+ cursor: pointer;
+}
+
+uni-switch[hidden] {
+ display: none;
+}
+
+uni-switch[disabled] {
+ cursor: not-allowed;
+}
+
+.uni-switch-wrapper {
+ display: inline-flex;
+ align-items: center;
+ vertical-align: middle;
+}
+
+.uni-switch-input {
+ -webkit-appearance: none;
+ appearance: none;
+ position: relative;
+ width: 52px;
+ height: 32px;
+ margin-right: 5px;
+ border: 1px solid #dfdfdf;
+ outline: 0;
+ border-radius: 16px;
+ box-sizing: border-box;
+ background-color: #dfdfdf;
+ transition: background-color 0.1s, border 0.1s;
+}
+
+uni-switch[disabled] .uni-switch-input {
+ opacity: 0.7;
+}
+
+.uni-switch-input:before {
+ content: ' ';
+ position: absolute;
+ top: 0;
+ left: 0;
+ width: 50px;
+ height: 30px;
+ border-radius: 15px;
+ background-color: #fdfdfd;
+ transition: transform 0.3s;
+}
+
+.uni-switch-input:after {
+ content: ' ';
+ position: absolute;
+ top: 0;
+ left: 0;
+ width: 30px;
+ height: 30px;
+ border-radius: 15px;
+ background-color: #ffffff;
+ box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
+ transition: transform 0.3s;
+}
+
+.uni-switch-input.uni-switch-input-checked {
+ border-color: #007aff;
+ background-color: #007aff;
+}
+
+.uni-switch-input.uni-switch-input-checked:before {
+ transform: scale(0);
+}
+
+.uni-switch-input.uni-switch-input-checked:after {
+ transform: translateX(20px);
+}
+
+uni-switch .uni-checkbox-input {
+ margin-right: 5px;
+ -webkit-appearance: none;
+ appearance: none;
+ outline: 0;
+ border: 1px solid #d1d1d1;
+ background-color: #ffffff;
+ border-radius: 3px;
+ width: 22px;
+ height: 22px;
+ position: relative;
+ color: #007aff;
+}
+
+uni-switch:not([disabled]) .uni-checkbox-input:hover {
+ border-color: #007aff;
+}
+
+uni-switch .uni-checkbox-input svg {
+ color: inherit;
+ font-size: 22px;
+ position: absolute;
+ top: 50%;
+ left: 50%;
+ transform: translate(-50%, -48%) scale(0.73);
+}
+
+.uni-checkbox-input.uni-checkbox-input-disabled {
+ background-color: #e1e1e1;
+}
+
+.uni-checkbox-input.uni-checkbox-input-disabled:before {
+ color: #adadad;
+}
+uni-text[selectable] {
+ cursor: auto;
+ -webkit-user-select: text;
+ user-select: text;
+}
+uni-textarea {
+ width: 300px;
+ height: 150px;
+ display: block;
+ position: relative;
+ font-size: 16px;
+ line-height: normal;
+ white-space: pre-wrap;
+ word-break: break-all;
+ box-sizing: content-box !important;
+}
+uni-textarea[hidden] {
+ display: none;
+}
+.uni-textarea-wrapper,
+.uni-textarea-placeholder,
+.uni-textarea-line,
+.uni-textarea-compute,
+.uni-textarea-textarea {
+ outline: none;
+ border: none;
+ padding: 0;
+ margin: 0;
+ text-decoration: inherit;
+}
+.uni-textarea-wrapper {
+ display: block;
+ position: relative;
+ width: 100%;
+ height: 100%;
+ min-height: inherit;
+}
+.uni-textarea-placeholder,
+.uni-textarea-line,
+.uni-textarea-compute,
+.uni-textarea-textarea {
+ position: absolute;
+ width: 100%;
+ height: 100%;
+ left: 0;
+ top: 0;
+ white-space: inherit;
+ word-break: inherit;
+}
+.uni-textarea-placeholder {
+ color: grey;
+ overflow: hidden;
+}
+.uni-textarea-line,
+.uni-textarea-compute {
+ visibility: hidden;
+ height: auto;
+}
+.uni-textarea-line {
+ width: 1em;
+}
+.uni-textarea-textarea {
+ resize: none;
+ background: none;
+ color: inherit;
+ opacity: 1;
+ font: inherit;
+ line-height: inherit;
+ letter-spacing: inherit;
+ text-align: inherit;
+ text-indent: inherit;
+ text-transform: inherit;
+ text-shadow: inherit;
+}
+/* 用于解决 iOS textarea 内部默认边距 */
+.uni-textarea-textarea-fix-margin {
+ width: auto;
+ right: 0;
+ margin: 0 -3px;
+}
+.uni-textarea-textarea:disabled {
+ /* 用于重置iOS14以下禁用状态文字颜色 */
+ -webkit-text-fill-color: currentcolor;
+}
+uni-video {
+ width: 300px;
+ height: 225px;
+ display: inline-block;
+ line-height: 0;
+ overflow: hidden;
+ position: relative;
+}
+
+uni-video[hidden] {
+ display: none;
+}
+
+.uni-video-container {
+ width: 100%;
+ height: 100%;
+ position: absolute;
+ top: 0;
+ left: 0;
+ overflow: hidden;
+ background-color: black;
+}
+
+.uni-video-slot {
+ position: absolute;
+ top: 0;
+ width: 100%;
+ height: 100%;
+ overflow: hidden;
+ pointer-events: none;
+}
diff --git a/packages/uni-app-plus/dist/uni-app-service.es.js b/packages/uni-app-plus/dist/uni-app-service.es.js
index 95608aa1cc7ef17aa08b5206f7baec49ae778154..13aee6b4ebf0a9478a378792411750cf8101cd47 100644
--- a/packages/uni-app-plus/dist/uni-app-service.es.js
+++ b/packages/uni-app-plus/dist/uni-app-service.es.js
@@ -594,6 +594,23 @@ var serviceContext = (function (vue) {
return encode$3(arrayBuffer);
}, ArrayBufferToBase64Protocol);
+ /**
+ * 简易版systemInfo,主要为upx2px,i18n服务
+ * @returns
+ */
+ function getBaseSystemInfo() {
+ // @ts-expect-error view 层
+ if (typeof __SYSTEM_INFO__ !== 'undefined') {
+ return window.__SYSTEM_INFO__;
+ }
+ const { resolutionWidth } = plus.screen.getCurrentSize();
+ return {
+ platform: (plus.os.name || '').toLowerCase(),
+ pixelRatio: plus.screen.scale,
+ windowWidth: Math.round(resolutionWidth),
+ };
+ }
+
function formatLog(module, ...args) {
return `[${Date.now()}][${module}]:${args
.map((arg) => JSON.stringify(arg))
@@ -1556,6 +1573,7 @@ var serviceContext = (function (vue) {
}
function hasRpx(str) {
+ str = str + '';
return str.indexOf('rpx') !== -1 || str.indexOf('upx') !== -1;
}
function rpx2px(str, replace = false) {
@@ -2454,6 +2472,35 @@ var serviceContext = (function (vue) {
timeout: Number,
};
+ const API_UPLOAD_FILE = 'uploadFile';
+ const UploadFileOptions = {
+ formatArgs: {
+ filePath(filePath, params) {
+ if (filePath) {
+ params.filePath = getRealPath(filePath);
+ }
+ },
+ header(value, params) {
+ params.header = value || {};
+ },
+ formData(value, params) {
+ params.formData = value || {};
+ },
+ },
+ };
+ const UploadFileProtocol = {
+ url: {
+ type: String,
+ required: true,
+ },
+ files: Array,
+ filePath: String,
+ name: String,
+ header: Object,
+ formData: Object,
+ timeout: Number,
+ };
+
const API_CONNECT_SOCKET = 'connectSocket';
const ConnectSocketOptions = {
formatArgs: {
@@ -4517,32 +4564,13 @@ var serviceContext = (function (vue) {
});
});
this._socket.onerror(() => {
- this.onErrorOrClose();
this.socketStateChange('error');
+ this.onErrorOrClose();
});
this._socket.onclose(() => {
- this.onErrorOrClose();
this.socketStateChange('close');
+ this.onErrorOrClose();
});
- const oldSocketSend = this._socket.send;
- const oldSocketClose = this._socket.close;
- this._socket.send = (res) => {
- oldSocketSend(extend({
- id: this.id,
- data: typeof res.data === 'object'
- ? {
- '@type': 'binary',
- base64: arrayBufferToBase64(res.data),
- }
- : res.data,
- }));
- };
- this._socket.close = (res) => {
- oldSocketClose(extend({
- id: this.id,
- res,
- }));
- };
}
onErrorOrClose() {
this.readyState = this.CLOSED;
@@ -4568,7 +4596,13 @@ var serviceContext = (function (vue) {
}
try {
this._socket.send({
- data: args.data,
+ id: this.id,
+ data: typeof args.data === 'object'
+ ? {
+ '@type': 'binary',
+ base64: arrayBufferToBase64(args.data),
+ }
+ : args.data,
});
callOptions(args, 'sendSocketMessage:ok');
}
@@ -4579,7 +4613,10 @@ var serviceContext = (function (vue) {
close(args) {
this.readyState = this.CLOSING;
try {
- this._socket.close(args);
+ this._socket.close(extend({
+ id: this.id,
+ args,
+ }));
callOptions(args, 'closeSocket:ok');
}
catch (error) {
@@ -4626,9 +4663,7 @@ var serviceContext = (function (vue) {
reject('sendSocketMessage:fail WebSocket is not connected');
return;
}
- socketTask._socket.send({
- data: args.data,
- });
+ socketTask.send({ data: args.data });
resolve();
}, SendSocketMessageProtocol);
const closeSocket = defineAsyncApi(API_CLOSE_SOCKET, (args, { resolve, reject }) => {
@@ -4639,7 +4674,7 @@ var serviceContext = (function (vue) {
}
socketTask.readyState = socketTask.CLOSING;
const { code, reason } = args;
- socketTask._socket.close({ code, reason });
+ socketTask.close({ code, reason });
resolve();
}, CloseSocketProtocol);
function on(event) {
@@ -4653,6 +4688,84 @@ var serviceContext = (function (vue) {
const onSocketMessage = /*#__PURE__*/ on('message');
const onSocketClose = /*#__PURE__*/ on('close');
+ class UploadTask {
+ constructor(uploader) {
+ this._callbacks = [];
+ this._uploader = uploader;
+ uploader.addEventListener('statechanged', (upload, status) => {
+ if (upload.uploadedSize && upload.totalSize) {
+ this._callbacks.forEach((callback) => {
+ callback({
+ progress: parseInt(String((upload.uploadedSize / upload.totalSize) * 100)),
+ totalBytesSent: upload.uploadedSize,
+ totalBytesExpectedToSend: upload.totalSize,
+ });
+ });
+ }
+ });
+ }
+ abort() {
+ this._uploader.abort();
+ }
+ onProgressUpdate(callback) {
+ if (typeof callback !== 'function') {
+ return;
+ }
+ this._callbacks.push(callback);
+ }
+ onHeadersReceived() { }
+ offProgressUpdate(callback) {
+ const index = this._callbacks.indexOf(callback);
+ if (index >= 0) {
+ this._callbacks.splice(index, 1);
+ }
+ }
+ offHeadersReceived() { }
+ }
+ const uploadFile = defineTaskApi(API_UPLOAD_FILE, ({ url, timeout, header, formData, files, filePath, name }, { resolve, reject }) => {
+ const uploader = plus.uploader.createUpload(url, {
+ timeout,
+ // 需要与其它平台上的表现保持一致,不走重试的逻辑。
+ retry: 0,
+ retryInterval: 0,
+ }, (upload, statusCode) => {
+ if (statusCode) {
+ resolve({
+ data: upload.responseText,
+ statusCode,
+ });
+ }
+ else {
+ reject(`statusCode: ${statusCode}`);
+ }
+ });
+ for (const name in header) {
+ if (hasOwn$1(header, name)) {
+ uploader.setRequestHeader(name, String(header[name]));
+ }
+ }
+ for (const name in formData) {
+ if (hasOwn$1(formData, name)) {
+ uploader.addData(name, String(formData[name]));
+ }
+ }
+ if (files && files.length) {
+ files.forEach((file) => {
+ uploader.addFile(getRealPath(file.uri), {
+ key: file.name || 'file',
+ });
+ });
+ }
+ else {
+ uploader.addFile(getRealPath(filePath), {
+ key: name,
+ });
+ }
+ const uploadFileTask = new UploadTask(uploader);
+ uploader.start();
+ return uploadFileTask;
+ }, UploadFileProtocol, UploadFileOptions);
+
const audios = {};
const evts = [
'play',
@@ -4698,7 +4811,7 @@ var serviceContext = (function (vue) {
};
function createAudioInstance() {
const audioId = `${Date.now()}${Math.random()}`;
- const audio = (audios[audioId] = plus.audio.createPlayer());
+ const audio = (audios[audioId] = plus.audio.createPlayer('')); // 此处空字符串必填
audio.src = '';
audio.volume = 1;
audio.startTime = 0;
@@ -6224,7 +6337,8 @@ var serviceContext = (function (vue) {
}
const VD_SYNC = 'vdSync';
- const ON_WEBVIEW_READY = 'onWebviewReady';
+ const ON_WEBVIEW_READY = 'onWebviewReady';
+ const INVOKE_API = 'invokeApi';
const ACTION_TYPE_PAGE_CREATE = 1;
const ACTION_TYPE_PAGE_CREATED = 2;
@@ -6580,7 +6694,11 @@ var serviceContext = (function (vue) {
// 非纯原生
subscribe(ON_WEBVIEW_READY, subscribeWebviewReady);
subscribe(VD_SYNC, onVdSync);
+ subscribe(INVOKE_API, onInvokeApi);
}
+ }
+ function onInvokeApi({ data: { method, args }, }) {
+ uni[method] && uni[method](args);
}
let appCtx;
@@ -7450,11 +7568,15 @@ var serviceContext = (function (vue) {
}
function initPageOptions({ meta }) {
const statusbarHeight = getStatusbarHeight();
+ const { platform, pixelRatio, windowWidth } = getBaseSystemInfo();
return {
css: true,
route: meta.route,
version: 1,
locale: '',
+ platform,
+ pixelRatio,
+ windowWidth,
disableScroll: meta.disableScroll === true,
onPageScroll: false,
onPageReachBottom: false,
@@ -7699,6 +7821,7 @@ var serviceContext = (function (vue) {
onSocketError: onSocketError,
onSocketMessage: onSocketMessage,
onSocketClose: onSocketClose,
+ uploadFile: uploadFile,
createInnerAudioContext: createInnerAudioContext,
getBackgroundAudioManager: getBackgroundAudioManager,
getLocation: getLocation,
diff --git a/packages/uni-app-plus/dist/uni-app-view.umd.js b/packages/uni-app-plus/dist/uni-app-view.umd.js
index 5344dcb66ac9637f3d3455573b8475d9069fdc27..2ba3d4eabbf5675f07b7cd685ec8a7fd3acf54b6 100644
--- a/packages/uni-app-plus/dist/uni-app-view.umd.js
+++ b/packages/uni-app-plus/dist/uni-app-view.umd.js
@@ -6,18 +6,19 @@
var nvue = "[nvue] uni-view,\n[nvue] uni-label,\n[nvue] uni-swiper-item,\n[nvue] uni-scroll-view {\n display: flex;\n flex-shrink: 0;\n flex-grow: 0;\n flex-basis: auto;\n align-items: stretch;\n align-content: flex-start;\n}\n\n[nvue] uni-button {\n margin: 0;\n}\n\n[nvue-dir-row] uni-view,\n[nvue-dir-row] uni-label,\n[nvue-dir-row] uni-swiper-item {\n flex-direction: row;\n}\n\n[nvue-dir-column] uni-view,\n[nvue-dir-column] uni-label,\n[nvue-dir-column] uni-swiper-item {\n flex-direction: column;\n}\n\n[nvue-dir-row-reverse] uni-view,\n[nvue-dir-row-reverse] uni-label,\n[nvue-dir-row-reverse] uni-swiper-item {\n flex-direction: row-reverse;\n}\n\n[nvue-dir-column-reverse] uni-view,\n[nvue-dir-column-reverse] uni-label,\n[nvue-dir-column-reverse] uni-swiper-item {\n flex-direction: column-reverse;\n}\n\n[nvue] uni-view,\n[nvue] uni-image,\n[nvue] uni-input,\n[nvue] uni-scroll-view,\n[nvue] uni-swiper,\n[nvue] uni-swiper-item,\n[nvue] uni-text,\n[nvue] uni-textarea,\n[nvue] uni-video {\n position: relative;\n border: 0px solid #000000;\n box-sizing: border-box;\n}\n\n[nvue] uni-swiper-item {\n position: absolute;\n}\n";
const VD_SYNC = "vdSync";
const ON_WEBVIEW_READY = "onWebviewReady";
- function makeMap(str, expectsLowerCase) {
+ const INVOKE_API = "invokeApi";
+ function makeMap$1(str, expectsLowerCase) {
const map = Object.create(null);
- const list = str.split(",");
- for (let i = 0; i < list.length; i++) {
- map[list[i]] = true;
+ const list2 = str.split(",");
+ for (let i = 0; i < list2.length; i++) {
+ map[list2[i]] = true;
}
return expectsLowerCase ? (val) => !!map[val.toLowerCase()] : (val) => !!map[val];
}
const GLOBALS_WHITE_LISTED = "Infinity,undefined,NaN,isFinite,isNaN,parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,BigInt";
- const isGloballyWhitelisted = /* @__PURE__ */ makeMap(GLOBALS_WHITE_LISTED);
+ const isGloballyWhitelisted = /* @__PURE__ */ makeMap$1(GLOBALS_WHITE_LISTED);
const specialBooleanAttrs = `itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly`;
- const isSpecialBooleanAttr = /* @__PURE__ */ makeMap(specialBooleanAttrs);
+ const isSpecialBooleanAttr = /* @__PURE__ */ makeMap$1(specialBooleanAttrs);
function normalizeStyle(value) {
if (isArray(value)) {
const res = {};
@@ -67,6 +68,26 @@
}
return res.trim();
}
+ const toDisplayString = (val) => {
+ return val == null ? "" : isObject$1(val) ? JSON.stringify(val, replacer, 2) : String(val);
+ };
+ const replacer = (_key, val) => {
+ if (isMap(val)) {
+ return {
+ [`Map(${val.size})`]: [...val.entries()].reduce((entries2, [key, val2]) => {
+ entries2[`${key} =>`] = val2;
+ return entries2;
+ }, {})
+ };
+ } else if (isSet(val)) {
+ return {
+ [`Set(${val.size})`]: [...val.values()]
+ };
+ } else if (isObject$1(val) && !isArray(val) && !isPlainObject(val)) {
+ return String(val);
+ }
+ return val;
+ };
const EMPTY_OBJ = {};
const EMPTY_ARR = [];
const NOOP = () => {
@@ -101,22 +122,22 @@
};
const isPlainObject = (val) => toTypeString(val) === "[object Object]";
const isIntegerKey = (key) => isString(key) && key !== "NaN" && key[0] !== "-" && "" + parseInt(key, 10) === key;
- const isReservedProp = /* @__PURE__ */ makeMap(",key,ref,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted");
- const cacheStringFunction = (fn) => {
- const cache = Object.create(null);
+ const isReservedProp = /* @__PURE__ */ makeMap$1(",key,ref,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted");
+ const cacheStringFunction$1 = (fn) => {
+ const cache2 = Object.create(null);
return (str) => {
- const hit = cache[str];
- return hit || (cache[str] = fn(str));
+ const hit = cache2[str];
+ return hit || (cache2[str] = fn(str));
};
};
const camelizeRE = /-(\w)/g;
- const camelize = cacheStringFunction((str) => {
+ const camelize = cacheStringFunction$1((str) => {
return str.replace(camelizeRE, (_, c) => c ? c.toUpperCase() : "");
});
const hyphenateRE = /\B([A-Z])/g;
- const hyphenate = cacheStringFunction((str) => str.replace(hyphenateRE, "-$1").toLowerCase());
- const capitalize = cacheStringFunction((str) => str.charAt(0).toUpperCase() + str.slice(1));
- const toHandlerKey = cacheStringFunction((str) => str ? `on${capitalize(str)}` : ``);
+ const hyphenate = cacheStringFunction$1((str) => str.replace(hyphenateRE, "-$1").toLowerCase());
+ const capitalize = cacheStringFunction$1((str) => str.charAt(0).toUpperCase() + str.slice(1));
+ const toHandlerKey = cacheStringFunction$1((str) => str ? `on${capitalize(str)}` : ``);
const hasChanged = (value, oldValue) => value !== oldValue && (value === value || oldValue === oldValue);
const invokeArrayFns = (fns, arg) => {
for (let i = 0; i < fns.length; i++) {
@@ -140,10 +161,13 @@
function getCustomDataset(el) {
return extend({}, el.dataset, el.__uniDataset);
}
+ function passive(passive2) {
+ return { passive: passive2 };
+ }
function normalizeTarget(el) {
- const { id, offsetTop, offsetLeft } = el;
+ const { id: id2, offsetTop, offsetLeft } = el;
return {
- id,
+ id: id2,
dataset: getCustomDataset(el),
offsetTop,
offsetLeft
@@ -228,8 +252,8 @@
return Object.assign(BASE_ATTR_MAP, Object.keys(EVENT_MAP).reduce((res, name) => {
const value = EVENT_MAP[name];
res[name] = value;
- OPTIONS.forEach((v, i) => {
- res[name + v] = value + i;
+ OPTIONS.forEach((v2, i) => {
+ res[name + v2] = value + i;
});
return res;
}, Object.create(null)));
@@ -244,6 +268,16 @@
function decodeAttr(name) {
return DECODED_ATTR_MAP[name] || name;
}
+ function cache(fn) {
+ const cache2 = Object.create(null);
+ return (str) => {
+ const hit = cache2[str];
+ return hit || (cache2[str] = fn(str));
+ };
+ }
+ function cacheStringFunction(fn) {
+ return cache(fn);
+ }
function once(fn, ctx = null) {
let res;
return (...args) => {
@@ -254,7 +288,22 @@
return res;
};
}
+ function debounce(fn, delay) {
+ let timeout;
+ const newFn = function() {
+ clearTimeout(timeout);
+ const timerFn = () => fn.apply(this, arguments);
+ timeout = setTimeout(timerFn, delay);
+ };
+ newFn.cancel = function() {
+ clearTimeout(timeout);
+ };
+ return newFn;
+ }
+ const NAVBAR_HEIGHT = 44;
const PRIMARY_COLOR = "#007aff";
+ const SCHEME_RE = /^([a-z-]+:)?\/\//i;
+ const DATA_RE = /^data:.*,.*/;
const isObject = (val) => val !== null && typeof val === "object";
class BaseFormatter {
constructor() {
@@ -277,14 +326,14 @@
function parse(format) {
const tokens = [];
let position = 0;
- let text = "";
+ let text2 = "";
while (position < format.length) {
let char = format[position++];
if (char === "{") {
- if (text) {
- tokens.push({ type: "text", value: text });
+ if (text2) {
+ tokens.push({ type: "text", value: text2 });
}
- text = "";
+ text2 = "";
let sub = "";
char = format[position++];
while (char !== void 0 && char !== "}") {
@@ -296,24 +345,24 @@
tokens.push({ value: sub, type });
} else if (char === "%") {
if (format[position] !== "{") {
- text += char;
+ text2 += char;
}
} else {
- text += char;
+ text2 += char;
}
}
- text && tokens.push({ type: "text", value: text });
+ text2 && tokens.push({ type: "text", value: text2 });
return tokens;
}
function compile(tokens, values) {
const compiled = [];
- let index = 0;
+ let index2 = 0;
const mode = Array.isArray(values) ? "list" : isObject(values) ? "named" : "unknown";
if (mode === "unknown") {
return compiled;
}
- while (index < tokens.length) {
- const token = tokens[index];
+ while (index2 < tokens.length) {
+ const token = tokens[index2];
switch (token.type) {
case "text":
compiled.push(token.value);
@@ -327,7 +376,7 @@
}
break;
}
- index++;
+ index2++;
}
return compiled;
}
@@ -403,9 +452,9 @@
return this.locale;
}
watchLocale(fn) {
- const index = this.watchers.push(fn) - 1;
+ const index2 = this.watchers.push(fn) - 1;
return () => {
- this.watchers.splice(index, 1);
+ this.watchers.splice(index2, 1);
};
}
add(locale, message) {
@@ -449,20 +498,20 @@
fallbackLocale,
messages
});
- let t = (key, values) => {
+ let t2 = (key, values) => {
if (typeof getApp !== "function") {
- t = function(key2, values2) {
+ t2 = function(key2, values2) {
return i18n2.t(key2, values2);
};
} else {
const appVm = getApp().$vm;
if (!appVm.$t || !appVm.$i18n) {
- t = function(key2, values2) {
+ t2 = function(key2, values2) {
return i18n2.t(key2, values2);
};
} else {
initLocaleWatcher(appVm, i18n2);
- t = function(key2, values2) {
+ t2 = function(key2, values2) {
const $i18n = appVm.$i18n;
const silentTranslationWarn = $i18n.silentTranslationWarn;
$i18n.silentTranslationWarn = true;
@@ -475,12 +524,12 @@
};
}
}
- return t(key, values);
+ return t2(key, values);
};
return {
i18n: i18n2,
t(key, values) {
- return t(key, values);
+ return t2(key, values);
},
add(locale2, message) {
return i18n2.add(locale2, message);
@@ -510,6 +559,24 @@
return res;
}, {});
}
+ const initI18nShowModalMsgsOnce = /* @__PURE__ */ once(() => {
+ const name = "uni.showModal.";
+ {
+ useI18n().add(LOCALE_EN, normalizeMessages(name, { cancel: "Cancel", confirm: "OK" }));
+ }
+ {
+ useI18n().add(LOCALE_ES, normalizeMessages(name, { cancel: "Cancelar", confirm: "OK" }));
+ }
+ {
+ useI18n().add(LOCALE_FR, normalizeMessages(name, { cancel: "Annuler", confirm: "OK" }));
+ }
+ {
+ useI18n().add(LOCALE_ZH_HANS, normalizeMessages(name, { cancel: "\u53D6\u6D88", confirm: "\u786E\u5B9A" }));
+ }
+ {
+ useI18n().add(LOCALE_ZH_HANT, normalizeMessages(name, { cancel: "\u53D6\u6D88", confirm: "\u78BA\u5B9A" }));
+ }
+ });
const initI18nButtonMsgsOnce = /* @__PURE__ */ once(() => {
const name = "uni.button.";
{
@@ -547,17 +614,17 @@
};
E.prototype = {
on: function(name, callback, ctx) {
- var e = this.e || (this.e = {});
- (e[name] || (e[name] = [])).push({
+ var e2 = this.e || (this.e = {});
+ (e2[name] || (e2[name] = [])).push({
fn: callback,
ctx
});
return this;
},
once: function(name, callback, ctx) {
- var self = this;
+ var self2 = this;
function listener() {
- self.off(name, listener);
+ self2.off(name, listener);
callback.apply(ctx, arguments);
}
listener._ = callback;
@@ -574,8 +641,8 @@
return this;
},
off: function(name, callback) {
- var e = this.e || (this.e = {});
- var evts = e[name];
+ var e2 = this.e || (this.e = {});
+ var evts = e2[name];
var liveEvents = [];
if (evts && callback) {
for (var i = 0, len = evts.length; i < len; i++) {
@@ -583,7 +650,7 @@
liveEvents.push(evts[i]);
}
}
- liveEvents.length ? e[name] = liveEvents : delete e[name];
+ liveEvents.length ? e2[name] = liveEvents : delete e2[name];
return this;
}
};
@@ -775,7 +842,7 @@
};
effects.forEach(run);
}
- const isNonTrackableKeys = /* @__PURE__ */ makeMap(`__proto__,__v_isRef,__isVue`);
+ const isNonTrackableKeys = /* @__PURE__ */ makeMap$1(`__proto__,__v_isRef,__isVue`);
const builtInSymbols = new Set(Object.getOwnPropertyNames(Symbol).map((key) => Symbol[key]).filter(isSymbol));
const get = /* @__PURE__ */ createGetter();
const shallowGet = /* @__PURE__ */ createGetter(false, true);
@@ -910,7 +977,7 @@
const toReactive = (value) => isObject$1(value) ? reactive(value) : value;
const toReadonly = (value) => isObject$1(value) ? readonly(value) : value;
const toShallow = (value) => value;
- const getProto = (v) => Reflect.getPrototypeOf(v);
+ const getProto = (v2) => Reflect.getPrototypeOf(v2);
function get$1(target, key, isReadonly2 = false, isShallow = false) {
target = target["__v_raw"];
const rawTarget = toRaw(target);
@@ -1113,12 +1180,7 @@
shallowReadonlyInstrumentations2
];
}
- const [
- mutableInstrumentations,
- readonlyInstrumentations,
- shallowInstrumentations,
- shallowReadonlyInstrumentations
- ] = /* @__PURE__ */ createInstrumentations();
+ const [mutableInstrumentations, readonlyInstrumentations, shallowInstrumentations, shallowReadonlyInstrumentations] = /* @__PURE__ */ createInstrumentations();
function createInstrumentationGetter(isReadonly2, shallow) {
const instrumentations = shallow ? isReadonly2 ? shallowReadonlyInstrumentations : shallowInstrumentations : isReadonly2 ? readonlyInstrumentations : mutableInstrumentations;
return (target, key, receiver) => {
@@ -1219,6 +1281,9 @@
function ref(value) {
return createRef(value);
}
+ function shallowRef(value) {
+ return createRef(value, true);
+ }
class RefImpl {
constructor(_rawValue, _shallow) {
this._rawValue = _rawValue;
@@ -1279,13 +1344,13 @@
this["__v_isReadonly"] = isReadonly2;
}
get value() {
- const self = toRaw(this);
- if (self._dirty) {
- self._value = this.effect();
- self._dirty = false;
+ const self2 = toRaw(this);
+ if (self2._dirty) {
+ self2._value = this.effect();
+ self2._dirty = false;
}
- track(self, "get", "value");
- return self._value;
+ track(self2, "get", "value");
+ return self2._value;
}
set value(newValue) {
this._setter(newValue);
@@ -1362,11 +1427,11 @@
const close = `>` + postfix;
return vnode.props ? [open, ...formatProps(vnode.props), close] : [open + close];
}
- function formatProps(props) {
+ function formatProps(props2) {
const res = [];
- const keys = Object.keys(props);
+ const keys = Object.keys(props2);
keys.slice(0, 3).forEach((key) => {
- res.push(...formatProp(key, props[key]));
+ res.push(...formatProp(key, props2[key]));
});
if (keys.length > 3) {
res.push(` ...`);
@@ -1433,11 +1498,7 @@
}
const appErrorHandler = instance.appContext.config.errorHandler;
if (appErrorHandler) {
- callWithErrorHandling(appErrorHandler, null, 10, [
- err,
- exposedInstance,
- errorInfo
- ]);
+ callWithErrorHandling(appErrorHandler, null, 10, [err, exposedInstance, errorInfo]);
return;
}
}
@@ -1500,9 +1561,9 @@
queue.splice(i, 1);
}
}
- function queueCb(cb, activeQueue, pendingQueue, index) {
+ function queueCb(cb, activeQueue, pendingQueue, index2) {
if (!isArray(cb)) {
- if (!activeQueue || !activeQueue.includes(cb, cb.allowRecurse ? index + 1 : index)) {
+ if (!activeQueue || !activeQueue.includes(cb, cb.allowRecurse ? index2 + 1 : index2)) {
pendingQueue.push(cb);
}
} else {
@@ -1539,7 +1600,7 @@
return;
}
activePostFlushCbs = deduped;
- activePostFlushCbs.sort((a, b) => getId(a) - getId(b));
+ activePostFlushCbs.sort((a2, b) => getId(a2) - getId(b));
for (postFlushIndex = 0; postFlushIndex < activePostFlushCbs.length; postFlushIndex++) {
activePostFlushCbs[postFlushIndex]();
}
@@ -1552,7 +1613,7 @@
isFlushPending = false;
isFlushing = true;
flushPreFlushCbs(seen);
- queue.sort((a, b) => getId(a) - getId(b));
+ queue.sort((a2, b) => getId(a2) - getId(b));
try {
for (flushIndex = 0; flushIndex < queue.length; flushIndex++) {
const job = queue[flushIndex];
@@ -1611,29 +1672,29 @@
return val === true || val === "suppress-warning";
}
}
- function emit(instance, event, ...rawArgs) {
- const props = instance.vnode.props || EMPTY_OBJ;
+ function emit$2(instance, event, ...rawArgs) {
+ const props2 = instance.vnode.props || EMPTY_OBJ;
let args = rawArgs;
const isModelListener2 = event.startsWith("update:");
const modelArg = isModelListener2 && event.slice(7);
- if (modelArg && modelArg in props) {
+ if (modelArg && modelArg in props2) {
const modifiersKey = `${modelArg === "modelValue" ? "model" : modelArg}Modifiers`;
- const { number, trim } = props[modifiersKey] || EMPTY_OBJ;
+ const { number, trim } = props2[modifiersKey] || EMPTY_OBJ;
if (trim) {
- args = rawArgs.map((a) => a.trim());
+ args = rawArgs.map((a2) => a2.trim());
} else if (number) {
args = rawArgs.map(toNumber);
}
}
let handlerName;
- let handler = props[handlerName = toHandlerKey(event)] || props[handlerName = toHandlerKey(camelize(event))];
+ let handler = props2[handlerName = toHandlerKey(event)] || props2[handlerName = toHandlerKey(camelize(event))];
if (!handler && isModelListener2) {
- handler = props[handlerName = toHandlerKey(hyphenate(event))];
+ handler = props2[handlerName = toHandlerKey(hyphenate(event))];
}
if (handler) {
callWithAsyncErrorHandling(handler, instance, 6, args);
}
- const onceHandler = props[handlerName + `Once`];
+ const onceHandler = props2[handlerName + `Once`];
if (onceHandler) {
if (!instance.emitted) {
instance.emitted = {};
@@ -1645,8 +1706,8 @@
}
}
function normalizeEmitsOptions(comp, appContext, asMixin = false) {
- const cache = appContext.emitsCache;
- const cached = cache.get(comp);
+ const cache2 = appContext.emitsCache;
+ const cached = cache2.get(comp);
if (cached !== void 0) {
return cached;
}
@@ -1672,7 +1733,7 @@
}
}
if (!raw && !hasExtends) {
- cache.set(comp, null);
+ cache2.set(comp, null);
return null;
}
if (isArray(raw)) {
@@ -1680,7 +1741,7 @@
} else {
extend(normalized, raw);
}
- cache.set(comp, normalized);
+ cache2.set(comp, normalized);
return normalized;
}
function isEmitListener(options, key) {
@@ -1726,43 +1787,27 @@
accessedAttrs = true;
}
function renderComponentRoot(instance) {
- const {
- type: Component,
- vnode,
- proxy,
- withProxy,
- props,
- propsOptions: [propsOptions],
- slots,
- attrs: attrs2,
- emit: emit2,
- render,
- renderCache,
- data,
- setupState,
- ctx,
- inheritAttrs
- } = instance;
+ const { type: Component, vnode, proxy, withProxy, props: props2, propsOptions: [propsOptions], slots, attrs: attrs2, emit: emit2, render, renderCache, data, setupState, ctx, inheritAttrs } = instance;
let result;
const prev = setCurrentRenderingInstance(instance);
try {
let fallthroughAttrs;
if (vnode.shapeFlag & 4) {
const proxyToUse = withProxy || proxy;
- result = normalizeVNode(render.call(proxyToUse, proxyToUse, renderCache, props, setupState, data, ctx));
+ result = normalizeVNode(render.call(proxyToUse, proxyToUse, renderCache, props2, setupState, data, ctx));
fallthroughAttrs = attrs2;
} else {
const render2 = Component;
if (false)
;
- result = normalizeVNode(render2.length > 1 ? render2(props, false ? {
+ result = normalizeVNode(render2.length > 1 ? render2(props2, false ? {
get attrs() {
markAttrsAccessed();
return attrs2;
},
slots,
emit: emit2
- } : { attrs: attrs2, slots, emit: emit2 }) : render2(props, null));
+ } : { attrs: attrs2, slots, emit: emit2 }) : render2(props2, null));
fallthroughAttrs = Component.props ? attrs2 : getFunctionalFallthrough(attrs2);
}
let root = result;
@@ -1800,6 +1845,7 @@
result = root;
}
} catch (err) {
+ blockStack.length = 0;
handleError(err, instance, 1);
result = createVNode(Comment$1);
}
@@ -1813,10 +1859,10 @@
if (!childRoot) {
return [vnode, void 0];
}
- const index = rawChildren.indexOf(childRoot);
+ const index2 = rawChildren.indexOf(childRoot);
const dynamicIndex = dynamicChildren ? dynamicChildren.indexOf(childRoot) : -1;
const setRoot = (updatedRoot) => {
- rawChildren[index] = updatedRoot;
+ rawChildren[index2] = updatedRoot;
if (dynamicChildren) {
if (dynamicIndex > -1) {
dynamicChildren[dynamicIndex] = updatedRoot;
@@ -1854,10 +1900,10 @@
}
return res;
};
- const filterModelListeners = (attrs2, props) => {
+ const filterModelListeners = (attrs2, props2) => {
const res = {};
for (const key in attrs2) {
- if (!isModelListener(key) || !(key.slice(9) in props)) {
+ if (!isModelListener(key) || !(key.slice(9) in props2)) {
res[key] = attrs2[key];
}
}
@@ -1869,7 +1915,7 @@
function shouldUpdateComponent(prevVNode, nextVNode, optimized) {
const { props: prevProps, children: prevChildren, component } = prevVNode;
const { props: nextProps, children: nextChildren, patchFlag } = nextVNode;
- const emits = component.emitsOptions;
+ const emits2 = component.emitsOptions;
if (nextVNode.dirs || nextVNode.transition) {
return true;
}
@@ -1881,12 +1927,12 @@
if (!prevProps) {
return !!nextProps;
}
- return hasPropsChanged(prevProps, nextProps, emits);
+ return hasPropsChanged(prevProps, nextProps, emits2);
} else if (patchFlag & 8) {
const dynamicProps = nextVNode.dynamicProps;
for (let i = 0; i < dynamicProps.length; i++) {
const key = dynamicProps[i];
- if (nextProps[key] !== prevProps[key] && !isEmitListener(emits, key)) {
+ if (nextProps[key] !== prevProps[key] && !isEmitListener(emits2, key)) {
return true;
}
}
@@ -1906,7 +1952,7 @@
if (!nextProps) {
return true;
}
- return hasPropsChanged(prevProps, nextProps, emits);
+ return hasPropsChanged(prevProps, nextProps, emits2);
}
return false;
}
@@ -1965,6 +2011,9 @@
;
}
}
+ function watchEffect(effect2, options) {
+ return doWatch(effect2, null, options);
+ }
const INITIAL_WATCHER_VALUE = {};
function watch(source, cb, options) {
return doWatch(source, cb, options);
@@ -2026,7 +2075,7 @@
}
if (cb) {
const newValue = runner();
- if (deep || forceTrigger || (isMultiSource ? newValue.some((v, i) => hasChanged(v, oldValue[i])) : hasChanged(newValue, oldValue)) || false) {
+ if (deep || forceTrigger || (isMultiSource ? newValue.some((v2, i) => hasChanged(v2, oldValue[i])) : hasChanged(newValue, oldValue)) || false) {
if (cleanup2) {
cleanup2();
}
@@ -2115,8 +2164,8 @@
traverse(value[i], seen);
}
} else if (isSet(value) || isMap(value)) {
- value.forEach((v) => {
- traverse(v, seen);
+ value.forEach((v2) => {
+ traverse(v2, seen);
});
} else if (isPlainObject(value)) {
for (const key in value) {
@@ -2211,7 +2260,7 @@
const {
data: dataOptions,
computed: computedOptions,
- methods,
+ methods: methods2,
watch: watchOptions,
provide: provideOptions,
inject: injectOptions,
@@ -2241,9 +2290,9 @@
if (injectOptions) {
resolveInjections(injectOptions, ctx, checkDuplicateProperties);
}
- if (methods) {
- for (const key in methods) {
- const methodHandler = methods[key];
+ if (methods2) {
+ for (const key in methods2) {
+ const methodHandler = methods2[key];
if (isFunction(methodHandler)) {
{
ctx[key] = methodHandler.bind(publicThis);
@@ -2273,7 +2322,7 @@
enumerable: true,
configurable: true,
get: () => c.value,
- set: (v) => c.value = v
+ set: (v2) => c.value = v2
});
}
}
@@ -2291,11 +2340,11 @@
if (created) {
callHook(created, instance, "c");
}
- function registerLifecycleHook(register, hook) {
+ function registerLifecycleHook(register2, hook) {
if (isArray(hook)) {
- hook.forEach((_hook) => register(_hook.bind(publicThis)));
+ hook.forEach((_hook) => register2(_hook.bind(publicThis)));
} else if (hook) {
- register(hook.bind(publicThis));
+ register2(hook.bind(publicThis));
}
}
registerLifecycleHook(onBeforeMount, beforeMount);
@@ -2378,12 +2427,8 @@
function resolveMergedOptions(instance) {
const base2 = instance.type;
const { mixins, extends: extendsOptions } = base2;
- const {
- mixins: globalMixins,
- optionsCache: cache,
- config: { optionMergeStrategies }
- } = instance.appContext;
- const cached = cache.get(base2);
+ const { mixins: globalMixins, optionsCache: cache2, config: { optionMergeStrategies } } = instance.appContext;
+ const cached = cache2.get(base2);
let resolved;
if (cached) {
resolved = cached;
@@ -2398,7 +2443,7 @@
}
mergeOptions(resolved, base2, optionMergeStrategies);
}
- cache.set(base2, resolved);
+ cache2.set(base2, resolved);
return resolved;
}
function mergeOptions(to, from, strats, asMixin = false) {
@@ -2485,34 +2530,30 @@
return merged;
}
function initProps(instance, rawProps, isStateful, isSSR = false) {
- const props = {};
+ const props2 = {};
const attrs2 = {};
def(attrs2, InternalObjectKey, 1);
instance.propsDefaults = Object.create(null);
- setFullProps(instance, rawProps, props, attrs2);
+ setFullProps(instance, rawProps, props2, attrs2);
for (const key in instance.propsOptions[0]) {
- if (!(key in props)) {
- props[key] = void 0;
+ if (!(key in props2)) {
+ props2[key] = void 0;
}
}
if (isStateful) {
- instance.props = isSSR ? props : shallowReactive(props);
+ instance.props = isSSR ? props2 : shallowReactive(props2);
} else {
if (!instance.type.props) {
instance.props = attrs2;
} else {
- instance.props = props;
+ instance.props = props2;
}
}
instance.attrs = attrs2;
}
function updateProps(instance, rawProps, rawPrevProps, optimized) {
- const {
- props,
- attrs: attrs2,
- vnode: { patchFlag }
- } = instance;
- const rawCurrentProps = toRaw(props);
+ const { props: props2, attrs: attrs2, vnode: { patchFlag } } = instance;
+ const rawCurrentProps = toRaw(props2);
const [options] = instance.propsOptions;
let hasAttrsChanged = false;
if ((optimized || patchFlag > 0) && !(patchFlag & 16)) {
@@ -2529,7 +2570,7 @@
}
} else {
const camelizedKey = camelize(key);
- props[camelizedKey] = resolvePropValue(options, rawCurrentProps, camelizedKey, value, instance, false);
+ props2[camelizedKey] = resolvePropValue(options, rawCurrentProps, camelizedKey, value, instance, false);
}
} else {
if (value !== attrs2[key]) {
@@ -2540,7 +2581,7 @@
}
}
} else {
- if (setFullProps(instance, rawProps, props, attrs2)) {
+ if (setFullProps(instance, rawProps, props2, attrs2)) {
hasAttrsChanged = true;
}
let kebabKey;
@@ -2548,10 +2589,10 @@
if (!rawProps || !hasOwn$1(rawProps, key) && ((kebabKey = hyphenate(key)) === key || !hasOwn$1(rawProps, kebabKey))) {
if (options) {
if (rawPrevProps && (rawPrevProps[key] !== void 0 || rawPrevProps[kebabKey] !== void 0)) {
- props[key] = resolvePropValue(options, rawCurrentProps, key, void 0, instance, true);
+ props2[key] = resolvePropValue(options, rawCurrentProps, key, void 0, instance, true);
}
} else {
- delete props[key];
+ delete props2[key];
}
}
}
@@ -2568,7 +2609,7 @@
trigger(instance, "set", "$attrs");
}
}
- function setFullProps(instance, rawProps, props, attrs2) {
+ function setFullProps(instance, rawProps, props2, attrs2) {
const [options, needCastKeys] = instance.propsOptions;
let hasAttrsChanged = false;
let rawCastValues;
@@ -2581,7 +2622,7 @@
let camelKey;
if (options && hasOwn$1(options, camelKey = camelize(key))) {
if (!needCastKeys || !needCastKeys.includes(camelKey)) {
- props[camelKey] = value;
+ props2[camelKey] = value;
} else {
(rawCastValues || (rawCastValues = {}))[camelKey] = value;
}
@@ -2594,16 +2635,16 @@
}
}
if (needCastKeys) {
- const rawCurrentProps = toRaw(props);
+ const rawCurrentProps = toRaw(props2);
const castValues = rawCastValues || EMPTY_OBJ;
for (let i = 0; i < needCastKeys.length; i++) {
const key = needCastKeys[i];
- props[key] = resolvePropValue(options, rawCurrentProps, key, castValues[key], instance, !hasOwn$1(castValues, key));
+ props2[key] = resolvePropValue(options, rawCurrentProps, key, castValues[key], instance, !hasOwn$1(castValues, key));
}
}
return hasAttrsChanged;
}
- function resolvePropValue(options, props, key, value, instance, isAbsent) {
+ function resolvePropValue(options, props2, key, value, instance, isAbsent) {
const opt = options[key];
if (opt != null) {
const hasDefault = hasOwn$1(opt, "default");
@@ -2615,7 +2656,7 @@
value = propsDefaults[key];
} else {
setCurrentInstance(instance);
- value = propsDefaults[key] = defaultValue.call(null, props);
+ value = propsDefaults[key] = defaultValue.call(null, props2);
setCurrentInstance(null);
}
} else {
@@ -2633,8 +2674,8 @@
return value;
}
function normalizePropsOptions(comp, appContext, asMixin = false) {
- const cache = appContext.propsCache;
- const cached = cache.get(comp);
+ const cache2 = appContext.propsCache;
+ const cached = cache2.get(comp);
if (cached) {
return cached;
}
@@ -2645,8 +2686,8 @@
if (!isFunction(comp)) {
const extendProps = (raw2) => {
hasExtends = true;
- const [props, keys] = normalizePropsOptions(raw2, appContext, true);
- extend(normalized, props);
+ const [props2, keys] = normalizePropsOptions(raw2, appContext, true);
+ extend(normalized, props2);
if (keys)
needCastKeys.push(...keys);
};
@@ -2661,7 +2702,7 @@
}
}
if (!raw && !hasExtends) {
- cache.set(comp, EMPTY_ARR);
+ cache2.set(comp, EMPTY_ARR);
return EMPTY_ARR;
}
if (isArray(raw)) {
@@ -2690,7 +2731,7 @@
}
}
const res = [normalized, needCastKeys];
- cache.set(comp, res);
+ cache2.set(comp, res);
return res;
}
function validatePropName(key) {
@@ -2699,16 +2740,16 @@
}
return false;
}
- function getType(ctor) {
+ function getType$1(ctor) {
const match = ctor && ctor.toString().match(/^\s*function (\w+)/);
return match ? match[1] : "";
}
- function isSameType(a, b) {
- return getType(a) === getType(b);
+ function isSameType(a2, b) {
+ return getType$1(a2) === getType$1(b);
}
function getTypeIndex(type, expectedTypes) {
if (isArray(expectedTypes)) {
- return expectedTypes.findIndex((t) => isSameType(t, type));
+ return expectedTypes.findIndex((t2) => isSameType(t2, type));
} else if (isFunction(expectedTypes)) {
return isSameType(expectedTypes, type) ? 0 : -1;
}
@@ -2717,8 +2758,8 @@
const isInternalKey = (key) => key[0] === "_" || key === "$stable";
const normalizeSlotValue = (value) => isArray(value) ? value.map(normalizeVNode) : [normalizeVNode(value)];
const normalizeSlot = (key, rawSlot, ctx) => {
- const normalized = withCtx((props) => {
- return normalizeSlotValue(rawSlot(props));
+ const normalized = withCtx((props2) => {
+ return normalizeSlotValue(rawSlot(props2));
}, ctx);
normalized._c = false;
return normalized;
@@ -2790,6 +2831,32 @@
}
}
};
+ function withDirectives(vnode, directives) {
+ const internalInstance = currentRenderingInstance;
+ if (internalInstance === null) {
+ return vnode;
+ }
+ const instance = internalInstance.proxy;
+ const bindings = vnode.dirs || (vnode.dirs = []);
+ for (let i = 0; i < directives.length; i++) {
+ let [dir, value, arg, modifiers = EMPTY_OBJ] = directives[i];
+ if (isFunction(dir)) {
+ dir = {
+ mounted: dir,
+ updated: dir
+ };
+ }
+ bindings.push({
+ dir,
+ instance,
+ value,
+ oldValue: void 0,
+ arg,
+ modifiers
+ });
+ }
+ return vnode;
+ }
function invokeDirectiveHook(vnode, prevVNode, instance, name) {
const bindings = vnode.dirs;
const oldBindings = prevVNode && prevVNode.dirs;
@@ -2852,7 +2919,7 @@
get config() {
return context.config;
},
- set config(v) {
+ set config(v2) {
},
use(plugin, ...options) {
if (installedPlugins.has(plugin))
@@ -2981,22 +3048,7 @@
return baseCreateRenderer(options);
}
function baseCreateRenderer(options, createHydrationFns) {
- const {
- insert: hostInsert,
- remove: hostRemove,
- patchProp: hostPatchProp,
- forcePatchProp: hostForcePatchProp,
- createElement: hostCreateElement,
- createText: hostCreateText,
- createComment: hostCreateComment,
- setText: hostSetText,
- setElementText: hostSetElementText,
- parentNode: hostParentNode,
- nextSibling: hostNextSibling,
- setScopeId: hostSetScopeId = NOOP,
- cloneNode: hostCloneNode,
- insertStaticContent: hostInsertStaticContent
- } = options;
+ const { insert: hostInsert, remove: hostRemove, patchProp: hostPatchProp, forcePatchProp: hostForcePatchProp, createElement: hostCreateElement, createText: hostCreateText, createComment: hostCreateComment, setText: hostSetText, setElementText: hostSetElementText, parentNode: hostParentNode, nextSibling: hostNextSibling, setScopeId: hostSetScopeId = NOOP, cloneNode: hostCloneNode, insertStaticContent: hostInsertStaticContent } = options;
const patch = (n1, n2, container, anchor = null, parentComponent = null, parentSuspense = null, isSVG = false, slotScopeIds = null, optimized = false) => {
if (n1 && !isSameVNodeType(n1, n2)) {
anchor = getNextHostNode(n1);
@@ -3009,7 +3061,7 @@
}
const { type, ref: ref2, shapeFlag } = n2;
switch (type) {
- case Text:
+ case Text$1:
processText(n1, n2, container, anchor);
break;
case Comment$1:
@@ -3093,11 +3145,11 @@
const mountElement = (vnode, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized) => {
let el;
let vnodeHook;
- const { type, props, shapeFlag, transition, patchFlag, dirs } = vnode;
+ const { type, props: props2, shapeFlag, transition, patchFlag, dirs } = vnode;
if (vnode.el && hostCloneNode !== void 0 && patchFlag === -1) {
el = vnode.el = hostCloneNode(vnode.el);
} else {
- el = vnode.el = hostCreateElement(vnode.type, isSVG, props && props.is, props);
+ el = vnode.el = hostCreateElement(vnode.type, isSVG, props2 && props2.is, props2);
if (shapeFlag & 8) {
hostSetElementText(el, vnode.children);
} else if (shapeFlag & 16) {
@@ -3106,13 +3158,13 @@
if (dirs) {
invokeDirectiveHook(vnode, null, parentComponent, "created");
}
- if (props) {
- for (const key in props) {
+ if (props2) {
+ for (const key in props2) {
if (!isReservedProp(key)) {
- hostPatchProp(el, key, null, props[key], isSVG, vnode.children, parentComponent, parentSuspense, unmountChildren);
+ hostPatchProp(el, key, null, props2[key], isSVG, vnode.children, parentComponent, parentSuspense, unmountChildren);
}
}
- if (vnodeHook = props.onVnodeBeforeMount) {
+ if (vnodeHook = props2.onVnodeBeforeMount) {
invokeVNodeHook(vnodeHook, parentComponent, vnode);
}
}
@@ -3126,7 +3178,7 @@
transition.beforeEnter(el);
}
hostInsert(el, container, anchor);
- if ((vnodeHook = props && props.onVnodeMounted) || needCallTransitionHooks || dirs) {
+ if ((vnodeHook = props2 && props2.onVnodeMounted) || needCallTransitionHooks || dirs) {
queuePostRenderEffect(() => {
vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, vnode);
needCallTransitionHooks && transition.enter(el);
@@ -3319,12 +3371,12 @@
instance.update = effect(function componentEffect() {
if (!instance.isMounted) {
let vnodeHook;
- const { el, props } = initialVNode;
+ const { el, props: props2 } = initialVNode;
const { bm, m, parent } = instance;
if (bm) {
invokeArrayFns(bm);
}
- if (vnodeHook = props && props.onVnodeBeforeMount) {
+ if (vnodeHook = props2 && props2.onVnodeBeforeMount) {
invokeVNodeHook(vnodeHook, parent, initialVNode);
}
if (el && hydrateNode) {
@@ -3345,7 +3397,7 @@
if (m) {
queuePostRenderEffect(m, parentSuspense);
}
- if (vnodeHook = props && props.onVnodeMounted) {
+ if (vnodeHook = props2 && props2.onVnodeMounted) {
const scopedInitialVNode = initialVNode;
queuePostRenderEffect(() => invokeVNodeHook(vnodeHook, parent, scopedInitialVNode), parentSuspense);
}
@@ -3611,16 +3663,7 @@
}
};
const unmount = (vnode, parentComponent, parentSuspense, doRemove = false, optimized = false) => {
- const {
- type,
- props,
- ref: ref2,
- children,
- dynamicChildren,
- shapeFlag,
- patchFlag,
- dirs
- } = vnode;
+ const { type, props: props2, ref: ref2, children, dynamicChildren, shapeFlag, patchFlag, dirs } = vnode;
if (ref2 != null) {
setRef(ref2, null, parentSuspense, vnode, true);
}
@@ -3630,7 +3673,7 @@
}
const shouldInvokeDirs = shapeFlag & 1 && dirs;
let vnodeHook;
- if (vnodeHook = props && props.onVnodeBeforeUnmount) {
+ if (vnodeHook = props2 && props2.onVnodeBeforeUnmount) {
invokeVNodeHook(vnodeHook, parentComponent, vnode);
}
if (shapeFlag & 6) {
@@ -3654,7 +3697,7 @@
remove2(vnode);
}
}
- if ((vnodeHook = props && props.onVnodeUnmounted) || shouldInvokeDirs) {
+ if ((vnodeHook = props2 && props2.onVnodeUnmounted) || shouldInvokeDirs) {
queuePostRenderEffect(() => {
vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, vnode);
shouldInvokeDirs && invokeDirectiveHook(vnode, null, parentComponent, "unmounted");
@@ -3800,7 +3843,7 @@
function getSequence(arr) {
const p2 = arr.slice();
const result = [0];
- let i, j, u, v, c;
+ let i, j, u, v2, c;
const len = arr.length;
for (i = 0; i < len; i++) {
const arrI = arr[i];
@@ -3812,13 +3855,13 @@
continue;
}
u = 0;
- v = result.length - 1;
- while (u < v) {
- c = (u + v) / 2 | 0;
+ v2 = result.length - 1;
+ while (u < v2) {
+ c = (u + v2) / 2 | 0;
if (arr[result[c]] < arrI) {
u = c + 1;
} else {
- v = c;
+ v2 = c;
}
}
if (arrI < arr[result[u]]) {
@@ -3830,24 +3873,41 @@
}
}
u = result.length;
- v = result[u - 1];
+ v2 = result[u - 1];
while (u-- > 0) {
- result[u] = v;
- v = p2[v];
+ result[u] = v2;
+ v2 = p2[v2];
}
return result;
}
const isTeleport = (type) => type.__isTeleport;
const NULL_DYNAMIC_COMPONENT = Symbol();
const Fragment = Symbol(void 0);
- const Text = Symbol(void 0);
+ const Text$1 = Symbol(void 0);
const Comment$1 = Symbol(void 0);
const Static = Symbol(void 0);
+ const blockStack = [];
let currentBlock = null;
+ function openBlock(disableTracking = false) {
+ blockStack.push(currentBlock = disableTracking ? null : []);
+ }
+ function closeBlock() {
+ blockStack.pop();
+ currentBlock = blockStack[blockStack.length - 1] || null;
+ }
let isBlockTreeEnabled = 1;
function setBlockTracking(value) {
isBlockTreeEnabled += value;
}
+ function createBlock(type, props2, children, patchFlag, dynamicProps) {
+ const vnode = createVNode(type, props2, children, patchFlag, dynamicProps, true);
+ vnode.dynamicChildren = isBlockTreeEnabled > 0 ? currentBlock || EMPTY_ARR : null;
+ closeBlock();
+ if (isBlockTreeEnabled > 0 && currentBlock) {
+ currentBlock.push(vnode);
+ }
+ return vnode;
+ }
function isVNode(value) {
return value ? value.__v_isVNode === true : false;
}
@@ -3860,12 +3920,12 @@
return ref2 != null ? isString(ref2) || isRef(ref2) || isFunction(ref2) ? { i: currentRenderingInstance, r: ref2 } : ref2 : null;
};
const createVNode = _createVNode;
- function _createVNode(type, props = null, children = null, patchFlag = 0, dynamicProps = null, isBlockNode = false) {
+ function _createVNode(type, props2 = null, children = null, patchFlag = 0, dynamicProps = null, isBlockNode = false) {
if (!type || type === NULL_DYNAMIC_COMPONENT) {
type = Comment$1;
}
if (isVNode(type)) {
- const cloned = cloneVNode(type, props, true);
+ const cloned = cloneVNode(type, props2, true);
if (children) {
normalizeChildren(cloned, children);
}
@@ -3874,19 +3934,19 @@
if (isClassComponent(type)) {
type = type.__vccOpts;
}
- if (props) {
- if (isProxy(props) || InternalObjectKey in props) {
- props = extend({}, props);
+ if (props2) {
+ if (isProxy(props2) || InternalObjectKey in props2) {
+ props2 = extend({}, props2);
}
- let { class: klass, style } = props;
+ let { class: klass, style } = props2;
if (klass && !isString(klass)) {
- props.class = normalizeClass(klass);
+ props2.class = normalizeClass(klass);
}
if (isObject$1(style)) {
if (isProxy(style) && !isArray(style)) {
style = extend({}, style);
}
- props.style = normalizeStyle(style);
+ props2.style = normalizeStyle(style);
}
}
const shapeFlag = isString(type) ? 1 : isSuspense(type) ? 128 : isTeleport(type) ? 64 : isObject$1(type) ? 4 : isFunction(type) ? 2 : 0;
@@ -3894,9 +3954,9 @@
__v_isVNode: true,
__v_skip: true,
type,
- props,
- key: props && normalizeKey(props),
- ref: props && normalizeRef(props),
+ props: props2,
+ key: props2 && normalizeKey(props2),
+ ref: props2 && normalizeRef(props2),
scopeId: currentScopeId,
slotScopeIds: null,
children: null,
@@ -3926,8 +3986,8 @@
return vnode;
}
function cloneVNode(vnode, extraProps, mergeRef = false) {
- const { props, ref: ref2, patchFlag, children } = vnode;
- const mergedProps = extraProps ? mergeProps(props || {}, extraProps) : props;
+ const { props: props2, ref: ref2, patchFlag, children } = vnode;
+ const mergedProps = extraProps ? mergeProps(props2 || {}, extraProps) : props2;
const cloned = {
__v_isVNode: true,
__v_skip: true,
@@ -3958,8 +4018,8 @@
};
return cloned;
}
- function createTextVNode(text = " ", flag = 0) {
- return createVNode(Text, null, text, flag);
+ function createTextVNode(text2 = " ", flag = 0) {
+ return createVNode(Text$1, null, text2, flag);
}
function normalizeVNode(child) {
if (child == null || typeof child === "boolean") {
@@ -3969,7 +4029,7 @@
} else if (typeof child === "object") {
return cloneIfMounted(child);
} else {
- return createVNode(Text, null, String(child));
+ return createVNode(Text$1, null, String(child));
}
}
function cloneIfMounted(child) {
@@ -4069,7 +4129,7 @@
});
const PublicInstanceProxyHandlers = {
get({ _: instance }, key) {
- const { ctx, setupState, data, props, accessCache, type, appContext } = instance;
+ const { ctx, setupState, data, props: props2, accessCache, type, appContext } = instance;
let normalizedProps;
if (key[0] !== "$") {
const n = accessCache[key];
@@ -4082,7 +4142,7 @@
case 3:
return ctx[key];
case 2:
- return props[key];
+ return props2[key];
}
} else if (setupState !== EMPTY_OBJ && hasOwn$1(setupState, key)) {
accessCache[key] = 0;
@@ -4092,7 +4152,7 @@
return data[key];
} else if ((normalizedProps = instance.propsOptions[0]) && hasOwn$1(normalizedProps, key)) {
accessCache[key] = 2;
- return props[key];
+ return props2[key];
} else if (ctx !== EMPTY_OBJ && hasOwn$1(ctx, key)) {
accessCache[key] = 3;
return ctx[key];
@@ -4220,10 +4280,11 @@
instance.ctx = { _: instance };
}
instance.root = parent ? parent.root : instance;
- instance.emit = emit.bind(null, instance);
+ instance.emit = emit$2.bind(null, instance);
return instance;
}
let currentInstance = null;
+ const getCurrentInstance = () => currentInstance || currentRenderingInstance;
const setCurrentInstance = (instance) => {
currentInstance = instance;
};
@@ -4233,9 +4294,9 @@
let isInSSRComponentSetup = false;
function setupComponent(instance, isSSR = false) {
isInSSRComponentSetup = isSSR;
- const { props, children } = instance.vnode;
+ const { props: props2, children } = instance.vnode;
const isStateful = isStatefulComponent(instance);
- initProps(instance, props, isStateful, isSSR);
+ initProps(instance, props2, isStateful, isSSR);
initSlots(instance, children);
const setupResult = isStateful ? setupStatefulComponent(instance, isSSR) : void 0;
isInSSRComponentSetup = false;
@@ -4250,10 +4311,7 @@
const setupContext = instance.setupContext = setup.length > 1 ? createSetupContext(instance) : null;
currentInstance = instance;
pauseTracking();
- const setupResult = callWithErrorHandling(setup, instance, 0, [
- instance.props,
- setupContext
- ]);
+ const setupResult = callWithErrorHandling(setup, instance, 0, [instance.props, setupContext]);
resetTracking();
currentInstance = null;
if (isPromise(setupResult)) {
@@ -4264,8 +4322,8 @@
if (isSSR) {
return setupResult.then((resolvedResult) => {
handleSetupResult(instance, resolvedResult);
- }).catch((e) => {
- handleError(e, instance, 0);
+ }).catch((e2) => {
+ handleError(e2, instance, 0);
});
} else {
instance.asyncDep = setupResult;
@@ -4401,26 +4459,26 @@
parent.removeChild(child);
}
},
- createElement: (tag, isSVG, is, props) => {
+ createElement: (tag, isSVG, is, props2) => {
const el = isSVG ? doc.createElementNS(svgNS, tag) : doc.createElement(tag, is ? { is } : void 0);
- if (tag === "select" && props && props.multiple != null) {
- el.setAttribute("multiple", props.multiple);
+ if (tag === "select" && props2 && props2.multiple != null) {
+ el.setAttribute("multiple", props2.multiple);
}
return el;
},
- createText: (text) => doc.createTextNode(text),
- createComment: (text) => doc.createComment(text),
- setText: (node, text) => {
- node.nodeValue = text;
+ createText: (text2) => doc.createTextNode(text2),
+ createComment: (text2) => doc.createComment(text2),
+ setText: (node, text2) => {
+ node.nodeValue = text2;
},
- setElementText: (el, text) => {
- el.textContent = text;
+ setElementText: (el, text2) => {
+ el.textContent = text2;
},
parentNode: (node) => node.parentNode,
nextSibling: (node) => node.nextSibling,
querySelector: (selector) => doc.querySelector(selector),
- setScopeId(el, id) {
- el.setAttribute(id, "");
+ setScopeId(el, id2) {
+ el.setAttribute(id2, "");
},
cloneNode(el) {
const cloned = el.cloneNode(true);
@@ -4496,7 +4554,7 @@
} else if (isString(next)) {
if (prev !== next) {
const current = style.display;
- style.cssText = next;
+ style.cssText = normalizeRpx(next);
if ("_vod" in el) {
style.display = current;
}
@@ -4517,8 +4575,9 @@
const importantRE$1 = /\s*!important$/;
function setStyle$1(style, name, val) {
if (isArray(val)) {
- val.forEach((v) => setStyle$1(style, name, v));
+ val.forEach((v2) => setStyle$1(style, name, v2));
} else {
+ val = normalizeRpx(val);
if (name.startsWith("--")) {
style.setProperty(name, val);
} else {
@@ -4551,6 +4610,18 @@
}
return rawName;
}
+ const rpxRE = /\b([+-]?\d+(\.\d+)?)[r|u]px\b/g;
+ const normalizeRpx = (val) => {
+ if (typeof rpx2px !== "function") {
+ return val;
+ }
+ if (isString(val)) {
+ return val.replace(rpxRE, (a2, b) => {
+ return rpx2px(b) + "px";
+ });
+ }
+ return val;
+ };
const xlinkNS = "http://www.w3.org/1999/xlink";
function patchAttr(el, key, value, isSVG, instance) {
if (isSVG && key.startsWith("xlink:")) {
@@ -4560,11 +4631,11 @@
el.setAttributeNS(xlinkNS, key, value);
}
} else {
- const isBoolean = isSpecialBooleanAttr(key);
- if (value == null || isBoolean && value === false) {
+ const isBoolean2 = isSpecialBooleanAttr(key);
+ if (value == null || isBoolean2 && value === false) {
el.removeAttribute(key);
} else {
- el.setAttribute(key, isBoolean ? "" : value);
+ el.setAttribute(key, isBoolean2 ? "" : value);
}
}
}
@@ -4604,7 +4675,7 @@
}
try {
el[key] = value;
- } catch (e) {
+ } catch (e2) {
}
}
let _getNow = Date.now;
@@ -4617,11 +4688,11 @@
skipTimestampCheck = !!(ffMatch && Number(ffMatch[1]) <= 53);
}
let cachedNow = 0;
- const p = Promise.resolve();
+ const p$1 = Promise.resolve();
const reset = () => {
cachedNow = 0;
};
- const getNow = () => cachedNow || (p.then(reset), cachedNow = _getNow());
+ const getNow = () => cachedNow || (p$1.then(reset), cachedNow = _getNow());
function addEventListener(el, event, handler, options) {
el.addEventListener(event, handler, options);
}
@@ -4658,24 +4729,24 @@
return [hyphenate(name.slice(2)), options];
}
function createInvoker$1(initialValue, instance) {
- const invoker = (e) => {
- const timeStamp = e.timeStamp || _getNow();
+ const invoker = (e2) => {
+ const timeStamp = e2.timeStamp || _getNow();
if (skipTimestampCheck || timeStamp >= invoker.attached - 1) {
- callWithAsyncErrorHandling(patchStopImmediatePropagation(e, invoker.value), instance, 5, [e]);
+ callWithAsyncErrorHandling(patchStopImmediatePropagation(e2, invoker.value), instance, 5, [e2]);
}
};
invoker.value = initialValue;
invoker.attached = getNow();
return invoker;
}
- function patchStopImmediatePropagation(e, value) {
+ function patchStopImmediatePropagation(e2, value) {
if (isArray(value)) {
- const originalStop = e.stopImmediatePropagation;
- e.stopImmediatePropagation = () => {
- originalStop.call(e);
- e._stopped = true;
+ const originalStop = e2.stopImmediatePropagation;
+ e2.stopImmediatePropagation = () => {
+ originalStop.call(e2);
+ e2._stopped = true;
};
- return value.map((fn) => (e2) => !e2._stopped && fn(e2));
+ return value.map((fn) => (e3) => !e3._stopped && fn(e3));
} else {
return value;
}
@@ -4737,17 +4808,17 @@
}
const systemModifiers = ["ctrl", "shift", "alt", "meta"];
const modifierGuards = {
- stop: (e) => e.stopPropagation(),
- prevent: (e) => e.preventDefault(),
- self: (e) => e.target !== e.currentTarget,
- ctrl: (e) => !e.ctrlKey,
- shift: (e) => !e.shiftKey,
- alt: (e) => !e.altKey,
- meta: (e) => !e.metaKey,
- left: (e) => "button" in e && e.button !== 0,
- middle: (e) => "button" in e && e.button !== 1,
- right: (e) => "button" in e && e.button !== 2,
- exact: (e, modifiers) => systemModifiers.some((m) => e[`${m}Key`] && !modifiers.includes(m))
+ stop: (e2) => e2.stopPropagation(),
+ prevent: (e2) => e2.preventDefault(),
+ self: (e2) => e2.target !== e2.currentTarget,
+ ctrl: (e2) => !e2.ctrlKey,
+ shift: (e2) => !e2.shiftKey,
+ alt: (e2) => !e2.altKey,
+ meta: (e2) => !e2.metaKey,
+ left: (e2) => "button" in e2 && e2.button !== 0,
+ middle: (e2) => "button" in e2 && e2.button !== 1,
+ right: (e2) => "button" in e2 && e2.button !== 2,
+ exact: (e2, modifiers) => systemModifiers.some((m) => e2[`${m}Key`] && !modifiers.includes(m))
};
const withModifiers = (fn, modifiers) => {
return (event, ...args) => {
@@ -4759,6 +4830,44 @@
return fn(event, ...args);
};
};
+ const vShow = {
+ beforeMount(el, { value }, { transition }) {
+ el._vod = el.style.display === "none" ? "" : el.style.display;
+ if (transition && value) {
+ transition.beforeEnter(el);
+ } else {
+ setDisplay(el, value);
+ }
+ },
+ mounted(el, { value }, { transition }) {
+ if (transition && value) {
+ transition.enter(el);
+ }
+ },
+ updated(el, { value, oldValue }, { transition }) {
+ if (!value === !oldValue)
+ return;
+ if (transition) {
+ if (value) {
+ transition.beforeEnter(el);
+ setDisplay(el, true);
+ transition.enter(el);
+ } else {
+ transition.leave(el, () => {
+ setDisplay(el, false);
+ });
+ }
+ } else {
+ setDisplay(el, value);
+ }
+ },
+ beforeUnmount(el, { value }) {
+ setDisplay(el, value);
+ }
+ };
+ function setDisplay(el, value) {
+ el.style.display = value ? el._vod : "none";
+ }
const rendererOptions = extend({ patchProp, forcePatchProp }, nodeOps);
let renderer;
function ensureRenderer() {
@@ -4793,7 +4902,7 @@
return container;
}
var attrs = ["top", "left", "right", "bottom"];
- var inited;
+ var inited$1;
var elementComputedStyle = {};
var support;
function getSupport() {
@@ -4811,8 +4920,8 @@
function init() {
support = typeof support === "string" ? support : getSupport();
if (!support) {
- attrs.forEach(function(attr) {
- elementComputedStyle[attr] = 0;
+ attrs.forEach(function(attr2) {
+ elementComputedStyle[attr2] = 0;
});
return;
}
@@ -4841,9 +4950,9 @@
}
});
window.addEventListener("test", null, opts);
- } catch (e) {
+ } catch (e2) {
}
- function addChild(parent, attr) {
+ function addChild(parent, attr2) {
var a1 = document.createElement("div");
var a2 = document.createElement("div");
var a1Children = document.createElement("div");
@@ -4856,7 +4965,7 @@
height: "200px",
boxSizing: "border-box",
overflow: "hidden",
- paddingBottom: support + "(safe-area-inset-" + attr + ")"
+ paddingBottom: support + "(safe-area-inset-" + attr2 + ")"
};
setStyle2(a1, aStyle);
setStyle2(a2, aStyle);
@@ -4887,13 +4996,13 @@
a1.scrollTop = a2.scrollTop = MAX;
a1LastScrollTop = a1.scrollTop;
a2LastScrollTop = a2.scrollTop;
- attrChange(attr);
+ attrChange(attr2);
}
a1.addEventListener("scroll", onScroll, passiveEvents);
a2.addEventListener("scroll", onScroll, passiveEvents);
});
var computedStyle = getComputedStyle(a1);
- Object.defineProperty(elementComputedStyle, attr, {
+ Object.defineProperty(elementComputedStyle, attr2, {
configurable: true,
get: function() {
return parseFloat(computedStyle.paddingBottom);
@@ -4916,46 +5025,46 @@
});
document.body.appendChild(parentDiv);
parentReady();
- inited = true;
+ inited$1 = true;
}
- function getAttr(attr) {
- if (!inited) {
+ function getAttr(attr2) {
+ if (!inited$1) {
init();
}
- return elementComputedStyle[attr];
+ return elementComputedStyle[attr2];
}
var changeAttrs = [];
- function attrChange(attr) {
+ function attrChange(attr2) {
if (!changeAttrs.length) {
setTimeout(function() {
var style = {};
- changeAttrs.forEach(function(attr2) {
- style[attr2] = elementComputedStyle[attr2];
+ changeAttrs.forEach(function(attr3) {
+ style[attr3] = elementComputedStyle[attr3];
});
changeAttrs.length = 0;
- callbacks.forEach(function(callback) {
+ callbacks$1.forEach(function(callback) {
callback(style);
});
}, 0);
}
- changeAttrs.push(attr);
+ changeAttrs.push(attr2);
}
- var callbacks = [];
+ var callbacks$1 = [];
function onChange(callback) {
if (!getSupport()) {
return;
}
- if (!inited) {
+ if (!inited$1) {
init();
}
if (typeof callback === "function") {
- callbacks.push(callback);
+ callbacks$1.push(callback);
}
}
function offChange(callback) {
- var index = callbacks.indexOf(callback);
- if (index >= 0) {
- callbacks.splice(index, 1);
+ var index2 = callbacks$1.indexOf(callback);
+ if (index2 >= 0) {
+ callbacks$1.splice(index2, 1);
}
}
var safeAreaInsets = {
@@ -4978,6 +5087,8 @@
offChange
};
var out = safeAreaInsets;
+ const onEventPrevent = /* @__PURE__ */ withModifiers(() => {
+ }, ["prevent"]);
function getWindowOffset() {
const style = document.documentElement.style;
const top = parseInt(style.getPropertyValue("--window-top"));
@@ -5000,6 +5111,31 @@
function PolySymbol(name) {
return Symbol("[uni-app]: " + name);
}
+ function hasRpx(str) {
+ str = str + "";
+ return str.indexOf("rpx") !== -1 || str.indexOf("upx") !== -1;
+ }
+ function rpx2px$1(str, replace = false) {
+ if (replace) {
+ return rpx2pxWithReplace(str);
+ }
+ if (typeof str === "string") {
+ const res = parseInt(str) || 0;
+ if (hasRpx(str)) {
+ return uni.upx2px(res);
+ }
+ return res;
+ }
+ return str;
+ }
+ function rpx2pxWithReplace(str) {
+ if (!hasRpx(str)) {
+ return str;
+ }
+ return str.replace(/(\d+(\.\d+)?)[ru]px/g, (_a, b) => {
+ return uni.upx2px(parseFloat(b)) + "px";
+ });
+ }
const ICON_PATH_CANCEL = "M20.928 10.176l-4.928 4.928-4.928-4.928-0.896 0.896 4.928 4.928-4.928 4.928 0.896 0.896 4.928-4.928 4.928 4.928 0.896-0.896-4.928-4.928 4.928-4.928-0.896-0.896zM16 2.080q-3.776 0-7.040 1.888-3.136 1.856-4.992 4.992-1.888 3.264-1.888 7.040t1.888 7.040q1.856 3.136 4.992 4.992 3.264 1.888 7.040 1.888t7.040-1.888q3.136-1.856 4.992-4.992 1.888-3.264 1.888-7.040t-1.888-7.040q-1.856-3.136-4.992-4.992-3.264-1.888-7.040-1.888zM16 28.64q-3.424 0-6.4-1.728-2.848-1.664-4.512-4.512-1.728-2.976-1.728-6.4t1.728-6.4q1.664-2.848 4.512-4.512 2.976-1.728 6.4-1.728t6.4 1.728q2.848 1.664 4.512 4.512 1.728 2.976 1.728 6.4t-1.728 6.4q-1.664 2.848-4.512 4.512-2.976 1.728-6.4 1.728z";
const ICON_PATH_CLEAR = "M16 0q-4.352 0-8.064 2.176-3.616 2.144-5.76 5.76-2.176 3.712-2.176 8.064t2.176 8.064q2.144 3.616 5.76 5.76 3.712 2.176 8.064 2.176t8.064-2.176q3.616-2.144 5.76-5.76 2.176-3.712 2.176-8.064t-2.176-8.064q-2.144-3.616-5.76-5.76-3.712-2.176-8.064-2.176zM22.688 21.408q0.32 0.32 0.304 0.752t-0.336 0.736-0.752 0.304-0.752-0.32l-5.184-5.376-5.376 5.184q-0.32 0.32-0.752 0.304t-0.736-0.336-0.304-0.752 0.32-0.752l5.376-5.184-5.184-5.376q-0.32-0.32-0.304-0.752t0.336-0.752 0.752-0.304 0.752 0.336l5.184 5.376 5.376-5.184q0.32-0.32 0.752-0.304t0.752 0.336 0.304 0.752-0.336 0.752l-5.376 5.184 5.184 5.376z";
const ICON_PATH_DOWNLOAD = "M15.808 1.696q-3.776 0-7.072 1.984-3.2 1.888-5.088 5.152-1.952 3.392-1.952 7.36 0 3.776 1.952 7.072 1.888 3.2 5.088 5.088 3.296 1.952 7.072 1.952 3.968 0 7.36-1.952 3.264-1.888 5.152-5.088 1.984-3.296 1.984-7.072 0-4-1.984-7.36-1.888-3.264-5.152-5.152-3.36-1.984-7.36-1.984zM20.864 18.592l-3.776 4.928q-0.448 0.576-1.088 0.576t-1.088-0.576l-3.776-4.928q-0.448-0.576-0.24-0.992t0.944-0.416h2.976v-8.928q0-0.256 0.176-0.432t0.4-0.176h1.216q0.224 0 0.4 0.176t0.176 0.432v8.928h2.976q0.736 0 0.944 0.416t-0.24 0.992z";
@@ -5009,11 +5145,43 @@
const ICON_PATH_SUCCESS = "M15.808 0.16q-4.224 0-7.872 2.176-3.552 2.112-5.632 5.728-2.144 3.744-2.144 8.128 0 4.192 2.144 7.872 2.112 3.52 5.632 5.632 3.68 2.144 7.872 2.144 4.384 0 8.128-2.144 3.616-2.080 5.728-5.632 2.176-3.648 2.176-7.872 0-4.384-2.176-8.128-2.112-3.616-5.728-5.728-3.744-2.176-8.128-2.176zM24.832 11.328l-11.264 11.104q-0.032 0.032-0.112 0.032t-0.112-0.032l-5.216-5.376q-0.096-0.128 0-0.288l0.704-0.96q0.032-0.064 0.112-0.064t0.112 0.032l4.256 3.264q0.064 0.032 0.144 0.032t0.112-0.032l10.336-8.608q0.064-0.064 0.144-0.064t0.112 0.064l0.672 0.672q0.128 0.128 0 0.224z";
const ICON_PATH_WAITING = "M15.84 0.096q-4.224 0-7.872 2.176-3.552 2.112-5.632 5.728-2.144 3.744-2.144 8.128 0 4.192 2.144 7.872 2.112 3.52 5.632 5.632 3.68 2.144 7.872 2.144 4.384 0 8.128-2.144 3.616-2.080 5.728-5.632 2.176-3.648 2.176-7.872 0-4.384-2.176-8.128-2.112-3.616-5.728-5.728-3.744-2.176-8.128-2.176zM23.008 21.92l-0.512 0.896q-0.096 0.128-0.224 0.064l-8-3.808q-0.096-0.064-0.16-0.128-0.128-0.096-0.128-0.288l0.512-12.096q0-0.064 0.048-0.112t0.112-0.048h1.376q0.064 0 0.112 0.048t0.048 0.112l0.448 10.848 6.304 4.256q0.064 0.064 0.080 0.128t-0.016 0.128z";
const ICON_PATH_WARN = "M15.808 0.16q-4.224 0-7.872 2.176-3.552 2.112-5.632 5.728-2.144 3.744-2.144 8.128 0 4.192 2.144 7.872 2.112 3.52 5.632 5.632 3.68 2.144 7.872 2.144 4.384 0 8.128-2.144 3.616-2.080 5.728-5.632 2.176-3.648 2.176-7.872 0-4.384-2.176-8.128-2.112-3.616-5.728-5.728-3.744-2.176-8.128-2.176zM15.136 8.672h1.728q0.128 0 0.224 0.096t0.096 0.256l-0.384 10.24q0 0.064-0.048 0.112t-0.112 0.048h-1.248q-0.096 0-0.144-0.048t-0.048-0.112l-0.384-10.24q0-0.16 0.096-0.256t0.224-0.096zM16 23.328q-0.48 0-0.832-0.352t-0.352-0.848 0.352-0.848 0.832-0.352 0.832 0.352 0.352 0.848-0.352 0.848-0.832 0.352z";
+ function createSvgIconVNode(path, color = "#000", size2 = 27) {
+ return createVNode("svg", {
+ width: size2,
+ height: size2,
+ viewBox: "0 0 32 32"
+ }, [
+ createVNode("path", {
+ d: path,
+ fill: color
+ }, null, 8, ["d", "fill"])
+ ], 8, ["width", "height"]);
+ }
function useCurrentPageId() {
{
return parseInt(window.__id__);
}
}
+ function getCurrentPage() {
+ const pages = getCurrentPages();
+ const len = pages.length;
+ if (len) {
+ return pages[len - 1];
+ }
+ }
+ function getCurrentPageMeta() {
+ const page = getCurrentPage();
+ if (page) {
+ return page.$page.meta;
+ }
+ }
+ function getCurrentPageId() {
+ const meta = getCurrentPageMeta();
+ if (meta) {
+ return meta.id;
+ }
+ return -1;
+ }
function disableScrollListener(evt) {
evt.preventDefault();
}
@@ -5072,6 +5240,52 @@
ticking = true;
};
}
+ function getRealRoute(fromRoute, toRoute) {
+ if (toRoute.indexOf("/") === 0) {
+ return toRoute;
+ }
+ if (toRoute.indexOf("./") === 0) {
+ return getRealRoute(fromRoute, toRoute.substr(2));
+ }
+ const toRouteArray = toRoute.split("/");
+ const toRouteLength = toRouteArray.length;
+ let i = 0;
+ for (; i < toRouteLength && toRouteArray[i] === ".."; i++) {
+ }
+ toRouteArray.splice(0, i);
+ toRoute = toRouteArray.join("/");
+ const fromRouteArray = fromRoute.length > 0 ? fromRoute.split("/") : [];
+ fromRouteArray.splice(fromRouteArray.length - i - 1, i + 1);
+ return "/" + fromRouteArray.concat(toRouteArray).join("/");
+ }
+ const callbacks = {};
+ function createCallbacks(namespace) {
+ let scopedCallbacks = callbacks[namespace];
+ if (!scopedCallbacks) {
+ scopedCallbacks = {
+ id: 1,
+ callbacks: Object.create(null)
+ };
+ callbacks[namespace] = scopedCallbacks;
+ }
+ return {
+ get(id2) {
+ return scopedCallbacks.callbacks[id2];
+ },
+ pop(id2) {
+ const callback = scopedCallbacks.callbacks[id2];
+ if (callback) {
+ delete scopedCallbacks.callbacks[id2];
+ }
+ return callback;
+ },
+ push(callback) {
+ const id2 = scopedCallbacks.id++;
+ scopedCallbacks.callbacks[id2] = callback;
+ return id2;
+ }
+ };
+ }
const isClickEvent = (val) => val.type === "click";
function $nne(evt) {
const { currentTarget } = evt;
@@ -5177,8 +5391,8 @@
const ACTION_TYPE_SET_TEXT = 8;
const ACTION_TYPE_EVENT = 20;
class UniNode {
- constructor(id, tag) {
- this.id = id;
+ constructor(id2, tag) {
+ this.id = id2;
this.tag = tag;
}
init(nodeJson) {
@@ -5186,8 +5400,8 @@
this.$.textContent = nodeJson.t || "";
}
}
- setText(text) {
- this.$.textContent = text;
+ setText(text2) {
+ this.$.textContent = text2;
}
insert(parentNodeId, refNodeId, nodeJson) {
this.init(nodeJson);
@@ -5205,14 +5419,14 @@
}
}
class UniComment extends UniNode {
- constructor(id) {
- super(id, "#comment");
+ constructor(id2) {
+ super(id2, "#comment");
this.$ = document.createComment("");
}
}
- class UniText extends UniNode {
- constructor(id) {
- super(id, "#text");
+ class UniTextNode extends UniNode {
+ constructor(id2) {
+ super(id2, "#text");
this.$ = document.createTextNode("");
}
}
@@ -5226,7 +5440,7 @@
if (value === "") {
el.removeAttribute("style");
} else {
- style.cssText = value;
+ style.cssText = rpx2px$1(value, true);
}
} else {
for (const key in value) {
@@ -5237,8 +5451,9 @@
const importantRE = /\s*!important$/;
function setStyle(style, name, val) {
if (isArray(val)) {
- val.forEach((v) => setStyle(style, name, v));
+ val.forEach((v2) => setStyle(style, name, v2));
} else {
+ val = rpx2px$1(val, true);
if (name.startsWith("--")) {
style.setProperty(name, val);
} else {
@@ -5291,11 +5506,11 @@
el.addEventListener(type, el.__listeners[type], options);
}
}
- function createInvoker(id, flag, options) {
+ function createInvoker(id2, flag, options) {
const invoker = (evt) => {
const event = $nne(evt);
event.type = normalizeEventType(evt.type, options);
- UniViewJSBridge.publishHandler(VD_SYNC, [[ACTION_TYPE_EVENT, id, event]]);
+ UniViewJSBridge.publishHandler(VD_SYNC, [[ACTION_TYPE_EVENT, id2, event]]);
};
if (!flag) {
return invoker;
@@ -5316,10 +5531,10 @@
return modifiers;
}
class UniElement extends UniNode {
- constructor(id, element) {
- super(id, element.tagName);
+ constructor(id2, element) {
+ super(id2, element.tagName);
this.$ = element;
- this.$.__id = id;
+ this.$.__id = id2;
this.$.__listeners = Object.create(null);
}
init(nodeJson) {
@@ -5478,14 +5693,235 @@
}
}
class UniViewElement extends UniHoverElement {
- constructor(id) {
- super(id, document.createElement("uni-view"));
+ constructor(id2) {
+ super(id2, document.createElement("uni-view"));
}
}
- var button = "uni-button {\n position: relative;\n display: block;\n margin-left: auto;\n margin-right: auto;\n padding-left: 14px;\n padding-right: 14px;\n box-sizing: border-box;\n font-size: 18px;\n text-align: center;\n text-decoration: none;\n line-height: 2.55555556;\n border-radius: 5px;\n -webkit-tap-highlight-color: transparent;\n overflow: hidden;\n color: #000000;\n background-color: #f8f8f8;\n cursor: pointer;\n}\n\nuni-button[hidden] {\n display: none !important;\n}\n\nuni-button:after {\n content: ' ';\n width: 200%;\n height: 200%;\n position: absolute;\n top: 0;\n left: 0;\n border: 1px solid rgba(0, 0, 0, 0.2);\n transform: scale(0.5);\n transform-origin: 0 0;\n box-sizing: border-box;\n border-radius: 10px;\n}\n\nuni-button[native] {\n padding-left: 0;\n padding-right: 0;\n}\n\nuni-button[native] .uni-button-cover-view-wrapper {\n border: inherit;\n border-color: inherit;\n border-radius: inherit;\n background-color: inherit;\n}\n\nuni-button[native] .uni-button-cover-view-inner {\n padding-left: 14px;\n padding-right: 14px;\n}\n\nuni-button uni-cover-view {\n line-height: inherit;\n white-space: inherit;\n}\n\nuni-button[type='default'] {\n color: #000000;\n background-color: #f8f8f8;\n}\n\nuni-button[type='primary'] {\n color: #ffffff;\n background-color: #007aff;\n}\n\nuni-button[type='warn'] {\n color: #ffffff;\n background-color: #e64340;\n}\n\nuni-button[disabled] {\n color: rgba(255, 255, 255, 0.6);\n cursor: not-allowed;\n}\n\nuni-button[disabled][type='default'],\nuni-button[disabled]:not([type]) {\n color: rgba(0, 0, 0, 0.3);\n background-color: #f7f7f7;\n}\n\nuni-button[disabled][type='primary'] {\n background-color: rgba(0, 122, 255, 0.6);\n}\n\nuni-button[disabled][type='warn'] {\n background-color: #ec8b89;\n}\n\nuni-button[type='primary'][plain] {\n color: #007aff;\n border: 1px solid #007aff;\n background-color: transparent;\n}\n\nuni-button[type='primary'][plain][disabled] {\n color: rgba(0, 0, 0, 0.2);\n border-color: rgba(0, 0, 0, 0.2);\n}\n\nuni-button[type='primary'][plain]:after {\n border-width: 0;\n}\n\nuni-button[type='default'][plain] {\n color: #353535;\n border: 1px solid #353535;\n background-color: transparent;\n}\n\nuni-button[type='default'][plain][disabled] {\n color: rgba(0, 0, 0, 0.2);\n border-color: rgba(0, 0, 0, 0.2);\n}\n\nuni-button[type='default'][plain]:after {\n border-width: 0;\n}\n\nuni-button[plain] {\n color: #353535;\n border: 1px solid #353535;\n background-color: transparent;\n}\n\nuni-button[plain][disabled] {\n color: rgba(0, 0, 0, 0.2);\n border-color: rgba(0, 0, 0, 0.2);\n}\n\nuni-button[plain]:after {\n border-width: 0;\n}\n\nuni-button[plain][native] .uni-button-cover-view-inner {\n padding: 0;\n}\n\nuni-button[type='warn'][plain] {\n color: #e64340;\n border: 1px solid #e64340;\n background-color: transparent;\n}\n\nuni-button[type='warn'][plain][disabled] {\n color: rgba(0, 0, 0, 0.2);\n border-color: rgba(0, 0, 0, 0.2);\n}\n\nuni-button[type='warn'][plain]:after {\n border-width: 0;\n}\n\nuni-button[size='mini'] {\n display: inline-block;\n line-height: 2.3;\n font-size: 13px;\n padding: 0 1.34em;\n}\n\nuni-button[size='mini'][native] {\n padding: 0;\n}\n\nuni-button[size='mini'][native] .uni-button-cover-view-inner {\n padding: 0 1.34em;\n}\n\nuni-button[loading]:not([disabled]) {\n cursor: progress;\n}\n\nuni-button[loading]:before {\n content: ' ';\n display: inline-block;\n width: 18px;\n height: 18px;\n vertical-align: middle;\n animation: uni-loading 1s steps(12, end) infinite;\n background-size: 100%;\n}\n\nuni-button[loading][type='primary'] {\n color: rgba(255, 255, 255, 0.6);\n background-color: #0062cc;\n}\n\nuni-button[loading][type='primary'][plain] {\n color: #007aff;\n background-color: transparent;\n}\n\nuni-button[loading][type='default'] {\n color: rgba(0, 0, 0, 0.6);\n background-color: #dedede;\n}\n\nuni-button[loading][type='default'][plain] {\n color: #353535;\n background-color: transparent;\n}\n\nuni-button[loading][type='warn'] {\n color: rgba(255, 255, 255, 0.6);\n background-color: #ce3c39;\n}\n\nuni-button[loading][type='warn'][plain] {\n color: #e64340;\n background-color: transparent;\n}\n\nuni-button[loading][native]:before {\n content: none;\n}\n\n.button-hover {\n color: rgba(0, 0, 0, 0.6);\n background-color: #dedede;\n}\n\n.button-hover[plain] {\n color: rgba(53, 53, 53, 0.6);\n border-color: rgba(53, 53, 53, 0.6);\n background-color: transparent;\n}\n\n.button-hover[type='primary'] {\n color: rgba(255, 255, 255, 0.6);\n background-color: #0062cc;\n}\n\n.button-hover[type='primary'][plain] {\n color: rgba(26, 173, 25, 0.6);\n border-color: rgba(26, 173, 25, 0.6);\n background-color: transparent;\n}\n\n.button-hover[type='default'] {\n color: rgba(0, 0, 0, 0.6);\n background-color: #dedede;\n}\n\n.button-hover[type='default'][plain] {\n color: rgba(53, 53, 53, 0.6);\n border-color: rgba(53, 53, 53, 0.6);\n background-color: transparent;\n}\n\n.button-hover[type='warn'] {\n color: rgba(255, 255, 255, 0.6);\n background-color: #ce3c39;\n}\n\n.button-hover[type='warn'][plain] {\n color: rgba(230, 67, 64, 0.6);\n border-color: rgba(230, 67, 64, 0.6);\n background-color: transparent;\n}\n";
+ var subscriber = {
+ mounted() {
+ this._toggleListeners("subscribe", this.id);
+ this.$watch("id", (newId, oldId) => {
+ this._toggleListeners("unsubscribe", oldId, true);
+ this._toggleListeners("subscribe", newId, true);
+ });
+ },
+ beforeDestroy() {
+ this._toggleListeners("unsubscribe", this.id);
+ if (this._contextId) {
+ this._toggleListeners("unsubscribe", this._contextId);
+ }
+ },
+ methods: {
+ _toggleListeners(type, id2, watch2) {
+ if (watch2 && !id2) {
+ return;
+ }
+ if (!isFunction(this._handleSubscribe)) {
+ return;
+ }
+ UniViewJSBridge[type](this.$page.id + "-" + this.$options.name.replace(/VUni([A-Z])/, "$1").toLowerCase() + "-" + id2, this._handleSubscribe);
+ },
+ _getContextInfo() {
+ const id2 = `context-${this._uid}`;
+ if (!this._contextId) {
+ this._toggleListeners("subscribe", id2);
+ this._contextId = id2;
+ }
+ return {
+ name: this.$options.name.replace(/VUni([A-Z])/, "$1").toLowerCase(),
+ id: id2,
+ page: this.$page.id
+ };
+ }
+ }
+ };
+ function throttle(fn, wait) {
+ let last = 0;
+ let timeout;
+ let waitCallback;
+ const newFn = function(...arg) {
+ const now = Date.now();
+ clearTimeout(timeout);
+ waitCallback = () => {
+ waitCallback = null;
+ last = now;
+ fn.apply(this, arg);
+ };
+ if (now - last < wait) {
+ timeout = setTimeout(waitCallback, wait - (now - last));
+ return;
+ }
+ waitCallback();
+ };
+ newFn.cancel = function() {
+ clearTimeout(timeout);
+ waitCallback = null;
+ };
+ newFn.flush = function() {
+ clearTimeout(timeout);
+ waitCallback && waitCallback();
+ };
+ return newFn;
+ }
+ const _sfc_main = {
+ name: "Audio",
+ mixins: [subscriber],
+ props: {
+ id: {
+ type: String,
+ default: ""
+ },
+ src: {
+ type: String,
+ default: ""
+ },
+ loop: {
+ type: [Boolean, String],
+ default: false
+ },
+ controls: {
+ type: [Boolean, String],
+ default: false
+ },
+ poster: {
+ type: String,
+ default: ""
+ },
+ name: {
+ type: String,
+ default: ""
+ },
+ author: {
+ type: String,
+ default: ""
+ }
+ },
+ data() {
+ return {
+ playing: false,
+ currentTime: this.getTime(0)
+ };
+ },
+ watch: {
+ src(val) {
+ if (this.$refs.audio) {
+ this.$refs.audio.src = this.$getRealPath(val);
+ }
+ }
+ },
+ mounted() {
+ const audio2 = this.$refs.audio;
+ audio2.addEventListener("error", ($event) => {
+ this.playing = false;
+ this.$trigger("error", $event, {});
+ });
+ audio2.addEventListener("play", ($event) => {
+ this.playing = true;
+ this.$trigger("play", $event, {});
+ });
+ audio2.addEventListener("pause", ($event) => {
+ this.playing = false;
+ this.$trigger("pause", $event, {});
+ });
+ audio2.addEventListener("ended", ($event) => {
+ this.playing = false;
+ this.$trigger("ended", $event, {});
+ });
+ audio2.addEventListener("timeupdate", ($event) => {
+ var currentTime = audio2.currentTime;
+ this.currentTime = this.getTime(currentTime);
+ var duration = audio2.duration;
+ this.$trigger("timeupdate", $event, {
+ currentTime,
+ duration
+ });
+ });
+ audio2.src = this.$getRealPath(this.src);
+ },
+ methods: {
+ _handleSubscribe({
+ type,
+ data = {}
+ }) {
+ var audio2 = this.$refs.audio;
+ switch (type) {
+ case "setSrc":
+ audio2.src = this.$getRealPath(data.src);
+ this.$emit("update:src", data.src);
+ break;
+ case "play":
+ audio2.play();
+ break;
+ case "pause":
+ audio2.pause();
+ break;
+ case "seek":
+ audio2.currentTime = data.position;
+ break;
+ }
+ },
+ trigger() {
+ if (this.playing) {
+ this.$refs.audio.pause();
+ } else {
+ this.$refs.audio.play();
+ }
+ },
+ getTime(time) {
+ var h2 = Math.floor(time / 3600);
+ var m = Math.floor(time % 3600 / 60);
+ var s = Math.floor(time % 3600 % 60);
+ h2 = (h2 < 10 ? "0" : "") + h2;
+ m = (m < 10 ? "0" : "") + m;
+ s = (s < 10 ? "0" : "") + s;
+ var str = m + ":" + s;
+ if (h2 !== "00") {
+ str = h2 + ":" + str;
+ }
+ return str;
+ }
+ }
+ };
+ const _hoisted_1 = { class: "uni-audio-default" };
+ const _hoisted_2 = { class: "uni-audio-right" };
+ const _hoisted_3 = { class: "uni-audio-time" };
+ const _hoisted_4 = { class: "uni-audio-info" };
+ const _hoisted_5 = { class: "uni-audio-name" };
+ const _hoisted_6 = { class: "uni-audio-author" };
+ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
+ return openBlock(), createBlock("uni-audio", mergeProps({
+ id: $props.id,
+ controls: !!$props.controls
+ }, _ctx.$attrs), [
+ createVNode("audio", {
+ ref: "audio",
+ loop: $props.loop,
+ style: { "display": "none" }
+ }, null, 8, ["loop"]),
+ createVNode("div", _hoisted_1, [
+ createVNode("div", {
+ style: "background-image: url(" + _ctx.$getRealPath($props.poster) + ");",
+ class: "uni-audio-left"
+ }, [
+ createVNode("div", {
+ class: [{ play: !$data.playing, pause: $data.playing }, "uni-audio-button"],
+ onClick: _cache[1] || (_cache[1] = (...args) => $options.trigger && $options.trigger(...args))
+ }, null, 2)
+ ], 4),
+ createVNode("div", _hoisted_2, [
+ createVNode("div", _hoisted_3, toDisplayString($data.currentTime), 1),
+ createVNode("div", _hoisted_4, [
+ createVNode("div", _hoisted_5, toDisplayString($props.name), 1),
+ createVNode("div", _hoisted_6, toDisplayString($props.author), 1)
+ ])
+ ])
+ ])
+ ], 16, ["id", "controls"]);
+ }
+ _sfc_main.render = _sfc_render;
function converPx(value) {
if (/^-?\d+[ur]px$/i.test(value)) {
- return value.replace(/(^-?\d+)[ur]px$/i, (text, num) => {
+ return value.replace(/(^-?\d+)[ur]px$/i, (text2, num) => {
return `${uni.upx2px(parseFloat(num))}px`;
});
} else if (/^-?[\d\.]+$/.test(value)) {
@@ -5494,8 +5930,8 @@
return value || "";
}
function converType(type) {
- return type.replace(/[A-Z]/g, (text) => {
- return `-${text.toLowerCase()}`;
+ return type.replace(/[A-Z]/g, (text2) => {
+ return `-${text2.toLowerCase()}`;
}).replace("webkit", "-webkit");
}
function getStyle(action) {
@@ -5559,18 +5995,18 @@
if (!animation2 || !animation2.actions || !animation2.actions.length) {
return;
}
- let index = 0;
+ let index2 = 0;
const actions = animation2.actions;
const length = animation2.actions.length;
function animate() {
- const action = actions[index];
+ const action = actions[index2];
const transition = action.option.transition;
const style = getStyle(action);
Object.keys(style).forEach((key) => {
context.$el.style[key] = style[key];
});
- index += 1;
- if (index < length) {
+ index2 += 1;
+ if (index2 < length) {
setTimeout(animate, transition.duration + transition.delay);
}
}
@@ -5593,8 +6029,8 @@
}
};
const defineBuiltInComponent = (options) => {
- const { props, mixins } = options;
- if (!props || !props.animation) {
+ const { props: props2, mixins } = options;
+ if (!props2 || !props2.animation) {
(mixins || (options.mixins = [])).push(animation);
}
return defineSystemComponent(options);
@@ -5623,7 +6059,7 @@
default: 400
}
};
- function useHover(props) {
+ function useHover(props2) {
const hovering = ref(false);
let hoverTouch = false;
let hoverStartTimer;
@@ -5633,20 +6069,20 @@
clearTimeout(hoverStayTimer);
hoverStayTimer = setTimeout(() => {
hovering.value = false;
- }, parseInt(props.hoverStayTime));
+ }, parseInt(props2.hoverStayTime));
});
}
function onTouchstartPassive(evt) {
if (evt._hoverPropagationStopped) {
return;
}
- if (!props.hoverClass || props.hoverClass === "none" || props.disabled) {
+ if (!props2.hoverClass || props2.hoverClass === "none" || props2.disabled) {
return;
}
if (evt.touches.length > 1) {
return;
}
- if (props.hoverStopPropagation) {
+ if (props2.hoverStopPropagation) {
evt._hoverPropagationStopped = true;
}
hoverTouch = true;
@@ -5655,7 +6091,7 @@
if (!hoverTouch) {
hoverReset();
}
- }, parseInt(props.hoverStartTime));
+ }, parseInt(props2.hoverStartTime));
}
function onTouchend() {
hoverTouch = false;
@@ -5677,12 +6113,12 @@
}
};
}
- function useBooleanAttr(props, keys) {
+ function useBooleanAttr(props2, keys) {
if (isString(keys)) {
keys = [keys];
}
return keys.reduce((res, key) => {
- if (props[key]) {
+ if (props2[key]) {
res[key] = true;
}
return res;
@@ -5691,21 +6127,136 @@
function withWebEvent(fn) {
return fn.__wwe = true, fn;
}
+ function useCustomEvent(ref2, emit2) {
+ return (name, evt, detail) => {
+ if (ref2.value) {
+ emit2(name, normalizeCustomEvent(name, evt, ref2.value, detail || {}));
+ }
+ };
+ }
+ function useNativeEvent(emit2) {
+ return (name, evt) => {
+ emit2(name, createNativeEvent(evt));
+ };
+ }
+ function normalizeCustomEvent(name, domEvt, el, detail) {
+ const target = normalizeTarget(el);
+ return {
+ type: detail.type || name,
+ timeStamp: domEvt.timeStamp || 0,
+ target,
+ currentTarget: target,
+ detail
+ };
+ }
const uniFormKey = PolySymbol("uniForm");
+ var Form = /* @__PURE__ */ defineBuiltInComponent({
+ name: "Form",
+ setup(_props, {
+ slots,
+ emit: emit2
+ }) {
+ provideForm(emit2);
+ return () => createVNode("uni-form", null, {
+ default: () => [createVNode("span", null, [slots.default && slots.default()])]
+ });
+ }
+ });
+ function provideForm(emit2) {
+ const fields = [];
+ provide(uniFormKey, {
+ addField(field) {
+ fields.push(field);
+ },
+ removeField(field) {
+ fields.splice(fields.indexOf(field), 1);
+ },
+ submit() {
+ emit2("submit", {
+ detail: {
+ value: fields.reduce((res, field) => {
+ if (field.submit) {
+ const [name, value] = field.submit();
+ name && (res[name] = value);
+ }
+ return res;
+ }, Object.create(null))
+ }
+ });
+ },
+ reset() {
+ fields.forEach((field) => field.reset && field.reset());
+ emit2("reset");
+ }
+ });
+ return fields;
+ }
const uniLabelKey = PolySymbol("uniLabel");
- function useListeners(props, listeners) {
- _addListeners(props.id, listeners);
- watch(() => props.id, (newId, oldId) => {
+ const props$o = {
+ for: {
+ type: String,
+ default: ""
+ }
+ };
+ var Label = /* @__PURE__ */ defineBuiltInComponent({
+ name: "Label",
+ props: props$o,
+ setup(props2, {
+ slots
+ }) {
+ const pageId2 = useCurrentPageId();
+ const handlers = useProvideLabel();
+ const pointer = computed$1(() => props2.for || slots.default && slots.default.length);
+ const _onClick = withWebEvent(($event) => {
+ const EventTarget = $event.target;
+ let stopPropagation = /^uni-(checkbox|radio|switch)-/.test(EventTarget.className);
+ if (!stopPropagation) {
+ stopPropagation = /^uni-(checkbox|radio|switch|button)$|^(svg|path)$/i.test(EventTarget.tagName);
+ }
+ if (stopPropagation) {
+ return;
+ }
+ if (props2.for) {
+ UniViewJSBridge.emit("uni-label-click-" + pageId2 + "-" + props2.for, $event, true);
+ } else {
+ handlers[0]($event, true);
+ }
+ });
+ return () => createVNode("uni-label", {
+ "class": {
+ "uni-label-pointer": pointer
+ },
+ "onClick": _onClick
+ }, {
+ default: () => [slots.default && slots.default()]
+ }, 8, ["class", "onClick"]);
+ }
+ });
+ function useProvideLabel() {
+ const handlers = [];
+ provide(uniLabelKey, {
+ addHandler(handler) {
+ handlers.push(handler);
+ },
+ removeHandler(handler) {
+ handlers.splice(handlers.indexOf(handler), 1);
+ }
+ });
+ return handlers;
+ }
+ function useListeners$1(props2, listeners) {
+ _addListeners(props2.id, listeners);
+ watch(() => props2.id, (newId, oldId) => {
_removeListeners(oldId, listeners, true);
_addListeners(newId, listeners, true);
});
onUnmounted(() => {
- _removeListeners(props.id, listeners);
+ _removeListeners(props2.id, listeners);
});
}
- function _addListeners(id, listeners, watch2) {
+ function _addListeners(id2, listeners, watch2) {
const pageId2 = useCurrentPageId();
- if (watch2 && !id) {
+ if (watch2 && !id2) {
return;
}
if (!isPlainObject(listeners)) {
@@ -5714,20 +6265,20 @@
Object.keys(listeners).forEach((name) => {
if (watch2) {
if (name.indexOf("@") !== 0 && name.indexOf("uni-") !== 0) {
- UniViewJSBridge.on(`uni-${name}-${pageId2}-${id}`, listeners[name]);
+ UniViewJSBridge.on(`uni-${name}-${pageId2}-${id2}`, listeners[name]);
}
} else {
if (name.indexOf("uni-") === 0) {
UniViewJSBridge.on(name, listeners[name]);
- } else if (id) {
- UniViewJSBridge.on(`uni-${name}-${pageId2}-${id}`, listeners[name]);
+ } else if (id2) {
+ UniViewJSBridge.on(`uni-${name}-${pageId2}-${id2}`, listeners[name]);
}
}
});
}
- function _removeListeners(id, listeners, watch2) {
+ function _removeListeners(id2, listeners, watch2) {
const pageId2 = useCurrentPageId();
- if (watch2 && !id) {
+ if (watch2 && !id2) {
return;
}
if (!isPlainObject(listeners)) {
@@ -5736,13 +6287,13 @@
Object.keys(listeners).forEach((name) => {
if (watch2) {
if (name.indexOf("@") !== 0 && name.indexOf("uni-") !== 0) {
- UniViewJSBridge.off(`uni-${name}-${pageId2}-${id}`, listeners[name]);
+ UniViewJSBridge.off(`uni-${name}-${pageId2}-${id2}`, listeners[name]);
}
} else {
if (name.indexOf("uni-") === 0) {
UniViewJSBridge.off(name, listeners[name]);
- } else if (id) {
- UniViewJSBridge.off(`uni-${name}-${pageId2}-${id}`, listeners[name]);
+ } else if (id2) {
+ UniViewJSBridge.off(`uni-${name}-${pageId2}-${id2}`, listeners[name]);
}
}
});
@@ -5787,7 +6338,7 @@
default: false
}
},
- setup(props, {
+ setup(props2, {
slots
}) {
const rootRef = ref(null);
@@ -5798,18 +6349,18 @@
const {
hovering,
binding
- } = useHover(props);
+ } = useHover(props2);
const {
- t
+ t: t2
} = useI18n();
- const onClick = withWebEvent((e, isLabelClick) => {
- if (props.disabled) {
- return e.stopImmediatePropagation();
+ const onClick = withWebEvent((e2, isLabelClick) => {
+ if (props2.disabled) {
+ return e2.stopImmediatePropagation();
}
if (isLabelClick) {
rootRef.value.click();
}
- const formType = props.formType;
+ const formType = props2.formType;
if (formType) {
if (!uniForm) {
return;
@@ -5821,8 +6372,8 @@
}
return;
}
- if (props.openType === "feedback") {
- openFeedback(t("uni.button.feedback.title"), t("uni.button.feedback.send"));
+ if (props2.openType === "feedback") {
+ openFeedback(t2("uni.button.feedback.title"), t2("uni.button.feedback.send"));
}
});
const uniLabel = inject(uniLabelKey, false);
@@ -5832,13 +6383,13 @@
uniLabel.removeHandler(onClick);
});
}
- useListeners(props, {
+ useListeners$1(props2, {
"label-click": onClick
});
return () => {
- const hoverClass = props.hoverClass;
- const booleanAttrs = useBooleanAttr(props, "disabled");
- const loadingAttrs = useBooleanAttr(props, "loading");
+ const hoverClass = props2.hoverClass;
+ const booleanAttrs = useBooleanAttr(props2, "disabled");
+ const loadingAttrs = useBooleanAttr(props2, "loading");
const hasHoverClass = hoverClass && hoverClass !== "none";
return createVNode("uni-button", mergeProps({
"ref": rootRef,
@@ -5870,152 +6421,8409 @@
});
feedback.show("slide-in-right");
}
- {
- plusReady(() => {
- plus.os.name === "Android";
- plus.os.version || "";
- });
- document.addEventListener("keyboardchange", function(event) {
- }, false);
+ function getBaseSystemInfo() {
+ if (typeof __SYSTEM_INFO__ !== "undefined") {
+ return window.__SYSTEM_INFO__;
+ }
+ const { resolutionWidth } = plus.screen.getCurrentSize();
+ return {
+ platform: (plus.os.name || "").toLowerCase(),
+ pixelRatio: plus.screen.scale,
+ windowWidth: Math.round(resolutionWidth)
+ };
}
- const INFO_COLOR = "#10aeff";
- const WARN_COLOR = "#f76260";
- const GREY_COLOR = "#b2b2b2";
- const CANCEL_COLOR = "#f43530";
- ({
- success: {
- d: ICON_PATH_SUCCESS,
- c: PRIMARY_COLOR
- },
- success_no_circle: {
- d: ICON_PATH_SUCCESS_NO_CIRCLE,
- c: PRIMARY_COLOR
+ function getRealPath(filepath) {
+ if (filepath.indexOf("//") === 0) {
+ return "https:" + filepath;
+ }
+ if (SCHEME_RE.test(filepath) || DATA_RE.test(filepath)) {
+ return filepath;
+ }
+ if (isSystemURL(filepath)) {
+ return "file://" + normalizeLocalPath(filepath);
+ }
+ const wwwPath = "file://" + normalizeLocalPath("_www");
+ if (filepath.indexOf("/") === 0) {
+ if (filepath.startsWith("/storage/") || filepath.includes("/Containers/Data/Application/")) {
+ return "file://" + filepath;
+ }
+ return wwwPath + filepath;
+ }
+ if (filepath.indexOf("../") === 0 || filepath.indexOf("./") === 0) {
+ if (typeof __id__ === "string") {
+ return wwwPath + getRealRoute("/" + __id__, filepath);
+ } else {
+ const pages = getCurrentPages();
+ if (pages.length) {
+ return wwwPath + getRealRoute("/" + pages[pages.length - 1].route, filepath);
+ }
+ }
+ }
+ return filepath;
+ }
+ const normalizeLocalPath = cacheStringFunction((filepath) => {
+ return plus.io.convertLocalFileSystemURL(filepath).replace(/^\/?apps\//, "/android_asset/apps/").replace(/\/$/, "");
+ });
+ function isSystemURL(filepath) {
+ if (filepath.indexOf("_www") === 0 || filepath.indexOf("_doc") === 0 || filepath.indexOf("_documents") === 0 || filepath.indexOf("_downloads") === 0) {
+ return true;
+ }
+ return false;
+ }
+ function saveImage(base64, dirname, callback) {
+ }
+ function getSameOriginUrl(url) {
+ return Promise.resolve(url);
+ }
+ var ResizeSensor = /* @__PURE__ */ defineBuiltInComponent({
+ name: "ResizeSensor",
+ props: {
+ initial: {
+ type: Boolean,
+ default: false
+ }
},
- info: {
+ emits: ["resize"],
+ setup(props2, {
+ emit: emit2
+ }) {
+ const rootRef = ref(null);
+ const reset2 = useResizeSensorReset(rootRef);
+ const update = useResizeSensorUpdate(rootRef, emit2, reset2);
+ useResizeSensorLifecycle(rootRef, props2, update, reset2);
+ return () => createVNode("uni-resize-sensor", {
+ "ref": rootRef,
+ "onAnimationstartOnce": update
+ }, {
+ default: () => [createVNode("div", {
+ "onScroll": update
+ }, [createVNode("div", null, null)], 40, ["onScroll"]), createVNode("div", {
+ "onScroll": update
+ }, [createVNode("div", null, null)], 40, ["onScroll"])],
+ _: 1
+ }, 8, ["onAnimationstartOnce"]);
+ }
+ });
+ function useResizeSensorUpdate(rootRef, emit2, reset2) {
+ const size2 = reactive({
+ width: -1,
+ height: -1
+ });
+ watch(() => extend({}, size2), (value) => emit2("resize", value));
+ return () => {
+ const rootEl = rootRef.value;
+ size2.width = rootEl.offsetWidth;
+ size2.height = rootEl.offsetHeight;
+ reset2();
+ };
+ }
+ function useResizeSensorReset(rootRef) {
+ return () => {
+ const {
+ firstElementChild,
+ lastElementChild
+ } = rootRef.value;
+ firstElementChild.scrollLeft = 1e5;
+ firstElementChild.scrollTop = 1e5;
+ lastElementChild.scrollLeft = 1e5;
+ lastElementChild.scrollTop = 1e5;
+ };
+ }
+ function useResizeSensorLifecycle(rootRef, props2, update, reset2) {
+ onActivated(reset2);
+ onMounted(() => {
+ if (props2.initial) {
+ nextTick(update);
+ }
+ const rootEl = rootRef.value;
+ if (rootEl.offsetParent !== rootEl.parentElement) {
+ rootEl.parentElement.style.position = "relative";
+ }
+ if (!("AnimationEvent" in window)) {
+ reset2();
+ }
+ });
+ }
+ const pixelRatio = /* @__PURE__ */ function() {
+ const canvas2 = document.createElement("canvas");
+ canvas2.height = canvas2.width = 0;
+ const context = canvas2.getContext("2d");
+ const backingStore = context.backingStorePixelRatio || context.webkitBackingStorePixelRatio || context.mozBackingStorePixelRatio || context.msBackingStorePixelRatio || context.oBackingStorePixelRatio || context.backingStorePixelRatio || 1;
+ return (window.devicePixelRatio || 1) / backingStore;
+ }();
+ function wrapper(canvas2) {
+ canvas2.width = canvas2.offsetWidth * pixelRatio;
+ canvas2.height = canvas2.offsetHeight * pixelRatio;
+ canvas2.getContext("2d").__hidpi__ = true;
+ }
+ let isHidpi = false;
+ function initHidpi() {
+ if (isHidpi) {
+ return;
+ }
+ isHidpi = true;
+ const forEach = function(obj, func) {
+ for (const key in obj) {
+ if (hasOwn$1(obj, key)) {
+ func(obj[key], key);
+ }
+ }
+ };
+ const ratioArgs = {
+ fillRect: "all",
+ clearRect: "all",
+ strokeRect: "all",
+ moveTo: "all",
+ lineTo: "all",
+ arc: [0, 1, 2],
+ arcTo: "all",
+ bezierCurveTo: "all",
+ isPointinPath: "all",
+ isPointinStroke: "all",
+ quadraticCurveTo: "all",
+ rect: "all",
+ translate: "all",
+ createRadialGradient: "all",
+ createLinearGradient: "all",
+ setTransform: [4, 5]
+ };
+ const proto = CanvasRenderingContext2D.prototype;
+ proto.drawImageByCanvas = function(_super) {
+ return function(canvas2, srcx, srcy, srcw, srch, desx, desy, desw, desh, isScale) {
+ if (!this.__hidpi__) {
+ return _super.apply(this, arguments);
+ }
+ srcx *= pixelRatio;
+ srcy *= pixelRatio;
+ srcw *= pixelRatio;
+ srch *= pixelRatio;
+ desx *= pixelRatio;
+ desy *= pixelRatio;
+ desw = isScale ? desw * pixelRatio : desw;
+ desh = isScale ? desh * pixelRatio : desh;
+ _super.call(this, canvas2, srcx, srcy, srcw, srch, desx, desy, desw, desh);
+ };
+ }(proto.drawImage);
+ if (pixelRatio !== 1) {
+ forEach(ratioArgs, function(value, key) {
+ proto[key] = function(_super) {
+ return function() {
+ if (!this.__hidpi__) {
+ return _super.apply(this, arguments);
+ }
+ let args = Array.prototype.slice.call(arguments);
+ if (value === "all") {
+ args = args.map(function(a2) {
+ return a2 * pixelRatio;
+ });
+ } else if (Array.isArray(value)) {
+ for (let i = 0; i < value.length; i++) {
+ args[value[i]] *= pixelRatio;
+ }
+ }
+ return _super.apply(this, args);
+ };
+ }(proto[key]);
+ });
+ proto.stroke = function(_super) {
+ return function() {
+ if (!this.__hidpi__) {
+ return _super.apply(this, arguments);
+ }
+ this.lineWidth *= pixelRatio;
+ _super.apply(this, arguments);
+ this.lineWidth /= pixelRatio;
+ };
+ }(proto.stroke);
+ proto.fillText = function(_super) {
+ return function() {
+ if (!this.__hidpi__) {
+ return _super.apply(this, arguments);
+ }
+ const args = Array.prototype.slice.call(arguments);
+ args[1] *= pixelRatio;
+ args[2] *= pixelRatio;
+ var font2 = this.font;
+ this.font = font2.replace(/(\d+\.?\d*)(px|em|rem|pt)/g, function(w, m, u) {
+ return m * pixelRatio + u;
+ });
+ _super.apply(this, args);
+ this.font = font2;
+ };
+ }(proto.fillText);
+ proto.strokeText = function(_super) {
+ return function() {
+ if (!this.__hidpi__) {
+ return _super.apply(this, arguments);
+ }
+ var args = Array.prototype.slice.call(arguments);
+ args[1] *= pixelRatio;
+ args[2] *= pixelRatio;
+ var font2 = this.font;
+ this.font = font2.replace(/(\d+\.?\d*)(px|em|rem|pt)/g, function(w, m, u) {
+ return m * pixelRatio + u;
+ });
+ _super.apply(this, args);
+ this.font = font2;
+ };
+ }(proto.strokeText);
+ proto.drawImage = function(_super) {
+ return function() {
+ if (!this.__hidpi__) {
+ return _super.apply(this, arguments);
+ }
+ this.scale(pixelRatio, pixelRatio);
+ _super.apply(this, arguments);
+ this.scale(1 / pixelRatio, 1 / pixelRatio);
+ };
+ }(proto.drawImage);
+ }
+ }
+ const initHidpiOnce = /* @__PURE__ */ once(() => {
+ return initHidpi();
+ });
+ function $getRealPath(src) {
+ return src ? getRealPath(src) : src;
+ }
+ function resolveColor(color) {
+ color = color.slice(0);
+ color[3] = color[3] / 255;
+ return "rgba(" + color.join(",") + ")";
+ }
+ function processTouches(target, touches) {
+ const eventTarget = target;
+ return Array.from(touches).map((touch) => {
+ let boundingClientRect = eventTarget.getBoundingClientRect();
+ return {
+ identifier: touch.identifier,
+ x: touch.clientX - boundingClientRect.left,
+ y: touch.clientY - boundingClientRect.top
+ };
+ });
+ }
+ let tempCanvas;
+ function getTempCanvas(width = 0, height = 0) {
+ if (!tempCanvas) {
+ tempCanvas = document.createElement("canvas");
+ }
+ tempCanvas.width = width;
+ tempCanvas.height = height;
+ return tempCanvas;
+ }
+ const props$n = {
+ canvasId: {
+ type: String,
+ default: ""
+ },
+ disableScroll: {
+ type: [Boolean, String],
+ default: false
+ }
+ };
+ var Canvas = /* @__PURE__ */ defineBuiltInComponent({
+ inheritAttrs: false,
+ name: "Canvas",
+ compatConfig: {
+ MODE: 3
+ },
+ props: props$n,
+ computed: {
+ id() {
+ return this.canvasId;
+ }
+ },
+ setup(props2, {
+ emit: emit2,
+ slots
+ }) {
+ initHidpiOnce();
+ const canvas2 = ref(null);
+ const sensor = ref(null);
+ const actionsWaiting = ref(false);
+ const trigger2 = useNativeEvent(emit2);
+ const {
+ $attrs,
+ $excludeAttrs,
+ $listeners
+ } = useAttrs({
+ excludeListeners: true
+ });
+ const {
+ _listeners
+ } = useListeners(props2, $listeners, trigger2);
+ const {
+ _handleSubscribe,
+ _resize
+ } = useMethods(canvas2, actionsWaiting);
+ useSubscribe(_handleSubscribe, useContextInfo(props2.canvasId), true);
+ onMounted(() => {
+ _resize();
+ });
+ return () => {
+ const {
+ canvasId,
+ disableScroll
+ } = props2;
+ return createVNode("uni-canvas", mergeProps({
+ "canvas-id": canvasId,
+ "disable-scroll": disableScroll
+ }, $attrs.value, $excludeAttrs.value, _listeners.value), {
+ default: () => [createVNode("canvas", {
+ "ref": canvas2,
+ "class": "uni-canvas-canvas",
+ "width": "300",
+ "height": "150"
+ }, null, 512), createVNode("div", {
+ "style": "position: absolute;top: 0;left: 0;width: 100%;height: 100%;overflow: hidden;"
+ }, [slots.default && slots.default()]), createVNode(ResizeSensor, {
+ "ref": sensor,
+ "onResize": _resize
+ }, null, 8, ["onResize"])],
+ _: 1
+ }, 16, ["canvas-id", "disable-scroll"]);
+ };
+ }
+ });
+ function useListeners(props2, Listeners, trigger2) {
+ const _listeners = computed$1(() => {
+ let events = ["onTouchstart", "onTouchmove", "onTouchend"];
+ let _$listeners = Listeners.value;
+ let $listeners = extend({}, (() => {
+ let obj = {};
+ for (const key in _$listeners) {
+ if (Object.prototype.hasOwnProperty.call(_$listeners, key)) {
+ const event = _$listeners[key];
+ obj[key] = event;
+ }
+ }
+ return obj;
+ })());
+ events.forEach((event) => {
+ let existing = $listeners[event];
+ let eventHandler = [];
+ if (existing) {
+ eventHandler.push(withWebEvent(($event) => {
+ trigger2(event.replace("on", "").toLocaleLowerCase(), extend({}, (() => {
+ let obj = {};
+ for (const key in $event) {
+ obj[key] = $event[key];
+ }
+ return obj;
+ })(), {
+ touches: processTouches($event.currentTarget, $event.touches),
+ changedTouches: processTouches($event.currentTarget, $event.changedTouches)
+ }));
+ }));
+ }
+ if (props2.disableScroll && event === "onTouchmove") {
+ eventHandler.push(onEventPrevent);
+ }
+ $listeners[event] = eventHandler;
+ });
+ return $listeners;
+ });
+ return {
+ _listeners
+ };
+ }
+ function useMethods(canvasRef, actionsWaiting) {
+ let _actionsDefer = [];
+ let _images = {};
+ function _resize() {
+ var canvas2 = canvasRef.value;
+ if (canvas2.width > 0 && canvas2.height > 0) {
+ var context = canvas2.getContext("2d");
+ var imageData = context.getImageData(0, 0, canvas2.width, canvas2.height);
+ wrapper(canvas2);
+ context.putImageData(imageData, 0, 0);
+ } else {
+ wrapper(canvas2);
+ }
+ }
+ function actionsChanged({
+ actions,
+ reserve,
+ callbackId
+ }) {
+ if (!actions) {
+ return;
+ }
+ if (actionsWaiting.value) {
+ _actionsDefer.push([actions, reserve, callbackId]);
+ return;
+ }
+ var canvas2 = canvasRef.value;
+ var c2d = canvas2.getContext("2d");
+ if (!reserve) {
+ c2d.fillStyle = "#000000";
+ c2d.strokeStyle = "#000000";
+ c2d.shadowColor = "#000000";
+ c2d.shadowBlur = 0;
+ c2d.shadowOffsetX = 0;
+ c2d.shadowOffsetY = 0;
+ c2d.setTransform(1, 0, 0, 1, 0, 0);
+ c2d.clearRect(0, 0, canvas2.width, canvas2.height);
+ }
+ preloadImage(actions);
+ for (let index2 = 0; index2 < actions.length; index2++) {
+ const action = actions[index2];
+ let method = action.method;
+ const data = action.data;
+ if (/^set/.test(method) && method !== "setTransform") {
+ const method1 = method[3].toLowerCase() + method.slice(4);
+ let color;
+ if (method1 === "fillStyle" || method1 === "strokeStyle") {
+ if (data[0] === "normal") {
+ color = resolveColor(data[1]);
+ } else if (data[0] === "linear") {
+ const LinearGradient = c2d.createLinearGradient(...data[1]);
+ data[2].forEach(function(data2) {
+ const offset = data2[0];
+ const color2 = resolveColor(data2[1]);
+ LinearGradient.addColorStop(offset, color2);
+ });
+ color = LinearGradient;
+ } else if (data[0] === "radial") {
+ const x = data[1][0];
+ const y = data[1][1];
+ const r = data[1][2];
+ const LinearGradient = c2d.createRadialGradient(x, y, 0, x, y, r);
+ data[2].forEach(function(data2) {
+ const offset = data2[0];
+ const color2 = resolveColor(data2[1]);
+ LinearGradient.addColorStop(offset, color2);
+ });
+ color = LinearGradient;
+ } else if (data[0] === "pattern") {
+ const loaded = checkImageLoaded(data[1], actions.slice(index2 + 1), callbackId, function(image2) {
+ if (image2) {
+ c2d[method1] = c2d.createPattern(image2, data[2]);
+ }
+ });
+ if (!loaded) {
+ break;
+ }
+ continue;
+ }
+ c2d[method1] = color;
+ } else if (method1 === "globalAlpha") {
+ c2d[method1] = Number(data[0]) / 255;
+ } else if (method1 === "shadow") {
+ var _ = ["shadowOffsetX", "shadowOffsetY", "shadowBlur", "shadowColor"];
+ data.forEach(function(color_, method_) {
+ c2d[_[method_]] = _[method_] === "shadowColor" ? resolveColor(color_) : color_;
+ });
+ } else if (method1 === "fontSize") {
+ const font2 = c2d.__font__ || c2d.font;
+ c2d.__font__ = c2d.font = font2.replace(/\d+\.?\d*px/, data[0] + "px");
+ } else if (method1 === "lineDash") {
+ c2d.setLineDash(data[0]);
+ c2d.lineDashOffset = data[1] || 0;
+ } else if (method1 === "textBaseline") {
+ if (data[0] === "normal") {
+ data[0] = "alphabetic";
+ }
+ c2d[method1] = data[0];
+ } else if (method1 === "font") {
+ c2d.__font__ = c2d.font = data[0];
+ } else {
+ c2d[method1] = data[0];
+ }
+ } else if (method === "fillPath" || method === "strokePath") {
+ method = method.replace(/Path/, "");
+ c2d.beginPath();
+ data.forEach(function(data_) {
+ c2d[data_.method].apply(c2d, data_.data);
+ });
+ c2d[method]();
+ } else if (method === "fillText") {
+ c2d.fillText.apply(c2d, data);
+ } else if (method === "drawImage") {
+ var A = function() {
+ var dataArray = [...data];
+ var url = dataArray[0];
+ var otherData = dataArray.slice(1);
+ _images = _images || {};
+ if (checkImageLoaded(url, actions.slice(index2 + 1), callbackId, function(image2) {
+ if (image2) {
+ c2d.drawImage.apply(c2d, [image2].concat([...otherData.slice(4, 8)], [...otherData.slice(0, 4)]));
+ }
+ }))
+ return "break";
+ }();
+ if (A === "break") {
+ break;
+ }
+ } else {
+ if (method === "clip") {
+ data.forEach(function(data_) {
+ c2d[data_.method].apply(c2d, data_.data);
+ });
+ c2d.clip();
+ } else {
+ c2d[method].apply(c2d, data);
+ }
+ }
+ }
+ if (!actionsWaiting.value && callbackId) {
+ UniViewJSBridge.publishHandler("onCanvasMethodCallback", {
+ callbackId,
+ data: {
+ errMsg: "drawCanvas:ok"
+ }
+ }, getCurrentPageId());
+ }
+ }
+ function preloadImage(actions) {
+ actions.forEach(function(action) {
+ var method = action.method;
+ var data = action.data;
+ var src = "";
+ if (method === "drawImage") {
+ src = data[0];
+ src = $getRealPath(src);
+ data[0] = src;
+ } else if (method === "setFillStyle" && data[0] === "pattern") {
+ src = data[1];
+ src = $getRealPath(src);
+ data[1] = src;
+ }
+ if (src && !_images[src]) {
+ loadImage();
+ }
+ function loadImage() {
+ const image2 = _images[src] = new Image();
+ image2.onload = function() {
+ image2.ready = true;
+ };
+ if (navigator.vendor === "Google Inc.") {
+ if (src.indexOf("file://") === 0) {
+ image2.crossOrigin = "anonymous";
+ }
+ image2.src = src;
+ return;
+ }
+ getSameOriginUrl(src).then((src2) => {
+ image2.src = src2;
+ }).catch(() => {
+ image2.src = src;
+ });
+ }
+ });
+ }
+ function checkImageLoaded(src, actions, callbackId, fn) {
+ var image2 = _images[src];
+ if (image2.ready) {
+ fn(image2);
+ return true;
+ } else {
+ _actionsDefer.unshift([actions, true]);
+ actionsWaiting.value = true;
+ image2.onload = function() {
+ image2.ready = true;
+ fn(image2);
+ actionsWaiting.value = false;
+ var actions2 = _actionsDefer.slice(0);
+ _actionsDefer = [];
+ for (var action = actions2.shift(); action; ) {
+ actionsChanged({
+ actions: action[0],
+ reserve: action[1],
+ callbackId
+ });
+ action = actions2.shift();
+ }
+ };
+ return false;
+ }
+ }
+ function getImageData({
+ x = 0,
+ y = 0,
+ width,
+ height,
+ destWidth,
+ destHeight,
+ hidpi = true,
+ dataType,
+ quality = 1,
+ type = "png",
+ callbackId
+ }) {
+ const canvas2 = canvasRef.value;
+ let data;
+ const maxWidth = canvas2.offsetWidth - x;
+ width = width ? Math.min(width, maxWidth) : maxWidth;
+ const maxHeight = canvas2.offsetHeight - y;
+ height = height ? Math.min(height, maxHeight) : maxHeight;
+ if (!hidpi) {
+ if (!destWidth && !destHeight) {
+ destWidth = Math.round(width * pixelRatio);
+ destHeight = Math.round(height * pixelRatio);
+ } else if (!destWidth) {
+ destWidth = Math.round(width / height * destHeight);
+ } else if (!destHeight) {
+ destHeight = Math.round(height / width * destWidth);
+ }
+ } else {
+ destWidth = width;
+ destHeight = height;
+ }
+ const newCanvas = getTempCanvas(destWidth, destHeight);
+ const context = newCanvas.getContext("2d");
+ if (type === "jpeg" || type === "jpg") {
+ type = "jpeg";
+ context.fillStyle = "#fff";
+ context.fillRect(0, 0, destWidth, destHeight);
+ }
+ context.__hidpi__ = true;
+ context.drawImageByCanvas(canvas2, x, y, width, height, 0, 0, destWidth, destHeight, false);
+ let result;
+ try {
+ let compressed;
+ if (dataType === "base64") {
+ data = newCanvas.toDataURL(`image/${type}`, quality);
+ } else {
+ const imgData = context.getImageData(0, 0, destWidth, destHeight);
+ if (true) {
+ const pako = require("pako");
+ data = pako.deflateRaw(imgData.data, {
+ to: "string"
+ });
+ compressed = true;
+ }
+ }
+ result = {
+ errMsg: "canvasGetImageData:ok",
+ data,
+ compressed,
+ width: destWidth,
+ height: destHeight
+ };
+ } catch (error) {
+ result = {
+ errMsg: `canvasGetImageData:fail ${error}`
+ };
+ }
+ newCanvas.height = newCanvas.width = 0;
+ context.__hidpi__ = false;
+ if (!callbackId) {
+ return result;
+ } else {
+ UniViewJSBridge.publishHandler("onCanvasMethodCallback", {
+ callbackId,
+ data: result
+ }, getCurrentPageId());
+ }
+ }
+ function putImageData({
+ data,
+ x,
+ y,
+ width,
+ height,
+ compressed,
+ callbackId
+ }) {
+ try {
+ if (!height) {
+ height = Math.round(data.length / 4 / width);
+ }
+ const canvas2 = getTempCanvas(width, height);
+ const context = canvas2.getContext("2d");
+ if (compressed) {
+ const pako = require("pako");
+ data = pako.inflateRaw(data);
+ }
+ context.putImageData(new ImageData(new Uint8ClampedArray(data), width, height), 0, 0);
+ canvasRef.value.getContext("2d").drawImage(canvas2, x, y, width, height);
+ canvas2.height = canvas2.width = 0;
+ } catch (error) {
+ UniViewJSBridge.publishHandler("onCanvasMethodCallback", {
+ callbackId,
+ data: {
+ errMsg: "canvasPutImageData:fail"
+ }
+ }, getCurrentPageId());
+ return;
+ }
+ UniViewJSBridge.publishHandler("onCanvasMethodCallback", {
+ callbackId,
+ data: {
+ errMsg: "canvasPutImageData:ok"
+ }
+ }, getCurrentPageId());
+ }
+ function toTempFilePath({
+ x = 0,
+ y = 0,
+ width,
+ height,
+ destWidth,
+ destHeight,
+ fileType,
+ quality,
+ dirname,
+ callbackId
+ }) {
+ const res = getImageData({
+ x,
+ y,
+ width,
+ height,
+ destWidth,
+ destHeight,
+ hidpi: false,
+ dataType: "base64",
+ type: fileType,
+ quality
+ });
+ if (!res.data || !res.data.length) {
+ UniViewJSBridge.publishHandler("onCanvasMethodCallback", {
+ callbackId,
+ data: {
+ errMsg: res.errMsg.replace("canvasPutImageData", "toTempFilePath")
+ }
+ }, getCurrentPageId());
+ return;
+ }
+ saveImage(res.data);
+ }
+ const methods2 = {
+ actionsChanged,
+ getImageData,
+ putImageData,
+ toTempFilePath
+ };
+ function _handleSubscribe(type, data = {}) {
+ let method = methods2[type];
+ if (type.indexOf("_") !== 0 && typeof method === "function") {
+ method(data);
+ }
+ }
+ return extend(methods2, {
+ _resize,
+ _handleSubscribe
+ });
+ }
+ const uniCheckGroupKey = PolySymbol("uniCheckGroup");
+ const props$m = {
+ name: {
+ type: String,
+ default: ""
+ }
+ };
+ var CheckboxGroup = /* @__PURE__ */ defineBuiltInComponent({
+ name: "CheckboxGroup",
+ props: props$m,
+ emits: ["change"],
+ setup(props2, {
+ emit: emit2,
+ slots
+ }) {
+ const rootRef = ref(null);
+ const trigger2 = useCustomEvent(rootRef, emit2);
+ useProvideCheckGroup(props2, trigger2);
+ return () => {
+ return createVNode("uni-checkbox-group", {
+ "ref": rootRef
+ }, {
+ default: () => [slots.default && slots.default()]
+ }, 512);
+ };
+ }
+ });
+ function useProvideCheckGroup(props2, trigger2) {
+ const fields = [];
+ const getFieldsValue = () => fields.reduce((res, field) => {
+ if (field.value.checkboxChecked) {
+ res.push(field.value.value);
+ }
+ return res;
+ }, new Array());
+ provide(uniCheckGroupKey, {
+ addField(field) {
+ fields.push(field);
+ },
+ removeField(field) {
+ fields.splice(fields.indexOf(field), 1);
+ },
+ checkboxChange($event) {
+ trigger2("change", $event, {
+ value: getFieldsValue()
+ });
+ }
+ });
+ const uniForm = inject(uniFormKey, false);
+ if (uniForm) {
+ uniForm.addField({
+ submit: () => {
+ let data = ["", null];
+ if (props2.name !== "") {
+ data[0] = props2.name;
+ data[1] = getFieldsValue();
+ }
+ return data;
+ }
+ });
+ }
+ return getFieldsValue;
+ }
+ const props$l = {
+ checked: {
+ type: [Boolean, String],
+ default: false
+ },
+ id: {
+ type: String,
+ default: ""
+ },
+ disabled: {
+ type: [Boolean, String],
+ default: false
+ },
+ color: {
+ type: String,
+ default: "#007aff"
+ },
+ value: {
+ type: String,
+ default: ""
+ }
+ };
+ var Checkbox = /* @__PURE__ */ defineBuiltInComponent({
+ name: "Checkbox",
+ props: props$l,
+ setup(props2, {
+ slots
+ }) {
+ const checkboxChecked = ref(props2.checked);
+ const checkboxValue = ref(props2.value);
+ watch([() => props2.checked, () => props2.value], ([newChecked, newModelValue]) => {
+ checkboxChecked.value = newChecked;
+ checkboxValue.value = newModelValue;
+ });
+ const reset2 = () => {
+ checkboxChecked.value = false;
+ };
+ const {
+ uniCheckGroup,
+ uniLabel
+ } = useCheckboxInject(checkboxChecked, checkboxValue, reset2);
+ const _onClick = ($event) => {
+ if (props2.disabled) {
+ return;
+ }
+ checkboxChecked.value = !checkboxChecked.value;
+ uniCheckGroup && uniCheckGroup.checkboxChange($event);
+ };
+ if (!!uniLabel) {
+ uniLabel.addHandler(_onClick);
+ onBeforeUnmount(() => {
+ uniLabel.removeHandler(_onClick);
+ });
+ }
+ useListeners$1(props2, {
+ "label-click": _onClick
+ });
+ return () => {
+ const {
+ booleanAttrs
+ } = useBooleanAttr(props2, "disabled");
+ return createVNode("uni-checkbox", mergeProps(booleanAttrs, {
+ "onClick": _onClick
+ }), {
+ default: () => [createVNode("div", {
+ "class": "uni-checkbox-wrapper"
+ }, [createVNode("div", {
+ "class": ["uni-checkbox-input", {
+ "uni-checkbox-input-disabled": props2.disabled
+ }]
+ }, [checkboxChecked.value ? createSvgIconVNode(ICON_PATH_SUCCESS_NO_CIRCLE, props2.color, 22) : ""], 2), slots.default && slots.default()])]
+ }, 16, ["onClick"]);
+ };
+ }
+ });
+ function useCheckboxInject(checkboxChecked, checkboxValue, reset2) {
+ const field = computed$1(() => ({
+ checkboxChecked: Boolean(checkboxChecked.value),
+ value: checkboxValue.value
+ }));
+ const formField = {
+ reset: reset2
+ };
+ const uniCheckGroup = inject(uniCheckGroupKey, false);
+ if (!!uniCheckGroup) {
+ uniCheckGroup.addField(field);
+ }
+ const uniForm = inject(uniFormKey, false);
+ if (!!uniForm) {
+ uniForm.addField(formField);
+ }
+ const uniLabel = inject(uniLabelKey, false);
+ onBeforeUnmount(() => {
+ uniCheckGroup && uniCheckGroup.removeField(field);
+ uniForm && uniForm.removeField(formField);
+ });
+ return {
+ uniCheckGroup,
+ uniForm,
+ uniLabel
+ };
+ }
+ let resetTimer;
+ let isAndroid;
+ let osVersion;
+ let keyboardHeight;
+ let keyboardChangeCallback;
+ let webviewStyle;
+ {
+ plusReady(() => {
+ isAndroid = plus.os.name === "Android";
+ osVersion = plus.os.version || "";
+ });
+ document.addEventListener("keyboardchange", function(event) {
+ keyboardHeight = event.height;
+ keyboardChangeCallback && keyboardChangeCallback();
+ }, false);
+ }
+ function iosHideKeyboard() {
+ }
+ function setSoftinputTemporary(props2, el, reset2) {
+ plusReady(() => {
+ const MODE_ADJUSTRESIZE = "adjustResize";
+ const MODE_ADJUSTPAN = "adjustPan";
+ const MODE_NOTHING = "nothing";
+ const currentWebview = plus.webview.currentWebview();
+ const style = webviewStyle || currentWebview.getStyle() || {};
+ const options = {
+ mode: reset2 || style.softinputMode === MODE_ADJUSTRESIZE ? MODE_ADJUSTRESIZE : props2.adjustPosition ? MODE_ADJUSTPAN : MODE_NOTHING,
+ position: {
+ top: 0,
+ height: 0
+ }
+ };
+ if (options.mode === MODE_ADJUSTPAN) {
+ const rect = el.getBoundingClientRect();
+ options.position.top = rect.top;
+ options.position.height = rect.height + (Number(props2.cursorSpacing) || 0);
+ }
+ currentWebview.setSoftinputTemporary(options);
+ });
+ }
+ function setSoftinputNavBar(props2, state) {
+ if (props2.showConfirmBar === "auto") {
+ delete state.softinputNavBar;
+ return;
+ }
+ plusReady(() => {
+ const currentWebview = plus.webview.currentWebview();
+ const { softinputNavBar } = currentWebview.getStyle() || {};
+ const showConfirmBar = softinputNavBar !== "none";
+ if (showConfirmBar !== props2.showConfirmBar) {
+ state.softinputNavBar = softinputNavBar || "auto";
+ currentWebview.setStyle({
+ softinputNavBar: props2.showConfirmBar ? "auto" : "none"
+ });
+ } else {
+ delete state.softinputNavBar;
+ }
+ });
+ }
+ function resetSoftinputNavBar(state) {
+ const softinputNavBar = state.softinputNavBar;
+ if (softinputNavBar) {
+ plusReady(() => {
+ const currentWebview = plus.webview.currentWebview();
+ currentWebview.setStyle({
+ softinputNavBar
+ });
+ });
+ }
+ }
+ const props$k = {
+ cursorSpacing: {
+ type: [Number, String],
+ default: 0
+ },
+ showConfirmBar: {
+ type: [Boolean, String],
+ default: "auto"
+ },
+ adjustPosition: {
+ type: [Boolean, String],
+ default: true
+ },
+ autoBlur: {
+ type: [Boolean, String],
+ default: false
+ }
+ };
+ const emit$1 = ["keyboardheightchange"];
+ function useKeyboard(props2, elRef, trigger2) {
+ const state = {};
+ function initKeyboard(el) {
+ let focus;
+ const keyboardChange = () => {
+ trigger2("keyboardheightchange", {}, {
+ height: keyboardHeight,
+ duration: 0.25
+ });
+ if (focus && keyboardHeight === 0) {
+ setSoftinputTemporary(props2, el);
+ }
+ if (props2.autoBlur && focus && keyboardHeight === 0 && (isAndroid || parseInt(osVersion) >= 13)) {
+ document.activeElement.blur();
+ }
+ };
+ el.addEventListener("focus", () => {
+ focus = true;
+ clearTimeout(resetTimer);
+ document.addEventListener("click", iosHideKeyboard, false);
+ {
+ keyboardChangeCallback = keyboardChange;
+ if (keyboardHeight) {
+ trigger2("keyboardheightchange", {}, {
+ height: keyboardHeight,
+ duration: 0
+ });
+ }
+ setSoftinputNavBar(props2, state);
+ setSoftinputTemporary(props2, el);
+ }
+ });
+ {
+ if (isAndroid) {
+ el.addEventListener("click", () => {
+ if (!props2.disabled && !props2.readOnly && focus && keyboardHeight === 0) {
+ setSoftinputTemporary(props2, el);
+ }
+ });
+ }
+ if (!isAndroid) {
+ if (parseInt(osVersion) < 12) {
+ el.addEventListener("touchstart", () => {
+ if (!props2.disabled && !props2.readOnly && !focus) {
+ setSoftinputTemporary(props2, el);
+ }
+ });
+ }
+ if (parseFloat(osVersion) >= 14.6 && !webviewStyle) {
+ plusReady(() => {
+ const currentWebview = plus.webview.currentWebview();
+ webviewStyle = currentWebview.getStyle() || {};
+ });
+ }
+ }
+ }
+ const onKeyboardHide = () => {
+ document.removeEventListener("click", iosHideKeyboard, false);
+ {
+ keyboardChangeCallback = null;
+ if (keyboardHeight) {
+ trigger2("keyboardheightchange", {}, {
+ height: 0,
+ duration: 0
+ });
+ }
+ resetSoftinputNavBar(state);
+ if (isAndroid) {
+ resetTimer = setTimeout(() => {
+ setSoftinputTemporary(props2, el, true);
+ }, 300);
+ }
+ }
+ if (String(navigator.vendor).indexOf("Apple") === 0) {
+ document.documentElement.scrollTo(document.documentElement.scrollLeft, document.documentElement.scrollTop);
+ }
+ };
+ el.addEventListener("blur", () => {
+ el.blur();
+ focus = false;
+ onKeyboardHide();
+ });
+ }
+ watch(() => elRef.value, (el) => initKeyboard(el));
+ }
+ var startTag = /^<([-A-Za-z0-9_]+)((?:\s+[a-zA-Z_:][-a-zA-Z0-9_:.]*(?:\s*=\s*(?:(?:"[^"]*")|(?:'[^']*')|[^>\s]+))?)*)\s*(\/?)>/;
+ var endTag = /^<\/([-A-Za-z0-9_]+)[^>]*>/;
+ var attr = /([a-zA-Z_:][-a-zA-Z0-9_:.]*)(?:\s*=\s*(?:(?:"((?:\\.|[^"])*)")|(?:'((?:\\.|[^'])*)')|([^>\s]+)))?/g;
+ var empty = /* @__PURE__ */ makeMap("area,base,basefont,br,col,frame,hr,img,input,link,meta,param,embed,command,keygen,source,track,wbr");
+ var block = /* @__PURE__ */ makeMap("a,address,article,applet,aside,audio,blockquote,button,canvas,center,dd,del,dir,div,dl,dt,fieldset,figcaption,figure,footer,form,frameset,h1,h2,h3,h4,h5,h6,header,hgroup,hr,iframe,isindex,li,map,menu,noframes,noscript,object,ol,output,p,pre,section,script,table,tbody,td,tfoot,th,thead,tr,ul,video");
+ var inline = /* @__PURE__ */ makeMap("abbr,acronym,applet,b,basefont,bdo,big,br,button,cite,code,del,dfn,em,font,i,iframe,img,input,ins,kbd,label,map,object,q,s,samp,script,select,small,span,strike,strong,sub,sup,textarea,tt,u,var");
+ var closeSelf = /* @__PURE__ */ makeMap("colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr");
+ var fillAttrs = /* @__PURE__ */ makeMap("checked,compact,declare,defer,disabled,ismap,multiple,nohref,noresize,noshade,nowrap,readonly,selected");
+ var special = /* @__PURE__ */ makeMap("script,style");
+ function HTMLParser(html, handler) {
+ var index2;
+ var chars;
+ var match;
+ var stack2 = [];
+ var last = html;
+ stack2.last = function() {
+ return this[this.length - 1];
+ };
+ while (html) {
+ chars = true;
+ if (!stack2.last() || !special[stack2.last()]) {
+ if (html.indexOf("");
+ if (index2 >= 0) {
+ if (handler.comment) {
+ handler.comment(html.substring(4, index2));
+ }
+ html = html.substring(index2 + 3);
+ chars = false;
+ }
+ } else if (html.indexOf("") == 0) {
+ match = html.match(endTag);
+ if (match) {
+ html = html.substring(match[0].length);
+ match[0].replace(endTag, parseEndTag);
+ chars = false;
+ }
+ } else if (html.indexOf("<") == 0) {
+ match = html.match(startTag);
+ if (match) {
+ html = html.substring(match[0].length);
+ match[0].replace(startTag, parseStartTag);
+ chars = false;
+ }
+ }
+ if (chars) {
+ index2 = html.indexOf("<");
+ var text2 = index2 < 0 ? html : html.substring(0, index2);
+ html = index2 < 0 ? "" : html.substring(index2);
+ if (handler.chars) {
+ handler.chars(text2);
+ }
+ }
+ } else {
+ html = html.replace(new RegExp("([\\s\\S]*?)" + stack2.last() + "[^>]*>"), function(all, text3) {
+ text3 = text3.replace(/|/g, "$1$2");
+ if (handler.chars) {
+ handler.chars(text3);
+ }
+ return "";
+ });
+ parseEndTag("", stack2.last());
+ }
+ if (html == last) {
+ throw "Parse Error: " + html;
+ }
+ last = html;
+ }
+ parseEndTag();
+ function parseStartTag(tag, tagName, rest, unary) {
+ tagName = tagName.toLowerCase();
+ if (block[tagName]) {
+ while (stack2.last() && inline[stack2.last()]) {
+ parseEndTag("", stack2.last());
+ }
+ }
+ if (closeSelf[tagName] && stack2.last() == tagName) {
+ parseEndTag("", tagName);
+ }
+ unary = empty[tagName] || !!unary;
+ if (!unary) {
+ stack2.push(tagName);
+ }
+ if (handler.start) {
+ var attrs2 = [];
+ rest.replace(attr, function(match2, name) {
+ var value = arguments[2] ? arguments[2] : arguments[3] ? arguments[3] : arguments[4] ? arguments[4] : fillAttrs[name] ? name : "";
+ attrs2.push({
+ name,
+ value,
+ escaped: value.replace(/(^|[^\\])"/g, '$1\\"')
+ });
+ });
+ if (handler.start) {
+ handler.start(tagName, attrs2, unary);
+ }
+ }
+ }
+ function parseEndTag(tag, tagName) {
+ if (!tagName) {
+ var pos = 0;
+ } else {
+ for (var pos = stack2.length - 1; pos >= 0; pos--) {
+ if (stack2[pos] == tagName) {
+ break;
+ }
+ }
+ }
+ if (pos >= 0) {
+ for (var i = stack2.length - 1; i >= pos; i--) {
+ if (handler.end) {
+ handler.end(stack2[i]);
+ }
+ }
+ stack2.length = pos;
+ }
+ }
+ }
+ function makeMap(str) {
+ var obj = {};
+ var items = str.split(",");
+ for (var i = 0; i < items.length; i++) {
+ obj[items[i]] = true;
+ }
+ return obj;
+ }
+ const scripts = {};
+ function loadScript(globalName, src, callback) {
+ const globalObject = typeof globalName === "string" ? window[globalName] : globalName;
+ if (globalObject) {
+ callback();
+ return;
+ }
+ let callbacks2 = scripts[src];
+ if (!callbacks2) {
+ callbacks2 = scripts[src] = [];
+ const script = document.createElement("script");
+ script.src = src;
+ document.body.appendChild(script);
+ script.onload = function() {
+ callbacks2.forEach((callback2) => callback2());
+ delete scripts[src];
+ };
+ }
+ callbacks2.push(callback);
+ }
+ function divider(Quill) {
+ const BlockEmbed = Quill.import("blots/block/embed");
+ class Divider extends BlockEmbed {
+ }
+ Divider.blotName = "divider";
+ Divider.tagName = "HR";
+ return {
+ "formats/divider": Divider
+ };
+ }
+ function ins(Quill) {
+ const Inline = Quill.import("blots/inline");
+ class Ins extends Inline {
+ }
+ Ins.blotName = "ins";
+ Ins.tagName = "INS";
+ return {
+ "formats/ins": Ins
+ };
+ }
+ function align(Quill) {
+ const { Scope, Attributor } = Quill.import("parchment");
+ const config = {
+ scope: Scope.BLOCK,
+ whitelist: ["left", "right", "center", "justify"]
+ };
+ const AlignStyle = new Attributor.Style("align", "text-align", config);
+ return {
+ "formats/align": AlignStyle
+ };
+ }
+ function direction(Quill) {
+ const { Scope, Attributor } = Quill.import("parchment");
+ const config = {
+ scope: Scope.BLOCK,
+ whitelist: ["rtl"]
+ };
+ const DirectionStyle = new Attributor.Style("direction", "direction", config);
+ return {
+ "formats/direction": DirectionStyle
+ };
+ }
+ function list(Quill) {
+ const Parchment = Quill.import("parchment");
+ const Container = Quill.import("blots/container");
+ const ListItem = Quill.import("formats/list/item");
+ class List extends Container {
+ static create(value) {
+ const tagName = value === "ordered" ? "OL" : "UL";
+ const node = super.create(tagName);
+ if (value === "checked" || value === "unchecked") {
+ node.setAttribute("data-checked", value === "checked");
+ }
+ return node;
+ }
+ static formats(domNode) {
+ if (domNode.tagName === "OL")
+ return "ordered";
+ if (domNode.tagName === "UL") {
+ if (domNode.hasAttribute("data-checked")) {
+ return domNode.getAttribute("data-checked") === "true" ? "checked" : "unchecked";
+ } else {
+ return "bullet";
+ }
+ }
+ return void 0;
+ }
+ constructor(domNode) {
+ super(domNode);
+ const listEventHandler = (e2) => {
+ if (e2.target.parentNode !== domNode)
+ return;
+ const format = this.statics.formats(domNode);
+ const blot = Parchment.find(e2.target);
+ if (format === "checked") {
+ blot.format("list", "unchecked");
+ } else if (format === "unchecked") {
+ blot.format("list", "checked");
+ }
+ };
+ domNode.addEventListener("click", listEventHandler);
+ }
+ format(name, value) {
+ if (this.children.length > 0) {
+ this.children.tail.format(name, value);
+ }
+ }
+ formats() {
+ return { [this.statics.blotName]: this.statics.formats(this.domNode) };
+ }
+ insertBefore(blot, ref2) {
+ if (blot instanceof ListItem) {
+ super.insertBefore(blot, ref2);
+ } else {
+ const index2 = ref2 == null ? this.length() : ref2.offset(this);
+ const after = this.split(index2);
+ after.parent.insertBefore(blot, after);
+ }
+ }
+ optimize(context) {
+ super.optimize(context);
+ const next = this.next;
+ if (next != null && next.prev === this && next.statics.blotName === this.statics.blotName && next.domNode.tagName === this.domNode.tagName && next.domNode.getAttribute("data-checked") === this.domNode.getAttribute("data-checked")) {
+ next.moveChildren(this);
+ next.remove();
+ }
+ }
+ replace(target) {
+ if (target.statics.blotName !== this.statics.blotName) {
+ const item = Parchment.create(this.statics.defaultChild);
+ target.moveChildren(item);
+ this.appendChild(item);
+ }
+ super.replace(target);
+ }
+ }
+ List.blotName = "list";
+ List.scope = Parchment.Scope.BLOCK_BLOT;
+ List.tagName = ["OL", "UL"];
+ List.defaultChild = "list-item";
+ List.allowedChildren = [ListItem];
+ return {
+ "formats/list": List
+ };
+ }
+ function background(Quill) {
+ const { Scope } = Quill.import("parchment");
+ const BackgroundStyle = Quill.import("formats/background");
+ const BackgroundColorStyle = new BackgroundStyle.constructor("backgroundColor", "background-color", {
+ scope: Scope.INLINE
+ });
+ return {
+ "formats/backgroundColor": BackgroundColorStyle
+ };
+ }
+ function box(Quill) {
+ const { Scope, Attributor } = Quill.import("parchment");
+ const config = {
+ scope: Scope.BLOCK
+ };
+ const margin = [
+ "margin",
+ "marginTop",
+ "marginBottom",
+ "marginLeft",
+ "marginRight"
+ ];
+ const padding = [
+ "padding",
+ "paddingTop",
+ "paddingBottom",
+ "paddingLeft",
+ "paddingRight"
+ ];
+ const result = {};
+ margin.concat(padding).forEach((name) => {
+ result[`formats/${name}`] = new Attributor.Style(name, hyphenate(name), config);
+ });
+ return result;
+ }
+ function font(Quill) {
+ const { Scope, Attributor } = Quill.import("parchment");
+ const config = {
+ scope: Scope.INLINE
+ };
+ const font2 = [
+ "font",
+ "fontSize",
+ "fontStyle",
+ "fontVariant",
+ "fontWeight",
+ "fontFamily"
+ ];
+ const result = {};
+ font2.forEach((name) => {
+ result[`formats/${name}`] = new Attributor.Style(name, hyphenate(name), config);
+ });
+ return result;
+ }
+ function text$1(Quill) {
+ const { Scope, Attributor } = Quill.import("parchment");
+ const text2 = [
+ {
+ name: "lineHeight",
+ scope: Scope.BLOCK
+ },
+ {
+ name: "letterSpacing",
+ scope: Scope.INLINE
+ },
+ {
+ name: "textDecoration",
+ scope: Scope.INLINE
+ },
+ {
+ name: "textIndent",
+ scope: Scope.BLOCK
+ }
+ ];
+ const result = {};
+ text2.forEach(({ name, scope }) => {
+ result[`formats/${name}`] = new Attributor.Style(name, hyphenate(name), {
+ scope
+ });
+ });
+ return result;
+ }
+ function image$1(Quill) {
+ const Image2 = Quill.import("formats/image");
+ const ATTRIBUTES = [
+ "alt",
+ "height",
+ "width",
+ "data-custom",
+ "class",
+ "data-local"
+ ];
+ Image2.sanitize = (url) => url;
+ Image2.formats = function formats(domNode) {
+ return ATTRIBUTES.reduce(function(formats2, attribute) {
+ if (domNode.hasAttribute(attribute)) {
+ formats2[attribute] = domNode.getAttribute(attribute);
+ }
+ return formats2;
+ }, {});
+ };
+ const format = Image2.prototype.format;
+ Image2.prototype.format = function(name, value) {
+ if (ATTRIBUTES.indexOf(name) > -1) {
+ if (value) {
+ this.domNode.setAttribute(name, value);
+ } else {
+ this.domNode.removeAttribute(name);
+ }
+ } else {
+ format.call(this, name, value);
+ }
+ };
+ }
+ function register(Quill) {
+ const formats = {
+ divider,
+ ins,
+ align,
+ direction,
+ list,
+ background,
+ box,
+ font,
+ text: text$1,
+ image: image$1
+ };
+ const options = {};
+ Object.values(formats).forEach((value) => extend(options, value(Quill)));
+ Quill.register(options, true);
+ }
+ function useQuill(props2, rootRef, trigger2) {
+ let quillReady;
+ let skipMatcher;
+ let quill;
+ let textChanging = false;
+ watch(() => props2.readOnly, (value) => {
+ if (quillReady) {
+ quill.enable(!value);
+ if (!value) {
+ quill.blur();
+ }
+ }
+ });
+ watch(() => props2.placeholder, (value) => {
+ if (quillReady) {
+ quill.root.setAttribute("data-placeholder", value);
+ }
+ });
+ function html2delta(html) {
+ const tags = [
+ "span",
+ "strong",
+ "b",
+ "ins",
+ "em",
+ "i",
+ "u",
+ "a",
+ "del",
+ "s",
+ "sub",
+ "sup",
+ "img",
+ "div",
+ "p",
+ "h1",
+ "h2",
+ "h3",
+ "h4",
+ "h5",
+ "h6",
+ "hr",
+ "ol",
+ "ul",
+ "li",
+ "br"
+ ];
+ let content = "";
+ let disable;
+ HTMLParser(html, {
+ start: function(tag, attrs2, unary) {
+ if (!tags.includes(tag)) {
+ disable = !unary;
+ return;
+ }
+ disable = false;
+ const arrts = attrs2.map(({ name, value }) => `${name}="${value}"`).join(" ");
+ const start = `<${tag} ${arrts} ${unary ? "/" : ""}>`;
+ content += start;
+ },
+ end: function(tag) {
+ if (!disable) {
+ content += `${tag}>`;
+ }
+ },
+ chars: function(text2) {
+ if (!disable) {
+ content += text2;
+ }
+ }
+ });
+ skipMatcher = true;
+ const delta = quill.clipboard.convert(content);
+ skipMatcher = false;
+ return delta;
+ }
+ function getContents() {
+ const html = quill.root.innerHTML;
+ const text2 = quill.getText();
+ const delta = quill.getContents();
+ return {
+ html,
+ text: text2,
+ delta
+ };
+ }
+ let oldStatus = {};
+ function updateStatus(range) {
+ const status = range ? quill.getFormat(range) : {};
+ const keys = Object.keys(status);
+ if (keys.length !== Object.keys(oldStatus).length || keys.find((key) => status[key] !== oldStatus[key])) {
+ oldStatus = status;
+ trigger2("statuschange", {}, status);
+ }
+ }
+ function initQuill(imageResizeModules) {
+ const Quill = window.Quill;
+ register(Quill);
+ const options = {
+ toolbar: false,
+ readOnly: props2.readOnly,
+ placeholder: props2.placeholder
+ };
+ if (imageResizeModules.length) {
+ Quill.register("modules/ImageResize", window.ImageResize.default);
+ options.modules = {
+ ImageResize: {
+ modules: imageResizeModules
+ }
+ };
+ }
+ const rootEl = rootRef.value;
+ quill = new Quill(rootEl, options);
+ const $el = quill.root;
+ const events = ["focus", "blur", "input"];
+ events.forEach((name) => {
+ $el.addEventListener(name, ($event) => {
+ if (name === "input") {
+ $event.stopPropagation();
+ } else {
+ trigger2(name, $event, getContents());
+ }
+ });
+ });
+ quill.on("text-change", () => {
+ if (!textChanging) {
+ trigger2("input", {}, getContents());
+ }
+ });
+ quill.on("selection-change", updateStatus);
+ quill.on("scroll-optimize", () => {
+ const range = quill.selection.getRange()[0];
+ updateStatus(range);
+ });
+ quill.clipboard.addMatcher(Node.ELEMENT_NODE, (node, delta) => {
+ if (skipMatcher) {
+ return delta;
+ }
+ if (delta.ops) {
+ delta.ops = delta.ops.filter(({ insert }) => typeof insert === "string").map(({ insert }) => ({ insert }));
+ }
+ return delta;
+ });
+ quillReady = true;
+ trigger2("ready", {}, {});
+ }
+ onMounted(() => {
+ const imageResizeModules = [];
+ if (props2.showImgSize) {
+ imageResizeModules.push("DisplaySize");
+ }
+ if (props2.showImgToolbar) {
+ imageResizeModules.push("Toolbar");
+ }
+ if (props2.showImgResize) {
+ imageResizeModules.push("Resize");
+ }
+ const quillSrc = "./__uniappquill.js";
+ loadScript(window.Quill, quillSrc, () => {
+ if (imageResizeModules.length) {
+ const imageResizeSrc = "./__uniappquillimageresize.js";
+ loadScript(window.ImageResize, imageResizeSrc, () => {
+ initQuill(imageResizeModules);
+ });
+ } else {
+ initQuill(imageResizeModules);
+ }
+ });
+ });
+ const id2 = useContextInfo();
+ useSubscribe((type, data) => {
+ const { options, callbackId } = data;
+ let res;
+ let range;
+ let errMsg;
+ if (quillReady) {
+ const Quill = window.Quill;
+ switch (type) {
+ case "format":
+ {
+ let { name = "", value = false } = options;
+ range = quill.getSelection(true);
+ let format = quill.getFormat(range)[name] || false;
+ if (["bold", "italic", "underline", "strike", "ins"].includes(name)) {
+ value = !format;
+ } else if (name === "direction") {
+ value = value === "rtl" && format ? false : value;
+ const align2 = quill.getFormat(range).align;
+ if (value === "rtl" && !align2) {
+ quill.format("align", "right", "user");
+ } else if (!value && align2 === "right") {
+ quill.format("align", false, "user");
+ }
+ } else if (name === "indent") {
+ const rtl = quill.getFormat(range).direction === "rtl";
+ value = value === "+1";
+ if (rtl) {
+ value = !value;
+ }
+ value = value ? "+1" : "-1";
+ } else {
+ if (name === "list") {
+ value = value === "check" ? "unchecked" : value;
+ format = format === "checked" ? "unchecked" : format;
+ }
+ value = format && format !== (value || false) || !format && value ? value : !format;
+ }
+ quill.format(name, value, "user");
+ }
+ break;
+ case "insertDivider":
+ range = quill.getSelection(true);
+ quill.insertText(range.index, "\n", "user");
+ quill.insertEmbed(range.index + 1, "divider", true, "user");
+ quill.setSelection(range.index + 2, 0, "silent");
+ break;
+ case "insertImage":
+ {
+ range = quill.getSelection(true);
+ const {
+ src = "",
+ alt = "",
+ width = "",
+ height = "",
+ extClass = "",
+ data: data2 = {}
+ } = options;
+ const path = getRealPath(src);
+ quill.insertEmbed(range.index, "image", path, "user");
+ const local = /^(file|blob):/.test(path) ? path : false;
+ textChanging = true;
+ quill.formatText(range.index, 1, "data-local", local);
+ quill.formatText(range.index, 1, "alt", alt);
+ quill.formatText(range.index, 1, "width", width);
+ quill.formatText(range.index, 1, "height", height);
+ quill.formatText(range.index, 1, "class", extClass);
+ textChanging = false;
+ quill.formatText(range.index, 1, "data-custom", Object.keys(data2).map((key) => `${key}=${data2[key]}`).join("&"));
+ quill.setSelection(range.index + 1, 0, "silent");
+ }
+ break;
+ case "insertText":
+ {
+ range = quill.getSelection(true);
+ const { text: text2 = "" } = options;
+ quill.insertText(range.index, text2, "user");
+ quill.setSelection(range.index + text2.length, 0, "silent");
+ }
+ break;
+ case "setContents":
+ {
+ const { delta, html } = options;
+ if (typeof delta === "object") {
+ quill.setContents(delta, "silent");
+ } else if (typeof html === "string") {
+ quill.setContents(html2delta(html), "silent");
+ } else {
+ errMsg = "contents is missing";
+ }
+ }
+ break;
+ case "getContents":
+ res = getContents();
+ break;
+ case "clear":
+ quill.setText("");
+ break;
+ case "removeFormat":
+ {
+ range = quill.getSelection(true);
+ const parchment = Quill.import("parchment");
+ if (range.length) {
+ quill.removeFormat(range.index, range.length, "user");
+ } else {
+ Object.keys(quill.getFormat(range)).forEach((key) => {
+ if (parchment.query(key, parchment.Scope.INLINE)) {
+ quill.format(key, false);
+ }
+ });
+ }
+ }
+ break;
+ case "undo":
+ quill.history.undo();
+ break;
+ case "redo":
+ quill.history.redo();
+ break;
+ case "blur":
+ quill.blur();
+ break;
+ case "getSelectionText":
+ range = quill.selection.savedRange;
+ res = { text: "" };
+ if (range && range.length !== 0) {
+ res.text = quill.getText(range.index, range.length);
+ }
+ break;
+ case "scrollIntoView":
+ quill.scrollIntoView();
+ break;
+ }
+ updateStatus(range);
+ } else {
+ errMsg = "not ready";
+ }
+ if (callbackId) {
+ UniViewJSBridge.publishHandler("onEditorMethodCallback", {
+ callbackId,
+ data: extend({}, res, {
+ errMsg: `${type}:${errMsg ? "fail " + errMsg : "ok"}`
+ })
+ });
+ }
+ }, id2, true);
+ }
+ const props$j = /* @__PURE__ */ extend({}, props$k, {
+ id: {
+ type: String,
+ default: ""
+ },
+ readOnly: {
+ type: [Boolean, String],
+ default: false
+ },
+ placeholder: {
+ type: String,
+ default: ""
+ },
+ showImgSize: {
+ type: [Boolean, String],
+ default: false
+ },
+ showImgToolbar: {
+ type: [Boolean, String],
+ default: false
+ },
+ showImgResize: {
+ type: [Boolean, String],
+ default: false
+ }
+ });
+ var Editor = /* @__PURE__ */ defineBuiltInComponent({
+ name: "Editor",
+ props: props$j,
+ emit: ["ready", "focus", "blur", "input", "statuschange", ...emit$1],
+ setup(props2, {
+ emit: emit2
+ }) {
+ const rootRef = ref(null);
+ const trigger2 = useCustomEvent(rootRef, emit2);
+ useQuill(props2, rootRef, trigger2);
+ useKeyboard(props2, rootRef, trigger2);
+ return () => {
+ return createVNode("uni-editor", {
+ "ref": rootRef,
+ "id": props2.id,
+ "class": "ql-container"
+ }, null, 8, ["id"]);
+ };
+ }
+ });
+ const INFO_COLOR = "#10aeff";
+ const WARN_COLOR = "#f76260";
+ const GREY_COLOR = "#b2b2b2";
+ const CANCEL_COLOR = "#f43530";
+ const ICONS = {
+ success: {
+ d: ICON_PATH_SUCCESS,
+ c: PRIMARY_COLOR
+ },
+ success_no_circle: {
+ d: ICON_PATH_SUCCESS_NO_CIRCLE,
+ c: PRIMARY_COLOR
+ },
+ info: {
d: ICON_PATH_INFO,
c: INFO_COLOR
},
- warn: {
- d: ICON_PATH_WARN,
- c: WARN_COLOR
+ warn: {
+ d: ICON_PATH_WARN,
+ c: WARN_COLOR
+ },
+ waiting: {
+ d: ICON_PATH_WAITING,
+ c: INFO_COLOR
+ },
+ cancel: {
+ d: ICON_PATH_CANCEL,
+ c: CANCEL_COLOR
+ },
+ download: {
+ d: ICON_PATH_DOWNLOAD,
+ c: PRIMARY_COLOR
+ },
+ search: {
+ d: ICON_PATH_SEARCH,
+ c: GREY_COLOR
+ },
+ clear: {
+ d: ICON_PATH_CLEAR,
+ c: GREY_COLOR
+ }
+ };
+ var Icon = /* @__PURE__ */ defineBuiltInComponent({
+ name: "Icon",
+ props: {
+ type: {
+ type: String,
+ required: true,
+ default: ""
+ },
+ size: {
+ type: [String, Number],
+ default: 23
+ },
+ color: {
+ type: String,
+ default: ""
+ }
+ },
+ setup(props2) {
+ const path = computed$1(() => ICONS[props2.type]);
+ return () => {
+ const {
+ value
+ } = path;
+ return createVNode("uni-icon", null, {
+ default: () => [value && value.d && createSvgIconVNode(value.d, props2.color || value.c, rpx2px$1(props2.size))]
+ });
+ };
+ }
+ });
+ const props$i = {
+ src: {
+ type: String,
+ default: ""
+ },
+ mode: {
+ type: String,
+ default: "scaleToFill"
+ },
+ lazyLoad: {
+ type: [Boolean, String],
+ default: false
+ },
+ draggable: {
+ type: Boolean,
+ default: true
+ }
+ };
+ const FIX_MODES = {
+ widthFix: ["offsetWidth", "height"],
+ heightFix: ["offsetHeight", "width"]
+ };
+ const IMAGE_MODES = {
+ aspectFit: ["center center", "contain"],
+ aspectFill: ["center center", "cover"],
+ widthFix: [, "100% 100%"],
+ heightFix: [, "100% 100%"],
+ top: ["center top"],
+ bottom: ["center bottom"],
+ center: ["center center"],
+ left: ["left center"],
+ right: ["right center"],
+ "top left": ["left top"],
+ "top right": ["right top"],
+ "bottom left": ["left bottom"],
+ "bottom right": ["right bottom"]
+ };
+ var Image$1 = /* @__PURE__ */ defineBuiltInComponent({
+ name: "Image",
+ props: props$i,
+ setup(props2, {
+ emit: emit2
+ }) {
+ const rootRef = ref(null);
+ const state = useImageState(rootRef, props2);
+ const trigger2 = useCustomEvent(rootRef, emit2);
+ const {
+ fixSize
+ } = useImageSize(rootRef, props2, state);
+ useImageLoader(state, {
+ trigger: trigger2,
+ fixSize
+ });
+ return () => {
+ const {
+ mode
+ } = props2;
+ const {
+ imgSrc,
+ modeStyle
+ } = state;
+ return createVNode("uni-image", {
+ "ref": rootRef
+ }, {
+ default: () => [createVNode("div", {
+ "style": modeStyle
+ }, null, 4), imgSrc ? createVNode("img", {
+ "src": imgSrc,
+ "draggable": props2.draggable
+ }, null, 8, ["src", "draggable"]) : createVNode("img", null, null), FIX_MODES[mode] ? createVNode(ResizeSensor, {
+ "onResize": fixSize
+ }, null, 8, ["onResize"]) : createVNode("span", null, null)],
+ _: 1
+ }, 512);
+ };
+ }
+ });
+ function useImageState(rootRef, props2) {
+ const imgSrc = ref("");
+ const modeStyleRef = computed$1(() => {
+ let size2 = "auto";
+ let position = "";
+ const opts = IMAGE_MODES[props2.mode];
+ if (!opts) {
+ position = "0% 0%";
+ size2 = "100% 100%";
+ } else {
+ opts[0] && (position = opts[0]);
+ opts[1] && (size2 = opts[1]);
+ }
+ const srcVal = imgSrc.value;
+ return `background-image:${srcVal ? 'url("' + srcVal + '")' : "none"};background-position:${position};background-size:${size2};background-repeat:no-repeat;`;
+ });
+ const state = reactive({
+ rootEl: rootRef,
+ src: computed$1(() => props2.src ? getRealPath(props2.src) : ""),
+ origWidth: 0,
+ origHeight: 0,
+ origStyle: {
+ width: "",
+ height: ""
+ },
+ modeStyle: modeStyleRef,
+ imgSrc
+ });
+ onMounted(() => {
+ const rootEl = rootRef.value;
+ const style = rootEl.style;
+ state.origWidth = Number(style.width) || 0;
+ state.origHeight = Number(style.height) || 0;
+ });
+ return state;
+ }
+ function useImageLoader(state, {
+ trigger: trigger2,
+ fixSize
+ }) {
+ let img;
+ const setState = (width = 0, height = 0, imgSrc = "") => {
+ state.origWidth = width;
+ state.origHeight = height;
+ state.imgSrc = imgSrc;
+ };
+ const loadImage = (src) => {
+ if (!src) {
+ resetImage();
+ setState();
+ return;
+ }
+ if (!img) {
+ img = new Image();
+ }
+ img.onload = (evt) => {
+ const {
+ width,
+ height
+ } = img;
+ setState(width, height, src);
+ fixSize();
+ resetImage();
+ trigger2("load", evt, {
+ width,
+ height
+ });
+ };
+ img.onerror = (evt) => {
+ setState();
+ resetImage();
+ trigger2("error", evt, {
+ errMsg: `GET ${state.src} 404 (Not Found)`
+ });
+ };
+ img.src = src;
+ };
+ const resetImage = () => {
+ if (img) {
+ img.onload = null;
+ img.onerror = null;
+ img = null;
+ }
+ };
+ watch(() => state.src, (value) => loadImage(value));
+ onMounted(() => loadImage(state.src));
+ onBeforeUnmount(() => resetImage());
+ }
+ const isChrome = navigator.vendor === "Google Inc.";
+ function fixNumber(num) {
+ if (isChrome && num > 10) {
+ num = Math.round(num / 2) * 2;
+ }
+ return num;
+ }
+ function useImageSize(rootRef, props2, state) {
+ const fixSize = () => {
+ const {
+ mode
+ } = props2;
+ const names = FIX_MODES[mode];
+ if (!names) {
+ return;
+ }
+ const {
+ origWidth,
+ origHeight
+ } = state;
+ const ratio = origWidth && origHeight ? origWidth / origHeight : 0;
+ if (!ratio) {
+ return;
+ }
+ const rootEl = rootRef.value;
+ const value = rootEl[names[0]];
+ if (value) {
+ rootEl.style[names[1]] = fixNumber(value / ratio) + "px";
+ }
+ {
+ window.dispatchEvent(new CustomEvent("updateview"));
+ }
+ };
+ const resetSize = () => {
+ const {
+ style
+ } = rootRef.value;
+ const {
+ origStyle: {
+ width,
+ height
+ }
+ } = state;
+ style.width = width;
+ style.height = height;
+ };
+ watch(() => props2.mode, (value, oldValue) => {
+ if (FIX_MODES[oldValue]) {
+ resetSize();
+ }
+ if (FIX_MODES[value]) {
+ fixSize();
+ }
+ });
+ return {
+ fixSize,
+ resetSize
+ };
+ }
+ const passiveOptions$1 = passive(true);
+ const states = [];
+ let userInteract = 0;
+ let inited;
+ function addInteractListener(vm) {
+ if (!inited) {
+ const eventNames = [
+ "touchstart",
+ "touchmove",
+ "touchend",
+ "mousedown",
+ "mouseup"
+ ];
+ eventNames.forEach((eventName) => {
+ document.addEventListener(eventName, function() {
+ states.forEach((vm2) => {
+ vm2.userAction = true;
+ userInteract++;
+ setTimeout(() => {
+ userInteract--;
+ if (!userInteract) {
+ vm2.userAction = false;
+ }
+ }, 0);
+ });
+ }, passiveOptions$1);
+ });
+ inited = true;
+ }
+ states.push(vm);
+ }
+ function removeInteractListener(vm) {
+ const index2 = states.indexOf(vm);
+ if (index2 >= 0) {
+ states.splice(index2, 1);
+ }
+ }
+ function useUserAction() {
+ const state = reactive({
+ userAction: false
+ });
+ onMounted(() => {
+ addInteractListener(state);
+ });
+ onBeforeUnmount(() => {
+ removeInteractListener(state);
+ });
+ return {
+ state
+ };
+ }
+ function useScopedAttrs() {
+ const state = reactive({
+ attrs: {}
+ });
+ onMounted(() => {
+ let instance = getCurrentInstance();
+ while (instance) {
+ const scopeId = instance.type.__scopeId;
+ if (scopeId) {
+ state.attrs[scopeId] = "";
+ }
+ instance = instance.__isPage ? null : instance.parent;
+ }
+ });
+ return {
+ state
+ };
+ }
+ function useFormField(nameKey, value) {
+ const uniForm = inject(uniFormKey, false);
+ if (!uniForm) {
+ return;
+ }
+ const instance = getCurrentInstance();
+ const ctx = {
+ submit() {
+ const proxy = instance.proxy;
+ return [
+ proxy[nameKey],
+ typeof value === "string" ? proxy[value] : value.value
+ ];
+ },
+ reset() {
+ if (typeof value === "string") {
+ instance.proxy[value] = "";
+ } else {
+ value.value = "";
+ }
+ }
+ };
+ uniForm.addField(ctx);
+ onBeforeUnmount(() => {
+ uniForm.removeField(ctx);
+ });
+ }
+ const pageIds = [];
+ const UniViewJSBridgeSubscribe = function() {
+ const pageId2 = getCurrentPageId();
+ if (pageIds.includes(pageId2))
+ return;
+ pageIds.push(pageId2);
+ UniViewJSBridge.subscribe(pageId2 + ".getSelectedTextRange", function({ pageId: pageId22, callbackId }) {
+ const activeElement = document.activeElement;
+ if (!activeElement)
+ return;
+ const tagName = activeElement.tagName.toLowerCase();
+ const tagNames = ["input", "textarea"];
+ const data = {};
+ if (tagNames.includes(tagName)) {
+ data.start = activeElement.selectionStart;
+ data.end = activeElement.selectionEnd;
+ }
+ UniViewJSBridge.publishHandler("onGetSelectedTextRange", {
+ callbackId,
+ data
+ }, pageId22);
+ });
+ };
+ const FOCUS_DELAY = 200;
+ let startTime;
+ function getValueString(value) {
+ return value === null ? "" : String(value);
+ }
+ const props$h = /* @__PURE__ */ extend({}, {
+ name: {
+ type: String,
+ default: ""
+ },
+ modelValue: {
+ type: [String, Number],
+ default: ""
+ },
+ value: {
+ type: [String, Number],
+ default: ""
+ },
+ disabled: {
+ type: [Boolean, String],
+ default: false
+ },
+ autoFocus: {
+ type: [Boolean, String],
+ default: false
+ },
+ focus: {
+ type: [Boolean, String],
+ default: false
+ },
+ cursor: {
+ type: [Number, String],
+ default: -1
+ },
+ selectionStart: {
+ type: [Number, String],
+ default: -1
+ },
+ selectionEnd: {
+ type: [Number, String],
+ default: -1
+ },
+ type: {
+ type: String,
+ default: "text"
+ },
+ password: {
+ type: [Boolean, String],
+ default: false
+ },
+ placeholder: {
+ type: String,
+ default: ""
+ },
+ placeholderStyle: {
+ type: String,
+ default: ""
+ },
+ placeholderClass: {
+ type: String,
+ default: ""
+ },
+ maxlength: {
+ type: [Number, String],
+ default: 140
+ },
+ confirmType: {
+ type: String,
+ default: "done"
+ }
+ }, props$k);
+ const emit = [
+ "input",
+ "focus",
+ "blur",
+ "update:value",
+ "update:modelValue",
+ "update:focus",
+ ...emit$1
+ ];
+ function useBase(props2, rootRef, emit2) {
+ const fieldRef = ref(null);
+ const trigger2 = useCustomEvent(rootRef, emit2);
+ const selectionStart = computed$1(() => {
+ const selectionStart2 = Number(props2.selectionStart);
+ return isNaN(selectionStart2) ? -1 : selectionStart2;
+ });
+ const selectionEnd = computed$1(() => {
+ const selectionEnd2 = Number(props2.selectionEnd);
+ return isNaN(selectionEnd2) ? -1 : selectionEnd2;
+ });
+ const cursor = computed$1(() => {
+ const cursor2 = Number(props2.cursor);
+ return isNaN(cursor2) ? -1 : cursor2;
+ });
+ const maxlength = computed$1(() => {
+ var maxlength2 = Number(props2.maxlength);
+ return isNaN(maxlength2) ? 140 : maxlength2;
+ });
+ const value = getValueString(props2.modelValue) || getValueString(props2.value);
+ const state = reactive({
+ value,
+ valueOrigin: value,
+ maxlength,
+ focus: props2.focus,
+ composing: false,
+ selectionStart,
+ selectionEnd,
+ cursor
+ });
+ watch(() => state.focus, (val) => emit2("update:focus", val));
+ watch(() => state.maxlength, (val) => state.value = state.value.slice(0, val));
+ return {
+ fieldRef,
+ state,
+ trigger: trigger2
+ };
+ }
+ function useValueSync(props2, state, emit2, trigger2) {
+ const valueChangeFn = debounce((val) => {
+ state.value = getValueString(val);
+ }, 100);
+ watch(() => props2.modelValue, valueChangeFn);
+ watch(() => props2.value, valueChangeFn);
+ const triggerInputFn = throttle((event, detail) => {
+ valueChangeFn.cancel();
+ emit2("update:modelValue", detail.value);
+ emit2("update:value", detail.value);
+ trigger2("input", event, detail);
+ }, 100);
+ const triggerInput = (event, detail, force) => {
+ valueChangeFn.cancel();
+ triggerInputFn(event, detail);
+ if (force) {
+ triggerInputFn.flush();
+ }
+ };
+ onBeforeMount(() => {
+ valueChangeFn.cancel();
+ triggerInputFn.cancel();
+ });
+ return {
+ trigger: trigger2,
+ triggerInput
+ };
+ }
+ function useAutoFocus(props2, fieldRef) {
+ const { state: userActionState } = useUserAction();
+ const needFocus = computed$1(() => props2.autoFocus || props2.focus);
+ function focus() {
+ if (!needFocus.value) {
+ return;
+ }
+ const field = fieldRef.value;
+ if (!field || !("plus" in window)) {
+ setTimeout(focus, 100);
+ return;
+ }
+ {
+ const timeout = FOCUS_DELAY - (Date.now() - startTime);
+ if (timeout > 0) {
+ setTimeout(focus, timeout);
+ return;
+ }
+ field.focus();
+ if (!userActionState.userAction) {
+ plus.key.showSoftKeybord();
+ }
+ }
+ }
+ function blur() {
+ const field = fieldRef.value;
+ if (field) {
+ field.blur();
+ }
+ }
+ watch(() => props2.focus, (value) => {
+ if (value) {
+ focus();
+ } else {
+ blur();
+ }
+ });
+ onMounted(() => {
+ startTime = startTime || Date.now();
+ if (needFocus.value) {
+ nextTick(focus);
+ }
+ });
+ }
+ function useEvent(fieldRef, state, trigger2, triggerInput, beforeInput) {
+ function checkSelection() {
+ const field = fieldRef.value;
+ if (field && state.focus && state.selectionStart > -1 && state.selectionEnd > -1) {
+ field.selectionStart = state.selectionStart;
+ field.selectionEnd = state.selectionEnd;
+ }
+ }
+ function checkCursor() {
+ const field = fieldRef.value;
+ if (field && state.focus && state.selectionStart < 0 && state.selectionEnd < 0 && state.cursor > -1) {
+ field.selectionEnd = field.selectionStart = state.cursor;
+ }
+ }
+ function initField() {
+ const field = fieldRef.value;
+ const onFocus = function(event) {
+ state.focus = true;
+ trigger2("focus", event, {
+ value: state.value
+ });
+ checkSelection();
+ checkCursor();
+ };
+ const onInput = function(event, force) {
+ event.stopPropagation();
+ if (typeof beforeInput === "function" && beforeInput(event, state) === false) {
+ return;
+ }
+ state.value = field.value;
+ if (!state.composing) {
+ triggerInput(event, {
+ value: field.value,
+ cursor: field.selectionEnd
+ }, force);
+ }
+ };
+ const onBlur = function(event) {
+ if (state.composing) {
+ state.composing = false;
+ onInput(event, true);
+ }
+ state.focus = false;
+ trigger2("blur", event, {
+ value: state.value,
+ cursor: event.target.selectionEnd
+ });
+ };
+ field.addEventListener("change", (event) => event.stopPropagation());
+ field.addEventListener("focus", onFocus);
+ field.addEventListener("blur", onBlur);
+ field.addEventListener("input", onInput);
+ field.addEventListener("compositionstart", (event) => {
+ event.stopPropagation();
+ state.composing = true;
+ });
+ field.addEventListener("compositionend", (event) => {
+ event.stopPropagation();
+ if (state.composing) {
+ state.composing = false;
+ onInput(event);
+ }
+ });
+ }
+ watch([() => state.selectionStart, () => state.selectionEnd], checkSelection);
+ watch(() => state.cursor, checkCursor);
+ watch(() => fieldRef.value, initField);
+ }
+ function useField(props2, rootRef, emit2, beforeInput) {
+ UniViewJSBridgeSubscribe();
+ const { fieldRef, state, trigger: trigger2 } = useBase(props2, rootRef, emit2);
+ const { triggerInput } = useValueSync(props2, state, emit2, trigger2);
+ useAutoFocus(props2, fieldRef);
+ useKeyboard(props2, fieldRef, trigger2);
+ const { state: scopedAttrsState } = useScopedAttrs();
+ useFormField("name", state);
+ useEvent(fieldRef, state, trigger2, triggerInput, beforeInput);
+ const fixDisabledColor = String(navigator.vendor).indexOf("Apple") === 0 && CSS.supports("image-orientation:from-image");
+ return {
+ fieldRef,
+ state,
+ scopedAttrsState,
+ fixDisabledColor,
+ trigger: trigger2
+ };
+ }
+ const props$g = /* @__PURE__ */ extend({}, props$h, {
+ placeholderClass: {
+ type: String,
+ default: "input-placeholder"
+ },
+ textContentType: {
+ type: String,
+ default: ""
+ }
+ });
+ var Input = /* @__PURE__ */ defineBuiltInComponent({
+ name: "Input",
+ props: props$g,
+ emits: ["confirm", ...emit],
+ setup(props2, {
+ emit: emit2
+ }) {
+ const INPUT_TYPES = ["text", "number", "idcard", "digit", "password", "tel"];
+ const AUTOCOMPLETES = ["off", "one-time-code"];
+ const type = computed$1(() => {
+ let type2 = "";
+ switch (props2.type) {
+ case "text":
+ if (props2.confirmType === "search") {
+ type2 = "search";
+ }
+ break;
+ case "idcard":
+ type2 = "text";
+ break;
+ case "digit":
+ type2 = "number";
+ break;
+ default:
+ type2 = ~INPUT_TYPES.includes(props2.type) ? props2.type : "text";
+ break;
+ }
+ return props2.password ? "password" : type2;
+ });
+ const autocomplete = computed$1(() => {
+ const camelizeIndex = AUTOCOMPLETES.indexOf(props2.textContentType);
+ const kebabCaseIndex = AUTOCOMPLETES.indexOf(hyphenate(props2.textContentType));
+ const index2 = camelizeIndex !== -1 ? camelizeIndex : kebabCaseIndex !== -1 ? kebabCaseIndex : 0;
+ return AUTOCOMPLETES[index2];
+ });
+ let cache2 = ref("");
+ let resetCache;
+ const rootRef = ref(null);
+ const {
+ fieldRef,
+ state,
+ scopedAttrsState,
+ fixDisabledColor,
+ trigger: trigger2
+ } = useField(props2, rootRef, emit2, (event, state2) => {
+ const input2 = event.target;
+ if (type.value === "number") {
+ if (resetCache) {
+ input2.removeEventListener("blur", resetCache);
+ resetCache = null;
+ }
+ if (input2.validity && !input2.validity.valid) {
+ if (!cache2.value && event.data === "-" || cache2.value[0] === "-" && event.inputType === "deleteContentBackward") {
+ cache2.value = "-";
+ state2.value = "";
+ resetCache = () => {
+ cache2.value = input2.value = "";
+ };
+ input2.addEventListener("blur", resetCache);
+ return false;
+ }
+ cache2.value = state2.value = input2.value = cache2.value === "-" ? "" : cache2.value;
+ return false;
+ } else {
+ cache2.value = input2.value;
+ }
+ const maxlength = state2.maxlength;
+ if (maxlength > 0 && input2.value.length > maxlength) {
+ input2.value = input2.value.slice(0, maxlength);
+ state2.value = input2.value;
+ return false;
+ }
+ }
+ });
+ const NUMBER_TYPES = ["number", "digit"];
+ const step = computed$1(() => NUMBER_TYPES.includes(props2.type) ? "0.000000000000000001" : "");
+ function onKeyUpEnter(event) {
+ if (event.key !== "Enter") {
+ return;
+ }
+ event.stopPropagation();
+ trigger2("confirm", event, {
+ value: event.target.value
+ });
+ }
+ return () => {
+ let inputNode = props2.disabled && fixDisabledColor ? createVNode("input", {
+ "ref": fieldRef,
+ "value": state.value,
+ "tabindex": "-1",
+ "readonly": !!props2.disabled,
+ "type": type.value,
+ "maxlength": state.maxlength,
+ "step": step.value,
+ "class": "uni-input-input",
+ "onFocus": (event) => event.target.blur()
+ }, null, 40, ["value", "readonly", "type", "maxlength", "step", "onFocus"]) : createVNode("input", {
+ "ref": fieldRef,
+ "value": state.value,
+ "disabled": !!props2.disabled,
+ "type": type.value,
+ "maxlength": state.maxlength,
+ "step": step.value,
+ "enterkeyhint": props2.confirmType,
+ "pattern": props2.type === "number" ? "[0-9]*" : void 0,
+ "class": "uni-input-input",
+ "autocomplete": autocomplete.value,
+ "onKeyup": onKeyUpEnter
+ }, null, 40, ["value", "disabled", "type", "maxlength", "step", "enterkeyhint", "pattern", "autocomplete", "onKeyup"]);
+ return createVNode("uni-input", {
+ "ref": rootRef
+ }, {
+ default: () => [createVNode("div", {
+ "class": "uni-input-wrapper"
+ }, [withDirectives(createVNode("div", mergeProps(scopedAttrsState.attrs, {
+ "style": props2.placeholderStyle,
+ "class": ["uni-input-placeholder", props2.placeholderClass]
+ }), [props2.placeholder], 16), [[vShow, !(state.value.length || cache2.value === "-")]]), props2.confirmType === "search" ? createVNode("form", {
+ "action": "",
+ "onSubmit": (event) => event.preventDefault(),
+ "class": "uni-input-form"
+ }, [inputNode], 40, ["onSubmit"]) : inputNode])]
+ }, 512);
+ };
+ }
+ });
+ function entries(obj) {
+ return Object.keys(obj).map((key) => [key, obj[key]]);
+ }
+ const DEFAULT_EXCLUDE_KEYS = ["class", "style"];
+ const LISTENER_PREFIX = /^on[A-Z]+/;
+ const useAttrs = (params = {}) => {
+ const { excludeListeners = false, excludeKeys = [] } = params;
+ const instance = getCurrentInstance();
+ const attrs2 = shallowRef({});
+ const listeners = shallowRef({});
+ const excludeAttrs = shallowRef({});
+ const allExcludeKeys = excludeKeys.concat(DEFAULT_EXCLUDE_KEYS);
+ instance.attrs = reactive(instance.attrs);
+ watchEffect(() => {
+ const res = entries(instance.attrs).reduce((acc, [key, val]) => {
+ if (allExcludeKeys.includes(key)) {
+ acc.exclude[key] = val;
+ } else if (LISTENER_PREFIX.test(key)) {
+ if (!excludeListeners) {
+ acc.attrs[key] = val;
+ }
+ acc.listeners[key] = val;
+ } else {
+ acc.attrs[key] = val;
+ }
+ return acc;
+ }, {
+ exclude: {},
+ attrs: {},
+ listeners: {}
+ });
+ attrs2.value = res.attrs;
+ listeners.value = res.listeners;
+ excludeAttrs.value = res.exclude;
+ });
+ return { $attrs: attrs2, $listeners: listeners, $excludeAttrs: excludeAttrs };
+ };
+ let webview;
+ let pullToRefreshStyle;
+ function initScrollBounce() {
+ {
+ plusReady(() => {
+ if (!webview) {
+ webview = plus.webview.currentWebview();
+ }
+ if (!pullToRefreshStyle) {
+ pullToRefreshStyle = (webview.getStyle() || {}).pullToRefresh || {};
+ }
+ });
+ }
+ }
+ function disableScrollBounce({ disable }) {
+ {
+ if (pullToRefreshStyle && pullToRefreshStyle.support) {
+ webview.setPullToRefresh(Object.assign({}, pullToRefreshStyle, {
+ support: !disable
+ }));
+ }
+ }
+ }
+ function flatVNode(nodes) {
+ const array = [];
+ if (Array.isArray(nodes)) {
+ nodes.forEach((vnode) => {
+ if (isVNode(vnode)) {
+ if (vnode.type === Fragment) {
+ array.push(...flatVNode(vnode.children));
+ } else {
+ array.push(vnode);
+ }
+ } else if (Array.isArray(vnode)) {
+ array.push(...flatVNode(vnode));
+ }
+ });
+ }
+ return array;
+ }
+ const props$f = {
+ scaleArea: {
+ type: Boolean,
+ default: false
+ }
+ };
+ var MovableArea = /* @__PURE__ */ defineBuiltInComponent({
+ inheritAttrs: false,
+ name: "MovableArea",
+ props: props$f,
+ setup(props2, {
+ slots
+ }) {
+ const rootRef = ref(null);
+ const _isMounted = ref(false);
+ let {
+ setContexts,
+ events: movableAreaEvents
+ } = useMovableAreaState(props2, rootRef);
+ const {
+ $listeners,
+ $attrs,
+ $excludeAttrs
+ } = useAttrs();
+ const _listeners = $listeners.value;
+ let events = ["onTouchstart", "onTouchmove", "onTouchend"];
+ events.forEach((event) => {
+ let existing = _listeners[event];
+ let ours = movableAreaEvents[`_${event}`];
+ _listeners[event] = existing ? [].concat(existing, ours) : ours;
+ });
+ onMounted(() => {
+ movableAreaEvents._resize();
+ initScrollBounce();
+ _isMounted.value = true;
+ });
+ let movableViewItems = [];
+ const originMovableViewContexts = [];
+ function updateMovableViewContexts() {
+ const contexts = [];
+ for (let index2 = 0; index2 < movableViewItems.length; index2++) {
+ const movableViewItem = movableViewItems[index2];
+ const movableViewContext = originMovableViewContexts.find((context) => movableViewItem.el === context.rootRef.value);
+ if (movableViewContext) {
+ contexts.push(markRaw(movableViewContext));
+ }
+ }
+ setContexts(contexts);
+ }
+ const addMovableViewContext = (movableViewContext) => {
+ originMovableViewContexts.push(movableViewContext);
+ updateMovableViewContexts();
+ };
+ const removeMovableViewContext = (movableViewContext) => {
+ const index2 = originMovableViewContexts.indexOf(movableViewContext);
+ if (index2 >= 0) {
+ originMovableViewContexts.splice(index2, 1);
+ updateMovableViewContexts();
+ }
+ };
+ provide("_isMounted", _isMounted);
+ provide("movableAreaRootRef", rootRef);
+ provide("addMovableViewContext", addMovableViewContext);
+ provide("removeMovableViewContext", removeMovableViewContext);
+ return () => {
+ const defaultSlots = slots.default && slots.default();
+ movableViewItems = flatVNode(defaultSlots);
+ return createVNode("uni-movable-area", mergeProps({
+ "ref": rootRef
+ }, $attrs.value, $excludeAttrs.value, _listeners), {
+ default: () => [createVNode(ResizeSensor, {
+ "onReize": movableAreaEvents._resize
+ }, null, 8, ["onReize"]), movableViewItems],
+ _: 2
+ }, 16);
+ };
+ }
+ });
+ function calc(e2) {
+ return Math.sqrt(e2.x * e2.x + e2.y * e2.y);
+ }
+ function useMovableAreaState(props2, rootRef) {
+ const width = ref(0);
+ const height = ref(0);
+ const gapV = reactive({
+ x: null,
+ y: null
+ });
+ const pinchStartLen = ref(null);
+ let _scaleMovableView = null;
+ let movableViewContexts = [];
+ function _updateScale(e2) {
+ if (e2 && e2 !== 1) {
+ if (props2.scaleArea) {
+ movableViewContexts.forEach(function(item) {
+ item._setScale(e2);
+ });
+ } else {
+ if (_scaleMovableView) {
+ _scaleMovableView._setScale(e2);
+ }
+ }
+ }
+ }
+ function _find(target, items = movableViewContexts) {
+ let root = rootRef.value;
+ function get2(node) {
+ for (let i = 0; i < items.length; i++) {
+ const item = items[i];
+ if (node === item.rootRef.value) {
+ return item;
+ }
+ }
+ if (node === root || node === document.body || node === document) {
+ return null;
+ }
+ return get2(node.parentNode);
+ }
+ return get2(target);
+ }
+ const _onTouchstart = withWebEvent((t2) => {
+ disableScrollBounce({
+ disable: true
+ });
+ let i = t2.touches;
+ if (i) {
+ if (i.length > 1) {
+ let r = {
+ x: i[1].pageX - i[0].pageX,
+ y: i[1].pageY - i[0].pageY
+ };
+ pinchStartLen.value = calc(r);
+ gapV.x = r.x;
+ gapV.y = r.y;
+ if (!props2.scaleArea) {
+ let touch0 = _find(i[0].target);
+ let touch1 = _find(i[1].target);
+ _scaleMovableView = touch0 && touch0 === touch1 ? touch0 : null;
+ }
+ }
+ }
+ });
+ const _onTouchmove = withWebEvent((t2) => {
+ let n = t2.touches;
+ if (n) {
+ if (n.length > 1) {
+ t2.preventDefault();
+ let i = {
+ x: n[1].pageX - n[0].pageX,
+ y: n[1].pageY - n[0].pageY
+ };
+ if (gapV.x !== null && pinchStartLen.value && pinchStartLen.value > 0) {
+ let r = calc(i) / pinchStartLen.value;
+ _updateScale(r);
+ }
+ gapV.x = i.x;
+ gapV.y = i.y;
+ }
+ }
+ });
+ const _onTouchend = withWebEvent((e2) => {
+ disableScrollBounce({
+ disable: false
+ });
+ let t2 = e2.touches;
+ if (!(t2 && t2.length)) {
+ if (e2.changedTouches) {
+ gapV.x = 0;
+ gapV.y = 0;
+ pinchStartLen.value = null;
+ if (props2.scaleArea) {
+ movableViewContexts.forEach(function(item) {
+ item._endScale();
+ });
+ } else {
+ if (_scaleMovableView) {
+ _scaleMovableView._endScale();
+ }
+ }
+ }
+ }
+ });
+ function _resize() {
+ _getWH();
+ movableViewContexts.forEach(function(item, index2) {
+ item.setParent();
+ });
+ }
+ function _getWH() {
+ let style = window.getComputedStyle(rootRef.value);
+ let rect = rootRef.value.getBoundingClientRect();
+ width.value = rect.width - ["Left", "Right"].reduce(function(all, item) {
+ const LEFT = "border" + item + "Width";
+ const RIGHT = "padding" + item;
+ return all + parseFloat(style[LEFT]) + parseFloat(style[RIGHT]);
+ }, 0);
+ height.value = rect.height - ["Top", "Bottom"].reduce(function(all, item) {
+ const TOP = "border" + item + "Width";
+ const BOTTOM = "padding" + item;
+ return all + parseFloat(style[TOP]) + parseFloat(style[BOTTOM]);
+ }, 0);
+ }
+ provide("movableAreaWidth", width);
+ provide("movableAreaHeight", height);
+ return {
+ setContexts(contexts) {
+ movableViewContexts = contexts;
+ },
+ events: {
+ _onTouchstart,
+ _onTouchmove,
+ _onTouchend,
+ _resize
+ }
+ };
+ }
+ const addListenerToElement = function(element, type, callback, capture) {
+ element.addEventListener(type, ($event) => {
+ if (typeof callback === "function") {
+ if (callback($event) === false) {
+ if (typeof $event.cancelable !== "undefined" ? $event.cancelable : true) {
+ $event.preventDefault();
+ }
+ $event.stopPropagation();
+ }
+ }
+ }, {
+ passive: false
+ });
+ };
+ let __mouseMoveEventListener;
+ let __mouseUpEventListener;
+ function useTouchtrack(element, method, useCancel) {
+ onBeforeUnmount(() => {
+ document.removeEventListener("mousemove", __mouseMoveEventListener);
+ document.removeEventListener("mouseup", __mouseUpEventListener);
+ });
+ let x0 = 0;
+ let y0 = 0;
+ let x1 = 0;
+ let y1 = 0;
+ const fn = function($event, state, x, y) {
+ if (method({
+ target: $event.target,
+ currentTarget: $event.currentTarget,
+ preventDefault: $event.preventDefault.bind($event),
+ stopPropagation: $event.stopPropagation.bind($event),
+ touches: $event.touches,
+ changedTouches: $event.changedTouches,
+ detail: {
+ state,
+ x,
+ y,
+ dx: x - x0,
+ dy: y - y0,
+ ddx: x - x1,
+ ddy: y - y1,
+ timeStamp: $event.timeStamp
+ }
+ }) === false) {
+ return false;
+ }
+ };
+ let $eventOld = null;
+ let hasTouchStart;
+ let hasMouseDown;
+ addListenerToElement(element, "touchstart", function($event) {
+ hasTouchStart = true;
+ if ($event.touches.length === 1 && !$eventOld) {
+ $eventOld = $event;
+ x0 = x1 = $event.touches[0].pageX;
+ y0 = y1 = $event.touches[0].pageY;
+ return fn($event, "start", x0, y0);
+ }
+ });
+ addListenerToElement(element, "mousedown", function($event) {
+ hasMouseDown = true;
+ if (!hasTouchStart && !$eventOld) {
+ $eventOld = $event;
+ x0 = x1 = $event.pageX;
+ y0 = y1 = $event.pageY;
+ return fn($event, "start", x0, y0);
+ }
+ });
+ addListenerToElement(element, "touchmove", function($event) {
+ if ($event.touches.length === 1 && $eventOld) {
+ const res = fn($event, "move", $event.touches[0].pageX, $event.touches[0].pageY);
+ x1 = $event.touches[0].pageX;
+ y1 = $event.touches[0].pageY;
+ return res;
+ }
+ });
+ const mouseMoveEventListener = __mouseMoveEventListener = function($event) {
+ if (!hasTouchStart && hasMouseDown && $eventOld) {
+ const res = fn($event, "move", $event.pageX, $event.pageY);
+ x1 = $event.pageX;
+ y1 = $event.pageY;
+ return res;
+ }
+ };
+ document.addEventListener("mousemove", mouseMoveEventListener);
+ addListenerToElement(element, "touchend", function($event) {
+ if ($event.touches.length === 0 && $eventOld) {
+ hasTouchStart = false;
+ $eventOld = null;
+ return fn($event, "end", $event.changedTouches[0].pageX, $event.changedTouches[0].pageY);
+ }
+ });
+ const mouseUpEventListener = __mouseUpEventListener = function($event) {
+ hasMouseDown = false;
+ if (!hasTouchStart && $eventOld) {
+ $eventOld = null;
+ return fn($event, "end", $event.pageX, $event.pageY);
+ }
+ };
+ document.addEventListener("mouseup", mouseUpEventListener);
+ addListenerToElement(element, "touchcancel", function($event) {
+ if ($eventOld) {
+ hasTouchStart = false;
+ const $eventTemp = $eventOld;
+ $eventOld = null;
+ return fn($event, useCancel ? "cancel" : "end", $eventTemp.touches[0].pageX, $eventTemp.touches[0].pageY);
+ }
+ });
+ }
+ function e(e2, t2, n) {
+ return e2 > t2 - n && e2 < t2 + n;
+ }
+ function t(t2, n) {
+ return e(t2, 0, n);
+ }
+ function Decline() {
+ }
+ Decline.prototype.x = function(e2) {
+ return Math.sqrt(e2);
+ };
+ function Friction$1(e2, t2) {
+ this._m = e2;
+ this._f = 1e3 * t2;
+ this._startTime = 0;
+ this._v = 0;
+ }
+ Friction$1.prototype.setV = function(x, y) {
+ var n = Math.pow(Math.pow(x, 2) + Math.pow(y, 2), 0.5);
+ this._x_v = x;
+ this._y_v = y;
+ this._x_a = -this._f * this._x_v / n;
+ this._y_a = -this._f * this._y_v / n;
+ this._t = Math.abs(x / this._x_a) || Math.abs(y / this._y_a);
+ this._lastDt = null;
+ this._startTime = new Date().getTime();
+ };
+ Friction$1.prototype.setS = function(x, y) {
+ this._x_s = x;
+ this._y_s = y;
+ };
+ Friction$1.prototype.s = function(t2) {
+ if (t2 === void 0) {
+ t2 = (new Date().getTime() - this._startTime) / 1e3;
+ }
+ if (t2 > this._t) {
+ t2 = this._t;
+ this._lastDt = t2;
+ }
+ var x = this._x_v * t2 + 0.5 * this._x_a * Math.pow(t2, 2) + this._x_s;
+ var y = this._y_v * t2 + 0.5 * this._y_a * Math.pow(t2, 2) + this._y_s;
+ if (this._x_a > 0 && x < this._endPositionX || this._x_a < 0 && x > this._endPositionX) {
+ x = this._endPositionX;
+ }
+ if (this._y_a > 0 && y < this._endPositionY || this._y_a < 0 && y > this._endPositionY) {
+ y = this._endPositionY;
+ }
+ return {
+ x,
+ y
+ };
+ };
+ Friction$1.prototype.ds = function(t2) {
+ if (t2 === void 0) {
+ t2 = (new Date().getTime() - this._startTime) / 1e3;
+ }
+ if (t2 > this._t) {
+ t2 = this._t;
+ }
+ return {
+ dx: this._x_v + this._x_a * t2,
+ dy: this._y_v + this._y_a * t2
+ };
+ };
+ Friction$1.prototype.delta = function() {
+ return {
+ x: -1.5 * Math.pow(this._x_v, 2) / this._x_a || 0,
+ y: -1.5 * Math.pow(this._y_v, 2) / this._y_a || 0
+ };
+ };
+ Friction$1.prototype.dt = function() {
+ return -this._x_v / this._x_a;
+ };
+ Friction$1.prototype.done = function() {
+ var t2 = e(this.s().x, this._endPositionX) || e(this.s().y, this._endPositionY) || this._lastDt === this._t;
+ this._lastDt = null;
+ return t2;
+ };
+ Friction$1.prototype.setEnd = function(x, y) {
+ this._endPositionX = x;
+ this._endPositionY = y;
+ };
+ Friction$1.prototype.reconfigure = function(m, f2) {
+ this._m = m;
+ this._f = 1e3 * f2;
+ };
+ function Spring$1(m, k, c) {
+ this._m = m;
+ this._k = k;
+ this._c = c;
+ this._solution = null;
+ this._endPosition = 0;
+ this._startTime = 0;
+ }
+ Spring$1.prototype._solve = function(e2, t2) {
+ var n = this._c;
+ var i = this._m;
+ var r = this._k;
+ var o2 = n * n - 4 * i * r;
+ if (o2 === 0) {
+ const a2 = -n / (2 * i);
+ const s = e2;
+ const l = t2 / (a2 * e2);
+ return {
+ x: function(e3) {
+ return (s + l * e3) * Math.pow(Math.E, a2 * e3);
+ },
+ dx: function(e3) {
+ var t3 = Math.pow(Math.E, a2 * e3);
+ return a2 * (s + l * e3) * t3 + l * t3;
+ }
+ };
+ }
+ if (o2 > 0) {
+ const c = (-n - Math.sqrt(o2)) / (2 * i);
+ const u = (-n + Math.sqrt(o2)) / (2 * i);
+ const d = (t2 - c * e2) / (u - c);
+ const h2 = e2 - d;
+ return {
+ x: function(e3) {
+ var t3;
+ var n2;
+ if (e3 === this._t) {
+ t3 = this._powER1T;
+ n2 = this._powER2T;
+ }
+ this._t = e3;
+ if (!t3) {
+ t3 = this._powER1T = Math.pow(Math.E, c * e3);
+ }
+ if (!n2) {
+ n2 = this._powER2T = Math.pow(Math.E, u * e3);
+ }
+ return h2 * t3 + d * n2;
+ },
+ dx: function(e3) {
+ var t3;
+ var n2;
+ if (e3 === this._t) {
+ t3 = this._powER1T;
+ n2 = this._powER2T;
+ }
+ this._t = e3;
+ if (!t3) {
+ t3 = this._powER1T = Math.pow(Math.E, c * e3);
+ }
+ if (!n2) {
+ n2 = this._powER2T = Math.pow(Math.E, u * e3);
+ }
+ return h2 * c * t3 + d * u * n2;
+ }
+ };
+ }
+ var p2 = Math.sqrt(4 * i * r - n * n) / (2 * i);
+ var f2 = -n / 2 * i;
+ var v2 = e2;
+ var g2 = (t2 - f2 * e2) / p2;
+ return {
+ x: function(e3) {
+ return Math.pow(Math.E, f2 * e3) * (v2 * Math.cos(p2 * e3) + g2 * Math.sin(p2 * e3));
+ },
+ dx: function(e3) {
+ var t3 = Math.pow(Math.E, f2 * e3);
+ var n2 = Math.cos(p2 * e3);
+ var i2 = Math.sin(p2 * e3);
+ return t3 * (g2 * p2 * n2 - v2 * p2 * i2) + f2 * t3 * (g2 * i2 + v2 * n2);
+ }
+ };
+ };
+ Spring$1.prototype.x = function(e2) {
+ if (e2 === void 0) {
+ e2 = (new Date().getTime() - this._startTime) / 1e3;
+ }
+ return this._solution ? this._endPosition + this._solution.x(e2) : 0;
+ };
+ Spring$1.prototype.dx = function(e2) {
+ if (e2 === void 0) {
+ e2 = (new Date().getTime() - this._startTime) / 1e3;
+ }
+ return this._solution ? this._solution.dx(e2) : 0;
+ };
+ Spring$1.prototype.setEnd = function(e2, n, i) {
+ if (!i) {
+ i = new Date().getTime();
+ }
+ if (e2 !== this._endPosition || !t(n, 0.1)) {
+ n = n || 0;
+ var r = this._endPosition;
+ if (this._solution) {
+ if (t(n, 0.1)) {
+ n = this._solution.dx((i - this._startTime) / 1e3);
+ }
+ r = this._solution.x((i - this._startTime) / 1e3);
+ if (t(n, 0.1)) {
+ n = 0;
+ }
+ if (t(r, 0.1)) {
+ r = 0;
+ }
+ r += this._endPosition;
+ }
+ if (!(this._solution && t(r - e2, 0.1) && t(n, 0.1))) {
+ this._endPosition = e2;
+ this._solution = this._solve(r - this._endPosition, n);
+ this._startTime = i;
+ }
+ }
+ };
+ Spring$1.prototype.snap = function(e2) {
+ this._startTime = new Date().getTime();
+ this._endPosition = e2;
+ this._solution = {
+ x: function() {
+ return 0;
+ },
+ dx: function() {
+ return 0;
+ }
+ };
+ };
+ Spring$1.prototype.done = function(n) {
+ if (!n) {
+ n = new Date().getTime();
+ }
+ return e(this.x(), this._endPosition, 0.1) && t(this.dx(), 0.1);
+ };
+ Spring$1.prototype.reconfigure = function(m, t2, c) {
+ this._m = m;
+ this._k = t2;
+ this._c = c;
+ if (!this.done()) {
+ this._solution = this._solve(this.x() - this._endPosition, this.dx());
+ this._startTime = new Date().getTime();
+ }
+ };
+ Spring$1.prototype.springConstant = function() {
+ return this._k;
+ };
+ Spring$1.prototype.damping = function() {
+ return this._c;
+ };
+ Spring$1.prototype.configuration = function() {
+ function e2(e3, t3) {
+ e3.reconfigure(1, t3, e3.damping());
+ }
+ function t2(e3, t3) {
+ e3.reconfigure(1, e3.springConstant(), t3);
+ }
+ return [
+ {
+ label: "Spring Constant",
+ read: this.springConstant.bind(this),
+ write: e2.bind(this, this),
+ min: 100,
+ max: 1e3
+ },
+ {
+ label: "Damping",
+ read: this.damping.bind(this),
+ write: t2.bind(this, this),
+ min: 1,
+ max: 500
+ }
+ ];
+ };
+ function STD(e2, t2, n) {
+ this._springX = new Spring$1(e2, t2, n);
+ this._springY = new Spring$1(e2, t2, n);
+ this._springScale = new Spring$1(e2, t2, n);
+ this._startTime = 0;
+ }
+ STD.prototype.setEnd = function(e2, t2, n, i) {
+ var r = new Date().getTime();
+ this._springX.setEnd(e2, i, r);
+ this._springY.setEnd(t2, i, r);
+ this._springScale.setEnd(n, i, r);
+ this._startTime = r;
+ };
+ STD.prototype.x = function() {
+ var e2 = (new Date().getTime() - this._startTime) / 1e3;
+ return {
+ x: this._springX.x(e2),
+ y: this._springY.x(e2),
+ scale: this._springScale.x(e2)
+ };
+ };
+ STD.prototype.done = function() {
+ var e2 = new Date().getTime();
+ return this._springX.done(e2) && this._springY.done(e2) && this._springScale.done(e2);
+ };
+ STD.prototype.reconfigure = function(e2, t2, n) {
+ this._springX.reconfigure(e2, t2, n);
+ this._springY.reconfigure(e2, t2, n);
+ this._springScale.reconfigure(e2, t2, n);
+ };
+ const props$e = {
+ direction: {
+ type: String,
+ default: "none"
+ },
+ inertia: {
+ type: [Boolean, String],
+ default: false
+ },
+ outOfBounds: {
+ type: [Boolean, String],
+ default: false
+ },
+ x: {
+ type: [Number, String],
+ default: 0
+ },
+ y: {
+ type: [Number, String],
+ default: 0
+ },
+ damping: {
+ type: [Number, String],
+ default: 20
+ },
+ friction: {
+ type: [Number, String],
+ default: 2
+ },
+ disabled: {
+ type: [Boolean, String],
+ default: false
+ },
+ scale: {
+ type: [Boolean, String],
+ default: false
+ },
+ scaleMin: {
+ type: [Number, String],
+ default: 0.5
+ },
+ scaleMax: {
+ type: [Number, String],
+ default: 10
+ },
+ scaleValue: {
+ type: [Number, String],
+ default: 1
+ },
+ animation: {
+ type: [Boolean, String],
+ default: true
+ }
+ };
+ var MovableView = /* @__PURE__ */ defineBuiltInComponent({
+ name: "MovableView",
+ props: props$e,
+ emits: ["change", "scale"],
+ setup(props2, {
+ slots,
+ emit: emit2
+ }) {
+ const rootRef = ref(null);
+ const trigger2 = useCustomEvent(rootRef, emit2);
+ const {
+ setParent
+ } = useMovableViewState(props2, trigger2, rootRef);
+ return () => {
+ return createVNode("uni-movable-view", {
+ "ref": rootRef
+ }, {
+ default: () => [createVNode(ResizeSensor, {
+ "onResize": setParent
+ }, null, 8, ["onResize"]), slots.default && slots.default()],
+ _: 1
+ }, 512);
+ };
+ }
+ });
+ let requesting = false;
+ function _requestAnimationFrame(e2) {
+ if (!requesting) {
+ requesting = true;
+ requestAnimationFrame(function() {
+ e2();
+ requesting = false;
+ });
+ }
+ }
+ function p(t2, n) {
+ if (t2 === n) {
+ return 0;
+ }
+ let i = t2.offsetLeft;
+ return t2.offsetParent ? i += p(t2.offsetParent, n) : 0;
+ }
+ function f(t2, n) {
+ if (t2 === n) {
+ return 0;
+ }
+ let i = t2.offsetTop;
+ return t2.offsetParent ? i += f(t2.offsetParent, n) : 0;
+ }
+ function v(a2, b) {
+ return +((1e3 * a2 - 1e3 * b) / 1e3).toFixed(1);
+ }
+ function g(friction, execute, endCallback) {
+ let record = {
+ id: 0,
+ cancelled: false
+ };
+ let cancel = function(record2) {
+ if (record2 && record2.id) {
+ cancelAnimationFrame(record2.id);
+ }
+ if (record2) {
+ record2.cancelled = true;
+ }
+ };
+ function fn(record2, friction2, execute2, endCallback2) {
+ if (!record2 || !record2.cancelled) {
+ execute2(friction2);
+ let isDone = friction2.done();
+ if (!isDone) {
+ if (!record2.cancelled) {
+ record2.id = requestAnimationFrame(fn.bind(null, record2, friction2, execute2, endCallback2));
+ }
+ }
+ if (isDone && endCallback2) {
+ endCallback2(friction2);
+ }
+ }
+ }
+ fn(record, friction, execute, endCallback);
+ return {
+ cancel: cancel.bind(null, record),
+ model: friction
+ };
+ }
+ function _getPx(val) {
+ if (/\d+[ur]px$/i.test(val)) {
+ return uni.upx2px(parseFloat(val));
+ }
+ return Number(val) || 0;
+ }
+ function useMovableViewState(props2, trigger2, rootRef) {
+ const movableAreaWidth = inject("movableAreaWidth", ref(0));
+ const movableAreaHeight = inject("movableAreaHeight", ref(0));
+ const _isMounted = inject("_isMounted", ref(false));
+ const movableAreaRootRef = inject("movableAreaRootRef");
+ const addMovableViewContext = inject("addMovableViewContext", () => {
+ });
+ const removeMovableViewContext = inject("removeMovableViewContext", () => {
+ });
+ const xSync = ref(_getPx(props2.x));
+ const ySync = ref(_getPx(props2.y));
+ const scaleValueSync = ref(Number(props2.scaleValue) || 1);
+ const width = ref(0);
+ const height = ref(0);
+ const minX = ref(0);
+ const minY = ref(0);
+ const maxX = ref(0);
+ const maxY = ref(0);
+ let _SFA = null;
+ let _FA = null;
+ const _offset = {
+ x: 0,
+ y: 0
+ };
+ const _scaleOffset = {
+ x: 0,
+ y: 0
+ };
+ let _scale = 1;
+ let _oldScale = 1;
+ let _translateX = 0;
+ let _translateY = 0;
+ let _isScaling = false;
+ let _isTouching = false;
+ let __baseX;
+ let __baseY;
+ let _checkCanMove = null;
+ let _firstMoveDirection = null;
+ const _declineX = new Decline();
+ const _declineY = new Decline();
+ const __touchInfo = {
+ historyX: [0, 0],
+ historyY: [0, 0],
+ historyT: [0, 0]
+ };
+ const dampingNumber = computed$1(() => {
+ let val = Number(props2.damping);
+ return isNaN(val) ? 20 : val;
+ });
+ const frictionNumber = computed$1(() => {
+ let val = Number(props2.friction);
+ return isNaN(val) || val <= 0 ? 2 : val;
+ });
+ const scaleMinNumber = computed$1(() => {
+ let val = Number(props2.scaleMin);
+ return isNaN(val) ? 0.5 : val;
+ });
+ const scaleMaxNumber = computed$1(() => {
+ let val = Number(props2.scaleMax);
+ return isNaN(val) ? 10 : val;
+ });
+ const xMove = computed$1(() => props2.direction === "all" || props2.direction === "horizontal");
+ const yMove = computed$1(() => props2.direction === "all" || props2.direction === "vertical");
+ const _STD = new STD(1, 9 * Math.pow(dampingNumber.value, 2) / 40, dampingNumber.value);
+ const _friction = new Friction$1(1, frictionNumber.value);
+ watch(() => props2.x, (val) => {
+ xSync.value = _getPx(val);
+ });
+ watch(() => props2.y, (val) => {
+ ySync.value = _getPx(val);
+ });
+ watch(xSync, (val) => {
+ _setX(val);
+ });
+ watch(ySync, (val) => {
+ _setY(val);
+ });
+ watch(() => props2.scaleValue, (val) => {
+ scaleValueSync.value = Number(val) || 0;
+ });
+ watch(scaleValueSync, (val) => {
+ _setScaleValue(val);
+ });
+ watch(scaleMinNumber, () => {
+ _setScaleMinOrMax();
+ });
+ watch(scaleMaxNumber, () => {
+ _setScaleMinOrMax();
+ });
+ function FAandSFACancel() {
+ if (_FA) {
+ _FA.cancel();
+ }
+ if (_SFA) {
+ _SFA.cancel();
+ }
+ }
+ function _setX(val) {
+ if (xMove.value) {
+ if (val + _scaleOffset.x === _translateX) {
+ return _translateX;
+ } else {
+ if (_SFA) {
+ _SFA.cancel();
+ }
+ _animationTo(val + _scaleOffset.x, ySync.value + _scaleOffset.y, _scale);
+ }
+ }
+ return val;
+ }
+ function _setY(val) {
+ if (yMove.value) {
+ if (val + _scaleOffset.y === _translateY) {
+ return _translateY;
+ } else {
+ if (_SFA) {
+ _SFA.cancel();
+ }
+ _animationTo(xSync.value + _scaleOffset.x, val + _scaleOffset.y, _scale);
+ }
+ }
+ return val;
+ }
+ function _setScaleMinOrMax() {
+ if (!props2.scale) {
+ return false;
+ }
+ _updateScale(_scale, true);
+ _updateOldScale(_scale);
+ }
+ function _setScaleValue(scale) {
+ if (!props2.scale) {
+ return false;
+ }
+ scale = _adjustScale(scale);
+ _updateScale(scale, true);
+ _updateOldScale(scale);
+ return scale;
+ }
+ function __handleTouchStart() {
+ if (!_isScaling) {
+ if (!props2.disabled) {
+ disableScrollBounce({
+ disable: true
+ });
+ FAandSFACancel();
+ __touchInfo.historyX = [0, 0];
+ __touchInfo.historyY = [0, 0];
+ __touchInfo.historyT = [0, 0];
+ if (xMove.value) {
+ __baseX = _translateX;
+ }
+ if (yMove.value) {
+ __baseY = _translateY;
+ }
+ rootRef.value.style.willChange = "transform";
+ _checkCanMove = null;
+ _firstMoveDirection = null;
+ _isTouching = true;
+ }
+ }
+ }
+ function __handleTouchMove(event) {
+ if (!_isScaling && !props2.disabled && _isTouching) {
+ let x = _translateX;
+ let y = _translateY;
+ if (_firstMoveDirection === null) {
+ _firstMoveDirection = Math.abs(event.detail.dx / event.detail.dy) > 1 ? "htouchmove" : "vtouchmove";
+ }
+ if (xMove.value) {
+ x = event.detail.dx + __baseX;
+ __touchInfo.historyX.shift();
+ __touchInfo.historyX.push(x);
+ if (!yMove.value && _checkCanMove === null) {
+ _checkCanMove = Math.abs(event.detail.dx / event.detail.dy) < 1;
+ }
+ }
+ if (yMove.value) {
+ y = event.detail.dy + __baseY;
+ __touchInfo.historyY.shift();
+ __touchInfo.historyY.push(y);
+ if (!xMove.value && _checkCanMove === null) {
+ _checkCanMove = Math.abs(event.detail.dy / event.detail.dx) < 1;
+ }
+ }
+ __touchInfo.historyT.shift();
+ __touchInfo.historyT.push(event.detail.timeStamp);
+ if (!_checkCanMove) {
+ event.preventDefault();
+ let source = "touch";
+ if (x < minX.value) {
+ if (props2.outOfBounds) {
+ source = "touch-out-of-bounds";
+ x = minX.value - _declineX.x(minX.value - x);
+ } else {
+ x = minX.value;
+ }
+ } else if (x > maxX.value) {
+ if (props2.outOfBounds) {
+ source = "touch-out-of-bounds";
+ x = maxX.value + _declineX.x(x - maxX.value);
+ } else {
+ x = maxX.value;
+ }
+ }
+ if (y < minY.value) {
+ if (props2.outOfBounds) {
+ source = "touch-out-of-bounds";
+ y = minY.value - _declineY.x(minY.value - y);
+ } else {
+ y = minY.value;
+ }
+ } else {
+ if (y > maxY.value) {
+ if (props2.outOfBounds) {
+ source = "touch-out-of-bounds";
+ y = maxY.value + _declineY.x(y - maxY.value);
+ } else {
+ y = maxY.value;
+ }
+ }
+ }
+ _requestAnimationFrame(function() {
+ _setTransform(x, y, _scale, source);
+ });
+ }
+ }
+ }
+ function __handleTouchEnd() {
+ if (!_isScaling && !props2.disabled && _isTouching) {
+ disableScrollBounce({
+ disable: false
+ });
+ rootRef.value.style.willChange = "auto";
+ _isTouching = false;
+ if (!_checkCanMove && !_revise("out-of-bounds") && props2.inertia) {
+ const xv = 1e3 * (__touchInfo.historyX[1] - __touchInfo.historyX[0]) / (__touchInfo.historyT[1] - __touchInfo.historyT[0]);
+ const yv = 1e3 * (__touchInfo.historyY[1] - __touchInfo.historyY[0]) / (__touchInfo.historyT[1] - __touchInfo.historyT[0]);
+ _friction.setV(xv, yv);
+ _friction.setS(_translateX, _translateY);
+ const x0 = _friction.delta().x;
+ const y0 = _friction.delta().y;
+ let x = x0 + _translateX;
+ let y = y0 + _translateY;
+ if (x < minX.value) {
+ x = minX.value;
+ y = _translateY + (minX.value - _translateX) * y0 / x0;
+ } else {
+ if (x > maxX.value) {
+ x = maxX.value;
+ y = _translateY + (maxX.value - _translateX) * y0 / x0;
+ }
+ }
+ if (y < minY.value) {
+ y = minY.value;
+ x = _translateX + (minY.value - _translateY) * x0 / y0;
+ } else {
+ if (y > maxY.value) {
+ y = maxY.value;
+ x = _translateX + (maxY.value - _translateY) * x0 / y0;
+ }
+ }
+ _friction.setEnd(x, y);
+ _FA = g(_friction, function() {
+ let t2 = _friction.s();
+ let x2 = t2.x;
+ let y2 = t2.y;
+ _setTransform(x2, y2, _scale, "friction");
+ }, function() {
+ _FA.cancel();
+ });
+ }
+ }
+ if (!props2.outOfBounds && !props2.inertia) {
+ FAandSFACancel();
+ }
+ }
+ function _getLimitXY(x, y) {
+ let outOfBounds = false;
+ if (x > maxX.value) {
+ x = maxX.value;
+ outOfBounds = true;
+ } else {
+ if (x < minX.value) {
+ x = minX.value;
+ outOfBounds = true;
+ }
+ }
+ if (y > maxY.value) {
+ y = maxY.value;
+ outOfBounds = true;
+ } else {
+ if (y < minY.value) {
+ y = minY.value;
+ outOfBounds = true;
+ }
+ }
+ return {
+ x,
+ y,
+ outOfBounds
+ };
+ }
+ function _updateOffset() {
+ _offset.x = p(rootRef.value, movableAreaRootRef.value);
+ _offset.y = f(rootRef.value, movableAreaRootRef.value);
+ }
+ function _updateWH(scale) {
+ scale = scale || _scale;
+ scale = _adjustScale(scale);
+ let rect = rootRef.value.getBoundingClientRect();
+ height.value = rect.height / _scale;
+ width.value = rect.width / _scale;
+ let _height = height.value * scale;
+ let _width = width.value * scale;
+ _scaleOffset.x = (_width - width.value) / 2;
+ _scaleOffset.y = (_height - height.value) / 2;
+ }
+ function _updateBoundary() {
+ let x = 0 - _offset.x + _scaleOffset.x;
+ let _width = movableAreaWidth.value - width.value - _offset.x - _scaleOffset.x;
+ minX.value = Math.min(x, _width);
+ maxX.value = Math.max(x, _width);
+ let y = 0 - _offset.y + _scaleOffset.y;
+ let _height = movableAreaHeight.value - height.value - _offset.y - _scaleOffset.y;
+ minY.value = Math.min(y, _height);
+ maxY.value = Math.max(y, _height);
+ }
+ function _beginScale() {
+ _isScaling = true;
+ }
+ function _updateScale(scale, animat) {
+ if (props2.scale) {
+ scale = _adjustScale(scale);
+ _updateWH(scale);
+ _updateBoundary();
+ const limitXY = _getLimitXY(_translateX, _translateY);
+ const x = limitXY.x;
+ const y = limitXY.y;
+ if (animat) {
+ _animationTo(x, y, scale, "", true, true);
+ } else {
+ _requestAnimationFrame(function() {
+ _setTransform(x, y, scale, "", true, true);
+ });
+ }
+ }
+ }
+ function _updateOldScale(scale) {
+ _oldScale = scale;
+ }
+ function _adjustScale(scale) {
+ scale = Math.max(0.5, scaleMinNumber.value, scale);
+ scale = Math.min(10, scaleMaxNumber.value, scale);
+ return scale;
+ }
+ function _animationTo(x, y, scale, source, r, o2) {
+ FAandSFACancel();
+ if (!xMove.value) {
+ x = _translateX;
+ }
+ if (!yMove.value) {
+ y = _translateY;
+ }
+ if (!props2.scale) {
+ scale = _scale;
+ }
+ let limitXY = _getLimitXY(x, y);
+ x = limitXY.x;
+ y = limitXY.y;
+ if (!props2.animation) {
+ _setTransform(x, y, scale, source, r, o2);
+ return;
+ }
+ _STD._springX._solution = null;
+ _STD._springY._solution = null;
+ _STD._springScale._solution = null;
+ _STD._springX._endPosition = _translateX;
+ _STD._springY._endPosition = _translateY;
+ _STD._springScale._endPosition = _scale;
+ _STD.setEnd(x, y, scale, 1);
+ _SFA = g(_STD, function() {
+ let data = _STD.x();
+ let x2 = data.x;
+ let y2 = data.y;
+ let scale2 = data.scale;
+ _setTransform(x2, y2, scale2, source, r, o2);
+ }, function() {
+ _SFA.cancel();
+ });
+ }
+ function _revise(source) {
+ let limitXY = _getLimitXY(_translateX, _translateY);
+ let x = limitXY.x;
+ let y = limitXY.y;
+ let outOfBounds = limitXY.outOfBounds;
+ if (outOfBounds) {
+ _animationTo(x, y, _scale, source);
+ }
+ return outOfBounds;
+ }
+ function _setTransform(x, y, scale, source = "", r, o2) {
+ if (!(x !== null && x.toString() !== "NaN" && typeof x === "number")) {
+ x = _translateX || 0;
+ }
+ if (!(y !== null && y.toString() !== "NaN" && typeof y === "number")) {
+ y = _translateY || 0;
+ }
+ x = Number(x.toFixed(1));
+ y = Number(y.toFixed(1));
+ scale = Number(scale.toFixed(1));
+ if (!(_translateX === x && _translateY === y)) {
+ if (!r) {
+ trigger2("change", {}, {
+ x: v(x, _scaleOffset.x),
+ y: v(y, _scaleOffset.y),
+ source
+ });
+ }
+ }
+ if (!props2.scale) {
+ scale = _scale;
+ }
+ scale = _adjustScale(scale);
+ scale = +scale.toFixed(3);
+ if (o2 && scale !== _scale) {
+ trigger2("scale", {}, {
+ x,
+ y,
+ scale
+ });
+ }
+ let transform = "translateX(" + x + "px) translateY(" + y + "px) translateZ(0px) scale(" + scale + ")";
+ rootRef.value.style.transform = transform;
+ rootRef.value.style.webkitTransform = transform;
+ _translateX = x;
+ _translateY = y;
+ _scale = scale;
+ }
+ function setParent() {
+ if (!_isMounted.value) {
+ return;
+ }
+ FAandSFACancel();
+ let scale = props2.scale ? scaleValueSync.value : 1;
+ _updateOffset();
+ _updateWH(scale);
+ _updateBoundary();
+ _translateX = xSync.value + _scaleOffset.x;
+ _translateY = ySync.value + _scaleOffset.y;
+ let limitXY = _getLimitXY(_translateX, _translateY);
+ let x = limitXY.x;
+ let y = limitXY.y;
+ _setTransform(x, y, scale, "", true);
+ _updateOldScale(scale);
+ }
+ function _endScale() {
+ _isScaling = false;
+ _updateOldScale(_scale);
+ }
+ function _setScale(scale) {
+ if (scale) {
+ scale = _oldScale * scale;
+ _beginScale();
+ _updateScale(scale);
+ }
+ }
+ onMounted(() => {
+ useTouchtrack(rootRef.value, (event) => {
+ switch (event.detail.state) {
+ case "start":
+ __handleTouchStart();
+ break;
+ case "move":
+ __handleTouchMove(event);
+ break;
+ case "end":
+ __handleTouchEnd();
+ }
+ });
+ setParent();
+ _friction.reconfigure(1, frictionNumber.value);
+ _STD.reconfigure(1, 9 * Math.pow(dampingNumber.value, 2) / 40, dampingNumber.value);
+ rootRef.value.style.transformOrigin = "center";
+ initScrollBounce();
+ const context = {
+ rootRef,
+ setParent,
+ _endScale,
+ _setScale
+ };
+ addMovableViewContext(context);
+ onUnmounted(() => {
+ removeMovableViewContext(context);
+ });
+ });
+ onUnmounted(() => {
+ FAandSFACancel();
+ });
+ return {
+ setParent
+ };
+ }
+ const OPEN_TYPES = ["navigate", "redirect", "switchTab", "reLaunch", "navigateBack"];
+ const props$d = {
+ hoverClass: {
+ type: String,
+ default: "navigator-hover"
+ },
+ url: {
+ type: String,
+ default: ""
+ },
+ openType: {
+ type: String,
+ default: "navigate",
+ validator(value) {
+ return Boolean(~OPEN_TYPES.indexOf(value));
+ }
+ },
+ delta: {
+ type: Number,
+ default: 1
+ },
+ hoverStartTime: {
+ type: [Number, String],
+ default: 50
+ },
+ hoverStayTime: {
+ type: [Number, String],
+ default: 600
+ },
+ exists: {
+ type: String,
+ default: ""
+ },
+ hoverStopPropagation: {
+ type: Boolean,
+ default: false
+ }
+ };
+ var Navigator = /* @__PURE__ */ defineBuiltInComponent({
+ name: "Navigator",
+ compatConfig: {
+ MODE: 3
+ },
+ props: props$d,
+ setup(props2, {
+ slots
+ }) {
+ const {
+ hovering,
+ binding
+ } = useHover(props2);
+ function onClick($event) {
+ if (props2.openType !== "navigateBack" && !props2.url) {
+ console.error(" should have url attribute when using navigateTo, redirectTo, reLaunch or switchTab");
+ return;
+ }
+ switch (props2.openType) {
+ case "navigate":
+ uni.navigateTo({
+ url: props2.url
+ });
+ break;
+ case "redirect":
+ uni.redirectTo({
+ url: props2.url,
+ exists: props2.exists
+ });
+ break;
+ case "switchTab":
+ uni.switchTab({
+ url: props2.url
+ });
+ break;
+ case "reLaunch":
+ uni.reLaunch({
+ url: props2.url
+ });
+ break;
+ case "navigateBack":
+ uni.navigateBack({
+ delta: props2.delta
+ });
+ break;
+ }
+ }
+ return () => {
+ const {
+ hoverClass
+ } = props2;
+ const hasHoverClass = props2.hoverClass && props2.hoverClass !== "none";
+ return createVNode("uni-navigator", mergeProps({
+ "class": hasHoverClass && hovering.value ? hoverClass : ""
+ }, hasHoverClass && binding, {
+ "onClick": onClick
+ }), {
+ default: () => [slots.default && slots.default()]
+ }, 16, ["class", "onClick"]);
+ };
+ }
+ });
+ const props$c = {
+ value: {
+ type: Array,
+ default() {
+ return [];
+ },
+ validator: function(val) {
+ return Array.isArray(val) && val.filter((val2) => typeof val2 === "number").length === val.length;
+ }
+ },
+ indicatorStyle: {
+ type: String,
+ default: ""
+ },
+ indicatorClass: {
+ type: String,
+ default: ""
+ },
+ maskStyle: {
+ type: String,
+ default: ""
+ },
+ maskClass: {
+ type: String,
+ default: ""
+ }
+ };
+ function useState$1(props2) {
+ const value = reactive([...props2.value]);
+ const state = reactive({
+ value,
+ height: 34
+ });
+ watch(() => props2.value, (val, oldVal) => {
+ if (val === oldVal || val.length !== oldVal.length || val.findIndex((item, index2) => item !== oldVal[index2]) >= 0) {
+ state.value.length = val.length;
+ val.forEach((val2, index2) => {
+ if (val2 !== state.value[index2]) {
+ state.value.splice(index2, 1, val2);
+ }
+ });
+ }
+ });
+ return state;
+ }
+ var PickerView = /* @__PURE__ */ defineBuiltInComponent({
+ name: "PickerView",
+ props: props$c,
+ emits: ["change", "pickstart", "pickend", "update:value"],
+ setup(props2, {
+ slots,
+ emit: emit2
+ }) {
+ const rootRef = ref(null);
+ const trigger2 = useCustomEvent(rootRef, emit2);
+ const state = useState$1(props2);
+ const resizeSensorRef = ref(null);
+ onMounted(() => {
+ const resizeSensor = resizeSensorRef.value;
+ state.height = resizeSensor.$el.getBoundingClientRect().height;
+ });
+ let columnVNodes = [];
+ function getItemIndex(vnode) {
+ return columnVNodes.indexOf(vnode);
+ }
+ const getPickerViewColumn = function(columnInstance) {
+ const ref2 = computed$1({
+ get() {
+ const index2 = getItemIndex(columnInstance.vnode);
+ return state.value[index2] || 0;
+ },
+ set(current) {
+ const index2 = getItemIndex(columnInstance.vnode);
+ const oldCurrent = state.value[index2];
+ if (oldCurrent !== current) {
+ state.value.splice(index2, 1, current);
+ const value = state.value.map((val) => val);
+ emit2("update:value", value);
+ trigger2("change", {}, {
+ value
+ });
+ }
+ }
+ });
+ return ref2;
+ };
+ provide("getPickerViewColumn", getPickerViewColumn);
+ provide("pickerViewProps", props2);
+ provide("pickerViewState", state);
+ return () => {
+ const defaultSlots = slots.default && slots.default();
+ columnVNodes = flatVNode(defaultSlots);
+ return createVNode("uni-picker-view", {
+ "ref": rootRef
+ }, {
+ default: () => [createVNode(ResizeSensor, {
+ "ref": resizeSensorRef,
+ "onResize": ({
+ height
+ }) => state.height = height
+ }, null, 8, ["onResize"]), createVNode("div", {
+ "class": "uni-picker-view-wrapper"
+ }, [defaultSlots])],
+ _: 2
+ }, 512);
+ };
+ }
+ });
+ class Friction {
+ constructor(drag) {
+ this._drag = drag;
+ this._dragLog = Math.log(drag);
+ this._x = 0;
+ this._v = 0;
+ this._startTime = 0;
+ }
+ set(x, v2) {
+ this._x = x;
+ this._v = v2;
+ this._startTime = new Date().getTime();
+ }
+ setVelocityByEnd(e2) {
+ this._v = (e2 - this._x) * this._dragLog / (Math.pow(this._drag, 100) - 1);
+ }
+ x(e2) {
+ if (e2 === void 0) {
+ e2 = (new Date().getTime() - this._startTime) / 1e3;
+ }
+ const t2 = e2 === this._dt && this._powDragDt ? this._powDragDt : this._powDragDt = Math.pow(this._drag, e2);
+ this._dt = e2;
+ return this._x + this._v * t2 / this._dragLog - this._v / this._dragLog;
+ }
+ dx(e2) {
+ if (e2 === void 0) {
+ e2 = (new Date().getTime() - this._startTime) / 1e3;
+ }
+ const t2 = e2 === this._dt && this._powDragDt ? this._powDragDt : this._powDragDt = Math.pow(this._drag, e2);
+ this._dt = e2;
+ return this._v * t2;
+ }
+ done() {
+ return Math.abs(this.dx()) < 3;
+ }
+ reconfigure(e2) {
+ const t2 = this.x();
+ const n = this.dx();
+ this._drag = e2;
+ this._dragLog = Math.log(e2);
+ this.set(t2, n);
+ }
+ configuration() {
+ const e2 = this;
+ return [
+ {
+ label: "Friction",
+ read: function() {
+ return e2._drag;
+ },
+ write: function(t2) {
+ e2.reconfigure(t2);
+ },
+ min: 1e-3,
+ max: 0.1,
+ step: 1e-3
+ }
+ ];
+ }
+ }
+ function o(e2, t2, n) {
+ return e2 > t2 - n && e2 < t2 + n;
+ }
+ function a(e2, t2) {
+ return o(e2, 0, t2);
+ }
+ class Spring {
+ constructor(m, k, c) {
+ this._m = m;
+ this._k = k;
+ this._c = c;
+ this._solution = null;
+ this._endPosition = 0;
+ this._startTime = 0;
+ }
+ _solve(e2, t2) {
+ const n = this._c;
+ const i = this._m;
+ const r = this._k;
+ const o2 = n * n - 4 * i * r;
+ if (o2 === 0) {
+ const a3 = -n / (2 * i);
+ const s2 = e2;
+ const l2 = t2 / (a3 * e2);
+ return {
+ x: function(e22) {
+ return (s2 + l2 * e22) * Math.pow(Math.E, a3 * e22);
+ },
+ dx: function(e22) {
+ const t22 = Math.pow(Math.E, a3 * e22);
+ return a3 * (s2 + l2 * e22) * t22 + l2 * t22;
+ }
+ };
+ }
+ if (o2 > 0) {
+ const c = (-n - Math.sqrt(o2)) / (2 * i);
+ const u = (-n + Math.sqrt(o2)) / (2 * i);
+ const l2 = (t2 - c * e2) / (u - c);
+ const s2 = e2 - l2;
+ return {
+ x: function(e22) {
+ let t22;
+ let n2;
+ if (e22 === this._t) {
+ t22 = this._powER1T;
+ n2 = this._powER2T;
+ }
+ this._t = e22;
+ if (!t22) {
+ t22 = this._powER1T = Math.pow(Math.E, c * e22);
+ }
+ if (!n2) {
+ n2 = this._powER2T = Math.pow(Math.E, u * e22);
+ }
+ return s2 * t22 + l2 * n2;
+ },
+ dx: function(e22) {
+ let t22;
+ let n2;
+ if (e22 === this._t) {
+ t22 = this._powER1T;
+ n2 = this._powER2T;
+ }
+ this._t = e22;
+ if (!t22) {
+ t22 = this._powER1T = Math.pow(Math.E, c * e22);
+ }
+ if (!n2) {
+ n2 = this._powER2T = Math.pow(Math.E, u * e22);
+ }
+ return s2 * c * t22 + l2 * u * n2;
+ }
+ };
+ }
+ const d = Math.sqrt(4 * i * r - n * n) / (2 * i);
+ const a2 = -n / 2 * i;
+ const s = e2;
+ const l = (t2 - a2 * e2) / d;
+ return {
+ x: function(e22) {
+ return Math.pow(Math.E, a2 * e22) * (s * Math.cos(d * e22) + l * Math.sin(d * e22));
+ },
+ dx: function(e22) {
+ const t22 = Math.pow(Math.E, a2 * e22);
+ const n2 = Math.cos(d * e22);
+ const i2 = Math.sin(d * e22);
+ return t22 * (l * d * n2 - s * d * i2) + a2 * t22 * (l * i2 + s * n2);
+ }
+ };
+ }
+ x(e2) {
+ if (e2 === void 0) {
+ e2 = (new Date().getTime() - this._startTime) / 1e3;
+ }
+ return this._solution ? this._endPosition + this._solution.x(e2) : 0;
+ }
+ dx(e2) {
+ if (e2 === void 0) {
+ e2 = (new Date().getTime() - this._startTime) / 1e3;
+ }
+ return this._solution ? this._solution.dx(e2) : 0;
+ }
+ setEnd(e2, t2, n) {
+ if (!n) {
+ n = new Date().getTime();
+ }
+ if (e2 !== this._endPosition || !a(t2, 0.4)) {
+ t2 = t2 || 0;
+ let i = this._endPosition;
+ if (this._solution) {
+ if (a(t2, 0.4)) {
+ t2 = this._solution.dx((n - this._startTime) / 1e3);
+ }
+ i = this._solution.x((n - this._startTime) / 1e3);
+ if (a(t2, 0.4)) {
+ t2 = 0;
+ }
+ if (a(i, 0.4)) {
+ i = 0;
+ }
+ i += this._endPosition;
+ }
+ if (!(this._solution && a(i - e2, 0.4) && a(t2, 0.4))) {
+ this._endPosition = e2;
+ this._solution = this._solve(i - this._endPosition, t2);
+ this._startTime = n;
+ }
+ }
+ }
+ snap(e2) {
+ this._startTime = new Date().getTime();
+ this._endPosition = e2;
+ this._solution = {
+ x: function() {
+ return 0;
+ },
+ dx: function() {
+ return 0;
+ }
+ };
+ }
+ done(e2) {
+ if (!e2) {
+ e2 = new Date().getTime();
+ }
+ return o(this.x(), this._endPosition, 0.4) && a(this.dx(), 0.4);
+ }
+ reconfigure(e2, t2, n) {
+ this._m = e2;
+ this._k = t2;
+ this._c = n;
+ if (!this.done()) {
+ this._solution = this._solve(this.x() - this._endPosition, this.dx());
+ this._startTime = new Date().getTime();
+ }
+ }
+ springConstant() {
+ return this._k;
+ }
+ damping() {
+ return this._c;
+ }
+ configuration() {
+ function e2(e22, t22) {
+ e22.reconfigure(1, t22, e22.damping());
+ }
+ function t2(e22, t22) {
+ e22.reconfigure(1, e22.springConstant(), t22);
+ }
+ return [
+ {
+ label: "Spring Constant",
+ read: this.springConstant.bind(this),
+ write: e2.bind(this, this),
+ min: 100,
+ max: 1e3
+ },
+ {
+ label: "Damping",
+ read: this.damping.bind(this),
+ write: t2.bind(this, this),
+ min: 1,
+ max: 500
+ }
+ ];
+ }
+ }
+ class Scroll {
+ constructor(extent, friction, spring) {
+ this._extent = extent;
+ this._friction = friction || new Friction(0.01);
+ this._spring = spring || new Spring(1, 90, 20);
+ this._startTime = 0;
+ this._springing = false;
+ this._springOffset = 0;
+ }
+ snap(e2, t2) {
+ this._springOffset = 0;
+ this._springing = true;
+ this._spring.snap(e2);
+ this._spring.setEnd(t2);
+ }
+ set(e2, t2) {
+ this._friction.set(e2, t2);
+ if (e2 > 0 && t2 >= 0) {
+ this._springOffset = 0;
+ this._springing = true;
+ this._spring.snap(e2);
+ this._spring.setEnd(0);
+ } else {
+ if (e2 < -this._extent && t2 <= 0) {
+ this._springOffset = 0;
+ this._springing = true;
+ this._spring.snap(e2);
+ this._spring.setEnd(-this._extent);
+ } else {
+ this._springing = false;
+ }
+ }
+ this._startTime = new Date().getTime();
+ }
+ x(e2) {
+ if (!this._startTime) {
+ return 0;
+ }
+ if (!e2) {
+ e2 = (new Date().getTime() - this._startTime) / 1e3;
+ }
+ if (this._springing) {
+ return this._spring.x() + this._springOffset;
+ }
+ let t2 = this._friction.x(e2);
+ let n = this.dx(e2);
+ if (t2 > 0 && n >= 0 || t2 < -this._extent && n <= 0) {
+ this._springing = true;
+ this._spring.setEnd(0, n);
+ if (t2 < -this._extent) {
+ this._springOffset = -this._extent;
+ } else {
+ this._springOffset = 0;
+ }
+ t2 = this._spring.x() + this._springOffset;
+ }
+ return t2;
+ }
+ dx(e2) {
+ let t2;
+ if (this._lastTime === e2) {
+ t2 = this._lastDx;
+ } else {
+ t2 = this._springing ? this._spring.dx(e2) : this._friction.dx(e2);
+ }
+ this._lastTime = e2;
+ this._lastDx = t2;
+ return t2;
+ }
+ done() {
+ return this._springing ? this._spring.done() : this._friction.done();
+ }
+ setVelocityByEnd(e2) {
+ this._friction.setVelocityByEnd(e2);
+ }
+ configuration() {
+ const e2 = this._friction.configuration();
+ e2.push.apply(e2, this._spring.configuration());
+ return e2;
+ }
+ }
+ function createAnimation(scroll, onScroll, onEnd) {
+ const state = {
+ id: 0,
+ cancelled: false
+ };
+ function startAnimation2(state2, scroll2, onScroll2, onEnd2) {
+ if (!state2 || !state2.cancelled) {
+ onScroll2(scroll2);
+ const isDone = scroll2.done();
+ if (!isDone) {
+ if (!state2.cancelled) {
+ state2.id = requestAnimationFrame(startAnimation2.bind(null, state2, scroll2, onScroll2, onEnd2));
+ }
+ }
+ if (isDone && onEnd2) {
+ onEnd2(scroll2);
+ }
+ }
+ }
+ function cancel(state2) {
+ if (state2 && state2.id) {
+ cancelAnimationFrame(state2.id);
+ }
+ if (state2) {
+ state2.cancelled = true;
+ }
+ }
+ startAnimation2(state, scroll, onScroll, onEnd);
+ return {
+ cancel: cancel.bind(null, state),
+ model: scroll
+ };
+ }
+ class Scroller {
+ constructor(element, options) {
+ options = options || {};
+ this._element = element;
+ this._options = options;
+ this._enableSnap = options.enableSnap || false;
+ this._itemSize = options.itemSize || 0;
+ this._enableX = options.enableX || false;
+ this._enableY = options.enableY || false;
+ this._shouldDispatchScrollEvent = !!options.onScroll;
+ if (this._enableX) {
+ this._extent = (options.scrollWidth || this._element.offsetWidth) - this._element.parentElement.offsetWidth;
+ this._scrollWidth = options.scrollWidth;
+ } else {
+ this._extent = (options.scrollHeight || this._element.offsetHeight) - this._element.parentElement.offsetHeight;
+ this._scrollHeight = options.scrollHeight;
+ }
+ this._position = 0;
+ this._scroll = new Scroll(this._extent, options.friction, options.spring);
+ this._onTransitionEnd = this.onTransitionEnd.bind(this);
+ this.updatePosition();
+ }
+ onTouchStart() {
+ this._startPosition = this._position;
+ this._lastChangePos = this._startPosition;
+ if (this._startPosition > 0) {
+ this._startPosition /= 0.5;
+ } else {
+ if (this._startPosition < -this._extent) {
+ this._startPosition = (this._startPosition + this._extent) / 0.5 - this._extent;
+ }
+ }
+ if (this._animation) {
+ this._animation.cancel();
+ this._scrolling = false;
+ }
+ this.updatePosition();
+ }
+ onTouchMove(x, y) {
+ let startPosition = this._startPosition;
+ if (this._enableX) {
+ startPosition += x;
+ } else if (this._enableY) {
+ startPosition += y;
+ }
+ if (startPosition > 0) {
+ startPosition *= 0.5;
+ } else if (startPosition < -this._extent) {
+ startPosition = 0.5 * (startPosition + this._extent) - this._extent;
+ }
+ this._position = startPosition;
+ this.updatePosition();
+ this.dispatchScroll();
+ }
+ onTouchEnd(x, y, o2) {
+ if (this._enableSnap && this._position > -this._extent && this._position < 0) {
+ if (this._enableY && (Math.abs(y) < this._itemSize && Math.abs(o2.y) < 300 || Math.abs(o2.y) < 150)) {
+ this.snap();
+ return;
+ }
+ if (this._enableX && (Math.abs(x) < this._itemSize && Math.abs(o2.x) < 300 || Math.abs(o2.x) < 150)) {
+ this.snap();
+ return;
+ }
+ }
+ if (this._enableX) {
+ this._scroll.set(this._position, o2.x);
+ } else if (this._enableY) {
+ this._scroll.set(this._position, o2.y);
+ }
+ let c;
+ if (this._enableSnap) {
+ const s = this._scroll._friction.x(100);
+ const l = s % this._itemSize;
+ c = Math.abs(l) > this._itemSize / 2 ? s - (this._itemSize - Math.abs(l)) : s - l;
+ if (c <= 0 && c >= -this._extent) {
+ this._scroll.setVelocityByEnd(c);
+ }
+ }
+ this._lastTime = Date.now();
+ this._lastDelay = 0;
+ this._scrolling = true;
+ this._lastChangePos = this._position;
+ this._lastIdx = Math.floor(Math.abs(this._position / this._itemSize));
+ this._animation = createAnimation(this._scroll, () => {
+ const e2 = Date.now();
+ const i = (e2 - this._scroll._startTime) / 1e3;
+ const r = this._scroll.x(i);
+ this._position = r;
+ this.updatePosition();
+ const o22 = this._scroll.dx(i);
+ if (this._shouldDispatchScrollEvent && e2 - this._lastTime > this._lastDelay) {
+ this.dispatchScroll();
+ this._lastDelay = Math.abs(2e3 / o22);
+ this._lastTime = e2;
+ }
+ }, () => {
+ if (this._enableSnap) {
+ if (c <= 0 && c >= -this._extent) {
+ this._position = c;
+ this.updatePosition();
+ }
+ if (typeof this._options.onSnap === "function") {
+ this._options.onSnap(Math.floor(Math.abs(this._position) / this._itemSize));
+ }
+ }
+ if (this._shouldDispatchScrollEvent) {
+ this.dispatchScroll();
+ }
+ this._scrolling = false;
+ });
+ }
+ onTransitionEnd() {
+ this._element.style.webkitTransition = "";
+ this._element.style.transition = "";
+ this._element.removeEventListener("transitionend", this._onTransitionEnd);
+ if (this._snapping) {
+ this._snapping = false;
+ }
+ this.dispatchScroll();
+ }
+ snap() {
+ const itemSize = this._itemSize;
+ const position = this._position % itemSize;
+ const i = Math.abs(position) > this._itemSize / 2 ? this._position - (itemSize - Math.abs(position)) : this._position - position;
+ if (this._position !== i) {
+ this._snapping = true;
+ this.scrollTo(-i);
+ if (typeof this._options.onSnap === "function") {
+ this._options.onSnap(Math.floor(Math.abs(this._position) / this._itemSize));
+ }
+ }
+ }
+ scrollTo(position, time) {
+ if (this._animation) {
+ this._animation.cancel();
+ this._scrolling = false;
+ }
+ if (typeof position === "number") {
+ this._position = -position;
+ }
+ if (this._position < -this._extent) {
+ this._position = -this._extent;
+ } else {
+ if (this._position > 0) {
+ this._position = 0;
+ }
+ }
+ const transition = "transform " + (time || 0.2) + "s ease-out";
+ this._element.style.webkitTransition = "-webkit-" + transition;
+ this._element.style.transition = transition;
+ this.updatePosition();
+ this._element.addEventListener("transitionend", this._onTransitionEnd);
+ }
+ dispatchScroll() {
+ if (typeof this._options.onScroll === "function" && Math.round(Number(this._lastPos)) !== Math.round(this._position)) {
+ this._lastPos = this._position;
+ const event = {
+ target: {
+ scrollLeft: this._enableX ? -this._position : 0,
+ scrollTop: this._enableY ? -this._position : 0,
+ scrollHeight: this._scrollHeight || this._element.offsetHeight,
+ scrollWidth: this._scrollWidth || this._element.offsetWidth,
+ offsetHeight: this._element.parentElement.offsetHeight,
+ offsetWidth: this._element.parentElement.offsetWidth
+ }
+ };
+ this._options.onScroll(event);
+ }
+ }
+ update(height, scrollHeight, itemSize) {
+ let extent = 0;
+ const position = this._position;
+ if (this._enableX) {
+ extent = this._element.childNodes.length ? (scrollHeight || this._element.offsetWidth) - this._element.parentElement.offsetWidth : 0;
+ this._scrollWidth = scrollHeight;
+ } else {
+ extent = this._element.childNodes.length ? (scrollHeight || this._element.offsetHeight) - this._element.parentElement.offsetHeight : 0;
+ this._scrollHeight = scrollHeight;
+ }
+ if (typeof height === "number") {
+ this._position = -height;
+ }
+ if (this._position < -extent) {
+ this._position = -extent;
+ } else {
+ if (this._position > 0) {
+ this._position = 0;
+ }
+ }
+ this._itemSize = itemSize || this._itemSize;
+ this.updatePosition();
+ if (position !== this._position) {
+ this.dispatchScroll();
+ if (typeof this._options.onSnap === "function") {
+ this._options.onSnap(Math.floor(Math.abs(this._position) / this._itemSize));
+ }
+ }
+ this._extent = extent;
+ this._scroll._extent = extent;
+ }
+ updatePosition() {
+ let transform = "";
+ if (this._enableX) {
+ transform = "translateX(" + this._position + "px) translateZ(0)";
+ } else {
+ if (this._enableY) {
+ transform = "translateY(" + this._position + "px) translateZ(0)";
+ }
+ }
+ this._element.style.webkitTransform = transform;
+ this._element.style.transform = transform;
+ }
+ isScrolling() {
+ return this._scrolling || this._snapping;
+ }
+ }
+ function useScroller(element, options) {
+ const touchInfo = {
+ trackingID: -1,
+ maxDy: 0,
+ maxDx: 0
+ };
+ const scroller = new Scroller(element, options);
+ function findDelta(event) {
+ const touchtrackEvent = event;
+ const mouseEvent = event;
+ return touchtrackEvent.detail.state === "move" || touchtrackEvent.detail.state === "end" ? {
+ x: touchtrackEvent.detail.dx,
+ y: touchtrackEvent.detail.dy
+ } : {
+ x: mouseEvent.screenX - touchInfo.x,
+ y: mouseEvent.screenY - touchInfo.y
+ };
+ }
+ function handleTouchStart(event) {
+ const touchtrackEvent = event;
+ const mouseEvent = event;
+ if (touchtrackEvent.detail.state === "start") {
+ touchInfo.trackingID = "touch";
+ touchInfo.x = touchtrackEvent.detail.x;
+ touchInfo.y = touchtrackEvent.detail.y;
+ } else {
+ touchInfo.trackingID = "mouse";
+ touchInfo.x = mouseEvent.screenX;
+ touchInfo.y = mouseEvent.screenY;
+ }
+ touchInfo.maxDx = 0;
+ touchInfo.maxDy = 0;
+ touchInfo.historyX = [0];
+ touchInfo.historyY = [0];
+ touchInfo.historyTime = [
+ touchtrackEvent.detail.timeStamp || mouseEvent.timeStamp
+ ];
+ touchInfo.listener = scroller;
+ if (scroller.onTouchStart) {
+ scroller.onTouchStart();
+ }
+ event.preventDefault();
+ }
+ function handleTouchMove(event) {
+ const touchtrackEvent = event;
+ const mouseEvent = event;
+ if (touchInfo.trackingID !== -1) {
+ event.preventDefault();
+ const delta = findDelta(event);
+ if (delta) {
+ for (touchInfo.maxDy = Math.max(touchInfo.maxDy, Math.abs(delta.y)), touchInfo.maxDx = Math.max(touchInfo.maxDx, Math.abs(delta.x)), touchInfo.historyX.push(delta.x), touchInfo.historyY.push(delta.y), touchInfo.historyTime.push(touchtrackEvent.detail.timeStamp || mouseEvent.timeStamp); touchInfo.historyTime.length > 10; ) {
+ touchInfo.historyTime.shift();
+ touchInfo.historyX.shift();
+ touchInfo.historyY.shift();
+ }
+ if (touchInfo.listener && touchInfo.listener.onTouchMove) {
+ touchInfo.listener.onTouchMove(delta.x, delta.y);
+ }
+ }
+ }
+ }
+ function handleTouchEnd(event) {
+ if (touchInfo.trackingID !== -1) {
+ event.preventDefault();
+ const delta = findDelta(event);
+ if (delta) {
+ const listener = touchInfo.listener;
+ touchInfo.trackingID = -1;
+ touchInfo.listener = null;
+ const length = touchInfo.historyTime.length;
+ const o2 = {
+ x: 0,
+ y: 0
+ };
+ if (length > 2) {
+ for (let i = touchInfo.historyTime.length - 1, time1 = touchInfo.historyTime[i], x = touchInfo.historyX[i], y = touchInfo.historyY[i]; i > 0; ) {
+ i--;
+ const time0 = touchInfo.historyTime[i];
+ const time = time1 - time0;
+ if (time > 30 && time < 50) {
+ o2.x = (x - touchInfo.historyX[i]) / (time / 1e3);
+ o2.y = (y - touchInfo.historyY[i]) / (time / 1e3);
+ break;
+ }
+ }
+ }
+ touchInfo.historyTime = [];
+ touchInfo.historyX = [];
+ touchInfo.historyY = [];
+ if (listener && listener.onTouchEnd) {
+ listener.onTouchEnd(delta.x, delta.y, o2);
+ }
+ }
+ }
+ }
+ return {
+ scroller,
+ handleTouchStart,
+ handleTouchMove,
+ handleTouchEnd
+ };
+ }
+ let scopedIndex = 0;
+ function useScopedClass(indicatorHeightRef) {
+ const className = `uni-picker-view-content-${scopedIndex++}`;
+ function updateStyle() {
+ const style = document.createElement("style");
+ style.innerText = `.uni-picker-view-content.${className}>*{height: ${indicatorHeightRef.value}px;overflow: hidden;}`;
+ document.head.appendChild(style);
+ }
+ watch(() => indicatorHeightRef.value, updateStyle);
+ return className;
+ }
+ function useCustomClick(dom) {
+ const MAX_MOVE = 20;
+ let x = 0;
+ let y = 0;
+ dom.addEventListener("touchstart", (event) => {
+ const info = event.changedTouches[0];
+ x = info.clientX;
+ y = info.clientY;
+ });
+ dom.addEventListener("touchend", (event) => {
+ const info = event.changedTouches[0];
+ if (Math.abs(info.clientX - x) < MAX_MOVE && Math.abs(info.clientY - y) < MAX_MOVE) {
+ const options = {
+ bubbles: true,
+ cancelable: true,
+ target: event.target,
+ currentTarget: event.currentTarget
+ };
+ const customClick = new CustomEvent("click", options);
+ const props2 = ["screenX", "screenY", "clientX", "clientY", "pageX", "pageY"];
+ props2.forEach((key) => {
+ customClick[key] = info[key];
+ });
+ event.target.dispatchEvent(customClick);
+ }
+ });
+ }
+ var PickerViewColumn = /* @__PURE__ */ defineBuiltInComponent({
+ name: "PickerViewColumn",
+ setup(props2, {
+ slots,
+ emit: emit2
+ }) {
+ const rootRef = ref(null);
+ const contentRef = ref(null);
+ const getPickerViewColumn = inject("getPickerViewColumn");
+ const instance = getCurrentInstance();
+ const currentRef = getPickerViewColumn ? getPickerViewColumn(instance) : ref(0);
+ const pickerViewProps = inject("pickerViewProps");
+ const pickerViewState = inject("pickerViewState");
+ const indicatorHeight = ref(34);
+ const resizeSensorRef = ref(null);
+ onMounted(() => {
+ const resizeSensor = resizeSensorRef.value;
+ indicatorHeight.value = resizeSensor.$el.getBoundingClientRect().height;
+ });
+ const maskSize = computed$1(() => (pickerViewState.height - indicatorHeight.value) / 2);
+ const {
+ state: scopedAttrsState
+ } = useScopedAttrs();
+ const className = useScopedClass(indicatorHeight);
+ let scroller;
+ const state = reactive({
+ current: currentRef.value,
+ length: 0
+ });
+ function updatesScroller() {
+ if (scroller) {
+ nextTick(() => {
+ let current = Math.min(state.current, state.length - 1);
+ current = Math.max(current, 0);
+ scroller.update(current * indicatorHeight.value, void 0, indicatorHeight.value);
+ });
+ }
+ }
+ watch(() => currentRef.value, (current) => {
+ if (current !== state.current) {
+ state.current = current;
+ updatesScroller();
+ }
+ });
+ watch(() => state.current, (current) => currentRef.value = current);
+ watch([() => indicatorHeight.value, () => state.length, () => pickerViewState.height], updatesScroller);
+ let oldDeltaY = 0;
+ function handleWheel(event) {
+ const deltaY = oldDeltaY + event.deltaY;
+ if (Math.abs(deltaY) > 10) {
+ oldDeltaY = 0;
+ let current = Math.min(state.current + (deltaY < 0 ? -1 : 1), state.length - 1);
+ state.current = current = Math.max(current, 0);
+ scroller.scrollTo(current * indicatorHeight.value);
+ } else {
+ oldDeltaY = deltaY;
+ }
+ event.preventDefault();
+ }
+ function handleTap({
+ clientY
+ }) {
+ const el = rootRef.value;
+ if (!scroller.isScrolling()) {
+ const rect = el.getBoundingClientRect();
+ const r = clientY - rect.top - pickerViewState.height / 2;
+ const o2 = indicatorHeight.value / 2;
+ if (!(Math.abs(r) <= o2)) {
+ const a2 = Math.ceil((Math.abs(r) - o2) / indicatorHeight.value);
+ const s = r < 0 ? -a2 : a2;
+ let current = Math.min(state.current + s, state.length - 1);
+ state.current = current = Math.max(current, 0);
+ scroller.scrollTo(current * indicatorHeight.value);
+ }
+ }
+ }
+ onMounted(() => {
+ const el = rootRef.value;
+ const content = contentRef.value;
+ const {
+ scroller: scrollerOrigin,
+ handleTouchStart,
+ handleTouchMove,
+ handleTouchEnd
+ } = useScroller(content, {
+ enableY: true,
+ enableX: false,
+ enableSnap: true,
+ itemSize: indicatorHeight.value,
+ friction: new Friction(1e-4),
+ spring: new Spring(2, 90, 20),
+ onSnap: (index2) => {
+ if (!isNaN(index2) && index2 !== state.current) {
+ state.current = index2;
+ }
+ }
+ });
+ scroller = scrollerOrigin;
+ useTouchtrack(el, (e2) => {
+ switch (e2.detail.state) {
+ case "start":
+ handleTouchStart(e2);
+ disableScrollBounce({
+ disable: true
+ });
+ break;
+ case "move":
+ handleTouchMove(e2);
+ break;
+ case "end":
+ case "cancel":
+ handleTouchEnd(e2);
+ disableScrollBounce({
+ disable: false
+ });
+ }
+ }, true);
+ useCustomClick(el);
+ initScrollBounce();
+ updatesScroller();
+ });
+ return () => {
+ const defaultSlots = slots.default && slots.default();
+ state.length = flatVNode(defaultSlots).length;
+ const padding = `${maskSize.value}px 0`;
+ return createVNode("uni-picker-view-column", {
+ "ref": rootRef
+ }, {
+ default: () => [createVNode("div", {
+ "onWheel": handleWheel,
+ "onClick": handleTap,
+ "class": "uni-picker-view-group"
+ }, [createVNode("div", mergeProps(scopedAttrsState.attrs, {
+ "class": ["uni-picker-view-mask", pickerViewProps.maskClass],
+ "style": `background-size: 100% ${maskSize.value}px;${pickerViewProps.maskStyle}`
+ }), null, 16), createVNode("div", mergeProps(scopedAttrsState.attrs, {
+ "class": ["uni-picker-view-indicator", pickerViewProps.indicatorClass],
+ "style": pickerViewProps.indicatorStyle
+ }), [createVNode(ResizeSensor, {
+ "ref": resizeSensorRef,
+ "onResize": ({
+ height
+ }) => indicatorHeight.value = height
+ }, null, 8, ["onResize"])], 16), createVNode("div", {
+ "ref": contentRef,
+ "class": ["uni-picker-view-content", className],
+ "style": {
+ padding
+ }
+ }, [defaultSlots], 6)], 40, ["onWheel", "onClick"])]
+ }, 512);
+ };
+ }
+ });
+ const VALUES = {
+ activeColor: PRIMARY_COLOR,
+ backgroundColor: "#EBEBEB",
+ activeMode: "backwards"
+ };
+ const props$b = {
+ percent: {
+ type: [Number, String],
+ default: 0,
+ validator(value) {
+ return !isNaN(parseFloat(value));
+ }
+ },
+ showInfo: {
+ type: [Boolean, String],
+ default: false
+ },
+ strokeWidth: {
+ type: [Number, String],
+ default: 6,
+ validator(value) {
+ return !isNaN(parseFloat(value));
+ }
+ },
+ color: {
+ type: String,
+ default: VALUES.activeColor
+ },
+ activeColor: {
+ type: String,
+ default: VALUES.activeColor
+ },
+ backgroundColor: {
+ type: String,
+ default: VALUES.backgroundColor
+ },
+ active: {
+ type: [Boolean, String],
+ default: false
+ },
+ activeMode: {
+ type: String,
+ default: VALUES.activeMode
+ },
+ duration: {
+ type: [Number, String],
+ default: 30,
+ validator(value) {
+ return !isNaN(parseFloat(value));
+ }
+ }
+ };
+ var Progress = /* @__PURE__ */ defineBuiltInComponent({
+ name: "Progress",
+ props: props$b,
+ setup(props2) {
+ const state = useProgressState(props2);
+ _activeAnimation(state, props2);
+ watch(() => state.realPercent, (newValue, oldValue) => {
+ state.strokeTimer && clearInterval(state.strokeTimer);
+ state.lastPercent = oldValue || 0;
+ _activeAnimation(state, props2);
+ });
+ return () => {
+ const {
+ showInfo
+ } = props2;
+ const {
+ outerBarStyle,
+ innerBarStyle,
+ currentPercent
+ } = state;
+ return createVNode("uni-progress", {
+ "class": "uni-progress"
+ }, {
+ default: () => [createVNode("div", {
+ "style": outerBarStyle,
+ "class": "uni-progress-bar"
+ }, [createVNode("div", {
+ "style": innerBarStyle,
+ "class": "uni-progress-inner-bar"
+ }, null, 4)], 4), showInfo ? createVNode("p", {
+ "class": "uni-progress-info"
+ }, [currentPercent + "%"]) : ""],
+ _: 1
+ });
+ };
+ }
+ });
+ function useProgressState(props2) {
+ const currentPercent = ref(0);
+ const outerBarStyle = computed$1(() => `background-color: ${props2.backgroundColor}; height: ${props2.strokeWidth}px;`);
+ const innerBarStyle = computed$1(() => {
+ const backgroundColor = props2.color !== VALUES.activeColor && props2.activeColor === VALUES.activeColor ? props2.color : props2.activeColor;
+ return `width: ${currentPercent.value}%;background-color: ${backgroundColor}`;
+ });
+ const realPercent = computed$1(() => {
+ let realValue = parseFloat(props2.percent);
+ realValue < 0 && (realValue = 0);
+ realValue > 100 && (realValue = 100);
+ return realValue;
+ });
+ const state = reactive({
+ outerBarStyle,
+ innerBarStyle,
+ realPercent,
+ currentPercent,
+ strokeTimer: 0,
+ lastPercent: 0
+ });
+ return state;
+ }
+ function _activeAnimation(state, props2) {
+ if (props2.active) {
+ state.currentPercent = props2.activeMode === VALUES.activeMode ? 0 : state.lastPercent;
+ state.strokeTimer = setInterval(() => {
+ if (state.currentPercent + 1 > state.realPercent) {
+ state.currentPercent = state.realPercent;
+ state.strokeTimer && clearInterval(state.strokeTimer);
+ } else {
+ state.currentPercent += 1;
+ }
+ }, parseFloat(props2.duration));
+ } else {
+ state.currentPercent = state.realPercent;
+ }
+ }
+ const uniRadioGroupKey = PolySymbol("uniCheckGroup");
+ const props$a = {
+ name: {
+ type: String,
+ default: ""
+ }
+ };
+ var RadioGroup = /* @__PURE__ */ defineBuiltInComponent({
+ name: "RadioGroup",
+ props: props$a,
+ setup(props2, {
+ emit: emit2,
+ slots
+ }) {
+ const rootRef = ref(null);
+ const trigger2 = useCustomEvent(rootRef, emit2);
+ useProvideRadioGroup(props2, trigger2);
+ return () => {
+ return createVNode("uni-radio-group", {
+ "ref": rootRef
+ }, {
+ default: () => [slots.default && slots.default()]
+ }, 512);
+ };
+ }
+ });
+ function useProvideRadioGroup(props2, trigger2) {
+ const fields = [];
+ onMounted(() => {
+ _resetRadioGroupValue(fields.length - 1);
+ });
+ const getFieldsValue = () => {
+ var _a;
+ return (_a = fields.find((field) => field.value.radioChecked)) == null ? void 0 : _a.value.value;
+ };
+ provide(uniRadioGroupKey, {
+ addField(field) {
+ fields.push(field);
+ },
+ removeField(field) {
+ fields.splice(fields.indexOf(field), 1);
+ },
+ radioChange($event, field) {
+ const index2 = fields.indexOf(field);
+ _resetRadioGroupValue(index2, true);
+ trigger2("change", $event, {
+ value: getFieldsValue()
+ });
+ }
+ });
+ const uniForm = inject(uniFormKey, false);
+ if (uniForm) {
+ uniForm.addField({
+ submit: () => {
+ let data = ["", null];
+ if (props2.name !== "") {
+ data[0] = props2.name;
+ data[1] = getFieldsValue();
+ }
+ return data;
+ }
+ });
+ }
+ function setFieldChecked(field, radioChecked) {
+ field.value = {
+ radioChecked,
+ value: field.value.value
+ };
+ }
+ function _resetRadioGroupValue(key, change) {
+ fields.forEach((value, index2) => {
+ if (index2 === key) {
+ return;
+ }
+ if (change) {
+ setFieldChecked(fields[index2], false);
+ } else {
+ fields.forEach((v2, i) => {
+ if (index2 >= i) {
+ return;
+ }
+ if (fields[i].value.radioChecked) {
+ setFieldChecked(fields[index2], false);
+ }
+ });
+ }
+ });
+ }
+ return fields;
+ }
+ const props$9 = {
+ checked: {
+ type: [Boolean, String],
+ default: false
+ },
+ id: {
+ type: String,
+ default: ""
+ },
+ disabled: {
+ type: [Boolean, String],
+ default: false
+ },
+ color: {
+ type: String,
+ default: "#007aff"
+ },
+ value: {
+ type: String,
+ default: ""
+ }
+ };
+ var Radio = /* @__PURE__ */ defineBuiltInComponent({
+ name: "Radio",
+ props: props$9,
+ setup(props2, {
+ slots
+ }) {
+ const radioChecked = ref(props2.checked);
+ const radioValue = ref(props2.value);
+ const checkedStyle = computed$1(() => `background-color: ${props2.color};border-color: ${props2.color};`);
+ watch([() => props2.checked, () => props2.value], ([newChecked, newModelValue]) => {
+ radioChecked.value = newChecked;
+ radioValue.value = newModelValue;
+ });
+ const reset2 = () => {
+ radioChecked.value = false;
+ };
+ const {
+ uniCheckGroup,
+ uniLabel,
+ field
+ } = useRadioInject(radioChecked, radioValue, reset2);
+ const _onClick = ($event) => {
+ if (props2.disabled) {
+ return;
+ }
+ radioChecked.value = true;
+ uniCheckGroup && uniCheckGroup.radioChange($event, field);
+ };
+ if (!!uniLabel) {
+ uniLabel.addHandler(_onClick);
+ onBeforeUnmount(() => {
+ uniLabel.removeHandler(_onClick);
+ });
+ }
+ useListeners$1(props2, {
+ "label-click": _onClick
+ });
+ return () => {
+ const {
+ booleanAttrs
+ } = useBooleanAttr(props2, "disabled");
+ return createVNode("uni-radio", mergeProps(booleanAttrs, {
+ "onClick": _onClick
+ }), {
+ default: () => [createVNode("div", {
+ "class": "uni-radio-wrapper"
+ }, [createVNode("div", {
+ "class": ["uni-radio-input", {
+ "uni-radio-input-disabled": props2.disabled
+ }],
+ "style": radioChecked.value ? checkedStyle.value : ""
+ }, [radioChecked.value ? createSvgIconVNode(ICON_PATH_SUCCESS_NO_CIRCLE, "#fff", 18) : ""], 6), slots.default && slots.default()])]
+ }, 16, ["onClick"]);
+ };
+ }
+ });
+ function useRadioInject(radioChecked, radioValue, reset2) {
+ const field = computed$1({
+ get: () => ({
+ radioChecked: Boolean(radioChecked.value),
+ value: radioValue.value
+ }),
+ set: ({
+ radioChecked: checked
+ }) => {
+ radioChecked.value = checked;
+ }
+ });
+ const formField = {
+ reset: reset2
+ };
+ const uniCheckGroup = inject(uniRadioGroupKey, false);
+ if (!!uniCheckGroup) {
+ uniCheckGroup.addField(field);
+ }
+ const uniForm = inject(uniFormKey, false);
+ if (!!uniForm) {
+ uniForm.addField(formField);
+ }
+ const uniLabel = inject(uniLabelKey, false);
+ onBeforeUnmount(() => {
+ uniCheckGroup && uniCheckGroup.removeField(field);
+ uniForm && uniForm.removeField(formField);
+ });
+ return {
+ uniCheckGroup,
+ uniForm,
+ uniLabel,
+ field
+ };
+ }
+ function removeDOCTYPE(html) {
+ return html.replace(/<\?xml.*\?>\n/, "").replace(/\n/, "").replace(/\n/, "");
+ }
+ function parseAttrs(attrs2) {
+ return attrs2.reduce(function(pre, attr2) {
+ let value = attr2.value;
+ const name = attr2.name;
+ if (value.match(/ /) && name !== "style") {
+ value = value.split(" ");
+ }
+ if (pre[name]) {
+ if (Array.isArray(pre[name])) {
+ pre[name].push(value);
+ } else {
+ pre[name] = [pre[name], value];
+ }
+ } else {
+ pre[name] = value;
+ }
+ return pre;
+ }, {});
+ }
+ function parseHtml(html) {
+ html = removeDOCTYPE(html);
+ const stacks = [];
+ const results = {
+ node: "root",
+ children: []
+ };
+ HTMLParser(html, {
+ start: function(tag, attrs2, unary) {
+ const node = {
+ name: tag
+ };
+ if (attrs2.length !== 0) {
+ node.attrs = parseAttrs(attrs2);
+ }
+ if (unary) {
+ const parent = stacks[0] || results;
+ if (!parent.children) {
+ parent.children = [];
+ }
+ parent.children.push(node);
+ } else {
+ stacks.unshift(node);
+ }
+ },
+ end: function(tag) {
+ const node = stacks.shift();
+ if (node.name !== tag)
+ console.error("invalid state: mismatch end tag");
+ if (stacks.length === 0) {
+ results.children.push(node);
+ } else {
+ const parent = stacks[0];
+ if (!parent.children) {
+ parent.children = [];
+ }
+ parent.children.push(node);
+ }
+ },
+ chars: function(text2) {
+ const node = {
+ type: "text",
+ text: text2
+ };
+ if (stacks.length === 0) {
+ results.children.push(node);
+ } else {
+ const parent = stacks[0];
+ if (!parent.children) {
+ parent.children = [];
+ }
+ parent.children.push(node);
+ }
+ },
+ comment: function(text2) {
+ const node = {
+ node: "comment",
+ text: text2
+ };
+ const parent = stacks[0];
+ if (!parent.children) {
+ parent.children = [];
+ }
+ parent.children.push(node);
+ }
+ });
+ return results.children;
+ }
+ const TAGS = {
+ a: "",
+ abbr: "",
+ b: "",
+ blockquote: "",
+ br: "",
+ code: "",
+ col: ["span", "width"],
+ colgroup: ["span", "width"],
+ dd: "",
+ del: "",
+ div: "",
+ dl: "",
+ dt: "",
+ em: "",
+ fieldset: "",
+ h1: "",
+ h2: "",
+ h3: "",
+ h4: "",
+ h5: "",
+ h6: "",
+ hr: "",
+ i: "",
+ img: ["alt", "src", "height", "width"],
+ ins: "",
+ label: "",
+ legend: "",
+ li: "",
+ ol: ["start", "type"],
+ p: "",
+ q: "",
+ span: "",
+ strong: "",
+ sub: "",
+ sup: "",
+ table: ["width"],
+ tbody: "",
+ td: ["colspan", "rowspan", "height", "width"],
+ tfoot: "",
+ th: ["colspan", "rowspan", "height", "width"],
+ thead: "",
+ tr: "",
+ ul: ""
+ };
+ const CHARS = {
+ amp: "&",
+ gt: ">",
+ lt: "<",
+ nbsp: " ",
+ quot: '"',
+ apos: "'"
+ };
+ function decodeEntities(htmlString) {
+ return htmlString.replace(/&(([a-zA-Z]+)|(#x{0,1}[\da-zA-Z]+));/gi, function(match, stage) {
+ if (hasOwn$1(CHARS, stage) && CHARS[stage]) {
+ return CHARS[stage];
+ }
+ if (/^#[0-9]{1,4}$/.test(stage)) {
+ return String.fromCharCode(stage.slice(1));
+ }
+ if (/^#x[0-9a-f]{1,4}$/i.test(stage)) {
+ return String.fromCharCode("0" + stage.slice(1));
+ }
+ const wrap = document.createElement("div");
+ wrap.innerHTML = match;
+ return wrap.innerText || wrap.textContent;
+ });
+ }
+ function parseNodes(nodes, parentNode) {
+ nodes.forEach(function(node) {
+ if (!isPlainObject(node)) {
+ return;
+ }
+ if (!hasOwn$1(node, "type") || node.type === "node") {
+ if (!(typeof node.name === "string" && node.name)) {
+ return;
+ }
+ const tagName = node.name.toLowerCase();
+ if (!hasOwn$1(TAGS, tagName)) {
+ return;
+ }
+ const elem = document.createElement(tagName);
+ if (!elem) {
+ return;
+ }
+ const attrs2 = node.attrs;
+ if (isPlainObject(attrs2)) {
+ const tagAttrs = TAGS[tagName] || [];
+ Object.keys(attrs2).forEach(function(name) {
+ let value = attrs2[name];
+ switch (name) {
+ case "class":
+ Array.isArray(value) && (value = value.join(" "));
+ case "style":
+ elem.setAttribute(name, value);
+ break;
+ default:
+ if (tagAttrs.indexOf(name) !== -1) {
+ elem.setAttribute(name, value);
+ }
+ }
+ });
+ }
+ const children = node.children;
+ if (Array.isArray(children) && children.length) {
+ parseNodes(node.children, elem);
+ }
+ parentNode.appendChild(elem);
+ } else {
+ if (node.type === "text" && typeof node.text === "string" && node.text !== "") {
+ parentNode.appendChild(document.createTextNode(decodeEntities(node.text)));
+ }
+ }
+ });
+ return parentNode;
+ }
+ const props$8 = {
+ nodes: {
+ type: [Array, String],
+ default: function() {
+ return [];
+ }
+ }
+ };
+ var RichText = /* @__PURE__ */ defineBuiltInComponent({
+ name: "RichText",
+ compatConfig: {
+ MODE: 3
+ },
+ props: props$8,
+ setup(props2) {
+ const rootRef = ref(null);
+ function _renderNodes(nodes) {
+ if (typeof nodes === "string") {
+ nodes = parseHtml(nodes);
+ }
+ const nodeList = parseNodes(nodes, document.createDocumentFragment());
+ rootRef.value.firstElementChild.innerHTML = "";
+ rootRef.value.firstElementChild.appendChild(nodeList);
+ }
+ watch(() => props2.nodes, (value) => {
+ _renderNodes(value);
+ });
+ onMounted(() => {
+ _renderNodes(props2.nodes);
+ });
+ return () => {
+ return createVNode("uni-rich-text", {
+ "ref": rootRef
+ }, {
+ default: () => [createVNode("div", null, null)]
+ }, 512);
+ };
+ }
+ });
+ const passiveOptions = passive(true);
+ const props$7 = {
+ scrollX: {
+ type: [Boolean, String],
+ default: false
+ },
+ scrollY: {
+ type: [Boolean, String],
+ default: false
+ },
+ upperThreshold: {
+ type: [Number, String],
+ default: 50
+ },
+ lowerThreshold: {
+ type: [Number, String],
+ default: 50
+ },
+ scrollTop: {
+ type: [Number, String],
+ default: 0
+ },
+ scrollLeft: {
+ type: [Number, String],
+ default: 0
+ },
+ scrollIntoView: {
+ type: String,
+ default: ""
+ },
+ scrollWithAnimation: {
+ type: [Boolean, String],
+ default: false
+ },
+ enableBackToTop: {
+ type: [Boolean, String],
+ default: false
+ },
+ refresherEnabled: {
+ type: [Boolean, String],
+ default: false
+ },
+ refresherThreshold: {
+ type: Number,
+ default: 45
+ },
+ refresherDefaultStyle: {
+ type: String,
+ default: "back"
+ },
+ refresherBackground: {
+ type: String,
+ default: "#fff"
+ },
+ refresherTriggered: {
+ type: [Boolean, String],
+ default: false
+ }
+ };
+ var ScrollView = /* @__PURE__ */ defineBuiltInComponent({
+ name: "ScrollView",
+ compatConfig: {
+ MODE: 3
+ },
+ props: props$7,
+ emits: ["scroll", "scrolltoupper", "scrolltolower", "refresherrefresh", "refresherrestore", "refresherpulling", "refresherabort", "update:refresherTriggered"],
+ setup(props2, {
+ emit: emit2,
+ slots
+ }) {
+ const rootRef = ref(null);
+ const main = ref(null);
+ const wrap = ref(null);
+ const content = ref(null);
+ const refresherinner = ref(null);
+ const trigger2 = useCustomEvent(rootRef, emit2);
+ const {
+ state,
+ scrollTopNumber,
+ scrollLeftNumber
+ } = useScrollViewState(props2);
+ useScrollViewLoader(props2, state, scrollTopNumber, scrollLeftNumber, trigger2, rootRef, main, content, emit2);
+ const mainStyle = computed$1(() => {
+ let style = "";
+ props2.scrollX ? style += "overflow-x:auto;" : style += "overflow-x:hidden;";
+ props2.scrollY ? style += "overflow-y:auto;" : style += "overflow-y:hidden;";
+ return style;
+ });
+ return () => {
+ const {
+ refresherEnabled,
+ refresherBackground,
+ refresherDefaultStyle
+ } = props2;
+ const {
+ refresherHeight,
+ refreshState,
+ refreshRotate
+ } = state;
+ return createVNode("uni-scroll-view", {
+ "ref": rootRef
+ }, {
+ default: () => [createVNode("div", {
+ "ref": wrap,
+ "class": "uni-scroll-view"
+ }, [createVNode("div", {
+ "ref": main,
+ "style": mainStyle.value,
+ "class": "uni-scroll-view"
+ }, [createVNode("div", {
+ "ref": content,
+ "class": "uni-scroll-view-content"
+ }, [refresherEnabled ? createVNode("div", {
+ "ref": refresherinner,
+ "style": {
+ backgroundColor: refresherBackground,
+ height: refresherHeight + "px"
+ },
+ "class": "uni-scroll-view-refresher"
+ }, [refresherDefaultStyle !== "none" ? createVNode("div", {
+ "class": "uni-scroll-view-refresh"
+ }, [createVNode("div", {
+ "class": "uni-scroll-view-refresh-inner"
+ }, [refreshState == "pulling" ? createVNode("svg", {
+ "key": "refresh__icon",
+ "style": {
+ transform: "rotate(" + refreshRotate + "deg)"
+ },
+ "fill": "#2BD009",
+ "class": "uni-scroll-view-refresh__icon",
+ "width": "24",
+ "height": "24",
+ "viewBox": "0 0 24 24"
+ }, [createVNode("path", {
+ "d": "M17.65 6.35C16.2 4.9 14.21 4 12 4c-4.42 0-7.99 3.58-7.99 8s3.57 8 7.99 8c3.73 0 6.84-2.55 7.73-6h-2.08c-.82 2.33-3.04 4-5.65 4-3.31 0-6-2.69-6-6s2.69-6 6-6c1.66 0 3.14.69 4.22 1.78L13 11h7V4l-2.35 2.35z"
+ }, null), createVNode("path", {
+ "d": "M0 0h24v24H0z",
+ "fill": "none"
+ }, null)], 4) : null, refreshState == "refreshing" ? createVNode("svg", {
+ "key": "refresh__spinner",
+ "class": "uni-scroll-view-refresh__spinner",
+ "width": "24",
+ "height": "24",
+ "viewBox": "25 25 50 50"
+ }, [createVNode("circle", {
+ "cx": "50",
+ "cy": "50",
+ "r": "20",
+ "fill": "none",
+ "style": "color: #2bd009",
+ "stroke-width": "3"
+ }, null)]) : null])]) : null, refresherDefaultStyle == "none" ? slots.refresher && slots.refresher() : null], 4) : null, slots.default && slots.default()], 512)], 4)], 512)]
+ }, 512);
+ };
+ }
+ });
+ function useScrollViewState(props2) {
+ const scrollTopNumber = computed$1(() => {
+ return Number(props2.scrollTop) || 0;
+ });
+ const scrollLeftNumber = computed$1(() => {
+ return Number(props2.scrollLeft) || 0;
+ });
+ const state = reactive({
+ lastScrollTop: scrollTopNumber.value,
+ lastScrollLeft: scrollLeftNumber.value,
+ lastScrollToUpperTime: 0,
+ lastScrollToLowerTime: 0,
+ refresherHeight: 0,
+ refreshRotate: 0,
+ refreshState: ""
+ });
+ return {
+ state,
+ scrollTopNumber,
+ scrollLeftNumber
+ };
+ }
+ function useScrollViewLoader(props2, state, scrollTopNumber, scrollLeftNumber, trigger2, rootRef, main, content, emit2) {
+ let _lastScrollTime = 0;
+ let beforeRefreshing = false;
+ let toUpperNumber = 0;
+ let triggerAbort = false;
+ let __transitionEnd = () => {
+ };
+ const upperThresholdNumber = computed$1(() => {
+ let val = Number(props2.upperThreshold);
+ return isNaN(val) ? 50 : val;
+ });
+ const lowerThresholdNumber = computed$1(() => {
+ let val = Number(props2.lowerThreshold);
+ return isNaN(val) ? 50 : val;
+ });
+ function scrollTo(scrollToValue, direction2) {
+ const container = main.value;
+ let transformValue = 0;
+ let transform = "";
+ scrollToValue < 0 ? scrollToValue = 0 : direction2 === "x" && scrollToValue > container.scrollWidth - container.offsetWidth ? scrollToValue = container.scrollWidth - container.offsetWidth : direction2 === "y" && scrollToValue > container.scrollHeight - container.offsetHeight && (scrollToValue = container.scrollHeight - container.offsetHeight);
+ direction2 === "x" ? transformValue = container.scrollLeft - scrollToValue : direction2 === "y" && (transformValue = container.scrollTop - scrollToValue);
+ if (transformValue === 0)
+ return;
+ let _content = content.value;
+ _content.style.transition = "transform .3s ease-out";
+ _content.style.webkitTransition = "-webkit-transform .3s ease-out";
+ if (direction2 === "x") {
+ transform = "translateX(" + transformValue + "px) translateZ(0)";
+ } else {
+ direction2 === "y" && (transform = "translateY(" + transformValue + "px) translateZ(0)");
+ }
+ _content.removeEventListener("transitionend", __transitionEnd);
+ _content.removeEventListener("webkitTransitionEnd", __transitionEnd);
+ __transitionEnd = () => _transitionEnd(scrollToValue, direction2);
+ _content.addEventListener("transitionend", __transitionEnd);
+ _content.addEventListener("webkitTransitionEnd", __transitionEnd);
+ if (direction2 === "x") {
+ container.style.overflowX = "hidden";
+ } else if (direction2 === "y") {
+ container.style.overflowY = "hidden";
+ }
+ _content.style.transform = transform;
+ _content.style.webkitTransform = transform;
+ }
+ function _handleScroll($event) {
+ if ($event.timeStamp - _lastScrollTime > 20) {
+ _lastScrollTime = $event.timeStamp;
+ const target = $event.target;
+ trigger2("scroll", $event, {
+ scrollLeft: target.scrollLeft,
+ scrollTop: target.scrollTop,
+ scrollHeight: target.scrollHeight,
+ scrollWidth: target.scrollWidth,
+ deltaX: state.lastScrollLeft - target.scrollLeft,
+ deltaY: state.lastScrollTop - target.scrollTop
+ });
+ if (props2.scrollY) {
+ if (target.scrollTop <= upperThresholdNumber.value && state.lastScrollTop - target.scrollTop > 0 && $event.timeStamp - state.lastScrollToUpperTime > 200) {
+ trigger2("scrolltoupper", $event, {
+ direction: "top"
+ });
+ state.lastScrollToUpperTime = $event.timeStamp;
+ }
+ if (target.scrollTop + target.offsetHeight + lowerThresholdNumber.value >= target.scrollHeight && state.lastScrollTop - target.scrollTop < 0 && $event.timeStamp - state.lastScrollToLowerTime > 200) {
+ trigger2("scrolltolower", $event, {
+ direction: "bottom"
+ });
+ state.lastScrollToLowerTime = $event.timeStamp;
+ }
+ }
+ if (props2.scrollX) {
+ if (target.scrollLeft <= upperThresholdNumber.value && state.lastScrollLeft - target.scrollLeft > 0 && $event.timeStamp - state.lastScrollToUpperTime > 200) {
+ trigger2("scrolltoupper", $event, {
+ direction: "left"
+ });
+ state.lastScrollToUpperTime = $event.timeStamp;
+ }
+ if (target.scrollLeft + target.offsetWidth + lowerThresholdNumber.value >= target.scrollWidth && state.lastScrollLeft - target.scrollLeft < 0 && $event.timeStamp - state.lastScrollToLowerTime > 200) {
+ trigger2("scrolltolower", $event, {
+ direction: "right"
+ });
+ state.lastScrollToLowerTime = $event.timeStamp;
+ }
+ }
+ state.lastScrollTop = target.scrollTop;
+ state.lastScrollLeft = target.scrollLeft;
+ }
+ }
+ function _scrollTopChanged(val) {
+ if (props2.scrollY) {
+ {
+ if (props2.scrollWithAnimation) {
+ scrollTo(val, "y");
+ } else {
+ main.value.scrollTop = val;
+ }
+ }
+ }
+ }
+ function _scrollLeftChanged(val) {
+ if (props2.scrollX) {
+ {
+ if (props2.scrollWithAnimation) {
+ scrollTo(val, "x");
+ } else {
+ main.value.scrollLeft = val;
+ }
+ }
+ }
+ }
+ function _scrollIntoViewChanged(val) {
+ if (val) {
+ if (!/^[_a-zA-Z][-_a-zA-Z0-9:]*$/.test(val)) {
+ console.error(`id error: scroll-into-view=${val}`);
+ return;
+ }
+ let element = rootRef.value.querySelector("#" + val);
+ if (element) {
+ let mainRect = main.value.getBoundingClientRect();
+ let elRect = element.getBoundingClientRect();
+ if (props2.scrollX) {
+ let left = elRect.left - mainRect.left;
+ let scrollLeft = main.value.scrollLeft;
+ let x = scrollLeft + left;
+ if (props2.scrollWithAnimation) {
+ scrollTo(x, "x");
+ } else {
+ main.value.scrollLeft = x;
+ }
+ }
+ if (props2.scrollY) {
+ let top = elRect.top - mainRect.top;
+ let scrollTop = main.value.scrollTop;
+ let y = scrollTop + top;
+ if (props2.scrollWithAnimation) {
+ scrollTo(y, "y");
+ } else {
+ main.value.scrollTop = y;
+ }
+ }
+ }
+ }
+ }
+ function _transitionEnd(val, direction2) {
+ content.value.style.transition = "";
+ content.value.style.webkitTransition = "";
+ content.value.style.transform = "";
+ content.value.style.webkitTransform = "";
+ let _main = main.value;
+ if (direction2 === "x") {
+ _main.style.overflowX = props2.scrollX ? "auto" : "hidden";
+ _main.scrollLeft = val;
+ } else if (direction2 === "y") {
+ _main.style.overflowY = props2.scrollY ? "auto" : "hidden";
+ _main.scrollTop = val;
+ }
+ content.value.removeEventListener("transitionend", __transitionEnd);
+ content.value.removeEventListener("webkitTransitionEnd", __transitionEnd);
+ }
+ function _setRefreshState(_state) {
+ switch (_state) {
+ case "refreshing":
+ state.refresherHeight = props2.refresherThreshold;
+ if (!beforeRefreshing) {
+ beforeRefreshing = true;
+ trigger2("refresherrefresh", {}, {});
+ emit2("update:refresherTriggered", true);
+ }
+ break;
+ case "restore":
+ case "refresherabort":
+ beforeRefreshing = false;
+ state.refresherHeight = toUpperNumber = 0;
+ if (_state === "restore") {
+ triggerAbort = false;
+ trigger2("refresherrestore", {}, {});
+ }
+ if (_state === "refresherabort" && triggerAbort) {
+ triggerAbort = false;
+ trigger2("refresherabort", {}, {});
+ }
+ break;
+ }
+ state.refreshState = _state;
+ }
+ onMounted(() => {
+ _scrollTopChanged(scrollTopNumber.value);
+ _scrollLeftChanged(scrollLeftNumber.value);
+ _scrollIntoViewChanged(props2.scrollIntoView);
+ let __handleScroll = function(event) {
+ event.stopPropagation();
+ _handleScroll(event);
+ };
+ let touchStart = {
+ x: 0,
+ y: 0
+ };
+ let needStop = false;
+ let __handleTouchMove = function(event) {
+ let x = event.touches[0].pageX;
+ let y = event.touches[0].pageY;
+ let _main = main.value;
+ if (Math.abs(x - touchStart.x) > Math.abs(y - touchStart.y)) {
+ if (self.scrollX) {
+ if (_main.scrollLeft === 0 && x > touchStart.x) {
+ needStop = false;
+ return;
+ } else if (_main.scrollWidth === _main.offsetWidth + _main.scrollLeft && x < touchStart.x) {
+ needStop = false;
+ return;
+ }
+ needStop = true;
+ } else {
+ needStop = false;
+ }
+ } else {
+ if (self.scrollY) {
+ if (props2.refresherEnabled && _main.scrollTop === 0 && y > touchStart.y) {
+ needStop = true;
+ if (event.cancelable !== false)
+ event.preventDefault();
+ } else if (_main.scrollHeight === _main.offsetHeight + _main.scrollTop && y < touchStart.y) {
+ needStop = false;
+ return;
+ }
+ needStop = true;
+ } else {
+ needStop = false;
+ }
+ }
+ if (needStop) {
+ event.stopPropagation();
+ }
+ if (_main.scrollTop === 0 && event.touches.length === 1) {
+ state.refreshState = "pulling";
+ }
+ if (props2.refresherEnabled && state.refreshState === "pulling") {
+ const dy = y - touchStart.y;
+ if (toUpperNumber === 0) {
+ toUpperNumber = y;
+ }
+ if (!beforeRefreshing) {
+ state.refresherHeight = y - toUpperNumber;
+ if (state.refresherHeight > 0) {
+ triggerAbort = true;
+ trigger2("refresherpulling", event, {
+ deltaY: dy
+ });
+ }
+ } else {
+ state.refresherHeight = dy + props2.refresherThreshold;
+ triggerAbort = false;
+ }
+ const route = state.refresherHeight / props2.refresherThreshold;
+ state.refreshRotate = (route > 1 ? 1 : route) * 360;
+ }
+ };
+ let __handleTouchStart = function(event) {
+ if (event.touches.length === 1) {
+ disableScrollBounce({
+ disable: true
+ });
+ touchStart = {
+ x: event.touches[0].pageX,
+ y: event.touches[0].pageY
+ };
+ }
+ };
+ let __handleTouchEnd = function(event) {
+ touchStart = {
+ x: 0,
+ y: 0
+ };
+ disableScrollBounce({
+ disable: false
+ });
+ if (state.refresherHeight >= props2.refresherThreshold) {
+ _setRefreshState("refreshing");
+ } else {
+ _setRefreshState("refresherabort");
+ }
+ };
+ main.value.addEventListener("touchstart", __handleTouchStart, passiveOptions);
+ main.value.addEventListener("touchmove", __handleTouchMove);
+ main.value.addEventListener("scroll", __handleScroll, passiveOptions);
+ main.value.addEventListener("touchend", __handleTouchEnd, passiveOptions);
+ initScrollBounce();
+ onBeforeUnmount(() => {
+ main.value.removeEventListener("touchstart", __handleTouchStart);
+ main.value.removeEventListener("touchmove", __handleTouchMove);
+ main.value.removeEventListener("scroll", __handleScroll);
+ main.value.removeEventListener("touchend", __handleTouchEnd);
+ });
+ });
+ onActivated(() => {
+ props2.scrollY && (main.value.scrollTop = state.lastScrollTop);
+ props2.scrollX && (main.value.scrollLeft = state.lastScrollLeft);
+ });
+ watch(scrollTopNumber, (val) => {
+ _scrollTopChanged(val);
+ });
+ watch(scrollLeftNumber, (val) => {
+ _scrollLeftChanged(val);
+ });
+ watch(() => props2.scrollIntoView, (val) => {
+ _scrollIntoViewChanged(val);
+ });
+ watch(() => props2.refresherTriggered, (val) => {
+ if (val === true) {
+ _setRefreshState("refreshing");
+ } else if (val === false) {
+ _setRefreshState("restore");
+ }
+ });
+ }
+ const props$6 = {
+ name: {
+ type: String,
+ default: ""
+ },
+ min: {
+ type: [Number, String],
+ default: 0
+ },
+ max: {
+ type: [Number, String],
+ default: 100
+ },
+ value: {
+ type: [Number, String],
+ default: 0
+ },
+ step: {
+ type: [Number, String],
+ default: 1
+ },
+ disabled: {
+ type: [Boolean, String],
+ default: false
+ },
+ color: {
+ type: String,
+ default: "#e9e9e9"
+ },
+ backgroundColor: {
+ type: String,
+ default: "#e9e9e9"
+ },
+ activeColor: {
+ type: String,
+ default: "#007aff"
+ },
+ selectedColor: {
+ type: String,
+ default: "#007aff"
+ },
+ blockColor: {
+ type: String,
+ default: "#ffffff"
+ },
+ blockSize: {
+ type: [Number, String],
+ default: 28
+ },
+ showValue: {
+ type: [Boolean, String],
+ default: false
+ }
+ };
+ var Slider = /* @__PURE__ */ defineBuiltInComponent({
+ name: "Slider",
+ props: props$6,
+ emits: ["changing", "change"],
+ setup(props2, {
+ emit: emit2
+ }) {
+ const sliderRef = ref(null);
+ const sliderValueRef = ref(null);
+ const sliderHandleRef = ref(null);
+ const sliderValue = ref(Number(props2.value));
+ watch(() => props2.value, (val) => {
+ sliderValue.value = Number(val);
+ });
+ const trigger2 = useCustomEvent(sliderRef, emit2);
+ const state = useSliderState(props2, sliderValue);
+ const {
+ _onClick,
+ _onTrack
+ } = useSliderLoader(props2, sliderValue, sliderRef, sliderValueRef, trigger2);
+ onMounted(() => {
+ useTouchtrack(sliderHandleRef.value, _onTrack);
+ });
+ return () => {
+ const {
+ setBgColor,
+ setBlockBg,
+ setActiveColor,
+ setBlockStyle
+ } = state;
+ return createVNode("uni-slider", {
+ "ref": sliderRef,
+ "onClick": withWebEvent(_onClick)
+ }, {
+ default: () => [createVNode("div", {
+ "class": "uni-slider-wrapper"
+ }, [createVNode("div", {
+ "class": "uni-slider-tap-area"
+ }, [createVNode("div", {
+ "style": setBgColor.value,
+ "class": "uni-slider-handle-wrapper"
+ }, [createVNode("div", {
+ "ref": sliderHandleRef,
+ "style": setBlockBg.value,
+ "class": "uni-slider-handle"
+ }, null, 4), createVNode("div", {
+ "style": setBlockStyle.value,
+ "class": "uni-slider-thumb"
+ }, null, 4), createVNode("div", {
+ "style": setActiveColor.value,
+ "class": "uni-slider-track"
+ }, null, 4)], 4)]), withDirectives(createVNode("span", {
+ "ref": sliderValueRef,
+ "class": "uni-slider-value"
+ }, [sliderValue.value], 512), [[vShow, props2.showValue]])]), createVNode("slot", null, null)],
+ _: 1
+ }, 8, ["onClick"]);
+ };
+ }
+ });
+ function useSliderState(props2, sliderValue) {
+ const _getValueWidth = () => {
+ const max = Number(props2.max);
+ const min = Number(props2.min);
+ return 100 * (sliderValue.value - min) / (max - min) + "%";
+ };
+ const _getBgColor = () => {
+ return props2.backgroundColor !== "#e9e9e9" ? props2.backgroundColor : props2.color !== "#007aff" ? props2.color : "#007aff";
+ };
+ const _getActiveColor = () => {
+ return props2.activeColor !== "#007aff" ? props2.activeColor : props2.selectedColor !== "#e9e9e9" ? props2.selectedColor : "#e9e9e9";
+ };
+ const state = {
+ setBgColor: computed$1(() => ({
+ backgroundColor: _getBgColor()
+ })),
+ setBlockBg: computed$1(() => ({
+ left: _getValueWidth()
+ })),
+ setActiveColor: computed$1(() => ({
+ backgroundColor: _getActiveColor(),
+ width: _getValueWidth()
+ })),
+ setBlockStyle: computed$1(() => ({
+ width: props2.blockSize + "px",
+ height: props2.blockSize + "px",
+ marginLeft: -props2.blockSize / 2 + "px",
+ marginTop: -props2.blockSize / 2 + "px",
+ left: _getValueWidth(),
+ backgroundColor: props2.blockColor
+ }))
+ };
+ return state;
+ }
+ function useSliderLoader(props2, sliderValue, sliderRef, sliderValueRef, trigger2) {
+ const _onClick = ($event) => {
+ if (props2.disabled) {
+ return;
+ }
+ _onUserChangedValue($event);
+ trigger2("change", $event, {
+ value: sliderValue.value
+ });
+ };
+ const _filterValue = (e2) => {
+ const max = Number(props2.max);
+ const min = Number(props2.min);
+ const step = Number(props2.step);
+ return e2 < min ? min : e2 > max ? max : computeController.mul.call(Math.round((e2 - min) / step), step) + min;
+ };
+ const _onUserChangedValue = (e2) => {
+ const max = Number(props2.max);
+ const min = Number(props2.min);
+ const sliderRightBox = sliderValueRef.value;
+ const sliderRightBoxLeft = getComputedStyle(sliderRightBox, null).marginLeft;
+ let sliderRightBoxWidth = sliderRightBox.offsetWidth;
+ sliderRightBoxWidth = sliderRightBoxWidth + parseInt(sliderRightBoxLeft);
+ const slider2 = sliderRef.value;
+ const offsetWidth = slider2.offsetWidth - (props2.showValue ? sliderRightBoxWidth : 0);
+ const boxLeft = slider2.getBoundingClientRect().left;
+ const value = (e2.x - boxLeft) * (max - min) / offsetWidth + min;
+ sliderValue.value = _filterValue(value);
+ };
+ const _onTrack = (e2) => {
+ if (!props2.disabled) {
+ return e2.detail.state === "move" ? (_onUserChangedValue({
+ x: e2.detail.x
+ }), trigger2("changing", e2, {
+ value: sliderValue.value
+ }), false) : e2.detail.state === "end" && trigger2("change", e2, {
+ value: sliderValue.value
+ });
+ }
+ };
+ const uniForm = inject(uniFormKey, false);
+ if (!!uniForm) {
+ const field = {
+ reset: () => sliderValue.value = Number(props2.min),
+ submit: () => {
+ const data = ["", null];
+ if (props2.name !== "") {
+ data[0] = props2.name;
+ data[1] = sliderValue.value;
+ }
+ return data;
+ }
+ };
+ uniForm.addField(field);
+ onBeforeUnmount(() => {
+ uniForm.removeField(field);
+ });
+ }
+ return {
+ _onClick,
+ _onTrack
+ };
+ }
+ var computeController = {
+ mul: function(arg) {
+ let m = 0;
+ let s1 = this.toString();
+ let s2 = arg.toString();
+ try {
+ m += s1.split(".")[1].length;
+ } catch (e2) {
+ }
+ try {
+ m += s2.split(".")[1].length;
+ } catch (e2) {
+ }
+ return Number(s1.replace(".", "")) * Number(s2.replace(".", "")) / Math.pow(10, m);
+ }
+ };
+ const props$5 = {
+ indicatorDots: {
+ type: [Boolean, String],
+ default: false
+ },
+ vertical: {
+ type: [Boolean, String],
+ default: false
+ },
+ autoplay: {
+ type: [Boolean, String],
+ default: false
+ },
+ circular: {
+ type: [Boolean, String],
+ default: false
+ },
+ interval: {
+ type: [Number, String],
+ default: 5e3
+ },
+ duration: {
+ type: [Number, String],
+ default: 500
+ },
+ current: {
+ type: [Number, String],
+ default: 0
+ },
+ indicatorColor: {
+ type: String,
+ default: ""
+ },
+ indicatorActiveColor: {
+ type: String,
+ default: ""
+ },
+ previousMargin: {
+ type: String,
+ default: ""
+ },
+ nextMargin: {
+ type: String,
+ default: ""
+ },
+ currentItemId: {
+ type: String,
+ default: ""
+ },
+ skipHiddenItemLayout: {
+ type: [Boolean, String],
+ default: false
+ },
+ displayMultipleItems: {
+ type: [Number, String],
+ default: 1
+ },
+ disableTouch: {
+ type: [Boolean, String],
+ default: false
+ }
+ };
+ function useState(props2) {
+ const interval = computed$1(() => {
+ const interval2 = Number(props2.interval);
+ return isNaN(interval2) ? 5e3 : interval2;
+ });
+ const duration = computed$1(() => {
+ const duration2 = Number(props2.duration);
+ return isNaN(duration2) ? 500 : duration2;
+ });
+ const displayMultipleItems = computed$1(() => {
+ const displayMultipleItems2 = Math.round(props2.displayMultipleItems);
+ return isNaN(displayMultipleItems2) ? 1 : displayMultipleItems2;
+ });
+ const state = reactive({
+ interval,
+ duration,
+ displayMultipleItems,
+ current: Math.round(props2.current) || 0,
+ currentItemId: props2.currentItemId,
+ userTracking: false
+ });
+ return state;
+ }
+ function useLayout(props2, state, swiperContexts, slideFrameRef, emit2, trigger2) {
+ function cancelSchedule() {
+ if (timer) {
+ clearTimeout(timer);
+ timer = null;
+ }
+ }
+ let timer = null;
+ let invalid = true;
+ let viewportPosition = 0;
+ let viewportMoveRatio = 1;
+ let animating = null;
+ let requestedAnimation = false;
+ let contentTrackViewport = 0;
+ let transitionStart;
+ let currentChangeSource = "";
+ let animationFrame;
+ const circularEnabled = computed$1(() => props2.circular && swiperContexts.value.length > state.displayMultipleItems);
+ function checkCircularLayout(index2) {
+ if (!invalid) {
+ for (let items = swiperContexts.value, n = items.length, i = index2 + state.displayMultipleItems, r = 0; r < n; r++) {
+ const item = items[r];
+ const s = Math.floor(index2 / n) * n + r;
+ const l = s + n;
+ const c = s - n;
+ const u = Math.max(index2 - (s + 1), s - i, 0);
+ const d = Math.max(index2 - (l + 1), l - i, 0);
+ const h2 = Math.max(index2 - (c + 1), c - i, 0);
+ const p2 = Math.min(u, d, h2);
+ const position = [s, l, c][[u, d, h2].indexOf(p2)];
+ item.updatePosition(position, props2.vertical);
+ }
+ }
+ }
+ function updateViewport(index2) {
+ if (!(Math.floor(2 * viewportPosition) === Math.floor(2 * index2) && Math.ceil(2 * viewportPosition) === Math.ceil(2 * index2))) {
+ if (circularEnabled.value) {
+ checkCircularLayout(index2);
+ }
+ }
+ const x = props2.vertical ? "0" : 100 * -index2 * viewportMoveRatio + "%";
+ const y = props2.vertical ? 100 * -index2 * viewportMoveRatio + "%" : "0";
+ const transform = "translate(" + x + ", " + y + ") translateZ(0)";
+ const slideFrame = slideFrameRef.value;
+ if (slideFrame) {
+ slideFrame.style.webkitTransform = transform;
+ slideFrame.style.transform = transform;
+ }
+ viewportPosition = index2;
+ if (!transitionStart) {
+ if (index2 % 1 === 0) {
+ return;
+ }
+ transitionStart = index2;
+ }
+ index2 -= Math.floor(transitionStart);
+ const items = swiperContexts.value;
+ if (index2 <= -(items.length - 1)) {
+ index2 += items.length;
+ } else if (index2 >= items.length) {
+ index2 -= items.length;
+ }
+ index2 = transitionStart % 1 > 0.5 || transitionStart < 0 ? index2 - 1 : index2;
+ trigger2("transition", {}, {
+ dx: props2.vertical ? 0 : index2 * slideFrame.offsetWidth,
+ dy: props2.vertical ? index2 * slideFrame.offsetHeight : 0
+ });
+ }
+ function endViewportAnimation() {
+ if (animating) {
+ updateViewport(animating.toPos);
+ animating = null;
+ }
+ }
+ function normalizeCurrentValue(current) {
+ const length = swiperContexts.value.length;
+ if (!length) {
+ return -1;
+ }
+ const index2 = (Math.round(current) % length + length) % length;
+ if (circularEnabled.value) {
+ if (length <= state.displayMultipleItems) {
+ return 0;
+ }
+ } else if (index2 > length - state.displayMultipleItems) {
+ return length - state.displayMultipleItems;
+ }
+ return index2;
+ }
+ function cancelViewportAnimation() {
+ animating = null;
+ }
+ function animateFrameFuncProto() {
+ if (!animating) {
+ requestedAnimation = false;
+ return;
+ }
+ const _animating = animating;
+ const toPos = _animating.toPos;
+ const acc = _animating.acc;
+ const endTime = _animating.endTime;
+ const source = _animating.source;
+ const time = endTime - Date.now();
+ if (time <= 0) {
+ updateViewport(toPos);
+ animating = null;
+ requestedAnimation = false;
+ transitionStart = null;
+ const item = swiperContexts.value[state.current];
+ if (item) {
+ const currentItemId = item.getItemId();
+ trigger2("animationfinish", {}, {
+ current: state.current,
+ currentItemId,
+ source
+ });
+ }
+ return;
+ }
+ const s = acc * time * time / 2;
+ const l = toPos + s;
+ updateViewport(l);
+ animationFrame = requestAnimationFrame(animateFrameFuncProto);
+ }
+ function animateViewport(current, source, n) {
+ cancelViewportAnimation();
+ const duration = state.duration;
+ const length = swiperContexts.value.length;
+ let position = viewportPosition;
+ if (circularEnabled.value) {
+ if (n < 0) {
+ for (; position < current; ) {
+ position += length;
+ }
+ for (; position - length > current; ) {
+ position -= length;
+ }
+ } else if (n > 0) {
+ for (; position > current; ) {
+ position -= length;
+ }
+ for (; position + length < current; ) {
+ position += length;
+ }
+ } else {
+ for (; position + length < current; ) {
+ position += length;
+ }
+ for (; position - length > current; ) {
+ position -= length;
+ }
+ if (position + length - current < current - position) {
+ position += length;
+ }
+ }
+ }
+ animating = {
+ toPos: current,
+ acc: 2 * (position - current) / (duration * duration),
+ endTime: Date.now() + duration,
+ source
+ };
+ if (!requestedAnimation) {
+ requestedAnimation = true;
+ animationFrame = requestAnimationFrame(animateFrameFuncProto);
+ }
+ }
+ function scheduleAutoplay() {
+ cancelSchedule();
+ const items = swiperContexts.value;
+ const callback = function() {
+ timer = null;
+ currentChangeSource = "autoplay";
+ if (circularEnabled.value) {
+ state.current = normalizeCurrentValue(state.current + 1);
+ } else {
+ state.current = state.current + state.displayMultipleItems < items.length ? state.current + 1 : 0;
+ }
+ animateViewport(state.current, "autoplay", circularEnabled.value ? 1 : 0);
+ timer = setTimeout(callback, state.interval);
+ };
+ if (!(invalid || items.length <= state.displayMultipleItems)) {
+ timer = setTimeout(callback, state.interval);
+ }
+ }
+ function resetLayout() {
+ cancelSchedule();
+ endViewportAnimation();
+ const items = swiperContexts.value;
+ for (let i = 0; i < items.length; i++) {
+ items[i].updatePosition(i, props2.vertical);
+ }
+ viewportMoveRatio = 1;
+ const slideFrameEl = slideFrameRef.value;
+ if (state.displayMultipleItems === 1 && items.length) {
+ const itemRect = items[0].getBoundingClientRect();
+ const slideFrameRect = slideFrameEl.getBoundingClientRect();
+ viewportMoveRatio = itemRect.width / slideFrameRect.width;
+ if (!(viewportMoveRatio > 0 && viewportMoveRatio < 1)) {
+ viewportMoveRatio = 1;
+ }
+ }
+ const position = viewportPosition;
+ viewportPosition = -2;
+ const current = state.current;
+ if (current >= 0) {
+ invalid = false;
+ if (state.userTracking) {
+ updateViewport(position + current - contentTrackViewport);
+ contentTrackViewport = current;
+ } else {
+ updateViewport(current);
+ if (props2.autoplay) {
+ scheduleAutoplay();
+ }
+ }
+ } else {
+ invalid = true;
+ updateViewport(-state.displayMultipleItems - 1);
+ }
+ }
+ watch([() => props2.current, () => props2.currentItemId, () => [...swiperContexts.value]], () => {
+ let current = -1;
+ if (props2.currentItemId) {
+ for (let i = 0, items = swiperContexts.value; i < items.length; i++) {
+ const itemId = items[i].getItemId();
+ if (itemId === props2.currentItemId) {
+ current = i;
+ break;
+ }
+ }
+ }
+ if (current < 0) {
+ current = Math.round(props2.current) || 0;
+ }
+ current = current < 0 ? 0 : current;
+ if (state.current !== current) {
+ currentChangeSource = "";
+ state.current = current;
+ }
+ });
+ watch([() => props2.vertical, () => circularEnabled.value, () => state.displayMultipleItems, () => [...swiperContexts.value]], resetLayout);
+ watch(() => state.interval, () => {
+ if (timer) {
+ cancelSchedule();
+ scheduleAutoplay();
+ }
+ });
+ function currentChanged(current, history) {
+ const source = currentChangeSource;
+ currentChangeSource = "";
+ const items = swiperContexts.value;
+ if (!source) {
+ const length = items.length;
+ animateViewport(current, "", circularEnabled.value && history + (length - current) % length > length / 2 ? 1 : 0);
+ }
+ const item = items[current];
+ if (item) {
+ const currentItemId = state.currentItemId = item.getItemId();
+ trigger2("change", {}, {
+ current: state.current,
+ currentItemId,
+ source
+ });
+ }
+ }
+ watch(() => state.current, (val, oldVal) => {
+ currentChanged(val, oldVal);
+ emit2("update:current", val);
+ });
+ watch(() => state.currentItemId, (val) => {
+ emit2("update:currentItemId", val);
+ });
+ function inintAutoplay(enable) {
+ if (enable) {
+ scheduleAutoplay();
+ } else {
+ cancelSchedule();
+ }
+ }
+ watch(() => props2.autoplay && !state.userTracking, inintAutoplay);
+ inintAutoplay(props2.autoplay && !state.userTracking);
+ onMounted(() => {
+ let userDirectionChecked = false;
+ let contentTrackSpeed = 0;
+ let contentTrackT = 0;
+ function handleTrackStart() {
+ cancelSchedule();
+ contentTrackViewport = viewportPosition;
+ contentTrackSpeed = 0;
+ contentTrackT = Date.now();
+ cancelViewportAnimation();
+ }
+ function handleTrackMove(data) {
+ const oldContentTrackT = contentTrackT;
+ contentTrackT = Date.now();
+ const length = swiperContexts.value.length;
+ const other = length - state.displayMultipleItems;
+ function calc2(val) {
+ return 0.5 - 0.25 / (val + 0.5);
+ }
+ function move(oldVal, newVal) {
+ let val = contentTrackViewport + oldVal;
+ contentTrackSpeed = 0.6 * contentTrackSpeed + 0.4 * newVal;
+ if (!circularEnabled.value) {
+ if (val < 0 || val > other) {
+ if (val < 0) {
+ val = -calc2(-val);
+ } else {
+ if (val > other) {
+ val = other + calc2(val - other);
+ }
+ }
+ contentTrackSpeed = 0;
+ }
+ }
+ updateViewport(val);
+ }
+ const time = contentTrackT - oldContentTrackT || 1;
+ const slideFrameEl = slideFrameRef.value;
+ if (props2.vertical) {
+ move(-data.dy / slideFrameEl.offsetHeight, -data.ddy / time);
+ } else {
+ move(-data.dx / slideFrameEl.offsetWidth, -data.ddx / time);
+ }
+ }
+ function handleTrackEnd(isCancel) {
+ state.userTracking = false;
+ const t2 = contentTrackSpeed / Math.abs(contentTrackSpeed);
+ let n = 0;
+ if (!isCancel && Math.abs(contentTrackSpeed) > 0.2) {
+ n = 0.5 * t2;
+ }
+ const current = normalizeCurrentValue(viewportPosition + n);
+ if (isCancel) {
+ updateViewport(contentTrackViewport);
+ } else {
+ currentChangeSource = "touch";
+ state.current = current;
+ animateViewport(current, "touch", n !== 0 ? n : current === 0 && circularEnabled.value && viewportPosition >= 1 ? 1 : 0);
+ }
+ }
+ useTouchtrack(slideFrameRef.value, (event) => {
+ if (props2.disableTouch) {
+ return;
+ }
+ if (!invalid) {
+ if (event.detail.state === "start") {
+ state.userTracking = true;
+ userDirectionChecked = false;
+ return handleTrackStart();
+ }
+ if (event.detail.state === "end") {
+ return handleTrackEnd(false);
+ }
+ if (event.detail.state === "cancel") {
+ return handleTrackEnd(true);
+ }
+ if (state.userTracking) {
+ if (!userDirectionChecked) {
+ userDirectionChecked = true;
+ const t2 = Math.abs(event.detail.dx);
+ const n = Math.abs(event.detail.dy);
+ if (t2 >= n && props2.vertical) {
+ state.userTracking = false;
+ } else {
+ if (t2 <= n && !props2.vertical) {
+ state.userTracking = false;
+ }
+ }
+ if (!state.userTracking) {
+ if (props2.autoplay) {
+ scheduleAutoplay();
+ }
+ return;
+ }
+ }
+ handleTrackMove(event.detail);
+ return false;
+ }
+ }
+ });
+ });
+ onUnmounted(() => {
+ cancelSchedule();
+ cancelAnimationFrame(animationFrame);
+ });
+ function onSwiperDotClick(index2) {
+ animateViewport(state.current = index2, currentChangeSource = "click", circularEnabled.value ? 1 : 0);
+ }
+ return {
+ onSwiperDotClick
+ };
+ }
+ var Swiper = /* @__PURE__ */ defineBuiltInComponent({
+ name: "Swiper",
+ props: props$5,
+ emits: ["change", "transition", "animationfinish", "update:current", "update:currentItemId"],
+ setup(props2, {
+ slots,
+ emit: emit2
+ }) {
+ const rootRef = ref(null);
+ const trigger2 = useCustomEvent(rootRef, emit2);
+ const slidesWrapperRef = ref(null);
+ const slideFrameRef = ref(null);
+ const state = useState(props2);
+ const slidesStyle = computed$1(() => {
+ let style = {};
+ if (props2.nextMargin || props2.previousMargin) {
+ style = props2.vertical ? {
+ left: 0,
+ right: 0,
+ top: rpx2px$1(props2.previousMargin, true),
+ bottom: rpx2px$1(props2.nextMargin, true)
+ } : {
+ top: 0,
+ bottom: 0,
+ left: rpx2px$1(props2.previousMargin, true),
+ right: rpx2px$1(props2.nextMargin, true)
+ };
+ }
+ return style;
+ });
+ const slideFrameStyle = computed$1(() => {
+ const value = Math.abs(100 / state.displayMultipleItems) + "%";
+ return {
+ width: props2.vertical ? "100%" : value,
+ height: !props2.vertical ? "100%" : value
+ };
+ });
+ let swiperItems = [];
+ const originSwiperContexts = [];
+ const swiperContexts = ref([]);
+ function updateSwiperContexts() {
+ const contexts = [];
+ for (let index2 = 0; index2 < swiperItems.length; index2++) {
+ const swiperItem2 = swiperItems[index2];
+ const swiperContext = originSwiperContexts.find((context) => swiperItem2.el === context.rootRef.value);
+ if (swiperContext) {
+ contexts.push(markRaw(swiperContext));
+ }
+ }
+ swiperContexts.value = contexts;
+ }
+ const addSwiperContext = function(swiperContext) {
+ originSwiperContexts.push(swiperContext);
+ updateSwiperContexts();
+ };
+ provide("addSwiperContext", addSwiperContext);
+ const removeSwiperContext = function(swiperContext) {
+ const index2 = originSwiperContexts.indexOf(swiperContext);
+ if (index2 >= 0) {
+ originSwiperContexts.splice(index2, 1);
+ updateSwiperContexts();
+ }
+ };
+ provide("removeSwiperContext", removeSwiperContext);
+ const {
+ onSwiperDotClick
+ } = useLayout(props2, state, swiperContexts, slideFrameRef, emit2, trigger2);
+ return () => {
+ const defaultSlots = slots.default && slots.default();
+ swiperItems = flatVNode(defaultSlots);
+ return createVNode("uni-swiper", {
+ "ref": rootRef
+ }, {
+ default: () => [createVNode("div", {
+ "ref": slidesWrapperRef,
+ "class": "uni-swiper-wrapper"
+ }, [createVNode("div", {
+ "class": "uni-swiper-slides",
+ "style": slidesStyle.value
+ }, [createVNode("div", {
+ "ref": slideFrameRef,
+ "class": "uni-swiper-slide-frame",
+ "style": slideFrameStyle.value
+ }, [defaultSlots], 4)], 4), props2.indicatorDots && createVNode("div", {
+ "class": ["uni-swiper-dots", props2.vertical ? "uni-swiper-dots-vertical" : "uni-swiper-dots-horizontal"]
+ }, [swiperContexts.value.map((_, index2, array) => createVNode("div", {
+ "onClick": () => onSwiperDotClick(index2),
+ "class": {
+ "uni-swiper-dot": true,
+ "uni-swiper-dot-active": index2 < state.current + state.displayMultipleItems && index2 >= state.current || index2 < state.current + state.displayMultipleItems - array.length
+ },
+ "style": {
+ background: index2 === state.current ? props2.indicatorActiveColor : props2.indicatorColor
+ }
+ }, null, 14, ["onClick"]))], 2)], 512)]
+ }, 512);
+ };
+ }
+ });
+ const props$4 = {
+ itemId: {
+ type: String,
+ default: ""
+ }
+ };
+ var SwiperItem = /* @__PURE__ */ defineBuiltInComponent({
+ name: "SwiperItem",
+ props: props$4,
+ setup(props2, {
+ slots
+ }) {
+ const rootRef = ref(null);
+ const context = {
+ rootRef,
+ getItemId() {
+ return props2.itemId;
+ },
+ getBoundingClientRect() {
+ const el = rootRef.value;
+ return el.getBoundingClientRect();
+ },
+ updatePosition(position, vertical) {
+ const x = vertical ? "0" : 100 * position + "%";
+ const y = vertical ? 100 * position + "%" : "0";
+ const rootEl = rootRef.value;
+ const value = `translate(${x},${y}) translateZ(0)`;
+ if (rootEl) {
+ rootEl.style.webkitTransform = value;
+ rootEl.style.transform = value;
+ }
+ }
+ };
+ onMounted(() => {
+ const addSwiperContext = inject("addSwiperContext");
+ if (addSwiperContext) {
+ addSwiperContext(context);
+ }
+ });
+ onUnmounted(() => {
+ const removeSwiperContext = inject("removeSwiperContext");
+ if (removeSwiperContext) {
+ removeSwiperContext(context);
+ }
+ });
+ return () => {
+ return createVNode("uni-swiper-item", {
+ "ref": rootRef,
+ "style": {
+ position: "absolute",
+ width: "100%",
+ height: "100%"
+ }
+ }, {
+ default: () => [slots.default && slots.default()]
+ }, 512);
+ };
+ }
+ });
+ const props$3 = {
+ name: {
+ type: String,
+ default: ""
+ },
+ checked: {
+ type: [Boolean, String],
+ default: false
+ },
+ type: {
+ type: String,
+ default: "switch"
+ },
+ id: {
+ type: String,
+ default: ""
+ },
+ disabled: {
+ type: [Boolean, String],
+ default: false
+ },
+ color: {
+ type: String,
+ default: "#007aff"
+ }
+ };
+ var Switch = /* @__PURE__ */ defineBuiltInComponent({
+ name: "Switch",
+ props: props$3,
+ emits: ["change"],
+ setup(props2, {
+ emit: emit2
+ }) {
+ const rootRef = ref(null);
+ const switchChecked = ref(props2.checked);
+ const uniLabel = useSwitchInject(props2, switchChecked);
+ const trigger2 = useCustomEvent(rootRef, emit2);
+ watch(() => props2.checked, (val) => {
+ switchChecked.value = val;
+ });
+ const _onClick = ($event) => {
+ if (props2.disabled) {
+ return;
+ }
+ switchChecked.value = !switchChecked.value;
+ trigger2("change", $event, {
+ value: switchChecked.value
+ });
+ };
+ if (!!uniLabel) {
+ uniLabel.addHandler(_onClick);
+ onBeforeUnmount(() => {
+ uniLabel.removeHandler(_onClick);
+ });
+ }
+ useListeners$1(props2, {
+ "label-click": _onClick
+ });
+ return () => {
+ const {
+ color,
+ type
+ } = props2;
+ const {
+ booleanAttrs
+ } = useBooleanAttr(props2, "disabled");
+ return createVNode("uni-switch", mergeProps({
+ "ref": rootRef
+ }, booleanAttrs, {
+ "onClick": _onClick
+ }), {
+ default: () => [createVNode("div", {
+ "class": "uni-switch-wrapper"
+ }, [withDirectives(createVNode("div", {
+ "class": ["uni-switch-input", [switchChecked.value ? "uni-switch-input-checked" : ""]],
+ "style": {
+ backgroundColor: switchChecked.value ? color : "#DFDFDF",
+ borderColor: switchChecked.value ? color : "#DFDFDF"
+ }
+ }, null, 6), [[vShow, type === "switch"]]), withDirectives(createVNode("div", {
+ "class": "uni-checkbox-input"
+ }, [switchChecked.value ? createSvgIconVNode(ICON_PATH_SUCCESS_NO_CIRCLE, props2.color, 22) : ""], 512), [[vShow, type === "checkbox"]])])]
+ }, 16, ["onClick"]);
+ };
+ }
+ });
+ function useSwitchInject(props2, switchChecked) {
+ const uniForm = inject(uniFormKey, false);
+ const uniLabel = inject(uniLabelKey, false);
+ const formField = {
+ submit: () => {
+ const data = ["", null];
+ if (props2.name) {
+ data[0] = props2.name;
+ data[1] = switchChecked.value;
+ }
+ return data;
+ },
+ reset: () => {
+ switchChecked.value = false;
+ }
+ };
+ if (!!uniForm) {
+ uniForm.addField(formField);
+ onUnmounted(() => {
+ uniForm.removeField(formField);
+ });
+ }
+ return uniLabel;
+ }
+ function _isSlot(s) {
+ return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
+ }
+ const SPACE_UNICODE = {
+ ensp: "\u2002",
+ emsp: "\u2003",
+ nbsp: "\xA0"
+ };
+ function normalizeText(text2, {
+ space,
+ decode
+ }) {
+ if (space && SPACE_UNICODE[space]) {
+ text2 = text2.replace(/ /g, SPACE_UNICODE[space]);
+ }
+ if (!decode) {
+ return text2;
+ }
+ return text2.replace(/ /g, SPACE_UNICODE.nbsp).replace(/ /g, SPACE_UNICODE.ensp).replace(/ /g, SPACE_UNICODE.emsp).replace(/</g, "<").replace(/>/g, ">").replace(/&/g, "&").replace(/"/g, '"').replace(/'/g, "'");
+ }
+ var Text = /* @__PURE__ */ defineBuiltInComponent({
+ name: "Text",
+ props: {
+ selectable: {
+ type: [Boolean, String],
+ default: false
+ },
+ space: {
+ type: String,
+ default: ""
+ },
+ decode: {
+ type: [Boolean, String],
+ default: false
+ }
+ },
+ setup(props2, {
+ slots
+ }) {
+ return () => {
+ let _slot;
+ const children = [];
+ if (slots.default) {
+ slots.default().forEach((vnode) => {
+ if (vnode.shapeFlag & 8) {
+ const lines = vnode.children.replace(/\\n/g, "\n").split("\n");
+ const len = lines.length - 1;
+ lines.forEach((text2, index2) => {
+ if (index2 === 0 && !text2)
+ ;
+ else {
+ children.push(createTextVNode(normalizeText(text2, {
+ space: props2.space,
+ decode: props2.decode
+ })));
+ }
+ if (index2 !== len) {
+ children.push(createVNode("br"));
+ }
+ });
+ } else {
+ if (vnode.shapeFlag & 6 && vnode.type.name !== "Text") {
+ console.warn("Do not nest other components in the text component, as there may be display differences on different platforms.");
+ }
+ children.push(vnode);
+ }
+ });
+ }
+ return createVNode("uni-text", {
+ "selectable": props2.selectable ? true : null
+ }, _isSlot(_slot = createVNode("span", null, children)) ? _slot : {
+ default: () => [_slot],
+ _: 1
+ }, 8, ["selectable"]);
+ };
+ }
+ });
+ const props$2 = /* @__PURE__ */ extend({}, props$h, {
+ placeholderClass: {
+ type: String,
+ default: "input-placeholder"
+ },
+ autoHeight: {
+ type: [Boolean, String],
+ default: false
+ },
+ confirmType: {
+ type: String,
+ default: ""
+ }
+ });
+ let fixMargin = false;
+ function setFixMargin() {
+ const DARK_TEST_STRING = "(prefers-color-scheme: dark)";
+ fixMargin = String(navigator.platform).indexOf("iP") === 0 && String(navigator.vendor).indexOf("Apple") === 0 && window.matchMedia(DARK_TEST_STRING).media !== DARK_TEST_STRING;
+ }
+ var Textarea = /* @__PURE__ */ defineBuiltInComponent({
+ name: "Textarea",
+ props: props$2,
+ emit: ["confirm", "linechange", ...emit],
+ setup(props2, {
+ emit: emit2
+ }) {
+ const rootRef = ref(null);
+ const {
+ fieldRef,
+ state,
+ scopedAttrsState,
+ fixDisabledColor,
+ trigger: trigger2
+ } = useField(props2, rootRef, emit2);
+ const valueCompute = computed$1(() => state.value.split("\n"));
+ const isDone = computed$1(() => ["done", "go", "next", "search", "send"].includes(props2.confirmType));
+ const heightRef = ref(0);
+ const lineRef = ref(null);
+ watch(() => heightRef.value, (height) => {
+ const el = rootRef.value;
+ const lineEl = lineRef.value;
+ let lineHeight = parseFloat(getComputedStyle(el).lineHeight);
+ if (isNaN(lineHeight)) {
+ lineHeight = lineEl.offsetHeight;
+ }
+ var lineCount = Math.round(height / lineHeight);
+ trigger2("linechange", {}, {
+ height,
+ heightRpx: 750 / window.innerWidth * height,
+ lineCount
+ });
+ if (props2.autoHeight) {
+ el.style.height = height + "px";
+ }
+ });
+ function onResize({
+ height
+ }) {
+ heightRef.value = height;
+ }
+ function confirm(event) {
+ trigger2("confirm", event, {
+ value: state.value
+ });
+ }
+ function onKeyDownEnter(event) {
+ if (event.key !== "Enter") {
+ return;
+ }
+ if (isDone.value) {
+ event.preventDefault();
+ }
+ }
+ function onKeyUpEnter(event) {
+ if (event.key !== "Enter") {
+ return;
+ }
+ if (isDone.value) {
+ confirm(event);
+ const textarea2 = event.target;
+ textarea2.blur();
+ }
+ }
+ {
+ setFixMargin();
+ }
+ return () => {
+ let textareaNode = props2.disabled && fixDisabledColor ? createVNode("textarea", {
+ "ref": fieldRef,
+ "value": state.value,
+ "tabindex": "-1",
+ "readonly": !!props2.disabled,
+ "maxlength": state.maxlength,
+ "class": {
+ "uni-textarea-textarea": true,
+ "uni-textarea-textarea-fix-margin": fixMargin
+ },
+ "style": {
+ overflowY: props2.autoHeight ? "hidden" : "auto"
+ },
+ "onFocus": (event) => event.target.blur()
+ }, null, 46, ["value", "readonly", "maxlength", "onFocus"]) : createVNode("textarea", {
+ "ref": fieldRef,
+ "value": state.value,
+ "disabled": !!props2.disabled,
+ "maxlength": state.maxlength,
+ "enterkeyhint": props2.confirmType,
+ "class": {
+ "uni-textarea-textarea": true,
+ "uni-textarea-textarea-fix-margin": fixMargin
+ },
+ "style": {
+ overflowY: props2.autoHeight ? "hidden" : "auto"
+ },
+ "onKeydown": onKeyDownEnter,
+ "onKeyup": onKeyUpEnter
+ }, null, 46, ["value", "disabled", "maxlength", "enterkeyhint", "onKeydown", "onKeyup"]);
+ return createVNode("uni-textarea", {
+ "ref": rootRef
+ }, {
+ default: () => [createVNode("div", {
+ "class": "uni-textarea-wrapper"
+ }, [withDirectives(createVNode("div", mergeProps(scopedAttrsState.attrs, {
+ "style": props2.placeholderStyle,
+ "class": ["uni-textarea-placeholder", props2.placeholderClass]
+ }), [props2.placeholder], 16), [[vShow, !state.value.length]]), createVNode("div", {
+ "ref": lineRef,
+ "class": "uni-textarea-line"
+ }, [" "], 512), createVNode("div", {
+ "class": "uni-textarea-compute"
+ }, [valueCompute.value.map((item) => createVNode("div", null, [item.trim() ? item : "."])), createVNode(ResizeSensor, {
+ "initial": true,
+ "onResize": onResize
+ }, null, 8, ["initial", "onResize"])]), props2.confirmType === "search" ? createVNode("form", {
+ "action": "",
+ "onSubmit": () => false,
+ "class": "uni-input-form"
+ }, [textareaNode], 40, ["onSubmit"]) : textareaNode])]
+ }, 512);
+ };
+ }
+ });
+ /* @__PURE__ */ defineBuiltInComponent({
+ name: "View",
+ props: extend({}, hoverProps),
+ setup(props2, {
+ slots
+ }) {
+ const {
+ hovering,
+ binding
+ } = useHover(props2);
+ return () => {
+ const hoverClass = props2.hoverClass;
+ if (hoverClass && hoverClass !== "none") {
+ return createVNode("uni-view", mergeProps({
+ "class": hovering.value ? hoverClass : ""
+ }, binding), {
+ default: () => [slots.default && slots.default()]
+ }, 16, ["class"]);
+ }
+ return createVNode("uni-view", null, {
+ default: () => [slots.default && slots.default()]
+ });
+ };
+ }
+ });
+ function normalizeEvent(pageId2, vm, id2) {
+ if (!id2) {
+ id2 = vm.id;
+ }
+ if (!id2) {
+ return;
+ }
+ return pageId2 + "." + vm.$options.name.toLowerCase() + "." + id2;
+ }
+ function addSubscribe(name, callback) {
+ if (!name) {
+ return;
+ }
+ UniViewJSBridge.subscribe(name, ({ type, data }) => {
+ callback(type, data);
+ });
+ }
+ function removeSubscribe(name) {
+ if (!name) {
+ return;
+ }
+ UniViewJSBridge.unsubscribe(name);
+ }
+ function useSubscribe(callback, name, multiple) {
+ const instance = getCurrentInstance();
+ const vm = instance.proxy;
+ const pageId2 = multiple || !name ? useCurrentPageId() : 0;
+ onMounted(() => {
+ addSubscribe(name || normalizeEvent(pageId2, vm), callback);
+ if (multiple || !name) {
+ watch(() => vm.id, (value, oldValue) => {
+ addSubscribe(normalizeEvent(pageId2, vm, value), callback);
+ removeSubscribe(oldValue && normalizeEvent(pageId2, vm, oldValue));
+ });
+ }
+ });
+ onBeforeUnmount(() => {
+ removeSubscribe(name || normalizeEvent(pageId2, vm));
+ });
+ }
+ let index = 0;
+ function useContextInfo(_id) {
+ const page = useCurrentPageId();
+ const instance = getCurrentInstance();
+ const vm = instance.proxy;
+ const type = vm.$options.name.toLowerCase();
+ const id2 = _id || vm.id || `context${index++}`;
+ onMounted(() => {
+ const el = vm.$el;
+ el.__uniContextInfo = {
+ id: id2,
+ type,
+ page
+ };
+ });
+ return `${page}.${type}.${id2}`;
+ }
+ var Ad = /* @__PURE__ */ defineBuiltInComponent({
+ name: "Ad"
+ });
+ class UniComponent extends UniNode {
+ constructor(id2, tag, component) {
+ super(id2, tag);
+ this.$component = component;
+ }
+ init(nodeJson) {
+ const container = document.createElement("div");
+ this.$props = reactive({});
+ const { a: a2 } = nodeJson;
+ if (a2) {
+ Object.keys(a2).forEach((n) => {
+ this.setAttr(n, a2[n]);
+ });
+ }
+ createApp(createWrapper(this.$component, this.$props)).mount(container);
+ this.$ = container.firstElementChild;
+ if (hasOwn$1(nodeJson, "t")) {
+ this.$.textContent = nodeJson.t || "";
+ }
+ }
+ setAttr(name, value) {
+ const decoded = decodeAttr(name);
+ if (name.indexOf(".e") === 0) {
+ this.$props[decoded] = createInvoker(this.id, value, parseEventName(decoded)[1]);
+ } else {
+ this.$props[decoded] = value;
+ }
+ }
+ removeAttr(name) {
+ this.$props[decodeAttr(name)] = null;
+ }
+ }
+ class UniAd extends UniComponent {
+ constructor(id2) {
+ super(id2, "uni-ad", Ad);
+ }
+ }
+ var audio = "uni-audio {\n display: none;\n}\n\nuni-audio[controls] {\n display: inline-block;\n}\n\nuni-audio[hidden] {\n display: none;\n}\n\n.uni-audio-default {\n max-width: 100%;\n min-width: 302px;\n height: 65px;\n background: #fcfcfc;\n border: 1px solid #e0e0e0;\n border-radius: 2.5px;\n display: inline-block;\n overflow: hidden;\n}\n\n.uni-audio-left {\n width: 65px;\n height: 65px;\n float: left;\n background-color: #e6e6e6;\n background-size: 100% 100%;\n background-position: 50% 50%;\n}\n\n.uni-audio-button {\n width: 24px;\n height: 24px;\n margin: 20.5px;\n background-size: cover;\n}\n\n.uni-audio-button.play {\n background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAB4dJREFUaAXNWg1MlVUYvpcfIRCJ+MnCaOBl8dOcOCEQZ9kmI5cQG5Yb6MifKbMaGVobOtlibTWHDpgpxBUwF07826iFsMkYJhg559JdGiQSkUzSBA0QkZ7n4/u+nXsvwf3jwru99/y/3/N+3znvec97rlbjABofH38GYtaAV4MjwDqwH9gHTBoE3wd3gA3gi+B6rVY7hHR2CKD9wFngs+BHYGuJYziWMqiscwgP8wLvBQ+AHUWURZle1mqhtXQAhLui7xZwPvgFsBENDg7+Drp069at2z09Pf03b978u6mpqZ+dVq1aFRAVFeW/aNGigNDQ0JfDwsISfXx8wowETBT+QpIPLsf0GpuomvrXIgUAPhhizoGXi+II+tq1az/o9fpLFRUVd8S26fJZWVkLN2/enBgTE/PW/PnzF5v0b0P5HSjxp0m9WXFaBQD+NYw6C1bf+vDwcF9DQ4N+/fr19ciPm0m1osLT01N76tSpNaD3PTw8FgpD+TXSoESrUGeWnVIBgM/EiDKwJ0eiPNrS0nJsw4YNNd3d3aOscxSFhIS4V1dXpyckJGRB5jxZ7jDSbVDiW7lslriY1cgVMvjjKErgR0dH/zl06NCuFStWfOdo8HwkZVL2wYMHP3ny5AlNLonPPi5jkSpMfyb9AhjAadMIlsBjrndmZ2fnnThxos9UwEyUMzIynj9y5EgB1gb3ExK/xBuTTSczBQCeC/ZnsDTnCR6f9YMbN25QiNMoOjras7W1tcjb2ztcfijXRKzpwjaaQgBPU0lrI4HntOGbdzZ4AuYzt2/fvm9sbOweyyBiOidjlCr4Y6QAyrTzkqlEx9GSkpJ9zpo2BGNKfHZRUdF+1D+W24iNGFVSpxAAcxekryK9/cuXLx/FoqpWe85iBlPpvbi4uB0yBE4lHabSvyyLX2AXyhJ42nmYytPsMBcI+80ZWKZeGQsxEqtEkgJ4+3Sm9sh1Gm5SM2EqFfnWpsRSV1dXIYzbI2NWv0AqGiXXl+4Bd1ihs0XZu3fvHhgYGNBXVVUlWDTAyk7p6ekNIyMj7fIwYiVmIwWkNvo2trgHAQEBy+CghW7cuPGLvr6+L3fu3PmSJNBBP8R09erVHwVxEwrgU/AwkqQ00DFT8lamqkEICgqKKy4u1sMU7li6dKnVLvL/Pbe0tLRFaEsidi1+UlB5ng3ctBYsWLBV6GRxFnJ4yjIj7CX36uvrS1NTU+uwEM3ara3Al/gaTl+EPC6Vi/hNRUhHR8dPSt5Rqbu7+3Nr1679rL+//3BBQYHyYJvFd3V1iTNkNRV4RZF2G6TkHZ36+vpG5uXlHcah59Pk5GSbj5AY3y1gi6ACisOk4UlKaJyJrBYnsuTa2trjzc3N7/r7+9N1sYo6OzsfCAN0VEB9GzwGCo0zlnV1dfVOTEzMhn3Xl5eXx1rzIBOMflRAsv8UopxhrRFoT18vL68QHCu/am9vz7FUjglGHyow6xQcHBxjKwgqwKCTRIweKHlnpZhGDfC7LP4CJhgH3QCUxzd/AmboA0kP8zNNcDt+w8ZUvHv37l+tedaSJUueFfrfpwJ0oSVLxLiN0DgjWWxsDxobG79JSUn53haXRafT+QrAOjiFDEoFg05K3tEpduoxg8FweuXKlRlJSUm1toAnpvDwcB55FTJQAdUFYMRMaXFkil34l9zc3K2RkZElV65ceWSPbCz414XxF6kAXWfpdMNwHyNmQge7skNDQ3dOnjy5PzAwMLewsLDLLmEYDJMb5ObmFiXLIeZ6FxzNGOK+IFeyk91f4enTpyNtbW3HIiIiNsHCNCmy7U1zcnKWCTIuEDu/AOn8RKLRMFbJcJ9StjRlBIN94Y40ZmZmboqNja3iScrS8dP1IyaEWt4W+kmYaYVILHA/8GGglbHKdevWqV+FHaYjOGofw811hcfZOV1fW9pxzE1wcXGJlscSq6SA+qZhJfai8nN2wNHtDhb0pt7eXoe9Qcq1lRg3hRvNkLtyytuHfAHlKVOI+UIwQxYaRolramrSmZ8LhLefJIAnRmKVSFUAHbiq8yeqNRpGiWE5XlXKs5WWlZUthu3/SHh+voxVqlKnEEuYRvTPee5czjKjxDCr2bMVnYNF9IO7fRRQAokHxIuPeCig3t4YKcAeUCIYiRrcffjwYUd8fPyHzo6PwuJ4XL9+/QAWrjILOHWmDu5SAWjHa500sBSNZoibUWKGvNnuDOKbNwFPLLytITYjUteAWIuOvNbZptQxxF1ZWXnYGWuCc57TRnjzhMFbGmIyI7MpJPbAdMpEuQzsKdc/hi+jT0tLO+NoE0tTSWsjL9h58vP45qe8YppSAQqBEmaXfAy0MlbJcJ+tXqUMUMMdlpsUIuE78JYVO89mznn7LvmUh8gL+xzKknVS6hmrZLiPETNrr1npmNG3oXsg7LCKaFobx1yzKhKhBE3sFnA+mCFuI4IyBuyWzYjb/MHQh+lFN09SPIxgirxIlxhepeIWiHL41vPBFl90i4MtykOROfVXA4tAT9YJisyJP3tMu4gnA29aB2UY4V4DXg1m/FMH9gMrMSd6jwwe8PxtAPMU6JC/2/wHuyI2cMsNBRIAAAAASUVORK5CYII=);\n}\n\n.uni-audio-button.pause {\n background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAABatJREFUaAXVWl1IpFUYnllZGUf3wlz6MXER1ES7s83VUDJw6KpdaSTDwMnYFSK6KNirooHullKQCNzQRjZ/wom1u9ALQ0mT1ktFdEBWXLdibaH1jwmx5zme83W+z2Hm+7bZmc8X3jl/73vO837n/z3j9aSBjo6O8lBNC7gZXAUuBxeCz4FJj8APwTHwCngaPOX1evcRZocAuhAcAt8G74KdEnWoyzpobGYIjfnBn4D/BqeLWBfr9Du1wmtXAZXnQPY9cBj8HNhEe3t7sbW1tfn19fW7m5ubD5aXl7dnZmYeUKipqel8dXV1UUlJyfmysrILFRUV9X6/n8PMSveREQYPYHgdWgsTpW0ZAPDPQ3kC/JJeCUEvLi7+NDg4+EskEvldL0sVD4VCz3Z1db1SW1v7egJj7kD/Coy4l6qelAYAfB0quQ02vno8Hr8/OTkZaWtrmzo4ODhK1Uiycp/P5x0fH28JBAKh3Nxcow3osDdaYcRCMv2kBgD8O1D+BuyTlcTn5+cj7e3t0Y2NjX+SVey0rLS09OzY2Fiwvr4+BN1cqX+A8CqM+E6mTwRnTuTIDAn+FpIC/OHh4V+9vb0fNzQ0jKYbPJtknaybbbAtCYNt35JYZJY5SNgDctj8DFEBfnd3d627u/vT4eHhP8zqTybV0dHxTH9//+f5+fkVsgX2xKuJhtMJAwCeE/Y3sBiPBF9XV/fh0tISK8kY1dTU+BYWFvo0IzgnLlontmkIATyXSq42Ajy7kl8+0+D5ldgm29aGEzFNSIwUEWQyADlc59VSGe/r6/ssU8PmGI75l20TA3LjsoTYiNEgYwjBMu6CPKuIr4/Vph+TasyQzGJkbm7ubaxO1yQEDqVyDKU9pvUe+AhpAZ7rPJbKHyjgBuKyTUwSCzESqyBhAL4+D1PXZZ6Hm9STWCpV/U5DYiEmTe+6xOwRQwiJEAq/pQCPB0VFRdf+7w7LutJJ3LG3t7dvaseOdzGMImoIXVaN8WzjNvDERkzEpnAiFJjP4OvzMhJQBTyYqbjdEDov7+/vf4+6pu0wZQcGBi7arV/JWbAFiN2Lnzcg8COFuGkVFBSo2a70UoYEhC5+OqWgJoAv+mdeXt5bWpat6M7Ozk1tc7vMIfSa0lxdXf1VxZ2ETsGz7sfRoV4sFtMxNtOAF1hAugs6jrn3lxcmDV0VDTBuRrxJaYWujFowltMA40LNa6ArUWugLBgLaYByfXjUHVaTd13UgvEcDTjVRAPodBJE74GKuzW0YHxEA+gxE0TXh4q7NbRgfEgDeIQWRL+Nirs1tGCM0YAVBZZOJxV3a2jBuEIDphVYesxU3EnIY4ETeco+jg71LBinacAUWNxueFSlx4yCTmh0dPRLJ4AoOzIy8oWTNihLbNpxmpin1H2AnrcrFJqdnf0KM901tzFiUoQ94M3GxsYPZHoC94FW9gBJnEYZoa8SBy1hGNNuIWIiNg2PwKwbIPYDdhF9lZqgK6LEpA0fYv3PAHQF94IbCikdrcXFxWdVOtsh/abEpOG4ITGbvBI9EBA3f3qJo9FoUFPIapROX81zTYzEKkgNIQ8s4qwOH2d7PPQS9/T0vKjS2QqJQXqsFYSwxCrSpsmK6yVdi7zx0APmoVuvs7Pz/Wx55+jkHRoa+jonJ+cp4gHdAV+CAcbrjckASsCI0+vcpQGw7h6CVrDwRvMCTS8xvwbLM0Fsy+KZJha+1hCbiYw5oOdCkM86V1UejWBXZmJOsA22pXkeCIOvNAmfmk4MIQWaIYZTwiemYDAY3dracsUTU1IDpBGn95FP9Yac2KfzmVUzgkssHxfCYOGGR2gQvXp0jNG3lOyh+wKosrLykmWMq3q4SYXBth+6laLtEL3hqr8a2AZuFYQhrvizR8pJbAWeKA1j6OFuATeDq8D09hWClc+Jp0ceGHn/5hWWt8C0/N3mX15C4bDnCIuAAAAAAElFTkSuQmCC);\n}\n\n.uni-audio-right {\n box-sizing: border-box;\n height: 65px;\n margin-left: 65px;\n padding: 11px 16.5px 13.5px 15px;\n overflow: hidden;\n}\n\n.uni-audio-time {\n margin-top: 3.5px;\n height: 16.5px;\n font-size: 12px;\n color: #888888;\n float: right;\n}\n\n.uni-audio-info {\n margin-right: 70px;\n overflow: hidden;\n}\n\n.uni-audio-name {\n height: 22.5px;\n line-height: 22.5px;\n margin-bottom: 3.5px;\n font-size: 14px;\n color: #353535;\n overflow: hidden;\n white-space: nowrap;\n text-overflow: ellipsis;\n}\n\n.uni-audio-author {\n height: 14.5px;\n line-height: 14.5px;\n font-size: 12px;\n color: #888888;\n overflow: hidden;\n white-space: nowrap;\n text-overflow: ellipsis;\n}\n";
+ class UniAudio extends UniComponent {
+ constructor(id2) {
+ super(id2, "uni-audio", _sfc_main);
+ }
+ }
+ var button = "uni-button {\n position: relative;\n display: block;\n margin-left: auto;\n margin-right: auto;\n padding-left: 14px;\n padding-right: 14px;\n box-sizing: border-box;\n font-size: 18px;\n text-align: center;\n text-decoration: none;\n line-height: 2.55555556;\n border-radius: 5px;\n -webkit-tap-highlight-color: transparent;\n overflow: hidden;\n color: #000000;\n background-color: #f8f8f8;\n cursor: pointer;\n}\n\nuni-button[hidden] {\n display: none !important;\n}\n\nuni-button:after {\n content: ' ';\n width: 200%;\n height: 200%;\n position: absolute;\n top: 0;\n left: 0;\n border: 1px solid rgba(0, 0, 0, 0.2);\n transform: scale(0.5);\n transform-origin: 0 0;\n box-sizing: border-box;\n border-radius: 10px;\n}\n\nuni-button[native] {\n padding-left: 0;\n padding-right: 0;\n}\n\nuni-button[native] .uni-button-cover-view-wrapper {\n border: inherit;\n border-color: inherit;\n border-radius: inherit;\n background-color: inherit;\n}\n\nuni-button[native] .uni-button-cover-view-inner {\n padding-left: 14px;\n padding-right: 14px;\n}\n\nuni-button uni-cover-view {\n line-height: inherit;\n white-space: inherit;\n}\n\nuni-button[type='default'] {\n color: #000000;\n background-color: #f8f8f8;\n}\n\nuni-button[type='primary'] {\n color: #ffffff;\n background-color: #007aff;\n}\n\nuni-button[type='warn'] {\n color: #ffffff;\n background-color: #e64340;\n}\n\nuni-button[disabled] {\n color: rgba(255, 255, 255, 0.6);\n cursor: not-allowed;\n}\n\nuni-button[disabled][type='default'],\nuni-button[disabled]:not([type]) {\n color: rgba(0, 0, 0, 0.3);\n background-color: #f7f7f7;\n}\n\nuni-button[disabled][type='primary'] {\n background-color: rgba(0, 122, 255, 0.6);\n}\n\nuni-button[disabled][type='warn'] {\n background-color: #ec8b89;\n}\n\nuni-button[type='primary'][plain] {\n color: #007aff;\n border: 1px solid #007aff;\n background-color: transparent;\n}\n\nuni-button[type='primary'][plain][disabled] {\n color: rgba(0, 0, 0, 0.2);\n border-color: rgba(0, 0, 0, 0.2);\n}\n\nuni-button[type='primary'][plain]:after {\n border-width: 0;\n}\n\nuni-button[type='default'][plain] {\n color: #353535;\n border: 1px solid #353535;\n background-color: transparent;\n}\n\nuni-button[type='default'][plain][disabled] {\n color: rgba(0, 0, 0, 0.2);\n border-color: rgba(0, 0, 0, 0.2);\n}\n\nuni-button[type='default'][plain]:after {\n border-width: 0;\n}\n\nuni-button[plain] {\n color: #353535;\n border: 1px solid #353535;\n background-color: transparent;\n}\n\nuni-button[plain][disabled] {\n color: rgba(0, 0, 0, 0.2);\n border-color: rgba(0, 0, 0, 0.2);\n}\n\nuni-button[plain]:after {\n border-width: 0;\n}\n\nuni-button[plain][native] .uni-button-cover-view-inner {\n padding: 0;\n}\n\nuni-button[type='warn'][plain] {\n color: #e64340;\n border: 1px solid #e64340;\n background-color: transparent;\n}\n\nuni-button[type='warn'][plain][disabled] {\n color: rgba(0, 0, 0, 0.2);\n border-color: rgba(0, 0, 0, 0.2);\n}\n\nuni-button[type='warn'][plain]:after {\n border-width: 0;\n}\n\nuni-button[size='mini'] {\n display: inline-block;\n line-height: 2.3;\n font-size: 13px;\n padding: 0 1.34em;\n}\n\nuni-button[size='mini'][native] {\n padding: 0;\n}\n\nuni-button[size='mini'][native] .uni-button-cover-view-inner {\n padding: 0 1.34em;\n}\n\nuni-button[loading]:not([disabled]) {\n cursor: progress;\n}\n\nuni-button[loading]:before {\n content: ' ';\n display: inline-block;\n width: 18px;\n height: 18px;\n vertical-align: middle;\n animation: uni-loading 1s steps(12, end) infinite;\n background-size: 100%;\n}\n\nuni-button[loading][type='primary'] {\n color: rgba(255, 255, 255, 0.6);\n background-color: #0062cc;\n}\n\nuni-button[loading][type='primary'][plain] {\n color: #007aff;\n background-color: transparent;\n}\n\nuni-button[loading][type='default'] {\n color: rgba(0, 0, 0, 0.6);\n background-color: #dedede;\n}\n\nuni-button[loading][type='default'][plain] {\n color: #353535;\n background-color: transparent;\n}\n\nuni-button[loading][type='warn'] {\n color: rgba(255, 255, 255, 0.6);\n background-color: #ce3c39;\n}\n\nuni-button[loading][type='warn'][plain] {\n color: #e64340;\n background-color: transparent;\n}\n\nuni-button[loading][native]:before {\n content: none;\n}\n\n.button-hover {\n color: rgba(0, 0, 0, 0.6);\n background-color: #dedede;\n}\n\n.button-hover[plain] {\n color: rgba(53, 53, 53, 0.6);\n border-color: rgba(53, 53, 53, 0.6);\n background-color: transparent;\n}\n\n.button-hover[type='primary'] {\n color: rgba(255, 255, 255, 0.6);\n background-color: #0062cc;\n}\n\n.button-hover[type='primary'][plain] {\n color: rgba(26, 173, 25, 0.6);\n border-color: rgba(26, 173, 25, 0.6);\n background-color: transparent;\n}\n\n.button-hover[type='default'] {\n color: rgba(0, 0, 0, 0.6);\n background-color: #dedede;\n}\n\n.button-hover[type='default'][plain] {\n color: rgba(53, 53, 53, 0.6);\n border-color: rgba(53, 53, 53, 0.6);\n background-color: transparent;\n}\n\n.button-hover[type='warn'] {\n color: rgba(255, 255, 255, 0.6);\n background-color: #ce3c39;\n}\n\n.button-hover[type='warn'][plain] {\n color: rgba(230, 67, 64, 0.6);\n border-color: rgba(230, 67, 64, 0.6);\n background-color: transparent;\n}\n";
+ class UniButton extends UniComponent {
+ constructor(id2) {
+ super(id2, "uni-button", Button);
+ }
+ }
+ class UniCamera extends UniNode {
+ constructor(id2) {
+ super(id2, "uni-camera");
+ }
+ }
+ var canvas = "uni-canvas {\n width: 300px;\n height: 150px;\n display: block;\n position: relative;\n}\n\nuni-canvas > .uni-canvas-canvas {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n}\n";
+ class UniCanvas extends UniComponent {
+ constructor(id2) {
+ super(id2, "uni-canvas", Canvas);
+ }
+ }
+ var checkbox = "uni-checkbox {\n -webkit-tap-highlight-color: transparent;\n display: inline-block;\n cursor: pointer;\n}\n\nuni-checkbox[hidden] {\n display: none;\n}\n\nuni-checkbox[disabled] {\n cursor: not-allowed;\n}\n\n.uni-checkbox-wrapper {\n display: inline-flex;\n align-items: center;\n vertical-align: middle;\n}\n\n.uni-checkbox-input {\n margin-right: 5px;\n -webkit-appearance: none;\n appearance: none;\n outline: 0;\n border: 1px solid #d1d1d1;\n background-color: #ffffff;\n border-radius: 3px;\n width: 22px;\n height: 22px;\n position: relative;\n}\n\n.uni-checkbox-input svg {\n color: #007aff;\n font-size: 22px;\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -48%) scale(0.73);\n}\n\nuni-checkbox:not([disabled]) .uni-checkbox-input:hover {\n border-color: #007aff;\n}\n\n.uni-checkbox-input.uni-checkbox-input-disabled {\n background-color: #e1e1e1;\n}\n\n.uni-checkbox-input.uni-checkbox-input-disabled:before {\n color: #adadad;\n}\n\nuni-checkbox-group {\n display: block;\n}\n";
+ class UniCheckbox extends UniComponent {
+ constructor(id2) {
+ super(id2, "uni-checkbox", Checkbox);
+ }
+ }
+ var checkboxGroup = "uni-checkbox-group {\n display: block;\n}\n\nuni-checkbox-group[hidden] {\n display: none;\n}\n";
+ class UniCheckboxGroup extends UniComponent {
+ constructor(id2) {
+ super(id2, "uni-checkbox-group", CheckboxGroup);
+ }
+ }
+ function getStatusbarHeight() {
+ return plus.navigator.isImmersedStatusbar() ? Math.round(plus.os.name === "iOS" ? plus.navigator.getSafeAreaInsets().top : plus.navigator.getStatusbarHeight()) : 0;
+ }
+ function getNavigationBarHeight() {
+ const webview2 = plus.webview.currentWebview();
+ const style = webview2.getStyle();
+ const titleNView = style && style.titleNView;
+ if (titleNView && titleNView.type === "default") {
+ return NAVBAR_HEIGHT + getStatusbarHeight();
+ }
+ return 0;
+ }
+ const onDrawKey = Symbol("onDraw");
+ function getFixed($el) {
+ let fixed;
+ while ($el) {
+ const style = getComputedStyle($el);
+ const transform = style.transform || style.webkitTransform;
+ fixed = transform && transform !== "none" ? false : fixed;
+ fixed = style.position === "fixed" ? true : fixed;
+ $el = $el.parentElement;
+ }
+ return fixed;
+ }
+ function useNativeAttrs(props2, ignore) {
+ return computed$1(() => {
+ const object = {};
+ Object.keys(props2).forEach((key) => {
+ if (ignore && ignore.includes(key)) {
+ return;
+ }
+ let val = props2[key];
+ val = key === "src" ? getRealPath(val) : val;
+ object[key.replace(/[A-Z]/g, (str) => "-" + str.toLowerCase())] = val;
+ });
+ return object;
+ });
+ }
+ function useNative(rootRef) {
+ const position = reactive({
+ top: "0px",
+ left: "0px",
+ width: "0px",
+ height: "0px",
+ position: "static"
+ });
+ const hidden = ref(false);
+ function updatePosition() {
+ const el = rootRef.value;
+ const rect = el.getBoundingClientRect();
+ hidden.value = rect.width === 0 || rect.height === 0;
+ if (!hidden.value) {
+ position.position = getFixed(el) ? "absolute" : "static";
+ const keys = ["top", "left", "width", "height"];
+ keys.forEach((key) => {
+ let val = rect[key];
+ val = key === "top" ? val + (position.position === "static" ? document.documentElement.scrollTop || document.body.scrollTop || 0 : getNavigationBarHeight()) : val;
+ position[key] = val + "px";
+ });
+ }
+ }
+ let request = null;
+ function requestPositionUpdate() {
+ if (request) {
+ cancelAnimationFrame(request);
+ }
+ request = requestAnimationFrame(() => {
+ request = null;
+ updatePosition();
+ });
+ }
+ window.addEventListener("updateview", requestPositionUpdate);
+ const onDrawCallbacks = [];
+ function onParentReady(callback) {
+ const onDraw2 = inject(onDrawKey);
+ const newCallback = (parentPosition) => {
+ callback(parentPosition);
+ onDrawCallbacks.forEach((callback2) => callback2(position));
+ onDrawCallbacks.length = 0;
+ };
+ if (onDraw2) {
+ onDraw2(newCallback);
+ } else {
+ onMounted(() => newCallback({
+ top: "0px",
+ left: "0px",
+ width: Number.MAX_SAFE_INTEGER + "px",
+ height: Number.MAX_SAFE_INTEGER + "px",
+ position: "static"
+ }));
+ }
+ }
+ const onDraw = function(callback) {
+ onDrawCallbacks.push(callback);
+ };
+ provide(onDrawKey, onDraw);
+ watch(() => rootRef.value, updatePosition);
+ return {
+ position,
+ hidden,
+ onParentReady
+ };
+ }
+ let id = 0;
+ function useCover(rootRef, trigger2, content) {
+ const { position, hidden, onParentReady } = useNative(rootRef);
+ onParentReady((parentPosition) => {
+ const viewPosition = computed$1(() => {
+ const object = {};
+ for (const key in position) {
+ let val = position[key];
+ const valNumber = parseFloat(val);
+ const parentValNumber = parseFloat(parentPosition[key]);
+ if (key === "top" || key === "left") {
+ val = Math.max(valNumber, parentValNumber) + "px";
+ } else if (key === "width" || key === "height") {
+ const base2 = key === "width" ? "left" : "top";
+ const parentStart = parseFloat(parentPosition[base2]);
+ const viewStart = parseFloat(position[base2]);
+ const diff1 = Math.max(parentStart - viewStart, 0);
+ const diff2 = Math.max(viewStart + valNumber - (parentStart + parentValNumber), 0);
+ val = Math.max(valNumber - diff1 - diff2, 0) + "px";
+ }
+ object[key] = val;
+ }
+ return object;
+ });
+ const baseStyle = [
+ "borderRadius",
+ "borderColor",
+ "borderWidth",
+ "backgroundColor"
+ ];
+ const textStyle = [
+ "paddingTop",
+ "paddingRight",
+ "paddingBottom",
+ "paddingLeft",
+ "color",
+ "textAlign",
+ "lineHeight",
+ "fontSize",
+ "fontWeight",
+ "textOverflow",
+ "whiteSpace"
+ ];
+ const imageStyle = [];
+ const textAlign = { start: "left", end: "right" };
+ function updateStyle(style2) {
+ const computedStyle = getComputedStyle(rootRef.value);
+ baseStyle.concat(textStyle, imageStyle).forEach((key) => {
+ style2[key] = computedStyle[key];
+ });
+ return style2;
+ }
+ const style = reactive(updateStyle({}));
+ let request = null;
+ function requestStyleUpdate() {
+ if (request) {
+ cancelAnimationFrame(request);
+ }
+ request = requestAnimationFrame(() => {
+ request = null;
+ updateStyle(style);
+ });
+ }
+ window.addEventListener("updateview", requestStyleUpdate);
+ function getTagPosition() {
+ const position2 = {};
+ for (const key in position2) {
+ let val = position2[key];
+ if (key === "top" || key === "left") {
+ val = Math.min(parseFloat(val) - parseFloat(parentPosition[key]), 0) + "px";
+ }
+ position2[key] = val;
+ }
+ return position2;
+ }
+ const tags = computed$1(() => {
+ const position2 = getTagPosition();
+ const tags2 = [
+ {
+ tag: "rect",
+ position: position2,
+ rectStyles: {
+ color: style.backgroundColor,
+ radius: style.borderRadius,
+ borderColor: style.borderColor,
+ borderWidth: style.borderWidth
+ }
+ }
+ ];
+ if ("src" in content) {
+ if (content.src) {
+ tags2.push({
+ tag: "img",
+ position: position2,
+ src: content.src
+ });
+ }
+ } else {
+ const lineSpacing = parseFloat(style.lineHeight) - parseFloat(style.fontSize);
+ let width = parseFloat(position2.width) - parseFloat(style.paddingLeft) - parseFloat(style.paddingRight);
+ width = width < 0 ? 0 : width;
+ let height = parseFloat(position2.height) - parseFloat(style.paddingTop) - lineSpacing / 2 - parseFloat(style.paddingBottom);
+ height = height < 0 ? 0 : height;
+ tags2.push({
+ tag: "font",
+ position: {
+ top: `${parseFloat(position2.top) + parseFloat(style.paddingTop) + lineSpacing / 2}px`,
+ left: `${parseFloat(position2.left) + parseFloat(style.paddingLeft)}px`,
+ width: `${width}px`,
+ height: `${height}px`
+ },
+ textStyles: {
+ align: textAlign[style.textAlign] || style.textAlign,
+ color: style.color,
+ decoration: "none",
+ lineSpacing: `${lineSpacing}px`,
+ margin: "0px",
+ overflow: style.textOverflow,
+ size: style.fontSize,
+ verticalAlign: "top",
+ weight: style.fontWeight,
+ whiteSpace: style.whiteSpace
+ },
+ text: content.text
+ });
+ }
+ return tags2;
+ });
+ const cover = new plus.nativeObj.View(`cover-${Date.now()}-${id++}`, viewPosition.value, tags.value);
+ plus.webview.currentWebview().append(cover);
+ if (hidden.value) {
+ cover.hide();
+ }
+ cover.addEventListener("click", () => {
+ trigger2("click", {}, {});
+ });
+ watch(() => hidden.value, (val) => {
+ cover[val ? "hide" : "show"]();
+ });
+ watch(() => viewPosition.value, (val) => {
+ cover.setStyle(val);
+ }, { deep: true });
+ watch(() => tags.value, () => {
+ cover.reset();
+ cover.draw(tags.value);
+ }, { deep: true });
+ });
+ }
+ const TEMP_PATH = "_doc/uniapp_temp/";
+ const props$1 = {
+ src: {
+ type: String,
+ default: ""
+ },
+ autoSize: {
+ type: [Boolean, String],
+ default: false
+ }
+ };
+ function useImageLoad(props2, content, trigger2) {
+ const style = ref("");
+ let downloaTask;
+ function loadImage() {
+ content.src = "";
+ style.value = props2.autoSize ? "width:0;height:0;" : "";
+ const realPath = props2.src ? getRealPath(props2.src) : "";
+ if (realPath.indexOf("http://") === 0 || realPath.indexOf("https://") === 0) {
+ plusReady(() => {
+ downloaTask = plus.downloader.createDownload(realPath, {
+ filename: TEMP_PATH + "/download/"
+ }, (task, status) => {
+ if (status === 200) {
+ getImageInfo(task.filename);
+ } else {
+ trigger2("error", {}, {
+ errMsg: "error"
+ });
+ }
+ });
+ downloaTask.start();
+ });
+ } else if (realPath) {
+ getImageInfo(realPath);
+ }
+ }
+ function getImageInfo(src) {
+ content.src = src;
+ plusReady(() => {
+ plus.io.getImageInfo({
+ src,
+ success: ({
+ width,
+ height
+ }) => {
+ if (props2.autoSize) {
+ style.value = `width:${width}px;height:${height}px;`;
+ window.dispatchEvent(new CustomEvent("updateview"));
+ }
+ trigger2("load", {}, {
+ width,
+ height
+ });
+ },
+ fail: () => {
+ trigger2("error", {}, {
+ errMsg: "error"
+ });
+ }
+ });
+ });
+ }
+ if (props2.src) {
+ loadImage();
+ }
+ watch(() => props2.src, loadImage);
+ onBeforeUnmount(() => {
+ if (downloaTask) {
+ downloaTask.abort();
+ }
+ });
+ return style;
+ }
+ var CoverImage = /* @__PURE__ */ defineBuiltInComponent({
+ name: "CoverImage",
+ props: props$1,
+ emits: ["click", "load", "error"],
+ setup(props2, {
+ emit: emit2
+ }) {
+ const rootRef = ref(null);
+ const trigger2 = useCustomEvent(rootRef, emit2);
+ let content = reactive({
+ src: ""
+ });
+ const style = useImageLoad(props2, content, trigger2);
+ useCover(rootRef, trigger2, content);
+ return () => {
+ return createVNode("uni-cover-image", {
+ "ref": rootRef,
+ "style": style.value
+ }, {
+ default: () => [createVNode("div", {
+ "class": "uni-cover-image"
+ }, null)]
+ }, 8, ["style"]);
+ };
+ }
+ });
+ class UniCoverImage extends UniComponent {
+ constructor(id2) {
+ super(id2, "uni-cover-image", CoverImage);
+ }
+ }
+ var CoverView = /* @__PURE__ */ defineBuiltInComponent({
+ name: "CoverView",
+ emits: ["click"],
+ setup(_, {
+ emit: emit2,
+ slots
+ }) {
+ const rootRef = ref(null);
+ const trigger2 = useCustomEvent(rootRef, emit2);
+ let content = reactive({
+ text: ""
+ });
+ useCover(rootRef, trigger2, content);
+ return () => {
+ const defaultSlots = slots.default ? flatVNode(slots.default()) : [];
+ let text2 = "";
+ defaultSlots.forEach((node) => {
+ if (!node.type === Text) {
+ text2 += node.children || "";
+ }
+ });
+ content.text = text2;
+ return createVNode("uni-cover-view", {
+ "ref": rootRef
+ }, {
+ default: () => [createVNode("div", {
+ "class": "uni-cover-view"
+ }, [text2])]
+ }, 512);
+ };
+ }
+ });
+ class UniCoverView extends UniComponent {
+ constructor(id2) {
+ super(id2, "uni-cover-view", CoverView);
+ }
+ }
+ var editor = ".ql-container {\n display: block;\n position: relative;\n box-sizing: border-box;\n -webkit-user-select: text;\n user-select: text;\n outline: none;\n overflow: hidden;\n width: 100%;\n height: 200px;\n min-height: 200px;\n}\n.ql-container[hidden] {\n display: none;\n}\n.ql-container .ql-editor {\n position: relative;\n font-size: inherit;\n line-height: inherit;\n font-family: inherit;\n min-height: inherit;\n width: 100%;\n height: 100%;\n padding: 0;\n overflow-x: hidden;\n overflow-y: auto;\n -webkit-tap-highlight-color: transparent;\n -webkit-touch-callout: none;\n -webkit-overflow-scrolling: touch;\n}\n.ql-container .ql-editor::-webkit-scrollbar {\n width: 0 !important;\n}\n.ql-container .ql-editor.scroll-disabled {\n overflow: hidden;\n}\n.ql-container .ql-image-overlay {\n display: flex;\n position: absolute;\n box-sizing: border-box;\n border: 1px dashed #ccc;\n justify-content: center;\n align-items: center;\n -webkit-user-select: none;\n user-select: none;\n}\n.ql-container .ql-image-overlay .ql-image-size {\n position: absolute;\n padding: 4px 8px;\n text-align: center;\n background-color: #fff;\n color: #888;\n border: 1px solid #ccc;\n box-sizing: border-box;\n opacity: 0.8;\n right: 4px;\n top: 4px;\n font-size: 12px;\n display: inline-block;\n width: auto;\n}\n.ql-container .ql-image-overlay .ql-image-toolbar {\n position: relative;\n text-align: center;\n box-sizing: border-box;\n background: #000;\n border-radius: 5px;\n color: #fff;\n font-size: 0;\n min-height: 24px;\n z-index: 100;\n}\n.ql-container .ql-image-overlay .ql-image-toolbar span {\n display: inline-block;\n cursor: pointer;\n padding: 5px;\n font-size: 12px;\n border-right: 1px solid #fff;\n}\n.ql-container .ql-image-overlay .ql-image-toolbar span:last-child {\n border-right: 0;\n}\n.ql-container .ql-image-overlay .ql-image-toolbar span.triangle-up {\n padding: 0;\n position: absolute;\n top: -12px;\n left: 50%;\n transform: translatex(-50%);\n width: 0;\n height: 0;\n border-width: 6px;\n border-style: solid;\n border-color: transparent transparent black transparent;\n}\n.ql-container .ql-image-overlay .ql-image-handle {\n position: absolute;\n height: 12px;\n width: 12px;\n border-radius: 50%;\n border: 1px solid #ccc;\n box-sizing: border-box;\n background: #fff;\n}\n.ql-container img {\n display: inline-block;\n max-width: 100%;\n}\n.ql-clipboard p {\n margin: 0;\n padding: 0;\n}\n.ql-editor {\n box-sizing: border-box;\n height: 100%;\n outline: none;\n overflow-y: auto;\n tab-size: 4;\n -moz-tab-size: 4;\n text-align: left;\n white-space: pre-wrap;\n word-wrap: break-word;\n}\n.ql-editor > * {\n cursor: text;\n}\n.ql-editor p,\n.ql-editor ol,\n.ql-editor ul,\n.ql-editor pre,\n.ql-editor blockquote,\n.ql-editor h1,\n.ql-editor h2,\n.ql-editor h3,\n.ql-editor h4,\n.ql-editor h5,\n.ql-editor h6 {\n margin: 0;\n padding: 0;\n counter-reset: list-1 list-2 list-3 list-4 list-5 list-6 list-7 list-8 list-9;\n}\n.ql-editor ol > li,\n.ql-editor ul > li {\n list-style-type: none;\n}\n.ql-editor ul > li::before {\n content: '\\2022';\n}\n.ql-editor ul[data-checked=true],\n.ql-editor ul[data-checked=false] {\n pointer-events: none;\n}\n.ql-editor ul[data-checked=true] > li *,\n.ql-editor ul[data-checked=false] > li * {\n pointer-events: all;\n}\n.ql-editor ul[data-checked=true] > li::before,\n.ql-editor ul[data-checked=false] > li::before {\n color: #777;\n cursor: pointer;\n pointer-events: all;\n}\n.ql-editor ul[data-checked=true] > li::before {\n content: '\\2611';\n}\n.ql-editor ul[data-checked=false] > li::before {\n content: '\\2610';\n}\n.ql-editor li::before {\n display: inline-block;\n white-space: nowrap;\n width: 2em;\n}\n.ql-editor ol li {\n counter-reset: list-1 list-2 list-3 list-4 list-5 list-6 list-7 list-8 list-9;\n counter-increment: list-0;\n}\n.ql-editor ol li:before {\n content: counter(list-0, decimal) '. ';\n}\n.ql-editor ol li.ql-indent-1 {\n counter-increment: list-1;\n}\n.ql-editor ol li.ql-indent-1:before {\n content: counter(list-1, lower-alpha) '. ';\n}\n.ql-editor ol li.ql-indent-1 {\n counter-reset: list-2 list-3 list-4 list-5 list-6 list-7 list-8 list-9;\n}\n.ql-editor ol li.ql-indent-2 {\n counter-increment: list-2;\n}\n.ql-editor ol li.ql-indent-2:before {\n content: counter(list-2, lower-roman) '. ';\n}\n.ql-editor ol li.ql-indent-2 {\n counter-reset: list-3 list-4 list-5 list-6 list-7 list-8 list-9;\n}\n.ql-editor ol li.ql-indent-3 {\n counter-increment: list-3;\n}\n.ql-editor ol li.ql-indent-3:before {\n content: counter(list-3, decimal) '. ';\n}\n.ql-editor ol li.ql-indent-3 {\n counter-reset: list-4 list-5 list-6 list-7 list-8 list-9;\n}\n.ql-editor ol li.ql-indent-4 {\n counter-increment: list-4;\n}\n.ql-editor ol li.ql-indent-4:before {\n content: counter(list-4, lower-alpha) '. ';\n}\n.ql-editor ol li.ql-indent-4 {\n counter-reset: list-5 list-6 list-7 list-8 list-9;\n}\n.ql-editor ol li.ql-indent-5 {\n counter-increment: list-5;\n}\n.ql-editor ol li.ql-indent-5:before {\n content: counter(list-5, lower-roman) '. ';\n}\n.ql-editor ol li.ql-indent-5 {\n counter-reset: list-6 list-7 list-8 list-9;\n}\n.ql-editor ol li.ql-indent-6 {\n counter-increment: list-6;\n}\n.ql-editor ol li.ql-indent-6:before {\n content: counter(list-6, decimal) '. ';\n}\n.ql-editor ol li.ql-indent-6 {\n counter-reset: list-7 list-8 list-9;\n}\n.ql-editor ol li.ql-indent-7 {\n counter-increment: list-7;\n}\n.ql-editor ol li.ql-indent-7:before {\n content: counter(list-7, lower-alpha) '. ';\n}\n.ql-editor ol li.ql-indent-7 {\n counter-reset: list-8 list-9;\n}\n.ql-editor ol li.ql-indent-8 {\n counter-increment: list-8;\n}\n.ql-editor ol li.ql-indent-8:before {\n content: counter(list-8, lower-roman) '. ';\n}\n.ql-editor ol li.ql-indent-8 {\n counter-reset: list-9;\n}\n.ql-editor ol li.ql-indent-9 {\n counter-increment: list-9;\n}\n.ql-editor ol li.ql-indent-9:before {\n content: counter(list-9, decimal) '. ';\n}\n.ql-editor .ql-indent-1:not(.ql-direction-rtl) {\n padding-left: 2em;\n}\n.ql-editor li.ql-indent-1:not(.ql-direction-rtl) {\n padding-left: 2em;\n}\n.ql-editor .ql-indent-1.ql-direction-rtl.ql-align-right {\n padding-right: 2em;\n}\n.ql-editor li.ql-indent-1.ql-direction-rtl.ql-align-right {\n padding-right: 2em;\n}\n.ql-editor .ql-indent-2:not(.ql-direction-rtl) {\n padding-left: 4em;\n}\n.ql-editor li.ql-indent-2:not(.ql-direction-rtl) {\n padding-left: 4em;\n}\n.ql-editor .ql-indent-2.ql-direction-rtl.ql-align-right {\n padding-right: 4em;\n}\n.ql-editor li.ql-indent-2.ql-direction-rtl.ql-align-right {\n padding-right: 4em;\n}\n.ql-editor .ql-indent-3:not(.ql-direction-rtl) {\n padding-left: 6em;\n}\n.ql-editor li.ql-indent-3:not(.ql-direction-rtl) {\n padding-left: 6em;\n}\n.ql-editor .ql-indent-3.ql-direction-rtl.ql-align-right {\n padding-right: 6em;\n}\n.ql-editor li.ql-indent-3.ql-direction-rtl.ql-align-right {\n padding-right: 6em;\n}\n.ql-editor .ql-indent-4:not(.ql-direction-rtl) {\n padding-left: 8em;\n}\n.ql-editor li.ql-indent-4:not(.ql-direction-rtl) {\n padding-left: 8em;\n}\n.ql-editor .ql-indent-4.ql-direction-rtl.ql-align-right {\n padding-right: 8em;\n}\n.ql-editor li.ql-indent-4.ql-direction-rtl.ql-align-right {\n padding-right: 8em;\n}\n.ql-editor .ql-indent-5:not(.ql-direction-rtl) {\n padding-left: 10em;\n}\n.ql-editor li.ql-indent-5:not(.ql-direction-rtl) {\n padding-left: 10em;\n}\n.ql-editor .ql-indent-5.ql-direction-rtl.ql-align-right {\n padding-right: 10em;\n}\n.ql-editor li.ql-indent-5.ql-direction-rtl.ql-align-right {\n padding-right: 10em;\n}\n.ql-editor .ql-indent-6:not(.ql-direction-rtl) {\n padding-left: 12em;\n}\n.ql-editor li.ql-indent-6:not(.ql-direction-rtl) {\n padding-left: 12em;\n}\n.ql-editor .ql-indent-6.ql-direction-rtl.ql-align-right {\n padding-right: 12em;\n}\n.ql-editor li.ql-indent-6.ql-direction-rtl.ql-align-right {\n padding-right: 12em;\n}\n.ql-editor .ql-indent-7:not(.ql-direction-rtl) {\n padding-left: 14em;\n}\n.ql-editor li.ql-indent-7:not(.ql-direction-rtl) {\n padding-left: 14em;\n}\n.ql-editor .ql-indent-7.ql-direction-rtl.ql-align-right {\n padding-right: 14em;\n}\n.ql-editor li.ql-indent-7.ql-direction-rtl.ql-align-right {\n padding-right: 14em;\n}\n.ql-editor .ql-indent-8:not(.ql-direction-rtl) {\n padding-left: 16em;\n}\n.ql-editor li.ql-indent-8:not(.ql-direction-rtl) {\n padding-left: 16em;\n}\n.ql-editor .ql-indent-8.ql-direction-rtl.ql-align-right {\n padding-right: 16em;\n}\n.ql-editor li.ql-indent-8.ql-direction-rtl.ql-align-right {\n padding-right: 16em;\n}\n.ql-editor .ql-indent-9:not(.ql-direction-rtl) {\n padding-left: 18em;\n}\n.ql-editor li.ql-indent-9:not(.ql-direction-rtl) {\n padding-left: 18em;\n}\n.ql-editor .ql-indent-9.ql-direction-rtl.ql-align-right {\n padding-right: 18em;\n}\n.ql-editor li.ql-indent-9.ql-direction-rtl.ql-align-right {\n padding-right: 18em;\n}\n.ql-editor .ql-direction-rtl {\n direction: rtl;\n text-align: inherit;\n}\n.ql-editor .ql-align-center {\n text-align: center;\n}\n.ql-editor .ql-align-justify {\n text-align: justify;\n}\n.ql-editor .ql-align-right {\n text-align: right;\n}\n.ql-editor.ql-blank::before {\n color: rgba(0, 0, 0, 0.6);\n content: attr(data-placeholder);\n font-style: italic;\n pointer-events: none;\n position: absolute;\n}\n.ql-container.ql-disabled .ql-editor ul[data-checked] > li::before {\n pointer-events: none;\n}\n.ql-clipboard {\n left: -100000px;\n height: 1px;\n overflow-y: hidden;\n position: absolute;\n top: 50%;\n}\n";
+ class UniEditor extends UniComponent {
+ constructor(id2) {
+ super(id2, "uni-editor", Editor);
+ }
+ }
+ var form = "";
+ class UniForm extends UniComponent {
+ constructor(id2) {
+ super(id2, "uni-form", Form);
+ }
+ }
+ class UniFunctionalPageNavigator extends UniNode {
+ constructor(id2) {
+ super(id2, "uni-functional-page-navigator");
+ }
+ }
+ var icon = "uni-icon {\n display: inline-block;\n font-size: 0;\n box-sizing: border-box;\n}\n\nuni-icon[hidden] {\n display: none;\n}\n";
+ class UniIcon extends UniComponent {
+ constructor(id2) {
+ super(id2, "uni-icon", Icon);
+ }
+ }
+ var image = "uni-image {\n width: 320px;\n height: 240px;\n display: inline-block;\n overflow: hidden;\n position: relative;\n}\n\nuni-image[hidden] {\n display: none;\n}\n\nuni-image > div {\n width: 100%;\n height: 100%;\n}\n\nuni-image > img {\n -webkit-touch-callout: none;\n -webkit-user-select: none;\n user-select: none;\n display: block;\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n opacity: 0;\n}\n\nuni-image > .uni-image-will-change {\n will-change: transform;\n}\n";
+ class UniImage extends UniComponent {
+ constructor(id2) {
+ super(id2, "uni-image", Image$1);
+ }
+ }
+ var input = "uni-input {\n display: block;\n font-size: 16px;\n line-height: 1.4em;\n height: 1.4em;\n min-height: 1.4em;\n overflow: hidden;\n}\n\nuni-input[hidden] {\n display: none;\n}\n\n.uni-input-wrapper,\n.uni-input-placeholder,\n.uni-input-form,\n.uni-input-input {\n outline: none;\n border: none;\n padding: 0;\n margin: 0;\n text-decoration: inherit;\n}\n\n.uni-input-wrapper,\n.uni-input-form {\n display: flex;\n position: relative;\n width: 100%;\n height: 100%;\n flex-direction: column;\n justify-content: center;\n}\n\n.uni-input-placeholder,\n.uni-input-input {\n width: 100%;\n}\n\n.uni-input-placeholder {\n position: absolute;\n top: auto !important;\n left: 0;\n color: gray;\n overflow: hidden;\n text-overflow: clip;\n white-space: pre;\n word-break: keep-all;\n pointer-events: none;\n line-height: inherit;\n}\n\n.uni-input-input {\n position: relative;\n display: block;\n height: 100%;\n background: none;\n color: inherit;\n opacity: 1;\n font: inherit;\n line-height: inherit;\n letter-spacing: inherit;\n text-align: inherit;\n text-indent: inherit;\n text-transform: inherit;\n text-shadow: inherit;\n}\n\n.uni-input-input[type='search']::-webkit-search-cancel-button {\n display: none;\n}\n\n.uni-input-input::-webkit-outer-spin-button,\n.uni-input-input::-webkit-inner-spin-button {\n -webkit-appearance: none;\n appearance: none;\n margin: 0;\n}\n\n.uni-input-input[type='number'] {\n -moz-appearance: textfield;\n}\n\n.uni-input-input:disabled {\n /* \u7528\u4E8E\u91CD\u7F6EiOS14\u4EE5\u4E0B\u7981\u7528\u72B6\u6001\u6587\u5B57\u989C\u8272 */\n -webkit-text-fill-color: currentcolor;\n}\n";
+ class UniInput extends UniComponent {
+ constructor(id2) {
+ super(id2, "uni-input", Input);
+ }
+ }
+ var label = ".uni-label-pointer {\n cursor: pointer;\n}\n";
+ class UniLabel extends UniComponent {
+ constructor(id2) {
+ super(id2, "uni-label", Label);
+ }
+ }
+ class UniLivePlayer extends UniNode {
+ constructor(id2) {
+ super(id2, "uni-live-player");
+ }
+ }
+ class UniLivePusher extends UniNode {
+ constructor(id2) {
+ super(id2, "uni-live-pusher");
+ }
+ }
+ var Map$1 = /* @__PURE__ */ defineBuiltInComponent({
+ name: "Map"
+ });
+ class UniMap extends UniComponent {
+ constructor(id2) {
+ super(id2, "uni-map", Map$1);
+ }
+ }
+ var movableArea = "uni-movable-area {\n display: block;\n position: relative;\n width: 10px;\n height: 10px;\n}\n\nuni-movable-area[hidden] {\n display: none;\n}\n";
+ class UniMovableArea extends UniComponent {
+ constructor(id2) {
+ super(id2, "uni-movable-area", MovableArea);
+ }
+ }
+ var movableView = "uni-movable-view {\n display: inline-block;\n width: 10px;\n height: 10px;\n top: 0px;\n left: 0px;\n position: absolute;\n cursor: grab;\n}\n\nuni-movable-view[hidden] {\n display: none;\n}\n";
+ class UniMovableView extends UniComponent {
+ constructor(id2) {
+ super(id2, "uni-movable-view", MovableView);
+ }
+ }
+ var navigator$1 = "uni-navigator {\n height: auto;\n width: auto;\n display: block;\n cursor: pointer;\n}\n\nuni-navigator[hidden] {\n display: none;\n}\n\n.navigator-hover {\n background-color: rgba(0, 0, 0, 0.1);\n opacity: 0.7;\n}\n";
+ class UniNavigator extends UniComponent {
+ constructor(id2) {
+ super(id2, "uni-navigator", Navigator);
+ }
+ }
+ class UniOfficialAccount extends UniNode {
+ constructor(id2) {
+ super(id2, "uni-official-account");
+ }
+ }
+ class UniOpenData extends UniNode {
+ constructor(id2) {
+ super(id2, "uni-open-data");
+ }
+ }
+ var Picker = /* @__PURE__ */ defineBuiltInComponent({
+ name: "Picker"
+ });
+ class UniPicker extends UniComponent {
+ constructor(id2) {
+ super(id2, "uni-picker", Picker);
+ }
+ }
+ var pickerView = "uni-picker-view {\n display: block;\n}\n\n.uni-picker-view-wrapper {\n display: flex;\n position: relative;\n overflow: hidden;\n height: 100%;\n}\n\nuni-picker-view[hidden] {\n display: none;\n}\n";
+ class UniPickerView extends UniComponent {
+ constructor(id2) {
+ super(id2, "uni-picker-view", PickerView);
+ }
+ }
+ var pickerViewColumn = "uni-picker-view-column {\n flex: 1;\n position: relative;\n height: 100%;\n overflow: hidden;\n}\n\nuni-picker-view-column[hidden] {\n display: none;\n}\n\n.uni-picker-view-group {\n height: 100%;\n overflow: hidden;\n}\n\n.uni-picker-view-mask {\n transform: translateZ(0);\n}\n\n.uni-picker-view-indicator,\n.uni-picker-view-mask {\n position: absolute;\n left: 0;\n width: 100%;\n z-index: 3;\n pointer-events: none;\n}\n\n.uni-picker-view-mask {\n top: 0;\n height: 100%;\n margin: 0 auto;\n background: linear-gradient(\n 180deg,\n hsla(0, 0%, 100%, 0.95),\n hsla(0, 0%, 100%, 0.6)\n ),\n linear-gradient(0deg, hsla(0, 0%, 100%, 0.95), hsla(0, 0%, 100%, 0.6));\n background-position: top, bottom;\n background-size: 100% 102px;\n background-repeat: no-repeat;\n}\n\n.uni-picker-view-indicator {\n height: 34px;\n /* top: 102px; */\n top: 50%;\n transform: translateY(-50%);\n}\n\n.uni-picker-view-content {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n will-change: transform;\n padding: 102px 0;\n cursor: pointer;\n}\n\n.uni-picker-view-content > * {\n height: 34px;\n overflow: hidden;\n}\n\n.uni-picker-view-indicator:after,\n.uni-picker-view-indicator:before {\n content: ' ';\n position: absolute;\n left: 0;\n right: 0;\n height: 1px;\n color: #e5e5e5;\n}\n\n.uni-picker-view-indicator:before {\n top: 0;\n border-top: 1px solid #e5e5e5;\n transform-origin: 0 0;\n transform: scaleY(0.5);\n}\n\n.uni-picker-view-indicator:after {\n bottom: 0;\n border-bottom: 1px solid #e5e5e5;\n transform-origin: 0 100%;\n transform: scaleY(0.5);\n}\n\n.uni-picker-view-indicator:after,\n.uni-picker-view-indicator:before {\n content: ' ';\n position: absolute;\n left: 0;\n right: 0;\n height: 1px;\n color: #e5e5e5;\n}\n";
+ class UniPickerViewColumn extends UniComponent {
+ constructor(id2) {
+ super(id2, "uni-picker-view-column", PickerViewColumn);
+ }
+ }
+ var progress = "uni-progress {\n display: flex;\n align-items: center;\n}\n\nuni-progress[hidden] {\n display: none;\n}\n\n.uni-progress-bar {\n flex: 1;\n}\n\n.uni-progress-inner-bar {\n width: 0;\n height: 100%;\n}\n\n.uni-progress-info {\n margin-top: 0;\n margin-bottom: 0;\n min-width: 2em;\n margin-left: 15px;\n font-size: 16px;\n}\n";
+ class UniProgress extends UniComponent {
+ constructor(id2) {
+ super(id2, "uni-progress", Progress);
+ }
+ }
+ var radio = "uni-radio {\n -webkit-tap-highlight-color: transparent;\n display: inline-block;\n cursor: pointer;\n}\n\nuni-radio[hidden] {\n display: none;\n}\n\nuni-radio[disabled] {\n cursor: not-allowed;\n}\n\n.uni-radio-wrapper {\n display: inline-flex;\n align-items: center;\n vertical-align: middle;\n}\n\n.uni-radio-input {\n -webkit-appearance: none;\n appearance: none;\n margin-right: 5px;\n outline: 0;\n border: 1px solid #d1d1d1;\n background-color: #ffffff;\n border-radius: 50%;\n width: 22px;\n height: 22px;\n position: relative;\n}\n\nuni-radio:not([disabled]) .uni-radio-input:hover {\n border-color: #007aff;\n}\n\n.uni-radio-input svg {\n color: #ffffff;\n font-size: 18px;\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -48%) scale(0.73);\n}\n\n.uni-radio-input.uni-radio-input-disabled {\n background-color: #e1e1e1;\n border-color: #d1d1d1;\n}\n\n.uni-radio-input.uni-radio-input-disabled:before {\n color: #adadad;\n}\n";
+ class UniRadio extends UniComponent {
+ constructor(id2) {
+ super(id2, "uni-radio", Radio);
+ }
+ }
+ var radioGroup = "uni-radio-group {\n display: block;\n}\nuni-radio-group[hidden] {\n display: none;\n}\n";
+ class UniRadioGroup extends UniComponent {
+ constructor(id2) {
+ super(id2, "uni-radio-group", RadioGroup);
+ }
+ }
+ var richText = "";
+ class UniRichText extends UniComponent {
+ constructor(id2) {
+ super(id2, "uni-rich-text", RichText);
+ }
+ }
+ var scrollView = "uni-scroll-view {\n display: block;\n width: 100%;\n}\n\nuni-scroll-view[hidden] {\n display: none;\n}\n\n.uni-scroll-view {\n position: relative;\n -webkit-overflow-scrolling: touch;\n width: 100%;\n /* display: flex; \u65F6\u5728\u5B89\u5353\u4E0B\u4F1A\u5BFC\u81F4scrollWidth\u548CoffsetWidth\u4E00\u6837 */\n height: 100%;\n max-height: inherit;\n}\n\n.uni-scroll-view-content {\n width: 100%;\n height: 100%;\n}\n\n.uni-scroll-view-refresher {\n position: relative;\n overflow: hidden;\n}\n\n.uni-scroll-view-refresh {\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n display: flex;\n flex-direction: row;\n justify-content: center;\n align-items: center;\n}\n\n.uni-scroll-view-refresh-inner {\n display: flex;\n align-items: center;\n justify-content: center;\n line-height: 0;\n width: 40px;\n height: 40px;\n border-radius: 50%;\n background-color: #fff;\n box-shadow: 0 1px 6px rgba(0, 0, 0, 0.117647),\n 0 1px 4px rgba(0, 0, 0, 0.117647);\n}\n\n.uni-scroll-view-refresh__spinner {\n transform-origin: center center;\n animation: uni-scroll-view-refresh-rotate 2s linear infinite;\n}\n\n.uni-scroll-view-refresh__spinner > circle {\n stroke: currentColor;\n stroke-linecap: round;\n animation: uni-scroll-view-refresh-dash 2s linear infinite;\n}\n\n@keyframes uni-scroll-view-refresh-rotate {\n 0% {\n transform: rotate(0deg);\n }\n\n 100% {\n transform: rotate(360deg);\n }\n}\n\n@keyframes uni-scroll-view-refresh-dash {\n 0% {\n stroke-dasharray: 1, 200;\n stroke-dashoffset: 0;\n }\n\n 50% {\n stroke-dasharray: 89, 200;\n stroke-dashoffset: -35px;\n }\n\n 100% {\n stroke-dasharray: 89, 200;\n stroke-dashoffset: -124px;\n }\n}\n";
+ class UniScrollView extends UniComponent {
+ constructor(id2) {
+ super(id2, "uni-scroll-view", ScrollView);
+ }
+ }
+ var slider = "uni-slider {\n margin: 10px 18px;\n padding: 0;\n display: block;\n}\n\nuni-slider[hidden] {\n display: none;\n}\n\nuni-slider .uni-slider-wrapper {\n display: flex;\n align-items: center;\n min-height: 16px;\n}\n\nuni-slider .uni-slider-tap-area {\n flex: 1;\n padding: 8px 0;\n}\n\nuni-slider .uni-slider-handle-wrapper {\n position: relative;\n height: 2px;\n border-radius: 5px;\n background-color: #e9e9e9;\n cursor: pointer;\n transition: background-color 0.3s ease;\n -webkit-tap-highlight-color: transparent;\n}\n\nuni-slider .uni-slider-track {\n height: 100%;\n border-radius: 6px;\n background-color: #007aff;\n transition: background-color 0.3s ease;\n}\n\nuni-slider .uni-slider-handle,\nuni-slider .uni-slider-thumb {\n position: absolute;\n left: 50%;\n top: 50%;\n cursor: pointer;\n border-radius: 50%;\n transition: border-color 0.3s ease;\n}\n\nuni-slider .uni-slider-handle {\n width: 28px;\n height: 28px;\n margin-top: -14px;\n margin-left: -14px;\n background-color: transparent;\n z-index: 3;\n cursor: grab;\n}\n\nuni-slider .uni-slider-thumb {\n z-index: 2;\n box-shadow: 0 0 4px rgba(0, 0, 0, 0.2);\n}\n\nuni-slider .uni-slider-step {\n position: absolute;\n width: 100%;\n height: 2px;\n background: transparent;\n z-index: 1;\n}\n\nuni-slider .uni-slider-value {\n width: 3ch;\n color: #888;\n font-size: 14px;\n margin-left: 1em;\n}\n\nuni-slider .uni-slider-disabled .uni-slider-track {\n background-color: #ccc;\n}\n\nuni-slider .uni-slider-disabled .uni-slider-thumb {\n background-color: #fff;\n border-color: #ccc;\n}\n";
+ class UniSlider extends UniComponent {
+ constructor(id2) {
+ super(id2, "uni-slider", Slider);
+ }
+ }
+ var swiper = "uni-swiper {\n display: block;\n height: 150px;\n}\n\nuni-swiper[hidden] {\n display: none;\n}\n\n.uni-swiper-wrapper {\n overflow: hidden;\n position: relative;\n width: 100%;\n height: 100%;\n transform: translateZ(0);\n}\n\n.uni-swiper-slides {\n position: absolute;\n left: 0;\n top: 0;\n right: 0;\n bottom: 0;\n}\n\n.uni-swiper-slide-frame {\n position: absolute;\n left: 0;\n top: 0;\n width: 100%;\n height: 100%;\n will-change: transform;\n}\n\n.uni-swiper-dots {\n position: absolute;\n font-size: 0;\n}\n\n.uni-swiper-dots-horizontal {\n left: 50%;\n bottom: 10px;\n text-align: center;\n white-space: nowrap;\n transform: translate(-50%, 0);\n}\n\n.uni-swiper-dots-horizontal .uni-swiper-dot {\n margin-right: 8px;\n}\n\n.uni-swiper-dots-horizontal .uni-swiper-dot:last-child {\n margin-right: 0;\n}\n\n.uni-swiper-dots-vertical {\n right: 10px;\n top: 50%;\n text-align: right;\n transform: translate(0, -50%);\n}\n\n.uni-swiper-dots-vertical .uni-swiper-dot {\n display: block;\n margin-bottom: 9px;\n}\n\n.uni-swiper-dots-vertical .uni-swiper-dot:last-child {\n margin-bottom: 0;\n}\n\n.uni-swiper-dot {\n display: inline-block;\n width: 8px;\n height: 8px;\n cursor: pointer;\n transition-property: background-color;\n transition-timing-function: ease;\n background: rgba(0, 0, 0, 0.3);\n border-radius: 50%;\n}\n\n.uni-swiper-dot-active {\n background-color: #000000;\n}\n";
+ class UniSwiper extends UniComponent {
+ constructor(id2) {
+ super(id2, "uni-swiper", Swiper);
+ }
+ }
+ var swiperItem = "uni-swiper-item {\n display: block;\n overflow: hidden;\n will-change: transform;\n position: absolute;\n width: 100%;\n height: 100%;\n cursor: grab;\n}\n\nuni-swiper-item[hidden] {\n display: none;\n}\n";
+ class UniSwiperItem extends UniComponent {
+ constructor(id2) {
+ super(id2, "uni-swiper-item", SwiperItem);
+ }
+ }
+ var _switch = "uni-switch {\n -webkit-tap-highlight-color: transparent;\n display: inline-block;\n cursor: pointer;\n}\n\nuni-switch[hidden] {\n display: none;\n}\n\nuni-switch[disabled] {\n cursor: not-allowed;\n}\n\n.uni-switch-wrapper {\n display: inline-flex;\n align-items: center;\n vertical-align: middle;\n}\n\n.uni-switch-input {\n -webkit-appearance: none;\n appearance: none;\n position: relative;\n width: 52px;\n height: 32px;\n margin-right: 5px;\n border: 1px solid #dfdfdf;\n outline: 0;\n border-radius: 16px;\n box-sizing: border-box;\n background-color: #dfdfdf;\n transition: background-color 0.1s, border 0.1s;\n}\n\nuni-switch[disabled] .uni-switch-input {\n opacity: 0.7;\n}\n\n.uni-switch-input:before {\n content: ' ';\n position: absolute;\n top: 0;\n left: 0;\n width: 50px;\n height: 30px;\n border-radius: 15px;\n background-color: #fdfdfd;\n transition: transform 0.3s;\n}\n\n.uni-switch-input:after {\n content: ' ';\n position: absolute;\n top: 0;\n left: 0;\n width: 30px;\n height: 30px;\n border-radius: 15px;\n background-color: #ffffff;\n box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);\n transition: transform 0.3s;\n}\n\n.uni-switch-input.uni-switch-input-checked {\n border-color: #007aff;\n background-color: #007aff;\n}\n\n.uni-switch-input.uni-switch-input-checked:before {\n transform: scale(0);\n}\n\n.uni-switch-input.uni-switch-input-checked:after {\n transform: translateX(20px);\n}\n\nuni-switch .uni-checkbox-input {\n margin-right: 5px;\n -webkit-appearance: none;\n appearance: none;\n outline: 0;\n border: 1px solid #d1d1d1;\n background-color: #ffffff;\n border-radius: 3px;\n width: 22px;\n height: 22px;\n position: relative;\n color: #007aff;\n}\n\nuni-switch:not([disabled]) .uni-checkbox-input:hover {\n border-color: #007aff;\n}\n\nuni-switch .uni-checkbox-input svg {\n color: inherit;\n font-size: 22px;\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -48%) scale(0.73);\n}\n\n.uni-checkbox-input.uni-checkbox-input-disabled {\n background-color: #e1e1e1;\n}\n\n.uni-checkbox-input.uni-checkbox-input-disabled:before {\n color: #adadad;\n}\n";
+ class UniSwitch extends UniComponent {
+ constructor(id2) {
+ super(id2, "uni-switch", Switch);
+ }
+ }
+ var text = "uni-text[selectable] {\n cursor: auto;\n -webkit-user-select: text;\n user-select: text;\n}\n";
+ class UniText extends UniComponent {
+ constructor(id2) {
+ super(id2, "uni-text", Text);
+ }
+ }
+ var textarea = "uni-textarea {\n width: 300px;\n height: 150px;\n display: block;\n position: relative;\n font-size: 16px;\n line-height: normal;\n white-space: pre-wrap;\n word-break: break-all;\n box-sizing: content-box !important;\n}\nuni-textarea[hidden] {\n display: none;\n}\n.uni-textarea-wrapper,\n.uni-textarea-placeholder,\n.uni-textarea-line,\n.uni-textarea-compute,\n.uni-textarea-textarea {\n outline: none;\n border: none;\n padding: 0;\n margin: 0;\n text-decoration: inherit;\n}\n.uni-textarea-wrapper {\n display: block;\n position: relative;\n width: 100%;\n height: 100%;\n min-height: inherit;\n}\n.uni-textarea-placeholder,\n.uni-textarea-line,\n.uni-textarea-compute,\n.uni-textarea-textarea {\n position: absolute;\n width: 100%;\n height: 100%;\n left: 0;\n top: 0;\n white-space: inherit;\n word-break: inherit;\n}\n.uni-textarea-placeholder {\n color: grey;\n overflow: hidden;\n}\n.uni-textarea-line,\n.uni-textarea-compute {\n visibility: hidden;\n height: auto;\n}\n.uni-textarea-line {\n width: 1em;\n}\n.uni-textarea-textarea {\n resize: none;\n background: none;\n color: inherit;\n opacity: 1;\n font: inherit;\n line-height: inherit;\n letter-spacing: inherit;\n text-align: inherit;\n text-indent: inherit;\n text-transform: inherit;\n text-shadow: inherit;\n}\n/* \u7528\u4E8E\u89E3\u51B3 iOS textarea \u5185\u90E8\u9ED8\u8BA4\u8FB9\u8DDD */\n.uni-textarea-textarea-fix-margin {\n width: auto;\n right: 0;\n margin: 0 -3px;\n}\n.uni-textarea-textarea:disabled {\n /* \u7528\u4E8E\u91CD\u7F6EiOS14\u4EE5\u4E0B\u7981\u7528\u72B6\u6001\u6587\u5B57\u989C\u8272 */\n -webkit-text-fill-color: currentcolor;\n}\n";
+ class UniTextarea extends UniComponent {
+ constructor(id2) {
+ super(id2, "uni-textarea", Textarea);
+ }
+ }
+ var video = "uni-video {\n width: 300px;\n height: 225px;\n display: inline-block;\n line-height: 0;\n overflow: hidden;\n position: relative;\n}\n\nuni-video[hidden] {\n display: none;\n}\n\n.uni-video-container {\n width: 100%;\n height: 100%;\n position: absolute;\n top: 0;\n left: 0;\n overflow: hidden;\n background-color: black;\n}\n\n.uni-video-slot {\n position: absolute;\n top: 0;\n width: 100%;\n height: 100%;\n overflow: hidden;\n pointer-events: none;\n}\n";
+ const props = {
+ id: {
+ type: String,
+ default: ""
+ },
+ src: {
+ type: String,
+ default: ""
},
- waiting: {
- d: ICON_PATH_WAITING,
- c: INFO_COLOR
+ duration: {
+ type: [Number, String],
+ default: ""
},
- cancel: {
- d: ICON_PATH_CANCEL,
- c: CANCEL_COLOR
+ controls: {
+ type: [Boolean, String],
+ default: true
},
- download: {
- d: ICON_PATH_DOWNLOAD,
- c: PRIMARY_COLOR
+ danmuList: {
+ type: Array,
+ default() {
+ return [];
+ }
},
- search: {
- d: ICON_PATH_SEARCH,
- c: GREY_COLOR
+ danmuBtn: {
+ type: [Boolean, String],
+ default: false
},
- clear: {
- d: ICON_PATH_CLEAR,
- c: GREY_COLOR
+ enableDanmu: {
+ type: [Boolean, String],
+ default: false
+ },
+ autoplay: {
+ type: [Boolean, String],
+ default: false
+ },
+ loop: {
+ type: [Boolean, String],
+ default: false
+ },
+ muted: {
+ type: [Boolean, String],
+ default: false
+ },
+ objectFit: {
+ type: String,
+ default: "contain"
+ },
+ poster: {
+ type: String,
+ default: ""
+ },
+ direction: {
+ type: [String, Number],
+ default: ""
+ },
+ showProgress: {
+ type: Boolean,
+ default: true
+ },
+ initialTime: {
+ type: [String, Number],
+ default: 0
+ },
+ showFullscreenBtn: {
+ type: [Boolean, String],
+ default: true
+ },
+ pageGesture: {
+ type: [Boolean, String],
+ default: false
+ },
+ enableProgressGesture: {
+ type: [Boolean, String],
+ default: true
+ },
+ showPlayBtn: {
+ type: [Boolean, String],
+ default: true
+ },
+ enablePlayGesture: {
+ type: [Boolean, String],
+ default: true
+ },
+ showCenterPlayBtn: {
+ type: [Boolean, String],
+ default: true
+ },
+ showLoading: {
+ type: [Boolean, String],
+ default: true
+ },
+ codec: {
+ type: String,
+ default: "hardware"
+ },
+ httpCache: {
+ type: [Boolean, String],
+ default: false
+ },
+ playStrategy: {
+ type: [Number, String],
+ default: 0
+ },
+ header: {
+ type: Object,
+ default() {
+ return {};
+ }
+ },
+ advanced: {
+ type: Array,
+ default() {
+ return [];
+ }
}
- });
- ({
- activeColor: PRIMARY_COLOR,
- backgroundColor: "#EBEBEB",
- activeMode: "backwards"
- });
- /* @__PURE__ */ defineBuiltInComponent({
- name: "View",
- props: extend({}, hoverProps),
- setup(props, {
+ };
+ const emits = ["play", "pause", "ended", "timeupdate", "fullscreenchange", "fullscreenclick", "waiting", "error"];
+ const methods = ["play", "pause", "stop", "seek", "sendDanmu", "playbackRate", "requestFullScreen", "exitFullScreen"];
+ var Video = /* @__PURE__ */ defineBuiltInComponent({
+ name: "Video",
+ props,
+ emits,
+ setup(props2, {
+ emit: emit2,
slots
}) {
+ const rootRef = ref(null);
+ const trigger2 = useCustomEvent(rootRef, emit2);
+ const containerRef = ref(null);
+ const attrs2 = useNativeAttrs(props2, ["id"]);
const {
- hovering,
- binding
- } = useHover(props);
- return () => {
- const hoverClass = props.hoverClass;
- if (hoverClass && hoverClass !== "none") {
- return createVNode("uni-view", mergeProps({
- "class": hovering.value ? hoverClass : ""
- }, binding), {
- default: () => [slots.default && slots.default()]
- }, 16, ["class"]);
- }
- return createVNode("uni-view", null, {
- default: () => [slots.default && slots.default()]
+ position,
+ hidden,
+ onParentReady
+ } = useNative(containerRef);
+ let video2;
+ onParentReady(() => {
+ video2 = plus.video.createVideoPlayer("video" + Date.now(), Object.assign({}, attrs2.value, position));
+ plus.webview.currentWebview().append(video2);
+ if (hidden.value) {
+ video2.hide();
+ }
+ emits.forEach((key) => {
+ video2.addEventListener(key, (event) => {
+ trigger2(key, {}, event.detail);
+ });
+ });
+ watch(() => attrs2.value, (attrs3) => video2.setStyles(attrs3), {
+ deep: true
+ });
+ watch(() => position, (position2) => video2.setStyles(position2), {
+ deep: true
+ });
+ watch(() => hidden.value, (val) => {
+ video2[val ? "hide" : "show"]();
+ if (!val) {
+ video2.setStyles(position);
+ }
});
+ });
+ const id2 = useContextInfo();
+ useSubscribe((type, data) => {
+ if (methods.includes(type)) {
+ let options;
+ switch (type) {
+ case "seek":
+ options = data.position;
+ break;
+ case "sendDanmu":
+ options = data;
+ break;
+ case "playbackRate":
+ options = data.rate;
+ break;
+ }
+ if (video2) {
+ video2[type](options);
+ }
+ }
+ }, id2, true);
+ onBeforeUnmount(() => {
+ if (video2) {
+ video2.close();
+ }
+ });
+ return () => {
+ return createVNode("uni-video", {
+ "ref": rootRef,
+ "id": props2.id
+ }, {
+ default: () => [createVNode("div", {
+ "ref": containerRef,
+ "class": "uni-video-container"
+ }, null, 512), createVNode("div", {
+ "class": "uni-video-slot"
+ }, [slots.default && slots.default()])],
+ _: 1
+ }, 8, ["id"]);
};
}
});
- class UniComponent extends UniNode {
- constructor(id, tag, component) {
- super(id, tag);
- this.$component = component;
- }
- init(nodeJson) {
- const container = document.createElement("div");
- this.$props = reactive({});
- const { a } = nodeJson;
- if (a) {
- Object.keys(a).forEach((n) => {
- this.setAttr(n, a[n]);
- });
- }
- createApp(createWrapper(this.$component, this.$props)).mount(container);
- this.$ = container.firstElementChild;
- if (hasOwn$1(nodeJson, "t")) {
- this.$.textContent = nodeJson.t || "";
- }
- }
- setAttr(name, value) {
- const decoded = decodeAttr(name);
- if (name.indexOf(".e") === 0) {
- this.$props[decoded] = createInvoker(this.id, value, parseEventName(decoded)[1]);
- } else {
- this.$props[decoded] = value;
- }
- }
- removeAttr(name) {
- this.$props[decodeAttr(name)] = null;
+ class UniVideo extends UniComponent {
+ constructor(id2) {
+ super(id2, "uni-video", Video);
}
}
- class UniButton extends UniComponent {
- constructor(id) {
- super(id, "uni-button", Button);
+ var WebView = /* @__PURE__ */ defineBuiltInComponent({
+ name: "WebView"
+ });
+ class UniWebView extends UniComponent {
+ constructor(id2) {
+ super(id2, "uni-web-view", WebView);
}
}
const BuiltInComponents = [
,
UniViewElement,
- ,
- ,
+ UniImage,
UniText,
+ UniTextNode,
UniComment,
- ,
- ,
- UniButton
+ UniNavigator,
+ UniForm,
+ UniButton,
+ UniInput,
+ UniLabel,
+ UniRadio,
+ UniCheckbox,
+ UniCheckboxGroup,
+ UniAd,
+ UniAudio,
+ UniCamera,
+ UniCanvas,
+ UniCoverImage,
+ UniCoverView,
+ UniEditor,
+ UniFunctionalPageNavigator,
+ UniIcon,
+ UniRadioGroup,
+ UniLivePlayer,
+ UniLivePusher,
+ UniMap,
+ UniMovableArea,
+ UniMovableView,
+ UniOfficialAccount,
+ UniOpenData,
+ UniPicker,
+ UniPickerView,
+ UniPickerViewColumn,
+ UniProgress,
+ UniRichText,
+ UniScrollView,
+ UniSlider,
+ UniSwiper,
+ UniSwiperItem,
+ UniSwitch,
+ UniTextarea,
+ UniVideo,
+ UniWebView
];
- function createBuiltInComponent(type, id) {
- return new BuiltInComponents[type](id);
+ function createBuiltInComponent(type, id2) {
+ return new BuiltInComponents[type](id2);
}
- function createWrapper(component, props) {
- return () => h(component, props);
+ function createWrapper(component, props2) {
+ return () => h(component, props2);
}
const elements = new Map();
- function $(id) {
- return elements.get(id);
+ function $(id2) {
+ return elements.get(id2);
}
- function createElement(id, tag) {
+ function createElement(id2, tag) {
let element;
if (isString(tag)) {
- element = new UniElement(id, document.createElement(tag));
+ element = new UniElement(id2, document.createElement(tag));
} else {
- element = createBuiltInComponent(tag, id);
+ element = createBuiltInComponent(tag, id2);
}
- elements.set(id, element);
+ elements.set(id2, element);
return element;
}
function onPageCreated() {
@@ -6023,6 +14831,9 @@
function onPageCreate({
css,
route,
+ platform,
+ pixelRatio: pixelRatio2,
+ windowWidth,
disableScroll,
onPageScroll,
onPageReachBottom,
@@ -6031,6 +14842,7 @@
windowTop,
windowBottom
}) {
+ initSystemInfo(platform, pixelRatio2, windowWidth);
initPageElement();
if (css) {
initPageCss(route);
@@ -6045,6 +14857,13 @@
initPageScroll(onPageScroll, onPageReachBottom, onReachBottomDistance);
}
}
+ function initSystemInfo(platform, pixelRatio2, windowWidth) {
+ window.__SYSTEM_INFO__ = {
+ platform,
+ pixelRatio: pixelRatio2,
+ windowWidth
+ };
+ }
function initPageElement() {
createElement(0, "div").$ = document.getElementById("app");
}
@@ -6129,7 +14948,291 @@
initSubscribeHandlers();
preventDoubleTap();
}
+ function validateProtocolFail(name, msg) {
+ console.warn(`${name}: ${msg}`);
+ }
+ function validateProtocol(name, data, protocol, onFail) {
+ if (!onFail) {
+ onFail = validateProtocolFail;
+ }
+ for (const key in protocol) {
+ const errMsg = validateProp(key, data[key], protocol[key], !hasOwn$1(data, key));
+ if (isString(errMsg)) {
+ onFail(name, errMsg);
+ }
+ }
+ }
+ function validateProtocols(name, args, protocol, onFail) {
+ if (!protocol) {
+ return;
+ }
+ if (!isArray(protocol)) {
+ return validateProtocol(name, args[0] || Object.create(null), protocol, onFail);
+ }
+ const len = protocol.length;
+ const argsLen = args.length;
+ for (let i = 0; i < len; i++) {
+ const opts = protocol[i];
+ const data = Object.create(null);
+ if (argsLen > i) {
+ data[opts.name] = args[i];
+ }
+ validateProtocol(name, data, { [opts.name]: opts }, onFail);
+ }
+ }
+ function validateProp(name, value, prop, isAbsent) {
+ if (!isPlainObject(prop)) {
+ prop = { type: prop };
+ }
+ const { type, required, validator } = prop;
+ if (required && isAbsent) {
+ return 'Missing required args: "' + name + '"';
+ }
+ if (value == null && !required) {
+ return;
+ }
+ if (type != null) {
+ let isValid = false;
+ const types = isArray(type) ? type : [type];
+ const expectedTypes = [];
+ for (let i = 0; i < types.length && !isValid; i++) {
+ const { valid, expectedType } = assertType(value, types[i]);
+ expectedTypes.push(expectedType || "");
+ isValid = valid;
+ }
+ if (!isValid) {
+ return getInvalidTypeMessage(name, value, expectedTypes);
+ }
+ }
+ if (validator) {
+ return validator(value);
+ }
+ }
+ const isSimpleType = /* @__PURE__ */ makeMap$1("String,Number,Boolean,Function,Symbol");
+ function assertType(value, type) {
+ let valid;
+ const expectedType = getType(type);
+ if (isSimpleType(expectedType)) {
+ const t2 = typeof value;
+ valid = t2 === expectedType.toLowerCase();
+ if (!valid && t2 === "object") {
+ valid = value instanceof type;
+ }
+ } else if (expectedType === "Object") {
+ valid = isObject$1(value);
+ } else if (expectedType === "Array") {
+ valid = isArray(value);
+ } else {
+ {
+ valid = value instanceof type || toRawType(value) === getType(type);
+ }
+ }
+ return {
+ valid,
+ expectedType
+ };
+ }
+ function getInvalidTypeMessage(name, value, expectedTypes) {
+ let message = `Invalid args: type check failed for args "${name}". Expected ${expectedTypes.map(capitalize).join(", ")}`;
+ const expectedType = expectedTypes[0];
+ const receivedType = toRawType(value);
+ const expectedValue = styleValue(value, expectedType);
+ const receivedValue = styleValue(value, receivedType);
+ if (expectedTypes.length === 1 && isExplicable(expectedType) && !isBoolean(expectedType, receivedType)) {
+ message += ` with value ${expectedValue}`;
+ }
+ message += `, got ${receivedType} `;
+ if (isExplicable(receivedType)) {
+ message += `with value ${receivedValue}.`;
+ }
+ return message;
+ }
+ function getType(ctor) {
+ const match = ctor && ctor.toString().match(/^\s*function (\w+)/);
+ return match ? match[1] : "";
+ }
+ function styleValue(value, type) {
+ if (type === "String") {
+ return `"${value}"`;
+ } else if (type === "Number") {
+ return `${Number(value)}`;
+ } else {
+ return `${value}`;
+ }
+ }
+ function isExplicable(type) {
+ const explicitTypes = ["string", "number", "boolean"];
+ return explicitTypes.some((elem) => type.toLowerCase() === elem);
+ }
+ function isBoolean(...args) {
+ return args.some((elem) => elem.toLowerCase() === "boolean");
+ }
+ function formatApiArgs(args, options) {
+ const params = args[0];
+ if (!options || !isPlainObject(options.formatArgs) && isPlainObject(params)) {
+ return;
+ }
+ const formatArgs = options.formatArgs;
+ const keys = Object.keys(formatArgs);
+ for (let i = 0; i < keys.length; i++) {
+ const name = keys[i];
+ const formatterOrDefaultValue = formatArgs[name];
+ if (isFunction(formatterOrDefaultValue)) {
+ const errMsg = formatterOrDefaultValue(args[0][name], params);
+ if (isString(errMsg)) {
+ return errMsg;
+ }
+ } else {
+ if (!hasOwn$1(params, name)) {
+ params[name] = formatterOrDefaultValue;
+ }
+ }
+ }
+ }
+ function beforeInvokeApi(name, args, protocol, options) {
+ {
+ validateProtocols(name, args, protocol);
+ }
+ if (options && options.beforeInvoke) {
+ const errMsg2 = options.beforeInvoke(args);
+ if (isString(errMsg2)) {
+ return errMsg2;
+ }
+ }
+ const errMsg = formatApiArgs(args, options);
+ if (errMsg) {
+ return errMsg;
+ }
+ }
+ function wrapperSyncApi(name, fn, protocol, options) {
+ return (...args) => {
+ const errMsg = beforeInvokeApi(name, args, protocol, options);
+ if (errMsg) {
+ throw new Error(errMsg);
+ }
+ return fn.apply(null, args);
+ };
+ }
+ function defineSyncApi(name, fn, protocol, options) {
+ return wrapperSyncApi(name, fn, protocol, options);
+ }
+ const API_UPX2PX = "upx2px";
+ const Upx2pxProtocol = [
+ {
+ name: "upx",
+ type: [Number, String],
+ required: true
+ }
+ ];
+ const EPS = 1e-4;
+ const BASE_DEVICE_WIDTH = 750;
+ let isIOS = false;
+ let deviceWidth = 0;
+ let deviceDPR = 0;
+ function checkDeviceWidth() {
+ const { platform, pixelRatio: pixelRatio2, windowWidth } = getBaseSystemInfo();
+ deviceWidth = windowWidth;
+ deviceDPR = pixelRatio2;
+ isIOS = platform === "ios";
+ }
+ function checkValue(value, defaultValue) {
+ const newValue = Number(value);
+ return isNaN(newValue) ? defaultValue : newValue;
+ }
+ const upx2px = /* @__PURE__ */ defineSyncApi(API_UPX2PX, (number, newDeviceWidth) => {
+ if (deviceWidth === 0) {
+ checkDeviceWidth();
+ }
+ number = Number(number);
+ if (number === 0) {
+ return 0;
+ }
+ let width = newDeviceWidth || deviceWidth;
+ {
+ const config = __uniConfig.globalStyle || {};
+ const maxWidth = checkValue(config.rpxCalcMaxDeviceWidth, 960);
+ const baseWidth = checkValue(config.rpxCalcBaseDeviceWidth, 375);
+ width = width <= maxWidth ? width : baseWidth;
+ }
+ let result = number / BASE_DEVICE_WIDTH * width;
+ if (result < 0) {
+ result = -result;
+ }
+ result = Math.floor(result + EPS);
+ if (result === 0) {
+ if (deviceDPR === 1 || !isIOS) {
+ result = 1;
+ } else {
+ result = 0.5;
+ }
+ }
+ return number < 0 ? -result : result;
+ }, Upx2pxProtocol);
+ createCallbacks("canvasEvent");
+ createCallbacks("getSelectedTextRangeEvent");
+ ({
+ beforeInvoke() {
+ initI18nShowModalMsgsOnce();
+ },
+ formatArgs: {
+ title: "",
+ content: "",
+ showCancel: true,
+ cancelText(_value, params) {
+ if (!hasOwn$1(params, "cancelText")) {
+ const { t: t2 } = useI18n();
+ params.cancelText = t2("uni.showModal.cancel");
+ }
+ },
+ cancelColor: "#000",
+ confirmText(_value, params) {
+ if (!hasOwn$1(params, "confirmText")) {
+ const { t: t2 } = useI18n();
+ params.confirmText = t2("uni.showModal.confirm");
+ }
+ },
+ confirmColor: PRIMARY_COLOR
+ }
+ });
+ function invokeApi(method, args = {}) {
+ UniViewJSBridge.publishHandler(INVOKE_API, {
+ data: {
+ method,
+ args
+ },
+ options: {
+ timestamp: Date.now()
+ }
+ });
+ }
+ function navigateTo(args) {
+ invokeApi("navigateTo", args);
+ }
+ function navigateBack(args) {
+ invokeApi("navigateBack", args);
+ }
+ function reLaunch(args) {
+ invokeApi("reLaunch", args);
+ }
+ function redirectTo(args) {
+ invokeApi("redirectTo", args);
+ }
+ function switchTab(args) {
+ invokeApi("switchTab", args);
+ }
+ var uni$1 = /* @__PURE__ */ Object.freeze({
+ __proto__: null,
+ [Symbol.toStringTag]: "Module",
+ upx2px,
+ navigateTo,
+ navigateBack,
+ reLaunch,
+ redirectTo,
+ switchTab
+ });
+ window.uni = uni$1;
window.UniViewJSBridge = UniViewJSBridge$1;
+ window.rpx2px = upx2px;
function onWebviewReady() {
initView();
UniViewJSBridge$1.publishHandler(ON_WEBVIEW_READY);
diff --git a/packages/uni-app-plus/src/PageAction.ts b/packages/uni-app-plus/src/PageAction.ts
index bab96b7f5ddf58ab329cfb0f625cbc4a22e5ae6f..355e819ed5376ab00feb5bacda009bf4c914970d 100644
--- a/packages/uni-app-plus/src/PageAction.ts
+++ b/packages/uni-app-plus/src/PageAction.ts
@@ -18,6 +18,9 @@ export interface PageNodeOptions {
route: string
version: number
locale: string
+ platform: string
+ pixelRatio: number
+ windowWidth: number
disableScroll: boolean
onPageScroll: boolean
onPageReachBottom: boolean
diff --git a/packages/uni-app-plus/src/constants.ts b/packages/uni-app-plus/src/constants.ts
index d4c524a5a9dfcb301c4462885ebee483dc4a709b..d7754b83ed116a20ff3740932b31e38d0f2e523c 100644
--- a/packages/uni-app-plus/src/constants.ts
+++ b/packages/uni-app-plus/src/constants.ts
@@ -1,2 +1,4 @@
export const VD_SYNC = 'vdSync'
export const ON_WEBVIEW_READY = 'onWebviewReady'
+
+export const INVOKE_API = 'invokeApi'
diff --git a/packages/uni-app-plus/src/platform/index.ts b/packages/uni-app-plus/src/platform/index.ts
index 99ead433572df29593e09bbcad5a7c55dad5a07c..6e3842c658d1182acb221baf2b48aa44ee5adc51 100644
--- a/packages/uni-app-plus/src/platform/index.ts
+++ b/packages/uni-app-plus/src/platform/index.ts
@@ -8,14 +8,7 @@ import {
SelectorQueryRequest,
} from '@dcloudio/uni-api'
-export function getBaseSystemInfo() {
- // TODO
- return {
- platform: '',
- pixelRatio: 1,
- windowWidth: 750,
- }
-}
+export { getBaseSystemInfo } from '../service/api/base/getBaseSystemInfo'
export { getRealPath } from './getRealPath'
export function operateVideoPlayer(
videoId: string,
diff --git a/packages/uni-app-plus/src/service/api/base/getBaseSystemInfo.ts b/packages/uni-app-plus/src/service/api/base/getBaseSystemInfo.ts
new file mode 100644
index 0000000000000000000000000000000000000000..8b74dc2ba49ad9e2a555a4c7e36afd8cd1d0483d
--- /dev/null
+++ b/packages/uni-app-plus/src/service/api/base/getBaseSystemInfo.ts
@@ -0,0 +1,16 @@
+/**
+ * 简易版systemInfo,主要为upx2px,i18n服务
+ * @returns
+ */
+export function getBaseSystemInfo() {
+ // @ts-expect-error view 层
+ if (typeof __SYSTEM_INFO__ !== 'undefined') {
+ return (window as any).__SYSTEM_INFO__
+ }
+ const { resolutionWidth } = plus.screen.getCurrentSize()
+ return {
+ platform: (plus.os.name || '').toLowerCase(),
+ pixelRatio: plus.screen.scale!,
+ windowWidth: Math.round(resolutionWidth),
+ }
+}
diff --git a/packages/uni-app-plus/src/service/framework/app/subscriber/index.ts b/packages/uni-app-plus/src/service/framework/app/subscriber/index.ts
index 7d79fae1c49d0d903e85433759f40960abbaa94f..49a86d7119f6c402b4080cbae8468155946d8549 100644
--- a/packages/uni-app-plus/src/service/framework/app/subscriber/index.ts
+++ b/packages/uni-app-plus/src/service/framework/app/subscriber/index.ts
@@ -1,4 +1,4 @@
-import { ON_WEBVIEW_READY, VD_SYNC } from '../../../../constants'
+import { INVOKE_API, ON_WEBVIEW_READY, VD_SYNC } from '../../../../constants'
import { onVdSync } from '../../dom'
import { onPlusMessage } from '../initGlobalEvent'
import { subscribeWebviewReady } from './webviewReady'
@@ -17,5 +17,14 @@ export function initSubscribeHandlers() {
// 非纯原生
subscribe(ON_WEBVIEW_READY, subscribeWebviewReady)
subscribe(VD_SYNC, onVdSync)
+ subscribe(INVOKE_API, onInvokeApi)
}
}
+
+function onInvokeApi({
+ data: { method, args },
+}: {
+ data: { method: UniApp.OpenType; args: any }
+}) {
+ uni[method] && uni[method](args)
+}
diff --git a/packages/uni-app-plus/src/service/framework/page/register.ts b/packages/uni-app-plus/src/service/framework/page/register.ts
index eccb729099fa560d6eb895a6a2cb09060a1a02ab..76e887ed55976f8142f9a8087d3933f065e2ca03 100644
--- a/packages/uni-app-plus/src/service/framework/page/register.ts
+++ b/packages/uni-app-plus/src/service/framework/page/register.ts
@@ -15,6 +15,7 @@ import { PageNodeOptions } from '../../../PageAction'
import { getStatusbarHeight } from '../../../helpers/statusBar'
import tabBar from '../app/tabBar'
import { addCurrentPage } from './getCurrentPages'
+import { getBaseSystemInfo } from '../../api/base/getBaseSystemInfo'
interface RegisterPageOptions {
url: string
@@ -89,11 +90,15 @@ export function registerPage({
function initPageOptions({ meta }: UniApp.UniRoute): PageNodeOptions {
const statusbarHeight = getStatusbarHeight()
+ const { platform, pixelRatio, windowWidth } = getBaseSystemInfo()
return {
css: true,
route: meta.route,
version: 1,
locale: '',
+ platform,
+ pixelRatio,
+ windowWidth,
disableScroll: meta.disableScroll === true,
onPageScroll: false,
onPageReachBottom: false,
diff --git a/packages/uni-app-plus/src/view/api/index.ts b/packages/uni-app-plus/src/view/api/index.ts
new file mode 100644
index 0000000000000000000000000000000000000000..5ce89d0a3a8e9fe381e3a329602d594abfe4fe2c
--- /dev/null
+++ b/packages/uni-app-plus/src/view/api/index.ts
@@ -0,0 +1,2 @@
+export { upx2px } from '@dcloudio/uni-api'
+export * from './route'
diff --git a/packages/uni-app-plus/src/view/api/route.ts b/packages/uni-app-plus/src/view/api/route.ts
new file mode 100644
index 0000000000000000000000000000000000000000..efade6ea3af24cb1d28ae17cbbbc0d24877f41dc
--- /dev/null
+++ b/packages/uni-app-plus/src/view/api/route.ts
@@ -0,0 +1,28 @@
+import { INVOKE_API } from '../../constants'
+
+function invokeApi(method: string, args: Record = {}) {
+ UniViewJSBridge.publishHandler(INVOKE_API, {
+ data: {
+ method,
+ args,
+ },
+ options: {
+ timestamp: Date.now(),
+ },
+ })
+}
+export function navigateTo(args: Record) {
+ invokeApi('navigateTo', args)
+}
+export function navigateBack(args: Record) {
+ invokeApi('navigateBack', args)
+}
+export function reLaunch(args: Record) {
+ invokeApi('reLaunch', args)
+}
+export function redirectTo(args: Record) {
+ invokeApi('redirectTo', args)
+}
+export function switchTab(args: Record) {
+ invokeApi('switchTab', args)
+}
diff --git a/packages/uni-app-plus/src/view/components/ad/index.tsx b/packages/uni-app-plus/src/view/components/ad/index.tsx
new file mode 100644
index 0000000000000000000000000000000000000000..a6813d0ccc5abf2f786e41fb64962f21410ccecd
--- /dev/null
+++ b/packages/uni-app-plus/src/view/components/ad/index.tsx
@@ -0,0 +1,5 @@
+import { defineBuiltInComponent } from '@dcloudio/uni-components'
+
+export default /*#__PURE__*/ defineBuiltInComponent({
+ name: 'Ad',
+})
diff --git a/packages/uni-app-plus/src/view/components/map/index.tsx b/packages/uni-app-plus/src/view/components/map/index.tsx
new file mode 100644
index 0000000000000000000000000000000000000000..dc3b998d88bce1d5e910a29bc65005a893c84414
--- /dev/null
+++ b/packages/uni-app-plus/src/view/components/map/index.tsx
@@ -0,0 +1,5 @@
+import { defineBuiltInComponent } from '@dcloudio/uni-components'
+
+export default /*#__PURE__*/ defineBuiltInComponent({
+ name: 'Map',
+})
diff --git a/packages/uni-app-plus/src/view/components/picker/index.tsx b/packages/uni-app-plus/src/view/components/picker/index.tsx
new file mode 100644
index 0000000000000000000000000000000000000000..62f2430b379288e9b18b4b76c0a5172f76127805
--- /dev/null
+++ b/packages/uni-app-plus/src/view/components/picker/index.tsx
@@ -0,0 +1,5 @@
+import { defineBuiltInComponent } from '@dcloudio/uni-components'
+
+export default /*#__PURE__*/ defineBuiltInComponent({
+ name: 'Picker',
+})
diff --git a/packages/uni-app-plus/src/view/components/web-view/index.tsx b/packages/uni-app-plus/src/view/components/web-view/index.tsx
new file mode 100644
index 0000000000000000000000000000000000000000..3494414445c89070e87818305f7e2473923f83b0
--- /dev/null
+++ b/packages/uni-app-plus/src/view/components/web-view/index.tsx
@@ -0,0 +1,5 @@
+import { defineBuiltInComponent } from '@dcloudio/uni-components'
+
+export default /*#__PURE__*/ defineBuiltInComponent({
+ name: 'WebView',
+})
diff --git a/packages/uni-app-plus/src/view/framework/dom/components/UniAd.ts b/packages/uni-app-plus/src/view/framework/dom/components/UniAd.ts
new file mode 100644
index 0000000000000000000000000000000000000000..a7b4167c52c9b23b2f081a9c60f7e5f206f35ff1
--- /dev/null
+++ b/packages/uni-app-plus/src/view/framework/dom/components/UniAd.ts
@@ -0,0 +1,9 @@
+import Ad from '../../../components/ad'
+
+import { UniComponent } from './UniComponent'
+
+export class UniAd extends UniComponent {
+ constructor(id: number) {
+ super(id, 'uni-ad', Ad)
+ }
+}
diff --git a/packages/uni-app-plus/src/view/framework/dom/components/UniAudio.ts b/packages/uni-app-plus/src/view/framework/dom/components/UniAudio.ts
new file mode 100644
index 0000000000000000000000000000000000000000..3002bad8605bea97fe4e4c36636e22550d703be2
--- /dev/null
+++ b/packages/uni-app-plus/src/view/framework/dom/components/UniAudio.ts
@@ -0,0 +1,10 @@
+import '@dcloudio/uni-components/style/audio.css'
+import { Audio } from '@dcloudio/uni-components'
+
+import { UniComponent } from './UniComponent'
+
+export class UniAudio extends UniComponent {
+ constructor(id: number) {
+ super(id, 'uni-audio', Audio)
+ }
+}
diff --git a/packages/uni-app-plus/src/view/framework/dom/components/UniCamera.ts b/packages/uni-app-plus/src/view/framework/dom/components/UniCamera.ts
new file mode 100644
index 0000000000000000000000000000000000000000..8495577ed9c20fd8ed65432ac3542aab76576505
--- /dev/null
+++ b/packages/uni-app-plus/src/view/framework/dom/components/UniCamera.ts
@@ -0,0 +1,7 @@
+import { UniNode } from '../elements/UniNode'
+
+export class UniCamera extends UniNode {
+ constructor(id: number) {
+ super(id, 'uni-camera')
+ }
+}
diff --git a/packages/uni-app-plus/src/view/framework/dom/components/UniCanvas.ts b/packages/uni-app-plus/src/view/framework/dom/components/UniCanvas.ts
new file mode 100644
index 0000000000000000000000000000000000000000..485eabd6b9a09c6b977472b52be4e3caf028b7fd
--- /dev/null
+++ b/packages/uni-app-plus/src/view/framework/dom/components/UniCanvas.ts
@@ -0,0 +1,10 @@
+import '@dcloudio/uni-components/style/canvas.css'
+import { Canvas } from '@dcloudio/uni-components'
+
+import { UniComponent } from './UniComponent'
+
+export class UniCanvas extends UniComponent {
+ constructor(id: number) {
+ super(id, 'uni-canvas', Canvas)
+ }
+}
diff --git a/packages/uni-app-plus/src/view/framework/dom/components/UniCheckbox.ts b/packages/uni-app-plus/src/view/framework/dom/components/UniCheckbox.ts
new file mode 100644
index 0000000000000000000000000000000000000000..5d759ae78bf28783683ec47f603b6a5847708d9c
--- /dev/null
+++ b/packages/uni-app-plus/src/view/framework/dom/components/UniCheckbox.ts
@@ -0,0 +1,10 @@
+import '@dcloudio/uni-components/style/checkbox.css'
+import { Checkbox } from '@dcloudio/uni-components'
+
+import { UniComponent } from './UniComponent'
+
+export class UniCheckbox extends UniComponent {
+ constructor(id: number) {
+ super(id, 'uni-checkbox', Checkbox)
+ }
+}
diff --git a/packages/uni-app-plus/src/view/framework/dom/components/UniCheckboxGroup.ts b/packages/uni-app-plus/src/view/framework/dom/components/UniCheckboxGroup.ts
new file mode 100644
index 0000000000000000000000000000000000000000..a5fcca9887e3e7ef72a6f7de6edc82af13aa48e9
--- /dev/null
+++ b/packages/uni-app-plus/src/view/framework/dom/components/UniCheckboxGroup.ts
@@ -0,0 +1,10 @@
+import '@dcloudio/uni-components/style/checkbox-group.css'
+import { CheckboxGroup } from '@dcloudio/uni-components'
+
+import { UniComponent } from './UniComponent'
+
+export class UniCheckboxGroup extends UniComponent {
+ constructor(id: number) {
+ super(id, 'uni-checkbox-group', CheckboxGroup)
+ }
+}
diff --git a/packages/uni-app-plus/src/view/framework/dom/components/UniCoverImage.ts b/packages/uni-app-plus/src/view/framework/dom/components/UniCoverImage.ts
new file mode 100644
index 0000000000000000000000000000000000000000..69ce183b19c82f169d8a9f3976c3cc57d9494e89
--- /dev/null
+++ b/packages/uni-app-plus/src/view/framework/dom/components/UniCoverImage.ts
@@ -0,0 +1,9 @@
+import CoverImage from '../../../components/cover-image'
+
+import { UniComponent } from './UniComponent'
+
+export class UniCoverImage extends UniComponent {
+ constructor(id: number) {
+ super(id, 'uni-cover-image', CoverImage)
+ }
+}
diff --git a/packages/uni-app-plus/src/view/framework/dom/components/UniCoverView.ts b/packages/uni-app-plus/src/view/framework/dom/components/UniCoverView.ts
new file mode 100644
index 0000000000000000000000000000000000000000..eb4eb6af2324dc21552b42ff6eeedf3f054350ba
--- /dev/null
+++ b/packages/uni-app-plus/src/view/framework/dom/components/UniCoverView.ts
@@ -0,0 +1,9 @@
+import CoverView from '../../../components/cover-view'
+
+import { UniComponent } from './UniComponent'
+
+export class UniCoverView extends UniComponent {
+ constructor(id: number) {
+ super(id, 'uni-cover-view', CoverView)
+ }
+}
diff --git a/packages/uni-app-plus/src/view/framework/dom/components/UniEditor.ts b/packages/uni-app-plus/src/view/framework/dom/components/UniEditor.ts
new file mode 100644
index 0000000000000000000000000000000000000000..5bdbbe4b30a7d9787f8390f65acf3a6f1254a87c
--- /dev/null
+++ b/packages/uni-app-plus/src/view/framework/dom/components/UniEditor.ts
@@ -0,0 +1,10 @@
+import '@dcloudio/uni-components/style/editor.css'
+import { Editor } from '@dcloudio/uni-components'
+
+import { UniComponent } from './UniComponent'
+
+export class UniEditor extends UniComponent {
+ constructor(id: number) {
+ super(id, 'uni-editor', Editor)
+ }
+}
diff --git a/packages/uni-app-plus/src/view/framework/dom/components/UniForm.ts b/packages/uni-app-plus/src/view/framework/dom/components/UniForm.ts
new file mode 100644
index 0000000000000000000000000000000000000000..7e46ba6dee8fc4df3e712dc7e41b95d2b41f6302
--- /dev/null
+++ b/packages/uni-app-plus/src/view/framework/dom/components/UniForm.ts
@@ -0,0 +1,10 @@
+import '@dcloudio/uni-components/style/form.css'
+import { Form } from '@dcloudio/uni-components'
+
+import { UniComponent } from './UniComponent'
+
+export class UniForm extends UniComponent {
+ constructor(id: number) {
+ super(id, 'uni-form', Form)
+ }
+}
diff --git a/packages/uni-app-plus/src/view/framework/dom/components/UniFunctionalPageNavigator.ts b/packages/uni-app-plus/src/view/framework/dom/components/UniFunctionalPageNavigator.ts
new file mode 100644
index 0000000000000000000000000000000000000000..759c1fe294c679ff7a9f628d6d0a1a58a4e96a89
--- /dev/null
+++ b/packages/uni-app-plus/src/view/framework/dom/components/UniFunctionalPageNavigator.ts
@@ -0,0 +1,7 @@
+import { UniNode } from '../elements/UniNode'
+
+export class UniFunctionalPageNavigator extends UniNode {
+ constructor(id: number) {
+ super(id, 'uni-functional-page-navigator')
+ }
+}
diff --git a/packages/uni-app-plus/src/view/framework/dom/components/UniIcon.ts b/packages/uni-app-plus/src/view/framework/dom/components/UniIcon.ts
new file mode 100644
index 0000000000000000000000000000000000000000..1f3d3b9ad43f2403726deba9fa0cf0c94275b0fa
--- /dev/null
+++ b/packages/uni-app-plus/src/view/framework/dom/components/UniIcon.ts
@@ -0,0 +1,10 @@
+import '@dcloudio/uni-components/style/icon.css'
+import { Icon } from '@dcloudio/uni-components'
+
+import { UniComponent } from './UniComponent'
+
+export class UniIcon extends UniComponent {
+ constructor(id: number) {
+ super(id, 'uni-icon', Icon)
+ }
+}
diff --git a/packages/uni-app-plus/src/view/framework/dom/components/UniImage.ts b/packages/uni-app-plus/src/view/framework/dom/components/UniImage.ts
new file mode 100644
index 0000000000000000000000000000000000000000..1b165805497eb365ba4e14e5ef2d3ee03775a84c
--- /dev/null
+++ b/packages/uni-app-plus/src/view/framework/dom/components/UniImage.ts
@@ -0,0 +1,10 @@
+import '@dcloudio/uni-components/style/image.css'
+import { Image } from '@dcloudio/uni-components'
+
+import { UniComponent } from './UniComponent'
+
+export class UniImage extends UniComponent {
+ constructor(id: number) {
+ super(id, 'uni-image', Image)
+ }
+}
diff --git a/packages/uni-app-plus/src/view/framework/dom/components/UniInput.ts b/packages/uni-app-plus/src/view/framework/dom/components/UniInput.ts
new file mode 100644
index 0000000000000000000000000000000000000000..0d20afdc2a1c7b57f0498b5ff34be69cb6f20cfc
--- /dev/null
+++ b/packages/uni-app-plus/src/view/framework/dom/components/UniInput.ts
@@ -0,0 +1,10 @@
+import '@dcloudio/uni-components/style/input.css'
+import { Input } from '@dcloudio/uni-components'
+
+import { UniComponent } from './UniComponent'
+
+export class UniInput extends UniComponent {
+ constructor(id: number) {
+ super(id, 'uni-input', Input)
+ }
+}
diff --git a/packages/uni-app-plus/src/view/framework/dom/components/UniLabel.ts b/packages/uni-app-plus/src/view/framework/dom/components/UniLabel.ts
new file mode 100644
index 0000000000000000000000000000000000000000..dffddb89faf4f8a2bbeb91cfe17ff5c4a376ae9b
--- /dev/null
+++ b/packages/uni-app-plus/src/view/framework/dom/components/UniLabel.ts
@@ -0,0 +1,10 @@
+import '@dcloudio/uni-components/style/label.css'
+import { Label } from '@dcloudio/uni-components'
+
+import { UniComponent } from './UniComponent'
+
+export class UniLabel extends UniComponent {
+ constructor(id: number) {
+ super(id, 'uni-label', Label)
+ }
+}
diff --git a/packages/uni-app-plus/src/view/framework/dom/components/UniLivePlayer.ts b/packages/uni-app-plus/src/view/framework/dom/components/UniLivePlayer.ts
new file mode 100644
index 0000000000000000000000000000000000000000..0ff9170ad3566643d3da439becae7fef6a99f0f5
--- /dev/null
+++ b/packages/uni-app-plus/src/view/framework/dom/components/UniLivePlayer.ts
@@ -0,0 +1,7 @@
+import { UniNode } from '../elements/UniNode'
+
+export class UniLivePlayer extends UniNode {
+ constructor(id: number) {
+ super(id, 'uni-live-player')
+ }
+}
diff --git a/packages/uni-app-plus/src/view/framework/dom/components/UniLivePusher.ts b/packages/uni-app-plus/src/view/framework/dom/components/UniLivePusher.ts
new file mode 100644
index 0000000000000000000000000000000000000000..3ce395dfd503b2b945f784e98ff9a5a164af3942
--- /dev/null
+++ b/packages/uni-app-plus/src/view/framework/dom/components/UniLivePusher.ts
@@ -0,0 +1,7 @@
+import { UniNode } from '../elements/UniNode'
+
+export class UniLivePusher extends UniNode {
+ constructor(id: number) {
+ super(id, 'uni-live-pusher')
+ }
+}
diff --git a/packages/uni-app-plus/src/view/framework/dom/components/UniMap.ts b/packages/uni-app-plus/src/view/framework/dom/components/UniMap.ts
new file mode 100644
index 0000000000000000000000000000000000000000..4d4fa478917f4768883b94742e2f21ab036703cf
--- /dev/null
+++ b/packages/uni-app-plus/src/view/framework/dom/components/UniMap.ts
@@ -0,0 +1,9 @@
+import Map from '../../../components/map'
+
+import { UniComponent } from './UniComponent'
+
+export class UniMap extends UniComponent {
+ constructor(id: number) {
+ super(id, 'uni-map', Map)
+ }
+}
diff --git a/packages/uni-app-plus/src/view/framework/dom/components/UniMovableArea.ts b/packages/uni-app-plus/src/view/framework/dom/components/UniMovableArea.ts
new file mode 100644
index 0000000000000000000000000000000000000000..3fb8d46cc17a571bd433d55831b210ec13322cc7
--- /dev/null
+++ b/packages/uni-app-plus/src/view/framework/dom/components/UniMovableArea.ts
@@ -0,0 +1,10 @@
+import '@dcloudio/uni-components/style/movable-area.css'
+import { MovableArea } from '@dcloudio/uni-components'
+
+import { UniComponent } from './UniComponent'
+
+export class UniMovableArea extends UniComponent {
+ constructor(id: number) {
+ super(id, 'uni-movable-area', MovableArea)
+ }
+}
diff --git a/packages/uni-app-plus/src/view/framework/dom/components/UniMovableView.ts b/packages/uni-app-plus/src/view/framework/dom/components/UniMovableView.ts
new file mode 100644
index 0000000000000000000000000000000000000000..922aec15bcb3ec988e8376a28826ee80b7f176c3
--- /dev/null
+++ b/packages/uni-app-plus/src/view/framework/dom/components/UniMovableView.ts
@@ -0,0 +1,10 @@
+import '@dcloudio/uni-components/style/movable-view.css'
+import { MovableView } from '@dcloudio/uni-components'
+
+import { UniComponent } from './UniComponent'
+
+export class UniMovableView extends UniComponent {
+ constructor(id: number) {
+ super(id, 'uni-movable-view', MovableView)
+ }
+}
diff --git a/packages/uni-app-plus/src/view/framework/dom/components/UniNavigator.ts b/packages/uni-app-plus/src/view/framework/dom/components/UniNavigator.ts
new file mode 100644
index 0000000000000000000000000000000000000000..366bdea1414596692c705139001e51c5d840083d
--- /dev/null
+++ b/packages/uni-app-plus/src/view/framework/dom/components/UniNavigator.ts
@@ -0,0 +1,10 @@
+import '@dcloudio/uni-components/style/navigator.css'
+import { Navigator } from '@dcloudio/uni-components'
+
+import { UniComponent } from './UniComponent'
+
+export class UniNavigator extends UniComponent {
+ constructor(id: number) {
+ super(id, 'uni-navigator', Navigator)
+ }
+}
diff --git a/packages/uni-app-plus/src/view/framework/dom/components/UniOfficialAccount.ts b/packages/uni-app-plus/src/view/framework/dom/components/UniOfficialAccount.ts
new file mode 100644
index 0000000000000000000000000000000000000000..29772ea697ff53283d2d44337ece267db7c797bb
--- /dev/null
+++ b/packages/uni-app-plus/src/view/framework/dom/components/UniOfficialAccount.ts
@@ -0,0 +1,7 @@
+import { UniNode } from '../elements/UniNode'
+
+export class UniOfficialAccount extends UniNode {
+ constructor(id: number) {
+ super(id, 'uni-official-account')
+ }
+}
diff --git a/packages/uni-app-plus/src/view/framework/dom/components/UniOpenData.ts b/packages/uni-app-plus/src/view/framework/dom/components/UniOpenData.ts
new file mode 100644
index 0000000000000000000000000000000000000000..e59d359333dbdab950ba3d43324923e969e0422b
--- /dev/null
+++ b/packages/uni-app-plus/src/view/framework/dom/components/UniOpenData.ts
@@ -0,0 +1,7 @@
+import { UniNode } from '../elements/UniNode'
+
+export class UniOpenData extends UniNode {
+ constructor(id: number) {
+ super(id, 'uni-open-data')
+ }
+}
diff --git a/packages/uni-app-plus/src/view/framework/dom/components/UniPicker.ts b/packages/uni-app-plus/src/view/framework/dom/components/UniPicker.ts
new file mode 100644
index 0000000000000000000000000000000000000000..2368ec89acd9f07f26bcb838b911e2110a2197ff
--- /dev/null
+++ b/packages/uni-app-plus/src/view/framework/dom/components/UniPicker.ts
@@ -0,0 +1,9 @@
+import Picker from '../../../components/picker'
+
+import { UniComponent } from './UniComponent'
+
+export class UniPicker extends UniComponent {
+ constructor(id: number) {
+ super(id, 'uni-picker', Picker)
+ }
+}
diff --git a/packages/uni-app-plus/src/view/framework/dom/components/UniPickerView.ts b/packages/uni-app-plus/src/view/framework/dom/components/UniPickerView.ts
new file mode 100644
index 0000000000000000000000000000000000000000..3d96511148860de11c61d296e4e5b994b22589ef
--- /dev/null
+++ b/packages/uni-app-plus/src/view/framework/dom/components/UniPickerView.ts
@@ -0,0 +1,10 @@
+import '@dcloudio/uni-components/style/picker-view.css'
+import { PickerView } from '@dcloudio/uni-components'
+
+import { UniComponent } from './UniComponent'
+
+export class UniPickerView extends UniComponent {
+ constructor(id: number) {
+ super(id, 'uni-picker-view', PickerView)
+ }
+}
diff --git a/packages/uni-app-plus/src/view/framework/dom/components/UniPickerViewColumn.ts b/packages/uni-app-plus/src/view/framework/dom/components/UniPickerViewColumn.ts
new file mode 100644
index 0000000000000000000000000000000000000000..596ffe1b45b29544068dc882432c8793fba82ae1
--- /dev/null
+++ b/packages/uni-app-plus/src/view/framework/dom/components/UniPickerViewColumn.ts
@@ -0,0 +1,10 @@
+import '@dcloudio/uni-components/style/picker-view-column.css'
+import { PickerViewColumn } from '@dcloudio/uni-components'
+
+import { UniComponent } from './UniComponent'
+
+export class UniPickerViewColumn extends UniComponent {
+ constructor(id: number) {
+ super(id, 'uni-picker-view-column', PickerViewColumn)
+ }
+}
diff --git a/packages/uni-app-plus/src/view/framework/dom/components/UniProgress.ts b/packages/uni-app-plus/src/view/framework/dom/components/UniProgress.ts
new file mode 100644
index 0000000000000000000000000000000000000000..cad720d2dfca15e3422fd09ec126cf2b04c1e84f
--- /dev/null
+++ b/packages/uni-app-plus/src/view/framework/dom/components/UniProgress.ts
@@ -0,0 +1,10 @@
+import '@dcloudio/uni-components/style/progress.css'
+import { Progress } from '@dcloudio/uni-components'
+
+import { UniComponent } from './UniComponent'
+
+export class UniProgress extends UniComponent {
+ constructor(id: number) {
+ super(id, 'uni-progress', Progress)
+ }
+}
diff --git a/packages/uni-app-plus/src/view/framework/dom/components/UniRadio.ts b/packages/uni-app-plus/src/view/framework/dom/components/UniRadio.ts
new file mode 100644
index 0000000000000000000000000000000000000000..a731ae716c1ddbde8adc132d4dad3272f57ab829
--- /dev/null
+++ b/packages/uni-app-plus/src/view/framework/dom/components/UniRadio.ts
@@ -0,0 +1,10 @@
+import '@dcloudio/uni-components/style/radio.css'
+import { Radio } from '@dcloudio/uni-components'
+
+import { UniComponent } from './UniComponent'
+
+export class UniRadio extends UniComponent {
+ constructor(id: number) {
+ super(id, 'uni-radio', Radio)
+ }
+}
diff --git a/packages/uni-app-plus/src/view/framework/dom/components/UniRadioGroup.ts b/packages/uni-app-plus/src/view/framework/dom/components/UniRadioGroup.ts
new file mode 100644
index 0000000000000000000000000000000000000000..3f1c250d6e00e5e2bb22d4fd43b7c3c1be035a5e
--- /dev/null
+++ b/packages/uni-app-plus/src/view/framework/dom/components/UniRadioGroup.ts
@@ -0,0 +1,10 @@
+import '@dcloudio/uni-components/style/radio-group.css'
+import { RadioGroup } from '@dcloudio/uni-components'
+
+import { UniComponent } from './UniComponent'
+
+export class UniRadioGroup extends UniComponent {
+ constructor(id: number) {
+ super(id, 'uni-radio-group', RadioGroup)
+ }
+}
diff --git a/packages/uni-app-plus/src/view/framework/dom/components/UniRichText.ts b/packages/uni-app-plus/src/view/framework/dom/components/UniRichText.ts
new file mode 100644
index 0000000000000000000000000000000000000000..57db97c595ea808199b7c035f3f402779ccf308c
--- /dev/null
+++ b/packages/uni-app-plus/src/view/framework/dom/components/UniRichText.ts
@@ -0,0 +1,10 @@
+import '@dcloudio/uni-components/style/rich-text.css'
+import { RichText } from '@dcloudio/uni-components'
+
+import { UniComponent } from './UniComponent'
+
+export class UniRichText extends UniComponent {
+ constructor(id: number) {
+ super(id, 'uni-rich-text', RichText)
+ }
+}
diff --git a/packages/uni-app-plus/src/view/framework/dom/components/UniScrollView.ts b/packages/uni-app-plus/src/view/framework/dom/components/UniScrollView.ts
new file mode 100644
index 0000000000000000000000000000000000000000..ba8fd3d4d6ba950ccef254b0576c5fbb1e66e5bc
--- /dev/null
+++ b/packages/uni-app-plus/src/view/framework/dom/components/UniScrollView.ts
@@ -0,0 +1,10 @@
+import '@dcloudio/uni-components/style/scroll-view.css'
+import { ScrollView } from '@dcloudio/uni-components'
+
+import { UniComponent } from './UniComponent'
+
+export class UniScrollView extends UniComponent {
+ constructor(id: number) {
+ super(id, 'uni-scroll-view', ScrollView)
+ }
+}
diff --git a/packages/uni-app-plus/src/view/framework/dom/components/UniSlider.ts b/packages/uni-app-plus/src/view/framework/dom/components/UniSlider.ts
new file mode 100644
index 0000000000000000000000000000000000000000..fb50292dc1ebd08734cf756aeab9eb3ad4e4822c
--- /dev/null
+++ b/packages/uni-app-plus/src/view/framework/dom/components/UniSlider.ts
@@ -0,0 +1,10 @@
+import '@dcloudio/uni-components/style/slider.css'
+import { Slider } from '@dcloudio/uni-components'
+
+import { UniComponent } from './UniComponent'
+
+export class UniSlider extends UniComponent {
+ constructor(id: number) {
+ super(id, 'uni-slider', Slider)
+ }
+}
diff --git a/packages/uni-app-plus/src/view/framework/dom/components/UniSwiper.ts b/packages/uni-app-plus/src/view/framework/dom/components/UniSwiper.ts
new file mode 100644
index 0000000000000000000000000000000000000000..8a0a3259d06933ab10083677f282dc76f5da32f3
--- /dev/null
+++ b/packages/uni-app-plus/src/view/framework/dom/components/UniSwiper.ts
@@ -0,0 +1,10 @@
+import '@dcloudio/uni-components/style/swiper.css'
+import { Swiper } from '@dcloudio/uni-components'
+
+import { UniComponent } from './UniComponent'
+
+export class UniSwiper extends UniComponent {
+ constructor(id: number) {
+ super(id, 'uni-swiper', Swiper)
+ }
+}
diff --git a/packages/uni-app-plus/src/view/framework/dom/components/UniSwiperItem.ts b/packages/uni-app-plus/src/view/framework/dom/components/UniSwiperItem.ts
new file mode 100644
index 0000000000000000000000000000000000000000..2a75495ba4991285c3215d765c1944581238d639
--- /dev/null
+++ b/packages/uni-app-plus/src/view/framework/dom/components/UniSwiperItem.ts
@@ -0,0 +1,10 @@
+import '@dcloudio/uni-components/style/swiper-item.css'
+import { SwiperItem } from '@dcloudio/uni-components'
+
+import { UniComponent } from './UniComponent'
+
+export class UniSwiperItem extends UniComponent {
+ constructor(id: number) {
+ super(id, 'uni-swiper-item', SwiperItem)
+ }
+}
diff --git a/packages/uni-app-plus/src/view/framework/dom/components/UniSwitch.ts b/packages/uni-app-plus/src/view/framework/dom/components/UniSwitch.ts
new file mode 100644
index 0000000000000000000000000000000000000000..deadc839720af175030fec3b5e43871abca24711
--- /dev/null
+++ b/packages/uni-app-plus/src/view/framework/dom/components/UniSwitch.ts
@@ -0,0 +1,10 @@
+import '@dcloudio/uni-components/style/switch.css'
+import { Switch } from '@dcloudio/uni-components'
+
+import { UniComponent } from './UniComponent'
+
+export class UniSwitch extends UniComponent {
+ constructor(id: number) {
+ super(id, 'uni-switch', Switch)
+ }
+}
diff --git a/packages/uni-app-plus/src/view/framework/dom/components/UniText.ts b/packages/uni-app-plus/src/view/framework/dom/components/UniText.ts
new file mode 100644
index 0000000000000000000000000000000000000000..6edeb42974ef1aaef7c0eaef110fc249ac58ca85
--- /dev/null
+++ b/packages/uni-app-plus/src/view/framework/dom/components/UniText.ts
@@ -0,0 +1,10 @@
+import '@dcloudio/uni-components/style/text.css'
+import { Text } from '@dcloudio/uni-components'
+
+import { UniComponent } from './UniComponent'
+
+export class UniText extends UniComponent {
+ constructor(id: number) {
+ super(id, 'uni-text', Text)
+ }
+}
diff --git a/packages/uni-app-plus/src/view/framework/dom/components/UniTextarea.ts b/packages/uni-app-plus/src/view/framework/dom/components/UniTextarea.ts
new file mode 100644
index 0000000000000000000000000000000000000000..7e4c8dddcf2a6ec1dfb3bc9f59830aa9a3ade31b
--- /dev/null
+++ b/packages/uni-app-plus/src/view/framework/dom/components/UniTextarea.ts
@@ -0,0 +1,10 @@
+import '@dcloudio/uni-components/style/textarea.css'
+import { Textarea } from '@dcloudio/uni-components'
+
+import { UniComponent } from './UniComponent'
+
+export class UniTextarea extends UniComponent {
+ constructor(id: number) {
+ super(id, 'uni-textarea', Textarea)
+ }
+}
diff --git a/packages/uni-app-plus/src/view/framework/dom/components/UniVideo.ts b/packages/uni-app-plus/src/view/framework/dom/components/UniVideo.ts
new file mode 100644
index 0000000000000000000000000000000000000000..841cbcbbfa1906ea96c6d7ad23c0f0ff0185cbef
--- /dev/null
+++ b/packages/uni-app-plus/src/view/framework/dom/components/UniVideo.ts
@@ -0,0 +1,10 @@
+import '../../../../../style/video.css'
+import Video from '../../../components/video'
+
+import { UniComponent } from './UniComponent'
+
+export class UniVideo extends UniComponent {
+ constructor(id: number) {
+ super(id, 'uni-video', Video)
+ }
+}
diff --git a/packages/uni-app-plus/src/view/framework/dom/components/UniWebView.ts b/packages/uni-app-plus/src/view/framework/dom/components/UniWebView.ts
new file mode 100644
index 0000000000000000000000000000000000000000..4fda2fd9bf3d89f0e32cc453e9313575ca8252c5
--- /dev/null
+++ b/packages/uni-app-plus/src/view/framework/dom/components/UniWebView.ts
@@ -0,0 +1,9 @@
+import WebView from '../../../components/web-view'
+
+import { UniComponent } from './UniComponent'
+
+export class UniWebView extends UniComponent {
+ constructor(id: number) {
+ super(id, 'uni-web-view', WebView)
+ }
+}
diff --git a/packages/uni-app-plus/src/view/framework/dom/components/index.ts b/packages/uni-app-plus/src/view/framework/dom/components/index.ts
index 2b766dcea68212c91303214a1422a7ac9719a944..5c8e47de7ba886046687db114e9f2cfa5852facd 100644
--- a/packages/uni-app-plus/src/view/framework/dom/components/index.ts
+++ b/packages/uni-app-plus/src/view/framework/dom/components/index.ts
@@ -1,8 +1,47 @@
import { defineComponent, h } from 'vue'
import { UniComment } from '../elements/UniComment'
-import { UniText } from '../elements/UniText'
+import { UniTextNode } from '../elements/UniTextNode'
import { UniViewElement } from '../elements/UniViewElement'
+import { UniAd } from './UniAd'
+import { UniAudio } from './UniAudio'
import { UniButton } from './UniButton'
+import { UniCamera } from './UniCamera'
+import { UniCanvas } from './UniCanvas'
+import { UniCheckbox } from './UniCheckbox'
+import { UniCheckboxGroup } from './UniCheckboxGroup'
+import { UniCoverImage } from './UniCoverImage'
+import { UniCoverView } from './UniCoverView'
+import { UniEditor } from './UniEditor'
+import { UniForm } from './UniForm'
+import { UniFunctionalPageNavigator } from './UniFunctionalPageNavigator'
+import { UniIcon } from './UniIcon'
+import { UniImage } from './UniImage'
+import { UniInput } from './UniInput'
+import { UniLabel } from './UniLabel'
+import { UniLivePlayer } from './UniLivePlayer'
+import { UniLivePusher } from './UniLivePusher'
+import { UniMap } from './UniMap'
+import { UniMovableArea } from './UniMovableArea'
+import { UniMovableView } from './UniMovableView'
+import { UniNavigator } from './UniNavigator'
+import { UniOfficialAccount } from './UniOfficialAccount'
+import { UniOpenData } from './UniOpenData'
+import { UniPicker } from './UniPicker'
+import { UniPickerView } from './UniPickerView'
+import { UniPickerViewColumn } from './UniPickerViewColumn'
+import { UniProgress } from './UniProgress'
+import { UniRadio } from './UniRadio'
+import { UniRadioGroup } from './UniRadioGroup'
+import { UniRichText } from './UniRichText'
+import { UniScrollView } from './UniScrollView'
+import { UniSlider } from './UniSlider'
+import { UniSwiper } from './UniSwiper'
+import { UniSwiperItem } from './UniSwiperItem'
+import { UniSwitch } from './UniSwitch'
+import { UniText } from './UniText'
+import { UniTextarea } from './UniTextarea'
+import { UniVideo } from './UniVideo'
+import { UniWebView } from './UniWebView'
export interface UniCustomElement extends Element {
__id: number
@@ -12,13 +51,48 @@ export interface UniCustomElement extends Element {
const BuiltInComponents = [
,
UniViewElement,
- ,
- ,
+ UniImage,
UniText,
+ UniTextNode,
UniComment,
- ,
- ,
+ UniNavigator,
+ UniForm,
UniButton,
+ UniInput,
+ UniLabel,
+ UniRadio,
+ UniCheckbox,
+ UniCheckboxGroup,
+ UniAd,
+ UniAudio,
+ UniCamera,
+ UniCanvas,
+ UniCoverImage,
+ UniCoverView,
+ UniEditor,
+ UniFunctionalPageNavigator,
+ UniIcon,
+ UniRadioGroup,
+ UniLivePlayer,
+ UniLivePusher,
+ UniMap,
+ UniMovableArea,
+ UniMovableView,
+ UniOfficialAccount,
+ UniOpenData,
+ UniPicker,
+ UniPickerView,
+ UniPickerViewColumn,
+ UniProgress,
+ UniRichText,
+ UniScrollView,
+ UniSlider,
+ UniSwiper,
+ UniSwiperItem,
+ UniSwitch,
+ UniTextarea,
+ UniVideo,
+ UniWebView,
]
export type WrapperComponent = ReturnType
diff --git a/packages/uni-app-plus/src/view/framework/dom/elements/UniText.ts b/packages/uni-app-plus/src/view/framework/dom/elements/UniTextNode.ts
similarity index 75%
rename from packages/uni-app-plus/src/view/framework/dom/elements/UniText.ts
rename to packages/uni-app-plus/src/view/framework/dom/elements/UniTextNode.ts
index 04b14142802416f07cfac2035253a1ba76c90623..925254c69c1814f8924993abf162c2c704c40540 100644
--- a/packages/uni-app-plus/src/view/framework/dom/elements/UniText.ts
+++ b/packages/uni-app-plus/src/view/framework/dom/elements/UniTextNode.ts
@@ -1,6 +1,6 @@
import { UniNode } from './UniNode'
-export class UniText extends UniNode {
+export class UniTextNode extends UniNode {
constructor(id: number) {
super(id, '#text')
this.$ = document.createTextNode('')
diff --git a/packages/uni-app-plus/src/view/framework/dom/modules/style.ts b/packages/uni-app-plus/src/view/framework/dom/modules/style.ts
index 12782d2961ec4bda238c79d06eac6b791fd3b146..f4294036ad08d31057da6510badd64e9e0dcbb6b 100644
--- a/packages/uni-app-plus/src/view/framework/dom/modules/style.ts
+++ b/packages/uni-app-plus/src/view/framework/dom/modules/style.ts
@@ -1,3 +1,4 @@
+import { rpx2px } from '@dcloudio/uni-core'
import { camelize, capitalize, hyphenate, isArray, isString } from '@vue/shared'
export function patchStyle(el: Element, value: string | Record) {
@@ -7,7 +8,7 @@ export function patchStyle(el: Element, value: string | Record) {
el.removeAttribute('style')
} else {
// TODO display
- style.cssText = value
+ style.cssText = rpx2px(value, true)
}
} else {
for (const key in value) {
@@ -26,6 +27,7 @@ function setStyle(
if (isArray(val)) {
val.forEach((v) => setStyle(style, name, v))
} else {
+ val = rpx2px(val, true)
if (name.startsWith('--')) {
// custom property definition
style.setProperty(name, val)
diff --git a/packages/uni-app-plus/src/view/framework/dom/page.ts b/packages/uni-app-plus/src/view/framework/dom/page.ts
index eefe61992a8f792a50a681b521ee9bc6dca10878..854e4655e6d76bcd7aa68086a9c9f309ab0df3f0 100644
--- a/packages/uni-app-plus/src/view/framework/dom/page.ts
+++ b/packages/uni-app-plus/src/view/framework/dom/page.ts
@@ -35,6 +35,9 @@ export function onPageCreated() {}
export function onPageCreate({
css,
route,
+ platform,
+ pixelRatio,
+ windowWidth,
disableScroll,
onPageScroll,
onPageReachBottom,
@@ -43,6 +46,7 @@ export function onPageCreate({
windowTop,
windowBottom,
}: PageCreateData) {
+ initSystemInfo(platform, pixelRatio, windowWidth)
// 初始化页面容器元素
initPageElement()
@@ -63,6 +67,18 @@ export function onPageCreate({
}
}
+function initSystemInfo(
+ platform: string,
+ pixelRatio: number,
+ windowWidth: number
+) {
+ ;(window as any).__SYSTEM_INFO__ = {
+ platform,
+ pixelRatio,
+ windowWidth,
+ }
+}
+
function initPageElement() {
createElement(0, 'div').$ = document.getElementById('app')!
}
diff --git a/packages/uni-app-plus/src/view/index.ts b/packages/uni-app-plus/src/view/index.ts
index 033c3f13126ca66224de6eaa5046f48c6f2438cb..04a075199a5f977a83f9952816d4357dfbea7abf 100644
--- a/packages/uni-app-plus/src/view/index.ts
+++ b/packages/uni-app-plus/src/view/index.ts
@@ -4,7 +4,10 @@ import '@dcloudio/uni-h5/style/framework/nvue.css'
import { ON_WEBVIEW_READY } from '../constants'
import { UniViewJSBridge } from './bridge'
import { initView } from './framework'
+import * as uni from './api'
+;(window as any).uni = uni
;(window as any).UniViewJSBridge = UniViewJSBridge
+;(window as any).rpx2px = uni.upx2px
function onWebviewReady() {
initView()
diff --git a/packages/uni-app-vite/dist/plugins/copy.js b/packages/uni-app-vite/dist/plugins/copy.js
index 2d8a1185418a00dc32435a76811f7edbf162f8ff..0ace6720704946e589690e6fb04314304486c873 100644
--- a/packages/uni-app-vite/dist/plugins/copy.js
+++ b/packages/uni-app-vite/dist/plugins/copy.js
@@ -11,9 +11,30 @@ function uniCopyPlugin() {
return uni_cli_shared_1.uniViteCopyPlugin({
targets: [
{
- src: slash_1.default(path_1.default.resolve(__dirname, '../../lib/template/*')),
+ src: slash_1.default(path_1.default.resolve(__dirname, '../../lib/template/*.js')),
dest: process.env.UNI_OUTPUT_DIR,
},
+ {
+ src: slash_1.default(path_1.default.resolve(__dirname, '../../lib/template/*.png')),
+ dest: process.env.UNI_OUTPUT_DIR,
+ },
+ {
+ src: slash_1.default(path_1.default.resolve(__dirname, '../../lib/template/__uniappview.html')),
+ dest: process.env.UNI_OUTPUT_DIR,
+ transform(content) {
+ const { globalStyle } = uni_cli_shared_1.parsePagesJsonOnce(process.env.UNI_INPUT_DIR, process.env.UNI_PLATFORM);
+ const __uniConfig = {
+ globalStyle: {
+ rpxCalcMaxDeviceWidth: globalStyle.rpxCalcMaxDeviceWidth,
+ rpxCalcBaseDeviceWidth: globalStyle
+ .rpxCalcBaseDeviceWidth,
+ },
+ };
+ return content
+ .toString()
+ .replace('/*__uniConfig*/', `var __uniConfig = ${JSON.stringify(__uniConfig)}`);
+ },
+ },
{
src: slash_1.default(require.resolve('@dcloudio/uni-app-plus/dist/uni-app-view.umd.js')),
dest: process.env.UNI_OUTPUT_DIR,
diff --git a/packages/uni-app-vite/lib/template/__uniappview.html b/packages/uni-app-vite/lib/template/__uniappview.html
index 77221d6c45d42cd050696ce794f45df2d85e10b9..78f2192ab811ec3a25e347fc888211e14d0f50b2 100644
--- a/packages/uni-app-vite/lib/template/__uniappview.html
+++ b/packages/uni-app-vite/lib/template/__uniappview.html
@@ -5,6 +5,7 @@
View
+
diff --git a/packages/uni-app-vite/src/plugins/copy.ts b/packages/uni-app-vite/src/plugins/copy.ts
index e6e5f1fd4c87d45f7a3780f7f8fe12e5e565d018..152b619657cabb0b00296dd2adee122f6007f78c 100644
--- a/packages/uni-app-vite/src/plugins/copy.ts
+++ b/packages/uni-app-vite/src/plugins/copy.ts
@@ -1,15 +1,44 @@
import path from 'path'
import slash from 'slash'
-import { uniViteCopyPlugin } from '@dcloudio/uni-cli-shared'
+import { parsePagesJsonOnce, uniViteCopyPlugin } from '@dcloudio/uni-cli-shared'
export function uniCopyPlugin() {
return uniViteCopyPlugin({
targets: [
{
- src: slash(path.resolve(__dirname, '../../lib/template/*')),
+ src: slash(path.resolve(__dirname, '../../lib/template/*.js')),
dest: process.env.UNI_OUTPUT_DIR,
},
+ {
+ src: slash(path.resolve(__dirname, '../../lib/template/*.png')),
+ dest: process.env.UNI_OUTPUT_DIR,
+ },
+ {
+ src: slash(
+ path.resolve(__dirname, '../../lib/template/__uniappview.html')
+ ),
+ dest: process.env.UNI_OUTPUT_DIR,
+ transform(content) {
+ const { globalStyle } = parsePagesJsonOnce(
+ process.env.UNI_INPUT_DIR,
+ process.env.UNI_PLATFORM
+ )
+ const __uniConfig = {
+ globalStyle: {
+ rpxCalcMaxDeviceWidth: (globalStyle as any).rpxCalcMaxDeviceWidth,
+ rpxCalcBaseDeviceWidth: (globalStyle as any)
+ .rpxCalcBaseDeviceWidth,
+ },
+ }
+ return content
+ .toString()
+ .replace(
+ '/*__uniConfig*/',
+ `var __uniConfig = ${JSON.stringify(__uniConfig)}`
+ )
+ },
+ },
{
src: slash(
require.resolve('@dcloudio/uni-app-plus/dist/uni-app-view.umd.js')
diff --git a/packages/uni-app-vue/dist/view.runtime.esm.js b/packages/uni-app-vue/dist/view.runtime.esm.js
index 5cb8129f3a7f473b3330bd8cafdbf022911c6a82..18e87dad2e114c17d4a83bddd476384577893036 100644
--- a/packages/uni-app-vue/dist/view.runtime.esm.js
+++ b/packages/uni-app-vue/dist/view.runtime.esm.js
@@ -300,11295 +300,9776 @@ const getGlobalThis = () => {
: {}));
};
-const targetMap = new WeakMap();
-const effectStack = [];
-let activeEffect;
-const ITERATE_KEY = Symbol(
- process.env.NODE_ENV !== 'production' ? 'iterate' : ''
-);
-const MAP_KEY_ITERATE_KEY = Symbol(
- process.env.NODE_ENV !== 'production' ? 'Map key iterate' : ''
-);
-function isEffect(fn) {
- return fn && fn._isEffect === true
-}
-function effect(fn, options = EMPTY_OBJ) {
- if (isEffect(fn)) {
- fn = fn.raw;
- }
- const effect = createReactiveEffect(fn, options);
- if (!options.lazy) {
- effect();
- }
- return effect
-}
-function stop(effect) {
- if (effect.active) {
- cleanup(effect);
- if (effect.options.onStop) {
- effect.options.onStop();
- }
- effect.active = false;
- }
-}
-let uid = 0;
-function createReactiveEffect(fn, options) {
- const effect = function reactiveEffect() {
- if (!effect.active) {
- return fn()
- }
- if (!effectStack.includes(effect)) {
- cleanup(effect);
- try {
- enableTracking();
- effectStack.push(effect);
- activeEffect = effect;
- return fn()
- } finally {
- effectStack.pop();
- resetTracking();
- activeEffect = effectStack[effectStack.length - 1];
- }
- }
- };
- effect.id = uid++;
- effect.allowRecurse = !!options.allowRecurse;
- effect._isEffect = true;
- effect.active = true;
- effect.raw = fn;
- effect.deps = [];
- effect.options = options;
- return effect
-}
-function cleanup(effect) {
- const { deps } = effect;
- if (deps.length) {
- for (let i = 0; i < deps.length; i++) {
- deps[i].delete(effect);
- }
- deps.length = 0;
- }
-}
-let shouldTrack = true;
-const trackStack = [];
-function pauseTracking() {
- trackStack.push(shouldTrack);
- shouldTrack = false;
-}
-function enableTracking() {
- trackStack.push(shouldTrack);
- shouldTrack = true;
-}
-function resetTracking() {
- const last = trackStack.pop();
- shouldTrack = last === undefined ? true : last;
-}
-function track(target, type, key) {
- if (!shouldTrack || activeEffect === undefined) {
- return
- }
- let depsMap = targetMap.get(target);
- if (!depsMap) {
- targetMap.set(target, (depsMap = new Map()));
- }
- let dep = depsMap.get(key);
- if (!dep) {
- depsMap.set(key, (dep = new Set()));
- }
- if (!dep.has(activeEffect)) {
- dep.add(activeEffect);
- activeEffect.deps.push(dep);
- if (process.env.NODE_ENV !== 'production' && activeEffect.options.onTrack) {
- activeEffect.options.onTrack({
- effect: activeEffect,
- target,
- type,
- key,
- });
- }
- }
-}
-function trigger(target, type, key, newValue, oldValue, oldTarget) {
- const depsMap = targetMap.get(target);
- if (!depsMap) {
- // never been tracked
- return
- }
- const effects = new Set();
- const add = (effectsToAdd) => {
- if (effectsToAdd) {
- effectsToAdd.forEach((effect) => {
- if (effect !== activeEffect || effect.allowRecurse) {
- effects.add(effect);
- }
- });
- }
- };
- if (type === 'clear' /* CLEAR */) {
- // collection being cleared
- // trigger all effects for target
- depsMap.forEach(add);
- } else if (key === 'length' && isArray(target)) {
- depsMap.forEach((dep, key) => {
- if (key === 'length' || key >= newValue) {
- add(dep);
- }
- });
- } else {
- // schedule runs for SET | ADD | DELETE
- if (key !== void 0) {
- add(depsMap.get(key));
- }
- // also run for iteration key on ADD | DELETE | Map.SET
- switch (type) {
- case 'add' /* ADD */:
- if (!isArray(target)) {
- add(depsMap.get(ITERATE_KEY));
- if (isMap(target)) {
- add(depsMap.get(MAP_KEY_ITERATE_KEY));
- }
- } else if (isIntegerKey(key)) {
- // new index added to array -> length changes
- add(depsMap.get('length'));
- }
- break
- case 'delete' /* DELETE */:
- if (!isArray(target)) {
- add(depsMap.get(ITERATE_KEY));
- if (isMap(target)) {
- add(depsMap.get(MAP_KEY_ITERATE_KEY));
- }
- }
- break
- case 'set' /* SET */:
- if (isMap(target)) {
- add(depsMap.get(ITERATE_KEY));
- }
- break
- }
- }
- const run = (effect) => {
- if (process.env.NODE_ENV !== 'production' && effect.options.onTrigger) {
- effect.options.onTrigger({
- effect,
- target,
- key,
- type,
- newValue,
- oldValue,
- oldTarget,
- });
- }
- if (effect.options.scheduler) {
- effect.options.scheduler(effect);
- } else {
- effect();
- }
- };
- effects.forEach(run);
+const targetMap = new WeakMap();
+const effectStack = [];
+let activeEffect;
+const ITERATE_KEY = Symbol((process.env.NODE_ENV !== 'production') ? 'iterate' : '');
+const MAP_KEY_ITERATE_KEY = Symbol((process.env.NODE_ENV !== 'production') ? 'Map key iterate' : '');
+function isEffect(fn) {
+ return fn && fn._isEffect === true;
+}
+function effect(fn, options = EMPTY_OBJ) {
+ if (isEffect(fn)) {
+ fn = fn.raw;
+ }
+ const effect = createReactiveEffect(fn, options);
+ if (!options.lazy) {
+ effect();
+ }
+ return effect;
+}
+function stop(effect) {
+ if (effect.active) {
+ cleanup(effect);
+ if (effect.options.onStop) {
+ effect.options.onStop();
+ }
+ effect.active = false;
+ }
+}
+let uid = 0;
+function createReactiveEffect(fn, options) {
+ const effect = function reactiveEffect() {
+ if (!effect.active) {
+ return fn();
+ }
+ if (!effectStack.includes(effect)) {
+ cleanup(effect);
+ try {
+ enableTracking();
+ effectStack.push(effect);
+ activeEffect = effect;
+ return fn();
+ }
+ finally {
+ effectStack.pop();
+ resetTracking();
+ activeEffect = effectStack[effectStack.length - 1];
+ }
+ }
+ };
+ effect.id = uid++;
+ effect.allowRecurse = !!options.allowRecurse;
+ effect._isEffect = true;
+ effect.active = true;
+ effect.raw = fn;
+ effect.deps = [];
+ effect.options = options;
+ return effect;
+}
+function cleanup(effect) {
+ const { deps } = effect;
+ if (deps.length) {
+ for (let i = 0; i < deps.length; i++) {
+ deps[i].delete(effect);
+ }
+ deps.length = 0;
+ }
+}
+let shouldTrack = true;
+const trackStack = [];
+function pauseTracking() {
+ trackStack.push(shouldTrack);
+ shouldTrack = false;
+}
+function enableTracking() {
+ trackStack.push(shouldTrack);
+ shouldTrack = true;
+}
+function resetTracking() {
+ const last = trackStack.pop();
+ shouldTrack = last === undefined ? true : last;
+}
+function track(target, type, key) {
+ if (!shouldTrack || activeEffect === undefined) {
+ return;
+ }
+ let depsMap = targetMap.get(target);
+ if (!depsMap) {
+ targetMap.set(target, (depsMap = new Map()));
+ }
+ let dep = depsMap.get(key);
+ if (!dep) {
+ depsMap.set(key, (dep = new Set()));
+ }
+ if (!dep.has(activeEffect)) {
+ dep.add(activeEffect);
+ activeEffect.deps.push(dep);
+ if ((process.env.NODE_ENV !== 'production') && activeEffect.options.onTrack) {
+ activeEffect.options.onTrack({
+ effect: activeEffect,
+ target,
+ type,
+ key
+ });
+ }
+ }
+}
+function trigger(target, type, key, newValue, oldValue, oldTarget) {
+ const depsMap = targetMap.get(target);
+ if (!depsMap) {
+ // never been tracked
+ return;
+ }
+ const effects = new Set();
+ const add = (effectsToAdd) => {
+ if (effectsToAdd) {
+ effectsToAdd.forEach(effect => {
+ if (effect !== activeEffect || effect.allowRecurse) {
+ effects.add(effect);
+ }
+ });
+ }
+ };
+ if (type === "clear" /* CLEAR */) {
+ // collection being cleared
+ // trigger all effects for target
+ depsMap.forEach(add);
+ }
+ else if (key === 'length' && isArray(target)) {
+ depsMap.forEach((dep, key) => {
+ if (key === 'length' || key >= newValue) {
+ add(dep);
+ }
+ });
+ }
+ else {
+ // schedule runs for SET | ADD | DELETE
+ if (key !== void 0) {
+ add(depsMap.get(key));
+ }
+ // also run for iteration key on ADD | DELETE | Map.SET
+ switch (type) {
+ case "add" /* ADD */:
+ if (!isArray(target)) {
+ add(depsMap.get(ITERATE_KEY));
+ if (isMap(target)) {
+ add(depsMap.get(MAP_KEY_ITERATE_KEY));
+ }
+ }
+ else if (isIntegerKey(key)) {
+ // new index added to array -> length changes
+ add(depsMap.get('length'));
+ }
+ break;
+ case "delete" /* DELETE */:
+ if (!isArray(target)) {
+ add(depsMap.get(ITERATE_KEY));
+ if (isMap(target)) {
+ add(depsMap.get(MAP_KEY_ITERATE_KEY));
+ }
+ }
+ break;
+ case "set" /* SET */:
+ if (isMap(target)) {
+ add(depsMap.get(ITERATE_KEY));
+ }
+ break;
+ }
+ }
+ const run = (effect) => {
+ if ((process.env.NODE_ENV !== 'production') && effect.options.onTrigger) {
+ effect.options.onTrigger({
+ effect,
+ target,
+ key,
+ type,
+ newValue,
+ oldValue,
+ oldTarget
+ });
+ }
+ if (effect.options.scheduler) {
+ effect.options.scheduler(effect);
+ }
+ else {
+ effect();
+ }
+ };
+ effects.forEach(run);
}
-const isNonTrackableKeys = /*#__PURE__*/ makeMap(`__proto__,__v_isRef,__isVue`);
-const builtInSymbols = new Set(
- Object.getOwnPropertyNames(Symbol)
- .map((key) => Symbol[key])
- .filter(isSymbol)
-);
-const get = /*#__PURE__*/ createGetter();
-const shallowGet = /*#__PURE__*/ createGetter(false, true);
-const readonlyGet = /*#__PURE__*/ createGetter(true);
-const shallowReadonlyGet = /*#__PURE__*/ createGetter(true, true);
-const arrayInstrumentations = /*#__PURE__*/ createArrayInstrumentations();
-function createArrayInstrumentations() {
- const instrumentations = {}
- ;['includes', 'indexOf', 'lastIndexOf'].forEach((key) => {
- const method = Array.prototype[key];
- instrumentations[key] = function (...args) {
- const arr = toRaw(this);
- for (let i = 0, l = this.length; i < l; i++) {
- track(arr, 'get' /* GET */, i + '');
- }
- // we run the method using the original args first (which may be reactive)
- const res = method.apply(arr, args);
- if (res === -1 || res === false) {
- // if that didn't work, run it again using raw values.
- return method.apply(arr, args.map(toRaw))
- } else {
- return res
- }
- };
- })
- ;['push', 'pop', 'shift', 'unshift', 'splice'].forEach((key) => {
- const method = Array.prototype[key];
- instrumentations[key] = function (...args) {
- pauseTracking();
- const res = method.apply(this, args);
- resetTracking();
- return res
- };
- });
- return instrumentations
-}
-function createGetter(isReadonly = false, shallow = false) {
- return function get(target, key, receiver) {
- if (key === '__v_isReactive' /* IS_REACTIVE */) {
- return !isReadonly
- } else if (key === '__v_isReadonly' /* IS_READONLY */) {
- return isReadonly
- } else if (
- key === '__v_raw' /* RAW */ &&
- receiver ===
- (isReadonly
- ? shallow
- ? shallowReadonlyMap
- : readonlyMap
- : shallow
- ? shallowReactiveMap
- : reactiveMap
- ).get(target)
- ) {
- return target
- }
- const targetIsArray = isArray(target);
- if (!isReadonly && targetIsArray && hasOwn(arrayInstrumentations, key)) {
- return Reflect.get(arrayInstrumentations, key, receiver)
- }
- const res = Reflect.get(target, key, receiver);
- if (isSymbol(key) ? builtInSymbols.has(key) : isNonTrackableKeys(key)) {
- return res
- }
- if (!isReadonly) {
- track(target, 'get' /* GET */, key);
- }
- if (shallow) {
- return res
- }
- if (isRef(res)) {
- // ref unwrapping - does not apply for Array + integer key.
- const shouldUnwrap = !targetIsArray || !isIntegerKey(key);
- return shouldUnwrap ? res.value : res
- }
- if (isObject$1(res)) {
- // Convert returned value into a proxy as well. we do the isObject check
- // here to avoid invalid value warning. Also need to lazy access readonly
- // and reactive here to avoid circular dependency.
- return isReadonly ? readonly(res) : reactive(res)
- }
- return res
- }
-}
-const set = /*#__PURE__*/ createSetter();
-const shallowSet = /*#__PURE__*/ createSetter(true);
-function createSetter(shallow = false) {
- return function set(target, key, value, receiver) {
- let oldValue = target[key];
- if (!shallow) {
- value = toRaw(value);
- oldValue = toRaw(oldValue);
- if (!isArray(target) && isRef(oldValue) && !isRef(value)) {
- oldValue.value = value;
- return true
- }
- }
- const hadKey =
- isArray(target) && isIntegerKey(key)
- ? Number(key) < target.length
- : hasOwn(target, key);
- const result = Reflect.set(target, key, value, receiver);
- // don't trigger if target is something up in the prototype chain of original
- if (target === toRaw(receiver)) {
- if (!hadKey) {
- trigger(target, 'add' /* ADD */, key, value);
- } else if (hasChanged(value, oldValue)) {
- trigger(target, 'set' /* SET */, key, value, oldValue);
- }
- }
- return result
- }
-}
-function deleteProperty(target, key) {
- const hadKey = hasOwn(target, key);
- const oldValue = target[key];
- const result = Reflect.deleteProperty(target, key);
- if (result && hadKey) {
- trigger(target, 'delete' /* DELETE */, key, undefined, oldValue);
- }
- return result
-}
-function has(target, key) {
- const result = Reflect.has(target, key);
- if (!isSymbol(key) || !builtInSymbols.has(key)) {
- track(target, 'has' /* HAS */, key);
- }
- return result
-}
-function ownKeys(target) {
- track(
- target,
- 'iterate' /* ITERATE */,
- isArray(target) ? 'length' : ITERATE_KEY
- );
- return Reflect.ownKeys(target)
-}
-const mutableHandlers = {
- get,
- set,
- deleteProperty,
- has,
- ownKeys,
-};
-const readonlyHandlers = {
- get: readonlyGet,
- set(target, key) {
- if (process.env.NODE_ENV !== 'production') {
- console.warn(
- `Set operation on key "${String(key)}" failed: target is readonly.`,
- target
- );
- }
- return true
- },
- deleteProperty(target, key) {
- if (process.env.NODE_ENV !== 'production') {
- console.warn(
- `Delete operation on key "${String(key)}" failed: target is readonly.`,
- target
- );
- }
- return true
- },
-};
-const shallowReactiveHandlers = /*#__PURE__*/ extend({}, mutableHandlers, {
- get: shallowGet,
- set: shallowSet,
-});
-// Props handlers are special in the sense that it should not unwrap top-level
-// refs (in order to allow refs to be explicitly passed down), but should
-// retain the reactivity of the normal readonly object.
-const shallowReadonlyHandlers = /*#__PURE__*/ extend({}, readonlyHandlers, {
- get: shallowReadonlyGet,
+const isNonTrackableKeys = /*#__PURE__*/ makeMap(`__proto__,__v_isRef,__isVue`);
+const builtInSymbols = new Set(Object.getOwnPropertyNames(Symbol)
+ .map(key => Symbol[key])
+ .filter(isSymbol));
+const get = /*#__PURE__*/ createGetter();
+const shallowGet = /*#__PURE__*/ createGetter(false, true);
+const readonlyGet = /*#__PURE__*/ createGetter(true);
+const shallowReadonlyGet = /*#__PURE__*/ createGetter(true, true);
+const arrayInstrumentations = /*#__PURE__*/ createArrayInstrumentations();
+function createArrayInstrumentations() {
+ const instrumentations = {};
+ ['includes', 'indexOf', 'lastIndexOf'].forEach(key => {
+ const method = Array.prototype[key];
+ instrumentations[key] = function (...args) {
+ const arr = toRaw(this);
+ for (let i = 0, l = this.length; i < l; i++) {
+ track(arr, "get" /* GET */, i + '');
+ }
+ // we run the method using the original args first (which may be reactive)
+ const res = method.apply(arr, args);
+ if (res === -1 || res === false) {
+ // if that didn't work, run it again using raw values.
+ return method.apply(arr, args.map(toRaw));
+ }
+ else {
+ return res;
+ }
+ };
+ });
+ ['push', 'pop', 'shift', 'unshift', 'splice'].forEach(key => {
+ const method = Array.prototype[key];
+ instrumentations[key] = function (...args) {
+ pauseTracking();
+ const res = method.apply(this, args);
+ resetTracking();
+ return res;
+ };
+ });
+ return instrumentations;
+}
+function createGetter(isReadonly = false, shallow = false) {
+ return function get(target, key, receiver) {
+ if (key === "__v_isReactive" /* IS_REACTIVE */) {
+ return !isReadonly;
+ }
+ else if (key === "__v_isReadonly" /* IS_READONLY */) {
+ return isReadonly;
+ }
+ else if (key === "__v_raw" /* RAW */ &&
+ receiver ===
+ (isReadonly
+ ? shallow
+ ? shallowReadonlyMap
+ : readonlyMap
+ : shallow
+ ? shallowReactiveMap
+ : reactiveMap).get(target)) {
+ return target;
+ }
+ const targetIsArray = isArray(target);
+ if (!isReadonly && targetIsArray && hasOwn(arrayInstrumentations, key)) {
+ return Reflect.get(arrayInstrumentations, key, receiver);
+ }
+ const res = Reflect.get(target, key, receiver);
+ if (isSymbol(key) ? builtInSymbols.has(key) : isNonTrackableKeys(key)) {
+ return res;
+ }
+ if (!isReadonly) {
+ track(target, "get" /* GET */, key);
+ }
+ if (shallow) {
+ return res;
+ }
+ if (isRef(res)) {
+ // ref unwrapping - does not apply for Array + integer key.
+ const shouldUnwrap = !targetIsArray || !isIntegerKey(key);
+ return shouldUnwrap ? res.value : res;
+ }
+ if (isObject$1(res)) {
+ // Convert returned value into a proxy as well. we do the isObject check
+ // here to avoid invalid value warning. Also need to lazy access readonly
+ // and reactive here to avoid circular dependency.
+ return isReadonly ? readonly(res) : reactive(res);
+ }
+ return res;
+ };
+}
+const set = /*#__PURE__*/ createSetter();
+const shallowSet = /*#__PURE__*/ createSetter(true);
+function createSetter(shallow = false) {
+ return function set(target, key, value, receiver) {
+ let oldValue = target[key];
+ if (!shallow) {
+ value = toRaw(value);
+ oldValue = toRaw(oldValue);
+ if (!isArray(target) && isRef(oldValue) && !isRef(value)) {
+ oldValue.value = value;
+ return true;
+ }
+ }
+ const hadKey = isArray(target) && isIntegerKey(key)
+ ? Number(key) < target.length
+ : hasOwn(target, key);
+ const result = Reflect.set(target, key, value, receiver);
+ // don't trigger if target is something up in the prototype chain of original
+ if (target === toRaw(receiver)) {
+ if (!hadKey) {
+ trigger(target, "add" /* ADD */, key, value);
+ }
+ else if (hasChanged(value, oldValue)) {
+ trigger(target, "set" /* SET */, key, value, oldValue);
+ }
+ }
+ return result;
+ };
+}
+function deleteProperty(target, key) {
+ const hadKey = hasOwn(target, key);
+ const oldValue = target[key];
+ const result = Reflect.deleteProperty(target, key);
+ if (result && hadKey) {
+ trigger(target, "delete" /* DELETE */, key, undefined, oldValue);
+ }
+ return result;
+}
+function has(target, key) {
+ const result = Reflect.has(target, key);
+ if (!isSymbol(key) || !builtInSymbols.has(key)) {
+ track(target, "has" /* HAS */, key);
+ }
+ return result;
+}
+function ownKeys(target) {
+ track(target, "iterate" /* ITERATE */, isArray(target) ? 'length' : ITERATE_KEY);
+ return Reflect.ownKeys(target);
+}
+const mutableHandlers = {
+ get,
+ set,
+ deleteProperty,
+ has,
+ ownKeys
+};
+const readonlyHandlers = {
+ get: readonlyGet,
+ set(target, key) {
+ if ((process.env.NODE_ENV !== 'production')) {
+ console.warn(`Set operation on key "${String(key)}" failed: target is readonly.`, target);
+ }
+ return true;
+ },
+ deleteProperty(target, key) {
+ if ((process.env.NODE_ENV !== 'production')) {
+ console.warn(`Delete operation on key "${String(key)}" failed: target is readonly.`, target);
+ }
+ return true;
+ }
+};
+const shallowReactiveHandlers = /*#__PURE__*/ extend({}, mutableHandlers, {
+ get: shallowGet,
+ set: shallowSet
+});
+// Props handlers are special in the sense that it should not unwrap top-level
+// refs (in order to allow refs to be explicitly passed down), but should
+// retain the reactivity of the normal readonly object.
+const shallowReadonlyHandlers = /*#__PURE__*/ extend({}, readonlyHandlers, {
+ get: shallowReadonlyGet
});
-const toReactive = (value) => (isObject$1(value) ? reactive(value) : value);
-const toReadonly = (value) => (isObject$1(value) ? readonly(value) : value);
-const toShallow = (value) => value;
-const getProto = (v) => Reflect.getPrototypeOf(v);
-function get$1(target, key, isReadonly = false, isShallow = false) {
- // #1772: readonly(reactive(Map)) should return readonly + reactive version
- // of the value
- target = target['__v_raw' /* RAW */];
- const rawTarget = toRaw(target);
- const rawKey = toRaw(key);
- if (key !== rawKey) {
- !isReadonly && track(rawTarget, 'get' /* GET */, key);
- }
- !isReadonly && track(rawTarget, 'get' /* GET */, rawKey);
- const { has } = getProto(rawTarget);
- const wrap = isShallow ? toShallow : isReadonly ? toReadonly : toReactive;
- if (has.call(rawTarget, key)) {
- return wrap(target.get(key))
- } else if (has.call(rawTarget, rawKey)) {
- return wrap(target.get(rawKey))
- } else if (target !== rawTarget) {
- // #3602 readonly(reactive(Map))
- // ensure that the nested reactive `Map` can do tracking for itself
- target.get(key);
- }
-}
-function has$1(key, isReadonly = false) {
- const target = this['__v_raw' /* RAW */];
- const rawTarget = toRaw(target);
- const rawKey = toRaw(key);
- if (key !== rawKey) {
- !isReadonly && track(rawTarget, 'has' /* HAS */, key);
- }
- !isReadonly && track(rawTarget, 'has' /* HAS */, rawKey);
- return key === rawKey
- ? target.has(key)
- : target.has(key) || target.has(rawKey)
-}
-function size(target, isReadonly = false) {
- target = target['__v_raw' /* RAW */];
- !isReadonly && track(toRaw(target), 'iterate' /* ITERATE */, ITERATE_KEY);
- return Reflect.get(target, 'size', target)
-}
-function add(value) {
- value = toRaw(value);
- const target = toRaw(this);
- const proto = getProto(target);
- const hadKey = proto.has.call(target, value);
- if (!hadKey) {
- target.add(value);
- trigger(target, 'add' /* ADD */, value, value);
- }
- return this
-}
-function set$1(key, value) {
- value = toRaw(value);
- const target = toRaw(this);
- const { has, get } = getProto(target);
- let hadKey = has.call(target, key);
- if (!hadKey) {
- key = toRaw(key);
- hadKey = has.call(target, key);
- } else if (process.env.NODE_ENV !== 'production') {
- checkIdentityKeys(target, has, key);
- }
- const oldValue = get.call(target, key);
- target.set(key, value);
- if (!hadKey) {
- trigger(target, 'add' /* ADD */, key, value);
- } else if (hasChanged(value, oldValue)) {
- trigger(target, 'set' /* SET */, key, value, oldValue);
- }
- return this
-}
-function deleteEntry(key) {
- const target = toRaw(this);
- const { has, get } = getProto(target);
- let hadKey = has.call(target, key);
- if (!hadKey) {
- key = toRaw(key);
- hadKey = has.call(target, key);
- } else if (process.env.NODE_ENV !== 'production') {
- checkIdentityKeys(target, has, key);
- }
- const oldValue = get ? get.call(target, key) : undefined;
- // forward the operation before queueing reactions
- const result = target.delete(key);
- if (hadKey) {
- trigger(target, 'delete' /* DELETE */, key, undefined, oldValue);
- }
- return result
-}
-function clear() {
- const target = toRaw(this);
- const hadItems = target.size !== 0;
- const oldTarget =
- process.env.NODE_ENV !== 'production'
- ? isMap(target)
- ? new Map(target)
- : new Set(target)
- : undefined;
- // forward the operation before queueing reactions
- const result = target.clear();
- if (hadItems) {
- trigger(target, 'clear' /* CLEAR */, undefined, undefined, oldTarget);
- }
- return result
-}
-function createForEach(isReadonly, isShallow) {
- return function forEach(callback, thisArg) {
- const observed = this;
- const target = observed['__v_raw' /* RAW */];
- const rawTarget = toRaw(target);
- const wrap = isShallow ? toShallow : isReadonly ? toReadonly : toReactive;
- !isReadonly && track(rawTarget, 'iterate' /* ITERATE */, ITERATE_KEY);
- return target.forEach((value, key) => {
- // important: make sure the callback is
- // 1. invoked with the reactive map as `this` and 3rd arg
- // 2. the value received should be a corresponding reactive/readonly.
- return callback.call(thisArg, wrap(value), wrap(key), observed)
- })
- }
-}
-function createIterableMethod(method, isReadonly, isShallow) {
- return function (...args) {
- const target = this['__v_raw' /* RAW */];
- const rawTarget = toRaw(target);
- const targetIsMap = isMap(rawTarget);
- const isPair =
- method === 'entries' || (method === Symbol.iterator && targetIsMap);
- const isKeyOnly = method === 'keys' && targetIsMap;
- const innerIterator = target[method](...args);
- const wrap = isShallow ? toShallow : isReadonly ? toReadonly : toReactive;
- !isReadonly &&
- track(
- rawTarget,
- 'iterate' /* ITERATE */,
- isKeyOnly ? MAP_KEY_ITERATE_KEY : ITERATE_KEY
- );
- // return a wrapped iterator which returns observed versions of the
- // values emitted from the real iterator
- return {
- // iterator protocol
- next() {
- const { value, done } = innerIterator.next();
- return done
- ? { value, done }
- : {
- value: isPair ? [wrap(value[0]), wrap(value[1])] : wrap(value),
- done,
- }
- },
- // iterable protocol
- [Symbol.iterator]() {
- return this
- },
- }
- }
-}
-function createReadonlyMethod(type) {
- return function (...args) {
- if (process.env.NODE_ENV !== 'production') {
- const key = args[0] ? `on key "${args[0]}" ` : ``;
- console.warn(
- `${capitalize(type)} operation ${key}failed: target is readonly.`,
- toRaw(this)
- );
- }
- return type === 'delete' /* DELETE */ ? false : this
- }
-}
-function createInstrumentations() {
- const mutableInstrumentations = {
- get(key) {
- return get$1(this, key)
- },
- get size() {
- return size(this)
- },
- has: has$1,
- add,
- set: set$1,
- delete: deleteEntry,
- clear,
- forEach: createForEach(false, false),
- };
- const shallowInstrumentations = {
- get(key) {
- return get$1(this, key, false, true)
- },
- get size() {
- return size(this)
- },
- has: has$1,
- add,
- set: set$1,
- delete: deleteEntry,
- clear,
- forEach: createForEach(false, true),
- };
- const readonlyInstrumentations = {
- get(key) {
- return get$1(this, key, true)
- },
- get size() {
- return size(this, true)
- },
- has(key) {
- return has$1.call(this, key, true)
- },
- add: createReadonlyMethod('add' /* ADD */),
- set: createReadonlyMethod('set' /* SET */),
- delete: createReadonlyMethod('delete' /* DELETE */),
- clear: createReadonlyMethod('clear' /* CLEAR */),
- forEach: createForEach(true, false),
- };
- const shallowReadonlyInstrumentations = {
- get(key) {
- return get$1(this, key, true, true)
- },
- get size() {
- return size(this, true)
- },
- has(key) {
- return has$1.call(this, key, true)
- },
- add: createReadonlyMethod('add' /* ADD */),
- set: createReadonlyMethod('set' /* SET */),
- delete: createReadonlyMethod('delete' /* DELETE */),
- clear: createReadonlyMethod('clear' /* CLEAR */),
- forEach: createForEach(true, true),
- };
- const iteratorMethods = ['keys', 'values', 'entries', Symbol.iterator];
- iteratorMethods.forEach((method) => {
- mutableInstrumentations[method] = createIterableMethod(method, false, false);
- readonlyInstrumentations[method] = createIterableMethod(method, true, false);
- shallowInstrumentations[method] = createIterableMethod(method, false, true);
- shallowReadonlyInstrumentations[method] = createIterableMethod(
- method,
- true,
- true
- );
- });
- return [
- mutableInstrumentations,
- readonlyInstrumentations,
- shallowInstrumentations,
- shallowReadonlyInstrumentations,
- ]
-}
-const [
- mutableInstrumentations,
- readonlyInstrumentations,
- shallowInstrumentations,
- shallowReadonlyInstrumentations,
-] = /* #__PURE__*/ createInstrumentations();
-function createInstrumentationGetter(isReadonly, shallow) {
- const instrumentations = shallow
- ? isReadonly
- ? shallowReadonlyInstrumentations
- : shallowInstrumentations
- : isReadonly
- ? readonlyInstrumentations
- : mutableInstrumentations;
- return (target, key, receiver) => {
- if (key === '__v_isReactive' /* IS_REACTIVE */) {
- return !isReadonly
- } else if (key === '__v_isReadonly' /* IS_READONLY */) {
- return isReadonly
- } else if (key === '__v_raw' /* RAW */) {
- return target
- }
- return Reflect.get(
- hasOwn(instrumentations, key) && key in target
- ? instrumentations
- : target,
- key,
- receiver
- )
- }
-}
-const mutableCollectionHandlers = {
- get: /*#__PURE__*/ createInstrumentationGetter(false, false),
-};
-const shallowCollectionHandlers = {
- get: /*#__PURE__*/ createInstrumentationGetter(false, true),
-};
-const readonlyCollectionHandlers = {
- get: /*#__PURE__*/ createInstrumentationGetter(true, false),
-};
-const shallowReadonlyCollectionHandlers = {
- get: /*#__PURE__*/ createInstrumentationGetter(true, true),
-};
-function checkIdentityKeys(target, has, key) {
- const rawKey = toRaw(key);
- if (rawKey !== key && has.call(target, rawKey)) {
- const type = toRawType(target);
- console.warn(
- `Reactive ${type} contains both the raw and reactive ` +
- `versions of the same object${type === `Map` ? ` as keys` : ``}, ` +
- `which can lead to inconsistencies. ` +
- `Avoid differentiating between the raw and reactive versions ` +
- `of an object and only use the reactive version if possible.`
- );
- }
-}
-
-const reactiveMap = new WeakMap();
-const shallowReactiveMap = new WeakMap();
-const readonlyMap = new WeakMap();
-const shallowReadonlyMap = new WeakMap();
-function targetTypeMap(rawType) {
- switch (rawType) {
- case 'Object':
- case 'Array':
- return 1 /* COMMON */
- case 'Map':
- case 'Set':
- case 'WeakMap':
- case 'WeakSet':
- return 2 /* COLLECTION */
- default:
- return 0 /* INVALID */
- }
-}
-function getTargetType(value) {
- return value['__v_skip' /* SKIP */] || !Object.isExtensible(value)
- ? 0 /* INVALID */
- : targetTypeMap(toRawType(value))
-}
-function reactive(target) {
- // if trying to observe a readonly proxy, return the readonly version.
- if (target && target['__v_isReadonly' /* IS_READONLY */]) {
- return target
- }
- return createReactiveObject(
- target,
- false,
- mutableHandlers,
- mutableCollectionHandlers,
- reactiveMap
- )
-}
-/**
- * Return a shallowly-reactive copy of the original object, where only the root
- * level properties are reactive. It also does not auto-unwrap refs (even at the
- * root level).
- */
-function shallowReactive(target) {
- return createReactiveObject(
- target,
- false,
- shallowReactiveHandlers,
- shallowCollectionHandlers,
- shallowReactiveMap
- )
-}
-/**
- * Creates a readonly copy of the original object. Note the returned copy is not
- * made reactive, but `readonly` can be called on an already reactive object.
- */
-function readonly(target) {
- return createReactiveObject(
- target,
- true,
- readonlyHandlers,
- readonlyCollectionHandlers,
- readonlyMap
- )
-}
-/**
- * Returns a reactive-copy of the original object, where only the root level
- * properties are readonly, and does NOT unwrap refs nor recursively convert
- * returned properties.
- * This is used for creating the props proxy object for stateful components.
- */
-function shallowReadonly(target) {
- return createReactiveObject(
- target,
- true,
- shallowReadonlyHandlers,
- shallowReadonlyCollectionHandlers,
- shallowReadonlyMap
- )
-}
-function createReactiveObject(
- target,
- isReadonly,
- baseHandlers,
- collectionHandlers,
- proxyMap
-) {
- if (!isObject$1(target)) {
- if (process.env.NODE_ENV !== 'production') {
- console.warn(`value cannot be made reactive: ${String(target)}`);
- }
- return target
- }
- // target is already a Proxy, return it.
- // exception: calling readonly() on a reactive object
- if (
- target['__v_raw' /* RAW */] &&
- !(isReadonly && target['__v_isReactive' /* IS_REACTIVE */])
- ) {
- return target
- }
- // target already has corresponding Proxy
- const existingProxy = proxyMap.get(target);
- if (existingProxy) {
- return existingProxy
- }
- // only a whitelist of value types can be observed.
- const targetType = getTargetType(target);
- if (targetType === 0 /* INVALID */) {
- return target
- }
- const proxy = new Proxy(
- target,
- targetType === 2 /* COLLECTION */ ? collectionHandlers : baseHandlers
- );
- proxyMap.set(target, proxy);
- return proxy
-}
-function isReactive(value) {
- if (isReadonly(value)) {
- return isReactive(value['__v_raw' /* RAW */])
- }
- return !!(value && value['__v_isReactive' /* IS_REACTIVE */])
-}
-function isReadonly(value) {
- return !!(value && value['__v_isReadonly' /* IS_READONLY */])
-}
-function isProxy(value) {
- return isReactive(value) || isReadonly(value)
-}
-function toRaw(observed) {
- return (observed && toRaw(observed['__v_raw' /* RAW */])) || observed
-}
-function markRaw(value) {
- def(value, '__v_skip' /* SKIP */, true);
- return value
-}
-
-const convert = (val) => (isObject$1(val) ? reactive(val) : val);
-function isRef(r) {
- return Boolean(r && r.__v_isRef === true)
-}
-function ref(value) {
- return createRef(value)
-}
-function shallowRef(value) {
- return createRef(value, true)
-}
-class RefImpl {
- constructor(_rawValue, _shallow) {
- this._rawValue = _rawValue;
- this._shallow = _shallow;
- this.__v_isRef = true;
- this._value = _shallow ? _rawValue : convert(_rawValue);
- }
- get value() {
- track(toRaw(this), 'get' /* GET */, 'value');
- return this._value
- }
- set value(newVal) {
- if (hasChanged(toRaw(newVal), this._rawValue)) {
- this._rawValue = newVal;
- this._value = this._shallow ? newVal : convert(newVal);
- trigger(toRaw(this), 'set' /* SET */, 'value', newVal);
- }
- }
-}
-function createRef(rawValue, shallow = false) {
- if (isRef(rawValue)) {
- return rawValue
- }
- return new RefImpl(rawValue, shallow)
-}
-function triggerRef(ref) {
- trigger(
- toRaw(ref),
- 'set' /* SET */,
- 'value',
- process.env.NODE_ENV !== 'production' ? ref.value : void 0
- );
-}
-function unref(ref) {
- return isRef(ref) ? ref.value : ref
-}
-const shallowUnwrapHandlers = {
- get: (target, key, receiver) => unref(Reflect.get(target, key, receiver)),
- set: (target, key, value, receiver) => {
- const oldValue = target[key];
- if (isRef(oldValue) && !isRef(value)) {
- oldValue.value = value;
- return true
- } else {
- return Reflect.set(target, key, value, receiver)
- }
- },
-};
-function proxyRefs(objectWithRefs) {
- return isReactive(objectWithRefs)
- ? objectWithRefs
- : new Proxy(objectWithRefs, shallowUnwrapHandlers)
-}
-class CustomRefImpl {
- constructor(factory) {
- this.__v_isRef = true;
- const { get, set } = factory(
- () => track(this, 'get' /* GET */, 'value'),
- () => trigger(this, 'set' /* SET */, 'value')
- );
- this._get = get;
- this._set = set;
- }
- get value() {
- return this._get()
- }
- set value(newVal) {
- this._set(newVal);
- }
-}
-function customRef(factory) {
- return new CustomRefImpl(factory)
-}
-function toRefs(object) {
- if (process.env.NODE_ENV !== 'production' && !isProxy(object)) {
- console.warn(`toRefs() expects a reactive object but received a plain one.`);
- }
- const ret = isArray(object) ? new Array(object.length) : {};
- for (const key in object) {
- ret[key] = toRef(object, key);
- }
- return ret
-}
-class ObjectRefImpl {
- constructor(_object, _key) {
- this._object = _object;
- this._key = _key;
- this.__v_isRef = true;
- }
- get value() {
- return this._object[this._key]
- }
- set value(newVal) {
- this._object[this._key] = newVal;
- }
-}
-function toRef(object, key) {
- return isRef(object[key]) ? object[key] : new ObjectRefImpl(object, key)
+const toReactive = (value) => isObject$1(value) ? reactive(value) : value;
+const toReadonly = (value) => isObject$1(value) ? readonly(value) : value;
+const toShallow = (value) => value;
+const getProto = (v) => Reflect.getPrototypeOf(v);
+function get$1(target, key, isReadonly = false, isShallow = false) {
+ // #1772: readonly(reactive(Map)) should return readonly + reactive version
+ // of the value
+ target = target["__v_raw" /* RAW */];
+ const rawTarget = toRaw(target);
+ const rawKey = toRaw(key);
+ if (key !== rawKey) {
+ !isReadonly && track(rawTarget, "get" /* GET */, key);
+ }
+ !isReadonly && track(rawTarget, "get" /* GET */, rawKey);
+ const { has } = getProto(rawTarget);
+ const wrap = isShallow ? toShallow : isReadonly ? toReadonly : toReactive;
+ if (has.call(rawTarget, key)) {
+ return wrap(target.get(key));
+ }
+ else if (has.call(rawTarget, rawKey)) {
+ return wrap(target.get(rawKey));
+ }
+ else if (target !== rawTarget) {
+ // #3602 readonly(reactive(Map))
+ // ensure that the nested reactive `Map` can do tracking for itself
+ target.get(key);
+ }
+}
+function has$1(key, isReadonly = false) {
+ const target = this["__v_raw" /* RAW */];
+ const rawTarget = toRaw(target);
+ const rawKey = toRaw(key);
+ if (key !== rawKey) {
+ !isReadonly && track(rawTarget, "has" /* HAS */, key);
+ }
+ !isReadonly && track(rawTarget, "has" /* HAS */, rawKey);
+ return key === rawKey
+ ? target.has(key)
+ : target.has(key) || target.has(rawKey);
+}
+function size(target, isReadonly = false) {
+ target = target["__v_raw" /* RAW */];
+ !isReadonly && track(toRaw(target), "iterate" /* ITERATE */, ITERATE_KEY);
+ return Reflect.get(target, 'size', target);
+}
+function add(value) {
+ value = toRaw(value);
+ const target = toRaw(this);
+ const proto = getProto(target);
+ const hadKey = proto.has.call(target, value);
+ if (!hadKey) {
+ target.add(value);
+ trigger(target, "add" /* ADD */, value, value);
+ }
+ return this;
+}
+function set$1(key, value) {
+ value = toRaw(value);
+ const target = toRaw(this);
+ const { has, get } = getProto(target);
+ let hadKey = has.call(target, key);
+ if (!hadKey) {
+ key = toRaw(key);
+ hadKey = has.call(target, key);
+ }
+ else if ((process.env.NODE_ENV !== 'production')) {
+ checkIdentityKeys(target, has, key);
+ }
+ const oldValue = get.call(target, key);
+ target.set(key, value);
+ if (!hadKey) {
+ trigger(target, "add" /* ADD */, key, value);
+ }
+ else if (hasChanged(value, oldValue)) {
+ trigger(target, "set" /* SET */, key, value, oldValue);
+ }
+ return this;
+}
+function deleteEntry(key) {
+ const target = toRaw(this);
+ const { has, get } = getProto(target);
+ let hadKey = has.call(target, key);
+ if (!hadKey) {
+ key = toRaw(key);
+ hadKey = has.call(target, key);
+ }
+ else if ((process.env.NODE_ENV !== 'production')) {
+ checkIdentityKeys(target, has, key);
+ }
+ const oldValue = get ? get.call(target, key) : undefined;
+ // forward the operation before queueing reactions
+ const result = target.delete(key);
+ if (hadKey) {
+ trigger(target, "delete" /* DELETE */, key, undefined, oldValue);
+ }
+ return result;
+}
+function clear() {
+ const target = toRaw(this);
+ const hadItems = target.size !== 0;
+ const oldTarget = (process.env.NODE_ENV !== 'production')
+ ? isMap(target)
+ ? new Map(target)
+ : new Set(target)
+ : undefined;
+ // forward the operation before queueing reactions
+ const result = target.clear();
+ if (hadItems) {
+ trigger(target, "clear" /* CLEAR */, undefined, undefined, oldTarget);
+ }
+ return result;
+}
+function createForEach(isReadonly, isShallow) {
+ return function forEach(callback, thisArg) {
+ const observed = this;
+ const target = observed["__v_raw" /* RAW */];
+ const rawTarget = toRaw(target);
+ const wrap = isShallow ? toShallow : isReadonly ? toReadonly : toReactive;
+ !isReadonly && track(rawTarget, "iterate" /* ITERATE */, ITERATE_KEY);
+ return target.forEach((value, key) => {
+ // important: make sure the callback is
+ // 1. invoked with the reactive map as `this` and 3rd arg
+ // 2. the value received should be a corresponding reactive/readonly.
+ return callback.call(thisArg, wrap(value), wrap(key), observed);
+ });
+ };
+}
+function createIterableMethod(method, isReadonly, isShallow) {
+ return function (...args) {
+ const target = this["__v_raw" /* RAW */];
+ const rawTarget = toRaw(target);
+ const targetIsMap = isMap(rawTarget);
+ const isPair = method === 'entries' || (method === Symbol.iterator && targetIsMap);
+ const isKeyOnly = method === 'keys' && targetIsMap;
+ const innerIterator = target[method](...args);
+ const wrap = isShallow ? toShallow : isReadonly ? toReadonly : toReactive;
+ !isReadonly &&
+ track(rawTarget, "iterate" /* ITERATE */, isKeyOnly ? MAP_KEY_ITERATE_KEY : ITERATE_KEY);
+ // return a wrapped iterator which returns observed versions of the
+ // values emitted from the real iterator
+ return {
+ // iterator protocol
+ next() {
+ const { value, done } = innerIterator.next();
+ return done
+ ? { value, done }
+ : {
+ value: isPair ? [wrap(value[0]), wrap(value[1])] : wrap(value),
+ done
+ };
+ },
+ // iterable protocol
+ [Symbol.iterator]() {
+ return this;
+ }
+ };
+ };
+}
+function createReadonlyMethod(type) {
+ return function (...args) {
+ if ((process.env.NODE_ENV !== 'production')) {
+ const key = args[0] ? `on key "${args[0]}" ` : ``;
+ console.warn(`${capitalize(type)} operation ${key}failed: target is readonly.`, toRaw(this));
+ }
+ return type === "delete" /* DELETE */ ? false : this;
+ };
+}
+function createInstrumentations() {
+ const mutableInstrumentations = {
+ get(key) {
+ return get$1(this, key);
+ },
+ get size() {
+ return size(this);
+ },
+ has: has$1,
+ add,
+ set: set$1,
+ delete: deleteEntry,
+ clear,
+ forEach: createForEach(false, false)
+ };
+ const shallowInstrumentations = {
+ get(key) {
+ return get$1(this, key, false, true);
+ },
+ get size() {
+ return size(this);
+ },
+ has: has$1,
+ add,
+ set: set$1,
+ delete: deleteEntry,
+ clear,
+ forEach: createForEach(false, true)
+ };
+ const readonlyInstrumentations = {
+ get(key) {
+ return get$1(this, key, true);
+ },
+ get size() {
+ return size(this, true);
+ },
+ has(key) {
+ return has$1.call(this, key, true);
+ },
+ add: createReadonlyMethod("add" /* ADD */),
+ set: createReadonlyMethod("set" /* SET */),
+ delete: createReadonlyMethod("delete" /* DELETE */),
+ clear: createReadonlyMethod("clear" /* CLEAR */),
+ forEach: createForEach(true, false)
+ };
+ const shallowReadonlyInstrumentations = {
+ get(key) {
+ return get$1(this, key, true, true);
+ },
+ get size() {
+ return size(this, true);
+ },
+ has(key) {
+ return has$1.call(this, key, true);
+ },
+ add: createReadonlyMethod("add" /* ADD */),
+ set: createReadonlyMethod("set" /* SET */),
+ delete: createReadonlyMethod("delete" /* DELETE */),
+ clear: createReadonlyMethod("clear" /* CLEAR */),
+ forEach: createForEach(true, true)
+ };
+ const iteratorMethods = ['keys', 'values', 'entries', Symbol.iterator];
+ iteratorMethods.forEach(method => {
+ mutableInstrumentations[method] = createIterableMethod(method, false, false);
+ readonlyInstrumentations[method] = createIterableMethod(method, true, false);
+ shallowInstrumentations[method] = createIterableMethod(method, false, true);
+ shallowReadonlyInstrumentations[method] = createIterableMethod(method, true, true);
+ });
+ return [
+ mutableInstrumentations,
+ readonlyInstrumentations,
+ shallowInstrumentations,
+ shallowReadonlyInstrumentations
+ ];
+}
+const [mutableInstrumentations, readonlyInstrumentations, shallowInstrumentations, shallowReadonlyInstrumentations] = /* #__PURE__*/ createInstrumentations();
+function createInstrumentationGetter(isReadonly, shallow) {
+ const instrumentations = shallow
+ ? isReadonly
+ ? shallowReadonlyInstrumentations
+ : shallowInstrumentations
+ : isReadonly
+ ? readonlyInstrumentations
+ : mutableInstrumentations;
+ return (target, key, receiver) => {
+ if (key === "__v_isReactive" /* IS_REACTIVE */) {
+ return !isReadonly;
+ }
+ else if (key === "__v_isReadonly" /* IS_READONLY */) {
+ return isReadonly;
+ }
+ else if (key === "__v_raw" /* RAW */) {
+ return target;
+ }
+ return Reflect.get(hasOwn(instrumentations, key) && key in target
+ ? instrumentations
+ : target, key, receiver);
+ };
+}
+const mutableCollectionHandlers = {
+ get: /*#__PURE__*/ createInstrumentationGetter(false, false)
+};
+const shallowCollectionHandlers = {
+ get: /*#__PURE__*/ createInstrumentationGetter(false, true)
+};
+const readonlyCollectionHandlers = {
+ get: /*#__PURE__*/ createInstrumentationGetter(true, false)
+};
+const shallowReadonlyCollectionHandlers = {
+ get: /*#__PURE__*/ createInstrumentationGetter(true, true)
+};
+function checkIdentityKeys(target, has, key) {
+ const rawKey = toRaw(key);
+ if (rawKey !== key && has.call(target, rawKey)) {
+ const type = toRawType(target);
+ console.warn(`Reactive ${type} contains both the raw and reactive ` +
+ `versions of the same object${type === `Map` ? ` as keys` : ``}, ` +
+ `which can lead to inconsistencies. ` +
+ `Avoid differentiating between the raw and reactive versions ` +
+ `of an object and only use the reactive version if possible.`);
+ }
}
-class ComputedRefImpl {
- constructor(getter, _setter, isReadonly) {
- this._setter = _setter;
- this._dirty = true;
- this.__v_isRef = true;
- this.effect = effect(getter, {
- lazy: true,
- scheduler: () => {
- if (!this._dirty) {
- this._dirty = true;
- trigger(toRaw(this), 'set' /* SET */, 'value');
- }
- },
- });
- this['__v_isReadonly' /* IS_READONLY */] = isReadonly;
- }
- get value() {
- // the computed ref may get wrapped by other proxies e.g. readonly() #3376
- const self = toRaw(this);
- if (self._dirty) {
- self._value = this.effect();
- self._dirty = false;
- }
- track(self, 'get' /* GET */, 'value');
- return self._value
- }
- set value(newValue) {
- this._setter(newValue);
- }
-}
-function computed(getterOrOptions) {
- let getter;
- let setter;
- if (isFunction$1(getterOrOptions)) {
- getter = getterOrOptions;
- setter =
- process.env.NODE_ENV !== 'production'
- ? () => {
- console.warn('Write operation failed: computed value is readonly');
- }
- : NOOP;
- } else {
- getter = getterOrOptions.get;
- setter = getterOrOptions.set;
- }
- return new ComputedRefImpl(
- getter,
- setter,
- isFunction$1(getterOrOptions) || !getterOrOptions.set
- )
+const reactiveMap = new WeakMap();
+const shallowReactiveMap = new WeakMap();
+const readonlyMap = new WeakMap();
+const shallowReadonlyMap = new WeakMap();
+function targetTypeMap(rawType) {
+ switch (rawType) {
+ case 'Object':
+ case 'Array':
+ return 1 /* COMMON */;
+ case 'Map':
+ case 'Set':
+ case 'WeakMap':
+ case 'WeakSet':
+ return 2 /* COLLECTION */;
+ default:
+ return 0 /* INVALID */;
+ }
+}
+function getTargetType(value) {
+ return value["__v_skip" /* SKIP */] || !Object.isExtensible(value)
+ ? 0 /* INVALID */
+ : targetTypeMap(toRawType(value));
+}
+function reactive(target) {
+ // if trying to observe a readonly proxy, return the readonly version.
+ if (target && target["__v_isReadonly" /* IS_READONLY */]) {
+ return target;
+ }
+ return createReactiveObject(target, false, mutableHandlers, mutableCollectionHandlers, reactiveMap);
+}
+/**
+ * Return a shallowly-reactive copy of the original object, where only the root
+ * level properties are reactive. It also does not auto-unwrap refs (even at the
+ * root level).
+ */
+function shallowReactive(target) {
+ return createReactiveObject(target, false, shallowReactiveHandlers, shallowCollectionHandlers, shallowReactiveMap);
+}
+/**
+ * Creates a readonly copy of the original object. Note the returned copy is not
+ * made reactive, but `readonly` can be called on an already reactive object.
+ */
+function readonly(target) {
+ return createReactiveObject(target, true, readonlyHandlers, readonlyCollectionHandlers, readonlyMap);
+}
+/**
+ * Returns a reactive-copy of the original object, where only the root level
+ * properties are readonly, and does NOT unwrap refs nor recursively convert
+ * returned properties.
+ * This is used for creating the props proxy object for stateful components.
+ */
+function shallowReadonly(target) {
+ return createReactiveObject(target, true, shallowReadonlyHandlers, shallowReadonlyCollectionHandlers, shallowReadonlyMap);
+}
+function createReactiveObject(target, isReadonly, baseHandlers, collectionHandlers, proxyMap) {
+ if (!isObject$1(target)) {
+ if ((process.env.NODE_ENV !== 'production')) {
+ console.warn(`value cannot be made reactive: ${String(target)}`);
+ }
+ return target;
+ }
+ // target is already a Proxy, return it.
+ // exception: calling readonly() on a reactive object
+ if (target["__v_raw" /* RAW */] &&
+ !(isReadonly && target["__v_isReactive" /* IS_REACTIVE */])) {
+ return target;
+ }
+ // target already has corresponding Proxy
+ const existingProxy = proxyMap.get(target);
+ if (existingProxy) {
+ return existingProxy;
+ }
+ // only a whitelist of value types can be observed.
+ const targetType = getTargetType(target);
+ if (targetType === 0 /* INVALID */) {
+ return target;
+ }
+ const proxy = new Proxy(target, targetType === 2 /* COLLECTION */ ? collectionHandlers : baseHandlers);
+ proxyMap.set(target, proxy);
+ return proxy;
+}
+function isReactive(value) {
+ if (isReadonly(value)) {
+ return isReactive(value["__v_raw" /* RAW */]);
+ }
+ return !!(value && value["__v_isReactive" /* IS_REACTIVE */]);
+}
+function isReadonly(value) {
+ return !!(value && value["__v_isReadonly" /* IS_READONLY */]);
+}
+function isProxy(value) {
+ return isReactive(value) || isReadonly(value);
+}
+function toRaw(observed) {
+ return ((observed && toRaw(observed["__v_raw" /* RAW */])) || observed);
+}
+function markRaw(value) {
+ def(value, "__v_skip" /* SKIP */, true);
+ return value;
}
-const stack = [];
-function pushWarningContext(vnode) {
- stack.push(vnode);
-}
-function popWarningContext() {
- stack.pop();
-}
-function warn(msg, ...args) {
- // avoid props formatting or warn handler tracking deps that might be mutated
- // during patch, leading to infinite recursion.
- pauseTracking();
- const instance = stack.length ? stack[stack.length - 1].component : null;
- const appWarnHandler = instance && instance.appContext.config.warnHandler;
- const trace = getComponentTrace();
- if (appWarnHandler) {
- callWithErrorHandling(appWarnHandler, instance, 11 /* APP_WARN_HANDLER */, [
- msg + args.join(''),
- instance && instance.proxy,
- trace
- .map(({ vnode }) => `at <${formatComponentName(instance, vnode.type)}>`)
- .join('\n'),
- trace,
- ]);
- } else {
- const warnArgs = [`[Vue warn]: ${msg}`, ...args];
- /* istanbul ignore if */
- if (
- trace.length &&
- // avoid spamming console during tests
- !false
- ) {
- warnArgs.push(`\n`, ...formatTrace(trace));
- }
- console.warn(...warnArgs);
- }
- resetTracking();
-}
-function getComponentTrace() {
- let currentVNode = stack[stack.length - 1];
- if (!currentVNode) {
- return []
- }
- // we can't just use the stack because it will be incomplete during updates
- // that did not start from the root. Re-construct the parent chain using
- // instance parent pointers.
- const normalizedStack = [];
- while (currentVNode) {
- const last = normalizedStack[0];
- if (last && last.vnode === currentVNode) {
- last.recurseCount++;
- } else {
- normalizedStack.push({
- vnode: currentVNode,
- recurseCount: 0,
- });
- }
- const parentInstance =
- currentVNode.component && currentVNode.component.parent;
- currentVNode = parentInstance && parentInstance.vnode;
- }
- return normalizedStack
-}
-/* istanbul ignore next */
-function formatTrace(trace) {
- const logs = [];
- trace.forEach((entry, i) => {
- logs.push(...(i === 0 ? [] : [`\n`]), ...formatTraceEntry(entry));
- });
- return logs
-}
-function formatTraceEntry({ vnode, recurseCount }) {
- const postfix =
- recurseCount > 0 ? `... (${recurseCount} recursive calls)` : ``;
- const isRoot = vnode.component ? vnode.component.parent == null : false;
- const open = ` at <${formatComponentName(
- vnode.component,
- vnode.type,
- isRoot
- )}`;
- const close = `>` + postfix;
- return vnode.props
- ? [open, ...formatProps(vnode.props), close]
- : [open + close]
-}
-/* istanbul ignore next */
-function formatProps(props) {
- const res = [];
- const keys = Object.keys(props);
- keys.slice(0, 3).forEach((key) => {
- res.push(...formatProp(key, props[key]));
- });
- if (keys.length > 3) {
- res.push(` ...`);
- }
- return res
-}
-/* istanbul ignore next */
-function formatProp(key, value, raw) {
- if (isString(value)) {
- value = JSON.stringify(value);
- return raw ? value : [`${key}=${value}`]
- } else if (
- typeof value === 'number' ||
- typeof value === 'boolean' ||
- value == null
- ) {
- return raw ? value : [`${key}=${value}`]
- } else if (isRef(value)) {
- value = formatProp(key, toRaw(value.value), true);
- return raw ? value : [`${key}=Ref<`, value, `>`]
- } else if (isFunction$1(value)) {
- return [`${key}=fn${value.name ? `<${value.name}>` : ``}`]
- } else {
- value = toRaw(value);
- return raw ? value : [`${key}=`, value]
- }
+const convert = (val) => isObject$1(val) ? reactive(val) : val;
+function isRef(r) {
+ return Boolean(r && r.__v_isRef === true);
+}
+function ref(value) {
+ return createRef(value);
+}
+function shallowRef(value) {
+ return createRef(value, true);
+}
+class RefImpl {
+ constructor(_rawValue, _shallow) {
+ this._rawValue = _rawValue;
+ this._shallow = _shallow;
+ this.__v_isRef = true;
+ this._value = _shallow ? _rawValue : convert(_rawValue);
+ }
+ get value() {
+ track(toRaw(this), "get" /* GET */, 'value');
+ return this._value;
+ }
+ set value(newVal) {
+ if (hasChanged(toRaw(newVal), this._rawValue)) {
+ this._rawValue = newVal;
+ this._value = this._shallow ? newVal : convert(newVal);
+ trigger(toRaw(this), "set" /* SET */, 'value', newVal);
+ }
+ }
+}
+function createRef(rawValue, shallow = false) {
+ if (isRef(rawValue)) {
+ return rawValue;
+ }
+ return new RefImpl(rawValue, shallow);
+}
+function triggerRef(ref) {
+ trigger(toRaw(ref), "set" /* SET */, 'value', (process.env.NODE_ENV !== 'production') ? ref.value : void 0);
+}
+function unref(ref) {
+ return isRef(ref) ? ref.value : ref;
+}
+const shallowUnwrapHandlers = {
+ get: (target, key, receiver) => unref(Reflect.get(target, key, receiver)),
+ set: (target, key, value, receiver) => {
+ const oldValue = target[key];
+ if (isRef(oldValue) && !isRef(value)) {
+ oldValue.value = value;
+ return true;
+ }
+ else {
+ return Reflect.set(target, key, value, receiver);
+ }
+ }
+};
+function proxyRefs(objectWithRefs) {
+ return isReactive(objectWithRefs)
+ ? objectWithRefs
+ : new Proxy(objectWithRefs, shallowUnwrapHandlers);
+}
+class CustomRefImpl {
+ constructor(factory) {
+ this.__v_isRef = true;
+ const { get, set } = factory(() => track(this, "get" /* GET */, 'value'), () => trigger(this, "set" /* SET */, 'value'));
+ this._get = get;
+ this._set = set;
+ }
+ get value() {
+ return this._get();
+ }
+ set value(newVal) {
+ this._set(newVal);
+ }
+}
+function customRef(factory) {
+ return new CustomRefImpl(factory);
+}
+function toRefs(object) {
+ if ((process.env.NODE_ENV !== 'production') && !isProxy(object)) {
+ console.warn(`toRefs() expects a reactive object but received a plain one.`);
+ }
+ const ret = isArray(object) ? new Array(object.length) : {};
+ for (const key in object) {
+ ret[key] = toRef(object, key);
+ }
+ return ret;
+}
+class ObjectRefImpl {
+ constructor(_object, _key) {
+ this._object = _object;
+ this._key = _key;
+ this.__v_isRef = true;
+ }
+ get value() {
+ return this._object[this._key];
+ }
+ set value(newVal) {
+ this._object[this._key] = newVal;
+ }
+}
+function toRef(object, key) {
+ return isRef(object[key])
+ ? object[key]
+ : new ObjectRefImpl(object, key);
}
-const ErrorTypeStrings = {
- ['sp' /* SERVER_PREFETCH */]: 'serverPrefetch hook',
- ['bc' /* BEFORE_CREATE */]: 'beforeCreate hook',
- ['c' /* CREATED */]: 'created hook',
- ['bm' /* BEFORE_MOUNT */]: 'beforeMount hook',
- ['m' /* MOUNTED */]: 'mounted hook',
- ['bu' /* BEFORE_UPDATE */]: 'beforeUpdate hook',
- ['u' /* UPDATED */]: 'updated',
- ['bum' /* BEFORE_UNMOUNT */]: 'beforeUnmount hook',
- ['um' /* UNMOUNTED */]: 'unmounted hook',
- ['a' /* ACTIVATED */]: 'activated hook',
- ['da' /* DEACTIVATED */]: 'deactivated hook',
- ['ec' /* ERROR_CAPTURED */]: 'errorCaptured hook',
- ['rtc' /* RENDER_TRACKED */]: 'renderTracked hook',
- ['rtg' /* RENDER_TRIGGERED */]: 'renderTriggered hook',
- [0 /* SETUP_FUNCTION */]: 'setup function',
- [1 /* RENDER_FUNCTION */]: 'render function',
- [2 /* WATCH_GETTER */]: 'watcher getter',
- [3 /* WATCH_CALLBACK */]: 'watcher callback',
- [4 /* WATCH_CLEANUP */]: 'watcher cleanup function',
- [5 /* NATIVE_EVENT_HANDLER */]: 'native event handler',
- [6 /* COMPONENT_EVENT_HANDLER */]: 'component event handler',
- [7 /* VNODE_HOOK */]: 'vnode hook',
- [8 /* DIRECTIVE_HOOK */]: 'directive hook',
- [9 /* TRANSITION_HOOK */]: 'transition hook',
- [10 /* APP_ERROR_HANDLER */]: 'app errorHandler',
- [11 /* APP_WARN_HANDLER */]: 'app warnHandler',
- [12 /* FUNCTION_REF */]: 'ref function',
- [13 /* ASYNC_COMPONENT_LOADER */]: 'async component loader',
- [14 /* SCHEDULER */]:
- 'scheduler flush. This is likely a Vue internals bug. ' +
- 'Please open an issue at https://new-issue.vuejs.org/?repo=vuejs/vue-next',
-};
-function callWithErrorHandling(fn, instance, type, args) {
- let res;
- try {
- res = args ? fn(...args) : fn();
- } catch (err) {
- handleError(err, instance, type);
- }
- return res
-}
-function callWithAsyncErrorHandling(fn, instance, type, args) {
- if (isFunction$1(fn)) {
- const res = callWithErrorHandling(fn, instance, type, args);
- if (res && isPromise$1(res)) {
- res.catch((err) => {
- handleError(err, instance, type);
- });
- }
- return res
- }
- const values = [];
- for (let i = 0; i < fn.length; i++) {
- values.push(callWithAsyncErrorHandling(fn[i], instance, type, args));
- }
- return values
-}
-function handleError(err, instance, type, throwInDev = true) {
- const contextVNode = instance ? instance.vnode : null;
- if (instance) {
- let cur = instance.parent;
- // the exposed instance is the render proxy to keep it consistent with 2.x
- const exposedInstance = instance.proxy;
- // in production the hook receives only the error code
- const errorInfo =
- process.env.NODE_ENV !== 'production' ? ErrorTypeStrings[type] : type;
- while (cur) {
- const errorCapturedHooks = cur.ec;
- if (errorCapturedHooks) {
- for (let i = 0; i < errorCapturedHooks.length; i++) {
- if (
- errorCapturedHooks[i](err, exposedInstance, errorInfo) === false
- ) {
- return
- }
- }
- }
- cur = cur.parent;
- }
- // app-level handling
- const appErrorHandler = instance.appContext.config.errorHandler;
- if (appErrorHandler) {
- callWithErrorHandling(appErrorHandler, null, 10 /* APP_ERROR_HANDLER */, [
- err,
- exposedInstance,
- errorInfo,
- ]);
- return
- }
- }
- logError(err, type, contextVNode, throwInDev);
-}
-function logError(err, type, contextVNode, throwInDev = true) {
- if (process.env.NODE_ENV !== 'production') {
- const info = ErrorTypeStrings[type];
- if (contextVNode) {
- pushWarningContext(contextVNode);
- }
- warn(`Unhandled error${info ? ` during execution of ${info}` : ``}`);
- if (contextVNode) {
- popWarningContext();
- }
- // crash in dev by default so it's more noticeable
- if (throwInDev) {
- throw err
- } else {
- console.error(err);
- }
- } else {
- // recover in prod to reduce the impact on end-user
- console.error(err);
- }
+class ComputedRefImpl {
+ constructor(getter, _setter, isReadonly) {
+ this._setter = _setter;
+ this._dirty = true;
+ this.__v_isRef = true;
+ this.effect = effect(getter, {
+ lazy: true,
+ scheduler: () => {
+ if (!this._dirty) {
+ this._dirty = true;
+ trigger(toRaw(this), "set" /* SET */, 'value');
+ }
+ }
+ });
+ this["__v_isReadonly" /* IS_READONLY */] = isReadonly;
+ }
+ get value() {
+ // the computed ref may get wrapped by other proxies e.g. readonly() #3376
+ const self = toRaw(this);
+ if (self._dirty) {
+ self._value = this.effect();
+ self._dirty = false;
+ }
+ track(self, "get" /* GET */, 'value');
+ return self._value;
+ }
+ set value(newValue) {
+ this._setter(newValue);
+ }
+}
+function computed(getterOrOptions) {
+ let getter;
+ let setter;
+ if (isFunction$1(getterOrOptions)) {
+ getter = getterOrOptions;
+ setter = (process.env.NODE_ENV !== 'production')
+ ? () => {
+ console.warn('Write operation failed: computed value is readonly');
+ }
+ : NOOP;
+ }
+ else {
+ getter = getterOrOptions.get;
+ setter = getterOrOptions.set;
+ }
+ return new ComputedRefImpl(getter, setter, isFunction$1(getterOrOptions) || !getterOrOptions.set);
}
-let isFlushing = false;
-let isFlushPending = false;
-const queue = [];
-let flushIndex = 0;
-const pendingPreFlushCbs = [];
-let activePreFlushCbs = null;
-let preFlushIndex = 0;
-const pendingPostFlushCbs = [];
-let activePostFlushCbs = null;
-let postFlushIndex = 0;
-const resolvedPromise = Promise.resolve();
-let currentFlushPromise = null;
-let currentPreFlushParentJob = null;
-const RECURSION_LIMIT = 100;
-function nextTick(fn) {
- const p = currentFlushPromise || resolvedPromise;
- return fn ? p.then(this ? fn.bind(this) : fn) : p
-}
-// #2768
-// Use binary-search to find a suitable position in the queue,
-// so that the queue maintains the increasing order of job's id,
-// which can prevent the job from being skipped and also can avoid repeated patching.
-function findInsertionIndex(job) {
- // the start index should be `flushIndex + 1`
- let start = flushIndex + 1;
- let end = queue.length;
- const jobId = getId(job);
- while (start < end) {
- const middle = (start + end) >>> 1;
- const middleJobId = getId(queue[middle]);
- middleJobId < jobId ? (start = middle + 1) : (end = middle);
- }
- return start
-}
-function queueJob(job) {
- // the dedupe search uses the startIndex argument of Array.includes()
- // by default the search index includes the current job that is being run
- // so it cannot recursively trigger itself again.
- // if the job is a watch() callback, the search will start with a +1 index to
- // allow it recursively trigger itself - it is the user's responsibility to
- // ensure it doesn't end up in an infinite loop.
- if (
- (!queue.length ||
- !queue.includes(
- job,
- isFlushing && job.allowRecurse ? flushIndex + 1 : flushIndex
- )) &&
- job !== currentPreFlushParentJob
- ) {
- const pos = findInsertionIndex(job);
- if (pos > -1) {
- queue.splice(pos, 0, job);
- } else {
- queue.push(job);
- }
- queueFlush();
- }
-}
-function queueFlush() {
- if (!isFlushing && !isFlushPending) {
- isFlushPending = true;
- currentFlushPromise = resolvedPromise.then(flushJobs);
- }
-}
-function invalidateJob(job) {
- const i = queue.indexOf(job);
- if (i > flushIndex) {
- queue.splice(i, 1);
- }
-}
-function queueCb(cb, activeQueue, pendingQueue, index) {
- if (!isArray(cb)) {
- if (
- !activeQueue ||
- !activeQueue.includes(cb, cb.allowRecurse ? index + 1 : index)
- ) {
- pendingQueue.push(cb);
- }
- } else {
- // if cb is an array, it is a component lifecycle hook which can only be
- // triggered by a job, which is already deduped in the main queue, so
- // we can skip duplicate check here to improve perf
- pendingQueue.push(...cb);
- }
- queueFlush();
-}
-function queuePreFlushCb(cb) {
- queueCb(cb, activePreFlushCbs, pendingPreFlushCbs, preFlushIndex);
-}
-function queuePostFlushCb(cb) {
- queueCb(cb, activePostFlushCbs, pendingPostFlushCbs, postFlushIndex);
-}
-function flushPreFlushCbs(seen, parentJob = null) {
- if (pendingPreFlushCbs.length) {
- currentPreFlushParentJob = parentJob;
- activePreFlushCbs = [...new Set(pendingPreFlushCbs)];
- pendingPreFlushCbs.length = 0;
- if (process.env.NODE_ENV !== 'production') {
- seen = seen || new Map();
- }
- for (
- preFlushIndex = 0;
- preFlushIndex < activePreFlushCbs.length;
- preFlushIndex++
- ) {
- if (
- process.env.NODE_ENV !== 'production' &&
- checkRecursiveUpdates(seen, activePreFlushCbs[preFlushIndex])
- ) {
- continue
- }
- activePreFlushCbs[preFlushIndex]();
- }
- activePreFlushCbs = null;
- preFlushIndex = 0;
- currentPreFlushParentJob = null;
- // recursively flush until it drains
- flushPreFlushCbs(seen, parentJob);
- }
-}
-function flushPostFlushCbs(seen) {
- if (pendingPostFlushCbs.length) {
- const deduped = [...new Set(pendingPostFlushCbs)];
- pendingPostFlushCbs.length = 0;
- // #1947 already has active queue, nested flushPostFlushCbs call
- if (activePostFlushCbs) {
- activePostFlushCbs.push(...deduped);
- return
- }
- activePostFlushCbs = deduped;
- if (process.env.NODE_ENV !== 'production') {
- seen = seen || new Map();
- }
- activePostFlushCbs.sort((a, b) => getId(a) - getId(b));
- for (
- postFlushIndex = 0;
- postFlushIndex < activePostFlushCbs.length;
- postFlushIndex++
- ) {
- if (
- process.env.NODE_ENV !== 'production' &&
- checkRecursiveUpdates(seen, activePostFlushCbs[postFlushIndex])
- ) {
- continue
- }
- activePostFlushCbs[postFlushIndex]();
- }
- activePostFlushCbs = null;
- postFlushIndex = 0;
- }
-}
-const getId = (job) => (job.id == null ? Infinity : job.id);
-function flushJobs(seen) {
- isFlushPending = false;
- isFlushing = true;
- if (process.env.NODE_ENV !== 'production') {
- seen = seen || new Map();
- }
- flushPreFlushCbs(seen);
- // Sort queue before flush.
- // This ensures that:
- // 1. Components are updated from parent to child. (because parent is always
- // created before the child so its render effect will have smaller
- // priority number)
- // 2. If a component is unmounted during a parent component's update,
- // its update can be skipped.
- queue.sort((a, b) => getId(a) - getId(b));
- try {
- for (flushIndex = 0; flushIndex < queue.length; flushIndex++) {
- const job = queue[flushIndex];
- if (job && job.active !== false) {
- if (
- process.env.NODE_ENV !== 'production' &&
- checkRecursiveUpdates(seen, job)
- ) {
- continue
- }
- callWithErrorHandling(job, null, 14 /* SCHEDULER */);
- }
- }
- } finally {
- flushIndex = 0;
- queue.length = 0;
- flushPostFlushCbs(seen);
- isFlushing = false;
- currentFlushPromise = null;
- // some postFlushCb queued jobs!
- // keep flushing until it drains.
- if (
- queue.length ||
- pendingPreFlushCbs.length ||
- pendingPostFlushCbs.length
- ) {
- flushJobs(seen);
- }
- }
-}
-function checkRecursiveUpdates(seen, fn) {
- if (!seen.has(fn)) {
- seen.set(fn, 1);
- } else {
- const count = seen.get(fn);
- if (count > RECURSION_LIMIT) {
- const instance = fn.ownerInstance;
- const componentName = instance && getComponentName(instance.type);
- warn(
- `Maximum recursive updates exceeded${
- componentName ? ` in component <${componentName}>` : ``
- }. ` +
- `This means you have a reactive effect that is mutating its own ` +
- `dependencies and thus recursively triggering itself. Possible sources ` +
- `include component template, render function, updated hook or ` +
- `watcher source function.`
- );
- return true
- } else {
- seen.set(fn, count + 1);
- }
- }
-}
-
-/* eslint-disable no-restricted-globals */
-let isHmrUpdating = false;
-const hmrDirtyComponents = new Set();
-// Expose the HMR runtime on the window object
-// This makes it entirely tree-shakable without polluting the exports and makes
-// it easier to be used in toolings like vue-loader
-// Note: for a component to be eligible for HMR it also needs the __hmrId option
-// to be set so that its instances can be registered / removed.
-if (process.env.NODE_ENV !== 'production') {
- const globalObject =
- typeof window !== 'undefined'
- ? window
- : typeof self !== 'undefined'
- ? self
- : typeof window !== 'undefined'
- ? window
- : {};
- globalObject.__VUE_HMR_RUNTIME__ = {
- createRecord: tryWrap(createRecord),
- rerender: tryWrap(rerender),
- reload: tryWrap(reload),
- };
-}
-const map = new Map();
-function registerHMR(instance) {
- const id = instance.type.__hmrId;
- let record = map.get(id);
- if (!record) {
- createRecord(id, instance.type);
- record = map.get(id);
- }
- record.instances.add(instance);
-}
-function unregisterHMR(instance) {
- map.get(instance.type.__hmrId).instances.delete(instance);
-}
-function createRecord(id, component) {
- if (!component) {
- warn(
- `HMR API usage is out of date.\n` +
- `Please upgrade vue-loader/vite/rollup-plugin-vue or other relevant ` +
- `dependency that handles Vue SFC compilation.`
- );
- component = {};
- }
- if (map.has(id)) {
- return false
- }
- map.set(id, {
- component: isClassComponent(component) ? component.__vccOpts : component,
- instances: new Set(),
- });
- return true
-}
-function rerender(id, newRender) {
- const record = map.get(id);
- if (!record) return
- if (newRender) record.component.render = newRender;
- // Array.from creates a snapshot which avoids the set being mutated during
- // updates
- Array.from(record.instances).forEach((instance) => {
- if (newRender) {
- instance.render = newRender;
- }
- instance.renderCache = [];
- // this flag forces child components with slot content to update
- isHmrUpdating = true;
- instance.update();
- isHmrUpdating = false;
- });
-}
-function reload(id, newComp) {
- const record = map.get(id);
- if (!record) return
- // Array.from creates a snapshot which avoids the set being mutated during
- // updates
- const { component, instances } = record;
- if (!hmrDirtyComponents.has(component)) {
- // 1. Update existing comp definition to match new one
- newComp = isClassComponent(newComp) ? newComp.__vccOpts : newComp;
- extend(component, newComp);
- for (const key in component) {
- if (key !== '__file' && !(key in newComp)) {
- delete component[key];
- }
- }
- // 2. Mark component dirty. This forces the renderer to replace the component
- // on patch.
- hmrDirtyComponents.add(component);
- // 3. Make sure to unmark the component after the reload.
- queuePostFlushCb(() => {
- hmrDirtyComponents.delete(component);
- });
- }
- Array.from(instances).forEach((instance) => {
- if (instance.parent) {
- // 4. Force the parent instance to re-render. This will cause all updated
- // components to be unmounted and re-mounted. Queue the update so that we
- // don't end up forcing the same parent to re-render multiple times.
- queueJob(instance.parent.update);
- } else if (instance.appContext.reload) {
- // root instance mounted via createApp() has a reload method
- instance.appContext.reload();
- } else if (typeof window !== 'undefined') {
- // root instance inside tree created via raw render(). Force reload.
- window.location.reload();
- } else {
- console.warn(
- '[HMR] Root or manually mounted instance modified. Full reload required.'
- );
- }
- });
-}
-function tryWrap(fn) {
- return (id, arg) => {
- try {
- return fn(id, arg)
- } catch (e) {
- console.error(e);
- console.warn(
- `[HMR] Something went wrong during Vue component hot-reload. ` +
- `Full reload required.`
- );
- }
- }
-}
-
-let devtools;
-function setDevtoolsHook(hook) {
- devtools = hook;
-}
-function devtoolsInitApp(app, version) {
- // TODO queue if devtools is undefined
- if (!devtools) return
- devtools.emit('app:init' /* APP_INIT */, app, version, {
- Fragment,
- Text,
- Comment: Comment$1,
- Static,
- });
-}
-function devtoolsUnmountApp(app) {
- if (!devtools) return
- devtools.emit('app:unmount' /* APP_UNMOUNT */, app);
-}
-const devtoolsComponentAdded = /*#__PURE__*/ createDevtoolsComponentHook(
- 'component:added' /* COMPONENT_ADDED */
-);
-const devtoolsComponentUpdated = /*#__PURE__*/ createDevtoolsComponentHook(
- 'component:updated' /* COMPONENT_UPDATED */
-);
-const devtoolsComponentRemoved = /*#__PURE__*/ createDevtoolsComponentHook(
- 'component:removed' /* COMPONENT_REMOVED */
-);
-function createDevtoolsComponentHook(hook) {
- return (component) => {
- if (!devtools) return
- devtools.emit(
- hook,
- component.appContext.app,
- component.uid,
- component.parent ? component.parent.uid : undefined,
- component
- );
- }
-}
-const devtoolsPerfStart = /*#__PURE__*/ createDevtoolsPerformanceHook(
- 'perf:start' /* PERFORMANCE_START */
-);
-const devtoolsPerfEnd = /*#__PURE__*/ createDevtoolsPerformanceHook(
- 'perf:end' /* PERFORMANCE_END */
-);
-function createDevtoolsPerformanceHook(hook) {
- return (component, type, time) => {
- if (!devtools) return
- devtools.emit(
- hook,
- component.appContext.app,
- component.uid,
- component,
- type,
- time
- );
- }
-}
-function devtoolsComponentEmit(component, event, params) {
- if (!devtools) return
- devtools.emit(
- 'component:emit' /* COMPONENT_EMIT */,
- component.appContext.app,
- component,
- event,
- params
- );
-}
-const globalCompatConfig = {
- MODE: 2,
-};
-function getCompatConfigForKey(key, instance) {
- const instanceConfig = instance && instance.type.compatConfig;
- if (instanceConfig && key in instanceConfig) {
- return instanceConfig[key]
- }
- return globalCompatConfig[key]
-}
-function isCompatEnabled(key, instance, enableForBuiltIn = false) {
- // skip compat for built-in components
- if (!enableForBuiltIn && instance && instance.type.__isBuiltIn) {
- return false
- }
- const rawMode = getCompatConfigForKey('MODE', instance) || 2;
- const val = getCompatConfigForKey(key, instance);
- const mode = isFunction$1(rawMode)
- ? rawMode(instance && instance.type)
- : rawMode;
- if (mode === 2) {
- return val !== false
- } else {
- return val === true || val === 'suppress-warning'
- }
-}
-
-function emit(instance, event, ...rawArgs) {
- const props = instance.vnode.props || EMPTY_OBJ;
- if (process.env.NODE_ENV !== 'production') {
- const {
- emitsOptions,
- propsOptions: [propsOptions],
- } = instance;
- if (emitsOptions) {
- if (!(event in emitsOptions) && !false) {
- if (!propsOptions || !(toHandlerKey(event) in propsOptions)) {
- warn(
- `Component emitted event "${event}" but it is neither declared in ` +
- `the emits option nor as an "${toHandlerKey(event)}" prop.`
- );
- }
- } else {
- const validator = emitsOptions[event];
- if (isFunction$1(validator)) {
- const isValid = validator(...rawArgs);
- if (!isValid) {
- warn(
- `Invalid event arguments: event validation failed for event "${event}".`
- );
- }
- }
- }
- }
- }
- let args = rawArgs;
- const isModelListener = event.startsWith('update:');
- // for v-model update:xxx events, apply modifiers on args
- const modelArg = isModelListener && event.slice(7);
- if (modelArg && modelArg in props) {
- const modifiersKey = `${
- modelArg === 'modelValue' ? 'model' : modelArg
- }Modifiers`;
- const { number, trim } = props[modifiersKey] || EMPTY_OBJ;
- if (trim) {
- args = rawArgs.map((a) => a.trim());
- } else if (number) {
- args = rawArgs.map(toNumber);
- }
- }
- if (process.env.NODE_ENV !== 'production' || false) {
- devtoolsComponentEmit(instance, event, args);
- }
- if (process.env.NODE_ENV !== 'production') {
- const lowerCaseEvent = event.toLowerCase();
- if (lowerCaseEvent !== event && props[toHandlerKey(lowerCaseEvent)]) {
- warn(
- `Event "${lowerCaseEvent}" is emitted in component ` +
- `${formatComponentName(
- instance,
- instance.type
- )} but the handler is registered for "${event}". ` +
- `Note that HTML attributes are case-insensitive and you cannot use ` +
- `v-on to listen to camelCase events when using in-DOM templates. ` +
- `You should probably use "${hyphenate(event)}" instead of "${event}".`
- );
- }
- }
- let handlerName;
- let handler =
- props[(handlerName = toHandlerKey(event))] ||
- // also try camelCase event handler (#2249)
- props[(handlerName = toHandlerKey(camelize(event)))];
- // for v-model update:xxx events, also trigger kebab-case equivalent
- // for props passed via kebab-case
- if (!handler && isModelListener) {
- handler = props[(handlerName = toHandlerKey(hyphenate(event)))];
- }
- if (handler) {
- callWithAsyncErrorHandling(
- handler,
- instance,
- 6 /* COMPONENT_EVENT_HANDLER */,
- args
- );
- }
- const onceHandler = props[handlerName + `Once`];
- if (onceHandler) {
- if (!instance.emitted) {
- instance.emitted = {};
- } else if (instance.emitted[handlerName]) {
- return
- }
- instance.emitted[handlerName] = true;
- callWithAsyncErrorHandling(
- onceHandler,
- instance,
- 6 /* COMPONENT_EVENT_HANDLER */,
- args
- );
- }
-}
-function normalizeEmitsOptions(comp, appContext, asMixin = false) {
- const cache = appContext.emitsCache;
- const cached = cache.get(comp);
- if (cached !== undefined) {
- return cached
- }
- const raw = comp.emits;
- let normalized = {};
- // apply mixin/extends props
- let hasExtends = false;
- if (!isFunction$1(comp)) {
- const extendEmits = (raw) => {
- const normalizedFromExtend = normalizeEmitsOptions(raw, appContext, true);
- if (normalizedFromExtend) {
- hasExtends = true;
- extend(normalized, normalizedFromExtend);
- }
- };
- if (!asMixin && appContext.mixins.length) {
- appContext.mixins.forEach(extendEmits);
- }
- if (comp.extends) {
- extendEmits(comp.extends);
- }
- if (comp.mixins) {
- comp.mixins.forEach(extendEmits);
- }
- }
- if (!raw && !hasExtends) {
- cache.set(comp, null);
- return null
- }
- if (isArray(raw)) {
- raw.forEach((key) => (normalized[key] = null));
- } else {
- extend(normalized, raw);
- }
- cache.set(comp, normalized);
- return normalized
-}
-// Check if an incoming prop key is a declared emit event listener.
-// e.g. With `emits: { click: null }`, props named `onClick` and `onclick` are
-// both considered matched listeners.
-function isEmitListener(options, key) {
- if (!options || !isOn(key)) {
- return false
- }
- key = key.slice(2).replace(/Once$/, '');
- return (
- hasOwn(options, key[0].toLowerCase() + key.slice(1)) ||
- hasOwn(options, hyphenate(key)) ||
- hasOwn(options, key)
- )
-}
-
-/**
- * mark the current rendering instance for asset resolution (e.g.
- * resolveComponent, resolveDirective) during render
- */
-let currentRenderingInstance = null;
-let currentScopeId = null;
-/**
- * Note: rendering calls maybe nested. The function returns the parent rendering
- * instance if present, which should be restored after the render is done:
- *
- * ```js
- * const prev = setCurrentRenderingInstance(i)
- * // ...render
- * setCurrentRenderingInstance(prev)
- * ```
- */
-function setCurrentRenderingInstance(instance) {
- const prev = currentRenderingInstance;
- currentRenderingInstance = instance;
- currentScopeId = (instance && instance.type.__scopeId) || null;
- return prev
-}
-/**
- * Set scope id when creating hoisted vnodes.
- * @private compiler helper
- */
-function pushScopeId(id) {
- currentScopeId = id;
-}
-/**
- * Technically we no longer need this after 3.0.8 but we need to keep the same
- * API for backwards compat w/ code generated by compilers.
- * @private
- */
-function popScopeId() {
- currentScopeId = null;
-}
-/**
- * Only for backwards compat
- * @private
- */
-const withScopeId = (_id) => withCtx;
-/**
- * Wrap a slot function to memoize current rendering instance
- * @private compiler helper
- */
-function withCtx(
- fn,
- ctx = currentRenderingInstance,
- isNonScopedSlot // false only
-) {
- if (!ctx) return fn
- // already normalized
- if (fn._n) {
- return fn
- }
- const renderFnWithContext = (...args) => {
- // If a user calls a compiled slot inside a template expression (#1745), it
- // can mess up block tracking, so by default we disable block tracking and
- // force bail out when invoking a compiled slot (indicated by the ._d flag).
- // This isn't necessary if rendering a compiled ``, so we flip the
- // ._d flag off when invoking the wrapped fn inside `renderSlot`.
- if (renderFnWithContext._d) {
- setBlockTracking(-1);
- }
- const prevInstance = setCurrentRenderingInstance(ctx);
- const res = fn(...args);
- setCurrentRenderingInstance(prevInstance);
- if (renderFnWithContext._d) {
- setBlockTracking(1);
- }
- if (process.env.NODE_ENV !== 'production' || false) {
- devtoolsComponentUpdated(ctx);
- }
- return res
- };
- // mark normalized to avoid duplicated wrapping
- renderFnWithContext._n = true;
- // mark this as compiled by default
- // this is used in vnode.ts -> normalizeChildren() to set the slot
- // rendering flag.
- renderFnWithContext._c = true;
- // disable block tracking by default
- renderFnWithContext._d = true;
- return renderFnWithContext
-}
-
-/**
- * dev only flag to track whether $attrs was used during render.
- * If $attrs was used during render then the warning for failed attrs
- * fallthrough can be suppressed.
- */
-let accessedAttrs = false;
-function markAttrsAccessed() {
- accessedAttrs = true;
-}
-function renderComponentRoot(instance) {
- const {
- type: Component,
- vnode,
- proxy,
- withProxy,
- props,
- propsOptions: [propsOptions],
- slots,
- attrs,
- emit,
- render,
- renderCache,
- data,
- setupState,
- ctx,
- inheritAttrs,
- } = instance;
- let result;
- const prev = setCurrentRenderingInstance(instance);
- if (process.env.NODE_ENV !== 'production') {
- accessedAttrs = false;
- }
- try {
- let fallthroughAttrs;
- if (vnode.shapeFlag & 4 /* STATEFUL_COMPONENT */) {
- // withProxy is a proxy with a different `has` trap only for
- // runtime-compiled render functions using `with` block.
- const proxyToUse = withProxy || proxy;
- result = normalizeVNode(
- render.call(
- proxyToUse,
- proxyToUse,
- renderCache,
- props,
- setupState,
- data,
- ctx
- )
- );
- fallthroughAttrs = attrs;
- } else {
- // functional
- const render = Component;
- // in dev, mark attrs accessed if optional props (attrs === props)
- if (process.env.NODE_ENV !== 'production' && attrs === props) {
- markAttrsAccessed();
- }
- result = normalizeVNode(
- render.length > 1
- ? render(
- props,
- process.env.NODE_ENV !== 'production'
- ? {
- get attrs() {
- markAttrsAccessed();
- return attrs
- },
- slots,
- emit,
- }
- : { attrs, slots, emit }
- )
- : render(props, null /* we know it doesn't need it */)
- );
- fallthroughAttrs = Component.props
- ? attrs
- : getFunctionalFallthrough(attrs);
- }
- // attr merging
- // in dev mode, comments are preserved, and it's possible for a template
- // to have comments along side the root element which makes it a fragment
- let root = result;
- let setRoot = undefined;
- if (
- process.env.NODE_ENV !== 'production' &&
- result.patchFlag > 0 &&
- result.patchFlag & 2048 /* DEV_ROOT_FRAGMENT */
- ) {
- ;[root, setRoot] = getChildRoot(result);
- }
- if (fallthroughAttrs && inheritAttrs !== false) {
- const keys = Object.keys(fallthroughAttrs);
- const { shapeFlag } = root;
- if (keys.length) {
- if (shapeFlag & 1 /* ELEMENT */ || shapeFlag & 6 /* COMPONENT */) {
- if (propsOptions && keys.some(isModelListener)) {
- // If a v-model listener (onUpdate:xxx) has a corresponding declared
- // prop, it indicates this component expects to handle v-model and
- // it should not fallthrough.
- // related: #1543, #1643, #1989
- fallthroughAttrs = filterModelListeners(
- fallthroughAttrs,
- propsOptions
- );
- }
- root = cloneVNode(root, fallthroughAttrs);
- } else if (
- process.env.NODE_ENV !== 'production' &&
- !accessedAttrs &&
- root.type !== Comment$1
- ) {
- const allAttrs = Object.keys(attrs);
- const eventAttrs = [];
- const extraAttrs = [];
- for (let i = 0, l = allAttrs.length; i < l; i++) {
- const key = allAttrs[i];
- if (isOn(key)) {
- // ignore v-model handlers when they fail to fallthrough
- if (!isModelListener(key)) {
- // remove `on`, lowercase first letter to reflect event casing
- // accurately
- eventAttrs.push(key[2].toLowerCase() + key.slice(3));
- }
- } else {
- extraAttrs.push(key);
- }
- }
- if (extraAttrs.length) {
- warn(
- `Extraneous non-props attributes (` +
- `${extraAttrs.join(', ')}) ` +
- `were passed to component but could not be automatically inherited ` +
- `because component renders fragment or text root nodes.`
- );
- }
- if (eventAttrs.length) {
- warn(
- `Extraneous non-emits event listeners (` +
- `${eventAttrs.join(', ')}) ` +
- `were passed to component but could not be automatically inherited ` +
- `because component renders fragment or text root nodes. ` +
- `If the listener is intended to be a component custom event listener only, ` +
- `declare it using the "emits" option.`
- );
- }
- }
- }
- }
- if (
- false &&
- isCompatEnabled(
- 'INSTANCE_ATTRS_CLASS_STYLE' /* INSTANCE_ATTRS_CLASS_STYLE */,
- instance
- ) &&
- vnode.shapeFlag & 4 /* STATEFUL_COMPONENT */ &&
- (root.shapeFlag & 1 /* ELEMENT */ || root.shapeFlag & 6) /* COMPONENT */
- );
- // inherit directives
- if (vnode.dirs) {
- if (process.env.NODE_ENV !== 'production' && !isElementRoot(root)) {
- warn(
- `Runtime directive used on component with non-element root node. ` +
- `The directives will not function as intended.`
- );
- }
- root.dirs = root.dirs ? root.dirs.concat(vnode.dirs) : vnode.dirs;
- }
- // inherit transition data
- if (vnode.transition) {
- if (process.env.NODE_ENV !== 'production' && !isElementRoot(root)) {
- warn(
- `Component inside renders non-element root node ` +
- `that cannot be animated.`
- );
- }
- root.transition = vnode.transition;
- }
- if (process.env.NODE_ENV !== 'production' && setRoot) {
- setRoot(root);
- } else {
- result = root;
- }
- } catch (err) {
- blockStack.length = 0;
- handleError(err, instance, 1 /* RENDER_FUNCTION */);
- result = createVNode(Comment$1);
- }
- setCurrentRenderingInstance(prev);
- return result
-}
-/**
- * dev only
- * In dev mode, template root level comments are rendered, which turns the
- * template into a fragment root, but we need to locate the single element
- * root for attrs and scope id processing.
- */
-const getChildRoot = (vnode) => {
- const rawChildren = vnode.children;
- const dynamicChildren = vnode.dynamicChildren;
- const childRoot = filterSingleRoot(rawChildren);
- if (!childRoot) {
- return [vnode, undefined]
- }
- const index = rawChildren.indexOf(childRoot);
- const dynamicIndex = dynamicChildren ? dynamicChildren.indexOf(childRoot) : -1;
- const setRoot = (updatedRoot) => {
- rawChildren[index] = updatedRoot;
- if (dynamicChildren) {
- if (dynamicIndex > -1) {
- dynamicChildren[dynamicIndex] = updatedRoot;
- } else if (updatedRoot.patchFlag > 0) {
- vnode.dynamicChildren = [...dynamicChildren, updatedRoot];
- }
- }
- };
- return [normalizeVNode(childRoot), setRoot]
-};
-function filterSingleRoot(children) {
- let singleRoot;
- for (let i = 0; i < children.length; i++) {
- const child = children[i];
- if (isVNode(child)) {
- // ignore user comment
- if (child.type !== Comment$1 || child.children === 'v-if') {
- if (singleRoot) {
- // has more than 1 non-comment child, return now
- return
- } else {
- singleRoot = child;
- }
- }
- } else {
- return
- }
- }
- return singleRoot
-}
-const getFunctionalFallthrough = (attrs) => {
- let res;
- for (const key in attrs) {
- if (key === 'class' || key === 'style' || isOn(key)) {
-(res || (res = {}))[key] = attrs[key];
- }
- }
- return res
-};
-const filterModelListeners = (attrs, props) => {
- const res = {};
- for (const key in attrs) {
- if (!isModelListener(key) || !(key.slice(9) in props)) {
- res[key] = attrs[key];
- }
- }
- return res
-};
-const isElementRoot = (vnode) => {
- return (
- vnode.shapeFlag & 6 /* COMPONENT */ ||
- vnode.shapeFlag & 1 /* ELEMENT */ ||
- vnode.type === Comment$1 // potential v-if branch switch
- )
-};
-function shouldUpdateComponent(prevVNode, nextVNode, optimized) {
- const { props: prevProps, children: prevChildren, component } = prevVNode;
- const { props: nextProps, children: nextChildren, patchFlag } = nextVNode;
- const emits = component.emitsOptions;
- // Parent component's render function was hot-updated. Since this may have
- // caused the child component's slots content to have changed, we need to
- // force the child to update as well.
- if (
- process.env.NODE_ENV !== 'production' &&
- (prevChildren || nextChildren) &&
- isHmrUpdating
- ) {
- return true
- }
- // force child update for runtime directive or transition on component vnode.
- if (nextVNode.dirs || nextVNode.transition) {
- return true
- }
- if (optimized && patchFlag >= 0) {
- if (patchFlag & 1024 /* DYNAMIC_SLOTS */) {
- // slot content that references values that might have changed,
- // e.g. in a v-for
- return true
- }
- if (patchFlag & 16 /* FULL_PROPS */) {
- if (!prevProps) {
- return !!nextProps
- }
- // presence of this flag indicates props are always non-null
- return hasPropsChanged(prevProps, nextProps, emits)
- } else if (patchFlag & 8 /* PROPS */) {
- const dynamicProps = nextVNode.dynamicProps;
- for (let i = 0; i < dynamicProps.length; i++) {
- const key = dynamicProps[i];
- if (nextProps[key] !== prevProps[key] && !isEmitListener(emits, key)) {
- return true
- }
- }
- }
- } else {
- // this path is only taken by manually written render functions
- // so presence of any children leads to a forced update
- if (prevChildren || nextChildren) {
- if (!nextChildren || !nextChildren.$stable) {
- return true
- }
- }
- if (prevProps === nextProps) {
- return false
- }
- if (!prevProps) {
- return !!nextProps
- }
- if (!nextProps) {
- return true
- }
- return hasPropsChanged(prevProps, nextProps, emits)
- }
- return false
-}
-function hasPropsChanged(prevProps, nextProps, emitsOptions) {
- const nextKeys = Object.keys(nextProps);
- if (nextKeys.length !== Object.keys(prevProps).length) {
- return true
- }
- for (let i = 0; i < nextKeys.length; i++) {
- const key = nextKeys[i];
- if (
- nextProps[key] !== prevProps[key] &&
- !isEmitListener(emitsOptions, key)
- ) {
- return true
- }
- }
- return false
-}
-function updateHOCHostEl(
- { vnode, parent },
- el // HostNode
-) {
- while (parent && parent.subTree === vnode) {
-(vnode = parent.vnode).el = el;
- parent = parent.parent;
- }
-}
-
-const isSuspense = (type) => type.__isSuspense;
-// Suspense exposes a component-like API, and is treated like a component
-// in the compiler, but internally it's a special built-in type that hooks
-// directly into the renderer.
-const SuspenseImpl = {
- name: 'Suspense',
- // In order to make Suspense tree-shakable, we need to avoid importing it
- // directly in the renderer. The renderer checks for the __isSuspense flag
- // on a vnode's type and calls the `process` method, passing in renderer
- // internals.
- __isSuspense: true,
- process(
- n1,
- n2,
- container,
- anchor,
- parentComponent,
- parentSuspense,
- isSVG,
- slotScopeIds,
- optimized,
- // platform-specific impl passed from renderer
- rendererInternals
- ) {
- if (n1 == null) {
- mountSuspense(
- n2,
- container,
- anchor,
- parentComponent,
- parentSuspense,
- isSVG,
- slotScopeIds,
- optimized,
- rendererInternals
- );
- } else {
- patchSuspense(
- n1,
- n2,
- container,
- anchor,
- parentComponent,
- isSVG,
- slotScopeIds,
- optimized,
- rendererInternals
- );
- }
- },
- hydrate: hydrateSuspense,
- create: createSuspenseBoundary,
- normalize: normalizeSuspenseChildren,
-};
-// Force-casted public typing for h and TSX props inference
-const Suspense = SuspenseImpl;
-function triggerEvent(vnode, name) {
- const eventListener = vnode.props && vnode.props[name];
- if (isFunction$1(eventListener)) {
- eventListener();
- }
-}
-function mountSuspense(
- vnode,
- container,
- anchor,
- parentComponent,
- parentSuspense,
- isSVG,
- slotScopeIds,
- optimized,
- rendererInternals
-) {
- const {
- p: patch,
- o: { createElement },
- } = rendererInternals;
- const hiddenContainer = createElement('div');
- const suspense = (vnode.suspense = createSuspenseBoundary(
- vnode,
- parentSuspense,
- parentComponent,
- container,
- hiddenContainer,
- anchor,
- isSVG,
- slotScopeIds,
- optimized,
- rendererInternals
- ));
- // start mounting the content subtree in an off-dom container
- patch(
- null,
- (suspense.pendingBranch = vnode.ssContent),
- hiddenContainer,
- null,
- parentComponent,
- suspense,
- isSVG,
- slotScopeIds
- );
- // now check if we have encountered any async deps
- if (suspense.deps > 0) {
- // has async
- // invoke @fallback event
- triggerEvent(vnode, 'onPending');
- triggerEvent(vnode, 'onFallback');
- // mount the fallback tree
- patch(
- null,
- vnode.ssFallback,
- container,
- anchor,
- parentComponent,
- null, // fallback tree will not have suspense context
- isSVG,
- slotScopeIds
- );
- setActiveBranch(suspense, vnode.ssFallback);
- } else {
- // Suspense has no async deps. Just resolve.
- suspense.resolve();
- }
-}
-function patchSuspense(
- n1,
- n2,
- container,
- anchor,
- parentComponent,
- isSVG,
- slotScopeIds,
- optimized,
- { p: patch, um: unmount, o: { createElement } }
-) {
- const suspense = (n2.suspense = n1.suspense);
- suspense.vnode = n2;
- n2.el = n1.el;
- const newBranch = n2.ssContent;
- const newFallback = n2.ssFallback;
- const { activeBranch, pendingBranch, isInFallback, isHydrating } = suspense;
- if (pendingBranch) {
- suspense.pendingBranch = newBranch;
- if (isSameVNodeType(newBranch, pendingBranch)) {
- // same root type but content may have changed.
- patch(
- pendingBranch,
- newBranch,
- suspense.hiddenContainer,
- null,
- parentComponent,
- suspense,
- isSVG,
- slotScopeIds,
- optimized
- );
- if (suspense.deps <= 0) {
- suspense.resolve();
- } else if (isInFallback) {
- patch(
- activeBranch,
- newFallback,
- container,
- anchor,
- parentComponent,
- null, // fallback tree will not have suspense context
- isSVG,
- slotScopeIds,
- optimized
- );
- setActiveBranch(suspense, newFallback);
- }
- } else {
- // toggled before pending tree is resolved
- suspense.pendingId++;
- if (isHydrating) {
- // if toggled before hydration is finished, the current DOM tree is
- // no longer valid. set it as the active branch so it will be unmounted
- // when resolved
- suspense.isHydrating = false;
- suspense.activeBranch = pendingBranch;
- } else {
- unmount(pendingBranch, parentComponent, suspense);
- }
- // increment pending ID. this is used to invalidate async callbacks
- // reset suspense state
- suspense.deps = 0;
- // discard effects from pending branch
- suspense.effects.length = 0;
- // discard previous container
- suspense.hiddenContainer = createElement('div');
- if (isInFallback) {
- // already in fallback state
- patch(
- null,
- newBranch,
- suspense.hiddenContainer,
- null,
- parentComponent,
- suspense,
- isSVG,
- slotScopeIds,
- optimized
- );
- if (suspense.deps <= 0) {
- suspense.resolve();
- } else {
- patch(
- activeBranch,
- newFallback,
- container,
- anchor,
- parentComponent,
- null, // fallback tree will not have suspense context
- isSVG,
- slotScopeIds,
- optimized
- );
- setActiveBranch(suspense, newFallback);
- }
- } else if (activeBranch && isSameVNodeType(newBranch, activeBranch)) {
- // toggled "back" to current active branch
- patch(
- activeBranch,
- newBranch,
- container,
- anchor,
- parentComponent,
- suspense,
- isSVG,
- slotScopeIds,
- optimized
- );
- // force resolve
- suspense.resolve(true);
- } else {
- // switched to a 3rd branch
- patch(
- null,
- newBranch,
- suspense.hiddenContainer,
- null,
- parentComponent,
- suspense,
- isSVG,
- slotScopeIds,
- optimized
- );
- if (suspense.deps <= 0) {
- suspense.resolve();
- }
- }
- }
- } else {
- if (activeBranch && isSameVNodeType(newBranch, activeBranch)) {
- // root did not change, just normal patch
- patch(
- activeBranch,
- newBranch,
- container,
- anchor,
- parentComponent,
- suspense,
- isSVG,
- slotScopeIds,
- optimized
- );
- setActiveBranch(suspense, newBranch);
- } else {
- // root node toggled
- // invoke @pending event
- triggerEvent(n2, 'onPending');
- // mount pending branch in off-dom container
- suspense.pendingBranch = newBranch;
- suspense.pendingId++;
- patch(
- null,
- newBranch,
- suspense.hiddenContainer,
- null,
- parentComponent,
- suspense,
- isSVG,
- slotScopeIds,
- optimized
- );
- if (suspense.deps <= 0) {
- // incoming branch has no async deps, resolve now.
- suspense.resolve();
- } else {
- const { timeout, pendingId } = suspense;
- if (timeout > 0) {
- setTimeout(() => {
- if (suspense.pendingId === pendingId) {
- suspense.fallback(newFallback);
- }
- }, timeout);
- } else if (timeout === 0) {
- suspense.fallback(newFallback);
- }
- }
- }
- }
-}
-let hasWarned = false;
-function createSuspenseBoundary(
- vnode,
- parent,
- parentComponent,
- container,
- hiddenContainer,
- anchor,
- isSVG,
- slotScopeIds,
- optimized,
- rendererInternals,
- isHydrating = false
-) {
- /* istanbul ignore if */
- if (process.env.NODE_ENV !== 'production' && !false && !hasWarned) {
- hasWarned = true;
- // @ts-ignore `console.info` cannot be null error
- console[console.info ? 'info' : 'log'](
- ` is an experimental feature and its API will likely change.`
- );
- }
- const {
- p: patch,
- m: move,
- um: unmount,
- n: next,
- o: { parentNode, remove },
- } = rendererInternals;
- const timeout = toNumber(vnode.props && vnode.props.timeout);
- const suspense = {
- vnode,
- parent,
- parentComponent,
- isSVG,
- container,
- hiddenContainer,
- anchor,
- deps: 0,
- pendingId: 0,
- timeout: typeof timeout === 'number' ? timeout : -1,
- activeBranch: null,
- pendingBranch: null,
- isInFallback: true,
- isHydrating,
- isUnmounted: false,
- effects: [],
- resolve(resume = false) {
- if (process.env.NODE_ENV !== 'production') {
- if (!resume && !suspense.pendingBranch) {
- throw new Error(
- `suspense.resolve() is called without a pending branch.`
- )
- }
- if (suspense.isUnmounted) {
- throw new Error(
- `suspense.resolve() is called on an already unmounted suspense boundary.`
- )
- }
- }
- const {
- vnode,
- activeBranch,
- pendingBranch,
- pendingId,
- effects,
- parentComponent,
- container,
- } = suspense;
- if (suspense.isHydrating) {
- suspense.isHydrating = false;
- } else if (!resume) {
- const delayEnter =
- activeBranch &&
- pendingBranch.transition &&
- pendingBranch.transition.mode === 'out-in';
- if (delayEnter) {
- activeBranch.transition.afterLeave = () => {
- if (pendingId === suspense.pendingId) {
- move(pendingBranch, container, anchor, 0 /* ENTER */);
- }
- };
- }
- // this is initial anchor on mount
- let { anchor } = suspense;
- // unmount current active tree
- if (activeBranch) {
- // if the fallback tree was mounted, it may have been moved
- // as part of a parent suspense. get the latest anchor for insertion
- anchor = next(activeBranch);
- unmount(activeBranch, parentComponent, suspense, true);
- }
- if (!delayEnter) {
- // move content from off-dom container to actual container
- move(pendingBranch, container, anchor, 0 /* ENTER */);
- }
- }
- setActiveBranch(suspense, pendingBranch);
- suspense.pendingBranch = null;
- suspense.isInFallback = false;
- // flush buffered effects
- // check if there is a pending parent suspense
- let parent = suspense.parent;
- let hasUnresolvedAncestor = false;
- while (parent) {
- if (parent.pendingBranch) {
- // found a pending parent suspense, merge buffered post jobs
- // into that parent
- parent.effects.push(...effects);
- hasUnresolvedAncestor = true;
- break
- }
- parent = parent.parent;
- }
- // no pending parent suspense, flush all jobs
- if (!hasUnresolvedAncestor) {
- queuePostFlushCb(effects);
- }
- suspense.effects = [];
- // invoke @resolve event
- triggerEvent(vnode, 'onResolve');
- },
- fallback(fallbackVNode) {
- if (!suspense.pendingBranch) {
- return
- }
- const { vnode, activeBranch, parentComponent, container, isSVG } =
- suspense;
- // invoke @fallback event
- triggerEvent(vnode, 'onFallback');
- const anchor = next(activeBranch);
- const mountFallback = () => {
- if (!suspense.isInFallback) {
- return
- }
- // mount the fallback tree
- patch(
- null,
- fallbackVNode,
- container,
- anchor,
- parentComponent,
- null, // fallback tree will not have suspense context
- isSVG,
- slotScopeIds,
- optimized
- );
- setActiveBranch(suspense, fallbackVNode);
- };
- const delayEnter =
- fallbackVNode.transition && fallbackVNode.transition.mode === 'out-in';
- if (delayEnter) {
- activeBranch.transition.afterLeave = mountFallback;
- }
- suspense.isInFallback = true;
- // unmount current active branch
- unmount(
- activeBranch,
- parentComponent,
- null, // no suspense so unmount hooks fire now
- true // shouldRemove
- );
- if (!delayEnter) {
- mountFallback();
- }
- },
- move(container, anchor, type) {
- suspense.activeBranch &&
- move(suspense.activeBranch, container, anchor, type);
- suspense.container = container;
- },
- next() {
- return suspense.activeBranch && next(suspense.activeBranch)
- },
- registerDep(instance, setupRenderEffect) {
- const isInPendingSuspense = !!suspense.pendingBranch;
- if (isInPendingSuspense) {
- suspense.deps++;
- }
- const hydratedEl = instance.vnode.el;
- instance.asyncDep
- .catch((err) => {
- handleError(err, instance, 0 /* SETUP_FUNCTION */);
- })
- .then((asyncSetupResult) => {
- // retry when the setup() promise resolves.
- // component may have been unmounted before resolve.
- if (
- instance.isUnmounted ||
- suspense.isUnmounted ||
- suspense.pendingId !== instance.suspenseId
- ) {
- return
- }
- // retry from this component
- instance.asyncResolved = true;
- const { vnode } = instance;
- if (process.env.NODE_ENV !== 'production') {
- pushWarningContext(vnode);
- }
- handleSetupResult(instance, asyncSetupResult, false);
- if (hydratedEl) {
- // vnode may have been replaced if an update happened before the
- // async dep is resolved.
- vnode.el = hydratedEl;
- }
- const placeholder = !hydratedEl && instance.subTree.el;
- setupRenderEffect(
- instance,
- vnode,
- // component may have been moved before resolve.
- // if this is not a hydration, instance.subTree will be the comment
- // placeholder.
- parentNode(hydratedEl || instance.subTree.el),
- // anchor will not be used if this is hydration, so only need to
- // consider the comment placeholder case.
- hydratedEl ? null : next(instance.subTree),
- suspense,
- isSVG,
- optimized
- );
- if (placeholder) {
- remove(placeholder);
- }
- updateHOCHostEl(instance, vnode.el);
- if (process.env.NODE_ENV !== 'production') {
- popWarningContext();
- }
- // only decrease deps count if suspense is not already resolved
- if (isInPendingSuspense && --suspense.deps === 0) {
- suspense.resolve();
- }
- });
- },
- unmount(parentSuspense, doRemove) {
- suspense.isUnmounted = true;
- if (suspense.activeBranch) {
- unmount(
- suspense.activeBranch,
- parentComponent,
- parentSuspense,
- doRemove
- );
- }
- if (suspense.pendingBranch) {
- unmount(
- suspense.pendingBranch,
- parentComponent,
- parentSuspense,
- doRemove
- );
- }
- },
- };
- return suspense
-}
-function hydrateSuspense(
- node,
- vnode,
- parentComponent,
- parentSuspense,
- isSVG,
- slotScopeIds,
- optimized,
- rendererInternals,
- hydrateNode
-) {
- /* eslint-disable no-restricted-globals */
- const suspense = (vnode.suspense = createSuspenseBoundary(
- vnode,
- parentSuspense,
- parentComponent,
- node.parentNode,
- document.createElement('div'),
- null,
- isSVG,
- slotScopeIds,
- optimized,
- rendererInternals,
- true /* hydrating */
- ));
- // there are two possible scenarios for server-rendered suspense:
- // - success: ssr content should be fully resolved
- // - failure: ssr content should be the fallback branch.
- // however, on the client we don't really know if it has failed or not
- // attempt to hydrate the DOM assuming it has succeeded, but we still
- // need to construct a suspense boundary first
- const result = hydrateNode(
- node,
- (suspense.pendingBranch = vnode.ssContent),
- parentComponent,
- suspense,
- slotScopeIds,
- optimized
- );
- if (suspense.deps === 0) {
- suspense.resolve();
- }
- return result
- /* eslint-enable no-restricted-globals */
-}
-function normalizeSuspenseChildren(vnode) {
- const { shapeFlag, children } = vnode;
- const isSlotChildren = shapeFlag & 32; /* SLOTS_CHILDREN */
- vnode.ssContent = normalizeSuspenseSlot(
- isSlotChildren ? children.default : children
- );
- vnode.ssFallback = isSlotChildren
- ? normalizeSuspenseSlot(children.fallback)
- : createVNode(Comment);
-}
-function normalizeSuspenseSlot(s) {
- let block;
- if (isFunction$1(s)) {
- const isCompiledSlot = s._c;
- if (isCompiledSlot) {
- // disableTracking: false
- // allow block tracking for compiled slots
- // (see ./componentRenderContext.ts)
- s._d = false;
- openBlock();
- }
- s = s();
- if (isCompiledSlot) {
- s._d = true;
- block = currentBlock;
- closeBlock();
- }
- }
- if (isArray(s)) {
- const singleChild = filterSingleRoot(s);
- if (process.env.NODE_ENV !== 'production' && !singleChild) {
- warn(` slots expect a single root node.`);
- }
- s = singleChild;
- }
- s = normalizeVNode(s);
- if (block) {
- s.dynamicChildren = block.filter((c) => c !== s);
- }
- return s
-}
-function queueEffectWithSuspense(fn, suspense) {
- if (suspense && suspense.pendingBranch) {
- if (isArray(fn)) {
- suspense.effects.push(...fn);
- } else {
- suspense.effects.push(fn);
- }
- } else {
- queuePostFlushCb(fn);
- }
-}
-function setActiveBranch(suspense, branch) {
- suspense.activeBranch = branch;
- const { vnode, parentComponent } = suspense;
- const el = (vnode.el = branch.el);
- // in case suspense is the root node of a component,
- // recursively update the HOC el
- if (parentComponent && parentComponent.subTree === vnode) {
- parentComponent.vnode.el = el;
- updateHOCHostEl(parentComponent, el);
- }
-}
-
-function provide(key, value) {
- if (!currentInstance) {
- if (process.env.NODE_ENV !== 'production') {
- warn(`provide() can only be used inside setup().`);
- }
- } else {
- let provides = currentInstance.provides;
- // by default an instance inherits its parent's provides object
- // but when it needs to provide values of its own, it creates its
- // own provides object using parent provides object as prototype.
- // this way in `inject` we can simply look up injections from direct
- // parent and let the prototype chain do the work.
- const parentProvides =
- currentInstance.parent && currentInstance.parent.provides;
- if (parentProvides === provides) {
- provides = currentInstance.provides = Object.create(parentProvides);
- }
- // TS doesn't allow symbol as index type
- provides[key] = value;
- }
-}
-function inject(key, defaultValue, treatDefaultAsFactory = false) {
- // fallback to `currentRenderingInstance` so that this can be called in
- // a functional component
- const instance = currentInstance || currentRenderingInstance;
- if (instance) {
- // #2400
- // to support `app.use` plugins,
- // fallback to appContext's `provides` if the intance is at root
- const provides =
- instance.parent == null
- ? instance.vnode.appContext && instance.vnode.appContext.provides
- : instance.parent.provides;
- if (provides && key in provides) {
- // TS doesn't allow symbol as index type
- return provides[key]
- } else if (arguments.length > 1) {
- return treatDefaultAsFactory && isFunction$1(defaultValue)
- ? defaultValue.call(instance.proxy)
- : defaultValue
- } else if (process.env.NODE_ENV !== 'production') {
- warn(`injection "${String(key)}" not found.`);
- }
- } else if (process.env.NODE_ENV !== 'production') {
- warn(`inject() can only be used inside setup() or functional components.`);
- }
+const stack = [];
+function pushWarningContext(vnode) {
+ stack.push(vnode);
+}
+function popWarningContext() {
+ stack.pop();
+}
+function warn(msg, ...args) {
+ // avoid props formatting or warn handler tracking deps that might be mutated
+ // during patch, leading to infinite recursion.
+ pauseTracking();
+ const instance = stack.length ? stack[stack.length - 1].component : null;
+ const appWarnHandler = instance && instance.appContext.config.warnHandler;
+ const trace = getComponentTrace();
+ if (appWarnHandler) {
+ callWithErrorHandling(appWarnHandler, instance, 11 /* APP_WARN_HANDLER */, [
+ msg + args.join(''),
+ instance && instance.proxy,
+ trace
+ .map(({ vnode }) => `at <${formatComponentName(instance, vnode.type)}>`)
+ .join('\n'),
+ trace
+ ]);
+ }
+ else {
+ const warnArgs = [`[Vue warn]: ${msg}`, ...args];
+ /* istanbul ignore if */
+ if (trace.length &&
+ // avoid spamming console during tests
+ !false) {
+ warnArgs.push(`\n`, ...formatTrace(trace));
+ }
+ console.warn(...warnArgs);
+ }
+ resetTracking();
+}
+function getComponentTrace() {
+ let currentVNode = stack[stack.length - 1];
+ if (!currentVNode) {
+ return [];
+ }
+ // we can't just use the stack because it will be incomplete during updates
+ // that did not start from the root. Re-construct the parent chain using
+ // instance parent pointers.
+ const normalizedStack = [];
+ while (currentVNode) {
+ const last = normalizedStack[0];
+ if (last && last.vnode === currentVNode) {
+ last.recurseCount++;
+ }
+ else {
+ normalizedStack.push({
+ vnode: currentVNode,
+ recurseCount: 0
+ });
+ }
+ const parentInstance = currentVNode.component && currentVNode.component.parent;
+ currentVNode = parentInstance && parentInstance.vnode;
+ }
+ return normalizedStack;
+}
+/* istanbul ignore next */
+function formatTrace(trace) {
+ const logs = [];
+ trace.forEach((entry, i) => {
+ logs.push(...(i === 0 ? [] : [`\n`]), ...formatTraceEntry(entry));
+ });
+ return logs;
+}
+function formatTraceEntry({ vnode, recurseCount }) {
+ const postfix = recurseCount > 0 ? `... (${recurseCount} recursive calls)` : ``;
+ const isRoot = vnode.component ? vnode.component.parent == null : false;
+ const open = ` at <${formatComponentName(vnode.component, vnode.type, isRoot)}`;
+ const close = `>` + postfix;
+ return vnode.props
+ ? [open, ...formatProps(vnode.props), close]
+ : [open + close];
+}
+/* istanbul ignore next */
+function formatProps(props) {
+ const res = [];
+ const keys = Object.keys(props);
+ keys.slice(0, 3).forEach(key => {
+ res.push(...formatProp(key, props[key]));
+ });
+ if (keys.length > 3) {
+ res.push(` ...`);
+ }
+ return res;
+}
+/* istanbul ignore next */
+function formatProp(key, value, raw) {
+ if (isString(value)) {
+ value = JSON.stringify(value);
+ return raw ? value : [`${key}=${value}`];
+ }
+ else if (typeof value === 'number' ||
+ typeof value === 'boolean' ||
+ value == null) {
+ return raw ? value : [`${key}=${value}`];
+ }
+ else if (isRef(value)) {
+ value = formatProp(key, toRaw(value.value), true);
+ return raw ? value : [`${key}=Ref<`, value, `>`];
+ }
+ else if (isFunction$1(value)) {
+ return [`${key}=fn${value.name ? `<${value.name}>` : ``}`];
+ }
+ else {
+ value = toRaw(value);
+ return raw ? value : [`${key}=`, value];
+ }
}
-// Simple effect.
-function watchEffect(effect, options) {
- return doWatch(effect, null, options)
-}
-// initial value for watchers to trigger on undefined initial values
-const INITIAL_WATCHER_VALUE = {};
-// implementation
-function watch(source, cb, options) {
- if (process.env.NODE_ENV !== 'production' && !isFunction$1(cb)) {
- warn(
- `\`watch(fn, options?)\` signature has been moved to a separate API. ` +
- `Use \`watchEffect(fn, options?)\` instead. \`watch\` now only ` +
- `supports \`watch(source, cb, options?) signature.`
- );
- }
- return doWatch(source, cb, options)
-}
-function doWatch(
- source,
- cb,
- { immediate, deep, flush, onTrack, onTrigger } = EMPTY_OBJ,
- instance = currentInstance
-) {
- if (process.env.NODE_ENV !== 'production' && !cb) {
- if (immediate !== undefined) {
- warn(
- `watch() "immediate" option is only respected when using the ` +
- `watch(source, callback, options?) signature.`
- );
- }
- if (deep !== undefined) {
- warn(
- `watch() "deep" option is only respected when using the ` +
- `watch(source, callback, options?) signature.`
- );
- }
- }
- const warnInvalidSource = (s) => {
- warn(
- `Invalid watch source: `,
- s,
- `A watch source can only be a getter/effect function, a ref, ` +
- `a reactive object, or an array of these types.`
- );
- };
- let getter;
- let forceTrigger = false;
- let isMultiSource = false;
- if (isRef(source)) {
- getter = () => source.value;
- forceTrigger = !!source._shallow;
- } else if (isReactive(source)) {
- getter = () => source;
- deep = true;
- } else if (isArray(source)) {
- isMultiSource = true;
- forceTrigger = source.some(isReactive);
- getter = () =>
- source.map((s) => {
- if (isRef(s)) {
- return s.value
- } else if (isReactive(s)) {
- return traverse(s)
- } else if (isFunction$1(s)) {
- return callWithErrorHandling(s, instance, 2 /* WATCH_GETTER */)
- } else {
- process.env.NODE_ENV !== 'production' && warnInvalidSource(s);
- }
- });
- } else if (isFunction$1(source)) {
- if (cb) {
- // getter with cb
- getter = () =>
- callWithErrorHandling(source, instance, 2 /* WATCH_GETTER */);
- } else {
- // no cb -> simple effect
- getter = () => {
- if (instance && instance.isUnmounted) {
- return
- }
- if (cleanup) {
- cleanup();
- }
- return callWithAsyncErrorHandling(
- source,
- instance,
- 3 /* WATCH_CALLBACK */,
- [onInvalidate]
- )
- };
- }
- } else {
- getter = NOOP;
- process.env.NODE_ENV !== 'production' && warnInvalidSource(source);
- }
- if (cb && deep) {
- const baseGetter = getter;
- getter = () => traverse(baseGetter());
- }
- let cleanup;
- let onInvalidate = (fn) => {
- cleanup = runner.options.onStop = () => {
- callWithErrorHandling(fn, instance, 4 /* WATCH_CLEANUP */);
- };
- };
- let oldValue = isMultiSource ? [] : INITIAL_WATCHER_VALUE;
- const job = () => {
- if (!runner.active) {
- return
- }
- if (cb) {
- // watch(source, cb)
- const newValue = runner();
- if (
- deep ||
- forceTrigger ||
- (isMultiSource
- ? newValue.some((v, i) => hasChanged(v, oldValue[i]))
- : hasChanged(newValue, oldValue)) ||
- false
- ) {
- // cleanup before running cb again
- if (cleanup) {
- cleanup();
- }
- callWithAsyncErrorHandling(cb, instance, 3 /* WATCH_CALLBACK */, [
- newValue,
- // pass undefined as the old value when it's changed for the first time
- oldValue === INITIAL_WATCHER_VALUE ? undefined : oldValue,
- onInvalidate,
- ]);
- oldValue = newValue;
- }
- } else {
- // watchEffect
- runner();
- }
- };
- // important: mark the job as a watcher callback so that scheduler knows
- // it is allowed to self-trigger (#1727)
- job.allowRecurse = !!cb;
- let scheduler;
- if (flush === 'sync') {
- scheduler = job; // the scheduler function gets called directly
- } else if (flush === 'post') {
- scheduler = () => queuePostRenderEffect(job, instance && instance.suspense);
- } else {
- // default: 'pre'
- scheduler = () => {
- if (!instance || instance.isMounted) {
- queuePreFlushCb(job);
- } else {
- // with 'pre' option, the first call must happen before
- // the component is mounted so it is called synchronously.
- job();
- }
- };
- }
- const runner = effect(getter, {
- lazy: true,
- onTrack,
- onTrigger,
- scheduler,
- });
- recordInstanceBoundEffect(runner, instance);
- // initial run
- if (cb) {
- if (immediate) {
- job();
- } else {
- oldValue = runner();
- }
- } else if (flush === 'post') {
- queuePostRenderEffect(runner, instance && instance.suspense);
- } else {
- runner();
- }
- return () => {
- stop(runner);
- if (instance) {
- remove(instance.effects, runner);
- }
- }
-}
-// this.$watch
-function instanceWatch(source, value, options) {
- const publicThis = this.proxy;
- const getter = isString(source)
- ? source.includes('.')
- ? createPathGetter(publicThis, source)
- : () => publicThis[source]
- : source.bind(publicThis, publicThis);
- let cb;
- if (isFunction$1(value)) {
- cb = value;
- } else {
- cb = value.handler;
- options = value;
- }
- return doWatch(getter, cb.bind(publicThis), options, this)
-}
-function createPathGetter(ctx, path) {
- const segments = path.split('.');
- return () => {
- let cur = ctx;
- for (let i = 0; i < segments.length && cur; i++) {
- cur = cur[segments[i]];
- }
- return cur
- }
-}
-function traverse(value, seen = new Set()) {
- if (!isObject$1(value) || seen.has(value) || value['__v_skip' /* SKIP */]) {
- return value
- }
- seen.add(value);
- if (isRef(value)) {
- traverse(value.value, seen);
- } else if (isArray(value)) {
- for (let i = 0; i < value.length; i++) {
- traverse(value[i], seen);
- }
- } else if (isSet(value) || isMap(value)) {
- value.forEach((v) => {
- traverse(v, seen);
- });
- } else if (isPlainObject(value)) {
- for (const key in value) {
- traverse(value[key], seen);
- }
- }
- return value
+const ErrorTypeStrings = {
+ ["sp" /* SERVER_PREFETCH */]: 'serverPrefetch hook',
+ ["bc" /* BEFORE_CREATE */]: 'beforeCreate hook',
+ ["c" /* CREATED */]: 'created hook',
+ ["bm" /* BEFORE_MOUNT */]: 'beforeMount hook',
+ ["m" /* MOUNTED */]: 'mounted hook',
+ ["bu" /* BEFORE_UPDATE */]: 'beforeUpdate hook',
+ ["u" /* UPDATED */]: 'updated',
+ ["bum" /* BEFORE_UNMOUNT */]: 'beforeUnmount hook',
+ ["um" /* UNMOUNTED */]: 'unmounted hook',
+ ["a" /* ACTIVATED */]: 'activated hook',
+ ["da" /* DEACTIVATED */]: 'deactivated hook',
+ ["ec" /* ERROR_CAPTURED */]: 'errorCaptured hook',
+ ["rtc" /* RENDER_TRACKED */]: 'renderTracked hook',
+ ["rtg" /* RENDER_TRIGGERED */]: 'renderTriggered hook',
+ [0 /* SETUP_FUNCTION */]: 'setup function',
+ [1 /* RENDER_FUNCTION */]: 'render function',
+ [2 /* WATCH_GETTER */]: 'watcher getter',
+ [3 /* WATCH_CALLBACK */]: 'watcher callback',
+ [4 /* WATCH_CLEANUP */]: 'watcher cleanup function',
+ [5 /* NATIVE_EVENT_HANDLER */]: 'native event handler',
+ [6 /* COMPONENT_EVENT_HANDLER */]: 'component event handler',
+ [7 /* VNODE_HOOK */]: 'vnode hook',
+ [8 /* DIRECTIVE_HOOK */]: 'directive hook',
+ [9 /* TRANSITION_HOOK */]: 'transition hook',
+ [10 /* APP_ERROR_HANDLER */]: 'app errorHandler',
+ [11 /* APP_WARN_HANDLER */]: 'app warnHandler',
+ [12 /* FUNCTION_REF */]: 'ref function',
+ [13 /* ASYNC_COMPONENT_LOADER */]: 'async component loader',
+ [14 /* SCHEDULER */]: 'scheduler flush. This is likely a Vue internals bug. ' +
+ 'Please open an issue at https://new-issue.vuejs.org/?repo=vuejs/vue-next'
+};
+function callWithErrorHandling(fn, instance, type, args) {
+ let res;
+ try {
+ res = args ? fn(...args) : fn();
+ }
+ catch (err) {
+ handleError(err, instance, type);
+ }
+ return res;
+}
+function callWithAsyncErrorHandling(fn, instance, type, args) {
+ if (isFunction$1(fn)) {
+ const res = callWithErrorHandling(fn, instance, type, args);
+ if (res && isPromise$1(res)) {
+ res.catch(err => {
+ handleError(err, instance, type);
+ });
+ }
+ return res;
+ }
+ const values = [];
+ for (let i = 0; i < fn.length; i++) {
+ values.push(callWithAsyncErrorHandling(fn[i], instance, type, args));
+ }
+ return values;
+}
+function handleError(err, instance, type, throwInDev = true) {
+ const contextVNode = instance ? instance.vnode : null;
+ if (instance) {
+ let cur = instance.parent;
+ // the exposed instance is the render proxy to keep it consistent with 2.x
+ const exposedInstance = instance.proxy;
+ // in production the hook receives only the error code
+ const errorInfo = (process.env.NODE_ENV !== 'production') ? ErrorTypeStrings[type] : type;
+ while (cur) {
+ const errorCapturedHooks = cur.ec;
+ if (errorCapturedHooks) {
+ for (let i = 0; i < errorCapturedHooks.length; i++) {
+ if (errorCapturedHooks[i](err, exposedInstance, errorInfo) === false) {
+ return;
+ }
+ }
+ }
+ cur = cur.parent;
+ }
+ // app-level handling
+ const appErrorHandler = instance.appContext.config.errorHandler;
+ if (appErrorHandler) {
+ callWithErrorHandling(appErrorHandler, null, 10 /* APP_ERROR_HANDLER */, [err, exposedInstance, errorInfo]);
+ return;
+ }
+ }
+ logError(err, type, contextVNode, throwInDev);
+}
+function logError(err, type, contextVNode, throwInDev = true) {
+ if ((process.env.NODE_ENV !== 'production')) {
+ const info = ErrorTypeStrings[type];
+ if (contextVNode) {
+ pushWarningContext(contextVNode);
+ }
+ warn(`Unhandled error${info ? ` during execution of ${info}` : ``}`);
+ if (contextVNode) {
+ popWarningContext();
+ }
+ // crash in dev by default so it's more noticeable
+ if (throwInDev) {
+ throw err;
+ }
+ else {
+ console.error(err);
+ }
+ }
+ else {
+ // recover in prod to reduce the impact on end-user
+ console.error(err);
+ }
}
-function useTransitionState() {
- const state = {
- isMounted: false,
- isLeaving: false,
- isUnmounting: false,
- leavingVNodes: new Map(),
- };
- onMounted(() => {
- state.isMounted = true;
- });
- onBeforeUnmount(() => {
- state.isUnmounting = true;
- });
- return state
-}
-const TransitionHookValidator = [Function, Array];
-const BaseTransitionImpl = {
- name: `BaseTransition`,
- props: {
- mode: String,
- appear: Boolean,
- persisted: Boolean,
- // enter
- onBeforeEnter: TransitionHookValidator,
- onEnter: TransitionHookValidator,
- onAfterEnter: TransitionHookValidator,
- onEnterCancelled: TransitionHookValidator,
- // leave
- onBeforeLeave: TransitionHookValidator,
- onLeave: TransitionHookValidator,
- onAfterLeave: TransitionHookValidator,
- onLeaveCancelled: TransitionHookValidator,
- // appear
- onBeforeAppear: TransitionHookValidator,
- onAppear: TransitionHookValidator,
- onAfterAppear: TransitionHookValidator,
- onAppearCancelled: TransitionHookValidator,
- },
- setup(props, { slots }) {
- const instance = getCurrentInstance();
- const state = useTransitionState();
- let prevTransitionKey;
- return () => {
- const children =
- slots.default && getTransitionRawChildren(slots.default(), true);
- if (!children || !children.length) {
- return
- }
- // warn multiple elements
- if (process.env.NODE_ENV !== 'production' && children.length > 1) {
- warn(
- ' can only be used on a single element or component. Use ' +
- ' for lists.'
- );
- }
- // there's no need to track reactivity for these props so use the raw
- // props for a bit better perf
- const rawProps = toRaw(props);
- const { mode } = rawProps;
- // check mode
- if (
- process.env.NODE_ENV !== 'production' &&
- mode &&
- !['in-out', 'out-in', 'default'].includes(mode)
- ) {
- warn(`invalid mode: ${mode}`);
- }
- // at this point children has a guaranteed length of 1.
- const child = children[0];
- if (state.isLeaving) {
- return emptyPlaceholder(child)
- }
- // in the case of , we need to
- // compare the type of the kept-alive children.
- const innerChild = getKeepAliveChild(child);
- if (!innerChild) {
- return emptyPlaceholder(child)
- }
- const enterHooks = resolveTransitionHooks(
- innerChild,
- rawProps,
- state,
- instance
- );
- setTransitionHooks(innerChild, enterHooks);
- const oldChild = instance.subTree;
- const oldInnerChild = oldChild && getKeepAliveChild(oldChild);
- let transitionKeyChanged = false;
- const { getTransitionKey } = innerChild.type;
- if (getTransitionKey) {
- const key = getTransitionKey();
- if (prevTransitionKey === undefined) {
- prevTransitionKey = key;
- } else if (key !== prevTransitionKey) {
- prevTransitionKey = key;
- transitionKeyChanged = true;
- }
- }
- // handle mode
- if (
- oldInnerChild &&
- oldInnerChild.type !== Comment$1 &&
- (!isSameVNodeType(innerChild, oldInnerChild) || transitionKeyChanged)
- ) {
- const leavingHooks = resolveTransitionHooks(
- oldInnerChild,
- rawProps,
- state,
- instance
- );
- // update old tree's hooks in case of dynamic transition
- setTransitionHooks(oldInnerChild, leavingHooks);
- // switching between different views
- if (mode === 'out-in') {
- state.isLeaving = true;
- // return placeholder node and queue update when leave finishes
- leavingHooks.afterLeave = () => {
- state.isLeaving = false;
- instance.update();
- };
- return emptyPlaceholder(child)
- } else if (mode === 'in-out' && innerChild.type !== Comment$1) {
- leavingHooks.delayLeave = (el, earlyRemove, delayedLeave) => {
- const leavingVNodesCache = getLeavingNodesForType(
- state,
- oldInnerChild
- );
- leavingVNodesCache[String(oldInnerChild.key)] = oldInnerChild;
- // early removal callback
- el._leaveCb = () => {
- earlyRemove();
- el._leaveCb = undefined;
- delete enterHooks.delayedLeave;
- };
- enterHooks.delayedLeave = delayedLeave;
- };
- }
- }
- return child
- }
- },
-};
-// export the public type for h/tsx inference
-// also to avoid inline import() in generated d.ts files
-const BaseTransition = BaseTransitionImpl;
-function getLeavingNodesForType(state, vnode) {
- const { leavingVNodes } = state;
- let leavingVNodesCache = leavingVNodes.get(vnode.type);
- if (!leavingVNodesCache) {
- leavingVNodesCache = Object.create(null);
- leavingVNodes.set(vnode.type, leavingVNodesCache);
- }
- return leavingVNodesCache
-}
-// The transition hooks are attached to the vnode as vnode.transition
-// and will be called at appropriate timing in the renderer.
-function resolveTransitionHooks(vnode, props, state, instance) {
- const {
- appear,
- mode,
- persisted = false,
- onBeforeEnter,
- onEnter,
- onAfterEnter,
- onEnterCancelled,
- onBeforeLeave,
- onLeave,
- onAfterLeave,
- onLeaveCancelled,
- onBeforeAppear,
- onAppear,
- onAfterAppear,
- onAppearCancelled,
- } = props;
- const key = String(vnode.key);
- const leavingVNodesCache = getLeavingNodesForType(state, vnode);
- const callHook = (hook, args) => {
- hook &&
- callWithAsyncErrorHandling(hook, instance, 9 /* TRANSITION_HOOK */, args);
- };
- const hooks = {
- mode,
- persisted,
- beforeEnter(el) {
- let hook = onBeforeEnter;
- if (!state.isMounted) {
- if (appear) {
- hook = onBeforeAppear || onBeforeEnter;
- } else {
- return
- }
- }
- // for same element (v-show)
- if (el._leaveCb) {
- el._leaveCb(true /* cancelled */);
- }
- // for toggled element with same key (v-if)
- const leavingVNode = leavingVNodesCache[key];
- if (
- leavingVNode &&
- isSameVNodeType(vnode, leavingVNode) &&
- leavingVNode.el._leaveCb
- ) {
- // force early removal (not cancelled)
- leavingVNode.el._leaveCb();
- }
- callHook(hook, [el]);
- },
- enter(el) {
- let hook = onEnter;
- let afterHook = onAfterEnter;
- let cancelHook = onEnterCancelled;
- if (!state.isMounted) {
- if (appear) {
- hook = onAppear || onEnter;
- afterHook = onAfterAppear || onAfterEnter;
- cancelHook = onAppearCancelled || onEnterCancelled;
- } else {
- return
- }
- }
- let called = false;
- const done = (el._enterCb = (cancelled) => {
- if (called) return
- called = true;
- if (cancelled) {
- callHook(cancelHook, [el]);
- } else {
- callHook(afterHook, [el]);
- }
- if (hooks.delayedLeave) {
- hooks.delayedLeave();
- }
- el._enterCb = undefined;
- });
- if (hook) {
- hook(el, done);
- if (hook.length <= 1) {
- done();
- }
- } else {
- done();
- }
- },
- leave(el, remove) {
- const key = String(vnode.key);
- if (el._enterCb) {
- el._enterCb(true /* cancelled */);
- }
- if (state.isUnmounting) {
- return remove()
- }
- callHook(onBeforeLeave, [el]);
- let called = false;
- const done = (el._leaveCb = (cancelled) => {
- if (called) return
- called = true;
- remove();
- if (cancelled) {
- callHook(onLeaveCancelled, [el]);
- } else {
- callHook(onAfterLeave, [el]);
- }
- el._leaveCb = undefined;
- if (leavingVNodesCache[key] === vnode) {
- delete leavingVNodesCache[key];
- }
- });
- leavingVNodesCache[key] = vnode;
- if (onLeave) {
- onLeave(el, done);
- if (onLeave.length <= 1) {
- done();
- }
- } else {
- done();
- }
- },
- clone(vnode) {
- return resolveTransitionHooks(vnode, props, state, instance)
- },
- };
- return hooks
-}
-// the placeholder really only handles one special case: KeepAlive
-// in the case of a KeepAlive in a leave phase we need to return a KeepAlive
-// placeholder with empty content to avoid the KeepAlive instance from being
-// unmounted.
-function emptyPlaceholder(vnode) {
- if (isKeepAlive(vnode)) {
- vnode = cloneVNode(vnode);
- vnode.children = null;
- return vnode
- }
-}
-function getKeepAliveChild(vnode) {
- return isKeepAlive(vnode)
- ? vnode.children
- ? vnode.children[0]
- : undefined
- : vnode
-}
-function setTransitionHooks(vnode, hooks) {
- if (vnode.shapeFlag & 6 /* COMPONENT */ && vnode.component) {
- setTransitionHooks(vnode.component.subTree, hooks);
- } else if (vnode.shapeFlag & 128 /* SUSPENSE */) {
- vnode.ssContent.transition = hooks.clone(vnode.ssContent);
- vnode.ssFallback.transition = hooks.clone(vnode.ssFallback);
- } else {
- vnode.transition = hooks;
- }
-}
-function getTransitionRawChildren(children, keepComment = false) {
- let ret = [];
- let keyedFragmentCount = 0;
- for (let i = 0; i < children.length; i++) {
- const child = children[i];
- // handle fragment children case, e.g. v-for
- if (child.type === Fragment) {
- if (child.patchFlag & 128 /* KEYED_FRAGMENT */) keyedFragmentCount++;
- ret = ret.concat(getTransitionRawChildren(child.children, keepComment));
- }
- // comment placeholders should be skipped, e.g. v-if
- else if (keepComment || child.type !== Comment$1) {
- ret.push(child);
- }
- }
- // #1126 if a transition children list contains multiple sub fragments, these
- // fragments will be merged into a flat children array. Since each v-for
- // fragment may contain different static bindings inside, we need to de-op
- // these children to force full diffs to ensure correct behavior.
- if (keyedFragmentCount > 1) {
- for (let i = 0; i < ret.length; i++) {
- ret[i].patchFlag = -2; /* BAIL */
- }
- }
- return ret
+let isFlushing = false;
+let isFlushPending = false;
+const queue = [];
+let flushIndex = 0;
+const pendingPreFlushCbs = [];
+let activePreFlushCbs = null;
+let preFlushIndex = 0;
+const pendingPostFlushCbs = [];
+let activePostFlushCbs = null;
+let postFlushIndex = 0;
+const resolvedPromise = Promise.resolve();
+let currentFlushPromise = null;
+let currentPreFlushParentJob = null;
+const RECURSION_LIMIT = 100;
+function nextTick(fn) {
+ const p = currentFlushPromise || resolvedPromise;
+ return fn ? p.then(this ? fn.bind(this) : fn) : p;
+}
+// #2768
+// Use binary-search to find a suitable position in the queue,
+// so that the queue maintains the increasing order of job's id,
+// which can prevent the job from being skipped and also can avoid repeated patching.
+function findInsertionIndex(job) {
+ // the start index should be `flushIndex + 1`
+ let start = flushIndex + 1;
+ let end = queue.length;
+ const jobId = getId(job);
+ while (start < end) {
+ const middle = (start + end) >>> 1;
+ const middleJobId = getId(queue[middle]);
+ middleJobId < jobId ? (start = middle + 1) : (end = middle);
+ }
+ return start;
+}
+function queueJob(job) {
+ // the dedupe search uses the startIndex argument of Array.includes()
+ // by default the search index includes the current job that is being run
+ // so it cannot recursively trigger itself again.
+ // if the job is a watch() callback, the search will start with a +1 index to
+ // allow it recursively trigger itself - it is the user's responsibility to
+ // ensure it doesn't end up in an infinite loop.
+ if ((!queue.length ||
+ !queue.includes(job, isFlushing && job.allowRecurse ? flushIndex + 1 : flushIndex)) &&
+ job !== currentPreFlushParentJob) {
+ const pos = findInsertionIndex(job);
+ if (pos > -1) {
+ queue.splice(pos, 0, job);
+ }
+ else {
+ queue.push(job);
+ }
+ queueFlush();
+ }
+}
+function queueFlush() {
+ if (!isFlushing && !isFlushPending) {
+ isFlushPending = true;
+ currentFlushPromise = resolvedPromise.then(flushJobs);
+ }
+}
+function invalidateJob(job) {
+ const i = queue.indexOf(job);
+ if (i > flushIndex) {
+ queue.splice(i, 1);
+ }
+}
+function queueCb(cb, activeQueue, pendingQueue, index) {
+ if (!isArray(cb)) {
+ if (!activeQueue ||
+ !activeQueue.includes(cb, cb.allowRecurse ? index + 1 : index)) {
+ pendingQueue.push(cb);
+ }
+ }
+ else {
+ // if cb is an array, it is a component lifecycle hook which can only be
+ // triggered by a job, which is already deduped in the main queue, so
+ // we can skip duplicate check here to improve perf
+ pendingQueue.push(...cb);
+ }
+ queueFlush();
+}
+function queuePreFlushCb(cb) {
+ queueCb(cb, activePreFlushCbs, pendingPreFlushCbs, preFlushIndex);
+}
+function queuePostFlushCb(cb) {
+ queueCb(cb, activePostFlushCbs, pendingPostFlushCbs, postFlushIndex);
+}
+function flushPreFlushCbs(seen, parentJob = null) {
+ if (pendingPreFlushCbs.length) {
+ currentPreFlushParentJob = parentJob;
+ activePreFlushCbs = [...new Set(pendingPreFlushCbs)];
+ pendingPreFlushCbs.length = 0;
+ if ((process.env.NODE_ENV !== 'production')) {
+ seen = seen || new Map();
+ }
+ for (preFlushIndex = 0; preFlushIndex < activePreFlushCbs.length; preFlushIndex++) {
+ if ((process.env.NODE_ENV !== 'production') &&
+ checkRecursiveUpdates(seen, activePreFlushCbs[preFlushIndex])) {
+ continue;
+ }
+ activePreFlushCbs[preFlushIndex]();
+ }
+ activePreFlushCbs = null;
+ preFlushIndex = 0;
+ currentPreFlushParentJob = null;
+ // recursively flush until it drains
+ flushPreFlushCbs(seen, parentJob);
+ }
+}
+function flushPostFlushCbs(seen) {
+ if (pendingPostFlushCbs.length) {
+ const deduped = [...new Set(pendingPostFlushCbs)];
+ pendingPostFlushCbs.length = 0;
+ // #1947 already has active queue, nested flushPostFlushCbs call
+ if (activePostFlushCbs) {
+ activePostFlushCbs.push(...deduped);
+ return;
+ }
+ activePostFlushCbs = deduped;
+ if ((process.env.NODE_ENV !== 'production')) {
+ seen = seen || new Map();
+ }
+ activePostFlushCbs.sort((a, b) => getId(a) - getId(b));
+ for (postFlushIndex = 0; postFlushIndex < activePostFlushCbs.length; postFlushIndex++) {
+ if ((process.env.NODE_ENV !== 'production') &&
+ checkRecursiveUpdates(seen, activePostFlushCbs[postFlushIndex])) {
+ continue;
+ }
+ activePostFlushCbs[postFlushIndex]();
+ }
+ activePostFlushCbs = null;
+ postFlushIndex = 0;
+ }
+}
+const getId = (job) => job.id == null ? Infinity : job.id;
+function flushJobs(seen) {
+ isFlushPending = false;
+ isFlushing = true;
+ if ((process.env.NODE_ENV !== 'production')) {
+ seen = seen || new Map();
+ }
+ flushPreFlushCbs(seen);
+ // Sort queue before flush.
+ // This ensures that:
+ // 1. Components are updated from parent to child. (because parent is always
+ // created before the child so its render effect will have smaller
+ // priority number)
+ // 2. If a component is unmounted during a parent component's update,
+ // its update can be skipped.
+ queue.sort((a, b) => getId(a) - getId(b));
+ try {
+ for (flushIndex = 0; flushIndex < queue.length; flushIndex++) {
+ const job = queue[flushIndex];
+ if (job && job.active !== false) {
+ if ((process.env.NODE_ENV !== 'production') && checkRecursiveUpdates(seen, job)) {
+ continue;
+ }
+ callWithErrorHandling(job, null, 14 /* SCHEDULER */);
+ }
+ }
+ }
+ finally {
+ flushIndex = 0;
+ queue.length = 0;
+ flushPostFlushCbs(seen);
+ isFlushing = false;
+ currentFlushPromise = null;
+ // some postFlushCb queued jobs!
+ // keep flushing until it drains.
+ if (queue.length ||
+ pendingPreFlushCbs.length ||
+ pendingPostFlushCbs.length) {
+ flushJobs(seen);
+ }
+ }
+}
+function checkRecursiveUpdates(seen, fn) {
+ if (!seen.has(fn)) {
+ seen.set(fn, 1);
+ }
+ else {
+ const count = seen.get(fn);
+ if (count > RECURSION_LIMIT) {
+ const instance = fn.ownerInstance;
+ const componentName = instance && getComponentName(instance.type);
+ warn(`Maximum recursive updates exceeded${componentName ? ` in component <${componentName}>` : ``}. ` +
+ `This means you have a reactive effect that is mutating its own ` +
+ `dependencies and thus recursively triggering itself. Possible sources ` +
+ `include component template, render function, updated hook or ` +
+ `watcher source function.`);
+ return true;
+ }
+ else {
+ seen.set(fn, count + 1);
+ }
+ }
}
-// implementation, close to no-op
-function defineComponent(options) {
- return isFunction$1(options)
- ? { setup: options, name: options.name }
- : options
+/* eslint-disable no-restricted-globals */
+let isHmrUpdating = false;
+const hmrDirtyComponents = new Set();
+// Expose the HMR runtime on the window object
+// This makes it entirely tree-shakable without polluting the exports and makes
+// it easier to be used in toolings like vue-loader
+// Note: for a component to be eligible for HMR it also needs the __hmrId option
+// to be set so that its instances can be registered / removed.
+if ((process.env.NODE_ENV !== 'production')) {
+ const globalObject = typeof window !== 'undefined'
+ ? window
+ : typeof self !== 'undefined'
+ ? self
+ : typeof window !== 'undefined'
+ ? window
+ : {};
+ globalObject.__VUE_HMR_RUNTIME__ = {
+ createRecord: tryWrap(createRecord),
+ rerender: tryWrap(rerender),
+ reload: tryWrap(reload)
+ };
+}
+const map = new Map();
+function registerHMR(instance) {
+ const id = instance.type.__hmrId;
+ let record = map.get(id);
+ if (!record) {
+ createRecord(id, instance.type);
+ record = map.get(id);
+ }
+ record.instances.add(instance);
+}
+function unregisterHMR(instance) {
+ map.get(instance.type.__hmrId).instances.delete(instance);
+}
+function createRecord(id, component) {
+ if (!component) {
+ warn(`HMR API usage is out of date.\n` +
+ `Please upgrade vue-loader/vite/rollup-plugin-vue or other relevant ` +
+ `dependency that handles Vue SFC compilation.`);
+ component = {};
+ }
+ if (map.has(id)) {
+ return false;
+ }
+ map.set(id, {
+ component: isClassComponent(component) ? component.__vccOpts : component,
+ instances: new Set()
+ });
+ return true;
+}
+function rerender(id, newRender) {
+ const record = map.get(id);
+ if (!record)
+ return;
+ if (newRender)
+ record.component.render = newRender;
+ // Array.from creates a snapshot which avoids the set being mutated during
+ // updates
+ Array.from(record.instances).forEach(instance => {
+ if (newRender) {
+ instance.render = newRender;
+ }
+ instance.renderCache = [];
+ // this flag forces child components with slot content to update
+ isHmrUpdating = true;
+ instance.update();
+ isHmrUpdating = false;
+ });
+}
+function reload(id, newComp) {
+ const record = map.get(id);
+ if (!record)
+ return;
+ // Array.from creates a snapshot which avoids the set being mutated during
+ // updates
+ const { component, instances } = record;
+ if (!hmrDirtyComponents.has(component)) {
+ // 1. Update existing comp definition to match new one
+ newComp = isClassComponent(newComp) ? newComp.__vccOpts : newComp;
+ extend(component, newComp);
+ for (const key in component) {
+ if (key !== '__file' && !(key in newComp)) {
+ delete component[key];
+ }
+ }
+ // 2. Mark component dirty. This forces the renderer to replace the component
+ // on patch.
+ hmrDirtyComponents.add(component);
+ // 3. Make sure to unmark the component after the reload.
+ queuePostFlushCb(() => {
+ hmrDirtyComponents.delete(component);
+ });
+ }
+ Array.from(instances).forEach(instance => {
+ if (instance.parent) {
+ // 4. Force the parent instance to re-render. This will cause all updated
+ // components to be unmounted and re-mounted. Queue the update so that we
+ // don't end up forcing the same parent to re-render multiple times.
+ queueJob(instance.parent.update);
+ }
+ else if (instance.appContext.reload) {
+ // root instance mounted via createApp() has a reload method
+ instance.appContext.reload();
+ }
+ else if (typeof window !== 'undefined') {
+ // root instance inside tree created via raw render(). Force reload.
+ window.location.reload();
+ }
+ else {
+ console.warn('[HMR] Root or manually mounted instance modified. Full reload required.');
+ }
+ });
+}
+function tryWrap(fn) {
+ return (id, arg) => {
+ try {
+ return fn(id, arg);
+ }
+ catch (e) {
+ console.error(e);
+ console.warn(`[HMR] Something went wrong during Vue component hot-reload. ` +
+ `Full reload required.`);
+ }
+ };
}
-const isAsyncWrapper = (i) => !!i.type.__asyncLoader;
-function defineAsyncComponent(source) {
- if (isFunction$1(source)) {
- source = { loader: source };
- }
- const {
- loader,
- loadingComponent,
- errorComponent,
- delay = 200,
- timeout, // undefined = never times out
- suspensible = true,
- onError: userOnError,
- } = source;
- let pendingRequest = null;
- let resolvedComp;
- let retries = 0;
- const retry = () => {
- retries++;
- pendingRequest = null;
- return load()
- };
- const load = () => {
- let thisRequest;
- return (
- pendingRequest ||
- (thisRequest = pendingRequest =
- loader()
- .catch((err) => {
- err = err instanceof Error ? err : new Error(String(err));
- if (userOnError) {
- return new Promise((resolve, reject) => {
- const userRetry = () => resolve(retry());
- const userFail = () => reject(err);
- userOnError(err, userRetry, userFail, retries + 1);
- })
- } else {
- throw err
- }
- })
- .then((comp) => {
- if (thisRequest !== pendingRequest && pendingRequest) {
- return pendingRequest
- }
- if (process.env.NODE_ENV !== 'production' && !comp) {
- warn(
- `Async component loader resolved to undefined. ` +
- `If you are using retry(), make sure to return its return value.`
- );
- }
- // interop module default
- if (
- comp &&
- (comp.__esModule || comp[Symbol.toStringTag] === 'Module')
- ) {
- comp = comp.default;
- }
- if (
- process.env.NODE_ENV !== 'production' &&
- comp &&
- !isObject$1(comp) &&
- !isFunction$1(comp)
- ) {
- throw new Error(`Invalid async component load result: ${comp}`)
- }
- resolvedComp = comp;
- return comp
- }))
- )
- };
- return defineComponent({
- name: 'AsyncComponentWrapper',
- __asyncLoader: load,
- get __asyncResolved() {
- return resolvedComp
- },
- setup() {
- const instance = currentInstance;
- // already resolved
- if (resolvedComp) {
- return () => createInnerComp(resolvedComp, instance)
- }
- const onError = (err) => {
- pendingRequest = null;
- handleError(
- err,
- instance,
- 13 /* ASYNC_COMPONENT_LOADER */,
- !errorComponent /* do not throw in dev if user provided error component */
- );
- };
- // suspense-controlled or SSR.
- if ((suspensible && instance.suspense) || false) {
- return load()
- .then((comp) => {
- return () => createInnerComp(comp, instance)
- })
- .catch((err) => {
- onError(err);
- return () =>
- errorComponent
- ? createVNode(errorComponent, {
- error: err,
- })
- : null
- })
- }
- const loaded = ref(false);
- const error = ref();
- const delayed = ref(!!delay);
- if (delay) {
- setTimeout(() => {
- delayed.value = false;
- }, delay);
- }
- if (timeout != null) {
- setTimeout(() => {
- if (!loaded.value && !error.value) {
- const err = new Error(
- `Async component timed out after ${timeout}ms.`
- );
- onError(err);
- error.value = err;
- }
- }, timeout);
- }
- load()
- .then(() => {
- loaded.value = true;
- if (instance.parent && isKeepAlive(instance.parent.vnode)) {
- // parent is keep-alive, force update so the loaded component's
- // name is taken into account
- queueJob(instance.parent.update);
- }
- })
- .catch((err) => {
- onError(err);
- error.value = err;
- });
- return () => {
- if (loaded.value && resolvedComp) {
- return createInnerComp(resolvedComp, instance)
- } else if (error.value && errorComponent) {
- return createVNode(errorComponent, {
- error: error.value,
- })
- } else if (loadingComponent && !delayed.value) {
- return createVNode(loadingComponent)
- }
- }
- },
- })
+let devtools;
+function setDevtoolsHook(hook) {
+ devtools = hook;
+}
+function devtoolsInitApp(app, version) {
+ // TODO queue if devtools is undefined
+ if (!devtools)
+ return;
+ devtools.emit("app:init" /* APP_INIT */, app, version, {
+ Fragment,
+ Text,
+ Comment: Comment$1,
+ Static
+ });
+}
+function devtoolsUnmountApp(app) {
+ if (!devtools)
+ return;
+ devtools.emit("app:unmount" /* APP_UNMOUNT */, app);
+}
+const devtoolsComponentAdded = /*#__PURE__*/ createDevtoolsComponentHook("component:added" /* COMPONENT_ADDED */);
+const devtoolsComponentUpdated = /*#__PURE__*/ createDevtoolsComponentHook("component:updated" /* COMPONENT_UPDATED */);
+const devtoolsComponentRemoved = /*#__PURE__*/ createDevtoolsComponentHook("component:removed" /* COMPONENT_REMOVED */);
+function createDevtoolsComponentHook(hook) {
+ return (component) => {
+ if (!devtools)
+ return;
+ devtools.emit(hook, component.appContext.app, component.uid, component.parent ? component.parent.uid : undefined, component);
+ };
+}
+const devtoolsPerfStart = /*#__PURE__*/ createDevtoolsPerformanceHook("perf:start" /* PERFORMANCE_START */);
+const devtoolsPerfEnd = /*#__PURE__*/ createDevtoolsPerformanceHook("perf:end" /* PERFORMANCE_END */);
+function createDevtoolsPerformanceHook(hook) {
+ return (component, type, time) => {
+ if (!devtools)
+ return;
+ devtools.emit(hook, component.appContext.app, component.uid, component, type, time);
+ };
+}
+function devtoolsComponentEmit(component, event, params) {
+ if (!devtools)
+ return;
+ devtools.emit("component:emit" /* COMPONENT_EMIT */, component.appContext.app, component, event, params);
}
-function createInnerComp(comp, { vnode: { ref, props, children } }) {
- const vnode = createVNode(comp, props, children);
- // ensure inner component inherits the async wrapper's ref owner
- vnode.ref = ref;
- return vnode
+const globalCompatConfig = {
+ MODE: 2
+};
+function getCompatConfigForKey(key, instance) {
+ const instanceConfig = instance && instance.type.compatConfig;
+ if (instanceConfig && key in instanceConfig) {
+ return instanceConfig[key];
+ }
+ return globalCompatConfig[key];
+}
+function isCompatEnabled(key, instance, enableForBuiltIn = false) {
+ // skip compat for built-in components
+ if (!enableForBuiltIn && instance && instance.type.__isBuiltIn) {
+ return false;
+ }
+ const rawMode = getCompatConfigForKey('MODE', instance) || 2;
+ const val = getCompatConfigForKey(key, instance);
+ const mode = isFunction$1(rawMode)
+ ? rawMode(instance && instance.type)
+ : rawMode;
+ if (mode === 2) {
+ return val !== false;
+ }
+ else {
+ return val === true || val === 'suppress-warning';
+ }
}
-const isKeepAlive = (vnode) => vnode.type.__isKeepAlive;
-const KeepAliveImpl = {
- name: `KeepAlive`,
- // Marker for special handling inside the renderer. We are not using a ===
- // check directly on KeepAlive in the renderer, because importing it directly
- // would prevent it from being tree-shaken.
- __isKeepAlive: true,
- props: {
- include: [String, RegExp, Array],
- exclude: [String, RegExp, Array],
- max: [String, Number],
- },
- setup(props, { slots }) {
- const instance = getCurrentInstance();
- // KeepAlive communicates with the instantiated renderer via the
- // ctx where the renderer passes in its internals,
- // and the KeepAlive instance exposes activate/deactivate implementations.
- // The whole point of this is to avoid importing KeepAlive directly in the
- // renderer to facilitate tree-shaking.
- const sharedContext = instance.ctx;
- // if the internal renderer is not registered, it indicates that this is server-side rendering,
- // for KeepAlive, we just need to render its children
- if (!sharedContext.renderer) {
- return slots.default
- }
- const cache = new Map();
- const keys = new Set();
- let current = null;
- if (process.env.NODE_ENV !== 'production' || false) {
- instance.__v_cache = cache;
- }
- const parentSuspense = instance.suspense;
- const {
- renderer: {
- p: patch,
- m: move,
- um: _unmount,
- o: { createElement },
- },
- } = sharedContext;
- const storageContainer = createElement('div');
- sharedContext.activate = (vnode, container, anchor, isSVG, optimized) => {
- const instance = vnode.component;
- move(vnode, container, anchor, 0 /* ENTER */, parentSuspense);
- // in case props have changed
- patch(
- instance.vnode,
- vnode,
- container,
- anchor,
- instance,
- parentSuspense,
- isSVG,
- vnode.slotScopeIds,
- optimized
- );
- queuePostRenderEffect(() => {
- instance.isDeactivated = false;
- if (instance.a) {
- invokeArrayFns(instance.a);
- }
- const vnodeHook = vnode.props && vnode.props.onVnodeMounted;
- if (vnodeHook) {
- invokeVNodeHook(vnodeHook, instance.parent, vnode);
- }
- }, parentSuspense);
- if (process.env.NODE_ENV !== 'production' || false) {
- // Update components tree
- devtoolsComponentAdded(instance);
- }
- };
- sharedContext.deactivate = (vnode) => {
- const instance = vnode.component;
- move(vnode, storageContainer, null, 1 /* LEAVE */, parentSuspense);
- queuePostRenderEffect(() => {
- if (instance.da) {
- invokeArrayFns(instance.da);
- }
- const vnodeHook = vnode.props && vnode.props.onVnodeUnmounted;
- if (vnodeHook) {
- invokeVNodeHook(vnodeHook, instance.parent, vnode);
- }
- instance.isDeactivated = true;
- }, parentSuspense);
- if (process.env.NODE_ENV !== 'production' || false) {
- // Update components tree
- devtoolsComponentAdded(instance);
- }
- };
- function unmount(vnode) {
- // reset the shapeFlag so it can be properly unmounted
- resetShapeFlag(vnode);
- _unmount(vnode, instance, parentSuspense);
- }
- function pruneCache(filter) {
- cache.forEach((vnode, key) => {
- const name = getComponentName(vnode.type);
- if (name && (!filter || !filter(name))) {
- pruneCacheEntry(key);
- }
- });
- }
- function pruneCacheEntry(key) {
- const cached = cache.get(key);
- if (!current || cached.type !== current.type) {
- unmount(cached);
- } else if (current) {
- // current active instance should no longer be kept-alive.
- // we can't unmount it now but it might be later, so reset its flag now.
- resetShapeFlag(current);
- }
- cache.delete(key);
- keys.delete(key);
- }
- // prune cache on include/exclude prop change
- watch(
- () => [props.include, props.exclude],
- ([include, exclude]) => {
- include && pruneCache((name) => matches(include, name));
- exclude && pruneCache((name) => !matches(exclude, name));
- },
- // prune post-render after `current` has been updated
- { flush: 'post', deep: true }
- );
- // cache sub tree after render
- let pendingCacheKey = null;
- const cacheSubtree = () => {
- // fix #1621, the pendingCacheKey could be 0
- if (pendingCacheKey != null) {
- cache.set(pendingCacheKey, getInnerChild(instance.subTree));
- }
- };
- onMounted(cacheSubtree);
- onUpdated(cacheSubtree);
- onBeforeUnmount(() => {
- cache.forEach((cached) => {
- const { subTree, suspense } = instance;
- const vnode = getInnerChild(subTree);
- if (cached.type === vnode.type) {
- // current instance will be unmounted as part of keep-alive's unmount
- resetShapeFlag(vnode);
- // but invoke its deactivated hook here
- const da = vnode.component.da;
- da && queuePostRenderEffect(da, suspense);
- return
- }
- unmount(cached);
- });
- });
- return () => {
- pendingCacheKey = null;
- if (!slots.default) {
- return null
- }
- const children = slots.default();
- const rawVNode = children[0];
- if (children.length > 1) {
- if (process.env.NODE_ENV !== 'production') {
- warn(`KeepAlive should contain exactly one component child.`);
- }
- current = null;
- return children
- } else if (
- !isVNode(rawVNode) ||
- (!((rawVNode.shapeFlag & 4) /* STATEFUL_COMPONENT */) &&
- !((rawVNode.shapeFlag & 128) /* SUSPENSE */))
- ) {
- current = null;
- return rawVNode
- }
- let vnode = getInnerChild(rawVNode);
- const comp = vnode.type;
- // for async components, name check should be based in its loaded
- // inner component if available
- const name = getComponentName(
- isAsyncWrapper(vnode) ? vnode.type.__asyncResolved || {} : comp
- );
- const { include, exclude, max } = props;
- if (
- (include && (!name || !matches(include, name))) ||
- (exclude && name && matches(exclude, name))
- ) {
- current = vnode;
- return rawVNode
- }
- const key = vnode.key == null ? comp : vnode.key;
- const cachedVNode = cache.get(key);
- // clone vnode if it's reused because we are going to mutate it
- if (vnode.el) {
- vnode = cloneVNode(vnode);
- if (rawVNode.shapeFlag & 128 /* SUSPENSE */) {
- rawVNode.ssContent = vnode;
- }
- }
- // #1513 it's possible for the returned vnode to be cloned due to attr
- // fallthrough or scopeId, so the vnode here may not be the final vnode
- // that is mounted. Instead of caching it directly, we store the pending
- // key and cache `instance.subTree` (the normalized vnode) in
- // beforeMount/beforeUpdate hooks.
- pendingCacheKey = key;
- if (cachedVNode) {
- // copy over mounted state
- vnode.el = cachedVNode.el;
- vnode.component = cachedVNode.component;
- if (vnode.transition) {
- // recursively update transition hooks on subTree
- setTransitionHooks(vnode, vnode.transition);
- }
- // avoid vnode being mounted as fresh
- vnode.shapeFlag |= 512; /* COMPONENT_KEPT_ALIVE */
- // make this key the freshest
- keys.delete(key);
- keys.add(key);
- } else {
- keys.add(key);
- // prune oldest entry
- if (max && keys.size > parseInt(max, 10)) {
- pruneCacheEntry(keys.values().next().value);
- }
- }
- // avoid vnode being unmounted
- vnode.shapeFlag |= 256; /* COMPONENT_SHOULD_KEEP_ALIVE */
- current = vnode;
- return rawVNode
- }
- },
-};
-// export the public type for h/tsx inference
-// also to avoid inline import() in generated d.ts files
-const KeepAlive = KeepAliveImpl;
-function matches(pattern, name) {
- if (isArray(pattern)) {
- return pattern.some((p) => matches(p, name))
- } else if (isString(pattern)) {
- return pattern.split(',').indexOf(name) > -1
- } else if (pattern.test) {
- return pattern.test(name)
- }
- /* istanbul ignore next */
- return false
-}
-function onActivated(hook, target) {
- registerKeepAliveHook(hook, 'a' /* ACTIVATED */, target);
-}
-function onDeactivated(hook, target) {
- registerKeepAliveHook(hook, 'da' /* DEACTIVATED */, target);
-}
-function registerKeepAliveHook(hook, type, target = currentInstance) {
- // cache the deactivate branch check wrapper for injected hooks so the same
- // hook can be properly deduped by the scheduler. "__wdc" stands for "with
- // deactivation check".
- const wrappedHook =
- hook.__wdc ||
- (hook.__wdc = () => {
- // only fire the hook if the target instance is NOT in a deactivated branch.
- let current = target;
- while (current) {
- if (current.isDeactivated) {
- return
- }
- current = current.parent;
- }
- hook();
- });
- injectHook(type, wrappedHook, target);
- // In addition to registering it on the target instance, we walk up the parent
- // chain and register it on all ancestor instances that are keep-alive roots.
- // This avoids the need to walk the entire component tree when invoking these
- // hooks, and more importantly, avoids the need to track child components in
- // arrays.
- if (target) {
- let current = target.parent;
- while (current && current.parent) {
- if (isKeepAlive(current.parent.vnode)) {
- injectToKeepAliveRoot(wrappedHook, type, target, current);
- }
- current = current.parent;
- }
- }
-}
-function injectToKeepAliveRoot(hook, type, target, keepAliveRoot) {
- // injectHook wraps the original for error handling, so make sure to remove
- // the wrapped version.
- const injected = injectHook(type, hook, keepAliveRoot, true /* prepend */);
- onUnmounted(() => {
- remove(keepAliveRoot[type], injected);
- }, target);
-}
-function resetShapeFlag(vnode) {
- let shapeFlag = vnode.shapeFlag;
- if (shapeFlag & 256 /* COMPONENT_SHOULD_KEEP_ALIVE */) {
- shapeFlag -= 256; /* COMPONENT_SHOULD_KEEP_ALIVE */
- }
- if (shapeFlag & 512 /* COMPONENT_KEPT_ALIVE */) {
- shapeFlag -= 512; /* COMPONENT_KEPT_ALIVE */
- }
- vnode.shapeFlag = shapeFlag;
-}
-function getInnerChild(vnode) {
- return vnode.shapeFlag & 128 /* SUSPENSE */ ? vnode.ssContent : vnode
+function emit(instance, event, ...rawArgs) {
+ const props = instance.vnode.props || EMPTY_OBJ;
+ if ((process.env.NODE_ENV !== 'production')) {
+ const { emitsOptions, propsOptions: [propsOptions] } = instance;
+ if (emitsOptions) {
+ if (!(event in emitsOptions) &&
+ !(false )) {
+ if (!propsOptions || !(toHandlerKey(event) in propsOptions)) {
+ warn(`Component emitted event "${event}" but it is neither declared in ` +
+ `the emits option nor as an "${toHandlerKey(event)}" prop.`);
+ }
+ }
+ else {
+ const validator = emitsOptions[event];
+ if (isFunction$1(validator)) {
+ const isValid = validator(...rawArgs);
+ if (!isValid) {
+ warn(`Invalid event arguments: event validation failed for event "${event}".`);
+ }
+ }
+ }
+ }
+ }
+ let args = rawArgs;
+ const isModelListener = event.startsWith('update:');
+ // for v-model update:xxx events, apply modifiers on args
+ const modelArg = isModelListener && event.slice(7);
+ if (modelArg && modelArg in props) {
+ const modifiersKey = `${modelArg === 'modelValue' ? 'model' : modelArg}Modifiers`;
+ const { number, trim } = props[modifiersKey] || EMPTY_OBJ;
+ if (trim) {
+ args = rawArgs.map(a => a.trim());
+ }
+ else if (number) {
+ args = rawArgs.map(toNumber);
+ }
+ }
+ if ((process.env.NODE_ENV !== 'production') || false) {
+ devtoolsComponentEmit(instance, event, args);
+ }
+ if ((process.env.NODE_ENV !== 'production')) {
+ const lowerCaseEvent = event.toLowerCase();
+ if (lowerCaseEvent !== event && props[toHandlerKey(lowerCaseEvent)]) {
+ warn(`Event "${lowerCaseEvent}" is emitted in component ` +
+ `${formatComponentName(instance, instance.type)} but the handler is registered for "${event}". ` +
+ `Note that HTML attributes are case-insensitive and you cannot use ` +
+ `v-on to listen to camelCase events when using in-DOM templates. ` +
+ `You should probably use "${hyphenate(event)}" instead of "${event}".`);
+ }
+ }
+ let handlerName;
+ let handler = props[(handlerName = toHandlerKey(event))] ||
+ // also try camelCase event handler (#2249)
+ props[(handlerName = toHandlerKey(camelize(event)))];
+ // for v-model update:xxx events, also trigger kebab-case equivalent
+ // for props passed via kebab-case
+ if (!handler && isModelListener) {
+ handler = props[(handlerName = toHandlerKey(hyphenate(event)))];
+ }
+ if (handler) {
+ callWithAsyncErrorHandling(handler, instance, 6 /* COMPONENT_EVENT_HANDLER */, args);
+ }
+ const onceHandler = props[handlerName + `Once`];
+ if (onceHandler) {
+ if (!instance.emitted) {
+ instance.emitted = {};
+ }
+ else if (instance.emitted[handlerName]) {
+ return;
+ }
+ instance.emitted[handlerName] = true;
+ callWithAsyncErrorHandling(onceHandler, instance, 6 /* COMPONENT_EVENT_HANDLER */, args);
+ }
+}
+function normalizeEmitsOptions(comp, appContext, asMixin = false) {
+ const cache = appContext.emitsCache;
+ const cached = cache.get(comp);
+ if (cached !== undefined) {
+ return cached;
+ }
+ const raw = comp.emits;
+ let normalized = {};
+ // apply mixin/extends props
+ let hasExtends = false;
+ if (!isFunction$1(comp)) {
+ const extendEmits = (raw) => {
+ const normalizedFromExtend = normalizeEmitsOptions(raw, appContext, true);
+ if (normalizedFromExtend) {
+ hasExtends = true;
+ extend(normalized, normalizedFromExtend);
+ }
+ };
+ if (!asMixin && appContext.mixins.length) {
+ appContext.mixins.forEach(extendEmits);
+ }
+ if (comp.extends) {
+ extendEmits(comp.extends);
+ }
+ if (comp.mixins) {
+ comp.mixins.forEach(extendEmits);
+ }
+ }
+ if (!raw && !hasExtends) {
+ cache.set(comp, null);
+ return null;
+ }
+ if (isArray(raw)) {
+ raw.forEach(key => (normalized[key] = null));
+ }
+ else {
+ extend(normalized, raw);
+ }
+ cache.set(comp, normalized);
+ return normalized;
+}
+// Check if an incoming prop key is a declared emit event listener.
+// e.g. With `emits: { click: null }`, props named `onClick` and `onclick` are
+// both considered matched listeners.
+function isEmitListener(options, key) {
+ if (!options || !isOn(key)) {
+ return false;
+ }
+ key = key.slice(2).replace(/Once$/, '');
+ return (hasOwn(options, key[0].toLowerCase() + key.slice(1)) ||
+ hasOwn(options, hyphenate(key)) ||
+ hasOwn(options, key));
}
-function injectHook(type, hook, target = currentInstance, prepend = false) {
- if (target) {
- const hooks = target[type] || (target[type] = []);
- // cache the error handling wrapper for injected hooks so the same hook
- // can be properly deduped by the scheduler. "__weh" stands for "with error
- // handling".
- const wrappedHook =
- hook.__weh ||
- (hook.__weh = (...args) => {
- if (target.isUnmounted) {
- return
- }
- // disable tracking inside all lifecycle hooks
- // since they can potentially be called inside effects.
- pauseTracking();
- // Set currentInstance during hook invocation.
- // This assumes the hook does not synchronously trigger other hooks, which
- // can only be false when the user does something really funky.
- setCurrentInstance(target);
- const res = callWithAsyncErrorHandling(hook, target, type, args);
- setCurrentInstance(null);
- resetTracking();
- return res
- });
- if (prepend) {
- hooks.unshift(wrappedHook);
- } else {
- hooks.push(wrappedHook);
- }
- return wrappedHook
- } else if (process.env.NODE_ENV !== 'production') {
- const apiName = toHandlerKey(ErrorTypeStrings[type].replace(/ hook$/, ''));
- warn(
- `${apiName} is called when there is no active component instance to be ` +
- `associated with. ` +
- `Lifecycle injection APIs can only be used during execution of setup().` +
- (` If you are using async setup(), make sure to register lifecycle ` +
- `hooks before the first await statement.`)
- );
- }
-}
-const createHook =
- (lifecycle) =>
- (hook, target = currentInstance) =>
- // post-create lifecycle registrations are noops during SSR (except for serverPrefetch)
- (!isInSSRComponentSetup || lifecycle === 'sp') /* SERVER_PREFETCH */ &&
- injectHook(lifecycle, hook, target);
-const onBeforeMount = createHook('bm' /* BEFORE_MOUNT */);
-const onMounted = createHook('m' /* MOUNTED */);
-const onBeforeUpdate = createHook('bu' /* BEFORE_UPDATE */);
-const onUpdated = createHook('u' /* UPDATED */);
-const onBeforeUnmount = createHook('bum' /* BEFORE_UNMOUNT */);
-const onUnmounted = createHook('um' /* UNMOUNTED */);
-const onServerPrefetch = createHook('sp' /* SERVER_PREFETCH */);
-const onRenderTriggered = createHook('rtg' /* RENDER_TRIGGERED */);
-const onRenderTracked = createHook('rtc' /* RENDER_TRACKED */);
-function onErrorCaptured(hook, target = currentInstance) {
- injectHook('ec' /* ERROR_CAPTURED */, hook, target);
+/**
+ * mark the current rendering instance for asset resolution (e.g.
+ * resolveComponent, resolveDirective) during render
+ */
+let currentRenderingInstance = null;
+let currentScopeId = null;
+/**
+ * Note: rendering calls maybe nested. The function returns the parent rendering
+ * instance if present, which should be restored after the render is done:
+ *
+ * ```js
+ * const prev = setCurrentRenderingInstance(i)
+ * // ...render
+ * setCurrentRenderingInstance(prev)
+ * ```
+ */
+function setCurrentRenderingInstance(instance) {
+ const prev = currentRenderingInstance;
+ currentRenderingInstance = instance;
+ currentScopeId = (instance && instance.type.__scopeId) || null;
+ return prev;
+}
+/**
+ * Set scope id when creating hoisted vnodes.
+ * @private compiler helper
+ */
+function pushScopeId(id) {
+ currentScopeId = id;
+}
+/**
+ * Technically we no longer need this after 3.0.8 but we need to keep the same
+ * API for backwards compat w/ code generated by compilers.
+ * @private
+ */
+function popScopeId() {
+ currentScopeId = null;
+}
+/**
+ * Only for backwards compat
+ * @private
+ */
+const withScopeId = (_id) => withCtx;
+/**
+ * Wrap a slot function to memoize current rendering instance
+ * @private compiler helper
+ */
+function withCtx(fn, ctx = currentRenderingInstance, isNonScopedSlot // false only
+) {
+ if (!ctx)
+ return fn;
+ // already normalized
+ if (fn._n) {
+ return fn;
+ }
+ const renderFnWithContext = (...args) => {
+ // If a user calls a compiled slot inside a template expression (#1745), it
+ // can mess up block tracking, so by default we disable block tracking and
+ // force bail out when invoking a compiled slot (indicated by the ._d flag).
+ // This isn't necessary if rendering a compiled ``, so we flip the
+ // ._d flag off when invoking the wrapped fn inside `renderSlot`.
+ if (renderFnWithContext._d) {
+ setBlockTracking(-1);
+ }
+ const prevInstance = setCurrentRenderingInstance(ctx);
+ const res = fn(...args);
+ setCurrentRenderingInstance(prevInstance);
+ if (renderFnWithContext._d) {
+ setBlockTracking(1);
+ }
+ if ((process.env.NODE_ENV !== 'production') || false) {
+ devtoolsComponentUpdated(ctx);
+ }
+ return res;
+ };
+ // mark normalized to avoid duplicated wrapping
+ renderFnWithContext._n = true;
+ // mark this as compiled by default
+ // this is used in vnode.ts -> normalizeChildren() to set the slot
+ // rendering flag.
+ renderFnWithContext._c = true;
+ // disable block tracking by default
+ renderFnWithContext._d = true;
+ return renderFnWithContext;
}
-function createDuplicateChecker() {
- const cache = Object.create(null);
- return (type, key) => {
- if (cache[key]) {
- warn(`${type} property "${key}" is already defined in ${cache[key]}.`);
- } else {
- cache[key] = type;
- }
- }
-}
-let shouldCacheAccess = true;
-function applyOptions(instance) {
- const options = resolveMergedOptions(instance);
- const publicThis = instance.proxy;
- const ctx = instance.ctx;
- // do not cache property access on public proxy during state initialization
- shouldCacheAccess = false;
- // call beforeCreate first before accessing other options since
- // the hook may mutate resolved options (#2791)
- if (options.beforeCreate) {
- callHook(options.beforeCreate, instance, 'bc' /* BEFORE_CREATE */);
- }
- const {
- // state
- data: dataOptions,
- computed: computedOptions,
- methods,
- watch: watchOptions,
- provide: provideOptions,
- inject: injectOptions,
- // lifecycle
- created,
- beforeMount,
- mounted,
- beforeUpdate,
- updated,
- activated,
- deactivated,
- beforeDestroy,
- beforeUnmount,
- destroyed,
- unmounted,
- render,
- renderTracked,
- renderTriggered,
- errorCaptured,
- serverPrefetch,
- // public API
- expose,
- inheritAttrs,
- // assets
- components,
- directives,
- filters,
- } = options;
- const checkDuplicateProperties =
- process.env.NODE_ENV !== 'production' ? createDuplicateChecker() : null;
- if (process.env.NODE_ENV !== 'production') {
- const [propsOptions] = instance.propsOptions;
- if (propsOptions) {
- for (const key in propsOptions) {
- checkDuplicateProperties('Props' /* PROPS */, key);
- }
- }
- }
- // options initialization order (to be consistent with Vue 2):
- // - props (already done outside of this function)
- // - inject
- // - methods
- // - data (deferred since it relies on `this` access)
- // - computed
- // - watch (deferred since it relies on `this` access)
- if (injectOptions) {
- resolveInjections(injectOptions, ctx, checkDuplicateProperties);
- }
- if (methods) {
- for (const key in methods) {
- const methodHandler = methods[key];
- if (isFunction$1(methodHandler)) {
- // In dev mode, we use the `createRenderContext` function to define methods to the proxy target,
- // and those are read-only but reconfigurable, so it needs to be redefined here
- if (process.env.NODE_ENV !== 'production') {
- Object.defineProperty(ctx, key, {
- value: methodHandler.bind(publicThis),
- configurable: true,
- enumerable: true,
- writable: true,
- });
- } else {
- ctx[key] = methodHandler.bind(publicThis);
- }
- if (process.env.NODE_ENV !== 'production') {
- checkDuplicateProperties('Methods' /* METHODS */, key);
- }
- } else if (process.env.NODE_ENV !== 'production') {
- warn(
- `Method "${key}" has type "${typeof methodHandler}" in the component definition. ` +
- `Did you reference the function correctly?`
- );
- }
- }
- }
- if (dataOptions) {
- if (process.env.NODE_ENV !== 'production' && !isFunction$1(dataOptions)) {
- warn(
- `The data option must be a function. ` +
- `Plain object usage is no longer supported.`
- );
- }
- const data = dataOptions.call(publicThis, publicThis);
- if (process.env.NODE_ENV !== 'production' && isPromise$1(data)) {
- warn(
- `data() returned a Promise - note data() cannot be async; If you ` +
- `intend to perform data fetching before component renders, use ` +
- `async setup() + .`
- );
- }
- if (!isObject$1(data)) {
- process.env.NODE_ENV !== 'production' &&
- warn(`data() should return an object.`);
- } else {
- instance.data = reactive(data);
- if (process.env.NODE_ENV !== 'production') {
- for (const key in data) {
- checkDuplicateProperties('Data' /* DATA */, key);
- // expose data on ctx during dev
- if (key[0] !== '$' && key[0] !== '_') {
- Object.defineProperty(ctx, key, {
- configurable: true,
- enumerable: true,
- get: () => data[key],
- set: NOOP,
- });
- }
- }
- }
- }
- }
- // state initialization complete at this point - start caching access
- shouldCacheAccess = true;
- if (computedOptions) {
- for (const key in computedOptions) {
- const opt = computedOptions[key];
- const get = isFunction$1(opt)
- ? opt.bind(publicThis, publicThis)
- : isFunction$1(opt.get)
- ? opt.get.bind(publicThis, publicThis)
- : NOOP;
- if (process.env.NODE_ENV !== 'production' && get === NOOP) {
- warn(`Computed property "${key}" has no getter.`);
- }
- const set =
- !isFunction$1(opt) && isFunction$1(opt.set)
- ? opt.set.bind(publicThis)
- : process.env.NODE_ENV !== 'production'
- ? () => {
- warn(
- `Write operation failed: computed property "${key}" is readonly.`
- );
- }
- : NOOP;
- const c = computed$1({
- get,
- set,
- });
- Object.defineProperty(ctx, key, {
- enumerable: true,
- configurable: true,
- get: () => c.value,
- set: (v) => (c.value = v),
- });
- if (process.env.NODE_ENV !== 'production') {
- checkDuplicateProperties('Computed' /* COMPUTED */, key);
- }
- }
- }
- if (watchOptions) {
- for (const key in watchOptions) {
- createWatcher(watchOptions[key], ctx, publicThis, key);
- }
- }
- if (provideOptions) {
- const provides = isFunction$1(provideOptions)
- ? provideOptions.call(publicThis)
- : provideOptions;
- Reflect.ownKeys(provides).forEach((key) => {
- provide(key, provides[key]);
- });
- }
- if (created) {
- callHook(created, instance, 'c' /* CREATED */);
- }
- function registerLifecycleHook(register, hook) {
- if (isArray(hook)) {
- hook.forEach((_hook) => register(_hook.bind(publicThis)));
- } else if (hook) {
- register(hook.bind(publicThis));
- }
- }
- registerLifecycleHook(onBeforeMount, beforeMount);
- registerLifecycleHook(onMounted, mounted);
- registerLifecycleHook(onBeforeUpdate, beforeUpdate);
- registerLifecycleHook(onUpdated, updated);
- registerLifecycleHook(onActivated, activated);
- registerLifecycleHook(onDeactivated, deactivated);
- registerLifecycleHook(onErrorCaptured, errorCaptured);
- registerLifecycleHook(onRenderTracked, renderTracked);
- registerLifecycleHook(onRenderTriggered, renderTriggered);
- registerLifecycleHook(onBeforeUnmount, beforeUnmount);
- registerLifecycleHook(onUnmounted, unmounted);
- registerLifecycleHook(onServerPrefetch, serverPrefetch);
- if (isArray(expose)) {
- if (expose.length) {
- const exposed = instance.exposed || (instance.exposed = {});
- expose.forEach((key) => {
- Object.defineProperty(exposed, key, {
- get: () => publicThis[key],
- set: (val) => (publicThis[key] = val),
- });
- });
- } else if (!instance.exposed) {
- instance.exposed = {};
- }
- }
- // options that are handled when creating the instance but also need to be
- // applied from mixins
- if (render && instance.render === NOOP) {
- instance.render = render;
- }
- if (inheritAttrs != null) {
- instance.inheritAttrs = inheritAttrs;
- }
- // asset options.
- if (components) instance.components = components;
- if (directives) instance.directives = directives;
-}
-function resolveInjections(
- injectOptions,
- ctx,
- checkDuplicateProperties = NOOP
-) {
- if (isArray(injectOptions)) {
- injectOptions = normalizeInject(injectOptions);
- }
- for (const key in injectOptions) {
- const opt = injectOptions[key];
- if (isObject$1(opt)) {
- if ('default' in opt) {
- ctx[key] = inject(
- opt.from || key,
- opt.default,
- true /* treat default function as factory */
- );
- } else {
- ctx[key] = inject(opt.from || key);
- }
- } else {
- ctx[key] = inject(opt);
- }
- if (process.env.NODE_ENV !== 'production') {
- checkDuplicateProperties('Inject' /* INJECT */, key);
- }
- }
-}
-function callHook(hook, instance, type) {
- callWithAsyncErrorHandling(
- isArray(hook)
- ? hook.map((h) => h.bind(instance.proxy))
- : hook.bind(instance.proxy),
- instance,
- type
- );
-}
-function createWatcher(raw, ctx, publicThis, key) {
- const getter = key.includes('.')
- ? createPathGetter(publicThis, key)
- : () => publicThis[key];
- if (isString(raw)) {
- const handler = ctx[raw];
- if (isFunction$1(handler)) {
- watch(getter, handler);
- } else if (process.env.NODE_ENV !== 'production') {
- warn(`Invalid watch handler specified by key "${raw}"`, handler);
- }
- } else if (isFunction$1(raw)) {
- watch(getter, raw.bind(publicThis));
- } else if (isObject$1(raw)) {
- if (isArray(raw)) {
- raw.forEach((r) => createWatcher(r, ctx, publicThis, key));
- } else {
- const handler = isFunction$1(raw.handler)
- ? raw.handler.bind(publicThis)
- : ctx[raw.handler];
- if (isFunction$1(handler)) {
- watch(getter, handler, raw);
- } else if (process.env.NODE_ENV !== 'production') {
- warn(`Invalid watch handler specified by key "${raw.handler}"`, handler);
- }
- }
- } else if (process.env.NODE_ENV !== 'production') {
- warn(`Invalid watch option: "${key}"`, raw);
- }
-}
-/**
- * Resolve merged options and cache it on the component.
- * This is done only once per-component since the merging does not involve
- * instances.
- */
-function resolveMergedOptions(instance) {
- const base = instance.type;
- const { mixins, extends: extendsOptions } = base;
- const {
- mixins: globalMixins,
- optionsCache: cache,
- config: { optionMergeStrategies },
- } = instance.appContext;
- const cached = cache.get(base);
- let resolved;
- if (cached) {
- resolved = cached;
- } else if (!globalMixins.length && !mixins && !extendsOptions) {
- {
- resolved = base;
- }
- } else {
- resolved = {};
- if (globalMixins.length) {
- globalMixins.forEach((m) =>
- mergeOptions(resolved, m, optionMergeStrategies, true)
- );
- }
- mergeOptions(resolved, base, optionMergeStrategies);
- }
- cache.set(base, resolved);
- return resolved
-}
-function mergeOptions(to, from, strats, asMixin = false) {
- const { mixins, extends: extendsOptions } = from;
- if (extendsOptions) {
- mergeOptions(to, extendsOptions, strats, true);
- }
- if (mixins) {
- mixins.forEach((m) => mergeOptions(to, m, strats, true));
- }
- for (const key in from) {
- if (asMixin && key === 'expose') {
- process.env.NODE_ENV !== 'production' &&
- warn(
- `"expose" option is ignored when declared in mixins or extends. ` +
- `It should only be declared in the base component itself.`
- );
- } else {
- const strat = internalOptionMergeStrats[key] || (strats && strats[key]);
- to[key] = strat ? strat(to[key], from[key]) : from[key];
- }
- }
- return to
-}
-const internalOptionMergeStrats = {
- data: mergeDataFn,
- props: mergeObjectOptions,
- emits: mergeObjectOptions,
- // objects
- methods: mergeObjectOptions,
- computed: mergeObjectOptions,
- // lifecycle
- beforeCreate: mergeAsArray,
- created: mergeAsArray,
- beforeMount: mergeAsArray,
- mounted: mergeAsArray,
- beforeUpdate: mergeAsArray,
- updated: mergeAsArray,
- beforeDestroy: mergeAsArray,
- destroyed: mergeAsArray,
- activated: mergeAsArray,
- deactivated: mergeAsArray,
- errorCaptured: mergeAsArray,
- serverPrefetch: mergeAsArray,
- // assets
- components: mergeObjectOptions,
- directives: mergeObjectOptions,
- // watch
- watch: mergeWatchOptions,
- // provide / inject
- provide: mergeDataFn,
- inject: mergeInject,
-};
-function mergeDataFn(to, from) {
- if (!from) {
- return to
- }
- if (!to) {
- return from
- }
- return function mergedDataFn() {
- return extend(
- isFunction$1(to) ? to.call(this, this) : to,
- isFunction$1(from) ? from.call(this, this) : from
- )
- }
-}
-function mergeInject(to, from) {
- return mergeObjectOptions(normalizeInject(to), normalizeInject(from))
-}
-function normalizeInject(raw) {
- if (isArray(raw)) {
- const res = {};
- for (let i = 0; i < raw.length; i++) {
- res[raw[i]] = raw[i];
- }
- return res
- }
- return raw
-}
-function mergeAsArray(to, from) {
- return to ? [...new Set([].concat(to, from))] : from
-}
-function mergeObjectOptions(to, from) {
- return to ? extend(extend(Object.create(null), to), from) : from
-}
-function mergeWatchOptions(to, from) {
- if (!to) return from
- if (!from) return to
- const merged = extend(Object.create(null), to);
- for (const key in from) {
- merged[key] = mergeAsArray(to[key], from[key]);
- }
- return merged
-}
-
-function initProps(
- instance,
- rawProps,
- isStateful, // result of bitwise flag comparison
- isSSR = false
-) {
- const props = {};
- const attrs = {};
- def(attrs, InternalObjectKey, 1);
- instance.propsDefaults = Object.create(null);
- setFullProps(instance, rawProps, props, attrs);
- // ensure all declared prop keys are present
- for (const key in instance.propsOptions[0]) {
- if (!(key in props)) {
- props[key] = undefined;
- }
- }
- // validation
- if (process.env.NODE_ENV !== 'production') {
- validateProps(rawProps || {}, props, instance);
- }
- if (isStateful) {
- // stateful
- instance.props = isSSR ? props : shallowReactive(props);
- } else {
- if (!instance.type.props) {
- // functional w/ optional props, props === attrs
- instance.props = attrs;
- } else {
- // functional w/ declared props
- instance.props = props;
- }
- }
- instance.attrs = attrs;
-}
-function updateProps(instance, rawProps, rawPrevProps, optimized) {
- const {
- props,
- attrs,
- vnode: { patchFlag },
- } = instance;
- const rawCurrentProps = toRaw(props);
- const [options] = instance.propsOptions;
- let hasAttrsChanged = false;
- if (
- // always force full diff in dev
- // - #1942 if hmr is enabled with sfc component
- // - vite#872 non-sfc component used by sfc component
- !(
- process.env.NODE_ENV !== 'production' &&
- (instance.type.__hmrId ||
- (instance.parent && instance.parent.type.__hmrId))
- ) &&
- (optimized || patchFlag > 0) &&
- !((patchFlag & 16) /* FULL_PROPS */)
- ) {
- if (patchFlag & 8 /* PROPS */) {
- // Compiler-generated props & no keys change, just set the updated
- // the props.
- const propsToUpdate = instance.vnode.dynamicProps;
- for (let i = 0; i < propsToUpdate.length; i++) {
- let key = propsToUpdate[i];
- // PROPS flag guarantees rawProps to be non-null
- const value = rawProps[key];
- if (options) {
- // attr / props separation was done on init and will be consistent
- // in this code path, so just check if attrs have it.
- if (hasOwn(attrs, key)) {
- if (value !== attrs[key]) {
- attrs[key] = value;
- hasAttrsChanged = true;
- }
- } else {
- const camelizedKey = camelize(key);
- props[camelizedKey] = resolvePropValue(
- options,
- rawCurrentProps,
- camelizedKey,
- value,
- instance,
- false /* isAbsent */
- );
- }
- } else {
- if (value !== attrs[key]) {
- attrs[key] = value;
- hasAttrsChanged = true;
- }
- }
- }
- }
- } else {
- // full props update.
- if (setFullProps(instance, rawProps, props, attrs)) {
- hasAttrsChanged = true;
- }
- // in case of dynamic props, check if we need to delete keys from
- // the props object
- let kebabKey;
- for (const key in rawCurrentProps) {
- if (
- !rawProps ||
- // for camelCase
- (!hasOwn(rawProps, key) &&
- // it's possible the original props was passed in as kebab-case
- // and converted to camelCase (#955)
- ((kebabKey = hyphenate(key)) === key || !hasOwn(rawProps, kebabKey)))
- ) {
- if (options) {
- if (
- rawPrevProps &&
- // for camelCase
- (rawPrevProps[key] !== undefined ||
- // for kebab-case
- rawPrevProps[kebabKey] !== undefined)
- ) {
- props[key] = resolvePropValue(
- options,
- rawCurrentProps,
- key,
- undefined,
- instance,
- true /* isAbsent */
- );
- }
- } else {
- delete props[key];
- }
- }
- }
- // in the case of functional component w/o props declaration, props and
- // attrs point to the same object so it should already have been updated.
- if (attrs !== rawCurrentProps) {
- for (const key in attrs) {
- if (!rawProps || !hasOwn(rawProps, key)) {
- delete attrs[key];
- hasAttrsChanged = true;
- }
- }
- }
- }
- // trigger updates for $attrs in case it's used in component slots
- if (hasAttrsChanged) {
- trigger(instance, 'set' /* SET */, '$attrs');
- }
- if (process.env.NODE_ENV !== 'production') {
- validateProps(rawProps || {}, props, instance);
- }
-}
-function setFullProps(instance, rawProps, props, attrs) {
- const [options, needCastKeys] = instance.propsOptions;
- let hasAttrsChanged = false;
- let rawCastValues;
- if (rawProps) {
- for (let key in rawProps) {
- // key, ref are reserved and never passed down
- if (isReservedProp(key)) {
- continue
- }
- const value = rawProps[key];
- // prop option names are camelized during normalization, so to support
- // kebab -> camel conversion here we need to camelize the key.
- let camelKey;
- if (options && hasOwn(options, (camelKey = camelize(key)))) {
- if (!needCastKeys || !needCastKeys.includes(camelKey)) {
- props[camelKey] = value;
- } else {
-(rawCastValues || (rawCastValues = {}))[camelKey] = value;
- }
- } else if (!isEmitListener(instance.emitsOptions, key)) {
- if (value !== attrs[key]) {
- attrs[key] = value;
- hasAttrsChanged = true;
- }
- }
- }
- }
- if (needCastKeys) {
- const rawCurrentProps = toRaw(props);
- const castValues = rawCastValues || EMPTY_OBJ;
- for (let i = 0; i < needCastKeys.length; i++) {
- const key = needCastKeys[i];
- props[key] = resolvePropValue(
- options,
- rawCurrentProps,
- key,
- castValues[key],
- instance,
- !hasOwn(castValues, key)
- );
- }
- }
- return hasAttrsChanged
-}
-function resolvePropValue(options, props, key, value, instance, isAbsent) {
- const opt = options[key];
- if (opt != null) {
- const hasDefault = hasOwn(opt, 'default');
- // default values
- if (hasDefault && value === undefined) {
- const defaultValue = opt.default;
- if (opt.type !== Function && isFunction$1(defaultValue)) {
- const { propsDefaults } = instance;
- if (key in propsDefaults) {
- value = propsDefaults[key];
- } else {
- setCurrentInstance(instance);
- value = propsDefaults[key] = defaultValue.call(null, props);
- setCurrentInstance(null);
- }
- } else {
- value = defaultValue;
- }
- }
- // boolean casting
- if (opt[0 /* shouldCast */]) {
- if (isAbsent && !hasDefault) {
- value = false;
- } else if (
- opt[1 /* shouldCastTrue */] &&
- (value === '' || value === hyphenate(key))
- ) {
- value = true;
- }
- }
- }
- return value
-}
-function normalizePropsOptions(comp, appContext, asMixin = false) {
- const cache = appContext.propsCache;
- const cached = cache.get(comp);
- if (cached) {
- return cached
- }
- const raw = comp.props;
- const normalized = {};
- const needCastKeys = [];
- // apply mixin/extends props
- let hasExtends = false;
- if (!isFunction$1(comp)) {
- const extendProps = (raw) => {
- hasExtends = true;
- const [props, keys] = normalizePropsOptions(raw, appContext, true);
- extend(normalized, props);
- if (keys) needCastKeys.push(...keys);
- };
- if (!asMixin && appContext.mixins.length) {
- appContext.mixins.forEach(extendProps);
- }
- if (comp.extends) {
- extendProps(comp.extends);
- }
- if (comp.mixins) {
- comp.mixins.forEach(extendProps);
- }
- }
- if (!raw && !hasExtends) {
- cache.set(comp, EMPTY_ARR);
- return EMPTY_ARR
- }
- if (isArray(raw)) {
- for (let i = 0; i < raw.length; i++) {
- if (process.env.NODE_ENV !== 'production' && !isString(raw[i])) {
- warn(`props must be strings when using array syntax.`, raw[i]);
- }
- const normalizedKey = camelize(raw[i]);
- if (validatePropName(normalizedKey)) {
- normalized[normalizedKey] = EMPTY_OBJ;
- }
- }
- } else if (raw) {
- if (process.env.NODE_ENV !== 'production' && !isObject$1(raw)) {
- warn(`invalid props options`, raw);
- }
- for (const key in raw) {
- const normalizedKey = camelize(key);
- if (validatePropName(normalizedKey)) {
- const opt = raw[key];
- const prop = (normalized[normalizedKey] =
- isArray(opt) || isFunction$1(opt) ? { type: opt } : opt);
- if (prop) {
- const booleanIndex = getTypeIndex(Boolean, prop.type);
- const stringIndex = getTypeIndex(String, prop.type);
- prop[0 /* shouldCast */] = booleanIndex > -1;
- prop[1 /* shouldCastTrue */] =
- stringIndex < 0 || booleanIndex < stringIndex;
- // if the prop needs boolean casting or default value
- if (booleanIndex > -1 || hasOwn(prop, 'default')) {
- needCastKeys.push(normalizedKey);
- }
- }
- }
- }
- }
- const res = [normalized, needCastKeys];
- cache.set(comp, res);
- return res
-}
-function validatePropName(key) {
- if (key[0] !== '$') {
- return true
- } else if (process.env.NODE_ENV !== 'production') {
- warn(`Invalid prop name: "${key}" is a reserved property.`);
- }
- return false
-}
-// use function string name to check type constructors
-// so that it works across vms / iframes.
-function getType(ctor) {
- const match = ctor && ctor.toString().match(/^\s*function (\w+)/);
- return match ? match[1] : ''
-}
-function isSameType(a, b) {
- return getType(a) === getType(b)
-}
-function getTypeIndex(type, expectedTypes) {
- if (isArray(expectedTypes)) {
- return expectedTypes.findIndex((t) => isSameType(t, type))
- } else if (isFunction$1(expectedTypes)) {
- return isSameType(expectedTypes, type) ? 0 : -1
- }
- return -1
-}
-/**
- * dev only
- */
-function validateProps(rawProps, props, instance) {
- const resolvedValues = toRaw(props);
- const options = instance.propsOptions[0];
- for (const key in options) {
- let opt = options[key];
- if (opt == null) continue
- validateProp(
- key,
- resolvedValues[key],
- opt,
- !hasOwn(rawProps, key) && !hasOwn(rawProps, hyphenate(key))
- );
- }
-}
-/**
- * dev only
- */
-function validateProp(name, value, prop, isAbsent) {
- const { type, required, validator } = prop;
- // required!
- if (required && isAbsent) {
- warn('Missing required prop: "' + name + '"');
- return
- }
- // missing but optional
- if (value == null && !prop.required) {
- return
- }
- // type check
- if (type != null && type !== true) {
- let isValid = false;
- const types = isArray(type) ? type : [type];
- const expectedTypes = [];
- // value is valid as long as one of the specified types match
- for (let i = 0; i < types.length && !isValid; i++) {
- const { valid, expectedType } = assertType(value, types[i]);
- expectedTypes.push(expectedType || '');
- isValid = valid;
- }
- if (!isValid) {
- warn(getInvalidTypeMessage(name, value, expectedTypes));
- return
- }
- }
- // custom validator
- if (validator && !validator(value)) {
- warn('Invalid prop: custom validator check failed for prop "' + name + '".');
- }
-}
-const isSimpleType = /*#__PURE__*/ makeMap(
- 'String,Number,Boolean,Function,Symbol,BigInt'
-);
-/**
- * dev only
- */
-function assertType(value, type) {
- let valid;
- const expectedType = getType(type);
- if (isSimpleType(expectedType)) {
- const t = typeof value;
- valid = t === expectedType.toLowerCase();
- // for primitive wrapper objects
- if (!valid && t === 'object') {
- valid = value instanceof type;
- }
- } else if (expectedType === 'Object') {
- valid = isObject$1(value);
- } else if (expectedType === 'Array') {
- valid = isArray(value);
- } else {
- valid = value instanceof type;
- }
- return {
- valid,
- expectedType,
- }
-}
-/**
- * dev only
- */
-function getInvalidTypeMessage(name, value, expectedTypes) {
- let message =
- `Invalid prop: type check failed for prop "${name}".` +
- ` Expected ${expectedTypes.map(capitalize).join(', ')}`;
- const expectedType = expectedTypes[0];
- const receivedType = toRawType(value);
- const expectedValue = styleValue(value, expectedType);
- const receivedValue = styleValue(value, receivedType);
- // check if we need to specify expected value
- if (
- expectedTypes.length === 1 &&
- isExplicable(expectedType) &&
- !isBoolean(expectedType, receivedType)
- ) {
- message += ` with value ${expectedValue}`;
- }
- message += `, got ${receivedType} `;
- // check if we need to specify received value
- if (isExplicable(receivedType)) {
- message += `with value ${receivedValue}.`;
- }
- return message
-}
-/**
- * dev only
- */
-function styleValue(value, type) {
- if (type === 'String') {
- return `"${value}"`
- } else if (type === 'Number') {
- return `${Number(value)}`
- } else {
- return `${value}`
- }
-}
-/**
- * dev only
- */
-function isExplicable(type) {
- const explicitTypes = ['string', 'number', 'boolean'];
- return explicitTypes.some((elem) => type.toLowerCase() === elem)
-}
-/**
- * dev only
- */
-function isBoolean(...args) {
- return args.some((elem) => elem.toLowerCase() === 'boolean')
-}
-
-const isInternalKey = (key) => key[0] === '_' || key === '$stable';
-const normalizeSlotValue = (value) =>
- isArray(value) ? value.map(normalizeVNode) : [normalizeVNode(value)];
-const normalizeSlot = (key, rawSlot, ctx) => {
- const normalized = withCtx((props) => {
- if (process.env.NODE_ENV !== 'production' && currentInstance) {
- warn(
- `Slot "${key}" invoked outside of the render function: ` +
- `this will not track dependencies used in the slot. ` +
- `Invoke the slot function inside the render function instead.`
- );
- }
- return normalizeSlotValue(rawSlot(props))
- }, ctx);
- normalized._c = false;
- return normalized
-};
-const normalizeObjectSlots = (rawSlots, slots, instance) => {
- const ctx = rawSlots._ctx;
- for (const key in rawSlots) {
- if (isInternalKey(key)) continue
- const value = rawSlots[key];
- if (isFunction$1(value)) {
- slots[key] = normalizeSlot(key, value, ctx);
- } else if (value != null) {
- if (process.env.NODE_ENV !== 'production' && !false) {
- warn(
- `Non-function value encountered for slot "${key}". ` +
- `Prefer function slots for better performance.`
- );
- }
- const normalized = normalizeSlotValue(value);
- slots[key] = () => normalized;
- }
- }
-};
-const normalizeVNodeSlots = (instance, children) => {
- if (
- process.env.NODE_ENV !== 'production' &&
- !isKeepAlive(instance.vnode) &&
- !false
- ) {
- warn(
- `Non-function value encountered for default slot. ` +
- `Prefer function slots for better performance.`
- );
- }
- const normalized = normalizeSlotValue(children);
- instance.slots.default = () => normalized;
-};
-const initSlots = (instance, children) => {
- if (instance.vnode.shapeFlag & 32 /* SLOTS_CHILDREN */) {
- const type = children._;
- if (type) {
- // users can get the shallow readonly version of the slots object through `this.$slots`,
- // we should avoid the proxy object polluting the slots of the internal instance
- instance.slots = toRaw(children);
- // make compiler marker non-enumerable
- def(children, '_', type);
- } else {
- normalizeObjectSlots(children, (instance.slots = {}));
- }
- } else {
- instance.slots = {};
- if (children) {
- normalizeVNodeSlots(instance, children);
- }
- }
- def(instance.slots, InternalObjectKey, 1);
-};
-const updateSlots = (instance, children, optimized) => {
- const { vnode, slots } = instance;
- let needDeletionCheck = true;
- let deletionComparisonTarget = EMPTY_OBJ;
- if (vnode.shapeFlag & 32 /* SLOTS_CHILDREN */) {
- const type = children._;
- if (type) {
- // compiled slots.
- if (process.env.NODE_ENV !== 'production' && isHmrUpdating) {
- // Parent was HMR updated so slot content may have changed.
- // force update slots and mark instance for hmr as well
- extend(slots, children);
- } else if (optimized && type === 1 /* STABLE */) {
- // compiled AND stable.
- // no need to update, and skip stale slots removal.
- needDeletionCheck = false;
- } else {
- // compiled but dynamic (v-if/v-for on slots) - update slots, but skip
- // normalization.
- extend(slots, children);
- // #2893
- // when rendering the optimized slots by manually written render function,
- // we need to delete the `slots._` flag if necessary to make subsequent updates reliable,
- // i.e. let the `renderSlot` create the bailed Fragment
- if (!optimized && type === 1 /* STABLE */) {
- delete slots._;
- }
- }
- } else {
- needDeletionCheck = !children.$stable;
- normalizeObjectSlots(children, slots);
- }
- deletionComparisonTarget = children;
- } else if (children) {
- // non slot object children (direct value) passed to a component
- normalizeVNodeSlots(instance, children);
- deletionComparisonTarget = { default: 1 };
- }
- // delete stale slots
- if (needDeletionCheck) {
- for (const key in slots) {
- if (!isInternalKey(key) && !(key in deletionComparisonTarget)) {
- delete slots[key];
- }
- }
- }
-};
-
-/**
-Runtime helper for applying directives to a vnode. Example usage:
-
-const comp = resolveComponent('comp')
-const foo = resolveDirective('foo')
-const bar = resolveDirective('bar')
-
-return withDirectives(h(comp), [
- [foo, this.x],
- [bar, this.y]
-])
-*/
-const isBuiltInDirective = /*#__PURE__*/ makeMap(
- 'bind,cloak,else-if,else,for,html,if,model,on,once,pre,show,slot,text'
-);
-function validateDirectiveName(name) {
- if (isBuiltInDirective(name)) {
- warn('Do not use built-in directive ids as custom directive id: ' + name);
- }
-}
-/**
- * Adds directives to a VNode.
- */
-function withDirectives(vnode, directives) {
- const internalInstance = currentRenderingInstance;
- if (internalInstance === null) {
- process.env.NODE_ENV !== 'production' &&
- warn(`withDirectives can only be used inside render functions.`);
- return vnode
- }
- const instance = internalInstance.proxy;
- const bindings = vnode.dirs || (vnode.dirs = []);
- for (let i = 0; i < directives.length; i++) {
- let [dir, value, arg, modifiers = EMPTY_OBJ] = directives[i];
- if (isFunction$1(dir)) {
- dir = {
- mounted: dir,
- updated: dir,
- };
- }
- bindings.push({
- dir,
- instance,
- value,
- oldValue: void 0,
- arg,
- modifiers,
- });
- }
- return vnode
-}
-function invokeDirectiveHook(vnode, prevVNode, instance, name) {
- const bindings = vnode.dirs;
- const oldBindings = prevVNode && prevVNode.dirs;
- for (let i = 0; i < bindings.length; i++) {
- const binding = bindings[i];
- if (oldBindings) {
- binding.oldValue = oldBindings[i].value;
- }
- let hook = binding.dir[name];
- if (hook) {
- // disable tracking inside all lifecycle hooks
- // since they can potentially be called inside effects.
- pauseTracking();
- callWithAsyncErrorHandling(hook, instance, 8 /* DIRECTIVE_HOOK */, [
- vnode.el,
- binding,
- vnode,
- prevVNode,
- ]);
- resetTracking();
- }
- }
-}
-
-function createAppContext() {
- return {
- app: null,
- config: {
- isNativeTag: NO,
- performance: false,
- globalProperties: {},
- optionMergeStrategies: {},
- errorHandler: undefined,
- warnHandler: undefined,
- compilerOptions: {},
- },
- mixins: [],
- components: {},
- directives: {},
- provides: Object.create(null),
- optionsCache: new WeakMap(),
- propsCache: new WeakMap(),
- emitsCache: new WeakMap(),
- }
-}
-let uid$1 = 0;
-function createAppAPI(render, hydrate) {
- return function createApp(rootComponent, rootProps = null) {
- if (rootProps != null && !isObject$1(rootProps)) {
- process.env.NODE_ENV !== 'production' &&
- warn(`root props passed to app.mount() must be an object.`);
- rootProps = null;
- }
- const context = createAppContext();
- const installedPlugins = new Set();
- let isMounted = false;
- const app = (context.app = {
- _uid: uid$1++,
- _component: rootComponent,
- _props: rootProps,
- _container: null,
- _context: context,
- _instance: null,
- version,
- get config() {
- return context.config
- },
- set config(v) {
- if (process.env.NODE_ENV !== 'production') {
- warn(
- `app.config cannot be replaced. Modify individual options instead.`
- );
- }
- },
- use(plugin, ...options) {
- if (installedPlugins.has(plugin)) {
- process.env.NODE_ENV !== 'production' &&
- warn(`Plugin has already been applied to target app.`);
- } else if (plugin && isFunction$1(plugin.install)) {
- installedPlugins.add(plugin);
- plugin.install(app, ...options);
- } else if (isFunction$1(plugin)) {
- installedPlugins.add(plugin);
- plugin(app, ...options);
- } else if (process.env.NODE_ENV !== 'production') {
- warn(
- `A plugin must either be a function or an object with an "install" ` +
- `function.`
- );
- }
- return app
- },
- mixin(mixin) {
- {
- if (!context.mixins.includes(mixin)) {
- context.mixins.push(mixin);
- } else if (process.env.NODE_ENV !== 'production') {
- warn(
- 'Mixin has already been applied to target app' +
- (mixin.name ? `: ${mixin.name}` : '')
- );
- }
- }
- return app
- },
- component(name, component) {
- if (process.env.NODE_ENV !== 'production') {
- validateComponentName(name, context.config);
- }
- if (!component) {
- return context.components[name]
- }
- if (process.env.NODE_ENV !== 'production' && context.components[name]) {
- warn(`Component "${name}" has already been registered in target app.`);
- }
- context.components[name] = component;
- return app
- },
- directive(name, directive) {
- if (process.env.NODE_ENV !== 'production') {
- validateDirectiveName(name);
- }
- if (!directive) {
- return context.directives[name]
- }
- if (process.env.NODE_ENV !== 'production' && context.directives[name]) {
- warn(`Directive "${name}" has already been registered in target app.`);
- }
- context.directives[name] = directive;
- return app
- },
- mount(rootContainer, isHydrate, isSVG) {
- if (!isMounted) {
- const vnode = createVNode(rootComponent, rootProps);
- // store app context on the root VNode.
- // this will be set on the root instance on initial mount.
- vnode.appContext = context;
- // HMR root reload
- if (process.env.NODE_ENV !== 'production') {
- context.reload = () => {
- render(cloneVNode(vnode), rootContainer, isSVG);
- };
- }
- if (isHydrate && hydrate) {
- hydrate(vnode, rootContainer);
- } else {
- render(vnode, rootContainer, isSVG);
- }
- isMounted = true;
- app._container = rootContainer;
- rootContainer.__vue_app__ = app;
- if (process.env.NODE_ENV !== 'production' || false) {
- app._instance = vnode.component;
- devtoolsInitApp(app, version);
- }
- return vnode.component.proxy
- } else if (process.env.NODE_ENV !== 'production') {
- warn(
- `App has already been mounted.\n` +
- `If you want to remount the same app, move your app creation logic ` +
- `into a factory function and create fresh app instances for each ` +
- `mount - e.g. \`const createMyApp = () => createApp(App)\``
- );
- }
- },
- unmount() {
- if (isMounted) {
- render(null, app._container);
- if (process.env.NODE_ENV !== 'production' || false) {
- app._instance = null;
- devtoolsUnmountApp(app);
- }
- delete app._container.__vue_app__;
- } else if (process.env.NODE_ENV !== 'production') {
- warn(`Cannot unmount an app that is not mounted.`);
- }
- },
- provide(key, value) {
- if (process.env.NODE_ENV !== 'production' && key in context.provides) {
- warn(
- `App already provides property with key "${String(key)}". ` +
- `It will be overwritten with the new value.`
- );
- }
- // TypeScript doesn't allow symbols as index type
- // https://github.com/Microsoft/TypeScript/issues/24587
- context.provides[key] = value;
- return app
- },
- });
- return app
- }
+/**
+ * dev only flag to track whether $attrs was used during render.
+ * If $attrs was used during render then the warning for failed attrs
+ * fallthrough can be suppressed.
+ */
+let accessedAttrs = false;
+function markAttrsAccessed() {
+ accessedAttrs = true;
+}
+function renderComponentRoot(instance) {
+ const { type: Component, vnode, proxy, withProxy, props, propsOptions: [propsOptions], slots, attrs, emit, render, renderCache, data, setupState, ctx, inheritAttrs } = instance;
+ let result;
+ const prev = setCurrentRenderingInstance(instance);
+ if ((process.env.NODE_ENV !== 'production')) {
+ accessedAttrs = false;
+ }
+ try {
+ let fallthroughAttrs;
+ if (vnode.shapeFlag & 4 /* STATEFUL_COMPONENT */) {
+ // withProxy is a proxy with a different `has` trap only for
+ // runtime-compiled render functions using `with` block.
+ const proxyToUse = withProxy || proxy;
+ result = normalizeVNode(render.call(proxyToUse, proxyToUse, renderCache, props, setupState, data, ctx));
+ fallthroughAttrs = attrs;
+ }
+ else {
+ // functional
+ const render = Component;
+ // in dev, mark attrs accessed if optional props (attrs === props)
+ if ((process.env.NODE_ENV !== 'production') && attrs === props) {
+ markAttrsAccessed();
+ }
+ result = normalizeVNode(render.length > 1
+ ? render(props, (process.env.NODE_ENV !== 'production')
+ ? {
+ get attrs() {
+ markAttrsAccessed();
+ return attrs;
+ },
+ slots,
+ emit
+ }
+ : { attrs, slots, emit })
+ : render(props, null /* we know it doesn't need it */));
+ fallthroughAttrs = Component.props
+ ? attrs
+ : getFunctionalFallthrough(attrs);
+ }
+ // attr merging
+ // in dev mode, comments are preserved, and it's possible for a template
+ // to have comments along side the root element which makes it a fragment
+ let root = result;
+ let setRoot = undefined;
+ if ((process.env.NODE_ENV !== 'production') &&
+ result.patchFlag > 0 &&
+ result.patchFlag & 2048 /* DEV_ROOT_FRAGMENT */) {
+ ;
+ [root, setRoot] = getChildRoot(result);
+ }
+ if (fallthroughAttrs && inheritAttrs !== false) {
+ const keys = Object.keys(fallthroughAttrs);
+ const { shapeFlag } = root;
+ if (keys.length) {
+ if (shapeFlag & 1 /* ELEMENT */ ||
+ shapeFlag & 6 /* COMPONENT */) {
+ if (propsOptions && keys.some(isModelListener)) {
+ // If a v-model listener (onUpdate:xxx) has a corresponding declared
+ // prop, it indicates this component expects to handle v-model and
+ // it should not fallthrough.
+ // related: #1543, #1643, #1989
+ fallthroughAttrs = filterModelListeners(fallthroughAttrs, propsOptions);
+ }
+ root = cloneVNode(root, fallthroughAttrs);
+ }
+ else if ((process.env.NODE_ENV !== 'production') && !accessedAttrs && root.type !== Comment$1) {
+ const allAttrs = Object.keys(attrs);
+ const eventAttrs = [];
+ const extraAttrs = [];
+ for (let i = 0, l = allAttrs.length; i < l; i++) {
+ const key = allAttrs[i];
+ if (isOn(key)) {
+ // ignore v-model handlers when they fail to fallthrough
+ if (!isModelListener(key)) {
+ // remove `on`, lowercase first letter to reflect event casing
+ // accurately
+ eventAttrs.push(key[2].toLowerCase() + key.slice(3));
+ }
+ }
+ else {
+ extraAttrs.push(key);
+ }
+ }
+ if (extraAttrs.length) {
+ warn(`Extraneous non-props attributes (` +
+ `${extraAttrs.join(', ')}) ` +
+ `were passed to component but could not be automatically inherited ` +
+ `because component renders fragment or text root nodes.`);
+ }
+ if (eventAttrs.length) {
+ warn(`Extraneous non-emits event listeners (` +
+ `${eventAttrs.join(', ')}) ` +
+ `were passed to component but could not be automatically inherited ` +
+ `because component renders fragment or text root nodes. ` +
+ `If the listener is intended to be a component custom event listener only, ` +
+ `declare it using the "emits" option.`);
+ }
+ }
+ }
+ }
+ if (false &&
+ isCompatEnabled("INSTANCE_ATTRS_CLASS_STYLE" /* INSTANCE_ATTRS_CLASS_STYLE */, instance) &&
+ vnode.shapeFlag & 4 /* STATEFUL_COMPONENT */ &&
+ (root.shapeFlag & 1 /* ELEMENT */ ||
+ root.shapeFlag & 6 /* COMPONENT */)) ;
+ // inherit directives
+ if (vnode.dirs) {
+ if ((process.env.NODE_ENV !== 'production') && !isElementRoot(root)) {
+ warn(`Runtime directive used on component with non-element root node. ` +
+ `The directives will not function as intended.`);
+ }
+ root.dirs = root.dirs ? root.dirs.concat(vnode.dirs) : vnode.dirs;
+ }
+ // inherit transition data
+ if (vnode.transition) {
+ if ((process.env.NODE_ENV !== 'production') && !isElementRoot(root)) {
+ warn(`Component inside renders non-element root node ` +
+ `that cannot be animated.`);
+ }
+ root.transition = vnode.transition;
+ }
+ if ((process.env.NODE_ENV !== 'production') && setRoot) {
+ setRoot(root);
+ }
+ else {
+ result = root;
+ }
+ }
+ catch (err) {
+ blockStack.length = 0;
+ handleError(err, instance, 1 /* RENDER_FUNCTION */);
+ result = createVNode(Comment$1);
+ }
+ setCurrentRenderingInstance(prev);
+ return result;
+}
+/**
+ * dev only
+ * In dev mode, template root level comments are rendered, which turns the
+ * template into a fragment root, but we need to locate the single element
+ * root for attrs and scope id processing.
+ */
+const getChildRoot = (vnode) => {
+ const rawChildren = vnode.children;
+ const dynamicChildren = vnode.dynamicChildren;
+ const childRoot = filterSingleRoot(rawChildren);
+ if (!childRoot) {
+ return [vnode, undefined];
+ }
+ const index = rawChildren.indexOf(childRoot);
+ const dynamicIndex = dynamicChildren ? dynamicChildren.indexOf(childRoot) : -1;
+ const setRoot = (updatedRoot) => {
+ rawChildren[index] = updatedRoot;
+ if (dynamicChildren) {
+ if (dynamicIndex > -1) {
+ dynamicChildren[dynamicIndex] = updatedRoot;
+ }
+ else if (updatedRoot.patchFlag > 0) {
+ vnode.dynamicChildren = [...dynamicChildren, updatedRoot];
+ }
+ }
+ };
+ return [normalizeVNode(childRoot), setRoot];
+};
+function filterSingleRoot(children) {
+ let singleRoot;
+ for (let i = 0; i < children.length; i++) {
+ const child = children[i];
+ if (isVNode(child)) {
+ // ignore user comment
+ if (child.type !== Comment$1 || child.children === 'v-if') {
+ if (singleRoot) {
+ // has more than 1 non-comment child, return now
+ return;
+ }
+ else {
+ singleRoot = child;
+ }
+ }
+ }
+ else {
+ return;
+ }
+ }
+ return singleRoot;
+}
+const getFunctionalFallthrough = (attrs) => {
+ let res;
+ for (const key in attrs) {
+ if (key === 'class' || key === 'style' || isOn(key)) {
+ (res || (res = {}))[key] = attrs[key];
+ }
+ }
+ return res;
+};
+const filterModelListeners = (attrs, props) => {
+ const res = {};
+ for (const key in attrs) {
+ if (!isModelListener(key) || !(key.slice(9) in props)) {
+ res[key] = attrs[key];
+ }
+ }
+ return res;
+};
+const isElementRoot = (vnode) => {
+ return (vnode.shapeFlag & 6 /* COMPONENT */ ||
+ vnode.shapeFlag & 1 /* ELEMENT */ ||
+ vnode.type === Comment$1 // potential v-if branch switch
+ );
+};
+function shouldUpdateComponent(prevVNode, nextVNode, optimized) {
+ const { props: prevProps, children: prevChildren, component } = prevVNode;
+ const { props: nextProps, children: nextChildren, patchFlag } = nextVNode;
+ const emits = component.emitsOptions;
+ // Parent component's render function was hot-updated. Since this may have
+ // caused the child component's slots content to have changed, we need to
+ // force the child to update as well.
+ if ((process.env.NODE_ENV !== 'production') && (prevChildren || nextChildren) && isHmrUpdating) {
+ return true;
+ }
+ // force child update for runtime directive or transition on component vnode.
+ if (nextVNode.dirs || nextVNode.transition) {
+ return true;
+ }
+ if (optimized && patchFlag >= 0) {
+ if (patchFlag & 1024 /* DYNAMIC_SLOTS */) {
+ // slot content that references values that might have changed,
+ // e.g. in a v-for
+ return true;
+ }
+ if (patchFlag & 16 /* FULL_PROPS */) {
+ if (!prevProps) {
+ return !!nextProps;
+ }
+ // presence of this flag indicates props are always non-null
+ return hasPropsChanged(prevProps, nextProps, emits);
+ }
+ else if (patchFlag & 8 /* PROPS */) {
+ const dynamicProps = nextVNode.dynamicProps;
+ for (let i = 0; i < dynamicProps.length; i++) {
+ const key = dynamicProps[i];
+ if (nextProps[key] !== prevProps[key] &&
+ !isEmitListener(emits, key)) {
+ return true;
+ }
+ }
+ }
+ }
+ else {
+ // this path is only taken by manually written render functions
+ // so presence of any children leads to a forced update
+ if (prevChildren || nextChildren) {
+ if (!nextChildren || !nextChildren.$stable) {
+ return true;
+ }
+ }
+ if (prevProps === nextProps) {
+ return false;
+ }
+ if (!prevProps) {
+ return !!nextProps;
+ }
+ if (!nextProps) {
+ return true;
+ }
+ return hasPropsChanged(prevProps, nextProps, emits);
+ }
+ return false;
+}
+function hasPropsChanged(prevProps, nextProps, emitsOptions) {
+ const nextKeys = Object.keys(nextProps);
+ if (nextKeys.length !== Object.keys(prevProps).length) {
+ return true;
+ }
+ for (let i = 0; i < nextKeys.length; i++) {
+ const key = nextKeys[i];
+ if (nextProps[key] !== prevProps[key] &&
+ !isEmitListener(emitsOptions, key)) {
+ return true;
+ }
+ }
+ return false;
+}
+function updateHOCHostEl({ vnode, parent }, el // HostNode
+) {
+ while (parent && parent.subTree === vnode) {
+ (vnode = parent.vnode).el = el;
+ parent = parent.parent;
+ }
}
-let hasMismatch = false;
-const isSVGContainer = (container) =>
- /svg/.test(container.namespaceURI) && container.tagName !== 'foreignObject';
-const isComment = (node) => node.nodeType === 8; /* COMMENT */
-// Note: hydration is DOM-specific
-// But we have to place it in core due to tight coupling with core - splitting
-// it out creates a ton of unnecessary complexity.
-// Hydration also depends on some renderer internal logic which needs to be
-// passed in via arguments.
-function createHydrationFunctions(rendererInternals) {
- const {
- mt: mountComponent,
- p: patch,
- o: { patchProp, nextSibling, parentNode, remove, insert, createComment },
- } = rendererInternals;
- const hydrate = (vnode, container) => {
- if (!container.hasChildNodes()) {
- process.env.NODE_ENV !== 'production' &&
- warn(
- `Attempting to hydrate existing markup but container is empty. ` +
- `Performing full mount instead.`
- );
- patch(null, vnode, container);
- flushPostFlushCbs();
- return
- }
- hasMismatch = false;
- hydrateNode(container.firstChild, vnode, null, null, null);
- flushPostFlushCbs();
- if (hasMismatch && !false) {
- // this error should show up in production
- console.error(`Hydration completed but contains mismatches.`);
- }
- };
- const hydrateNode = (
- node,
- vnode,
- parentComponent,
- parentSuspense,
- slotScopeIds,
- optimized = false
- ) => {
- const isFragmentStart = isComment(node) && node.data === '[';
- const onMismatch = () =>
- handleMismatch(
- node,
- vnode,
- parentComponent,
- parentSuspense,
- slotScopeIds,
- isFragmentStart
- );
- const { type, ref, shapeFlag } = vnode;
- const domType = node.nodeType;
- vnode.el = node;
- let nextNode = null;
- switch (type) {
- case Text:
- if (domType !== 3 /* TEXT */) {
- nextNode = onMismatch();
- } else {
- if (node.data !== vnode.children) {
- hasMismatch = true;
- process.env.NODE_ENV !== 'production' &&
- warn(
- `Hydration text mismatch:` +
- `\n- Client: ${JSON.stringify(node.data)}` +
- `\n- Server: ${JSON.stringify(vnode.children)}`
- );
- node.data = vnode.children;
- }
- nextNode = nextSibling(node);
- }
- break
- case Comment$1:
- if (domType !== 8 /* COMMENT */ || isFragmentStart) {
- nextNode = onMismatch();
- } else {
- nextNode = nextSibling(node);
- }
- break
- case Static:
- if (domType !== 1 /* ELEMENT */) {
- nextNode = onMismatch();
- } else {
- // determine anchor, adopt content
- nextNode = node;
- // if the static vnode has its content stripped during build,
- // adopt it from the server-rendered HTML.
- const needToAdoptContent = !vnode.children.length;
- for (let i = 0; i < vnode.staticCount; i++) {
- if (needToAdoptContent) vnode.children += nextNode.outerHTML;
- if (i === vnode.staticCount - 1) {
- vnode.anchor = nextNode;
- }
- nextNode = nextSibling(nextNode);
- }
- return nextNode
- }
- break
- case Fragment:
- if (!isFragmentStart) {
- nextNode = onMismatch();
- } else {
- nextNode = hydrateFragment(
- node,
- vnode,
- parentComponent,
- parentSuspense,
- slotScopeIds,
- optimized
- );
- }
- break
- default:
- if (shapeFlag & 1 /* ELEMENT */) {
- if (
- domType !== 1 /* ELEMENT */ ||
- vnode.type.toLowerCase() !== node.tagName.toLowerCase()
- ) {
- nextNode = onMismatch();
- } else {
- nextNode = hydrateElement(
- node,
- vnode,
- parentComponent,
- parentSuspense,
- slotScopeIds,
- optimized
- );
- }
- } else if (shapeFlag & 6 /* COMPONENT */) {
- // when setting up the render effect, if the initial vnode already
- // has .el set, the component will perform hydration instead of mount
- // on its sub-tree.
- vnode.slotScopeIds = slotScopeIds;
- const container = parentNode(node);
- mountComponent(
- vnode,
- container,
- null,
- parentComponent,
- parentSuspense,
- isSVGContainer(container),
- optimized
- );
- // component may be async, so in the case of fragments we cannot rely
- // on component's rendered output to determine the end of the fragment
- // instead, we do a lookahead to find the end anchor node.
- nextNode = isFragmentStart
- ? locateClosingAsyncAnchor(node)
- : nextSibling(node);
- // #3787
- // if component is async, it may get moved / unmounted before its
- // inner component is loaded, so we need to give it a placeholder
- // vnode that matches its adopted DOM.
- if (isAsyncWrapper(vnode)) {
- let subTree;
- if (isFragmentStart) {
- subTree = createVNode(Fragment);
- subTree.anchor = nextNode
- ? nextNode.previousSibling
- : container.lastChild;
- } else {
- subTree =
- node.nodeType === 3 ? createTextVNode('') : createVNode('div');
- }
- subTree.el = node;
- vnode.component.subTree = subTree;
- }
- } else if (shapeFlag & 64 /* TELEPORT */) {
- if (domType !== 8 /* COMMENT */) {
- nextNode = onMismatch();
- } else {
- nextNode = vnode.type.hydrate(
- node,
- vnode,
- parentComponent,
- parentSuspense,
- slotScopeIds,
- optimized,
- rendererInternals,
- hydrateChildren
- );
- }
- } else if (shapeFlag & 128 /* SUSPENSE */) {
- nextNode = vnode.type.hydrate(
- node,
- vnode,
- parentComponent,
- parentSuspense,
- isSVGContainer(parentNode(node)),
- slotScopeIds,
- optimized,
- rendererInternals,
- hydrateNode
- );
- } else if (process.env.NODE_ENV !== 'production') {
- warn('Invalid HostVNode type:', type, `(${typeof type})`);
- }
- }
- if (ref != null) {
- setRef(ref, null, parentSuspense, vnode);
- }
- return nextNode
- };
- const hydrateElement = (
- el,
- vnode,
- parentComponent,
- parentSuspense,
- slotScopeIds,
- optimized
- ) => {
- optimized = optimized || !!vnode.dynamicChildren;
- const { type, props, patchFlag, shapeFlag, dirs } = vnode;
- // #4006 for form elements with non-string v-model value bindings
- // e.g.