uview-ultra 4.5.46
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +20 -0
- package/README.md +76 -0
- package/changelog.md +1421 -0
- package/components/up-action-sheet/actionSheet.js +26 -0
- package/components/up-action-sheet/actionSheet.uts +36 -0
- package/components/up-action-sheet/props.js +62 -0
- package/components/up-action-sheet/props.uts +66 -0
- package/components/up-action-sheet/types.uts +86 -0
- package/components/up-action-sheet/up-action-sheet.uvue +390 -0
- package/components/up-action-sheet/up-action-sheet.vue +348 -0
- package/components/up-action-sheet-data/up-action-sheet-data.uvue +112 -0
- package/components/up-action-sheet-data/up-action-sheet-data.vue +109 -0
- package/components/up-agreement/up-agreement.uvue +80 -0
- package/components/up-agreement/up-agreement.vue +91 -0
- package/components/up-album/album.js +28 -0
- package/components/up-album/album.uts +28 -0
- package/components/up-album/props.js +93 -0
- package/components/up-album/props.uts +84 -0
- package/components/up-album/up-album.uvue +377 -0
- package/components/up-album/up-album.vue +261 -0
- package/components/up-alert/alert.js +22 -0
- package/components/up-alert/alert.uts +22 -0
- package/components/up-alert/props.js +46 -0
- package/components/up-alert/props.uts +48 -0
- package/components/up-alert/up-alert.uvue +286 -0
- package/components/up-alert/up-alert.vue +231 -0
- package/components/up-avatar/avatar.js +28 -0
- package/components/up-avatar/avatar.uts +28 -0
- package/components/up-avatar/props.js +82 -0
- package/components/up-avatar/props.uts +82 -0
- package/components/up-avatar/up-avatar.uvue +242 -0
- package/components/up-avatar/up-avatar.vue +168 -0
- package/components/up-avatar-group/avatarGroup.js +23 -0
- package/components/up-avatar-group/avatarGroup.uts +23 -0
- package/components/up-avatar-group/props.js +54 -0
- package/components/up-avatar-group/props.uts +55 -0
- package/components/up-avatar-group/up-avatar-group.uvue +160 -0
- package/components/up-avatar-group/up-avatar-group.vue +109 -0
- package/components/up-back-top/backtop.js +27 -0
- package/components/up-back-top/backtop.uts +27 -0
- package/components/up-back-top/props.js +56 -0
- package/components/up-back-top/props.uts +57 -0
- package/components/up-back-top/up-back-top.uvue +161 -0
- package/components/up-back-top/up-back-top.vue +141 -0
- package/components/up-badge/badge.js +27 -0
- package/components/up-badge/badge.uts +27 -0
- package/components/up-badge/props.js +79 -0
- package/components/up-badge/props.uts +89 -0
- package/components/up-badge/up-badge.uvue +266 -0
- package/components/up-badge/up-badge.vue +157 -0
- package/components/up-barcode/up-barcode.uvue +818 -0
- package/components/up-barcode/up-barcode.vue +902 -0
- package/components/up-box/box.js +24 -0
- package/components/up-box/box.uts +24 -0
- package/components/up-box/props.js +57 -0
- package/components/up-box/props.uts +58 -0
- package/components/up-box/up-box.uvue +143 -0
- package/components/up-box/up-box.vue +104 -0
- package/components/up-button/button.js +42 -0
- package/components/up-button/button.uts +42 -0
- package/components/up-button/nvue.scss +46 -0
- package/components/up-button/props.js +155 -0
- package/components/up-button/props.uts +164 -0
- package/components/up-button/up-button.uvue +611 -0
- package/components/up-button/up-button.vue +456 -0
- package/components/up-button/vue.scss +85 -0
- package/components/up-calendar/calendar.js +75 -0
- package/components/up-calendar/calendar.uts +61 -0
- package/components/up-calendar/header.uvue +233 -0
- package/components/up-calendar/header.vue +239 -0
- package/components/up-calendar/month.uvue +565 -0
- package/components/up-calendar/month.vue +709 -0
- package/components/up-calendar/props.js +262 -0
- package/components/up-calendar/props.uts +244 -0
- package/components/up-calendar/types.uts +18 -0
- package/components/up-calendar/up-calendar.uvue +829 -0
- package/components/up-calendar/up-calendar.vue +922 -0
- package/components/up-calendar/util.js +86 -0
- package/components/up-calendar/util.uts +93 -0
- package/components/up-calendar-strip/calendarStrip.js +36 -0
- package/components/up-calendar-strip/props.js +70 -0
- package/components/up-calendar-strip/up-calendar-strip.vue +515 -0
- package/components/up-canvas/up-canvas.uvue +508 -0
- package/components/up-canvas/up-canvas.vue +655 -0
- package/components/up-car-keyboard/carKeyboard.js +15 -0
- package/components/up-car-keyboard/carKeyboard.uts +16 -0
- package/components/up-car-keyboard/props.js +17 -0
- package/components/up-car-keyboard/props.uts +27 -0
- package/components/up-car-keyboard/up-car-keyboard.uvue +369 -0
- package/components/up-car-keyboard/up-car-keyboard.vue +357 -0
- package/components/up-card/card.uts +58 -0
- package/components/up-card/props.js +140 -0
- package/components/up-card/props.uts +150 -0
- package/components/up-card/up-card.uvue +308 -0
- package/components/up-card/up-card.vue +188 -0
- package/components/up-cascader/up-cascader.uvue +427 -0
- package/components/up-cascader/up-cascader.vue +331 -0
- package/components/up-cate-tab/up-cate-tab.uvue +426 -0
- package/components/up-cate-tab/up-cate-tab.vue +374 -0
- package/components/up-cell/cell.js +35 -0
- package/components/up-cell/cell.uts +35 -0
- package/components/up-cell/props.js +113 -0
- package/components/up-cell/props.uts +108 -0
- package/components/up-cell/up-cell.uvue +336 -0
- package/components/up-cell/up-cell.vue +266 -0
- package/components/up-cell-group/cellGroup.js +16 -0
- package/components/up-cell-group/cellGroup.uts +16 -0
- package/components/up-cell-group/props.js +16 -0
- package/components/up-cell-group/props.uts +26 -0
- package/components/up-cell-group/up-cell-group.uvue +70 -0
- package/components/up-cell-group/up-cell-group.vue +72 -0
- package/components/up-checkbox/checkbox.js +27 -0
- package/components/up-checkbox/checkbox.uts +27 -0
- package/components/up-checkbox/props.js +76 -0
- package/components/up-checkbox/props.uts +77 -0
- package/components/up-checkbox/up-checkbox.uvue +533 -0
- package/components/up-checkbox/up-checkbox.vue +409 -0
- package/components/up-checkbox-group/checkboxGroup.js +29 -0
- package/components/up-checkbox-group/checkboxGroup.uts +29 -0
- package/components/up-checkbox-group/props.js +93 -0
- package/components/up-checkbox-group/props.uts +84 -0
- package/components/up-checkbox-group/up-checkbox-group.uvue +211 -0
- package/components/up-checkbox-group/up-checkbox-group.vue +185 -0
- package/components/up-choose/up-choose.uvue +130 -0
- package/components/up-choose/up-choose.vue +117 -0
- package/components/up-circle-progress/circleProgress.js +15 -0
- package/components/up-circle-progress/props.js +10 -0
- package/components/up-circle-progress/up-circle-progress.vue +187 -0
- package/components/up-city-locate/up-city-locate.uvue +188 -0
- package/components/up-city-locate/up-city-locate.vue +162 -0
- package/components/up-code/code.js +21 -0
- package/components/up-code/code.uts +20 -0
- package/components/up-code/props.js +36 -0
- package/components/up-code/props.uts +47 -0
- package/components/up-code/up-code.uvue +184 -0
- package/components/up-code/up-code.vue +117 -0
- package/components/up-code-input/codeInput.js +29 -0
- package/components/up-code-input/codeInput.uts +29 -0
- package/components/up-code-input/props.js +90 -0
- package/components/up-code-input/props.uts +83 -0
- package/components/up-code-input/up-code-input.uvue +365 -0
- package/components/up-code-input/up-code-input.vue +269 -0
- package/components/up-col/col.js +19 -0
- package/components/up-col/col.uts +19 -0
- package/components/up-col/props.js +32 -0
- package/components/up-col/props.uts +41 -0
- package/components/up-col/up-col.uvue +215 -0
- package/components/up-col/up-col.vue +160 -0
- package/components/up-collapse/collapse.js +17 -0
- package/components/up-collapse/collapse.uts +17 -0
- package/components/up-collapse/props.js +21 -0
- package/components/up-collapse/props.uts +23 -0
- package/components/up-collapse/up-collapse.uvue +133 -0
- package/components/up-collapse/up-collapse.vue +116 -0
- package/components/up-collapse-item/collapseItem.js +26 -0
- package/components/up-collapse-item/collapseItem.uts +26 -0
- package/components/up-collapse-item/props.js +66 -0
- package/components/up-collapse-item/props.uts +69 -0
- package/components/up-collapse-item/up-collapse-item.uvue +294 -0
- package/components/up-collapse-item/up-collapse-item.vue +279 -0
- package/components/up-color-picker/up-color-picker.uvue +1045 -0
- package/components/up-color-picker/up-color-picker.vue +1081 -0
- package/components/up-column-notice/columnNotice.js +24 -0
- package/components/up-column-notice/columnNotice.uts +24 -0
- package/components/up-column-notice/props.js +57 -0
- package/components/up-column-notice/props.uts +59 -0
- package/components/up-column-notice/up-column-notice.uvue +198 -0
- package/components/up-column-notice/up-column-notice.vue +162 -0
- package/components/up-copy/up-copy.uvue +77 -0
- package/components/up-copy/up-copy.vue +75 -0
- package/components/up-count-down/countDown.js +18 -0
- package/components/up-count-down/countDown.uts +18 -0
- package/components/up-count-down/props.js +26 -0
- package/components/up-count-down/props.uts +37 -0
- package/components/up-count-down/up-count-down.uvue +198 -0
- package/components/up-count-down/up-count-down.vue +186 -0
- package/components/up-count-down/utils.js +62 -0
- package/components/up-count-down/utils.uts +67 -0
- package/components/up-count-to/countTo.js +25 -0
- package/components/up-count-to/countTo.uts +25 -0
- package/components/up-count-to/props.js +61 -0
- package/components/up-count-to/props.uts +72 -0
- package/components/up-count-to/up-count-to.uvue +309 -0
- package/components/up-count-to/up-count-to.vue +209 -0
- package/components/up-coupon/up-coupon.uvue +346 -0
- package/components/up-coupon/up-coupon.vue +415 -0
- package/components/up-cropper/up-cropper.uvue +899 -0
- package/components/up-cropper/up-cropper.vue +1392 -0
- package/components/up-datetime-picker/datetimePicker.js +40 -0
- package/components/up-datetime-picker/datetimePicker.uts +45 -0
- package/components/up-datetime-picker/dayjs.esm.min.js +7 -0
- package/components/up-datetime-picker/props.js +165 -0
- package/components/up-datetime-picker/props.uts +169 -0
- package/components/up-datetime-picker/up-datetime-picker.uvue +960 -0
- package/components/up-datetime-picker/up-datetime-picker.vue +765 -0
- package/components/up-divider/divider.js +23 -0
- package/components/up-divider/divider.uts +22 -0
- package/components/up-divider/props.js +46 -0
- package/components/up-divider/props.uts +57 -0
- package/components/up-divider/up-divider.uvue +151 -0
- package/components/up-divider/up-divider.vue +112 -0
- package/components/up-dragsort/up-dragsort.uvue +821 -0
- package/components/up-dragsort/up-dragsort.vue +410 -0
- package/components/up-dropdown/dropdown.uts +25 -0
- package/components/up-dropdown/props.js +61 -0
- package/components/up-dropdown/props.uts +72 -0
- package/components/up-dropdown/types.uts +5 -0
- package/components/up-dropdown/up-dropdown.uvue +366 -0
- package/components/up-dropdown/up-dropdown.vue +297 -0
- package/components/up-dropdown-item/dropdown-item.uts +25 -0
- package/components/up-dropdown-item/props.js +47 -0
- package/components/up-dropdown-item/props.uts +56 -0
- package/components/up-dropdown-item/up-dropdown-item.uvue +196 -0
- package/components/up-dropdown-item/up-dropdown-item.vue +123 -0
- package/components/up-empty/empty.js +26 -0
- package/components/up-empty/empty.uts +24 -0
- package/components/up-empty/props.js +61 -0
- package/components/up-empty/props.uts +71 -0
- package/components/up-empty/up-empty.uvue +193 -0
- package/components/up-empty/up-empty.vue +116 -0
- package/components/up-flex/flex.js +10 -0
- package/components/up-flex/flex.uts +10 -0
- package/components/up-flex/props.js +12 -0
- package/components/up-flex/props.uts +13 -0
- package/components/up-flex/up-flex.uvue +71 -0
- package/components/up-flex/up-flex.vue +62 -0
- package/components/up-float-button/up-float-button.uvue +194 -0
- package/components/up-float-button/up-float-button.vue +160 -0
- package/components/up-form/form.js +22 -0
- package/components/up-form/form.uts +22 -0
- package/components/up-form/props.js +47 -0
- package/components/up-form/props.uts +57 -0
- package/components/up-form/types.uts +18 -0
- package/components/up-form/up-form.uvue +480 -0
- package/components/up-form/up-form.vue +297 -0
- package/components/up-form-item/formItem.js +24 -0
- package/components/up-form-item/formItem.uts +24 -0
- package/components/up-form-item/props.js +55 -0
- package/components/up-form-item/props.uts +65 -0
- package/components/up-form-item/up-form-item.uvue +349 -0
- package/components/up-form-item/up-form-item.vue +276 -0
- package/components/up-gap/gap.js +19 -0
- package/components/up-gap/gap.uts +19 -0
- package/components/up-gap/props.js +27 -0
- package/components/up-gap/props.uts +36 -0
- package/components/up-gap/up-gap.uvue +53 -0
- package/components/up-gap/up-gap.vue +38 -0
- package/components/up-goods-sku/up-goods-sku.uvue +564 -0
- package/components/up-goods-sku/up-goods-sku.vue +436 -0
- package/components/up-grid/grid.js +17 -0
- package/components/up-grid/grid.uts +17 -0
- package/components/up-grid/props.js +29 -0
- package/components/up-grid/props.uts +37 -0
- package/components/up-grid/up-grid.uvue +161 -0
- package/components/up-grid/up-grid.vue +119 -0
- package/components/up-grid-item/gridItem.js +16 -0
- package/components/up-grid-item/gridItem.uts +16 -0
- package/components/up-grid-item/props.js +16 -0
- package/components/up-grid-item/props.uts +27 -0
- package/components/up-grid-item/up-grid-item.uvue +227 -0
- package/components/up-grid-item/up-grid-item.vue +244 -0
- package/components/up-guide/guide.js +16 -0
- package/components/up-guide/props.js +53 -0
- package/components/up-guide/up-guide.vue +274 -0
- package/components/up-icon/icon.js +36 -0
- package/components/up-icon/icon.uts +33 -0
- package/components/up-icon/icons.js +426 -0
- package/components/up-icon/icons.uts +222 -0
- package/components/up-icon/props.js +92 -0
- package/components/up-icon/props.uts +101 -0
- package/components/up-icon/up-icon.uvue +300 -0
- package/components/up-icon/up-icon.vue +259 -0
- package/components/up-icon/upicon.ttf +0 -0
- package/components/up-icon/util.js +212 -0
- package/components/up-image/image.js +30 -0
- package/components/up-image/image.uts +30 -0
- package/components/up-image/props.js +87 -0
- package/components/up-image/props.uts +88 -0
- package/components/up-image/up-image.uvue +254 -0
- package/components/up-image/up-image.vue +253 -0
- package/components/up-index-anchor/indexAnchor.js +19 -0
- package/components/up-index-anchor/indexAnchor.uts +19 -0
- package/components/up-index-anchor/props.js +31 -0
- package/components/up-index-anchor/props.uts +41 -0
- package/components/up-index-anchor/up-index-anchor.uvue +146 -0
- package/components/up-index-anchor/up-index-anchor.vue +124 -0
- package/components/up-index-item/indexItem.uts +15 -0
- package/components/up-index-item/props.js +8 -0
- package/components/up-index-item/props.uts +15 -0
- package/components/up-index-item/up-index-item.uvue +109 -0
- package/components/up-index-item/up-index-item.vue +105 -0
- package/components/up-index-list/indexList.js +21 -0
- package/components/up-index-list/indexList.uts +21 -0
- package/components/up-index-list/props.js +41 -0
- package/components/up-index-list/props.uts +51 -0
- package/components/up-index-list/up-index-list.uvue +594 -0
- package/components/up-index-list/up-index-list.vue +643 -0
- package/components/up-input/input.js +48 -0
- package/components/up-input/input.uts +49 -0
- package/components/up-input/props.js +198 -0
- package/components/up-input/props.uts +198 -0
- package/components/up-input/up-input.uvue +571 -0
- package/components/up-input/up-input.vue +441 -0
- package/components/up-keyboard/keyboard.js +30 -0
- package/components/up-keyboard/keyboard.uts +30 -0
- package/components/up-keyboard/props.js +86 -0
- package/components/up-keyboard/props.uts +97 -0
- package/components/up-keyboard/up-keyboard.uvue +253 -0
- package/components/up-keyboard/up-keyboard.vue +188 -0
- package/components/up-lazy-load/lazyLoad.uts +19 -0
- package/components/up-lazy-load/props.uts +74 -0
- package/components/up-lazy-load/up-lazy-load.uvue +340 -0
- package/components/up-lazy-load/up-lazy-load.vue +280 -0
- package/components/up-line/line.js +20 -0
- package/components/up-line/line.uts +20 -0
- package/components/up-line/props.js +36 -0
- package/components/up-line/props.uts +37 -0
- package/components/up-line/up-line.uvue +97 -0
- package/components/up-line/up-line.vue +61 -0
- package/components/up-line-progress/lineProgress.js +19 -0
- package/components/up-line-progress/lineProgress.uts +9 -0
- package/components/up-line-progress/props.js +30 -0
- package/components/up-line-progress/up-line-progress.uvue +165 -0
- package/components/up-line-progress/up-line-progress.vue +155 -0
- package/components/up-link/link.js +26 -0
- package/components/up-link/link.uts +23 -0
- package/components/up-link/props.js +41 -0
- package/components/up-link/props.uts +43 -0
- package/components/up-link/up-link.uvue +136 -0
- package/components/up-link/up-link.vue +75 -0
- package/components/up-list/list.js +28 -0
- package/components/up-list/list.uts +33 -0
- package/components/up-list/props.js +101 -0
- package/components/up-list/props.uts +111 -0
- package/components/up-list/up-list.uvue +255 -0
- package/components/up-list/up-list.vue +230 -0
- package/components/up-list-item/listItem.js +15 -0
- package/components/up-list-item/listItem.uts +15 -0
- package/components/up-list-item/props.js +11 -0
- package/components/up-list-item/props.uts +21 -0
- package/components/up-list-item/up-list-item.uvue +126 -0
- package/components/up-list-item/up-list-item.vue +155 -0
- package/components/up-loading-icon/loadingIcon.js +30 -0
- package/components/up-loading-icon/loadingIcon.uts +28 -0
- package/components/up-loading-icon/props.js +62 -0
- package/components/up-loading-icon/props.uts +71 -0
- package/components/up-loading-icon/up-loading-icon.uvue +439 -0
- package/components/up-loading-icon/up-loading-icon.vue +357 -0
- package/components/up-loading-page/loadingPage.js +24 -0
- package/components/up-loading-page/loadingPage.uts +24 -0
- package/components/up-loading-page/props.js +57 -0
- package/components/up-loading-page/props.uts +58 -0
- package/components/up-loading-page/up-loading-page.uvue +197 -0
- package/components/up-loading-page/up-loading-page.vue +109 -0
- package/components/up-loadmore/loadmore.js +32 -0
- package/components/up-loadmore/loadmore.uts +32 -0
- package/components/up-loadmore/props.js +96 -0
- package/components/up-loadmore/props.uts +107 -0
- package/components/up-loadmore/up-loadmore.uvue +247 -0
- package/components/up-loadmore/up-loadmore.vue +132 -0
- package/components/up-markdown/marked.esm.js +7 -0
- package/components/up-markdown/up-markdown.uvue +171 -0
- package/components/up-markdown/up-markdown.vue +289 -0
- package/components/up-message-input/up-message-input.uvue +113 -0
- package/components/up-message-input/up-message-input.vue +111 -0
- package/components/up-modal/modal.js +36 -0
- package/components/up-modal/modal.uts +36 -0
- package/components/up-modal/props.js +111 -0
- package/components/up-modal/props.uts +113 -0
- package/components/up-modal/up-modal.uvue +407 -0
- package/components/up-modal/up-modal.vue +268 -0
- package/components/up-navbar/navbar.js +33 -0
- package/components/up-navbar/navbar.uts +34 -0
- package/components/up-navbar/props.js +97 -0
- package/components/up-navbar/props.uts +98 -0
- package/components/up-navbar/theme-vars.scss +26 -0
- package/components/up-navbar/up-navbar.uvue +467 -0
- package/components/up-navbar/up-navbar.vue +316 -0
- package/components/up-navbar-mini/navbarMini.js +23 -0
- package/components/up-navbar-mini/navbarMini.uts +23 -0
- package/components/up-navbar-mini/props.js +51 -0
- package/components/up-navbar-mini/props.uts +53 -0
- package/components/up-navbar-mini/up-navbar-mini.uvue +184 -0
- package/components/up-navbar-mini/up-navbar-mini.vue +135 -0
- package/components/up-no-network/noNetwork.js +18 -0
- package/components/up-no-network/noNetwork.uts +18 -0
- package/components/up-no-network/props.js +21 -0
- package/components/up-no-network/props.uts +31 -0
- package/components/up-no-network/up-no-network.uvue +218 -0
- package/components/up-no-network/up-no-network.vue +231 -0
- package/components/up-notice-bar/noticeBar.js +27 -0
- package/components/up-notice-bar/noticeBar.uts +27 -0
- package/components/up-notice-bar/props.js +72 -0
- package/components/up-notice-bar/props.uts +74 -0
- package/components/up-notice-bar/theme-vars.scss +25 -0
- package/components/up-notice-bar/up-notice-bar.uvue +179 -0
- package/components/up-notice-bar/up-notice-bar.vue +110 -0
- package/components/up-notify/notify.js +22 -0
- package/components/up-notify/notify.uts +22 -0
- package/components/up-notify/props.js +51 -0
- package/components/up-notify/props.uts +56 -0
- package/components/up-notify/up-notify.uvue +327 -0
- package/components/up-notify/up-notify.vue +248 -0
- package/components/up-novel-reader/content-normalizer.js +80 -0
- package/components/up-novel-reader/content-normalizer.uts +112 -0
- package/components/up-novel-reader/layout-engine.js +222 -0
- package/components/up-novel-reader/layout-engine.uts +256 -0
- package/components/up-novel-reader/measure-adapter.js +69 -0
- package/components/up-novel-reader/measure-adapter.uts +56 -0
- package/components/up-novel-reader/novelReader.js +35 -0
- package/components/up-novel-reader/novelReader.uts +37 -0
- package/components/up-novel-reader/persistence.js +143 -0
- package/components/up-novel-reader/persistence.uts +137 -0
- package/components/up-novel-reader/props.js +97 -0
- package/components/up-novel-reader/props.uts +97 -0
- package/components/up-novel-reader/reader-catalog.uvue +92 -0
- package/components/up-novel-reader/reader-catalog.vue +202 -0
- package/components/up-novel-reader/reader-content.uvue +167 -0
- package/components/up-novel-reader/reader-content.vue +227 -0
- package/components/up-novel-reader/reader-core.js +158 -0
- package/components/up-novel-reader/reader-core.uts +175 -0
- package/components/up-novel-reader/reader-settings.uvue +136 -0
- package/components/up-novel-reader/reader-settings.vue +215 -0
- package/components/up-novel-reader/reader-toolbar.uvue +127 -0
- package/components/up-novel-reader/reader-toolbar.vue +303 -0
- package/components/up-novel-reader/theme-vars.scss +49 -0
- package/components/up-novel-reader/up-novel-reader.uvue +831 -0
- package/components/up-novel-reader/up-novel-reader.vue +760 -0
- package/components/up-number-box/numberBox.js +40 -0
- package/components/up-number-box/numberBox.uts +40 -0
- package/components/up-number-box/props.js +145 -0
- package/components/up-number-box/props.uts +148 -0
- package/components/up-number-box/up-number-box.uvue +630 -0
- package/components/up-number-box/up-number-box.vue +417 -0
- package/components/up-number-keyboard/numberKeyboard.js +17 -0
- package/components/up-number-keyboard/numberKeyboard.uts +17 -0
- package/components/up-number-keyboard/props.js +21 -0
- package/components/up-number-keyboard/props.uts +32 -0
- package/components/up-number-keyboard/up-number-keyboard.uvue +223 -0
- package/components/up-number-keyboard/up-number-keyboard.vue +234 -0
- package/components/up-overlay/overlay.js +18 -0
- package/components/up-overlay/overlay.uts +18 -0
- package/components/up-overlay/props.js +26 -0
- package/components/up-overlay/props.uts +28 -0
- package/components/up-overlay/up-overlay.uvue +96 -0
- package/components/up-overlay/up-overlay.vue +67 -0
- package/components/up-pagination/up-pagination.uvue +417 -0
- package/components/up-pagination/up-pagination.vue +283 -0
- package/components/up-parse/node/node.vue +599 -0
- package/components/up-parse/parse.js +22 -0
- package/components/up-parse/parser.js +1334 -0
- package/components/up-parse/props.js +48 -0
- package/components/up-parse/props.uts +68 -0
- package/components/up-parse/up-parse.uvue +561 -0
- package/components/up-parse/up-parse.vue +554 -0
- package/components/up-pdf-reader/props.js +19 -0
- package/components/up-pdf-reader/props.uts +19 -0
- package/components/up-pdf-reader/up-pdf-reader.uvue +83 -0
- package/components/up-pdf-reader/up-pdf-reader.vue +58 -0
- package/components/up-picker/picker.js +31 -0
- package/components/up-picker/picker.uts +31 -0
- package/components/up-picker/props.js +108 -0
- package/components/up-picker/props.uts +119 -0
- package/components/up-picker/up-picker.uvue +550 -0
- package/components/up-picker/up-picker.vue +336 -0
- package/components/up-picker-column/props.js +7 -0
- package/components/up-picker-column/props.uts +7 -0
- package/components/up-picker-column/up-picker-column.uvue +25 -0
- package/components/up-picker-column/up-picker-column.vue +36 -0
- package/components/up-picker-data/up-picker-data.uvue +149 -0
- package/components/up-picker-data/up-picker-data.vue +137 -0
- package/components/up-popover/props.js +59 -0
- package/components/up-popover/props.uts +58 -0
- package/components/up-popover/up-popover.uvue +161 -0
- package/components/up-popover/up-popover.vue +109 -0
- package/components/up-popup/popup.js +30 -0
- package/components/up-popup/popup.uts +29 -0
- package/components/up-popup/props.js +86 -0
- package/components/up-popup/props.uts +96 -0
- package/components/up-popup/up-popup.uvue +433 -0
- package/components/up-popup/up-popup.vue +378 -0
- package/components/up-poster/up-poster.uvue +944 -0
- package/components/up-poster/up-poster.vue +628 -0
- package/components/up-pull-refresh/up-pull-refresh.uvue +326 -0
- package/components/up-pull-refresh/up-pull-refresh.vue +319 -0
- package/components/up-qrcode/qrcode.js +1275 -0
- package/components/up-qrcode/qrcode.uts +480 -0
- package/components/up-qrcode/up-qrcode.uvue +502 -0
- package/components/up-qrcode/up-qrcode.vue +493 -0
- package/components/up-radio/props.js +71 -0
- package/components/up-radio/props.uts +81 -0
- package/components/up-radio/radio.js +27 -0
- package/components/up-radio/radio.uts +27 -0
- package/components/up-radio/up-radio.uvue +512 -0
- package/components/up-radio/up-radio.vue +382 -0
- package/components/up-radio-group/props.js +95 -0
- package/components/up-radio-group/props.uts +90 -0
- package/components/up-radio-group/radioGroup.js +30 -0
- package/components/up-radio-group/radioGroup.uts +30 -0
- package/components/up-radio-group/up-radio-group.uvue +211 -0
- package/components/up-radio-group/up-radio-group.vue +184 -0
- package/components/up-rate/props.js +80 -0
- package/components/up-rate/props.uts +82 -0
- package/components/up-rate/rate.js +26 -0
- package/components/up-rate/rate.uts +27 -0
- package/components/up-rate/up-rate.uvue +484 -0
- package/components/up-rate/up-rate.vue +367 -0
- package/components/up-read-more/props.js +63 -0
- package/components/up-read-more/props.uts +61 -0
- package/components/up-read-more/readMore.js +23 -0
- package/components/up-read-more/readMore.uts +23 -0
- package/components/up-read-more/up-read-more.uvue +252 -0
- package/components/up-read-more/up-read-more.vue +169 -0
- package/components/up-refresh-virtual-list/up-refresh-virtual-list.uvue +95 -0
- package/components/up-refresh-virtual-list/up-refresh-virtual-list.vue +100 -0
- package/components/up-root-toast-host/up-root-toast-host.vue +12 -0
- package/components/up-row/props.js +22 -0
- package/components/up-row/props.uts +31 -0
- package/components/up-row/row.js +17 -0
- package/components/up-row/row.uts +17 -0
- package/components/up-row/up-row.uvue +137 -0
- package/components/up-row/up-row.vue +104 -0
- package/components/up-row-notice/props.js +41 -0
- package/components/up-row-notice/props.uts +43 -0
- package/components/up-row-notice/rowNotice.js +21 -0
- package/components/up-row-notice/rowNotice.uts +21 -0
- package/components/up-row-notice/up-row-notice.uvue +310 -0
- package/components/up-row-notice/up-row-notice.vue +346 -0
- package/components/up-safe-bottom/props.js +7 -0
- package/components/up-safe-bottom/props.uts +6 -0
- package/components/up-safe-bottom/up-safe-bottom.uvue +60 -0
- package/components/up-safe-bottom/up-safe-bottom.vue +54 -0
- package/components/up-scroll-list/nvue.js +31 -0
- package/components/up-scroll-list/props.js +36 -0
- package/components/up-scroll-list/props.uts +38 -0
- package/components/up-scroll-list/scrollList.js +20 -0
- package/components/up-scroll-list/scrollList.uts +20 -0
- package/components/up-scroll-list/scrollWxs.wxs +50 -0
- package/components/up-scroll-list/up-scroll-list.uvue +262 -0
- package/components/up-scroll-list/up-scroll-list.vue +253 -0
- package/components/up-search/props.js +156 -0
- package/components/up-search/props.uts +152 -0
- package/components/up-search/search.js +41 -0
- package/components/up-search/search.uts +41 -0
- package/components/up-search/up-search.uvue +537 -0
- package/components/up-search/up-search.vue +347 -0
- package/components/up-section/section.js +16 -0
- package/components/up-section/section.uts +16 -0
- package/components/up-select/up-select.uvue +323 -0
- package/components/up-select/up-select.vue +239 -0
- package/components/up-short-video/up-short-video.uvue +659 -0
- package/components/up-short-video/up-short-video.vue +488 -0
- package/components/up-signature/up-signature.uvue +563 -0
- package/components/up-signature/up-signature.vue +534 -0
- package/components/up-skeleton/props.js +61 -0
- package/components/up-skeleton/props.uts +69 -0
- package/components/up-skeleton/skeleton.js +25 -0
- package/components/up-skeleton/skeleton.uts +22 -0
- package/components/up-skeleton/up-skeleton.uvue +279 -0
- package/components/up-skeleton/up-skeleton.vue +246 -0
- package/components/up-slider/props.js +95 -0
- package/components/up-slider/props.uts +102 -0
- package/components/up-slider/slider.js +28 -0
- package/components/up-slider/slider.uts +25 -0
- package/components/up-slider/up-slider.uvue +679 -0
- package/components/up-slider/up-slider.vue +524 -0
- package/components/up-status-bar/props.js +10 -0
- package/components/up-status-bar/props.uts +12 -0
- package/components/up-status-bar/statusBar.js +15 -0
- package/components/up-status-bar/statusBar.uts +15 -0
- package/components/up-status-bar/up-status-bar.uvue +52 -0
- package/components/up-status-bar/up-status-bar.vue +46 -0
- package/components/up-steps/props.js +41 -0
- package/components/up-steps/props.uts +43 -0
- package/components/up-steps/steps.js +21 -0
- package/components/up-steps/steps.uts +22 -0
- package/components/up-steps/up-steps.uvue +153 -0
- package/components/up-steps/up-steps.vue +118 -0
- package/components/up-steps-item/props.js +31 -0
- package/components/up-steps-item/props.uts +33 -0
- package/components/up-steps-item/stepsItem.js +18 -0
- package/components/up-steps-item/stepsItem.uts +18 -0
- package/components/up-steps-item/up-steps-item.uvue +448 -0
- package/components/up-steps-item/up-steps-item.vue +349 -0
- package/components/up-sticky/props.js +42 -0
- package/components/up-sticky/props.uts +52 -0
- package/components/up-sticky/sticky.js +20 -0
- package/components/up-sticky/sticky.uts +20 -0
- package/components/up-sticky/up-sticky.uvue +238 -0
- package/components/up-sticky/up-sticky.vue +220 -0
- package/components/up-subsection/props.js +66 -0
- package/components/up-subsection/props.uts +68 -0
- package/components/up-subsection/subsection.js +26 -0
- package/components/up-subsection/subsection.uts +26 -0
- package/components/up-subsection/theme-vars.scss +41 -0
- package/components/up-subsection/up-subsection.uvue +404 -0
- package/components/up-subsection/up-subsection.vue +327 -0
- package/components/up-swipe-action/props.js +16 -0
- package/components/up-swipe-action/props.uts +18 -0
- package/components/up-swipe-action/swipeAction.js +15 -0
- package/components/up-swipe-action/swipeAction.uts +16 -0
- package/components/up-swipe-action/up-swipe-action.uvue +105 -0
- package/components/up-swipe-action/up-swipe-action.vue +95 -0
- package/components/up-swipe-action-item/alipay.sjs +229 -0
- package/components/up-swipe-action-item/index.wxs +252 -0
- package/components/up-swipe-action-item/nvue.js +174 -0
- package/components/up-swipe-action-item/other.js +178 -0
- package/components/up-swipe-action-item/other.uts +176 -0
- package/components/up-swipe-action-item/props.js +52 -0
- package/components/up-swipe-action-item/props.uts +53 -0
- package/components/up-swipe-action-item/swipeActionItem.js +23 -0
- package/components/up-swipe-action-item/swipeActionItem.uts +24 -0
- package/components/up-swipe-action-item/types.uts +11 -0
- package/components/up-swipe-action-item/up-swipe-action-item.uvue +476 -0
- package/components/up-swipe-action-item/up-swipe-action-item.vue +752 -0
- package/components/up-swipe-action-item/wxs.js +15 -0
- package/components/up-swiper/props.js +132 -0
- package/components/up-swiper/props.uts +142 -0
- package/components/up-swiper/swiper.js +40 -0
- package/components/up-swiper/swiper.uts +39 -0
- package/components/up-swiper/up-swiper.uvue +455 -0
- package/components/up-swiper/up-swiper.vue +274 -0
- package/components/up-swiper-indicator/props.js +31 -0
- package/components/up-swiper-indicator/props.uts +41 -0
- package/components/up-swiper-indicator/swipterIndicator.js +19 -0
- package/components/up-swiper-indicator/swipterIndicator.uts +19 -0
- package/components/up-swiper-indicator/up-swiper-indicator.uvue +147 -0
- package/components/up-swiper-indicator/up-swiper-indicator.vue +112 -0
- package/components/up-switch/props.js +64 -0
- package/components/up-switch/props.uts +82 -0
- package/components/up-switch/switch.js +24 -0
- package/components/up-switch/switch.uts +27 -0
- package/components/up-switch/theme-vars.scss +41 -0
- package/components/up-switch/up-switch.uvue +257 -0
- package/components/up-switch/up-switch.vue +211 -0
- package/components/up-tabbar/props.js +57 -0
- package/components/up-tabbar/props.uts +66 -0
- package/components/up-tabbar/tabbar.js +24 -0
- package/components/up-tabbar/tabbar.uts +24 -0
- package/components/up-tabbar/up-tabbar.uvue +254 -0
- package/components/up-tabbar/up-tabbar.vue +208 -0
- package/components/up-tabbar-item/midButtonGeometry.js +23 -0
- package/components/up-tabbar-item/midButtonGeometry.uts +15 -0
- package/components/up-tabbar-item/props.js +71 -0
- package/components/up-tabbar-item/props.uts +81 -0
- package/components/up-tabbar-item/tabbarItem.js +27 -0
- package/components/up-tabbar-item/tabbarItem.uts +27 -0
- package/components/up-tabbar-item/up-tabbar-item.uvue +554 -0
- package/components/up-tabbar-item/up-tabbar-item.vue +428 -0
- package/components/up-table/props.js +7 -0
- package/components/up-table/props.uts +39 -0
- package/components/up-table/table.uts +21 -0
- package/components/up-table/up-table.uvue +128 -0
- package/components/up-table/up-table.vue +132 -0
- package/components/up-table2/tableRow.uvue +389 -0
- package/components/up-table2/tableRow.vue +329 -0
- package/components/up-table2/up-table2.uvue +1504 -0
- package/components/up-table2/up-table2.vue +911 -0
- package/components/up-tabs/props.js +76 -0
- package/components/up-tabs/props.uts +73 -0
- package/components/up-tabs/tabs.js +34 -0
- package/components/up-tabs/tabs.uts +35 -0
- package/components/up-tabs/types.uts +19 -0
- package/components/up-tabs/up-tabs.uvue +691 -0
- package/components/up-tabs/up-tabs.vue +561 -0
- package/components/up-tabs-item/props.js +7 -0
- package/components/up-tabs-item/props.uts +7 -0
- package/components/up-tabs-item/up-tabs-item.uvue +23 -0
- package/components/up-tabs-item/up-tabs-item.vue +34 -0
- package/components/up-tabs-pro/up-tabs-pro.uvue +242 -0
- package/components/up-tabs-pro/up-tabs-pro.vue +202 -0
- package/components/up-tag/props.js +91 -0
- package/components/up-tag/props.uts +100 -0
- package/components/up-tag/tag.js +30 -0
- package/components/up-tag/tag.uts +30 -0
- package/components/up-tag/theme-vars.scss +21 -0
- package/components/up-tag/up-tag.uvue +469 -0
- package/components/up-tag/up-tag.vue +377 -0
- package/components/up-td/props.js +7 -0
- package/components/up-td/props.uts +7 -0
- package/components/up-td/td.uts +19 -0
- package/components/up-td/up-td.uvue +124 -0
- package/components/up-td/up-td.vue +99 -0
- package/components/up-text/props.js +123 -0
- package/components/up-text/props.uts +159 -0
- package/components/up-text/text.js +40 -0
- package/components/up-text/text.uts +45 -0
- package/components/up-text/up-text.uvue +536 -0
- package/components/up-text/up-text.vue +365 -0
- package/components/up-text/value.js +87 -0
- package/components/up-textarea/props.js +132 -0
- package/components/up-textarea/props.uts +130 -0
- package/components/up-textarea/textarea.js +40 -0
- package/components/up-textarea/textarea.uts +40 -0
- package/components/up-textarea/up-textarea.uvue +440 -0
- package/components/up-textarea/up-textarea.vue +294 -0
- package/components/up-th/props.js +7 -0
- package/components/up-th/props.uts +7 -0
- package/components/up-th/th.uts +16 -0
- package/components/up-th/up-th.uvue +93 -0
- package/components/up-th/up-th.vue +69 -0
- package/components/up-title/up-title.uvue +27 -0
- package/components/up-title/up-title.vue +38 -0
- package/components/up-toast/toast.js +30 -0
- package/components/up-toast/toast.uts +29 -0
- package/components/up-toast/up-toast.uvue +390 -0
- package/components/up-toast/up-toast.vue +354 -0
- package/components/up-toolbar/props.js +41 -0
- package/components/up-toolbar/props.uts +43 -0
- package/components/up-toolbar/toolbar.js +21 -0
- package/components/up-toolbar/toolbar.uts +20 -0
- package/components/up-toolbar/up-toolbar.uvue +162 -0
- package/components/up-toolbar/up-toolbar.vue +131 -0
- package/components/up-tooltip/props.js +61 -0
- package/components/up-tooltip/props.uts +69 -0
- package/components/up-tooltip/tooltip.js +25 -0
- package/components/up-tooltip/up-tooltip.uvue +514 -0
- package/components/up-tooltip/up-tooltip.vue +325 -0
- package/components/up-tr/props.js +7 -0
- package/components/up-tr/props.uts +7 -0
- package/components/up-tr/up-tr.uvue +19 -0
- package/components/up-tr/up-tr.vue +37 -0
- package/components/up-transition/nvue-ani-map.js +75 -0
- package/components/up-transition/props.js +27 -0
- package/components/up-transition/props.uts +36 -0
- package/components/up-transition/transition.js +18 -0
- package/components/up-transition/transition.uts +18 -0
- package/components/up-transition/transitionMixin.js +164 -0
- package/components/up-transition/up-transition.uvue +182 -0
- package/components/up-transition/up-transition.vue +280 -0
- package/components/up-transition/vue.ani-style.scss +113 -0
- package/components/up-tree/tree-node.uvue +185 -0
- package/components/up-tree/tree-node.vue +141 -0
- package/components/up-tree/up-tree.uvue +825 -0
- package/components/up-tree/up-tree.vue +604 -0
- package/components/up-upload/mixin.js +23 -0
- package/components/up-upload/mixin.uts +24 -0
- package/components/up-upload/props.js +176 -0
- package/components/up-upload/props.uts +176 -0
- package/components/up-upload/types.uts +38 -0
- package/components/up-upload/up-upload.uvue +1131 -0
- package/components/up-upload/up-upload.vue +930 -0
- package/components/up-upload/upload.js +46 -0
- package/components/up-upload/upload.uts +46 -0
- package/components/up-upload/utils.js +183 -0
- package/components/up-upload/utils.uts +213 -0
- package/components/up-video/danmaku.js +96 -0
- package/components/up-video/danmaku.uts +106 -0
- package/components/up-video/props.js +200 -0
- package/components/up-video/types.uts +48 -0
- package/components/up-video/up-video.uvue +1451 -0
- package/components/up-video/up-video.vue +1349 -0
- package/components/up-video/video-danmaku.uvue +296 -0
- package/components/up-video/video-danmaku.vue +264 -0
- package/components/up-video/video-slider.uvue +210 -0
- package/components/up-video/video-slider.vue +201 -0
- package/components/up-video/video-utils.js +105 -0
- package/components/up-video/video-utils.uts +127 -0
- package/components/up-video/video.js +77 -0
- package/components/up-video/video.uts +78 -0
- package/components/up-view/up-view.uvue +93 -0
- package/components/up-view/up-view.vue +95 -0
- package/components/up-virtual-list/up-virtual-list.uvue +265 -0
- package/components/up-virtual-list/up-virtual-list.vue +241 -0
- package/components/up-waterfall/props.uts +49 -0
- package/components/up-waterfall/up-waterfall.uvue +456 -0
- package/components/up-waterfall/up-waterfall.vue +444 -0
- package/components/up-waterfall/waterfall.uts +20 -0
- package/index.js +344 -0
- package/index.scss +28 -0
- package/index.uts +91 -0
- package/libs/composable/useFuncIndex.uts +873 -0
- package/libs/composable/useUltraUI.js +201 -0
- package/libs/composable/useUltraUI.uts +184 -0
- package/libs/config/color.js +19 -0
- package/libs/config/color.uts +17 -0
- package/libs/config/config.js +48 -0
- package/libs/config/config.uts +33 -0
- package/libs/config/props.js +210 -0
- package/libs/config/props.uts +6 -0
- package/libs/config/zIndex.js +20 -0
- package/libs/config/zIndex.uts +20 -0
- package/libs/css/color.scss +311 -0
- package/libs/css/common.scss +121 -0
- package/libs/css/components.scss +37 -0
- package/libs/css/flex.scss +368 -0
- package/libs/css/h5.scss +0 -0
- package/libs/css/mixin.scss +8 -0
- package/libs/css/mp.scss +0 -0
- package/libs/css/nvue.scss +0 -0
- package/libs/css/theme-legacy-bridge.scss +6 -0
- package/libs/css/theme-vars-core.scss +201 -0
- package/libs/css/theme-vars.scss +1 -0
- package/libs/css/vue.scss +35 -0
- package/libs/function/calc.js +70 -0
- package/libs/function/colorGradient.js +134 -0
- package/libs/function/colorGradient.uts +316 -0
- package/libs/function/debounce.js +29 -0
- package/libs/function/debounce.uts +33 -0
- package/libs/function/digit.js +167 -0
- package/libs/function/digit.uts +182 -0
- package/libs/function/index.js +853 -0
- package/libs/function/index.uts +852 -0
- package/libs/function/platform.js +75 -0
- package/libs/function/platform.uts +75 -0
- package/libs/function/test.js +332 -0
- package/libs/function/test.uts +337 -0
- package/libs/function/throttle.js +34 -0
- package/libs/function/throttle.uts +36 -0
- package/libs/i18n/index.js +88 -0
- package/libs/i18n/index.uts +141 -0
- package/libs/i18n/locale-packs.js +11 -0
- package/libs/i18n/locale-packs.uts +11 -0
- package/libs/i18n/locales/all.js +23 -0
- package/libs/i18n/locales/all.uts +23 -0
- package/libs/i18n/locales/de.js +99 -0
- package/libs/i18n/locales/de.uts +99 -0
- package/libs/i18n/locales/en.js +99 -0
- package/libs/i18n/locales/en.uts +99 -0
- package/libs/i18n/locales/es.js +99 -0
- package/libs/i18n/locales/es.uts +99 -0
- package/libs/i18n/locales/fr.js +99 -0
- package/libs/i18n/locales/fr.uts +99 -0
- package/libs/i18n/locales/ja.js +99 -0
- package/libs/i18n/locales/ja.uts +99 -0
- package/libs/i18n/locales/ko.js +99 -0
- package/libs/i18n/locales/ko.uts +99 -0
- package/libs/i18n/locales/ru.js +99 -0
- package/libs/i18n/locales/ru.uts +99 -0
- package/libs/i18n/locales/th.js +99 -0
- package/libs/i18n/locales/th.uts +99 -0
- package/libs/i18n/locales/zh-Hans.js +99 -0
- package/libs/i18n/locales/zh-Hans.uts +99 -0
- package/libs/i18n/locales/zh-Hant.js +99 -0
- package/libs/i18n/locales/zh-Hant.uts +99 -0
- package/libs/luch-request/adapters/index.js +97 -0
- package/libs/luch-request/adapters/index.uts +114 -0
- package/libs/luch-request/core/InterceptorManager.js +50 -0
- package/libs/luch-request/core/InterceptorManager.uts +41 -0
- package/libs/luch-request/core/Request.js +198 -0
- package/libs/luch-request/core/Request.uts +134 -0
- package/libs/luch-request/core/buildFullPath.js +20 -0
- package/libs/luch-request/core/buildFullPath.uts +20 -0
- package/libs/luch-request/core/defaults.js +29 -0
- package/libs/luch-request/core/defaults.uts +30 -0
- package/libs/luch-request/core/dispatchRequest.js +3 -0
- package/libs/luch-request/core/dispatchRequest.uts +89 -0
- package/libs/luch-request/core/mergeConfig.js +103 -0
- package/libs/luch-request/core/mergeConfig.uts +115 -0
- package/libs/luch-request/core/settle.js +16 -0
- package/libs/luch-request/core/settle.uts +32 -0
- package/libs/luch-request/helpers/buildURL.js +69 -0
- package/libs/luch-request/helpers/buildURL.uts +64 -0
- package/libs/luch-request/helpers/combineURLs.js +14 -0
- package/libs/luch-request/helpers/combineURLs.uts +14 -0
- package/libs/luch-request/helpers/isAbsoluteURL.js +14 -0
- package/libs/luch-request/helpers/isAbsoluteURL.uts +14 -0
- package/libs/luch-request/index.d.ts +116 -0
- package/libs/luch-request/index.js +3 -0
- package/libs/luch-request/index.uts +3 -0
- package/libs/luch-request/utils/clone.js +264 -0
- package/libs/luch-request/utils/clone.uts +38 -0
- package/libs/luch-request/utils.js +131 -0
- package/libs/luch-request/utils.uts +66 -0
- package/libs/marked-uts/LICENSE +21 -0
- package/libs/marked-uts/common/Hooks.uts +71 -0
- package/libs/marked-uts/common/Instance.uts +273 -0
- package/libs/marked-uts/common/Lexer.uts +1083 -0
- package/libs/marked-uts/common/Parser.uts +367 -0
- package/libs/marked-uts/common/Renderer.uts +244 -0
- package/libs/marked-uts/common/TextRenderer.uts +74 -0
- package/libs/marked-uts/common/Tokenizer.uts +1122 -0
- package/libs/marked-uts/common/defaults.uts +25 -0
- package/libs/marked-uts/common/helpers.uts +165 -0
- package/libs/marked-uts/common/marked.uts +8 -0
- package/libs/marked-uts/common/rules.uts +603 -0
- package/libs/marked-uts/package.json +102 -0
- package/libs/marked-uts/readme.md +159 -0
- package/libs/marked-uts/utssdk/Hooks.interface.uts +34 -0
- package/libs/marked-uts/utssdk/Lexer.interface.uts +51 -0
- package/libs/marked-uts/utssdk/Marked.interface.uts +35 -0
- package/libs/marked-uts/utssdk/MarkedOptions.interface.uts +155 -0
- package/libs/marked-uts/utssdk/Parser.interface.uts +20 -0
- package/libs/marked-uts/utssdk/Renderer.interface.uts +34 -0
- package/libs/marked-uts/utssdk/Rules.interface.uts +296 -0
- package/libs/marked-uts/utssdk/TextRenderer.interface.uts +14 -0
- package/libs/marked-uts/utssdk/Tokenizer.interface.uts +38 -0
- package/libs/marked-uts/utssdk/Tokens.interface.uts +312 -0
- package/libs/marked-uts/utssdk/app-android/config.json +3 -0
- package/libs/marked-uts/utssdk/app-android/index.uts +23 -0
- package/libs/marked-uts/utssdk/app-android/libs/JSReg3.jar +0 -0
- package/libs/marked-uts/utssdk/app-harmony/index.uts +2 -0
- package/libs/marked-uts/utssdk/app-ios/config.json +3 -0
- package/libs/marked-uts/utssdk/app-ios/index.uts +85 -0
- package/libs/marked-uts/utssdk/app-js/index.uts +2 -0
- package/libs/marked-uts/utssdk/interface.uts +933 -0
- package/libs/marked-uts/utssdk/mp-weixin/index.uts +2 -0
- package/libs/marked-uts/utssdk/unierror.uts +39 -0
- package/libs/marked-uts/utssdk/web/index.uts +2 -0
- package/libs/root/LICENSE +21 -0
- package/libs/root/root-toast-host.vue +31 -0
- package/libs/root/runtime.js +11 -0
- package/libs/theme/runtime.js +440 -0
- package/libs/theme/theme.js +681 -0
- package/libs/util/async-validator.js +1343 -0
- package/libs/util/async-validator.uts +412 -0
- package/libs/util/calendar.js +546 -0
- package/libs/util/calendar.uts +546 -0
- package/libs/util/emitter.js +51 -0
- package/libs/util/route.js +124 -0
- package/libs/util/route.uts +130 -0
- package/libs/vite/app-icon-font.js +95 -0
- package/libs/vite/index.js +50 -0
- package/libs/vite/utils.js +48 -0
- package/libs/vue.js +3 -0
- package/libs/vue.uts +8 -0
- package/package.json +113 -0
- package/theme.scss +116 -0
- package/types/common.uts +14 -0
- package/types/comps/_common.d.ts +9 -0
- package/types/comps/actionSheet.d.ts +125 -0
- package/types/comps/album.d.ts +91 -0
- package/types/comps/alert.d.ts +55 -0
- package/types/comps/avatar.d.ts +85 -0
- package/types/comps/avatarGroup.d.ts +62 -0
- package/types/comps/backTop.d.ts +74 -0
- package/types/comps/badge.d.ts +76 -0
- package/types/comps/button.d.ts +169 -0
- package/types/comps/calendar.d.ts +271 -0
- package/types/comps/calendarStrip.d.ts +115 -0
- package/types/comps/cell.d.ts +133 -0
- package/types/comps/cellGroup.d.ts +27 -0
- package/types/comps/checkbox.d.ts +81 -0
- package/types/comps/checkboxGroup.d.ts +93 -0
- package/types/comps/code.d.ts +69 -0
- package/types/comps/codeInput.d.ts +98 -0
- package/types/comps/col.d.ts +43 -0
- package/types/comps/collapse.d.ts +52 -0
- package/types/comps/collapseItem.d.ts +83 -0
- package/types/comps/countDown.d.ts +60 -0
- package/types/comps/countTo.d.ts +88 -0
- package/types/comps/datetimePicker.d.ts +178 -0
- package/types/comps/divider.d.ts +58 -0
- package/types/comps/empty.d.ts +72 -0
- package/types/comps/form.d.ts +102 -0
- package/types/comps/formItem.d.ts +68 -0
- package/types/comps/gap.d.ts +35 -0
- package/types/comps/grid.d.ts +34 -0
- package/types/comps/gridItem.d.ts +28 -0
- package/types/comps/guide.d.ts +45 -0
- package/types/comps/icon.d.ts +98 -0
- package/types/comps/image.d.ts +119 -0
- package/types/comps/indexAnchor.d.ts +38 -0
- package/types/comps/indexItem.d.ts +18 -0
- package/types/comps/indexList.d.ts +39 -0
- package/types/comps/input.d.ts +234 -0
- package/types/comps/keyboard.d.ts +129 -0
- package/types/comps/line.d.ts +44 -0
- package/types/comps/lineProgress.d.ts +51 -0
- package/types/comps/link.d.ts +51 -0
- package/types/comps/list.d.ts +92 -0
- package/types/comps/listItem.d.ts +18 -0
- package/types/comps/loadMore.d.ts +108 -0
- package/types/comps/loadingIcon.d.ts +68 -0
- package/types/comps/loadingPage.d.ts +58 -0
- package/types/comps/modal.d.ts +115 -0
- package/types/comps/navbar.d.ts +113 -0
- package/types/comps/navbarMini.d.ts +78 -0
- package/types/comps/noNetwork.d.ts +40 -0
- package/types/comps/noticeBar.d.ts +85 -0
- package/types/comps/notify.d.ts +73 -0
- package/types/comps/novelReader.d.ts +103 -0
- package/types/comps/numberBox.d.ts +219 -0
- package/types/comps/overlay.d.ts +46 -0
- package/types/comps/pagination.d.ts +96 -0
- package/types/comps/parse.d.ts +101 -0
- package/types/comps/picker.d.ts +119 -0
- package/types/comps/popup.d.ts +107 -0
- package/types/comps/radio.d.ts +81 -0
- package/types/comps/radioGroup.d.ts +97 -0
- package/types/comps/rate.d.ts +85 -0
- package/types/comps/readMore.d.ts +80 -0
- package/types/comps/rootToastHost.d.ts +3 -0
- package/types/comps/row.d.ts +34 -0
- package/types/comps/safeBottom.d.ts +16 -0
- package/types/comps/scrollList.d.ts +51 -0
- package/types/comps/search.d.ts +167 -0
- package/types/comps/skeleton.d.ts +70 -0
- package/types/comps/slider.d.ts +79 -0
- package/types/comps/statusBar.d.ts +22 -0
- package/types/comps/steps.d.ts +48 -0
- package/types/comps/stepsItem.d.ts +41 -0
- package/types/comps/sticky.d.ts +48 -0
- package/types/comps/subsection.d.ts +79 -0
- package/types/comps/swipeAction.d.ts +24 -0
- package/types/comps/swipeActionItem.d.ts +71 -0
- package/types/comps/swiper.d.ts +147 -0
- package/types/comps/swiperIndicator.d.ts +37 -0
- package/types/comps/switch.d.ts +73 -0
- package/types/comps/tabbar.d.ts +54 -0
- package/types/comps/tabbarItem.d.ts +78 -0
- package/types/comps/tabs.d.ts +91 -0
- package/types/comps/tabsPro.d.ts +64 -0
- package/types/comps/tag.d.ts +93 -0
- package/types/comps/text.d.ts +115 -0
- package/types/comps/textarea.d.ts +163 -0
- package/types/comps/toast.d.ts +59 -0
- package/types/comps/tooltip.d.ts +71 -0
- package/types/comps/transition.d.ts +61 -0
- package/types/comps/upload.d.ts +163 -0
- package/types/comps/video.d.ts +170 -0
- package/types/comps.d.ts +120 -0
- package/types/index.d.ts +374 -0
- package/types/index.uts +11 -0
- package/types/package.json +26 -0
|
@@ -0,0 +1,944 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view class="up-poster">
|
|
3
|
+
<canvas
|
|
4
|
+
v-if="showCanvas"
|
|
5
|
+
class="up-poster__canvas"
|
|
6
|
+
:id="canvasId"
|
|
7
|
+
:canvas-id="canvasId"
|
|
8
|
+
:style="canvasStyle"
|
|
9
|
+
></canvas>
|
|
10
|
+
</view>
|
|
11
|
+
</template>
|
|
12
|
+
|
|
13
|
+
<script setup lang="uts">
|
|
14
|
+
import { computed, getCurrentInstance, nextTick, ref } from 'vue'
|
|
15
|
+
import { createQrCells, getQrRenderCount } from '../up-qrcode/qrcode.uts'
|
|
16
|
+
|
|
17
|
+
type PosterItem = {
|
|
18
|
+
type: string,
|
|
19
|
+
text: string,
|
|
20
|
+
src: string,
|
|
21
|
+
css: UTSJSONObject
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
type PosterImageAsset = {
|
|
25
|
+
src: string,
|
|
26
|
+
image: Image | null,
|
|
27
|
+
failed: boolean
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
type GradientStop = {
|
|
31
|
+
color: string,
|
|
32
|
+
offset: number
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function toObject(value: any | null): UTSJSONObject {
|
|
36
|
+
if (value == null) {
|
|
37
|
+
return {} as UTSJSONObject
|
|
38
|
+
}
|
|
39
|
+
return value as UTSJSONObject
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
function stringValue(value: any | null, fallback: string = ''): string {
|
|
43
|
+
return value == null ? fallback : value.toString()
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
function numberValue(value: any | null, fallback: number = 0): number {
|
|
47
|
+
if (typeof value === 'number') {
|
|
48
|
+
return value
|
|
49
|
+
}
|
|
50
|
+
if (value == null) {
|
|
51
|
+
return fallback
|
|
52
|
+
}
|
|
53
|
+
const text = value.toString()
|
|
54
|
+
if (text.endsWith('rpx')) {
|
|
55
|
+
const parsed = parseFloat(text.substring(0, text.length - 3))
|
|
56
|
+
return isNaN(parsed) ? fallback : parsed * uni.getWindowInfo().windowWidth / 750
|
|
57
|
+
}
|
|
58
|
+
if (text.endsWith('px')) {
|
|
59
|
+
const parsed = parseFloat(text.substring(0, text.length - 2))
|
|
60
|
+
return isNaN(parsed) ? fallback : parsed
|
|
61
|
+
}
|
|
62
|
+
const parsed = parseFloat(text)
|
|
63
|
+
return isNaN(parsed) ? fallback : parsed
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
function characterWidth(character: string, fontSize: number): number {
|
|
67
|
+
// 全角字符(CJK 汉字、日文假名、韩文、CJK 标点、全角符号)约占一个字号宽。
|
|
68
|
+
// 注意必须包含 ︰- 与 ⺀-〾 两段:全角句号「。」、顿号「、」、书名号等
|
|
69
|
+
// 落在 CJK 标点区,漏掉会把中文标点按半角短算,行宽被低估。
|
|
70
|
+
if (/[⺀-〾㐀-鿿-ヿ가-힣豈-︰--]/.test(character)) {
|
|
71
|
+
return fontSize
|
|
72
|
+
}
|
|
73
|
+
if (/\s/.test(character)) {
|
|
74
|
+
return fontSize * 0.28
|
|
75
|
+
}
|
|
76
|
+
return fontSize * 0.56
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
function estimateTextWidth(text: string, fontSize: number): number {
|
|
80
|
+
let width = 0
|
|
81
|
+
for (let index = 0; index < text.length; index++) {
|
|
82
|
+
width += characterWidth(text.charAt(index), fontSize)
|
|
83
|
+
}
|
|
84
|
+
return width
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
function colorValue(value: any | null, fallback: string): string {
|
|
88
|
+
const text = stringValue(value, fallback)
|
|
89
|
+
return text.length > 0 ? text : fallback
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
function splitGradientArgs(value: string): Array<string> {
|
|
93
|
+
const result = [] as Array<string>
|
|
94
|
+
let depth = 0
|
|
95
|
+
let start = 0
|
|
96
|
+
for (let i = 0; i < value.length; i++) {
|
|
97
|
+
const char = value.substring(i, i + 1)
|
|
98
|
+
if (char == '(') {
|
|
99
|
+
depth++
|
|
100
|
+
} else if (char == ')') {
|
|
101
|
+
depth--
|
|
102
|
+
} else if (char == ',' && depth == 0) {
|
|
103
|
+
result.push(value.substring(start, i).trim())
|
|
104
|
+
start = i + 1
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
const tail = value.substring(start).trim()
|
|
108
|
+
if (tail.length > 0) {
|
|
109
|
+
result.push(tail)
|
|
110
|
+
}
|
|
111
|
+
return result
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
function gradientBody(value: string): string {
|
|
115
|
+
const start = value.indexOf('(')
|
|
116
|
+
const end = value.lastIndexOf(')')
|
|
117
|
+
if (start < 0 || end <= start) {
|
|
118
|
+
return ''
|
|
119
|
+
}
|
|
120
|
+
return value.substring(start + 1, end)
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
function isGradientDirection(value: string): boolean {
|
|
124
|
+
return value.endsWith('deg') || value.startsWith('to ')
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
function parseGradientStop(value: string, index: number, total: number): GradientStop {
|
|
128
|
+
const parts = value.split(' ')
|
|
129
|
+
const color = parts.length > 0 ? parts[0].trim() : '#ffffff'
|
|
130
|
+
let offset = total <= 1 ? 0 : index / (total - 1)
|
|
131
|
+
for (let i = 1; i < parts.length; i++) {
|
|
132
|
+
const part = parts[i].trim()
|
|
133
|
+
if (part.endsWith('%')) {
|
|
134
|
+
const parsed = parseFloat(part.substring(0, part.length - 1))
|
|
135
|
+
if (!isNaN(parsed)) {
|
|
136
|
+
offset = Math.max(0, Math.min(1, parsed / 100))
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
return {
|
|
141
|
+
color: color.length > 0 ? color : '#ffffff',
|
|
142
|
+
offset
|
|
143
|
+
} as GradientStop
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
function parseGradientStops(background: string): Array<GradientStop> {
|
|
147
|
+
const args = splitGradientArgs(gradientBody(background))
|
|
148
|
+
const firstColorIndex = args.length > 0 && isGradientDirection(args[0]) ? 1 : 0
|
|
149
|
+
const total = args.length - firstColorIndex
|
|
150
|
+
const stops = [] as Array<GradientStop>
|
|
151
|
+
for (let i = firstColorIndex; i < args.length; i++) {
|
|
152
|
+
stops.push(parseGradientStop(args[i], i - firstColorIndex, total))
|
|
153
|
+
}
|
|
154
|
+
if (stops.length == 0) {
|
|
155
|
+
stops.push({ color: '#ffffff', offset: 0 } as GradientStop)
|
|
156
|
+
stops.push({ color: '#ffffff', offset: 1 } as GradientStop)
|
|
157
|
+
} else if (stops.length == 1) {
|
|
158
|
+
stops.push({ color: stops[0].color, offset: 1 } as GradientStop)
|
|
159
|
+
}
|
|
160
|
+
return stops
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
function gradientAngle(background: string): number {
|
|
164
|
+
const args = splitGradientArgs(gradientBody(background))
|
|
165
|
+
if (args.length == 0) {
|
|
166
|
+
return 135
|
|
167
|
+
}
|
|
168
|
+
const direction = args[0]
|
|
169
|
+
if (direction.endsWith('deg')) {
|
|
170
|
+
const parsed = parseFloat(direction.substring(0, direction.length - 3))
|
|
171
|
+
return isNaN(parsed) ? 135 : parsed
|
|
172
|
+
}
|
|
173
|
+
if (direction == 'to right') return 90
|
|
174
|
+
if (direction == 'to left') return 270
|
|
175
|
+
if (direction == 'to bottom') return 180
|
|
176
|
+
if (direction == 'to top') return 0
|
|
177
|
+
if (direction == 'to right bottom' || direction == 'to bottom right') return 135
|
|
178
|
+
if (direction == 'to left bottom' || direction == 'to bottom left') return 225
|
|
179
|
+
if (direction == 'to right top' || direction == 'to top right') return 45
|
|
180
|
+
if (direction == 'to left top' || direction == 'to top left') return 315
|
|
181
|
+
return 135
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
function createItem(raw: any | null): PosterItem {
|
|
185
|
+
const obj = toObject(raw)
|
|
186
|
+
return {
|
|
187
|
+
type: stringValue(obj['type']),
|
|
188
|
+
text: stringValue(obj['text']),
|
|
189
|
+
src: stringValue(obj['src']),
|
|
190
|
+
css: toObject(obj['css'])
|
|
191
|
+
} as PosterItem
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
function makeId(): string {
|
|
195
|
+
return 'up-poster-canvas-' + Date.now().toString()
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
defineOptions({
|
|
199
|
+
styleIsolation: 'app-and-page',
|
|
200
|
+
name: 'up-poster'
|
|
201
|
+
})
|
|
202
|
+
|
|
203
|
+
const props = defineProps({
|
|
204
|
+
json: {
|
|
205
|
+
type: Object,
|
|
206
|
+
default(): UTSJSONObject {
|
|
207
|
+
return {} as UTSJSONObject
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
})
|
|
211
|
+
|
|
212
|
+
const emit = defineEmits(['export', 'error'])
|
|
213
|
+
const instance = getCurrentInstance()!.proxy!
|
|
214
|
+
|
|
215
|
+
const canvasId = ref(makeId())
|
|
216
|
+
const showCanvas = ref(false)
|
|
217
|
+
const canvasWidth = ref(375)
|
|
218
|
+
const canvasHeight = ref(557)
|
|
219
|
+
const canvasContext = ref<CanvasContext | null>(null)
|
|
220
|
+
const ctx = ref<CanvasRenderingContext2D | null>(null)
|
|
221
|
+
const dpr = ref(1)
|
|
222
|
+
let posterImageAssets = [] as Array<PosterImageAsset>
|
|
223
|
+
|
|
224
|
+
function getDrawScale(): number {
|
|
225
|
+
// #ifdef APP-HARMONY
|
|
226
|
+
return dpr.value
|
|
227
|
+
// #endif
|
|
228
|
+
// #ifndef APP-HARMONY
|
|
229
|
+
return 1
|
|
230
|
+
// #endif
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
function scaleCanvasValue(value: number): number {
|
|
234
|
+
// 鸿蒙 uni-canvas 会在每个数值参数上执行 px2vp,需在调用层抵消一次。
|
|
235
|
+
// 其它平台不改变原有 Canvas 坐标。
|
|
236
|
+
return value * getDrawScale()
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
function measuredTextWidth(context: CanvasRenderingContext2D, text: string, fontSize: number): number {
|
|
240
|
+
// 鸿蒙 CanvasContext.measureText 的同步返回值通常为 0;若运行时返回了物理
|
|
241
|
+
// 像素宽度,也要除以绘制倍率后再与逻辑宽度比较。
|
|
242
|
+
const measured = context.measureText(text).width / getDrawScale()
|
|
243
|
+
return measured > 0 ? measured : estimateTextWidth(text, fontSize)
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
function normalizeCanvasColor(color: string): string {
|
|
247
|
+
return color == 'transparent' ? 'rgba(0, 0, 0, 0)' : color
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
function canvasPixelRatio(): number {
|
|
251
|
+
// #ifdef APP-HARMONY
|
|
252
|
+
const ratio = uni.getWindowInfo().pixelRatio
|
|
253
|
+
return ratio > 0 ? ratio : 1
|
|
254
|
+
// #endif
|
|
255
|
+
// #ifndef APP-HARMONY
|
|
256
|
+
return 1
|
|
257
|
+
// #endif
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
const canvasStyle = computed((): UTSJSONObject => {
|
|
261
|
+
return {
|
|
262
|
+
width: canvasWidth.value.toString() + 'px',
|
|
263
|
+
height: canvasHeight.value.toString() + 'px'
|
|
264
|
+
} as UTSJSONObject
|
|
265
|
+
})
|
|
266
|
+
|
|
267
|
+
function getJson(): UTSJSONObject {
|
|
268
|
+
return toObject(props.json)
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
function getPosterCss(): UTSJSONObject {
|
|
272
|
+
return toObject(getJson()['css'])
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
function getViews(): Array<any> {
|
|
276
|
+
const views = getJson()['views']
|
|
277
|
+
if (views == null) {
|
|
278
|
+
return [] as Array<any>
|
|
279
|
+
}
|
|
280
|
+
return views as Array<any>
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
function prepareSize(): void {
|
|
284
|
+
const css = getPosterCss()
|
|
285
|
+
canvasWidth.value = numberValue(css['width'], 375)
|
|
286
|
+
canvasHeight.value = numberValue(css['height'], 557)
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
function initCanvas(): Promise<void> {
|
|
290
|
+
return new Promise((resolve, reject) => {
|
|
291
|
+
uni.createCanvasContextAsync({
|
|
292
|
+
id: canvasId.value.toString() as string.IDString,
|
|
293
|
+
component: instance,
|
|
294
|
+
success: (context: CanvasContext) => {
|
|
295
|
+
const context2d = context.getContext('2d')
|
|
296
|
+
if (context2d == null) {
|
|
297
|
+
reject(new Error('无法获取海报画布上下文'))
|
|
298
|
+
return
|
|
299
|
+
}
|
|
300
|
+
canvasContext.value = context
|
|
301
|
+
// 画布后备存储是「布局尺寸(vp) × dpr」个物理像素,而鸿蒙运行时会对
|
|
302
|
+
// 每个绘制坐标做一次 px2vp(即 ÷dpr)。所有绘制参数统一乘 dpr
|
|
303
|
+
// 抵消这次转换,避免使用会触发异常超大 Surface 的矩阵缩放。
|
|
304
|
+
dpr.value = canvasPixelRatio()
|
|
305
|
+
const canvas = context2d.canvas
|
|
306
|
+
canvas.width = Math.ceil(canvasWidth.value * dpr.value)
|
|
307
|
+
canvas.height = Math.ceil(canvasHeight.value * dpr.value)
|
|
308
|
+
ctx.value = context2d
|
|
309
|
+
// #ifdef APP-HARMONY
|
|
310
|
+
// Wait until the native Canvas has produced its first frame; otherwise
|
|
311
|
+
// synchronous background/text drawing is discarded while later image
|
|
312
|
+
// callbacks happen to render correctly.
|
|
313
|
+
context.requestAnimationFrame((_time: number) => {
|
|
314
|
+
resolve()
|
|
315
|
+
})
|
|
316
|
+
// #endif
|
|
317
|
+
// #ifndef APP-HARMONY
|
|
318
|
+
resolve()
|
|
319
|
+
// #endif
|
|
320
|
+
},
|
|
321
|
+
fail: (error: UniError) => {
|
|
322
|
+
reject(error)
|
|
323
|
+
}
|
|
324
|
+
})
|
|
325
|
+
})
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
let exportImage = (): Promise<UTSJSONObject> => {
|
|
329
|
+
return new Promise((resolve, reject) => {
|
|
330
|
+
reject(new Error('exportImage is not ready'))
|
|
331
|
+
})
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
let generatePoster = (): Promise<string> => {
|
|
335
|
+
return new Promise((resolve, reject) => {
|
|
336
|
+
reject(new Error('generatePoster is not ready'))
|
|
337
|
+
})
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
let drawPoster = (): Promise<void> => {
|
|
341
|
+
return new Promise((resolve, reject) => {
|
|
342
|
+
reject(new Error('drawPoster is not ready'))
|
|
343
|
+
})
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
let drawPosterSync = (): Promise<void> => {
|
|
347
|
+
return new Promise((resolve, reject) => {
|
|
348
|
+
reject(new Error('drawPosterSync is not ready'))
|
|
349
|
+
})
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
let drawItems = (_views: Array<any>, _index: number): Promise<void> => {
|
|
353
|
+
return new Promise((resolve, reject) => {
|
|
354
|
+
reject(new Error('drawItems is not ready'))
|
|
355
|
+
})
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
let drawItem = (_item: PosterItem): Promise<void> => {
|
|
359
|
+
return new Promise((resolve, reject) => {
|
|
360
|
+
reject(new Error('drawItem is not ready'))
|
|
361
|
+
})
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
let preloadPosterImage = (_item: PosterItem): Promise<void> => {
|
|
365
|
+
return new Promise((resolve, reject) => {
|
|
366
|
+
reject(new Error('preloadPosterImage is not ready'))
|
|
367
|
+
})
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
let preloadPosterImages = (_views: Array<any>, _index: number): Promise<void> => {
|
|
371
|
+
return new Promise((resolve, reject) => {
|
|
372
|
+
reject(new Error('preloadPosterImages is not ready'))
|
|
373
|
+
})
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
let drawView = (_item: PosterItem): void => {}
|
|
377
|
+
let drawText = (_item: PosterItem): void => {}
|
|
378
|
+
let wrapText = (_text: string, _maxWidth: number, _maxLines: number, _fontSize: number): Array<string> => [] as Array<string>
|
|
379
|
+
|
|
380
|
+
let drawImageBox = (_item: PosterItem): Promise<void> => {
|
|
381
|
+
return new Promise((resolve, reject) => {
|
|
382
|
+
reject(new Error('drawImageBox is not ready'))
|
|
383
|
+
})
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
let drawImageFallback = (_x: number, _y: number, _width: number, _height: number, _radius: number): void => {}
|
|
387
|
+
let drawQrCode = (_item: PosterItem): void => {}
|
|
388
|
+
let fillBackground = (_value: any | null, _x: number, _y: number, _width: number, _height: number, _radius: number, _fallback: string): void => {}
|
|
389
|
+
let fillGradient = (_background: string, _x: number, _y: number, _width: number, _height: number, _radius: number, _fallback: string): void => {}
|
|
390
|
+
let fillCanvasGradient = (_background: string, _x: number, _y: number, _width: number, _height: number, _radius: number): boolean => false
|
|
391
|
+
let fillSteppedLinearGradient = (_background: string, _x: number, _y: number, _width: number, _height: number, _radius: number, _fallback: string): void => {}
|
|
392
|
+
let fillSteppedRadialGradient = (_background: string, _x: number, _y: number, _width: number, _height: number, _radius: number, _fallback: string): void => {}
|
|
393
|
+
let gradientColorAt = (_stops: Array<GradientStop>, _progress: number, fallback: string): string => fallback
|
|
394
|
+
let clipRadiusMask = (_x: number, _y: number, _width: number, _height: number, _radius: number): void => {}
|
|
395
|
+
let fillRoundRect = (_x: number, _y: number, _width: number, _height: number, _radius: number): void => {}
|
|
396
|
+
|
|
397
|
+
exportImage = (): Promise<UTSJSONObject> => {
|
|
398
|
+
return new Promise((resolve, reject) => {
|
|
399
|
+
generatePoster().then((path: string) => {
|
|
400
|
+
const result = {
|
|
401
|
+
width: canvasWidth.value,
|
|
402
|
+
height: canvasHeight.value,
|
|
403
|
+
path
|
|
404
|
+
} as UTSJSONObject
|
|
405
|
+
emit('export', result)
|
|
406
|
+
resolve(result)
|
|
407
|
+
}).catch((error: any | null) => {
|
|
408
|
+
emit('error', error)
|
|
409
|
+
reject(error)
|
|
410
|
+
})
|
|
411
|
+
})
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
function getPosterImageAsset(src: string): PosterImageAsset | null {
|
|
415
|
+
for (let i = 0; i < posterImageAssets.length; i++) {
|
|
416
|
+
if (posterImageAssets[i].src == src) {
|
|
417
|
+
return posterImageAssets[i]
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
return null
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
preloadPosterImage = (item: PosterItem): Promise<void> => {
|
|
424
|
+
return new Promise((resolve) => {
|
|
425
|
+
if (item.src.length == 0 || getPosterImageAsset(item.src) != null) {
|
|
426
|
+
resolve()
|
|
427
|
+
return
|
|
428
|
+
}
|
|
429
|
+
const asset = {
|
|
430
|
+
src: item.src,
|
|
431
|
+
image: null,
|
|
432
|
+
failed: false
|
|
433
|
+
} as PosterImageAsset
|
|
434
|
+
posterImageAssets.push(asset)
|
|
435
|
+
const canvas = canvasContext.value
|
|
436
|
+
if (canvas == null) {
|
|
437
|
+
asset.failed = true
|
|
438
|
+
resolve()
|
|
439
|
+
return
|
|
440
|
+
}
|
|
441
|
+
uni.getImageInfo({
|
|
442
|
+
src: item.src,
|
|
443
|
+
success: (res: GetImageInfoSuccess) => {
|
|
444
|
+
const image = canvas.createImage()
|
|
445
|
+
image.onload = () => {
|
|
446
|
+
asset.image = image
|
|
447
|
+
resolve()
|
|
448
|
+
}
|
|
449
|
+
// #ifdef APP
|
|
450
|
+
image.onerror = () => {
|
|
451
|
+
asset.failed = true
|
|
452
|
+
resolve()
|
|
453
|
+
}
|
|
454
|
+
// #endif
|
|
455
|
+
// #ifndef APP
|
|
456
|
+
;(image as any).onerror = () => {
|
|
457
|
+
asset.failed = true
|
|
458
|
+
resolve()
|
|
459
|
+
}
|
|
460
|
+
// #endif
|
|
461
|
+
image.src = res.path
|
|
462
|
+
},
|
|
463
|
+
fail: () => {
|
|
464
|
+
asset.failed = true
|
|
465
|
+
resolve()
|
|
466
|
+
}
|
|
467
|
+
})
|
|
468
|
+
})
|
|
469
|
+
}
|
|
470
|
+
|
|
471
|
+
preloadPosterImages = (views: Array<any>, index: number): Promise<void> => {
|
|
472
|
+
return new Promise((resolve) => {
|
|
473
|
+
if (index >= views.length) {
|
|
474
|
+
resolve()
|
|
475
|
+
return
|
|
476
|
+
}
|
|
477
|
+
const item = createItem(views[index])
|
|
478
|
+
if (item.type == 'image') {
|
|
479
|
+
preloadPosterImage(item).then(() => {
|
|
480
|
+
preloadPosterImages(views, index + 1).then(() => {
|
|
481
|
+
resolve()
|
|
482
|
+
})
|
|
483
|
+
})
|
|
484
|
+
return
|
|
485
|
+
}
|
|
486
|
+
preloadPosterImages(views, index + 1).then(() => {
|
|
487
|
+
resolve()
|
|
488
|
+
})
|
|
489
|
+
})
|
|
490
|
+
}
|
|
491
|
+
|
|
492
|
+
generatePoster = (): Promise<string> => {
|
|
493
|
+
return new Promise((resolve, reject) => {
|
|
494
|
+
prepareSize()
|
|
495
|
+
showCanvas.value = true
|
|
496
|
+
nextTick(() => {
|
|
497
|
+
initCanvas().then(() => {
|
|
498
|
+
posterImageAssets = [] as Array<PosterImageAsset>
|
|
499
|
+
preloadPosterImages(getViews(), 0).then(() => {
|
|
500
|
+
drawPoster().then(() => {
|
|
501
|
+
const canvas = canvasContext.value
|
|
502
|
+
if (canvas == null) {
|
|
503
|
+
reject(new Error('Canvas is not ready'))
|
|
504
|
+
return
|
|
505
|
+
}
|
|
506
|
+
const dataUrl = canvas.toDataURL('image/png', 1)
|
|
507
|
+
showCanvas.value = false
|
|
508
|
+
resolve(dataUrl)
|
|
509
|
+
})
|
|
510
|
+
})
|
|
511
|
+
}).catch((error: any | null) => {
|
|
512
|
+
showCanvas.value = false
|
|
513
|
+
reject(error)
|
|
514
|
+
})
|
|
515
|
+
})
|
|
516
|
+
})
|
|
517
|
+
}
|
|
518
|
+
|
|
519
|
+
drawPoster = (): Promise<void> => {
|
|
520
|
+
return new Promise((resolve) => {
|
|
521
|
+
drawPosterSync().then(() => {
|
|
522
|
+
const context = ctx.value
|
|
523
|
+
if (context != null) {
|
|
524
|
+
context.draw()
|
|
525
|
+
}
|
|
526
|
+
resolve()
|
|
527
|
+
})
|
|
528
|
+
})
|
|
529
|
+
}
|
|
530
|
+
|
|
531
|
+
drawPosterSync = (): Promise<void> => {
|
|
532
|
+
return new Promise((resolve) => {
|
|
533
|
+
const context = ctx.value
|
|
534
|
+
if (context == null) {
|
|
535
|
+
resolve()
|
|
536
|
+
return
|
|
537
|
+
}
|
|
538
|
+
const css = getPosterCss()
|
|
539
|
+
context.clearRect(0, 0, scaleCanvasValue(canvasWidth.value), scaleCanvasValue(canvasHeight.value))
|
|
540
|
+
fillBackground(css['background'], 0, 0, canvasWidth.value, canvasHeight.value, 0, '#ffffff')
|
|
541
|
+
const views = getViews()
|
|
542
|
+
drawItems(views, 0).then(() => {
|
|
543
|
+
resolve()
|
|
544
|
+
})
|
|
545
|
+
})
|
|
546
|
+
}
|
|
547
|
+
|
|
548
|
+
drawItems = (views: Array<any>, index: number): Promise<void> => {
|
|
549
|
+
return new Promise((resolve) => {
|
|
550
|
+
if (index >= views.length) {
|
|
551
|
+
resolve()
|
|
552
|
+
return
|
|
553
|
+
}
|
|
554
|
+
drawItem(createItem(views[index])).then(() => {
|
|
555
|
+
drawItems(views, index + 1).then(() => {
|
|
556
|
+
resolve()
|
|
557
|
+
})
|
|
558
|
+
})
|
|
559
|
+
})
|
|
560
|
+
}
|
|
561
|
+
|
|
562
|
+
drawItem = (item: PosterItem): Promise<void> => {
|
|
563
|
+
return new Promise((resolve) => {
|
|
564
|
+
if (item.type == 'view') {
|
|
565
|
+
drawView(item)
|
|
566
|
+
resolve()
|
|
567
|
+
} else if (item.type == 'text') {
|
|
568
|
+
drawText(item)
|
|
569
|
+
resolve()
|
|
570
|
+
} else if (item.type == 'image') {
|
|
571
|
+
drawImageBox(item).then(() => {
|
|
572
|
+
resolve()
|
|
573
|
+
})
|
|
574
|
+
} else if (item.type == 'qrcode') {
|
|
575
|
+
drawQrCode(item)
|
|
576
|
+
resolve()
|
|
577
|
+
} else {
|
|
578
|
+
resolve()
|
|
579
|
+
}
|
|
580
|
+
})
|
|
581
|
+
}
|
|
582
|
+
|
|
583
|
+
drawView = (item: PosterItem): void => {
|
|
584
|
+
const context = ctx.value
|
|
585
|
+
if (context == null) {
|
|
586
|
+
return
|
|
587
|
+
}
|
|
588
|
+
const css = item.css
|
|
589
|
+
const x = numberValue(css['left'], 0)
|
|
590
|
+
const y = numberValue(css['top'], 0)
|
|
591
|
+
const width = numberValue(css['width'], 0)
|
|
592
|
+
const height = numberValue(css['height'], 0)
|
|
593
|
+
fillBackground(css['background'], x, y, width, height, numberValue(css['radius'], 0), '#ffffff')
|
|
594
|
+
}
|
|
595
|
+
|
|
596
|
+
drawText = (item: PosterItem): void => {
|
|
597
|
+
const context = ctx.value
|
|
598
|
+
if (context == null) {
|
|
599
|
+
return
|
|
600
|
+
}
|
|
601
|
+
const css = item.css
|
|
602
|
+
const x = numberValue(css['left'], 0)
|
|
603
|
+
const y = numberValue(css['top'], 0)
|
|
604
|
+
const width = numberValue(css['width'], canvasWidth.value - x)
|
|
605
|
+
const fontSize = numberValue(css['fontSize'], 14)
|
|
606
|
+
const lineHeight = numberValue(css['lineHeight'], fontSize + 6)
|
|
607
|
+
const lineClamp = numberValue(css['lineClamp'], 1)
|
|
608
|
+
context.fillStyle = normalizeCanvasColor(colorValue(css['color'], '#333333'))
|
|
609
|
+
context.font = stringValue(css['fontWeight']) == 'bold' ? 'bold ' + scaleCanvasValue(fontSize).toString() + 'px sans-serif' : scaleCanvasValue(fontSize).toString() + 'px sans-serif'
|
|
610
|
+
const lines = wrapText(item.text, width, lineClamp, fontSize)
|
|
611
|
+
for (let i = 0; i < lines.length; i++) {
|
|
612
|
+
context.fillText(lines[i], scaleCanvasValue(x), scaleCanvasValue(y + fontSize + i * lineHeight))
|
|
613
|
+
}
|
|
614
|
+
}
|
|
615
|
+
|
|
616
|
+
wrapText = (text: string, maxWidth: number, maxLines: number, fontSize: number): Array<string> => {
|
|
617
|
+
const context = ctx.value
|
|
618
|
+
const lines = [] as Array<string>
|
|
619
|
+
if (context == null || text.length == 0) {
|
|
620
|
+
return lines
|
|
621
|
+
}
|
|
622
|
+
let current = ''
|
|
623
|
+
for (let i = 0; i < text.length; i++) {
|
|
624
|
+
const next = current + text.substring(i, i + 1)
|
|
625
|
+
if (measuredTextWidth(context, next, fontSize) > maxWidth && current.length > 0) {
|
|
626
|
+
lines.push(current)
|
|
627
|
+
current = text.substring(i, i + 1)
|
|
628
|
+
if (lines.length >= maxLines) {
|
|
629
|
+
break
|
|
630
|
+
}
|
|
631
|
+
} else {
|
|
632
|
+
current = next
|
|
633
|
+
}
|
|
634
|
+
}
|
|
635
|
+
if (lines.length < maxLines && current.length > 0) {
|
|
636
|
+
lines.push(current)
|
|
637
|
+
}
|
|
638
|
+
if (lines.length == maxLines && text.length > lines.join('').length) {
|
|
639
|
+
let last = lines[maxLines - 1]
|
|
640
|
+
while (last.length > 0 && measuredTextWidth(context, last + '...', fontSize) > maxWidth) {
|
|
641
|
+
last = last.substring(0, last.length - 1)
|
|
642
|
+
}
|
|
643
|
+
lines[maxLines - 1] = last + '...'
|
|
644
|
+
}
|
|
645
|
+
return lines
|
|
646
|
+
}
|
|
647
|
+
|
|
648
|
+
drawImageBox = (item: PosterItem): Promise<void> => {
|
|
649
|
+
return new Promise((resolve) => {
|
|
650
|
+
const context = ctx.value
|
|
651
|
+
if (context == null) {
|
|
652
|
+
resolve()
|
|
653
|
+
return
|
|
654
|
+
}
|
|
655
|
+
const css = item.css
|
|
656
|
+
const x = numberValue(css['left'], 0)
|
|
657
|
+
const y = numberValue(css['top'], 0)
|
|
658
|
+
const width = numberValue(css['width'], 0)
|
|
659
|
+
const height = numberValue(css['height'], 0)
|
|
660
|
+
const asset = getPosterImageAsset(item.src)
|
|
661
|
+
if (asset == null || asset.failed || asset.image == null) {
|
|
662
|
+
drawImageFallback(x, y, width, height, numberValue(css['radius'], 0))
|
|
663
|
+
resolve()
|
|
664
|
+
return
|
|
665
|
+
}
|
|
666
|
+
context.drawImage(asset.image, scaleCanvasValue(x), scaleCanvasValue(y), scaleCanvasValue(width), scaleCanvasValue(height))
|
|
667
|
+
resolve()
|
|
668
|
+
})
|
|
669
|
+
}
|
|
670
|
+
|
|
671
|
+
drawImageFallback = (x: number, y: number, width: number, height: number, radius: number): void => {
|
|
672
|
+
const context = ctx.value
|
|
673
|
+
if (context == null) {
|
|
674
|
+
return
|
|
675
|
+
}
|
|
676
|
+
context.fillStyle = normalizeCanvasColor('#eef2f7')
|
|
677
|
+
fillRoundRect(x, y, width, height, radius)
|
|
678
|
+
}
|
|
679
|
+
|
|
680
|
+
drawQrCode = (item: PosterItem): void => {
|
|
681
|
+
const context = ctx.value
|
|
682
|
+
if (context == null) {
|
|
683
|
+
return
|
|
684
|
+
}
|
|
685
|
+
const css = item.css
|
|
686
|
+
const x = numberValue(css['left'], 0)
|
|
687
|
+
const y = numberValue(css['top'], 0)
|
|
688
|
+
const width = numberValue(css['width'], 0)
|
|
689
|
+
const height = numberValue(css['height'], width)
|
|
690
|
+
const value = item.text.length > 0 ? item.text : item.src
|
|
691
|
+
if (value.length == 0 || width <= 0 || height <= 0) {
|
|
692
|
+
drawImageFallback(x, y, width, height, numberValue(css['radius'], 0))
|
|
693
|
+
return
|
|
694
|
+
}
|
|
695
|
+
const foreground = colorValue(css['foreground'], '#000000')
|
|
696
|
+
const background = colorValue(css['background'], '#ffffff')
|
|
697
|
+
const pdground = colorValue(css['pdground'], foreground)
|
|
698
|
+
const level = numberValue(css['lv'], 3)
|
|
699
|
+
const count = getQrRenderCount(value, level)
|
|
700
|
+
const cells = createQrCells(value, foreground, background, pdground, level)
|
|
701
|
+
const cellSize = Math.min(width, height) / count
|
|
702
|
+
context.fillStyle = normalizeCanvasColor(background)
|
|
703
|
+
context.fillRect(scaleCanvasValue(x), scaleCanvasValue(y), scaleCanvasValue(width), scaleCanvasValue(height))
|
|
704
|
+
for (let row = 0; row < count; row++) {
|
|
705
|
+
for (let col = 0; col < count; col++) {
|
|
706
|
+
const index = row * count + col
|
|
707
|
+
if (index >= cells.length) continue
|
|
708
|
+
const cell = cells[index]
|
|
709
|
+
if ((cell['dark'] as boolean) != true) continue
|
|
710
|
+
context.fillStyle = normalizeCanvasColor(colorValue(cell['color'], foreground))
|
|
711
|
+
context.fillRect(scaleCanvasValue(x + col * cellSize), scaleCanvasValue(y + row * cellSize), scaleCanvasValue(cellSize + 0.5), scaleCanvasValue(cellSize + 0.5))
|
|
712
|
+
}
|
|
713
|
+
}
|
|
714
|
+
}
|
|
715
|
+
|
|
716
|
+
fillBackground = (value: any | null, x: number, y: number, width: number, height: number, radius: number, fallback: string): void => {
|
|
717
|
+
const context = ctx.value
|
|
718
|
+
if (context == null) {
|
|
719
|
+
return
|
|
720
|
+
}
|
|
721
|
+
const background = colorValue(value, fallback)
|
|
722
|
+
if (background.indexOf('gradient') >= 0) {
|
|
723
|
+
fillGradient(background, x, y, width, height, radius, fallback)
|
|
724
|
+
return
|
|
725
|
+
}
|
|
726
|
+
context.fillStyle = normalizeCanvasColor(background)
|
|
727
|
+
fillRoundRect(x, y, width, height, radius)
|
|
728
|
+
}
|
|
729
|
+
|
|
730
|
+
fillGradient = (background: string, x: number, y: number, width: number, height: number, radius: number, fallback: string): void => {
|
|
731
|
+
if (fillCanvasGradient(background, x, y, width, height, radius)) {
|
|
732
|
+
return
|
|
733
|
+
}
|
|
734
|
+
if (background.indexOf('radial-gradient') >= 0) {
|
|
735
|
+
fillSteppedRadialGradient(background, x, y, width, height, radius, fallback)
|
|
736
|
+
return
|
|
737
|
+
}
|
|
738
|
+
fillSteppedLinearGradient(background, x, y, width, height, radius, fallback)
|
|
739
|
+
}
|
|
740
|
+
|
|
741
|
+
fillCanvasGradient = (background: string, x: number, y: number, width: number, height: number, radius: number): boolean => {
|
|
742
|
+
const context = ctx.value
|
|
743
|
+
if (context == null) {
|
|
744
|
+
return false
|
|
745
|
+
}
|
|
746
|
+
const stops = parseGradientStops(background)
|
|
747
|
+
if (background.indexOf('radial-gradient') >= 0) {
|
|
748
|
+
const centerX = x + width / 2
|
|
749
|
+
const centerY = y + height / 2
|
|
750
|
+
const maxRadius = Math.max(width, height) / 2
|
|
751
|
+
const gradient = context.createRadialGradient(scaleCanvasValue(centerX), scaleCanvasValue(centerY), 0, scaleCanvasValue(centerX), scaleCanvasValue(centerY), scaleCanvasValue(maxRadius))
|
|
752
|
+
for (let i = 0; i < stops.length; i++) {
|
|
753
|
+
gradient.addColorStop(stops[i].offset, normalizeCanvasColor(stops[i].color))
|
|
754
|
+
}
|
|
755
|
+
context.fillStyle = gradient
|
|
756
|
+
fillRoundRect(x, y, width, height, radius)
|
|
757
|
+
return true
|
|
758
|
+
}
|
|
759
|
+
const angle = gradientAngle(background) % 360
|
|
760
|
+
let startX = x
|
|
761
|
+
let startY = y
|
|
762
|
+
let endX = x + width
|
|
763
|
+
let endY = y + height
|
|
764
|
+
if (angle == 0) {
|
|
765
|
+
startX = x
|
|
766
|
+
startY = y + height
|
|
767
|
+
endX = x
|
|
768
|
+
endY = y
|
|
769
|
+
} else if (angle == 90) {
|
|
770
|
+
startX = x
|
|
771
|
+
startY = y
|
|
772
|
+
endX = x + width
|
|
773
|
+
endY = y
|
|
774
|
+
} else if (angle == 180) {
|
|
775
|
+
startX = x
|
|
776
|
+
startY = y
|
|
777
|
+
endX = x
|
|
778
|
+
endY = y + height
|
|
779
|
+
} else if (angle == 270) {
|
|
780
|
+
startX = x + width
|
|
781
|
+
startY = y
|
|
782
|
+
endX = x
|
|
783
|
+
endY = y
|
|
784
|
+
}
|
|
785
|
+
const gradient = context.createLinearGradient(scaleCanvasValue(startX), scaleCanvasValue(startY), scaleCanvasValue(endX), scaleCanvasValue(endY))
|
|
786
|
+
for (let i = 0; i < stops.length; i++) {
|
|
787
|
+
gradient.addColorStop(stops[i].offset, normalizeCanvasColor(stops[i].color))
|
|
788
|
+
}
|
|
789
|
+
context.fillStyle = gradient
|
|
790
|
+
fillRoundRect(x, y, width, height, radius)
|
|
791
|
+
return true
|
|
792
|
+
}
|
|
793
|
+
|
|
794
|
+
fillSteppedLinearGradient = (background: string, x: number, y: number, width: number, height: number, radius: number, fallback: string): void => {
|
|
795
|
+
const context = ctx.value
|
|
796
|
+
if (context == null) {
|
|
797
|
+
return
|
|
798
|
+
}
|
|
799
|
+
const stops = parseGradientStops(background)
|
|
800
|
+
const angle = gradientAngle(background) % 360
|
|
801
|
+
const horizontal = angle == 90 || angle == 270
|
|
802
|
+
const steps = Math.max(1, Math.floor(horizontal ? width : height))
|
|
803
|
+
for (let i = 0; i < steps; i++) {
|
|
804
|
+
const rawProgress = steps <= 1 ? 0 : i / (steps - 1)
|
|
805
|
+
const progress = angle == 270 || angle == 0 ? 1 - rawProgress : rawProgress
|
|
806
|
+
context.fillStyle = normalizeCanvasColor(gradientColorAt(stops, progress, fallback))
|
|
807
|
+
if (horizontal) {
|
|
808
|
+
context.fillRect(scaleCanvasValue(x + i), scaleCanvasValue(y), scaleCanvasValue(1.5), scaleCanvasValue(height))
|
|
809
|
+
} else {
|
|
810
|
+
context.fillRect(scaleCanvasValue(x), scaleCanvasValue(y + i), scaleCanvasValue(width), scaleCanvasValue(1.5))
|
|
811
|
+
}
|
|
812
|
+
}
|
|
813
|
+
if (radius > 0) {
|
|
814
|
+
clipRadiusMask(x, y, width, height, radius)
|
|
815
|
+
}
|
|
816
|
+
}
|
|
817
|
+
|
|
818
|
+
fillSteppedRadialGradient = (background: string, x: number, y: number, width: number, height: number, radius: number, fallback: string): void => {
|
|
819
|
+
const context = ctx.value
|
|
820
|
+
if (context == null) {
|
|
821
|
+
return
|
|
822
|
+
}
|
|
823
|
+
const stops = parseGradientStops(background)
|
|
824
|
+
const centerX = x + width / 2
|
|
825
|
+
const centerY = y + height / 2
|
|
826
|
+
const maxRadius = Math.max(width, height) / 2
|
|
827
|
+
const steps = Math.max(1, Math.floor(maxRadius))
|
|
828
|
+
for (let i = steps; i >= 0; i--) {
|
|
829
|
+
const progress = steps <= 0 ? 0 : i / steps
|
|
830
|
+
context.fillStyle = normalizeCanvasColor(gradientColorAt(stops, progress, fallback))
|
|
831
|
+
context.beginPath()
|
|
832
|
+
context.arc(scaleCanvasValue(centerX), scaleCanvasValue(centerY), scaleCanvasValue(i), 0, Math.PI * 2)
|
|
833
|
+
context.closePath()
|
|
834
|
+
context.fill()
|
|
835
|
+
}
|
|
836
|
+
if (radius > 0) {
|
|
837
|
+
clipRadiusMask(x, y, width, height, radius)
|
|
838
|
+
}
|
|
839
|
+
}
|
|
840
|
+
|
|
841
|
+
gradientColorAt = (stops: Array<GradientStop>, progress: number, fallback: string): string => {
|
|
842
|
+
if (stops.length == 0) {
|
|
843
|
+
return fallback
|
|
844
|
+
}
|
|
845
|
+
let current = stops[0]
|
|
846
|
+
for (let i = 1; i < stops.length; i++) {
|
|
847
|
+
if (progress <= stops[i].offset) {
|
|
848
|
+
const next = stops[i]
|
|
849
|
+
const span = next.offset - current.offset
|
|
850
|
+
const ratio = span <= 0 ? 0 : (progress - current.offset) / span
|
|
851
|
+
return ratio < 0.5 ? current.color : next.color
|
|
852
|
+
}
|
|
853
|
+
current = stops[i]
|
|
854
|
+
}
|
|
855
|
+
return current.color
|
|
856
|
+
}
|
|
857
|
+
|
|
858
|
+
clipRadiusMask = (x: number, y: number, width: number, height: number, radius: number): void => {
|
|
859
|
+
const context = ctx.value
|
|
860
|
+
if (context == null) {
|
|
861
|
+
return
|
|
862
|
+
}
|
|
863
|
+
context.save()
|
|
864
|
+
context.globalCompositeOperation = 'destination-in'
|
|
865
|
+
context.fillStyle = normalizeCanvasColor('#000000')
|
|
866
|
+
fillRoundRect(x, y, width, height, radius)
|
|
867
|
+
context.restore()
|
|
868
|
+
context.globalCompositeOperation = 'source-over'
|
|
869
|
+
}
|
|
870
|
+
|
|
871
|
+
fillRoundRect = (x: number, y: number, width: number, height: number, radius: number): void => {
|
|
872
|
+
const context = ctx.value
|
|
873
|
+
if (context == null) {
|
|
874
|
+
return
|
|
875
|
+
}
|
|
876
|
+
if (radius <= 0) {
|
|
877
|
+
context.fillRect(scaleCanvasValue(x), scaleCanvasValue(y), scaleCanvasValue(width), scaleCanvasValue(height))
|
|
878
|
+
return
|
|
879
|
+
}
|
|
880
|
+
const r = Math.min(radius, Math.min(width, height) / 2)
|
|
881
|
+
context.beginPath()
|
|
882
|
+
context.moveTo(scaleCanvasValue(x + r), scaleCanvasValue(y))
|
|
883
|
+
context.lineTo(scaleCanvasValue(x + width - r), scaleCanvasValue(y))
|
|
884
|
+
context.quadraticCurveTo(scaleCanvasValue(x + width), scaleCanvasValue(y), scaleCanvasValue(x + width), scaleCanvasValue(y + r))
|
|
885
|
+
context.lineTo(scaleCanvasValue(x + width), scaleCanvasValue(y + height - r))
|
|
886
|
+
context.quadraticCurveTo(scaleCanvasValue(x + width), scaleCanvasValue(y + height), scaleCanvasValue(x + width - r), scaleCanvasValue(y + height))
|
|
887
|
+
context.lineTo(scaleCanvasValue(x + r), scaleCanvasValue(y + height))
|
|
888
|
+
context.quadraticCurveTo(scaleCanvasValue(x), scaleCanvasValue(y + height), scaleCanvasValue(x), scaleCanvasValue(y + height - r))
|
|
889
|
+
context.lineTo(scaleCanvasValue(x), scaleCanvasValue(y + r))
|
|
890
|
+
context.quadraticCurveTo(scaleCanvasValue(x), scaleCanvasValue(y), scaleCanvasValue(x + r), scaleCanvasValue(y))
|
|
891
|
+
context.closePath()
|
|
892
|
+
context.fill()
|
|
893
|
+
}
|
|
894
|
+
|
|
895
|
+
defineExpose({
|
|
896
|
+
canvasId,
|
|
897
|
+
showCanvas,
|
|
898
|
+
canvasWidth,
|
|
899
|
+
canvasHeight,
|
|
900
|
+
canvasContext,
|
|
901
|
+
ctx,
|
|
902
|
+
canvasStyle,
|
|
903
|
+
getJson,
|
|
904
|
+
getPosterCss,
|
|
905
|
+
getViews,
|
|
906
|
+
prepareSize,
|
|
907
|
+
initCanvas,
|
|
908
|
+
exportImage,
|
|
909
|
+
generatePoster,
|
|
910
|
+
drawPoster,
|
|
911
|
+
drawPosterSync,
|
|
912
|
+
drawItems,
|
|
913
|
+
drawItem,
|
|
914
|
+
drawView,
|
|
915
|
+
drawText,
|
|
916
|
+
wrapText,
|
|
917
|
+
drawImageBox,
|
|
918
|
+
drawImageFallback,
|
|
919
|
+
drawQrCode,
|
|
920
|
+
fillBackground,
|
|
921
|
+
fillGradient,
|
|
922
|
+
fillCanvasGradient,
|
|
923
|
+
fillSteppedLinearGradient,
|
|
924
|
+
fillSteppedRadialGradient,
|
|
925
|
+
gradientColorAt,
|
|
926
|
+
clipRadiusMask,
|
|
927
|
+
fillRoundRect
|
|
928
|
+
})
|
|
929
|
+
</script>
|
|
930
|
+
|
|
931
|
+
<style lang="scss" scoped>
|
|
932
|
+
.up-poster {
|
|
933
|
+
position: fixed;
|
|
934
|
+
left: -9999px;
|
|
935
|
+
top: -9999px;
|
|
936
|
+
width: 1px;
|
|
937
|
+
height: 1px;
|
|
938
|
+
overflow: hidden;
|
|
939
|
+
}
|
|
940
|
+
|
|
941
|
+
.up-poster__canvas {
|
|
942
|
+
display: flex;
|
|
943
|
+
}
|
|
944
|
+
</style>
|