├── .editorconfig ├── .eslintignore ├── .eslintrc ├── .gitattributes ├── .gitignore ├── .lintstagedrc.js ├── .prettierignore ├── .prettierrc ├── .stylelintignore ├── .stylelintrc.js ├── .vscode └── settings.json ├── LICENSE ├── README.md ├── commitlint.config.js ├── cz-customizable.config.js ├── examples └── example-weapp │ ├── LICENSE │ ├── README.md │ ├── app.js │ ├── app.json │ ├── app.wxss │ ├── assets │ └── images │ │ └── placeholder.jpeg │ ├── components │ └── page │ │ ├── README.md │ │ ├── index.js │ │ ├── index.json │ │ ├── index.wxml │ │ ├── index.wxs │ │ └── index.wxss │ ├── config.js │ ├── package.json │ ├── pages │ ├── action-sheet │ │ ├── index.js │ │ ├── index.json │ │ ├── index.wxml │ │ └── index.wxss │ ├── back-top │ │ ├── index.js │ │ ├── index.json │ │ ├── index.wxml │ │ └── index.wxss │ ├── badge │ │ ├── index.js │ │ ├── index.json │ │ ├── index.wxml │ │ └── index.wxss │ ├── button │ │ ├── index.js │ │ ├── index.json │ │ ├── index.wxml │ │ └── index.wxss │ ├── calendar │ │ ├── index.js │ │ ├── index.json │ │ ├── index.wxml │ │ ├── index.wxss │ │ ├── month.js │ │ ├── month.json │ │ ├── month.wxml │ │ └── month.wxss │ ├── cascade │ │ ├── city.js │ │ ├── index.js │ │ ├── index.json │ │ ├── index.wxml │ │ └── index.wxss │ ├── cell │ │ ├── index.js │ │ ├── index.json │ │ ├── index.wxml │ │ └── index.wxss │ ├── checkbox │ │ ├── index.js │ │ ├── index.json │ │ ├── index.wxml │ │ └── index.wxss │ ├── collapse │ │ ├── index.js │ │ ├── index.json │ │ ├── index.wxml │ │ └── index.wxss │ ├── countdown │ │ ├── index.js │ │ ├── index.json │ │ ├── index.wxml │ │ ├── index.wxss │ │ └── templates.wxml │ ├── datetime-picker │ │ ├── index.js │ │ ├── index.json │ │ ├── index.wxml │ │ └── index.wxss │ ├── dialog │ │ ├── index.js │ │ ├── index.json │ │ ├── index.wxml │ │ └── index.wxss │ ├── divider │ │ ├── index.js │ │ ├── index.json │ │ ├── index.wxml │ │ └── index.wxss │ ├── dropdown-menu │ │ ├── index.js │ │ ├── index.json │ │ ├── index.wxml │ │ └── index.wxss │ ├── empty │ │ ├── index.js │ │ ├── index.json │ │ ├── index.wxml │ │ └── index.wxss │ ├── grid │ │ ├── index.js │ │ ├── index.json │ │ ├── index.wxml │ │ └── index.wxss │ ├── icon │ │ ├── config.js │ │ ├── icon.js │ │ ├── index.js │ │ ├── index.json │ │ ├── index.wxml │ │ └── index.wxss │ ├── image │ │ ├── index.js │ │ ├── index.json │ │ ├── index.wxml │ │ └── index.wxss │ ├── input-number │ │ ├── index.js │ │ ├── index.json │ │ ├── index.wxml │ │ └── index.wxss │ ├── input │ │ ├── index.js │ │ ├── index.json │ │ ├── index.wxml │ │ └── index.wxss │ ├── layout │ │ ├── index.js │ │ ├── index.json │ │ ├── index.wxml │ │ └── index.wxss │ ├── loading │ │ ├── index.js │ │ ├── index.json │ │ ├── index.wxml │ │ └── index.wxss │ ├── navbar │ │ ├── index.js │ │ ├── index.json │ │ └── index.wxml │ ├── notice-bar │ │ ├── index.js │ │ ├── index.json │ │ ├── index.wxml │ │ └── index.wxss │ ├── picker │ │ ├── city.js │ │ ├── cityConfig.js │ │ ├── config.js │ │ ├── index.js │ │ ├── index.json │ │ ├── index.wxml │ │ ├── index.wxs │ │ ├── index.wxss │ │ ├── page.js │ │ ├── page.json │ │ ├── page.wxml │ │ ├── page.wxss │ │ ├── picker.js │ │ ├── picker.json │ │ ├── picker.wxml │ │ ├── picker.wxss │ │ ├── simple.js │ │ ├── simple.json │ │ ├── simple.wxml │ │ └── simple.wxss │ ├── popup-titlebar │ │ ├── index.js │ │ ├── index.json │ │ ├── index.wxml │ │ └── index.wxss │ ├── popup │ │ ├── index.js │ │ ├── index.json │ │ ├── index.wxml │ │ └── index.wxss │ ├── preview │ │ ├── index.js │ │ ├── index.json │ │ ├── index.wxml │ │ └── index.wxss │ ├── price │ │ ├── index.js │ │ ├── index.json │ │ ├── index.wxml │ │ └── index.wxss │ ├── product-detail │ │ ├── index.js │ │ ├── index.json │ │ ├── index.wxml │ │ └── index.wxss │ ├── progress │ │ ├── index.js │ │ ├── index.json │ │ ├── index.wxml │ │ └── index.wxss │ ├── radio │ │ ├── index.js │ │ ├── index.json │ │ ├── index.wxml │ │ └── index.wxss │ ├── rate │ │ ├── index.js │ │ ├── index.json │ │ ├── index.wxml │ │ └── index.wxss │ ├── root │ │ ├── index.js │ │ ├── index.json │ │ ├── index.wxml │ │ └── index.wxss │ ├── search │ │ ├── index.js │ │ ├── index.json │ │ ├── index.wxml │ │ └── index.wxss │ ├── share-sheet │ │ ├── index.js │ │ ├── index.json │ │ ├── index.wxml │ │ └── index.wxss │ ├── sidebar │ │ ├── index.js │ │ ├── index.json │ │ ├── index.wxml │ │ └── index.wxss │ ├── sku │ │ ├── index.js │ │ ├── index.json │ │ ├── index.wxml │ │ ├── index.wxss │ │ └── mockData.js │ ├── slider │ │ ├── index.js │ │ ├── index.json │ │ ├── index.wxml │ │ └── index.wxss │ ├── steps │ │ ├── index.js │ │ ├── index.json │ │ ├── index.wxml │ │ └── index.wxss │ ├── sticky │ │ ├── index.js │ │ ├── index.json │ │ ├── index.wxml │ │ └── index.wxss │ ├── swipe-cell │ │ ├── index.js │ │ ├── index.json │ │ ├── index.wxml │ │ └── index.wxss │ ├── switch │ │ ├── index.js │ │ ├── index.json │ │ ├── index.wxml │ │ └── index.wxss │ ├── tabbar │ │ ├── index.js │ │ ├── index.json │ │ ├── index.wxml │ │ └── index.wxss │ ├── tabs │ │ ├── index.js │ │ ├── index.json │ │ ├── index.wxml │ │ └── index.wxss │ ├── tag │ │ ├── index.js │ │ ├── index.json │ │ ├── index.wxml │ │ └── index.wxss │ ├── textarea │ │ ├── index.js │ │ ├── index.json │ │ ├── index.wxml │ │ └── index.wxss │ ├── toast │ │ ├── index.js │ │ ├── index.json │ │ ├── index.wxml │ │ └── index.wxss │ ├── tooltip │ │ ├── index.js │ │ ├── index.json │ │ ├── index.wxml │ │ └── index.wxss │ ├── transition │ │ ├── index.js │ │ ├── index.json │ │ ├── index.wxml │ │ └── index.wxss │ ├── tree-select │ │ ├── index.js │ │ ├── index.json │ │ ├── index.wxml │ │ └── index.wxss │ └── uploader │ │ ├── index.js │ │ ├── index.json │ │ ├── index.wxml │ │ └── index.wxss │ ├── private.key │ ├── project.config.json │ ├── sitemap.json │ └── util │ └── index.js ├── jest.config.js ├── package.json ├── packages ├── compiler │ ├── CHANGELOG.md │ ├── LICENSE │ ├── README.md │ ├── lib │ │ ├── BasicCompiler.js │ │ └── index.js │ ├── package.json │ ├── plugins │ │ ├── esbuild-plugin-copy-files.js │ │ ├── esbuild-plugin-postcss-less.js │ │ ├── esbuild-plugin-swc.js │ │ ├── esbuild-plugin-time.js │ │ └── index.js │ ├── pnpm-lock.yaml │ └── postcss.config.js ├── prettier-plugin-wxml │ ├── CHANGELOG.md │ ├── LICENSE │ ├── README.md │ ├── __test__ │ │ ├── __snapshots__ │ │ │ └── prettier-plugin-wxml.test.js.snap │ │ └── prettier-plugin-wxml.test.js │ ├── lib │ │ ├── index.js │ │ └── parser.js │ └── package.json ├── titian-snippets │ ├── .gitattributes │ ├── .gitignore │ ├── .vscodeignore │ ├── CHANGELOG.md │ ├── LICENSE │ ├── README.md │ ├── images │ │ ├── logo.png │ │ └── titian.gif │ ├── package.json │ └── snippets │ │ ├── titian-js.json │ │ └── titian-wxml.json └── weapp │ ├── CHANGELOG.md │ ├── LICENSE │ ├── README.md │ ├── package.json │ └── src │ ├── action-sheet │ ├── __test__ │ │ ├── __snapshots__ │ │ │ └── action-sheet.test.js.snap │ │ └── action-sheet.test.js │ ├── index.json │ ├── index.less │ ├── index.ts │ └── index.wxml │ ├── back-top │ ├── __test__ │ │ ├── __snapshots__ │ │ │ └── backTop.test.js.snap │ │ └── backTop.test.js │ ├── index.json │ ├── index.less │ ├── index.ts │ ├── index.wxml │ └── index.wxs │ ├── badge │ ├── __test__ │ │ ├── __snapshots__ │ │ │ └── badge.test.js.snap │ │ └── badge.test.js │ ├── index.json │ ├── index.less │ ├── index.ts │ ├── index.wxml │ └── index.wxs │ ├── behaviors │ ├── __test__ │ │ ├── __snapshots__ │ │ │ ├── link.test.js.snap │ │ │ └── transition.test.js.snap │ │ ├── link.test.js │ │ └── transition.test.js │ ├── choose.ts │ ├── color.ts │ ├── link.ts │ ├── open-type.ts │ ├── transition.ts │ └── uploader.ts │ ├── button │ ├── __test__ │ │ ├── __snapshots__ │ │ │ └── button.test.js.snap │ │ └── button.test.js │ ├── const.ts │ ├── index.json │ ├── index.less │ ├── index.ts │ ├── index.wxml │ └── index.wxs │ ├── calendar │ ├── __test__ │ │ ├── calendar.test.js │ │ └── mock │ │ │ └── index.js │ ├── calc.ts │ ├── calendar.ts │ ├── const.ts │ ├── index.json │ ├── index.less │ ├── index.ts │ ├── index.wxml │ ├── index.wxs │ ├── multiple.ts │ ├── range.ts │ ├── single.ts │ └── utils.ts │ ├── cascade │ ├── cascade.ts │ ├── index.json │ ├── index.less │ ├── index.ts │ ├── index.wxml │ └── index.wxs │ ├── cell-group │ ├── __test__ │ │ ├── __snapshots__ │ │ │ └── cell-group.test.js.snap │ │ └── cell-group.test.js │ ├── index.json │ ├── index.less │ ├── index.ts │ └── index.wxml │ ├── cell │ ├── __test__ │ │ ├── __snapshots__ │ │ │ └── cell.test.js.snap │ │ └── cell.test.js │ ├── index.json │ ├── index.less │ ├── index.ts │ ├── index.wxml │ └── index.wxs │ ├── checkbox-button │ ├── index.json │ ├── index.less │ ├── index.ts │ └── index.wxml │ ├── checkbox-group │ ├── __test__ │ │ ├── __snapshots__ │ │ │ └── checkbox-group.test.js.snap │ │ └── checkbox-group.test.js │ ├── index.json │ ├── index.less │ ├── index.ts │ └── index.wxml │ ├── checkbox │ ├── __test__ │ │ ├── __snapshots__ │ │ │ └── checkbox.test.js.snap │ │ └── checkbox.test.js │ ├── index.json │ ├── index.less │ ├── index.ts │ ├── index.wxml │ └── index.wxs │ ├── circle-progress │ ├── __test__ │ │ ├── __snapshots__ │ │ │ └── circle-progress.test.js.snap │ │ └── circle-progress.test.js │ ├── index.json │ ├── index.less │ ├── index.ts │ ├── index.wxml │ └── index.wxs │ ├── col │ ├── __test__ │ │ ├── __snapshots__ │ │ │ └── col.test.js.snap │ │ └── col.test.js │ ├── index.json │ ├── index.less │ ├── index.ts │ ├── index.wxml │ └── index.wxs │ ├── collapse-item │ ├── index.json │ ├── index.less │ ├── index.ts │ ├── index.wxml │ └── index.wxs │ ├── collapse │ ├── __test__ │ │ ├── __snapshots__ │ │ │ └── collapse.test.js.snap │ │ ├── collapse.test.js │ │ └── mock │ │ │ └── index.js │ ├── index.json │ ├── index.ts │ └── index.wxml │ ├── common │ ├── basic │ │ ├── BasicComponent.ts │ │ └── relations.ts │ ├── interface │ │ ├── BasicComponentOptions.ts │ │ ├── index.ts │ │ └── uploader.ts │ ├── static │ │ ├── mixins │ │ │ ├── clearfix.less │ │ │ ├── ellipsis.less │ │ │ ├── expand-click.less │ │ │ ├── hairline.less │ │ │ ├── index.less │ │ │ └── position.less │ │ ├── utils.less │ │ └── var.less │ ├── test │ │ ├── getBehavior.js │ │ └── getComponent.ts │ └── utils │ │ ├── __test__ │ │ └── index.test.js │ │ ├── color.ts │ │ ├── index.ts │ │ ├── modal.ts │ │ ├── number.ts │ │ ├── version.ts │ │ ├── wxs │ │ ├── __test__ │ │ │ └── namespace.test.js │ │ ├── borderRadius.wxs │ │ ├── convertStyles.wxs │ │ ├── index.wxs │ │ ├── namespace.wxs │ │ ├── suffix.wxs │ │ └── wxUtils.wxs │ │ └── zIndexTool.ts │ ├── countdown │ ├── index.json │ ├── index.less │ ├── index.ts │ ├── index.wxml │ ├── index.wxs │ └── utils.ts │ ├── datetime-picker │ ├── __test__ │ │ ├── __snapshots__ │ │ │ └── datetime-picker.test.js.snap │ │ ├── datetime-picker.test.js │ │ └── mock │ │ │ └── index.js │ ├── index.json │ ├── index.less │ ├── index.ts │ ├── index.wxml │ └── utils.ts │ ├── dialog │ ├── index.json │ ├── index.less │ ├── index.ts │ ├── index.wxml │ └── types.ts │ ├── divider │ ├── const.ts │ ├── index.json │ ├── index.less │ ├── index.ts │ ├── index.wxml │ └── index.wxs │ ├── dropdown-item │ ├── __test__ │ │ ├── __snapshots__ │ │ │ └── dropdown-item.test.js.snap │ │ ├── dropdown-item.test.js │ │ ├── index.js │ │ ├── index.json │ │ └── index.wxml │ ├── index.json │ ├── index.less │ ├── index.ts │ ├── index.wxml │ └── index.wxs │ ├── dropdown-menu │ ├── __test__ │ │ ├── __snapshots__ │ │ │ └── dropdown-menu.test.js.snap │ │ └── dropdown-menu.test.js │ ├── index.json │ ├── index.less │ ├── index.ts │ ├── index.wxml │ └── index.wxs │ ├── empty │ ├── __test__ │ │ ├── __snapshots__ │ │ │ └── empty.test.js.snap │ │ └── empty.test.js │ ├── index.json │ ├── index.less │ ├── index.ts │ └── index.wxml │ ├── goods-card │ ├── index.json │ ├── index.less │ ├── index.ts │ ├── index.wxml │ └── index.wxs │ ├── grid-item │ ├── __test__ │ │ ├── __snapshots__ │ │ │ └── grid-item.test.js.snap │ │ └── grid-item.test.js │ ├── index.json │ ├── index.less │ ├── index.ts │ ├── index.wxml │ └── index.wxs │ ├── grid │ ├── __test__ │ │ ├── __snapshots__ │ │ │ └── grid.test.js.snap │ │ ├── grid.test.js │ │ ├── index.js │ │ ├── index.json │ │ └── index.wxml │ ├── index.json │ ├── index.less │ ├── index.ts │ ├── index.wxml │ └── index.wxs │ ├── icon │ ├── __test__ │ │ ├── __snapshots__ │ │ │ └── icon.test.js.snap │ │ └── icon.test.js │ ├── index.json │ ├── index.less │ ├── index.ts │ ├── index.wxml │ └── index.wxs │ ├── image │ ├── index.json │ ├── index.less │ ├── index.ts │ ├── index.wxml │ └── index.wxs │ ├── index.ts │ ├── input-number │ ├── index.json │ ├── index.less │ ├── index.ts │ ├── index.wxml │ └── index.wxs │ ├── input │ ├── index.json │ ├── index.less │ ├── index.ts │ └── index.wxml │ ├── loading │ ├── __test__ │ │ ├── __snapshots__ │ │ │ └── loading.test.js.snap │ │ └── loading.test.js │ ├── index.json │ ├── index.less │ ├── index.ts │ ├── index.wxml │ └── index.wxs │ ├── navbar │ ├── index.json │ ├── index.less │ ├── index.ts │ ├── index.wxml │ └── index.wxs │ ├── notice-bar │ ├── index.json │ ├── index.less │ ├── index.ts │ ├── index.wxml │ └── index.wxs │ ├── picker-column │ ├── index.json │ ├── index.less │ ├── index.ts │ ├── index.wxml │ └── index.wxs │ ├── picker │ ├── __test__ │ │ ├── __snapshots__ │ │ │ └── picker.test.js.snap │ │ ├── mock │ │ │ ├── cascade.js │ │ │ └── index.js │ │ └── picker.test.js │ ├── column.ts │ ├── const.ts │ ├── index.json │ ├── index.less │ ├── index.ts │ ├── index.wxml │ ├── index.wxs │ └── picker.ts │ ├── popup-title-bar │ ├── const.ts │ ├── index.json │ ├── index.less │ ├── index.ts │ ├── index.wxml │ └── index.wxs │ ├── popup │ ├── const.ts │ ├── index.json │ ├── index.less │ ├── index.ts │ ├── index.wxml │ └── index.wxs │ ├── preview │ ├── index.json │ ├── index.less │ ├── index.ts │ └── index.wxml │ ├── price │ ├── index.json │ ├── index.less │ ├── index.ts │ └── index.wxml │ ├── progress │ ├── __test__ │ │ ├── __snapshots__ │ │ │ └── progress.test.js.snap │ │ └── progress.test.js │ ├── index.json │ ├── index.less │ ├── index.ts │ ├── index.wxml │ └── index.wxs │ ├── radio-button │ ├── index.json │ ├── index.less │ ├── index.ts │ └── index.wxml │ ├── radio-group │ ├── __test__ │ │ ├── __snapshots__ │ │ │ └── radio-group.test.js.snap │ │ ├── index.js │ │ ├── index.json │ │ ├── index.wxml │ │ └── radio-group.test.js │ ├── index.json │ ├── index.less │ ├── index.ts │ └── index.wxml │ ├── radio │ ├── __test__ │ │ ├── __snapshots__ │ │ │ └── radio.test.js.snap │ │ └── radio.test.js │ ├── index.json │ ├── index.less │ ├── index.ts │ ├── index.wxml │ └── index.wxs │ ├── rate │ ├── index.json │ ├── index.less │ ├── index.ts │ ├── index.wxml │ └── index.wxs │ ├── row │ ├── __test__ │ │ ├── __snapshots__ │ │ │ └── row.test.js.snap │ │ └── row.test.js │ ├── index.json │ ├── index.less │ ├── index.ts │ ├── index.wxml │ └── index.wxs │ ├── safe-area │ ├── const.ts │ ├── index.json │ ├── index.less │ ├── index.ts │ └── index.wxml │ ├── search │ ├── index.json │ ├── index.less │ ├── index.ts │ └── index.wxml │ ├── share-sheet │ ├── __test__ │ │ ├── __snapshots__ │ │ │ └── share-sheet.test.js.snap │ │ └── share-sheet.test.js │ ├── index.json │ ├── index.less │ ├── index.ts │ ├── index.wxml │ └── index.wxs │ ├── sidebar-item │ ├── index.json │ ├── index.less │ ├── index.ts │ ├── index.wxml │ └── index.wxs │ ├── sidebar │ ├── index.json │ ├── index.less │ ├── index.ts │ └── index.wxml │ ├── sku-selector │ ├── graph.ts │ ├── index.json │ ├── index.less │ ├── index.ts │ └── index.wxml │ ├── sku │ ├── index.json │ ├── index.less │ ├── index.ts │ └── index.wxml │ ├── slider │ ├── index.json │ ├── index.less │ ├── index.ts │ └── index.wxml │ ├── step-item │ ├── index.json │ ├── index.less │ ├── index.ts │ ├── index.wxml │ └── index.wxs │ ├── steps │ ├── index.json │ ├── index.ts │ ├── index.wxml │ └── index.wxs │ ├── sticky │ ├── index.json │ ├── index.less │ ├── index.ts │ ├── index.wxml │ └── index.wxs │ ├── svg-path-view │ ├── __test__ │ │ ├── __snapshots__ │ │ │ └── svg-path-view.test.js.snap │ │ └── svg-path-view.test.js │ ├── index.json │ ├── index.less │ ├── index.ts │ ├── index.wxml │ └── index.wxs │ ├── swipe-cell │ ├── __test__ │ │ ├── __snapshots__ │ │ │ └── swipe-cell.test.js.snap │ │ └── swipe-cell.test.js │ ├── index.json │ ├── index.less │ ├── index.ts │ └── index.wxml │ ├── switch │ ├── __test__ │ │ ├── __snapshots__ │ │ │ └── swipe-cell.test.js.snap │ │ └── swipe-cell.test.js │ ├── index.json │ ├── index.less │ ├── index.ts │ ├── index.wxml │ ├── index.wxs │ └── switch.wxs │ ├── tabbar-item │ ├── index.json │ ├── index.less │ ├── index.ts │ ├── index.wxml │ └── index.wxs │ ├── tabbar │ ├── __test__ │ │ ├── mock │ │ │ └── index.js │ │ └── tabbar.test.js │ ├── index.json │ ├── index.less │ ├── index.ts │ ├── index.wxml │ └── index.wxs │ ├── tabs │ ├── index.json │ ├── index.less │ ├── index.ts │ ├── index.wxml │ └── index.wxs │ ├── tag │ ├── const.ts │ ├── index.json │ ├── index.less │ ├── index.ts │ └── index.wxml │ ├── textarea │ ├── index.json │ ├── index.less │ ├── index.ts │ └── index.wxml │ ├── title-bar │ ├── index.json │ ├── index.less │ ├── index.ts │ └── index.wxml │ ├── toast │ ├── const.ts │ ├── index.json │ ├── index.less │ ├── index.ts │ └── index.wxml │ ├── tooltip │ ├── __test__ │ │ ├── __snapshots__ │ │ │ └── tooltip.test.js.snap │ │ └── tooltip.test.js │ ├── index.json │ ├── index.less │ ├── index.ts │ ├── index.wxml │ └── index.wxs │ ├── transition │ ├── __test__ │ │ ├── __snapshots__ │ │ │ └── transition.test.js.snap │ │ └── transition.test.js │ ├── index.json │ ├── index.less │ ├── index.ts │ ├── index.wxml │ └── index.wxs │ ├── tree-select │ ├── index.json │ ├── index.less │ ├── index.ts │ ├── index.wxml │ └── index.wxs │ └── uploader │ ├── __test__ │ ├── __snapshots__ │ │ └── uploader.test.js.snap │ ├── mock │ │ └── index.js │ └── uploader.test.js │ ├── index.json │ ├── index.less │ ├── index.ts │ ├── index.wxml │ └── index.wxs ├── pnpm-lock.yaml ├── pnpm-workspace.yaml ├── tasks ├── addHoverClass.js ├── config.js ├── watchWxOutput.js └── webhook.js ├── test ├── global.d.ts └── setupJest.ts ├── titian.config.js └── tsconfig.json /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | charset = utf-8 5 | end_of_line = lf # 换行符 cr,crlf,lf,unset 6 | trim_trailing_whitespace = true # 去除多余的空格 7 | insert_final_newline = true # 在尾部插入一行 8 | indent_style = space # 缩进方式 tab,space,unset 9 | indent_size = 2 # 缩进大小 10 | 11 | -------------------------------------------------------------------------------- /.eslintignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | miniprogram_npm/ 3 | packages/weapp/esm/* 4 | packages/weapp/dist-titan/* 5 | packages/weapp/esm-titan/* 6 | *.lock 7 | .husky/* 8 | .vscode/* 9 | *.d.ts 10 | *.wxs 11 | examples/example-weapp/dist/ 12 | packages/compiler/ 13 | packages/prettier-plugin-wxml/ -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | * text eol=lf 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/ignore-files/ for more about ignoring files. 2 | 3 | # Dependencies 4 | node_modules/ 5 | 6 | # Test coverage 7 | coverage 8 | .nyc_output 9 | 10 | # Logs 11 | npm-debug.log* 12 | yarn-debug.log* 13 | yarn-error.log* 14 | logs/* 15 | 16 | # Editors and IDEs 17 | .idea 18 | .history 19 | .vscode/* 20 | !.vscode/settings.json 21 | !.vscode/tasks.json 22 | !.vscode/launch.json 23 | !.vscode/extensions.json 24 | .history 25 | 26 | # Misc 27 | .DS_Store 28 | package-lock.json 29 | 30 | .eslintcache 31 | 32 | lerna-debug.log 33 | 34 | cjs 35 | esm 36 | types 37 | 38 | # weapp-example 39 | miniprogram_npm 40 | project.private.config.json 41 | 42 | # vue press 43 | .temp 44 | .cache 45 | docs/components 46 | docs/.vuepress/dist 47 | website 48 | *.zip 49 | *.7z 50 | packages/weapp/dist-titan/* 51 | packages/weapp/esm-titan/* 52 | 53 | # local env files 54 | .env*.local 55 | 56 | examples/example-weapp/dist -------------------------------------------------------------------------------- /.lintstagedrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | '!(.)*.{js,jsx,ts,tsx}': ['eslint --fix', 'prettier --write'], 3 | '*.{css,less,scss,wxss}': ['stylelint --fix', 'prettier --write'], 4 | '*.{md,wxs}': ['prettier --write'] 5 | }; 6 | -------------------------------------------------------------------------------- /.prettierignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | miniprogram_npm 3 | packages/weapp/esm/* 4 | packages/weapp/dist-titan/* 5 | packages/weapp/types/* 6 | *.lock 7 | .husky/* 8 | .vscode/* 9 | .idea/* 10 | coverage 11 | *.test.js.snap 12 | packages/weapp/src/input/index.wxml 13 | packages/weapp/src/input-number/index.wxml 14 | packages/weapp/src/button/index.wxml 15 | packages/weapp/src/steps/index.wxml 16 | -------------------------------------------------------------------------------- /.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "printWidth": 120, 3 | "singleQuote": true, 4 | "semi": true, 5 | "trailingComma": "none", 6 | "bracketSpacing": true, 7 | "overrides": [ 8 | { 9 | "files": "*.wxml", 10 | "options": { 11 | "parser": "wxml" 12 | } 13 | }, 14 | { 15 | "files": "*.wxss", 16 | "options": { 17 | "parser": "css" 18 | } 19 | } 20 | ], 21 | "htmlWhitespaceSensitivity": "ignore", 22 | "tabWidth": 2, 23 | "plugins": ["./node_modules/@titian-design/prettier-plugin-wxml/lib/index.js"] 24 | } 25 | -------------------------------------------------------------------------------- /.stylelintignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | packages/alipay/* 3 | packages/taro/* 4 | packages/weapp/esm/* 5 | packages/weapp/dist-titan/* 6 | packages/weapp/example/components/* 7 | *.lock 8 | .husky/* 9 | .vscode/* 10 | .* 11 | 12 | 13 | examples/example-weapp/dist/ 14 | packages/compiler/ 15 | packages/prettier-plugin-wxml/ -------------------------------------------------------------------------------- /.stylelintrc.js: -------------------------------------------------------------------------------- 1 | const sortOrderSmacss = require('stylelint-config-property-sort-order-smacss/generate'); 2 | 3 | module.exports = { 4 | customSyntax: 'postcss-less', 5 | extends: ['stylelint-config-standard', 'stylelint-config-prettier'], 6 | plugins: ['stylelint-order'], 7 | rules: { 8 | 'declaration-empty-line-before': null, 9 | // 'max-nesting-depth': [2, {}], // 此规则不适用于less, 因为less中的嵌套层级没有限制, 只适用于css 10 | 'at-rule-no-unknown': null, 11 | 'order/properties-order': [ 12 | sortOrderSmacss({ 13 | emptyLineBefore: 'always', 14 | noEmptyLineBetween: true 15 | }) 16 | ], 17 | 'font-family-no-missing-generic-family-keyword': null, 18 | 'unit-no-unknown': [ 19 | true, 20 | { 21 | ignoreUnits: ['rpx'] 22 | } 23 | ], 24 | 'no-duplicate-selectors': null, 25 | 'value-no-vendor-prefix': null, 26 | 'color-function-notation': 'legacy' 27 | } 28 | }; 29 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | Copyright © 2022 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 5 | 6 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 7 | 8 | THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 9 | 10 | 11 | -------------------------------------------------------------------------------- /commitlint.config.js: -------------------------------------------------------------------------------- 1 | // eslint-disable-next-line @typescript-eslint/no-var-requires 2 | const typeEnum = require('./cz-customizable.config'); 3 | 4 | /** 5 | * @see https://commitlint.js.org/ 6 | * @see https://juejin.cn/post/6979054290526535717 7 | * 默认 @commitlint/config-conventional 约束规则 && 自定义约束规则 8 | * 约束调用方 @commitlint/cli 9 | */ 10 | module.exports = { 11 | extends: ['@commitlint/config-conventional'], 12 | rules: { 13 | // feat ... 14 | 'type-enum': [2, 'always', typeEnum.types.map((i) => i.value)], 15 | // 单词格式 16 | 'type-case': [0, 'always', 'lower-case'], 17 | 'subject-max-length': [2, 'always', typeEnum.subjectLimit] 18 | } 19 | }; 20 | -------------------------------------------------------------------------------- /examples/example-weapp/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | Copyright © 2022 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 5 | 6 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 7 | 8 | THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 9 | 10 | 11 | -------------------------------------------------------------------------------- /examples/example-weapp/README.md: -------------------------------------------------------------------------------- 1 | ### 安装依赖 2 | 3 | > 不能使用 yarn 4 | 5 | ```bash 6 | npm install 7 | ``` 8 | 9 | ### 启动 10 | 11 | 1. 用 `微信开发者工具` 打开此示例 12 | 2. 工具选择 `构建 npm` 既可预览 13 | -------------------------------------------------------------------------------- /examples/example-weapp/app.js: -------------------------------------------------------------------------------- 1 | // app.js 2 | App({ 3 | onLaunch() { 4 | // 展示本地存储能力 5 | const logs = wx.getStorageSync('logs') || []; 6 | logs.unshift(Date.now()); 7 | wx.setStorageSync('logs', logs); 8 | 9 | // 登录 10 | wx.login({ 11 | success: (res) => { 12 | // 发送 res.code 到后台换取 openId, sessionKey, unionId 13 | } 14 | }); 15 | // 获取设备信息 16 | wx.getSystemInfo({ 17 | success(res) { 18 | console.log(res); 19 | // if (['ios', 'mac'].includes(res.platform)) { 20 | // } 21 | } 22 | }); 23 | }, 24 | globalData: { 25 | userInfo: null 26 | } 27 | }); 28 | -------------------------------------------------------------------------------- /examples/example-weapp/assets/images/placeholder.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weimob-tech/titian-weapp/d4f0f8b901e09177803e49da10e76a3a056d4b23/examples/example-weapp/assets/images/placeholder.jpeg -------------------------------------------------------------------------------- /examples/example-weapp/components/page/index.json: -------------------------------------------------------------------------------- 1 | { 2 | "component": true, 3 | "usingComponents": {} 4 | } 5 | -------------------------------------------------------------------------------- /examples/example-weapp/components/page/index.wxs: -------------------------------------------------------------------------------- 1 | function computedScrollLeft(item) { 2 | var itemWidth = 140; 3 | var itemGap = 12; 4 | return (itemWidth + itemGap) * (item.currentIndex - 1) + 'rpx'; 5 | } 6 | module.exports = { 7 | computedScrollLeft: computedScrollLeft 8 | }; 9 | -------------------------------------------------------------------------------- /examples/example-weapp/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "example-weapp", 3 | "version": "1.0.0", 4 | "private": true, 5 | "description": "", 6 | "keywords": [], 7 | "license": "MIT", 8 | "author": "", 9 | "main": ".eslintrc.js", 10 | "scripts": { 11 | "test": "echo \"Error: no test specified\" && exit 1" 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /examples/example-weapp/pages/action-sheet/index.json: -------------------------------------------------------------------------------- 1 | { 2 | "navigationBarTitleText": "上拉菜单" 3 | } 4 | -------------------------------------------------------------------------------- /examples/example-weapp/pages/action-sheet/index.wxml: -------------------------------------------------------------------------------- 1 | 2 | 点击演示 3 | 4 | 14 | 15 | -------------------------------------------------------------------------------- /examples/example-weapp/pages/action-sheet/index.wxss: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weimob-tech/titian-weapp/d4f0f8b901e09177803e49da10e76a3a056d4b23/examples/example-weapp/pages/action-sheet/index.wxss -------------------------------------------------------------------------------- /examples/example-weapp/pages/back-top/index.js: -------------------------------------------------------------------------------- 1 | Page({ 2 | data: { 3 | list: Array(20).fill(1), 4 | options: [ 5 | { 6 | type: 'radio', 7 | desc: '模式', 8 | key: 'mode', 9 | name: 'Mode', 10 | value: true, 11 | list: [ 12 | { 13 | label: '图标', 14 | value: true 15 | }, 16 | { 17 | label: '图文', 18 | value: false, 19 | attr: { text: '顶部' } 20 | } 21 | ] 22 | } 23 | ], 24 | attrs: {} 25 | }, 26 | onChange(e) { 27 | const { detail } = e; 28 | this.setData({ 29 | attrs: { visibilityHeight: 100, duration: 450, ...detail } 30 | }); 31 | }, 32 | onShareAppMessage() { 33 | return { 34 | title: 'Back Top 回到顶部', 35 | path: 'pages/back-top/index' 36 | }; 37 | } 38 | }); 39 | -------------------------------------------------------------------------------- /examples/example-weapp/pages/back-top/index.json: -------------------------------------------------------------------------------- 1 | { 2 | "usingComponents": {} 3 | } 4 | -------------------------------------------------------------------------------- /examples/example-weapp/pages/back-top/index.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 13 | {{ attrs.text }} 14 | 15 | -------------------------------------------------------------------------------- /examples/example-weapp/pages/back-top/index.wxss: -------------------------------------------------------------------------------- 1 | .section { 2 | display: flex; 3 | align-items: center; 4 | justify-content: center; 5 | height: 200rpx; 6 | 7 | border-bottom: 1px solid #ccc; 8 | 9 | background-color: #fff; 10 | } 11 | 12 | .menu { 13 | height: auto; 14 | } 15 | 16 | .footer { 17 | padding-bottom: 0; 18 | } 19 | -------------------------------------------------------------------------------- /examples/example-weapp/pages/badge/index.json: -------------------------------------------------------------------------------- 1 | { 2 | "navigationBarTitleText": "徽标" 3 | } 4 | -------------------------------------------------------------------------------- /examples/example-weapp/pages/badge/index.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 11 | Title Text 12 | 13 | 14 | 15 | 22 | Icon 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /examples/example-weapp/pages/badge/index.wxss: -------------------------------------------------------------------------------- 1 | .text { 2 | display: inline-block; 3 | position: relative; 4 | 5 | background: #f2f2f2; 6 | 7 | font-size: 28px; 8 | line-height: 34px; 9 | } 10 | 11 | .box { 12 | margin: 20px; 13 | } 14 | 15 | .badge-box { 16 | display: flex; 17 | align-items: center; 18 | justify-content: center; 19 | width: 64rpx; 20 | height: 64rpx; 21 | 22 | border-radius: 12rpx; 23 | 24 | background: #f2f2f2; 25 | 26 | color: #212121; 27 | font-family: PingFangSC-Medium, 'PingFang SC'; 28 | font-size: 18rpx; 29 | font-weight: 500; 30 | } 31 | -------------------------------------------------------------------------------- /examples/example-weapp/pages/button/index.json: -------------------------------------------------------------------------------- 1 | { 2 | "navigationBarTitleText": "按钮" 3 | } 4 | -------------------------------------------------------------------------------- /examples/example-weapp/pages/button/index.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 16 | {{ attrs.text }} 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /examples/example-weapp/pages/button/index.wxss: -------------------------------------------------------------------------------- 1 | .container { 2 | overflow: visible; 3 | 4 | border-radius: 0; 5 | 6 | background-color: transparent; 7 | 8 | text-align: center; 9 | } 10 | -------------------------------------------------------------------------------- /examples/example-weapp/pages/calendar/index.json: -------------------------------------------------------------------------------- 1 | { 2 | "navigationBarTitleText": "日历" 3 | } 4 | -------------------------------------------------------------------------------- /examples/example-weapp/pages/calendar/index.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 点击演示 5 | 6 | 7 | 8 | 9 | 17 | 18 | -------------------------------------------------------------------------------- /examples/example-weapp/pages/calendar/index.wxss: -------------------------------------------------------------------------------- 1 | .calendar { 2 | /* --calendar-date-text-select-color: #ccc; 3 | --calendar-popup-radius: 50%; */ 4 | } 5 | -------------------------------------------------------------------------------- /examples/example-weapp/pages/calendar/month.json: -------------------------------------------------------------------------------- 1 | { 2 | "usingComponents": {} 3 | } 4 | -------------------------------------------------------------------------------- /examples/example-weapp/pages/cascade/index.json: -------------------------------------------------------------------------------- 1 | { 2 | "navigationBarTitleText": "级联组件" 3 | } 4 | -------------------------------------------------------------------------------- /examples/example-weapp/pages/cascade/index.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 点击演示 5 | 6 | 7 | 8 | 9 | 10 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /examples/example-weapp/pages/cascade/index.wxss: -------------------------------------------------------------------------------- 1 | /* pages/transition/index.wxss */ 2 | .custom-container { 3 | display: flex; 4 | position: fixed; 5 | top: 50%; 6 | align-items: center; 7 | justify-content: center; 8 | width: 100%; 9 | height: 50vh; 10 | } 11 | 12 | .container-show { 13 | z-index: 1000; 14 | } 15 | 16 | .wrap { 17 | display: flex; 18 | position: relative; 19 | z-index: 10; 20 | flex-wrap: wrap; 21 | align-items: center; 22 | } 23 | 24 | .btn-item { 25 | width: 40vw; 26 | margin: 20rpx 5vw; 27 | 28 | font-size: 28rpx; 29 | } 30 | 31 | .placeholder { 32 | width: 100px; 33 | height: 100px; 34 | 35 | background-color: #fa2c19; 36 | } 37 | -------------------------------------------------------------------------------- /examples/example-weapp/pages/cell/index.json: -------------------------------------------------------------------------------- 1 | { 2 | "navigationBarTitleText": "单元格" 3 | } 4 | -------------------------------------------------------------------------------- /examples/example-weapp/pages/cell/index.wxss: -------------------------------------------------------------------------------- 1 | .slot-desc { 2 | display: flex; 3 | align-items: center; 4 | 5 | font-size: 24rpx; 6 | font-weight: 500; 7 | } 8 | 9 | .container { 10 | --checkbox-padding-h: 0; 11 | } 12 | 13 | .desc-content { 14 | max-height: 42rpx; 15 | } 16 | -------------------------------------------------------------------------------- /examples/example-weapp/pages/checkbox/index.json: -------------------------------------------------------------------------------- 1 | { 2 | "navigationBarTitleText": "复选框" 3 | } 4 | -------------------------------------------------------------------------------- /examples/example-weapp/pages/checkbox/index.wxss: -------------------------------------------------------------------------------- 1 | .checkbox-button-page { 2 | background-color: #fff; 3 | 4 | --checkbox-button-padding-h: 12rpx; 5 | --checkbox-padding-h: 12rpx; 6 | } 7 | -------------------------------------------------------------------------------- /examples/example-weapp/pages/collapse/index.json: -------------------------------------------------------------------------------- 1 | { 2 | "navigationBarTitleText": "折叠面板" 3 | } 4 | -------------------------------------------------------------------------------- /examples/example-weapp/pages/collapse/index.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /examples/example-weapp/pages/collapse/index.wxss: -------------------------------------------------------------------------------- 1 | .demo-collapse-title-box { 2 | display: flex; 3 | height: 114rpx; 4 | margin: 0 0 0 28rpx; 5 | 6 | line-height: 114rpx; 7 | } 8 | 9 | .demo-collapse-title { 10 | color: #212121; 11 | font-family: PingFangSC-Medium, 'PingFang SC'; 12 | font-size: 28rpx; 13 | font-weight: 500; 14 | } 15 | 16 | .demo-collapse-sub-title { 17 | color: #757575; 18 | font-family: PingFangSC-Regular, 'PingFang SC'; 19 | font-size: 24rpx; 20 | font-weight: 400; 21 | } 22 | 23 | .container { 24 | /* --collapse-cell-padding-v: 150rpx; 25 | --collapse-text-color: #000; */ 26 | 27 | /* --collapse-text-color: #000; 28 | --collapse-padding-h: 1px; 29 | --collapse-padding-v: 1px; */ 30 | } 31 | -------------------------------------------------------------------------------- /examples/example-weapp/pages/countdown/index.json: -------------------------------------------------------------------------------- 1 | { 2 | "navigationBarTitleText": "倒计时" 3 | } 4 | -------------------------------------------------------------------------------- /examples/example-weapp/pages/countdown/templates.wxml: -------------------------------------------------------------------------------- 1 | 22 | 23 | -------------------------------------------------------------------------------- /examples/example-weapp/pages/datetime-picker/index.json: -------------------------------------------------------------------------------- 1 | { 2 | "navigationBarTitleText": "时间选择" 3 | } 4 | -------------------------------------------------------------------------------- /examples/example-weapp/pages/datetime-picker/index.wxml: -------------------------------------------------------------------------------- 1 | 2 | 点击演示 3 | 4 | 5 | 6 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /examples/example-weapp/pages/datetime-picker/index.wxss: -------------------------------------------------------------------------------- 1 | .datetime-picker-hairline { 2 | /* border: 2px solid rgb(207 122 122) !important; */ 3 | } 4 | 5 | .datetime-option-item { 6 | /* background-color: rgba(0, 0, 10, 30%); 7 | 8 | color: azure !important; */ 9 | } 10 | 11 | .datetime-picker-ext { 12 | /* outline: 1px solid #999; */ 13 | } 14 | 15 | .datetime-option { 16 | /* outline: 1px solid #000; */ 17 | } 18 | 19 | .datetime-picker-mask { 20 | /* background-color: rgba(225, 225, 10, 30%); */ 21 | } 22 | 23 | .datetime-picker { 24 | /* --datetime-picker-row-color: yellow; 25 | --datetime-picker-row-selected-color: blue; 26 | --datetime-picker-row-disabled-color: red; */ 27 | } 28 | -------------------------------------------------------------------------------- /examples/example-weapp/pages/dialog/index.json: -------------------------------------------------------------------------------- 1 | { 2 | "navigationBarTitleText": "弹出框" 3 | } 4 | -------------------------------------------------------------------------------- /examples/example-weapp/pages/dialog/index.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 点击演示 - API 式 5 | 6 | 7 | 点击演示 - 声明式 8 | 9 | 10 | 11 | 12 | 13 | 14 | - 内容 Content 插槽- 15 | 16 | 17 | 28 | 前缀- 29 | - 内容 Content 插槽- 30 | 31 | -------------------------------------------------------------------------------- /examples/example-weapp/pages/dialog/index.wxss: -------------------------------------------------------------------------------- 1 | /* stylelint-disable-next-line selector-type-no-unknown */ 2 | page { 3 | /* --dialog-popup-mask-bg-color: blue; */ 4 | } 5 | 6 | .wrapper { 7 | display: flex; 8 | flex-direction: column; 9 | align-items: center; 10 | justify-content: center; 11 | gap: 30px; 12 | } 13 | 14 | .content { 15 | display: flex; 16 | align-items: center; 17 | justify-content: center; 18 | width: 484rpx; 19 | height: 252rpx; 20 | 21 | background-color: #f2f2f2; 22 | 23 | color: #9e9e9e; 24 | } 25 | -------------------------------------------------------------------------------- /examples/example-weapp/pages/divider/index.json: -------------------------------------------------------------------------------- 1 | { 2 | "navigationBarTitleText": "分割线" 3 | } 4 | -------------------------------------------------------------------------------- /examples/example-weapp/pages/divider/index.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 一级分类 4 | 12 | {{ attrs.text }} 13 | 14 | 二级分类 15 | 16 | 17 | -------------------------------------------------------------------------------- /examples/example-weapp/pages/divider/index.wxss: -------------------------------------------------------------------------------- 1 | .container { 2 | display: flex; 3 | justify-content: center; 4 | align-items: center; 5 | background-color: transparent; 6 | } 7 | 8 | .text { 9 | font-size: 24rpx; 10 | color: #757575; 11 | line-height: 1.2; 12 | } 13 | -------------------------------------------------------------------------------- /examples/example-weapp/pages/dropdown-menu/index.json: -------------------------------------------------------------------------------- 1 | { 2 | "navigationBarTitleText": "下拉菜单" 3 | } 4 | -------------------------------------------------------------------------------- /examples/example-weapp/pages/dropdown-menu/index.wxss: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weimob-tech/titian-weapp/d4f0f8b901e09177803e49da10e76a3a056d4b23/examples/example-weapp/pages/dropdown-menu/index.wxss -------------------------------------------------------------------------------- /examples/example-weapp/pages/empty/index.json: -------------------------------------------------------------------------------- 1 | { 2 | "navigationBarTitleText": "空态" 3 | } 4 | -------------------------------------------------------------------------------- /examples/example-weapp/pages/empty/index.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 立即前往 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /examples/example-weapp/pages/empty/index.wxss: -------------------------------------------------------------------------------- 1 | .button { 2 | margin-top: 36rpx; 3 | } 4 | 5 | .button-big { 6 | margin-top: 48rpx; 7 | } 8 | -------------------------------------------------------------------------------- /examples/example-weapp/pages/grid/index.json: -------------------------------------------------------------------------------- 1 | { 2 | "navigationBarTitleText": "宫格" 3 | } 4 | -------------------------------------------------------------------------------- /examples/example-weapp/pages/grid/index.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 12 | - 内容 - 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /examples/example-weapp/pages/grid/index.wxss: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weimob-tech/titian-weapp/d4f0f8b901e09177803e49da10e76a3a056d4b23/examples/example-weapp/pages/grid/index.wxss -------------------------------------------------------------------------------- /examples/example-weapp/pages/icon/index.json: -------------------------------------------------------------------------------- 1 | { 2 | "navigationBarTitleText": "图标" 3 | } 4 | -------------------------------------------------------------------------------- /examples/example-weapp/pages/icon/index.wxml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 15 | 23 | 24 | 25 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /examples/example-weapp/pages/image/index.json: -------------------------------------------------------------------------------- 1 | { 2 | "navigationBarTitleText": "图片" 3 | } 4 | -------------------------------------------------------------------------------- /examples/example-weapp/pages/image/index.wxml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 9 | 20 | 21 | 加载中... 22 | 加载失败 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /examples/example-weapp/pages/image/index.wxss: -------------------------------------------------------------------------------- 1 | .container { 2 | display: flex; 3 | position: relative; 4 | width: auto; 5 | 6 | border-radius: 0; 7 | 8 | background: #f2f2f2; 9 | } 10 | 11 | .bg-pic { 12 | position: absolute; 13 | width: 270rpx; 14 | height: 180rpx; 15 | 16 | opacity: 0.2; 17 | } 18 | -------------------------------------------------------------------------------- /examples/example-weapp/pages/input-number/index.json: -------------------------------------------------------------------------------- 1 | { 2 | "navigationBarTitleText": "步进器" 3 | } 4 | -------------------------------------------------------------------------------- /examples/example-weapp/pages/input-number/index.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /examples/example-weapp/pages/input-number/index.wxss: -------------------------------------------------------------------------------- 1 | .container { 2 | width: auto; 3 | padding: 40rpx 80rpx; 4 | 5 | background-color: #fff; 6 | } 7 | 8 | .ext-input-class { 9 | --input-number-background: #fff; 10 | font-family: font-wemo; 11 | } 12 | 13 | .ext-minus-class, 14 | .ext-plus-class { 15 | --base-radius-size: var(--input-number-radius-size, 0); 16 | } 17 | -------------------------------------------------------------------------------- /examples/example-weapp/pages/input/index.json: -------------------------------------------------------------------------------- 1 | { 2 | "navigationBarTitleText": "输入" 3 | } 4 | -------------------------------------------------------------------------------- /examples/example-weapp/pages/input/index.wxss: -------------------------------------------------------------------------------- 1 | .ellipsis-line1 { 2 | display: -webkit-box; 3 | overflow: hidden; 4 | 5 | text-overflow: ellipsis; 6 | -webkit-line-clamp: 1; 7 | -webkit-box-orient: vertical; 8 | } 9 | 10 | .ellipsis-line2 { 11 | display: -webkit-box; 12 | overflow: hidden; 13 | 14 | text-overflow: ellipsis; 15 | -webkit-line-clamp: 2; 16 | -webkit-box-orient: vertical; 17 | } 18 | 19 | .suffix-box { 20 | margin-left: 28rpx; 21 | } 22 | 23 | .red { 24 | color: #fa2c19; 25 | font-size: 26rpx; 26 | font-weight: 500; 27 | } 28 | 29 | .prefix-box { 30 | display: flex; 31 | align-items: center; 32 | margin-right: 16rpx; 33 | } 34 | -------------------------------------------------------------------------------- /examples/example-weapp/pages/layout/index.json: -------------------------------------------------------------------------------- 1 | { 2 | "navigationBarTitleText": "布局" 3 | } 4 | -------------------------------------------------------------------------------- /examples/example-weapp/pages/layout/index.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {{ item.label }} 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /examples/example-weapp/pages/layout/index.wxss: -------------------------------------------------------------------------------- 1 | .item { 2 | display: flex; 3 | align-items: center; 4 | justify-content: center; 5 | height: 72rpx; 6 | font-size: 28rpx; 7 | font-weight: 400; 8 | color: #ffffff; 9 | line-height: 40rpx; 10 | background: #fa2c19; 11 | } 12 | 13 | .item3 { 14 | opacity: 0.7; 15 | } 16 | .container { 17 | width: 100%; 18 | margin: 0 68rpx; 19 | box-sizing: border-box; 20 | border-radius: 12rpx; 21 | overflow: hidden; 22 | } 23 | .item12 { 24 | opacity: 0.49; 25 | } 26 | .item12.index1 { 27 | opacity: 0.7; 28 | } 29 | .item8.index1 { 30 | opacity: 0.49; 31 | } 32 | -------------------------------------------------------------------------------- /examples/example-weapp/pages/loading/index.json: -------------------------------------------------------------------------------- 1 | { 2 | "navigationBarTitleText": "加载" 3 | } 4 | -------------------------------------------------------------------------------- /examples/example-weapp/pages/loading/index.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /examples/example-weapp/pages/loading/index.wxss: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weimob-tech/titian-weapp/d4f0f8b901e09177803e49da10e76a3a056d4b23/examples/example-weapp/pages/loading/index.wxss -------------------------------------------------------------------------------- /examples/example-weapp/pages/navbar/index.json: -------------------------------------------------------------------------------- 1 | { 2 | "navigationStyle": "custom" 3 | } 4 | -------------------------------------------------------------------------------- /examples/example-weapp/pages/notice-bar/index.json: -------------------------------------------------------------------------------- 1 | { 2 | "navigationBarTitleText": "通告栏" 3 | } 4 | -------------------------------------------------------------------------------- /examples/example-weapp/pages/notice-bar/index.wxml: -------------------------------------------------------------------------------- 1 | 2 | 11 | 按钮 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /examples/example-weapp/pages/notice-bar/index.wxss: -------------------------------------------------------------------------------- 1 | .container { 2 | margin: 0; 3 | } 4 | -------------------------------------------------------------------------------- /examples/example-weapp/pages/picker/index.json: -------------------------------------------------------------------------------- 1 | { 2 | "navigationBarTitleText": "选择器" 3 | } 4 | -------------------------------------------------------------------------------- /examples/example-weapp/pages/picker/index.wxml: -------------------------------------------------------------------------------- 1 | 2 | 点击演示 3 | 4 | 5 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /examples/example-weapp/pages/picker/index.wxs: -------------------------------------------------------------------------------- 1 | function computedScrollLeft(item) { 2 | var itemWidth = 140; 3 | var itemGap = 12; 4 | return (itemWidth + itemGap) * (item.currentIndex - 1) + 'rpx'; 5 | } 6 | module.exports = { 7 | computedScrollLeft: computedScrollLeft 8 | }; 9 | -------------------------------------------------------------------------------- /examples/example-weapp/pages/picker/index.wxss: -------------------------------------------------------------------------------- 1 | .picker-hairline { 2 | /* border: 2px solid rgb(207 122 122) !important; */ 3 | } 4 | 5 | .picker-option-item { 6 | /* background-color: rgba(0, 0, 10, 30%); 7 | 8 | color: azure !important; */ 9 | } 10 | 11 | .picker-ext { 12 | /* outline: 1px solid #999; */ 13 | } 14 | 15 | .picker-option { 16 | /* outline: 1px solid #000; */ 17 | } 18 | 19 | .picker-picker-mask { 20 | /* background-color: rgba(225, 225, 10, 30%); */ 21 | } 22 | 23 | .picker { 24 | /* --picker-row-color: yellow; 25 | --picker-row-selected-color: blue; 26 | --picker-row-disabled-color: red; */ 27 | } 28 | -------------------------------------------------------------------------------- /examples/example-weapp/pages/picker/page.json: -------------------------------------------------------------------------------- 1 | { 2 | "component": true 3 | } 4 | -------------------------------------------------------------------------------- /examples/example-weapp/pages/picker/picker.json: -------------------------------------------------------------------------------- 1 | { 2 | "usingComponents": { 3 | "ti-page": "./page" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /examples/example-weapp/pages/picker/picker.wxml: -------------------------------------------------------------------------------- 1 | 2 | 点击演示 3 | 4 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /examples/example-weapp/pages/picker/picker.wxss: -------------------------------------------------------------------------------- 1 | /* pages/picker/picker.wxss */ 2 | 3 | .drawer { 4 | height: 600px; 5 | } 6 | -------------------------------------------------------------------------------- /examples/example-weapp/pages/picker/simple.json: -------------------------------------------------------------------------------- 1 | { 2 | "usingComponents": {} 3 | } 4 | -------------------------------------------------------------------------------- /examples/example-weapp/pages/picker/simple.wxss: -------------------------------------------------------------------------------- 1 | .demo-picker-hairline { 2 | border: 1px solid #f0f; 3 | } 4 | -------------------------------------------------------------------------------- /examples/example-weapp/pages/popup-titlebar/index.json: -------------------------------------------------------------------------------- 1 | { 2 | "navigationBarTitleText": "弹出层标题" 3 | } 4 | -------------------------------------------------------------------------------- /examples/example-weapp/pages/popup-titlebar/index.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /examples/example-weapp/pages/popup-titlebar/index.wxss: -------------------------------------------------------------------------------- 1 | .group { 2 | display: flex; 3 | flex: 1; 4 | flex-direction: column; 5 | } 6 | 7 | .ext-class { 8 | margin: 10px 0; 9 | 10 | background: #fff; 11 | } 12 | 13 | .group-item { 14 | position: relative; 15 | } 16 | -------------------------------------------------------------------------------- /examples/example-weapp/pages/popup/index.json: -------------------------------------------------------------------------------- 1 | { 2 | "navigationBarTitleText": "弹出层" 3 | } 4 | -------------------------------------------------------------------------------- /examples/example-weapp/pages/popup/index.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 点击演示 4 | 5 | 6 | 15 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /examples/example-weapp/pages/popup/index.wxss: -------------------------------------------------------------------------------- 1 | .popup-center { 2 | width: 240rpx; 3 | height: 240rpx; 4 | } 5 | 6 | .popup-left { 7 | width: 150rpx; 8 | } 9 | 10 | .popup-right { 11 | width: 150rpx; 12 | } 13 | 14 | .popup-bottom { 15 | height: 648rpx; 16 | } 17 | 18 | .popup-right, 19 | .popup-left { 20 | height: 100vh; 21 | } 22 | -------------------------------------------------------------------------------- /examples/example-weapp/pages/preview/index.json: -------------------------------------------------------------------------------- 1 | { 2 | "navigationBarTitleText": "图片预览" 3 | } 4 | -------------------------------------------------------------------------------- /examples/example-weapp/pages/preview/index.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 10 | 点击图片预览 11 | 12 | 13 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /examples/example-weapp/pages/preview/index.wxss: -------------------------------------------------------------------------------- 1 | .preview-content { 2 | display: flex; 3 | flex-direction: column; 4 | align-items: center; 5 | justify-content: center; 6 | } 7 | 8 | .preview-text { 9 | margin-top: 20rpx; 10 | 11 | color: #c4c4c4; 12 | font-size: 20rpx; 13 | } 14 | -------------------------------------------------------------------------------- /examples/example-weapp/pages/price/index.js: -------------------------------------------------------------------------------- 1 | Page({ 2 | data: { 3 | options: [ 4 | { key: 'color', type: 'color', name: 'Color', desc: '颜色' }, 5 | { 6 | key: 'prefix', 7 | type: 'radio', 8 | name: 'State', 9 | desc: '前缀', 10 | list: [ 11 | { label: '无', value: 1, attr: { prefix: '' } }, 12 | { label: '文案', value: 2, attr: { prefix: '最低' } } 13 | ], 14 | value: 1 15 | }, 16 | { 17 | key: 'suffix', 18 | type: 'radio', 19 | name: 'State', 20 | desc: '后缀', 21 | list: [ 22 | { label: '无', value: 1, attr: { suffix: '' } }, 23 | { label: '文案', value: 2, attr: { suffix: '起' } } 24 | ], 25 | value: 1 26 | } 27 | ], 28 | attrs: {}, 29 | cssVariable: '' 30 | }, 31 | 32 | onChange(event) { 33 | const attr = event.detail; 34 | 35 | this.setData({ 36 | attrs: { ...this.data.attrs, ...attr }, 37 | cssVariable: `--theme-price:${attr.color};` 38 | }); 39 | } 40 | }); 41 | -------------------------------------------------------------------------------- /examples/example-weapp/pages/price/index.json: -------------------------------------------------------------------------------- 1 | { 2 | "navigationBarTitleText": "价格" 3 | } 4 | -------------------------------------------------------------------------------- /examples/example-weapp/pages/price/index.wxml: -------------------------------------------------------------------------------- 1 | 2 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /examples/example-weapp/pages/price/index.wxss: -------------------------------------------------------------------------------- 1 | .body { 2 | justify-content: space-around; 3 | } 4 | -------------------------------------------------------------------------------- /examples/example-weapp/pages/product-detail/index.js: -------------------------------------------------------------------------------- 1 | Page({ 2 | data: { 3 | navigationBarHeight: '', 4 | statusBarHeight: '' 5 | }, 6 | onReady() { 7 | this.navBarAnimation(); 8 | }, 9 | navBarAnimation() { 10 | const sysInfo = wx.getSystemInfoSync(); 11 | const menuInfo = wx.getMenuButtonBoundingClientRect(); 12 | this.setData({ 13 | navigationBarHeight: (menuInfo.top - sysInfo.statusBarHeight) * 2 + menuInfo.height, 14 | statusBarHeight: sysInfo.statusBarHeight 15 | }); 16 | this.animate('.navigation-bar', [{ opacity: '0' }, { opacity: '1' }], 100, { 17 | scrollSource: '#scroller', 18 | timeRange: 100, 19 | startScrollOffset: 300, 20 | endScrollOffset: 340 21 | }); 22 | } 23 | }); 24 | -------------------------------------------------------------------------------- /examples/example-weapp/pages/product-detail/index.json: -------------------------------------------------------------------------------- 1 | { 2 | "navigationBarTitleText": "商品详情", 3 | "navigationStyle": "custom" 4 | } 5 | -------------------------------------------------------------------------------- /examples/example-weapp/pages/progress/index.json: -------------------------------------------------------------------------------- 1 | { 2 | "navigationBarTitleText": "进度条" 3 | } 4 | -------------------------------------------------------------------------------- /examples/example-weapp/pages/progress/index.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 10 | 11 | 12 | 13 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /examples/example-weapp/pages/progress/index.wxss: -------------------------------------------------------------------------------- 1 | .body { 2 | justify-content: space-around; 3 | } 4 | -------------------------------------------------------------------------------- /examples/example-weapp/pages/radio/index.json: -------------------------------------------------------------------------------- 1 | { 2 | "navigationBarTitleText": "单选框" 3 | } 4 | -------------------------------------------------------------------------------- /examples/example-weapp/pages/radio/index.wxss: -------------------------------------------------------------------------------- 1 | .radio-button-page { 2 | background-color: #fff; 3 | 4 | --radio-button-padding-h: 12rpx; 5 | --radio-padding-h: 12rpx; 6 | } 7 | -------------------------------------------------------------------------------- /examples/example-weapp/pages/rate/index.json: -------------------------------------------------------------------------------- 1 | { 2 | "navigationBarTitleText": "评分" 3 | } 4 | -------------------------------------------------------------------------------- /examples/example-weapp/pages/rate/index.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 15 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /examples/example-weapp/pages/rate/index.wxss: -------------------------------------------------------------------------------- 1 | .rate-wrap { 2 | margin-bottom: 30rpx; 3 | } 4 | 5 | .rate-label { 6 | margin-left: 20rpx; 7 | 8 | color: red; 9 | } 10 | 11 | .rate-box { 12 | display: flex; 13 | flex-direction: column; 14 | justify-content: space-between; 15 | height: 100rpx; 16 | 17 | /* --rate-color: #000; 18 | --rate-empty-color: blue; 19 | --rate-gap: 10px; */ 20 | } 21 | -------------------------------------------------------------------------------- /examples/example-weapp/pages/root/index.json: -------------------------------------------------------------------------------- 1 | { 2 | "navigationStyle": "custom" 3 | } 4 | -------------------------------------------------------------------------------- /examples/example-weapp/pages/search/index.json: -------------------------------------------------------------------------------- 1 | { 2 | "navigationBarTitleText": "搜索" 3 | } 4 | -------------------------------------------------------------------------------- /examples/example-weapp/pages/search/index.wxss: -------------------------------------------------------------------------------- 1 | .container { 2 | min-height: 100vh; 3 | 4 | background: #f5f5f5; 5 | } 6 | 7 | .prefix, 8 | .suffix { 9 | display: flex; 10 | align-items: center; 11 | justify-content: space-between; 12 | 13 | color: #111; 14 | font-size: 28rpx; 15 | font-weight: 400; 16 | } 17 | 18 | .prefix { 19 | margin-right: 28rpx; 20 | } 21 | 22 | .suffix { 23 | margin-left: 28rpx; 24 | } 25 | 26 | .search-box { 27 | border-radius: 20rpx; 28 | 29 | --icon-color: #212121; 30 | } 31 | 32 | .search-box-diy { 33 | background: #f3f3f3; 34 | } 35 | 36 | .diy { 37 | background-color: #f3f3f3; 38 | } 39 | 40 | .search-inner-class { 41 | border-radius: 72rpx; 42 | 43 | background-color: #fff; 44 | } 45 | -------------------------------------------------------------------------------- /examples/example-weapp/pages/share-sheet/index.json: -------------------------------------------------------------------------------- 1 | { 2 | "navigationBarTitleText": "分享菜单" 3 | } 4 | -------------------------------------------------------------------------------- /examples/example-weapp/pages/share-sheet/index.wxml: -------------------------------------------------------------------------------- 1 | 2 | 点击演示 3 | 4 | 14 | -------------------------------------------------------------------------------- /examples/example-weapp/pages/share-sheet/index.wxss: -------------------------------------------------------------------------------- 1 | /* stylelint-disable-next-line selector-type-no-unknown */ 2 | page { 3 | /* --share-sheet-popup-radius: 50%; */ 4 | 5 | /* --share-sheet-item-icon-bg-color: #000; */ 6 | } 7 | -------------------------------------------------------------------------------- /examples/example-weapp/pages/sidebar/index.js: -------------------------------------------------------------------------------- 1 | Page({ 2 | onShareAppMessage() { 3 | return { 4 | title: 'Sidebar 侧边栏', 5 | path: 'pages/sidebar/index' 6 | }; 7 | }, 8 | data: { 9 | options: [ 10 | { 11 | type: 'color', 12 | name: 'color', 13 | key: 'color', 14 | desc: '颜色 ', 15 | value: '#212121', 16 | list: [ 17 | { label: 'red', value: '#fa2c19' }, 18 | { label: 'orange', value: '#ffa300' }, 19 | { label: 'green', value: '#07c160' }, 20 | { label: 'blue', value: '#2a6ae9' }, 21 | { label: 'black', value: '#212121' } 22 | ] 23 | }, 24 | { 25 | type: 'radius', 26 | name: 'shape', 27 | key: 'radius', 28 | desc: '圆角', 29 | value: 16 30 | } 31 | ], 32 | attrs: {} 33 | }, 34 | 35 | onChange(e) { 36 | const { detail } = e; 37 | this.setData({ attrs: detail }); 38 | }, 39 | onChangeSelected(e) { 40 | const { detail } = e; 41 | console.log('onChangeSelected ', detail); 42 | } 43 | }); 44 | -------------------------------------------------------------------------------- /examples/example-weapp/pages/sidebar/index.json: -------------------------------------------------------------------------------- 1 | { 2 | "navigationBarTitleText": "侧边导航" 3 | } 4 | -------------------------------------------------------------------------------- /examples/example-weapp/pages/sidebar/index.wxml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /examples/example-weapp/pages/sidebar/index.wxss: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weimob-tech/titian-weapp/d4f0f8b901e09177803e49da10e76a3a056d4b23/examples/example-weapp/pages/sidebar/index.wxss -------------------------------------------------------------------------------- /examples/example-weapp/pages/sku/index.json: -------------------------------------------------------------------------------- 1 | { 2 | "navigationBarTitleText": "规格选择" 3 | } 4 | -------------------------------------------------------------------------------- /examples/example-weapp/pages/sku/index.wxml: -------------------------------------------------------------------------------- 1 | 2 | 展示sku 3 | 4 | 5 | 6 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /examples/example-weapp/pages/sku/index.wxss: -------------------------------------------------------------------------------- 1 | .sku-slot-content { 2 | display: flex; 3 | box-sizing: border-box; 4 | align-items: center; 5 | justify-content: center; 6 | width: 100%; 7 | height: 500rpx; 8 | 9 | border-radius: 30rpx; 10 | 11 | background-color: #d4d4d4; 12 | } 13 | 14 | .sku-slot-action { 15 | display: flex; 16 | align-items: center; 17 | justify-content: flex-start; 18 | width: 150rpx; 19 | height: 100%; 20 | } 21 | 22 | .sku-wrapper { 23 | padding: 28px; 24 | } 25 | -------------------------------------------------------------------------------- /examples/example-weapp/pages/slider/index.json: -------------------------------------------------------------------------------- 1 | { 2 | "navigationBarTitleText": "滑块" 3 | } 4 | -------------------------------------------------------------------------------- /examples/example-weapp/pages/slider/index.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /examples/example-weapp/pages/slider/index.wxss: -------------------------------------------------------------------------------- 1 | .slider-wrap { 2 | width: 80%; 3 | margin-bottom: 30rpx; 4 | } 5 | 6 | .slider-thumb-class::before { 7 | position: absolute; 8 | top: 50%; 9 | left: 50%; 10 | width: 20rpx; 11 | height: 20rpx; 12 | background-color: #fa2c19; 13 | border-radius: 50%; 14 | transform: translate(-50%, -50%); 15 | content: ''; 16 | } 17 | -------------------------------------------------------------------------------- /examples/example-weapp/pages/steps/index.json: -------------------------------------------------------------------------------- 1 | { 2 | "navigationBarTitleText": "步骤条" 3 | } 4 | -------------------------------------------------------------------------------- /examples/example-weapp/pages/steps/index.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /examples/example-weapp/pages/steps/index.wxss: -------------------------------------------------------------------------------- 1 | .content { 2 | padding-top: 20rpx; 3 | } 4 | -------------------------------------------------------------------------------- /examples/example-weapp/pages/sticky/index.json: -------------------------------------------------------------------------------- 1 | { 2 | "navigationBarTitleText": "粘性布局" 3 | } 4 | -------------------------------------------------------------------------------- /examples/example-weapp/pages/sticky/index.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | {{ attrs.text }} 5 | 6 | 7 | - 上滑展示区页面,显示吸顶效果 - 8 | 9 | 10 | -------------------------------------------------------------------------------- /examples/example-weapp/pages/sticky/index.wxss: -------------------------------------------------------------------------------- 1 | .container { 2 | display: flex; 3 | align-items: center; 4 | justify-content: center; 5 | height: 20vh; 6 | border-radius: unset; 7 | } 8 | .placeholder { 9 | height: 1300px; 10 | } 11 | .page-container { 12 | flex-direction: column; 13 | } 14 | .tip { 15 | position: absolute; 16 | bottom: 100rpx; 17 | text-align: center; 18 | font-size: 20rpx; 19 | color: #9e9e9e; 20 | } 21 | -------------------------------------------------------------------------------- /examples/example-weapp/pages/swipe-cell/index.json: -------------------------------------------------------------------------------- 1 | { 2 | "navigationBarTitleText": "滑动单元格" 3 | } 4 | -------------------------------------------------------------------------------- /examples/example-weapp/pages/switch/index.json: -------------------------------------------------------------------------------- 1 | { 2 | "navigationBarTitleText": "开关" 3 | } 4 | -------------------------------------------------------------------------------- /examples/example-weapp/pages/switch/index.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /examples/example-weapp/pages/switch/index.wxss: -------------------------------------------------------------------------------- 1 | .switch-box { 2 | /* --switch-bg-color: #000; 3 | --switch-active-bg-color: #fff; 4 | --switch-ball-bg-color: #eee; */ 5 | } 6 | -------------------------------------------------------------------------------- /examples/example-weapp/pages/tabbar/index.json: -------------------------------------------------------------------------------- 1 | { 2 | "navigationBarTitleText": "标签栏" 3 | } 4 | -------------------------------------------------------------------------------- /examples/example-weapp/pages/tabbar/index.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 10 | 11 | -------------------------------------------------------------------------------- /examples/example-weapp/pages/tabbar/index.wxss: -------------------------------------------------------------------------------- 1 | /* stylelint-disable-next-line selector-type-no-unknown */ 2 | page { 3 | /* --tabbar-padding-v: 30px; 4 | --tabbar-item-title-margin-bottom: 10px; */ 5 | } 6 | -------------------------------------------------------------------------------- /examples/example-weapp/pages/tabs/index.json: -------------------------------------------------------------------------------- 1 | { 2 | "navigationBarTitleText": "标签页", 3 | "navigationBarBackgroundColor": "#FFFFFF" 4 | } 5 | -------------------------------------------------------------------------------- /examples/example-weapp/pages/tabs/index.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 17 | 18 | - {{ item.label || item }} - 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /examples/example-weapp/pages/tabs/index.wxss: -------------------------------------------------------------------------------- 1 | /* .page { 2 | box-sizing: border-box; 3 | width: 100vw; 4 | height: 100vh; 5 | 6 | } 7 | .container { 8 | height: 80vh; 9 | } */ 10 | .swiper-class { 11 | height: 320rpx; 12 | 13 | background: #fff; 14 | } 15 | 16 | .item { 17 | display: flex; 18 | align-items: center; 19 | justify-content: center; 20 | width: 100%; 21 | height: 100%; 22 | 23 | color: #9e9e9e; 24 | font-size: 24rpx; 25 | } 26 | 27 | .tabs-container { 28 | width: 100vw; 29 | 30 | background-color: #fff; 31 | } 32 | -------------------------------------------------------------------------------- /examples/example-weapp/pages/tag/index.json: -------------------------------------------------------------------------------- 1 | { 2 | "navigationBarTitleText": "标签" 3 | } 4 | -------------------------------------------------------------------------------- /examples/example-weapp/pages/tag/index.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 11 | {{ attrs.text }} 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /examples/example-weapp/pages/tag/index.wxss: -------------------------------------------------------------------------------- 1 | .ext-class { 2 | /* --s: 100px; */ 3 | } 4 | -------------------------------------------------------------------------------- /examples/example-weapp/pages/textarea/index.json: -------------------------------------------------------------------------------- 1 | { 2 | "navigationBarTitleText": "多行文本" 3 | } 4 | -------------------------------------------------------------------------------- /examples/example-weapp/pages/textarea/index.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /examples/example-weapp/pages/textarea/index.wxss: -------------------------------------------------------------------------------- 1 | .page { 2 | min-height: 100vh; 3 | 4 | background: #f9f9f9; 5 | } 6 | 7 | .test { 8 | color: red !important; 9 | } 10 | 11 | .box { 12 | padding: 28rpx; 13 | } 14 | 15 | .ext-class { 16 | margin: 28rpx; 17 | 18 | border-radius: 12rpx; 19 | 20 | background: #f5f5f5; 21 | } 22 | -------------------------------------------------------------------------------- /examples/example-weapp/pages/toast/index.json: -------------------------------------------------------------------------------- 1 | { 2 | "navigationBarTitleText": "轻提示" 3 | } 4 | -------------------------------------------------------------------------------- /examples/example-weapp/pages/toast/index.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /examples/example-weapp/pages/toast/index.wxss: -------------------------------------------------------------------------------- 1 | /* stylelint-disable-next-line selector-type-no-unknown */ 2 | page { 3 | /* --toast-popup-radius: 50%; */ 4 | } 5 | -------------------------------------------------------------------------------- /examples/example-weapp/pages/tooltip/index.json: -------------------------------------------------------------------------------- 1 | { 2 | "navigationBarTitleText": "提示" 3 | } 4 | -------------------------------------------------------------------------------- /examples/example-weapp/pages/tooltip/index.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | {{ attr.text }} 4 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /examples/example-weapp/pages/tooltip/index.wxss: -------------------------------------------------------------------------------- 1 | .tooltip-page { 2 | display: flex; 3 | flex: 1; 4 | align-items: center; 5 | height: 108rpx; 6 | 7 | background-color: #fff; 8 | } 9 | 10 | .text { 11 | margin: 0 20rpx; 12 | 13 | font-size: 28rpx; 14 | } 15 | -------------------------------------------------------------------------------- /examples/example-weapp/pages/transition/index.json: -------------------------------------------------------------------------------- 1 | { 2 | "navigationBarTitleText": "动画" 3 | } 4 | -------------------------------------------------------------------------------- /examples/example-weapp/pages/transition/index.wxss: -------------------------------------------------------------------------------- 1 | /* pages/transition/index.wxss */ 2 | .custom-container { 3 | display: flex; 4 | position: fixed; 5 | top: 50%; 6 | align-items: center; 7 | justify-content: center; 8 | width: 100%; 9 | height: 50vh; 10 | } 11 | 12 | .container-show { 13 | z-index: 1000; 14 | } 15 | 16 | .wrap { 17 | display: flex; 18 | position: relative; 19 | z-index: 10; 20 | flex-wrap: wrap; 21 | align-items: center; 22 | } 23 | 24 | .btn-item { 25 | width: 40vw; 26 | margin: 20rpx 5vw; 27 | 28 | font-size: 28rpx; 29 | } 30 | 31 | .placeholder { 32 | width: 100px; 33 | height: 100px; 34 | 35 | background-color: #fa2c19; 36 | } 37 | -------------------------------------------------------------------------------- /examples/example-weapp/pages/tree-select/index.json: -------------------------------------------------------------------------------- 1 | { 2 | "navigationBarTitleText": "分类选择" 3 | } 4 | -------------------------------------------------------------------------------- /examples/example-weapp/pages/tree-select/index.wxml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 11 | - {{ text }} - 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /examples/example-weapp/pages/tree-select/index.wxss: -------------------------------------------------------------------------------- 1 | .container { 2 | width: 100%; 3 | height: 100%; 4 | margin: 0; 5 | } 6 | 7 | .content { 8 | height: 100%; 9 | display: flex; 10 | justify-content: center; 11 | align-items: center; 12 | font-size: 24rpx; 13 | color: #9e9e9e; 14 | line-height: 28px; 15 | background-color: #ffffff; 16 | } 17 | -------------------------------------------------------------------------------- /examples/example-weapp/pages/uploader/index.json: -------------------------------------------------------------------------------- 1 | { 2 | "navigationBarTitleText": "上传" 3 | } 4 | -------------------------------------------------------------------------------- /examples/example-weapp/pages/uploader/index.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /examples/example-weapp/private.key: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weimob-tech/titian-weapp/d4f0f8b901e09177803e49da10e76a3a056d4b23/examples/example-weapp/private.key -------------------------------------------------------------------------------- /examples/example-weapp/sitemap.json: -------------------------------------------------------------------------------- 1 | { 2 | "desc": "微盟小程序组件库示例", 3 | "rules": [ 4 | { 5 | "action": "allow", 6 | "page": "*" 7 | } 8 | ] 9 | } 10 | -------------------------------------------------------------------------------- /examples/example-weapp/util/index.js: -------------------------------------------------------------------------------- 1 | function mergeOptionIntoAttrs(option, attr) { 2 | const afterAttr = {}; 3 | option.forEach((opt) => { 4 | const attrVal = attr[opt.key]; 5 | if (Array.isArray(opt.list)) { 6 | opt.list.forEach((o) => { 7 | if (o.value === attrVal) { 8 | afterAttr[opt.key] = o.value; 9 | 10 | if (o.property) { 11 | Object.assign(afterAttr, o.property); 12 | } else if (o.attr) { 13 | Object.assign(afterAttr, o.attr); 14 | } else { 15 | afterAttr[opt.key] = o.value; 16 | } 17 | } 18 | }); 19 | } else { 20 | afterAttr[opt.key] = attr[opt.key]; 21 | } 22 | }); 23 | return afterAttr; 24 | } 25 | 26 | export { mergeOptionIntoAttrs }; 27 | -------------------------------------------------------------------------------- /jest.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | testEnvironment: 'jsdom', // Use JSDOM to test 3 | setupFiles: ['/test/setupJest.ts'], // setup files 4 | snapshotSerializers: ['miniprogram-simulate/jest-snapshot-plugin'], // snapshot serializer 5 | transform: { 6 | '^.+\\.jsx?$': 'babel-jest', // Transform all .js and .jsx files 7 | '^.+\\.tsx?$': 'ts-jest' // Transform all .ts and .tsx files 8 | }, 9 | testPathIgnorePatterns: ['/examples/', 'esm', 'dist-titan'], // ignore e2e test 10 | coveragePathIgnorePatterns: ['/__test__/*', 'node_modules'], // ignore test files 11 | globals: { 12 | 'ts-jest': { 13 | tsconfig: './tsconfig.json' 14 | } 15 | }, 16 | coverageThreshold: { 17 | global: { 18 | statements: 60, // %stmts是语句覆盖率 (statement coverage): 是不是每个语句都执行了? 19 | branches: 60, // %Branch分支覆盖率 (branch coverage): 是不是每个if代码块都执行了? 20 | functions: 60, // %Funcs函数覆盖率 (function coverage): 是不是每个函数都调用了? 21 | lines: 60 // %Lines行覆盖率 (line coverage): 是不是每一行都执行了? 22 | } 23 | } 24 | }; 25 | -------------------------------------------------------------------------------- /packages/compiler/CHANGELOG.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weimob-tech/titian-weapp/d4f0f8b901e09177803e49da10e76a3a056d4b23/packages/compiler/CHANGELOG.md -------------------------------------------------------------------------------- /packages/compiler/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | Copyright © 2022 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 5 | 6 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 7 | 8 | THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 9 | 10 | 11 | -------------------------------------------------------------------------------- /packages/compiler/README.md: -------------------------------------------------------------------------------- 1 | # `compiler` 2 | 3 | > TODO: description 4 | 5 | ## Usage 6 | 7 | ``` 8 | const compiler = require('compiler'); 9 | 10 | // TODO: DEMONSTRATE API 11 | ``` 12 | -------------------------------------------------------------------------------- /packages/compiler/lib/index.js: -------------------------------------------------------------------------------- 1 | /* eslint-disable no-new */ 2 | const { logger } = require('@titian-design/cli'); 3 | const Compiler = require('./BasicCompiler'); 4 | 5 | process.on('unhandledRejection', (error) => { 6 | logger.error('compiler', error); 7 | }); 8 | 9 | function start(...args) { 10 | new Compiler(...args); 11 | } 12 | 13 | function build(...args) { 14 | new Compiler(...args); 15 | } 16 | 17 | function release() { 18 | logger.error('compiler', 'release is not supported'); 19 | } 20 | 21 | module.exports = { 22 | start, 23 | build, 24 | release, 25 | Compiler 26 | }; 27 | -------------------------------------------------------------------------------- /packages/compiler/plugins/esbuild-plugin-time.js: -------------------------------------------------------------------------------- 1 | const { performance } = require('perf_hooks'); 2 | const { logger } = require('@titian-design/cli'); 3 | const colors = require('colors'); 4 | 5 | const time = (name) => ({ 6 | name: 'Log', 7 | setup(build) { 8 | let startTime = performance.now(); 9 | 10 | build.onStart(() => { 11 | startTime = performance.now(); 12 | logger.info(`Build${name ? ` ${colors.green(name)} ` : ' '}start...`); 13 | }); 14 | 15 | build.onEnd(() => { 16 | const endTime = performance.now() - startTime; 17 | const totalTime = (endTime / 1000).toFixed(3); 18 | logger.info('compiler', `Build${name ? ` ${colors.green(name)} ` : ' '}ended: ${colors.yellow(`${totalTime}s`)}`); 19 | }); 20 | } 21 | }); 22 | 23 | module.exports = time; 24 | -------------------------------------------------------------------------------- /packages/compiler/plugins/index.js: -------------------------------------------------------------------------------- 1 | const esbuildPluginCopyFiles = require('./esbuild-plugin-copy-files'); 2 | const esbuildPluginPostcssLess = require('./esbuild-plugin-postcss-less'); 3 | const esbuildPluginSWC = require('./esbuild-plugin-swc'); 4 | const esbuildPluginTime = require('./esbuild-plugin-time'); 5 | 6 | module.exports = { 7 | esbuildPluginPostcssLess, 8 | esbuildPluginCopyFiles, 9 | esbuildPluginTime, 10 | esbuildPluginSWC 11 | }; 12 | -------------------------------------------------------------------------------- /packages/compiler/postcss.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | plugins: { 3 | [require.resolve('autoprefixer')]: {}, 4 | [require.resolve('cssnano')]: { 5 | preset: 'default' 6 | }, 7 | // 'postcss-pxtorpx-pro': { 8 | // multiplier: 3, 9 | // replace: true, 10 | 11 | // } 12 | [require.resolve('postcss-pxtorpx')]: { 13 | multiplier: 1, 14 | minPixelValue: 2, 15 | propList: ['*'] 16 | } 17 | } 18 | }; 19 | -------------------------------------------------------------------------------- /packages/prettier-plugin-wxml/CHANGELOG.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weimob-tech/titian-weapp/d4f0f8b901e09177803e49da10e76a3a056d4b23/packages/prettier-plugin-wxml/CHANGELOG.md -------------------------------------------------------------------------------- /packages/prettier-plugin-wxml/README.md: -------------------------------------------------------------------------------- 1 | # `prettier-plugin-wxml` 2 | 3 | prettier wechat wxml files. 4 | 5 | ## Usage 6 | 7 | ```bash 8 | npm install --save-dev prettier-plugin-wxml prettier 9 | ``` 10 | -------------------------------------------------------------------------------- /packages/prettier-plugin-wxml/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@titian-design/prettier-plugin-wxml", 3 | "version": "0.1.0", 4 | "description": "prettier plugin for wechat wxml file", 5 | "keywords": [ 6 | "prettier", 7 | "wechat", 8 | "wxml" 9 | ], 10 | "homepage": "", 11 | "repository": { 12 | "type": "git", 13 | "url": "https://github.com/weimob-tech/titian-weapp.git" 14 | }, 15 | "license": "MIT", 16 | "author": "", 17 | "main": "lib/index.js", 18 | "directories": { 19 | "lib": "lib", 20 | "test": "__test__" 21 | }, 22 | "files": [ 23 | "lib" 24 | ], 25 | "dependencies": { 26 | "htmlparser2": "^7.2.0", 27 | "prettier": "^2.5.0", 28 | "pretty": "^2.0.0" 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /packages/titian-snippets/.gitattributes: -------------------------------------------------------------------------------- 1 | # Set default behavior to automatically normalize line endings. 2 | * text=auto 3 | 4 | -------------------------------------------------------------------------------- /packages/titian-snippets/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | *.vsix 3 | -------------------------------------------------------------------------------- /packages/titian-snippets/.vscodeignore: -------------------------------------------------------------------------------- 1 | .vscode/** 2 | .vscode-test/** 3 | .gitignore 4 | vsc-extension-quickstart.md 5 | -------------------------------------------------------------------------------- /packages/titian-snippets/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Change Log 2 | 3 | All notable changes to the "titian-snippets" extension will be documented in this file. 4 | 5 | Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how to structure this file. 6 | 7 | ## [Unreleased] 8 | 9 | - Initial release 10 | -------------------------------------------------------------------------------- /packages/titian-snippets/images/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weimob-tech/titian-weapp/d4f0f8b901e09177803e49da10e76a3a056d4b23/packages/titian-snippets/images/logo.png -------------------------------------------------------------------------------- /packages/titian-snippets/images/titian.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weimob-tech/titian-weapp/d4f0f8b901e09177803e49da10e76a3a056d4b23/packages/titian-snippets/images/titian.gif -------------------------------------------------------------------------------- /packages/titian-snippets/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@titian-design/snippets", 3 | "displayName": "titian-snippets", 4 | "version": "1.0.1", 5 | "description": "Weimob-UI Snippets for VS Code", 6 | "categories": [ 7 | "Snippets" 8 | ], 9 | "license": "MIT", 10 | "publisher": "titian", 11 | "contributes": { 12 | "snippets": [ 13 | { 14 | "language": "wxml", 15 | "path": "./snippets/titian-wxml.json" 16 | }, 17 | { 18 | "language": "html", 19 | "path": "./snippets/titian-wxml.json" 20 | }, 21 | { 22 | "language": "javascript", 23 | "path": "./snippets/titian-js.json" 24 | } 25 | ] 26 | }, 27 | "engines": { 28 | "vscode": "^1.63.0" 29 | }, 30 | "icon": "images/logo.png" 31 | } 32 | -------------------------------------------------------------------------------- /packages/weapp/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # 0.2.0 (2023-08-17) 2 | 3 | 4 | ### Bug Fixes 5 | 6 | * row组件ext-class丢失,input-number组件浮点数计算问题,datetime-picker组件change事件优化,tooltip组件样式优化 ([88fdfa8](https://github.com/weimob-tech/titian-weapp/commit/88fdfa80c445527e9910f9752d76aaf2cb3cb942)) 7 | 8 | 9 | ### Features 10 | 11 | * 删除callout-map组件 ([cdc6d79](https://github.com/weimob-tech/titian-weapp/commit/cdc6d79fbac90e4315b8d1ee5bb057ddb2c11d04)) 12 | * 新增组件 ([f4af3f2](https://github.com/weimob-tech/titian-weapp/commit/f4af3f25f4c7fc13bf8a230a949b5144c4181909)) 13 | * 组件优化 ([476ecc1](https://github.com/weimob-tech/titian-weapp/commit/476ecc16db6ab2cec9905c358535dc05928ea3dc)) 14 | * **ut:** update test snapshot ([3de9a4c](https://github.com/weimob-tech/titian-weapp/commit/3de9a4cfb61418ea01693b7ba324eaf6ea3655ad)) 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /packages/weapp/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | Copyright © 2022 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 5 | 6 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 7 | 8 | THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 9 | 10 | 11 | -------------------------------------------------------------------------------- /packages/weapp/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@titian-design/weapp", 3 | "version": "0.2.0", 4 | "description": "wechat mini program ui component", 5 | "homepage": "", 6 | "repository": { 7 | "type": "git", 8 | "url": "https://github.com/weimob-tech/titian-weapp" 9 | }, 10 | "license": "MIT", 11 | "author": "", 12 | "types": "types/**/*.d.ts", 13 | "files": [ 14 | "esm", 15 | "dist-titan", 16 | "types", 17 | "README.md" 18 | ], 19 | "devDependencies": { 20 | "miniprogram-simulate": "^1.4.3" 21 | }, 22 | "miniprogram": "esm" 23 | } 24 | -------------------------------------------------------------------------------- /packages/weapp/src/action-sheet/__test__/action-sheet.test.js: -------------------------------------------------------------------------------- 1 | const { getComponent } = require('../../common/test/getComponent'); 2 | 3 | describe('test component', () => { 4 | it('should render success', () => { 5 | const comp = getComponent('action-sheet'); 6 | expect(comp).toMatchSnapshot(); 7 | }); 8 | }); 9 | -------------------------------------------------------------------------------- /packages/weapp/src/action-sheet/index.json: -------------------------------------------------------------------------------- 1 | { 2 | "component": true, 3 | "usingComponents": { 4 | "ti-icon": "../icon/index", 5 | "ti-popup": "../popup/index", 6 | "ti-loading": "../loading/index", 7 | "ti-badge": "../badge/index" 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /packages/weapp/src/back-top/index.json: -------------------------------------------------------------------------------- 1 | { 2 | "component": true, 3 | "usingComponents": { 4 | "ti-icon": "../icon/index" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /packages/weapp/src/back-top/index.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 10 | 11 | {{ text }} 12 | 13 | -------------------------------------------------------------------------------- /packages/weapp/src/back-top/index.wxs: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var _require = require('../common/utils/wxs/convertStyles.wxs'); 4 | var convertStyles = _require.convertStyles; 5 | 6 | var completedStyles = function completedStyles(data) { 7 | return convertStyles([data.display ? null : 'display: none']); 8 | }; 9 | 10 | module.exports = { 11 | completedStyles: completedStyles 12 | }; 13 | -------------------------------------------------------------------------------- /packages/weapp/src/badge/__test__/badge.test.js: -------------------------------------------------------------------------------- 1 | const { getComponent } = require('../../common/test/getComponent'); 2 | 3 | describe('test component', () => { 4 | it('should render success', () => { 5 | const comp = getComponent('badge'); 6 | comp.triggerLifeTime('attached'); 7 | expect(comp).toMatchSnapshot(); 8 | }); 9 | 10 | it('should render success with content', () => { 11 | const comp = getComponent('badge', { 12 | content: '1' 13 | }); 14 | expect(comp).toMatchSnapshot(); 15 | }); 16 | 17 | it('should render success with icon', () => { 18 | const comp = getComponent('badge', { 19 | icon: 'home' 20 | }); 21 | expect(comp).toMatchSnapshot(); 22 | }); 23 | it('should render success with dot', () => { 24 | const comp = getComponent('badge', { 25 | dot: true 26 | }); 27 | expect(comp).toMatchSnapshot(); 28 | }); 29 | }); 30 | -------------------------------------------------------------------------------- /packages/weapp/src/badge/index.json: -------------------------------------------------------------------------------- 1 | { 2 | "component": true, 3 | "usingComponents": { 4 | "ti-icon": "../icon/index" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /packages/weapp/src/badge/index.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 9 | {{ content }} 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /packages/weapp/src/badge/index.wxs: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var tools = require('../common/utils/wxs/convertStyles.wxs'); 4 | 5 | function computedStyle(offset, extStyle) { 6 | var style = {}; 7 | if (offset.length === 2) { 8 | style = { 9 | '--badge-top': offset[0] + 'rpx', 10 | '--badge-right': offset[1] + 'rpx' 11 | }; 12 | } 13 | 14 | return tools.convertStyles([style, extStyle]); 15 | } 16 | 17 | module.exports = { 18 | computedStyle: computedStyle 19 | }; 20 | -------------------------------------------------------------------------------- /packages/weapp/src/behaviors/__test__/__snapshots__/link.test.js.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`test behavior link test link navigateTo, props success 1`] = ` 4 |
5 | 9 | pages/root/index 10 | 11 |
12 | `; 13 | -------------------------------------------------------------------------------- /packages/weapp/src/behaviors/color.ts: -------------------------------------------------------------------------------- 1 | import { hexToRGBA, RGBToRGBA } from '../common/utils/color'; 2 | 3 | // const hexRegx = /#[0-9a-fA-F]{6}/; 4 | // const rgbRegx = /rgb\(\s*(?:(\d{1,3})\s*,?){3}\)/; 5 | // const rgbaRegx = /^rgba\((\d{1,3}%?),\s*(\d{1,3}%?),\s*(\d{1,3}%?),\s*(\d*(?:\.\d+)?)\)$/; 6 | 7 | const color = Behavior({ 8 | properties: { 9 | // 颜色 10 | color: String 11 | }, 12 | data: { 13 | rgbaColor: '' 14 | }, 15 | observers: { 16 | color(colorStr) { 17 | colorStr = colorStr.trim(); 18 | if (!colorStr) return; 19 | let rgbaColor = ''; 20 | if (colorStr.includes('#')) { 21 | rgbaColor = hexToRGBA(colorStr); 22 | } else if (colorStr.includes('rgba')) { 23 | rgbaColor = colorStr; 24 | } else if (colorStr.includes('rgb')) { 25 | rgbaColor = RGBToRGBA(colorStr); 26 | } 27 | 28 | this.setData({ 29 | rgbaColor 30 | }); 31 | } 32 | } 33 | }); 34 | 35 | export default color; 36 | -------------------------------------------------------------------------------- /packages/weapp/src/behaviors/link.ts: -------------------------------------------------------------------------------- 1 | export type JumpType = 'redirectTo'; 2 | const link = Behavior({ 3 | properties: { 4 | // 跳转路径 5 | link: String, 6 | 7 | // 跳转方式 8 | jumpType: { 9 | type: String, 10 | value: 'navigateTo' 11 | } 12 | }, 13 | methods: { 14 | jumpToLink() { 15 | const { link: url, jumpType } = this.data; 16 | if (url) { 17 | if (jumpType === 'navigateTo' && getCurrentPages().length > 9) { 18 | wx.redirectTo({ url }).then((r) => r); 19 | return; 20 | } 21 | const fn = wx[jumpType as JumpType]; 22 | fn({ url }); 23 | } 24 | } 25 | } 26 | }); 27 | 28 | export default link; 29 | -------------------------------------------------------------------------------- /packages/weapp/src/button/const.ts: -------------------------------------------------------------------------------- 1 | enum EButtonVariant { 2 | /** 实心 */ 3 | CONTAINED = 'contained', 4 | 5 | /** 填充 */ 6 | FILLED = 'filled', 7 | 8 | /** 描边 */ 9 | OUTLINED = 'outlined', 10 | 11 | /** 文字 */ 12 | TEXT = 'text' 13 | } 14 | 15 | enum EButtonSize { 16 | TINY = 'tiny', 17 | SMALL = 'small', 18 | MEDIUM = 'medium', 19 | BIG = 'big', 20 | LARGE = 'large' 21 | } 22 | 23 | enum EButtonShape { 24 | /** 圆角胶囊 */ 25 | CAPSULE = 'capsule', 26 | 27 | /** 圆角 */ 28 | ROUND = 'round', 29 | 30 | /** 矩形 */ 31 | RECT = 'rect' 32 | } 33 | 34 | enum EButtonType { 35 | /** 默认主题 */ 36 | PRIMARY = 'primary', 37 | 38 | /** 警告 */ 39 | WARNING = 'warning', 40 | 41 | /** 错误 */ 42 | ERROR = 'error', 43 | 44 | /** 成功 */ 45 | SUCCESS = 'success', 46 | 47 | /** 信息 */ 48 | INFO = 'info', 49 | 50 | /** outlined 模式下可用,灰色调 */ 51 | SIMPLE = 'simple' 52 | } 53 | 54 | export { EButtonVariant, EButtonSize, EButtonShape, EButtonType }; 55 | -------------------------------------------------------------------------------- /packages/weapp/src/button/index.json: -------------------------------------------------------------------------------- 1 | { 2 | "component": true, 3 | "usingComponents": { 4 | "ti-icon": "../icon/index", 5 | "ti-loading": "../loading/index" 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /packages/weapp/src/calendar/index.json: -------------------------------------------------------------------------------- 1 | { 2 | "component": true, 3 | "usingComponents": { 4 | "ti-button": "../button/index", 5 | "ti-popup": "../popup/index", 6 | "ti-popup-titlebar": "../popup-title-bar/index" 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /packages/weapp/src/cascade/index.json: -------------------------------------------------------------------------------- 1 | { 2 | "component": true, 3 | "usingComponents": { 4 | "ti-popup-titlebar": "../popup-title-bar/index", 5 | "ti-checkbox": "../checkbox/index" 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /packages/weapp/src/cascade/index.wxs: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | var namespace = require('../common/utils/wxs/namespace.wxs'); 3 | 4 | module.exports = { 5 | completedClass: function (data) { 6 | return namespace.handle('cascade', [ 7 | 'tab', 8 | (data.columnValueList[data.index] || {})[data.label] ? 'value' : '', 9 | data.active === data.index ? 'active' : '' 10 | ]); 11 | }, 12 | completedTabs: function (data) { 13 | return (data.columnValueList[data.index] || {})[data.label] || data.item; 14 | }, 15 | completedScrollIntoView: function (data) { 16 | if (!data.columnValueList[data.index]) { 17 | return ''; 18 | } 19 | return 'opt_' + data.index + '_' + data.columnValueList[data.index][data.code]; 20 | }, 21 | completedCheckbox: function (data) { 22 | var value = data.columnValueList[data.index]; 23 | if (!value) { 24 | return false; 25 | } 26 | if (!value[data.code]) { 27 | return false; 28 | } 29 | return value[data.code] === data.opt[data.code]; 30 | } 31 | }; 32 | -------------------------------------------------------------------------------- /packages/weapp/src/cell-group/__test__/cell-group.test.js: -------------------------------------------------------------------------------- 1 | const { getComponent } = require('../../common/test/getComponent'); 2 | 3 | describe('test component', () => { 4 | it('should render success', () => { 5 | const comp = getComponent('cell-group'); 6 | expect(comp).toMatchSnapshot(); 7 | }); 8 | 9 | it('should render title、subTitle success', () => { 10 | const comp = getComponent('cell-group', { 11 | title: '标题', 12 | subTitle: '副标题' 13 | }); 14 | expect(comp).toMatchSnapshot(); 15 | }); 16 | 17 | it('should render different mode success', () => { 18 | const comp = getComponent('cell-group', { 19 | mode: 'card' 20 | }); 21 | 22 | expect(comp).toMatchSnapshot(); 23 | }); 24 | }); 25 | -------------------------------------------------------------------------------- /packages/weapp/src/cell-group/index.json: -------------------------------------------------------------------------------- 1 | { 2 | "component": true 3 | } 4 | -------------------------------------------------------------------------------- /packages/weapp/src/cell-group/index.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | {{ title }} 7 | {{ subTitle }} 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /packages/weapp/src/cell/index.json: -------------------------------------------------------------------------------- 1 | { 2 | "component": true, 3 | "usingComponents": { 4 | "ti-icon": "../icon/index" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /packages/weapp/src/cell/index.wxs: -------------------------------------------------------------------------------- 1 | var _require = require('../common/utils/wxs/convertStyles.wxs'); 2 | var convertStyles = _require.convertStyles; 3 | 4 | var wxsUtils = require('../common/utils/wxs/index.wxs'); 5 | 6 | var completedStyles = function (data) { 7 | return convertStyles([ 8 | { 9 | 'align-items': data.alignItems 10 | }, 11 | data['extStyle'] 12 | ]); 13 | }; 14 | 15 | var completedArrow = function (data) { 16 | if (wxsUtils.isString(data.rightIcon) && wxsUtils.isNotEmpty(data.rightIcon)) { 17 | return data.rightIcon; 18 | } 19 | return 'arrow-right'; 20 | }; 21 | 22 | function completedSubDescStyles(data) { 23 | if (!data.desc) { 24 | return 'display:flex'; 25 | } 26 | if (data.rightIcon || data.arrow || data.link) { 27 | return 'padding-right: 32rpx;'; 28 | } 29 | } 30 | 31 | module.exports = { 32 | completedSubDescStyles: completedSubDescStyles, 33 | completedStyles: completedStyles, 34 | completedArrow: completedArrow 35 | }; 36 | -------------------------------------------------------------------------------- /packages/weapp/src/checkbox-button/index.json: -------------------------------------------------------------------------------- 1 | { 2 | "component": true, 3 | "usingComponents": { 4 | "ti-tag": "../tag/index" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /packages/weapp/src/checkbox-button/index.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 8 | 9 | {{ label }} 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /packages/weapp/src/checkbox-group/__test__/checkbox-group.test.js: -------------------------------------------------------------------------------- 1 | const simulate = require('miniprogram-simulate'); 2 | const { getComponent } = require('../../common/test/getComponent'); 3 | 4 | describe('test component', () => { 5 | it('should render success', () => { 6 | const comp = getComponent('checkbox-group'); 7 | comp.triggerLifeTime('attached'); 8 | expect(comp).toMatchSnapshot(); 9 | }); 10 | 11 | it('should render options props success', async () => { 12 | const options = [ 13 | { value: 'a', label: '选项 A' }, 14 | { value: 'b', label: '选项 B' }, 15 | { 16 | value: 'c', 17 | label: '选项 C' 18 | } 19 | ]; 20 | const comp = getComponent('checkbox-group', { 21 | options, 22 | max: 1, 23 | name: 'test', 24 | value: ['a', 'c'] 25 | }); 26 | 27 | comp.triggerLifeTime('attached'); 28 | await simulate.sleep(300); 29 | expect(comp).toMatchSnapshot(); 30 | }); 31 | }); 32 | -------------------------------------------------------------------------------- /packages/weapp/src/checkbox-group/index.json: -------------------------------------------------------------------------------- 1 | { 2 | "component": true, 3 | "usingComponents": { 4 | "ti-checkbox": "../checkbox/index" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /packages/weapp/src/checkbox-group/index.less: -------------------------------------------------------------------------------- 1 | @import '../common/static/var'; 2 | @import '../common/static/utils'; 3 | @import '../common/static/mixins/index.less'; 4 | 5 | @checkboxGroup: ~'@{project}-checkbox-group'; 6 | 7 | :host { 8 | display: contents; 9 | } 10 | 11 | .@{checkboxGroup} { 12 | &-vertical { 13 | display: flex; 14 | flex-direction: column; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /packages/weapp/src/checkbox-group/index.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /packages/weapp/src/checkbox/index.json: -------------------------------------------------------------------------------- 1 | { 2 | "component": true, 3 | "usingComponents": { 4 | "ti-icon": "../icon/index" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /packages/weapp/src/checkbox/index.wxs: -------------------------------------------------------------------------------- 1 | var stylesUtils = require('../common/utils/wxs/convertStyles.wxs'); 2 | var borderRadiusUtils = require('../common/utils/wxs/borderRadius.wxs'); 3 | 4 | function completedStyles(data) { 5 | data.size = data.size || 32; 6 | if (data.shape === 'circle' || data.shape === 'square') { 7 | return borderRadiusUtils.handler(data.shape) + '; height: ' + data.size + 'rpx'; 8 | } 9 | 10 | var style = { 11 | height: data.size + 'rpx' 12 | }; 13 | 14 | style['--base-radius-size'] = (data.shape ? data.shape : data.size) + 'rpx'; 15 | 16 | return stylesUtils.convertStyles(style); 17 | } 18 | function completedIconStyles(data) { 19 | var style = {}; 20 | if (data.color) { 21 | style['background-color'] = data.color; 22 | } 23 | if (data.size) { 24 | style['width'] = style['height'] = style['line-height'] = data.size + 'rpx'; 25 | } 26 | return stylesUtils.convertStyles(style); 27 | } 28 | module.exports = { 29 | completedStyles: completedStyles, 30 | completedIconStyles: completedIconStyles 31 | }; 32 | -------------------------------------------------------------------------------- /packages/weapp/src/circle-progress/__test__/__snapshots__/circle-progress.test.js.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`test component should render success 1`] = ` 4 |
5 | 8 | 13 | 14 |
15 | `; 16 | -------------------------------------------------------------------------------- /packages/weapp/src/circle-progress/__test__/circle-progress.test.js: -------------------------------------------------------------------------------- 1 | const { getComponent } = require('../../common/test/getComponent'); 2 | 3 | describe('test component', () => { 4 | it('should render success', () => { 5 | const comp = getComponent('circle-progress'); 6 | expect(comp).toMatchSnapshot(); 7 | }); 8 | }); 9 | -------------------------------------------------------------------------------- /packages/weapp/src/circle-progress/index.json: -------------------------------------------------------------------------------- 1 | { 2 | "component": true 3 | } 4 | -------------------------------------------------------------------------------- /packages/weapp/src/circle-progress/index.less: -------------------------------------------------------------------------------- 1 | @import '../common/static/var'; 2 | @import '../common/static/utils'; 3 | @import '../common/static/mixins/index.less'; 4 | 5 | @circleProgress: ~'@{project}-circle-progress'; 6 | 7 | :host { 8 | display: contents; 9 | } 10 | .@{circleProgress} { 11 | display: inline-flex; 12 | position: relative; 13 | overflow: hidden; 14 | 15 | &-canvas { 16 | color: @brand-color; 17 | } 18 | 19 | &-text { 20 | position: absolute; 21 | top: 50%; 22 | left: 50%; 23 | 24 | transform: translate(-50%, -50%); 25 | 26 | font-size: 28px; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /packages/weapp/src/circle-progress/index.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 10 | 15 | {{ value }}% 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /packages/weapp/src/circle-progress/index.wxs: -------------------------------------------------------------------------------- 1 | var stylesUtils = require('../common/utils/wxs/convertStyles.wxs'); 2 | 3 | function convertCircleProgressStyle(data) { 4 | var style = {}; 5 | if (data.color) { 6 | style.color = data.color; 7 | } 8 | if (data.size) { 9 | style.width = data.size + 'rpx'; 10 | style.height = data.size + 'rpx'; 11 | } 12 | if (data.font) { 13 | style.font = data.font; 14 | } 15 | return stylesUtils.convertStyles(style); 16 | } 17 | 18 | module.exports = { 19 | convertCircleProgressStyle: convertCircleProgressStyle 20 | }; 21 | -------------------------------------------------------------------------------- /packages/weapp/src/col/index.json: -------------------------------------------------------------------------------- 1 | { 2 | "component": true, 3 | "usingComponents": {} 4 | } 5 | -------------------------------------------------------------------------------- /packages/weapp/src/col/index.less: -------------------------------------------------------------------------------- 1 | @import '../common/static/utils'; 2 | @import '../common/static/var.less'; 3 | @import '../common/static/mixins/index.less'; 4 | 5 | @col: ~'@{project}-col'; 6 | @numCol: 24; 7 | 8 | :host { 9 | display: contents; 10 | } 11 | 12 | .@{col} { 13 | box-sizing: border-box; 14 | min-height: 1px; 15 | float: left; 16 | } 17 | 18 | .@{col}-0 { 19 | display: none; 20 | } 21 | 22 | .generate(@numCol); 23 | 24 | .generate(@n, @i: 1) when (@i =< @n) { 25 | .@{col}-@{i} { 26 | width: @i * (100% / @numCol); 27 | } 28 | 29 | .@{col}-flex-@{i} { 30 | flex: 0 0 @i * (100% / @numCol); 31 | } 32 | 33 | .@{col}-offset-@{i} { 34 | margin-left: @i * (100% / @numCol); 35 | } 36 | .generate(@n, (@i + 1)); 37 | } 38 | -------------------------------------------------------------------------------- /packages/weapp/src/col/index.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /packages/weapp/src/col/index.wxs: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | var _require = require('../common/utils/wxs/convertStyles.wxs'); 3 | var convertStyles = _require.convertStyles; 4 | 5 | function completedStyles(gutter) { 6 | var num = gutter / 2; 7 | 8 | return convertStyles({ 9 | 'padding-left': num + 'rpx', 10 | 'padding-right': num + 'rpx' 11 | }); 12 | } 13 | 14 | module.exports = { 15 | completedStyle: completedStyles 16 | }; 17 | -------------------------------------------------------------------------------- /packages/weapp/src/collapse-item/index.json: -------------------------------------------------------------------------------- 1 | { 2 | "component": true, 3 | "usingComponents": { 4 | "ti-cell": "../cell/index", 5 | "ti-icon": "../icon/index" 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /packages/weapp/src/collapse-item/index.wxs: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | var CollapseItemStateEnum = { 3 | FOLD: 'fold', // 收起 4 | UN_FOLD: 'un_fold' // 展开 5 | }; 6 | function completedStatus(status) { 7 | return status === CollapseItemStateEnum.UN_FOLD; 8 | } 9 | 10 | module.exports = { 11 | completedStatus: completedStatus 12 | }; 13 | -------------------------------------------------------------------------------- /packages/weapp/src/collapse/__test__/__snapshots__/collapse.test.js.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`test component should render success 1`] = `
`; 4 | -------------------------------------------------------------------------------- /packages/weapp/src/collapse/__test__/mock/index.js: -------------------------------------------------------------------------------- 1 | const comm = { 2 | props: { 3 | value: [1], 4 | options: [ 5 | { 6 | title: '标题文字A', 7 | content: '- 标题A下的内容 -' 8 | }, 9 | { 10 | title: '标题文字B', 11 | content: '- 标题B下的内容 -' 12 | } 13 | ] 14 | }, 15 | params: {}, 16 | open: [0], 17 | close: [0, 1], 18 | expect: ['标题文字B', [1, 0], [1], []] 19 | }; 20 | const data = [ 21 | { ...comm, label: '常规场景1' }, 22 | { 23 | ...comm, 24 | label: '常规场景2 互斥', 25 | open: [0, 1], 26 | close: [0], 27 | props: { ...comm.props, repel: true }, 28 | expect: ['标题文字B', 0, '', 1] 29 | } 30 | ]; 31 | 32 | module.exports.data = data; 33 | -------------------------------------------------------------------------------- /packages/weapp/src/collapse/index.json: -------------------------------------------------------------------------------- 1 | { 2 | "component": true, 3 | "usingComponents": { 4 | "ti-collapse-item": "../collapse-item/index" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /packages/weapp/src/collapse/index.wxml: -------------------------------------------------------------------------------- 1 | 2 | 17 | {{ item.content || '' }} 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /packages/weapp/src/common/interface/index.ts: -------------------------------------------------------------------------------- 1 | export type OmitType = Pick; 2 | 3 | export type Key = string | number | symbol; 4 | 5 | export type IAnyObject = { [key: Key]: unknown }; 6 | 7 | export type IAnyMap = Map; 8 | 9 | export type PropertyToData = 10 | | T 11 | | WechatMiniprogram.Component.FullProperty; 12 | -------------------------------------------------------------------------------- /packages/weapp/src/common/static/mixins/clearfix.less: -------------------------------------------------------------------------------- 1 | .clearfix() { 2 | &::before { 3 | content: ''; 4 | 5 | display: table; 6 | } 7 | 8 | &::after { 9 | content: ''; 10 | 11 | display: table; 12 | clear: both; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /packages/weapp/src/common/static/mixins/ellipsis.less: -------------------------------------------------------------------------------- 1 | .ellipsis-lines(@lines: 2) { 2 | display: -webkit-box; 3 | overflow: hidden; 4 | 5 | text-overflow: ellipsis; 6 | -webkit-line-clamp: @lines; 7 | -webkit-box-orient: vertical; 8 | } 9 | 10 | .ellipsis() { 11 | overflow: hidden; 12 | 13 | text-overflow: ellipsis; 14 | white-space: nowrap; 15 | } 16 | -------------------------------------------------------------------------------- /packages/weapp/src/common/static/mixins/expand-click.less: -------------------------------------------------------------------------------- 1 | .expand-click(@size: 44px) { 2 | content: ''; 3 | 4 | position: absolute; 5 | top: 50%; 6 | left: 50%; 7 | width: @size; 8 | height: @size; 9 | 10 | transform: translate(-50%, -50%); 11 | } 12 | -------------------------------------------------------------------------------- /packages/weapp/src/common/static/mixins/index.less: -------------------------------------------------------------------------------- 1 | @import './hairline.less'; 2 | @import '../utils.less'; 3 | @import './ellipsis.less'; 4 | @import './clearfix.less'; 5 | @import './position.less'; 6 | @import './expand-click.less'; 7 | -------------------------------------------------------------------------------- /packages/weapp/src/common/static/mixins/position.less: -------------------------------------------------------------------------------- 1 | .abs-pos(@top: 0px, @right: 0px, @bottom: 0px, @left: 0px) { 2 | top: @top; 3 | right: @right; 4 | bottom: @bottom; 5 | left: @left; 6 | } 7 | 8 | .fixed-pos(@top: 0px, @right: 0px, @bottom: 0px, @left: 0px) { 9 | .abs-pos(@top: 0px, @right: 0px, @bottom: 0px, @left: 0px); 10 | } 11 | -------------------------------------------------------------------------------- /packages/weapp/src/common/static/utils.less: -------------------------------------------------------------------------------- 1 | @project: titian; 2 | -------------------------------------------------------------------------------- /packages/weapp/src/common/utils/version.ts: -------------------------------------------------------------------------------- 1 | import { getSystemInfoSync } from './index'; 2 | 3 | function compareVersion(v1: string, v2: string) { 4 | const v1Copy = v1.split('.'); 5 | const v2Copy = v2.split('.'); 6 | const len = Math.max(v1Copy.length, v2Copy.length); 7 | while (v1Copy.length < len) { 8 | v1Copy.push('0'); 9 | } 10 | while (v2Copy.length < len) { 11 | v2Copy.push('0'); 12 | } 13 | let i = 0; 14 | for (i = 0; i < len; i += 1) { 15 | const num1 = parseInt(v1Copy[i], 10); 16 | const num2 = parseInt(v2Copy[i], 10); 17 | if (num1 > num2) { 18 | return 1; 19 | } 20 | if (num1 < num2) { 21 | return -1; 22 | } 23 | } 24 | return 0; 25 | } 26 | 27 | export function canIUseFormFieldButton(): boolean { 28 | let result = false; 29 | 30 | const system = getSystemInfoSync(); 31 | result = compareVersion(system.SDKVersion, '2.10.3') >= 0; 32 | 33 | return result; 34 | } 35 | -------------------------------------------------------------------------------- /packages/weapp/src/common/utils/wxs/borderRadius.wxs: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var tools = require('./convertStyles.wxs'); 4 | 5 | function computedStyle(shape) { 6 | var style = {}; 7 | if (shape === 'capsule' || shape === 'circle') { 8 | style['--base-radius-size'] = '999px'; 9 | } else if (shape === 'rect' || shape === 'square') { 10 | style['--base-radius-size'] = '-999px'; 11 | } 12 | return tools.convertStyles(style); 13 | } 14 | 15 | module.exports = { 16 | handler: computedStyle 17 | }; 18 | -------------------------------------------------------------------------------- /packages/weapp/src/common/utils/wxs/convertStyles.wxs: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var utils = require('./index.wxs'); 4 | 5 | function convertStylesWxs(styles) { 6 | if (utils.isPlainArray(styles)) { 7 | return styles 8 | .filter(function (item) { 9 | return item != null && item !== ''; 10 | }) 11 | .map(function (item) { 12 | return convertStylesWxs(item); 13 | }) 14 | .join(';'); 15 | } 16 | 17 | if (styles.constructor === 'Object') { 18 | return utils 19 | .keys(styles) 20 | .filter(function (key) { 21 | return styles[key] != null && styles[key] !== ''; 22 | }) 23 | .map(function (key) { 24 | return [key, [styles[key]]].join(':'); 25 | }) 26 | .join(';'); 27 | } 28 | 29 | return styles; 30 | } 31 | 32 | module.exports = { 33 | convertStyles: convertStylesWxs 34 | }; 35 | -------------------------------------------------------------------------------- /packages/weapp/src/common/utils/wxs/suffix.wxs: -------------------------------------------------------------------------------- 1 | // prettier-ignore 2 | var REGEXP = getRegExp('^-?[0-9]+(\.[0-9]+)?$'); 3 | 4 | // 添加rpx单位 5 | function addUnit(value) { 6 | if (REGEXP.test(value)) { 7 | return value + 'rpx'; 8 | } 9 | return value; 10 | } 11 | 12 | module.exports = { 13 | addUnit: addUnit 14 | }; 15 | -------------------------------------------------------------------------------- /packages/weapp/src/common/utils/wxs/wxUtils.wxs: -------------------------------------------------------------------------------- 1 | var REGEXP = getRegExp('{|}|"', 'g'); // eslint-disable-next-line @typescript-eslint/no-explicit-any 2 | 3 | var toTypeString = function toTypeString(val) { 4 | return val && val.constructor; 5 | }; 6 | 7 | module.exports = { 8 | toTypeString: toTypeString, 9 | REGEXP: REGEXP 10 | }; 11 | -------------------------------------------------------------------------------- /packages/weapp/src/common/utils/zIndexTool.ts: -------------------------------------------------------------------------------- 1 | export default (() => { 2 | let zIndex = 10000; 3 | return { 4 | getZIndex() { 5 | zIndex += 1; 6 | return zIndex; 7 | } 8 | }; 9 | })(); 10 | -------------------------------------------------------------------------------- /packages/weapp/src/countdown/index.json: -------------------------------------------------------------------------------- 1 | { 2 | "component": true, 3 | "usingComponents": { 4 | "ti-icon": "../icon/index" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /packages/weapp/src/countdown/index.wxs: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | function show(format, tag, mark) { 4 | if (!format) return true; 5 | var res = format.indexOf(tag) > -1; 6 | if (!mark) return res; 7 | if (tag === 'H') { 8 | var more = format.indexOf('m') > -1 || format.indexOf('s') > -1 || format.indexOf('S') > -1; 9 | return res && more; 10 | } else if (tag === 'm') { 11 | var more = format.indexOf('s') > -1 || format.indexOf('S') > -1; 12 | return res && more; 13 | } else if (tag === 's') { 14 | var more = format.indexOf('S') > -1; 15 | return res && more; 16 | } else { 17 | return res; 18 | } 19 | } 20 | 21 | function indexOf(str, value) { 22 | return str.indexOf(value); 23 | } 24 | 25 | module.exports = { 26 | show: show, 27 | indexOf: indexOf 28 | }; 29 | -------------------------------------------------------------------------------- /packages/weapp/src/datetime-picker/index.json: -------------------------------------------------------------------------------- 1 | { 2 | "component": true, 3 | "usingComponents": { 4 | "ti-picker": "../picker/index", 5 | "ti-picker-column": "../picker-column/index" 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /packages/weapp/src/datetime-picker/index.less: -------------------------------------------------------------------------------- 1 | @import '../common/static/utils.less'; 2 | @import '../common/static/var.less'; 3 | @import '../common/static/mixins/index.less'; 4 | 5 | @datetimePicker: ~'@{project}-datetime-picker'; 6 | 7 | .@{datetimePicker} { 8 | position: relative; 9 | 10 | --protected-picker-mask-bg-image: @datetime-picker-mask-bg-image; 11 | --protected-picker-loading-bg-color: @datetime-picker-loading-bg-color; 12 | --protected-picker-row-color: @datetime-picker-row-color; 13 | --protected-picker-row-selected-color: @datetime-picker-row-selected-color; 14 | --protected-picker-row-disabled-color: @datetime-picker-row-disabled-color; 15 | } 16 | -------------------------------------------------------------------------------- /packages/weapp/src/dialog/index.json: -------------------------------------------------------------------------------- 1 | { 2 | "component": true, 3 | "usingComponents": { 4 | "ti-popup": "../popup/index", 5 | "ti-button": "../button/index" 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /packages/weapp/src/dialog/types.ts: -------------------------------------------------------------------------------- 1 | export interface IDialogProps { 2 | title?: string; 3 | content?: string; 4 | hasCancelButton?: boolean; 5 | cancelBtnText?: string; 6 | confirmBtnText?: string; 7 | isTextButton?: boolean; 8 | extClass?: string; 9 | extStyle?: string; 10 | } 11 | 12 | export interface IDialogStaticOptions { 13 | confirmBtnText: string; 14 | cancelBtnText: string; 15 | isTextButton: boolean; 16 | hasCancelButton: boolean; 17 | onCancel: () => void; 18 | onClose: () => void; 19 | onConfirm: () => void; 20 | } 21 | -------------------------------------------------------------------------------- /packages/weapp/src/divider/const.ts: -------------------------------------------------------------------------------- 1 | enum EDividerPosition { 2 | /** 中 */ 3 | CENTER = 'center', 4 | 5 | /** 中 */ 6 | LEFT = 'left', 7 | 8 | /** 右 */ 9 | RIGHT = 'right' 10 | } 11 | 12 | enum EDividerOrientation { 13 | /** 横向 */ 14 | HORIZONTAL = 'horizontal', 15 | 16 | /** 纵向 */ 17 | VERTICAL = 'vertical' 18 | } 19 | 20 | export { EDividerPosition, EDividerOrientation }; 21 | -------------------------------------------------------------------------------- /packages/weapp/src/divider/index.json: -------------------------------------------------------------------------------- 1 | { 2 | "component": true, 3 | "usingComponents": {} 4 | } 5 | -------------------------------------------------------------------------------- /packages/weapp/src/divider/index.ts: -------------------------------------------------------------------------------- 1 | import BasicComponent from '../common/basic/BasicComponent'; 2 | import { EDividerPosition, EDividerOrientation } from './const'; 3 | 4 | BasicComponent({ 5 | properties: { 6 | // 虚线 7 | dashed: Boolean, 8 | 9 | // 发丝线 10 | hairline: Boolean, 11 | 12 | // 文本位置,可选值left、center、right 13 | textAlign: { 14 | type: String, 15 | value: EDividerPosition.CENTER 16 | }, 17 | 18 | // 颜色,包括分割线和文字 19 | color: String, 20 | 21 | // 分割线颜色 22 | borderColor: String, 23 | 24 | // 分割线厚度 25 | borderWidth: { 26 | type: Number, 27 | value: 2 28 | }, 29 | 30 | // 分割线方向 31 | orientation: { 32 | type: String, 33 | value: EDividerOrientation.HORIZONTAL 34 | }, 35 | 36 | // 根节点样式 37 | extStyle: String 38 | } 39 | }); 40 | -------------------------------------------------------------------------------- /packages/weapp/src/divider/index.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /packages/weapp/src/divider/index.wxs: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var tools = require('../common/utils/wxs/convertStyles.wxs'); 4 | 5 | function computedStyle(color, borderColor, borderWidth, dashed, extStyle) { 6 | var style = { 7 | color: color, 8 | '--divider-color': color 9 | }; 10 | if (dashed) { 11 | style['--divider-style'] = 'dashed'; 12 | } else { 13 | style['--divider-background'] = borderColor; 14 | } 15 | if (borderColor) { 16 | style['--divider-color'] = borderColor; 17 | } 18 | if (borderWidth) { 19 | borderWidth = borderWidth > 2 ? borderWidth : 2; 20 | style['--divider-width'] = borderWidth + 'rpx'; 21 | } 22 | return tools.convertStyles([style, extStyle]); 23 | } 24 | 25 | module.exports = { 26 | computedStyle: computedStyle 27 | }; 28 | -------------------------------------------------------------------------------- /packages/weapp/src/dropdown-item/__test__/index.js: -------------------------------------------------------------------------------- 1 | Component({ 2 | data: { 3 | multiple: false, 4 | visible: false, 5 | options: [ 6 | { 7 | title: '选项1', 8 | value: '1' 9 | }, 10 | { 11 | title: '选项2', 12 | value: '2' 13 | } 14 | ] 15 | }, 16 | methods: { 17 | onSubmit(e) { 18 | this.setData({ 19 | value: e.detail.value 20 | }); 21 | }, 22 | onChange(e) { 23 | this.setData({ 24 | changeValue: e.detail.value 25 | }); 26 | }, 27 | onClose() { 28 | this.setData({ 29 | visible: false 30 | }); 31 | }, 32 | onOpen() { 33 | this.setData({ 34 | visible: true 35 | }); 36 | } 37 | } 38 | }); 39 | -------------------------------------------------------------------------------- /packages/weapp/src/dropdown-item/__test__/index.json: -------------------------------------------------------------------------------- 1 | { 2 | "component": true, 3 | "usingComponents": { 4 | "ti-dropdown-menu": "../../dropdown-menu/index", 5 | "ti-dropdown-item": "../index" 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /packages/weapp/src/dropdown-item/__test__/index.wxml: -------------------------------------------------------------------------------- 1 | 2 | 14 | 15 | item1 16 | 17 | 18 | -------------------------------------------------------------------------------- /packages/weapp/src/dropdown-item/index.json: -------------------------------------------------------------------------------- 1 | { 2 | "component": true, 3 | "usingComponents": { 4 | "ti-switch": "../switch/index", 5 | "ti-button": "../button/index", 6 | "ti-icon": "../icon/index", 7 | "ti-popup": "../popup/index", 8 | "ti-cell": "../cell/index" 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /packages/weapp/src/dropdown-item/index.less: -------------------------------------------------------------------------------- 1 | @import '../common/static/var'; 2 | @import '../common/static/utils'; 3 | @import '../common/static/mixins/index.less'; 4 | 5 | @dropdownItem: ~'@{project}-dropdown-item'; 6 | 7 | .@{dropdownItem} { 8 | display: none; 9 | position: fixed; 10 | z-index: 1000; 11 | top: 0; 12 | right: 0; 13 | bottom: 0; 14 | left: 0; 15 | overflow: hidden; 16 | 17 | --popup-position: absolute; 18 | 19 | &-visible { 20 | display: block; 21 | } 22 | 23 | &-cell-active { 24 | --cell-title-text-color: @dropdown-label-active-color; 25 | } 26 | 27 | &-select-icon { 28 | color: @dropdown-select-icon-color; 29 | } 30 | 31 | &-submit { 32 | margin: @gap-16 @gap-28; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /packages/weapp/src/dropdown-item/index.wxs: -------------------------------------------------------------------------------- 1 | var utils = require('../common/utils/wxs/index.wxs'); 2 | 3 | function getActiveStatus(data) { 4 | var value = data.value.split(','); 5 | 6 | return value.indexOf(data.itemVal) > -1; 7 | } 8 | 9 | module.exports = { 10 | getActiveStatus: getActiveStatus 11 | }; 12 | -------------------------------------------------------------------------------- /packages/weapp/src/dropdown-menu/index.json: -------------------------------------------------------------------------------- 1 | { 2 | "component": true, 3 | "usingComponents": { 4 | "ti-button": "../button/index", 5 | "ti-icon": "../icon/index" 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /packages/weapp/src/dropdown-menu/index.less: -------------------------------------------------------------------------------- 1 | @import '../common/static/var'; 2 | @import '../common/static/utils'; 3 | @import '../common/static/mixins/index.less'; 4 | 5 | @dropdownMenu: ~'@{project}-dropdown-menu'; 6 | 7 | .@{dropdownMenu} { 8 | &-title-wrap { 9 | display: flex; 10 | 11 | background-color: @dropdown-menu-title-wrap-bg-color; 12 | } 13 | 14 | &-title { 15 | flex: 1; 16 | 17 | --button-font-weight: @dropdown-title-font-weight; 18 | } 19 | 20 | &-icon { 21 | margin-left: @dropdown-menu-icon-margin-left; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /packages/weapp/src/dropdown-menu/index.wxs: -------------------------------------------------------------------------------- 1 | var utils = require('../common/utils/wxs/convertStyles.wxs'); 2 | 3 | function completedStyle(data) { 4 | var styles = {}; 5 | 6 | if (data.activeColor) { 7 | styles['--dropdown-active-color'] = data.activeColor; 8 | } 9 | 10 | if (data.mode === 'multiple') { 11 | styles['--dropdown-label-active-color'] = 'black'; 12 | } else { 13 | styles['--dropdown-label-active-color'] = data.activeColor; 14 | } 15 | 16 | return utils.convertStyles(styles); 17 | } 18 | 19 | module.exports = { 20 | completedStyle: completedStyle 21 | }; 22 | -------------------------------------------------------------------------------- /packages/weapp/src/empty/__test__/__snapshots__/empty.test.js.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`test component should render success 1`] = ` 4 |
5 | 10 | 14 | 15 |
16 | `; 17 | -------------------------------------------------------------------------------- /packages/weapp/src/empty/__test__/empty.test.js: -------------------------------------------------------------------------------- 1 | const simulate = require('miniprogram-simulate'); 2 | const { getComponent } = require('../../common/test/getComponent'); 3 | 4 | describe('test component', () => { 5 | it('should render success', async () => { 6 | const comp = getComponent('empty'); 7 | const clickCallback = jest.fn(); 8 | comp.addEventListener('click', clickCallback); 9 | 10 | expect(comp).toMatchSnapshot(); 11 | 12 | comp.querySelector('.titian-empty').dispatchEvent('tap'); 13 | await simulate.sleep(0); 14 | 15 | expect(clickCallback).toHaveBeenCalledTimes(1); 16 | }); 17 | }); 18 | -------------------------------------------------------------------------------- /packages/weapp/src/empty/index.json: -------------------------------------------------------------------------------- 1 | { 2 | "component": true 3 | } 4 | -------------------------------------------------------------------------------- /packages/weapp/src/empty/index.ts: -------------------------------------------------------------------------------- 1 | import BasicComponent from '../common/basic/BasicComponent'; 2 | 3 | BasicComponent({ 4 | properties: { 5 | image: { 6 | type: String, 7 | value: 'https://cdn2.weimob.com/saas/saas-fe-sirius-orion-node/production/145/searchwithnoresult.png' 8 | }, 9 | size: { 10 | type: String, 11 | value: 'medium' // `medium` `big` 12 | }, 13 | title: String, 14 | subTitle: String, 15 | 16 | extStyle: String, 17 | useImageSlot: Boolean, 18 | useTitleSlot: Boolean 19 | }, 20 | methods: { 21 | onClick(e: WechatMiniprogram.TouchEvent) { 22 | this.triggerEvent('click', e); 23 | } 24 | } 25 | }); 26 | -------------------------------------------------------------------------------- /packages/weapp/src/empty/index.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | 10 | 11 | 12 | {{ title }} 13 | {{ subTitle }} 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /packages/weapp/src/goods-card/index.json: -------------------------------------------------------------------------------- 1 | { 2 | "component": true, 3 | "usingComponents": { 4 | "ti-image": "../image/index", 5 | "ti-price": "../price/index" 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /packages/weapp/src/goods-card/index.less: -------------------------------------------------------------------------------- 1 | @import '../common/static/var'; 2 | @import '../common/static/utils'; 3 | @import '../common/static/mixins/index.less'; 4 | @goods: ~'@{project}-goods'; 5 | 6 | .@{goods} { 7 | display: flex; 8 | padding: 28px; 9 | 10 | &-title { 11 | flex-grow: 1; 12 | max-width: 434px; 13 | height: 42px; 14 | overflow: hidden; 15 | 16 | font-size: 28px; 17 | line-height: 42px; 18 | text-overflow: ellipsis; 19 | white-space: nowrap; 20 | } 21 | 22 | &-right { 23 | display: flex; 24 | flex-direction: column; 25 | justify-content: flex-end; 26 | margin-left: 24px; 27 | } 28 | 29 | &-stock, 30 | &-selected { 31 | margin-top: 12px; 32 | 33 | color: #9e9e9e; 34 | font-size: 24px; 35 | line-height: 28px; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /packages/weapp/src/goods-card/index.ts: -------------------------------------------------------------------------------- 1 | import BasicComponent from '../common/basic/BasicComponent'; 2 | 3 | interface IGoodsCart { 4 | name: string; 5 | title: string; 6 | imageUrl: string; 7 | priceUnit: string; 8 | price: number; 9 | pricePrefix: string; 10 | pricePostfix: string; 11 | priceLabel: string; 12 | hasSubPrice: boolean; 13 | subPriceLabel: string; 14 | subPrice: number; 15 | stockText: string; 16 | specsText: string; 17 | hasSelectedSpecsText: boolean; 18 | } 19 | 20 | BasicComponent({ 21 | properties: { 22 | goodsData: { 23 | type: Object 24 | }, 25 | extStyle: String 26 | }, 27 | methods: { 28 | onClick(e: WechatMiniprogram.TouchEvent) { 29 | this.triggerEvent('click-image', e); 30 | } 31 | } 32 | }); 33 | -------------------------------------------------------------------------------- /packages/weapp/src/goods-card/index.wxs: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports = {}; 4 | -------------------------------------------------------------------------------- /packages/weapp/src/grid-item/__test__/__snapshots__/grid-item.test.js.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`test component should render success 1`] = ` 4 |
5 | 10 | 15 | 16 | 19 | 20 | 21 |
22 | `; 23 | -------------------------------------------------------------------------------- /packages/weapp/src/grid-item/__test__/grid-item.test.js: -------------------------------------------------------------------------------- 1 | const { getComponent } = require('../../common/test/getComponent'); 2 | 3 | describe('test component', () => { 4 | it('should render success', () => { 5 | const comp = getComponent('grid-item'); 6 | expect(comp).toMatchSnapshot(); 7 | }); 8 | }); 9 | -------------------------------------------------------------------------------- /packages/weapp/src/grid-item/index.json: -------------------------------------------------------------------------------- 1 | { 2 | "component": true, 3 | "usingComponents": { 4 | "ti-icon": "../icon/index" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /packages/weapp/src/grid-item/index.wxs: -------------------------------------------------------------------------------- 1 | var utils = require('../common/utils/wxs/convertStyles.wxs'); 2 | 3 | function completedStyle(data) { 4 | var width = 100 / data.columns + '%'; 5 | var styles = {}; 6 | 7 | styles.width = width; 8 | 9 | if (data.square) { 10 | styles['padding-top'] = width; 11 | } 12 | 13 | if (data.gutter) { 14 | var gutter = data.gutter / 2 + 'px'; 15 | 16 | styles['margin-top'] = gutter; 17 | styles['padding-right'] = gutter; 18 | } 19 | 20 | return utils.convertStyles(styles); 21 | } 22 | 23 | module.exports = { 24 | completedStyle: completedStyle 25 | }; 26 | -------------------------------------------------------------------------------- /packages/weapp/src/grid/__test__/grid.test.js: -------------------------------------------------------------------------------- 1 | const path = require('path'); 2 | const simulate = require('miniprogram-simulate'); 3 | 4 | describe('test component', () => { 5 | const id = simulate.load(path.resolve(__dirname, './index'), { 6 | rootPath: path.join(process.cwd(), 'packages/weapp', 'src') 7 | }); 8 | 9 | it('should render success', async () => { 10 | const clickCallback = jest.fn(); 11 | const container = simulate.render(id); 12 | container.addEventListener('itemClick', clickCallback); 13 | 14 | container.attach(document.createElement('parent-wrapper')); 15 | await simulate.sleep(0); 16 | expect(container.toJSON()).toMatchSnapshot(); 17 | 18 | const item = container.querySelector('.item').querySelector('.titian-grid-item'); 19 | item.dispatchEvent('tap'); 20 | await simulate.sleep(0); 21 | expect(clickCallback).toBeCalled(); 22 | }); 23 | }); 24 | -------------------------------------------------------------------------------- /packages/weapp/src/grid/__test__/index.js: -------------------------------------------------------------------------------- 1 | Component({ 2 | methods: { 3 | itemClick(e) { 4 | this.triggerEvent('itemClick', e); 5 | } 6 | } 7 | }); 8 | -------------------------------------------------------------------------------- /packages/weapp/src/grid/__test__/index.json: -------------------------------------------------------------------------------- 1 | { 2 | "component": true, 3 | "usingComponents": { 4 | "ti-grid-item": "../../grid-item/index", 5 | "ti-grid": "../index" 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /packages/weapp/src/grid/__test__/index.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /packages/weapp/src/grid/index.json: -------------------------------------------------------------------------------- 1 | { 2 | "component": true, 3 | "usingComponents": { 4 | "ti-grid-item": "../grid-item/index" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /packages/weapp/src/grid/index.less: -------------------------------------------------------------------------------- 1 | @import '../common/static/var'; 2 | @import '../common/static/utils'; 3 | @import '../common/static/mixins/index.less'; 4 | 5 | @grid: ~'@{project}-grid'; 6 | 7 | .@{grid} { 8 | display: flex; 9 | position: relative; 10 | box-sizing: border-box; 11 | flex-wrap: wrap; 12 | overflow: hidden; 13 | 14 | background-color: @grid-bg-color; 15 | 16 | &-title { 17 | padding: @grid-title-padding-v @grid-title-padding-h; 18 | 19 | color: @neutral-color-1; 20 | font-size: @T28; 21 | font-weight: @font-weight-400; 22 | line-height: @line-height; 23 | } 24 | 25 | &::before { 26 | .hairline(top); 27 | } 28 | 29 | &::after { 30 | .hairline(left); 31 | } 32 | 33 | &-gutter, 34 | &-borderless { 35 | &::before, 36 | &::after { 37 | content: none; 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /packages/weapp/src/grid/index.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | {{ title }} 7 | 8 | 9 | 10 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /packages/weapp/src/grid/index.wxs: -------------------------------------------------------------------------------- 1 | var utils = require('../common/utils/wxs/convertStyles.wxs'); 2 | 3 | function completedStyle(gutter) { 4 | var styles = {}; 5 | 6 | if (gutter) { 7 | styles['padding-left'] = gutter / 2 + 'px'; 8 | } 9 | 10 | return utils.convertStyles(styles); 11 | } 12 | 13 | module.exports = { 14 | completedStyle: completedStyle 15 | }; 16 | -------------------------------------------------------------------------------- /packages/weapp/src/icon/__test__/__snapshots__/icon.test.js.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`test component should render success 1`] = ` 4 |
5 | 10 |
11 | `; 12 | 13 | exports[`test component should render success 2`] = ` 14 |
15 | 20 |
21 | `; 22 | 23 | exports[`test component should render success 3`] = ` 24 |
25 | 30 |
31 | `; 32 | -------------------------------------------------------------------------------- /packages/weapp/src/icon/__test__/icon.test.js: -------------------------------------------------------------------------------- 1 | const { getComponent } = require('../../common/test/getComponent'); 2 | 3 | describe('test component', () => { 4 | it('should render success', async () => { 5 | const comp = getComponent('icon', { name: 'checkbox' }); 6 | 7 | const clickCallback = jest.fn(); 8 | comp.addEventListener('click', clickCallback); 9 | 10 | expect(comp).toMatchSnapshot(); 11 | 12 | comp.querySelector('.titian-icon').dispatchEvent('tap'); 13 | await Promise.resolve(); 14 | expect(clickCallback).toHaveBeenCalled(); 15 | clickCallback.mockClear(); 16 | 17 | comp.setData({ name: 'rotate', color: ['#000', '#ccc'] }); 18 | await Promise.resolve(); 19 | expect(comp).toMatchSnapshot(); 20 | 21 | comp.setData({ name: 'rotate', color: 'rgba(0,0,0,1)' }); 22 | await Promise.resolve(); 23 | expect(comp).toMatchSnapshot(); 24 | comp.querySelector('.titian-icon').dispatchEvent('tap'); 25 | await Promise.resolve(); 26 | expect(clickCallback).toHaveBeenCalled(); 27 | clickCallback.mockClear(); 28 | }); 29 | }); 30 | -------------------------------------------------------------------------------- /packages/weapp/src/icon/index.json: -------------------------------------------------------------------------------- 1 | { 2 | "component": true 3 | } 4 | -------------------------------------------------------------------------------- /packages/weapp/src/icon/index.ts: -------------------------------------------------------------------------------- 1 | import BasicComponent from '../common/basic/BasicComponent'; 2 | 3 | BasicComponent({ 4 | options: { 5 | virtualHost: true 6 | }, 7 | properties: { 8 | name: String, 9 | color: String, 10 | size: null, 11 | spin: Boolean, 12 | rotate: String, 13 | extStyle: String, 14 | prefix: String, 15 | hyphen: { 16 | type: String, 17 | value: '-' 18 | }, 19 | iconStyle: String 20 | }, 21 | methods: { 22 | onClick() { 23 | this.triggerEvent('click'); 24 | } 25 | } 26 | }); 27 | -------------------------------------------------------------------------------- /packages/weapp/src/icon/index.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | -------------------------------------------------------------------------------- /packages/weapp/src/image/index.json: -------------------------------------------------------------------------------- 1 | { 2 | "component": true, 3 | "usingComponents": { 4 | "ti-icon": "../icon/index" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /packages/weapp/src/input-number/index.json: -------------------------------------------------------------------------------- 1 | { 2 | "component": true, 3 | "usingComponents": { 4 | "ti-icon": "../icon/index" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /packages/weapp/src/input-number/index.wxs: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var tools = require('../common/utils/wxs/convertStyles.wxs'); 4 | 5 | function computedSize(size, extStyle) { 6 | var style = {}; 7 | if (size === 'big') { 8 | style = { 9 | '--input-number-size': 56 + 'rpx' 10 | }; 11 | } 12 | 13 | return tools.convertStyles([style, extStyle]); 14 | } 15 | 16 | function computedInputWidth(size, inputWidth, autoWidth, variant) { 17 | var curInputWidth = 60; 18 | if (size === 'big') { 19 | curInputWidth = 64; 20 | } 21 | if (variant === 'bright') { 22 | curInputWidth = 36; 23 | } 24 | if (inputWidth) { 25 | curInputWidth = inputWidth; 26 | } 27 | if (autoWidth) { 28 | return 'width: 100%;' + 'min-width:' + curInputWidth + 'rpx'; 29 | } else { 30 | return 'width:' + curInputWidth + 'rpx'; 31 | } 32 | } 33 | module.exports = { 34 | computedSize: computedSize, 35 | computedInputWidth: computedInputWidth 36 | }; 37 | -------------------------------------------------------------------------------- /packages/weapp/src/input/index.json: -------------------------------------------------------------------------------- 1 | { 2 | "component": true, 3 | "usingComponents": { 4 | "ti-icon": "../icon/index" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /packages/weapp/src/loading/__test__/loading.test.js: -------------------------------------------------------------------------------- 1 | const { getComponent } = require('../../common/test/getComponent'); 2 | 3 | describe('test component', () => { 4 | it('should render success', () => { 5 | const comp = getComponent('loading'); 6 | expect(comp).toMatchSnapshot(); 7 | }); 8 | }); 9 | -------------------------------------------------------------------------------- /packages/weapp/src/loading/index.json: -------------------------------------------------------------------------------- 1 | { 2 | "component": true 3 | } 4 | -------------------------------------------------------------------------------- /packages/weapp/src/navbar/index.json: -------------------------------------------------------------------------------- 1 | { 2 | "component": true, 3 | "usingComponents": { 4 | "ti-icon": "../icon/index", 5 | "ti-loading": "../loading/index" 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /packages/weapp/src/notice-bar/index.json: -------------------------------------------------------------------------------- 1 | { 2 | "component": true, 3 | "usingComponents": { 4 | "ti-icon": "../icon/index" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /packages/weapp/src/notice-bar/index.wxs: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var tools = require('../common/utils/wxs/convertStyles.wxs'); 4 | 5 | function computedStyle(color, bgColor, height, extStyle, textMode) { 6 | var style = { 7 | '--notice-bar-color': color, 8 | '--notice-bar-background-color': bgColor 9 | }; 10 | if (textMode === 'wrap') { 11 | height = 'auto'; 12 | } 13 | height && (style['--notice-bar-height'] = height); 14 | return tools.convertStyles([style, extStyle]); 15 | } 16 | 17 | module.exports = { 18 | computedStyle: computedStyle 19 | }; 20 | -------------------------------------------------------------------------------- /packages/weapp/src/picker-column/index.json: -------------------------------------------------------------------------------- 1 | { 2 | "component": true, 3 | "usingComponents": {} 4 | } 5 | -------------------------------------------------------------------------------- /packages/weapp/src/picker/index.json: -------------------------------------------------------------------------------- 1 | { 2 | "component": true, 3 | "usingComponents": { 4 | "ti-picker-column": "../picker-column/index", 5 | "ti-loading": "../loading/index", 6 | "ti-popup-titlebar": "../popup-title-bar/index" 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /packages/weapp/src/picker/index.wxs: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | var _require = require('../common/utils/wxs/convertStyles.wxs'); 3 | var convertStyles = _require.convertStyles; 4 | 5 | function completedStyles(visibleItemCount, height) { 6 | if (visibleItemCount === 0) { 7 | return ''; 8 | } 9 | return convertStyles({ 10 | height: visibleItemCount * height + 'px' 11 | }); 12 | } 13 | 14 | function completedColAlias(colsAlias, index) { 15 | if (colsAlias.length > index) { 16 | return colsAlias[index]; 17 | } 18 | return index; 19 | } 20 | 21 | module.exports = { 22 | completedStyle: completedStyles, 23 | completedColAlias: completedColAlias 24 | }; 25 | -------------------------------------------------------------------------------- /packages/weapp/src/popup-title-bar/const.ts: -------------------------------------------------------------------------------- 1 | enum EPopupTitleBarVariantType { 2 | WithConfirm = 'with-confirm', // TODO: 主版本迭代 name change ConfirmTitleClose 3 | CancelOnly = 'cancel-only', // TODO: 主版本迭代 name change TitleClose 4 | BackTitleClose = 'back-title-cancel', 5 | MiniClose = 'mini-close', // TODO: 主版本迭代 name change Close 6 | LeftTitleClose = 'left-title-close' 7 | } 8 | export default EPopupTitleBarVariantType; 9 | -------------------------------------------------------------------------------- /packages/weapp/src/popup-title-bar/index.json: -------------------------------------------------------------------------------- 1 | { 2 | "component": true, 3 | "usingComponents": { 4 | "ti-icon": "../icon/index", 5 | "ti-title-bar": "../title-bar/index" 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /packages/weapp/src/popup-title-bar/index.less: -------------------------------------------------------------------------------- 1 | @import '../common/static/utils.less'; 2 | @import '../common/static/var.less'; 3 | @import '../common/static/mixins/index.less'; 4 | 5 | @popuptitle:~ '@{project}-popup-titlebar'; 6 | 7 | .@{popuptitle} { 8 | &-cancel { 9 | color: @popup-title-bar-cancel-color; 10 | } 11 | 12 | &-confirm { 13 | color: @popup-title-bar-confirm-color; 14 | } 15 | 16 | &-back { 17 | --protected-icon-color: @popup-title-bar-back-color; 18 | } 19 | 20 | &-close, 21 | &-mini-close { 22 | --protected-icon-color: @popup-title-bar-cancel-color; 23 | } 24 | 25 | &-mini-close { 26 | display: flex; 27 | position: absolute; 28 | z-index: 1; 29 | right: 0; 30 | align-items: center; 31 | justify-content: left; 32 | width: 72px; 33 | height: 108px; 34 | padding: 0; 35 | 36 | text-align: left; 37 | } 38 | 39 | &-mini-close-icon { 40 | padding: 8px; 41 | } 42 | 43 | &-space-between { 44 | text-align: left; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /packages/weapp/src/popup-title-bar/index.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 21 | 22 | -------------------------------------------------------------------------------- /packages/weapp/src/popup/const.ts: -------------------------------------------------------------------------------- 1 | enum EPosition { 2 | TOP = 'top', 3 | BOTTOM = 'bottom', 4 | LEFT = 'left', 5 | RIGHT = 'right', 6 | CENTER = 'center' 7 | // ABSOLUTE = 'absolute' 8 | } 9 | 10 | const ETransitionClass: { 11 | [key in EPosition]: string; 12 | } = { 13 | [EPosition.TOP]: 'slide-down', 14 | [EPosition.BOTTOM]: 'slide-up', 15 | [EPosition.LEFT]: 'slide-left', 16 | [EPosition.RIGHT]: 'slide-right', 17 | [EPosition.CENTER]: 'fade' 18 | // [EPosition.ABSOLUTE]: 'slide-up' 19 | }; 20 | 21 | export { EPosition, ETransitionClass }; 22 | -------------------------------------------------------------------------------- /packages/weapp/src/popup/index.json: -------------------------------------------------------------------------------- 1 | { 2 | "component": true, 3 | "usingComponents": { 4 | "ti-transition": "../transition/index", 5 | "ti-safe-area": "../safe-area/index" 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /packages/weapp/src/preview/index.json: -------------------------------------------------------------------------------- 1 | { 2 | "component": true, 3 | "usingComponents": { 4 | "ti-transition": "../transition/index" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /packages/weapp/src/price/index.json: -------------------------------------------------------------------------------- 1 | { 2 | "component": true 3 | } 4 | -------------------------------------------------------------------------------- /packages/weapp/src/price/index.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | {{ label }}{{ prefix }}{{ unit }}{{ integerPart }}.{{ fractionPart }}{{ suffix }} 5 | 6 | 7 | -------------------------------------------------------------------------------- /packages/weapp/src/progress/__test__/progress.test.js: -------------------------------------------------------------------------------- 1 | const { getComponent } = require('../../common/test/getComponent'); 2 | 3 | describe('test component', () => { 4 | it('should render success', () => { 5 | const comp = getComponent('progress', { 6 | color: '#ff0000', 7 | gradientColor: { 8 | from: '#ffff00', 9 | to: '#ff0000' 10 | } 11 | }); 12 | comp.triggerLifeTime('attached'); 13 | expect(comp).toMatchSnapshot(); 14 | }); 15 | 16 | it('should render value success', () => { 17 | const comp = getComponent('progress', { 18 | color: '#ff0000', 19 | value: 50 20 | }); 21 | comp.triggerLifeTime('attached'); 22 | expect(comp).toMatchSnapshot(); 23 | }); 24 | }); 25 | -------------------------------------------------------------------------------- /packages/weapp/src/progress/index.json: -------------------------------------------------------------------------------- 1 | { 2 | "component": true 3 | } 4 | -------------------------------------------------------------------------------- /packages/weapp/src/radio-button/index.json: -------------------------------------------------------------------------------- 1 | { 2 | "component": true, 3 | "usingComponents": { 4 | "ti-tag": "../tag/index" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /packages/weapp/src/radio-button/index.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 8 | 9 | {{ label }} 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /packages/weapp/src/radio-group/__test__/index.js: -------------------------------------------------------------------------------- 1 | Component({ 2 | data: { 3 | defaultValue: '3', 4 | selectValue: '1' 5 | }, 6 | methods: { 7 | onChange(e) { 8 | this.setData({ 9 | selectValue: e.detail 10 | }); 11 | } 12 | } 13 | }); 14 | -------------------------------------------------------------------------------- /packages/weapp/src/radio-group/__test__/index.json: -------------------------------------------------------------------------------- 1 | { 2 | "component": true, 3 | "usingComponents": { 4 | "ti-radio-group": "../index", 5 | "ti-radio": "../../radio/index" 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /packages/weapp/src/radio-group/__test__/index.wxml: -------------------------------------------------------------------------------- 1 | 2 | 选项1 3 | 选项2 4 | 选项3 5 | 6 | -------------------------------------------------------------------------------- /packages/weapp/src/radio-group/index.json: -------------------------------------------------------------------------------- 1 | { 2 | "component": true, 3 | "usingComponents": { 4 | "ti-radio": "../radio/index" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /packages/weapp/src/radio-group/index.less: -------------------------------------------------------------------------------- 1 | @import '../common/static/var'; 2 | @import '../common/static/utils'; 3 | @import '../common/static/mixins/index.less'; 4 | 5 | @radioGroup: ~'@{project}-radio-group'; 6 | 7 | :host { 8 | display: contents; 9 | } 10 | .@{radioGroup} { 11 | &-vertical { 12 | display: flex; 13 | flex-direction: column; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /packages/weapp/src/radio-group/index.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /packages/weapp/src/radio/index.json: -------------------------------------------------------------------------------- 1 | { 2 | "component": true, 3 | "usingComponents": { 4 | "ti-icon": "../icon/index" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /packages/weapp/src/radio/index.wxs: -------------------------------------------------------------------------------- 1 | var stylesUtils = require('../common/utils/wxs/convertStyles.wxs'); 2 | var borderRadiusUtils = require('../common/utils/wxs/borderRadius.wxs'); 3 | 4 | function completedStyles(data) { 5 | if (data.shape === 'circle' || data.shape === 'square') { 6 | return borderRadiusUtils.handler(data.shape) + '; height: ' + data.size + 'rpx'; 7 | } 8 | 9 | var style = { 10 | height: data.size + 'rpx' 11 | }; 12 | 13 | style['--base-radius-size'] = (data.shape ? data.shape : data.size) + 'rpx'; 14 | 15 | return stylesUtils.convertStyles(style); 16 | } 17 | function completedIconStyles(data) { 18 | var style = {}; 19 | if (data.color) { 20 | style['background-color'] = data.color; 21 | } 22 | if (data.size) { 23 | style['width'] = style['height'] = style['line-height'] = data.size + 'rpx'; 24 | } 25 | return stylesUtils.convertStyles(style); 26 | } 27 | module.exports = { 28 | completedStyles: completedStyles, 29 | completedIconStyles: completedIconStyles 30 | }; 31 | -------------------------------------------------------------------------------- /packages/weapp/src/rate/index.json: -------------------------------------------------------------------------------- 1 | { 2 | "component": true, 3 | "usingComponents": { 4 | "ti-icon": "../icon/index" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /packages/weapp/src/rate/index.less: -------------------------------------------------------------------------------- 1 | @import '../common/static/var.less'; 2 | @import '../common/static/utils.less'; 3 | @import '../common/static/mixins/index.less'; 4 | @rate: ~'@{project}-rate'; 5 | 6 | .@{rate} { 7 | display: inline-flex; 8 | align-items: center; 9 | justify-content: center; 10 | 11 | &-item { 12 | display: inline-flex; 13 | position: relative; 14 | align-items: center; 15 | justify-content: center; 16 | margin-right: @rate-gap; 17 | 18 | &:last-of-type { 19 | margin-right: 0; 20 | } 21 | } 22 | 23 | &-star-half { 24 | position: absolute !important; 25 | top: 0; 26 | bottom: 0; 27 | left: 0; 28 | width: 50%; 29 | margin: auto; 30 | overflow: hidden; 31 | } 32 | 33 | &-filled { 34 | --icon-color: @rate-color; 35 | } 36 | 37 | &-empty { 38 | --icon-color: @rate-empty-color; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /packages/weapp/src/rate/index.wxs: -------------------------------------------------------------------------------- 1 | function getClass(condition) { 2 | if (condition) { 3 | return 'filled'; 4 | } else { 5 | return 'empty'; 6 | } 7 | } 8 | 9 | module.exports = { 10 | getClass: getClass 11 | }; 12 | -------------------------------------------------------------------------------- /packages/weapp/src/row/__test__/__snapshots__/row.test.js.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`test component should flex prop render success 1`] = ` 4 |
5 | 9 |
10 | `; 11 | 12 | exports[`test component should gutter prop render success 1`] = ` 13 |
14 | 18 |
19 | `; 20 | 21 | exports[`test component should render success 1`] = ` 22 |
23 | 27 |
28 | `; 29 | -------------------------------------------------------------------------------- /packages/weapp/src/row/__test__/row.test.js: -------------------------------------------------------------------------------- 1 | const { getComponent } = require('../../common/test/getComponent'); 2 | 3 | describe('test component', () => { 4 | it('should render success', () => { 5 | const comp = getComponent('row'); 6 | expect(comp).toMatchSnapshot(); 7 | }); 8 | 9 | it('should gutter prop render success', () => { 10 | const comp = getComponent('row', { 11 | gutter: 8 12 | }); 13 | 14 | const row = comp.querySelector('.titian-row-flex').dom; 15 | 16 | expect(row.style.marginLeft).toBe('-4px'); 17 | expect(row.style.marginRight).toBe('-4px'); 18 | 19 | expect(comp).toMatchSnapshot(); 20 | }); 21 | 22 | it('should flex prop render success', () => { 23 | const comp = getComponent('row', { 24 | flex: false 25 | }); 26 | 27 | expect(comp).toMatchSnapshot(); 28 | }); 29 | }); 30 | -------------------------------------------------------------------------------- /packages/weapp/src/row/index.json: -------------------------------------------------------------------------------- 1 | { 2 | "component": true, 3 | "usingComponents": {} 4 | } 5 | -------------------------------------------------------------------------------- /packages/weapp/src/row/index.less: -------------------------------------------------------------------------------- 1 | @import '../common/static/utils'; 2 | @import '../common/static/var.less'; 3 | @import '../common/static/mixins/index.less'; 4 | @row: ~'@{project}-row'; 5 | 6 | .@{row} { 7 | &-flex { 8 | display: flex; 9 | flex-flow: row wrap; 10 | } 11 | 12 | &::after { 13 | content: ''; 14 | 15 | display: table; 16 | clear: both; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /packages/weapp/src/row/index.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /packages/weapp/src/row/index.wxs: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | function completedStyle(gutter) { 4 | var num = gutter / 2; 5 | return 'margin-left: -'.concat(num, 'rpx; margin-right: -').concat(num, 'rpx;'); 6 | } 7 | 8 | module.exports = { 9 | completedStyle: completedStyle 10 | }; 11 | -------------------------------------------------------------------------------- /packages/weapp/src/safe-area/const.ts: -------------------------------------------------------------------------------- 1 | enum ESafeArea { 2 | Top = 'top', 3 | Bottom = 'bottom' 4 | } 5 | 6 | export default ESafeArea; 7 | export { ESafeArea }; 8 | -------------------------------------------------------------------------------- /packages/weapp/src/safe-area/index.json: -------------------------------------------------------------------------------- 1 | { 2 | "component": true, 3 | "usingComponents": {} 4 | } 5 | -------------------------------------------------------------------------------- /packages/weapp/src/safe-area/index.less: -------------------------------------------------------------------------------- 1 | @import '../common/static/utils'; 2 | @import '../common/static/var'; 3 | @import '../common/static/mixins/index.less'; 4 | @safe: ~'@{project}-safe'; 5 | 6 | @keyframes iosfix { 7 | from { 8 | padding-bottom: env(safe-area-inset-bottom); 9 | } 10 | 11 | to { 12 | padding-bottom: env(safe-area-inset-bottom); 13 | } 14 | } 15 | .@{safe} { 16 | background-color: @safe-bg-color; 17 | 18 | &-top { 19 | padding-top: env(safe-area-inset-top); 20 | 21 | animation: iosfix infinite 1s; 22 | } 23 | 24 | &-bottom { 25 | padding-bottom: env(safe-area-inset-bottom); 26 | 27 | animation: iosfix infinite 1s; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /packages/weapp/src/safe-area/index.ts: -------------------------------------------------------------------------------- 1 | import { ESafeArea } from './const'; 2 | 3 | Component({ 4 | properties: { 5 | position: { 6 | type: String, 7 | value: ESafeArea.Bottom 8 | } 9 | } 10 | }); 11 | -------------------------------------------------------------------------------- /packages/weapp/src/safe-area/index.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /packages/weapp/src/search/index.json: -------------------------------------------------------------------------------- 1 | { 2 | "component": true, 3 | "usingComponents": { 4 | "ti-icon": "../icon/index", 5 | "ti-input": "../input/index", 6 | "ti-button": "../button/index" 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /packages/weapp/src/share-sheet/index.json: -------------------------------------------------------------------------------- 1 | { 2 | "component": true, 3 | "usingComponents": { 4 | "ti-icon": "../icon/index", 5 | "ti-svg-path-view": "../svg-path-view/index", 6 | "ti-popup": "../popup/index", 7 | "ti-popup-titlebar": "../popup-title-bar/index" 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /packages/weapp/src/share-sheet/index.wxs: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | function completedStyles(length) { 4 | if (length > 4 || length === 0) { 5 | return ''; 6 | } 7 | var width = 100 / length; 8 | return 'width:' + width + '%;'; 9 | } 10 | function completedData(options) { 11 | if (options.constructor !== 'Array') { 12 | return []; 13 | } 14 | if (options.length === 0) { 15 | return options; 16 | } 17 | if (options[0].constructor === 'Array') { 18 | return options; 19 | } 20 | return [options]; 21 | } 22 | 23 | function completedBgColor(color) { 24 | if (typeof color === 'string' && color) { 25 | return 'background-color:' + color + ';'; 26 | } 27 | return ''; 28 | } 29 | 30 | function isImg(icon) { 31 | return icon && icon.indexOf && icon.indexOf('http') > -1; 32 | } 33 | 34 | module.exports = { 35 | completedStyles: completedStyles, 36 | completedData: completedData, 37 | completedBgColor: completedBgColor, 38 | isImg: isImg 39 | }; 40 | -------------------------------------------------------------------------------- /packages/weapp/src/sidebar-item/index.json: -------------------------------------------------------------------------------- 1 | { 2 | "component": true, 3 | "usingComponents": { 4 | "ti-badge": "../badge/index" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /packages/weapp/src/sidebar-item/index.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {{ label }} 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /packages/weapp/src/sidebar-item/index.wxs: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var tools = require('../common/utils/wxs/convertStyles.wxs'); 4 | var wxsUtils = require('../common/utils/wxs/index.wxs'); 5 | 6 | function addClass(prefix, object) { 7 | var className = ''; 8 | var keys = wxsUtils.keys(object); 9 | keys.forEach(function (item) { 10 | if (object[item]) { 11 | className += ' ' + prefix + item; 12 | } 13 | }); 14 | return className; 15 | } 16 | 17 | module.exports = { 18 | addClass: addClass 19 | }; 20 | -------------------------------------------------------------------------------- /packages/weapp/src/sidebar/index.json: -------------------------------------------------------------------------------- 1 | { 2 | "component": true, 3 | "usingComponents": {} 4 | } 5 | -------------------------------------------------------------------------------- /packages/weapp/src/sidebar/index.less: -------------------------------------------------------------------------------- 1 | @import '../common/static/utils.less'; 2 | @import '../common/static/var.less'; 3 | @import '../common/static/mixins/index.less'; 4 | @sidebar:~ '@{project}-sidebar'; 5 | 6 | :host { 7 | display: contents; 8 | } 9 | .@{sidebar} { 10 | width: 184px; 11 | height: 100%; 12 | overflow: scroll; 13 | 14 | background: var(--sidebar-bg-color, @neutral-color-7); 15 | } 16 | -------------------------------------------------------------------------------- /packages/weapp/src/sidebar/index.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /packages/weapp/src/sku-selector/index.json: -------------------------------------------------------------------------------- 1 | { 2 | "component": true, 3 | "usingComponents": { 4 | "ti-tag": "../tag/index" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /packages/weapp/src/sku/index.json: -------------------------------------------------------------------------------- 1 | { 2 | "component": true, 3 | "usingComponents": { 4 | "ti-popup": "../popup/index", 5 | "ti-popup-titlebar": "../popup-title-bar/index", 6 | "ti-image": "../image/index", 7 | "ti-button": "../button/index", 8 | "ti-sku-selector": "../sku-selector/index", 9 | "ti-input-number": "../input-number/index", 10 | "ti-safe-area": "../safe-area/index", 11 | "ti-divider": "../divider/index", 12 | "ti-price": "../price/index", 13 | "ti-goods-card": "../goods-card/index" 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /packages/weapp/src/slider/index.json: -------------------------------------------------------------------------------- 1 | { 2 | "component": true, 3 | "usingComponents": {} 4 | } 5 | -------------------------------------------------------------------------------- /packages/weapp/src/slider/index.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 9 | 15 | 22 | 23 | -------------------------------------------------------------------------------- /packages/weapp/src/step-item/index.json: -------------------------------------------------------------------------------- 1 | { 2 | "component": true, 3 | "usingComponents": { 4 | "ti-icon": "../icon/index" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /packages/weapp/src/step-item/index.wxs: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var tools = require('../common/utils/wxs/convertStyles.wxs'); 4 | var utils = require('../common/utils/wxs/index.wxs'); 5 | 6 | function computedStyle(extStyle, activeColor) { 7 | var style = {}; 8 | if (activeColor) { 9 | style = { 10 | '--steps-icon-active-color': activeColor, 11 | '--steps-dot-active-color': activeColor, 12 | '--steps-title-active-color': activeColor, 13 | '--steps-subtitle-active-color': activeColor 14 | }; 15 | } 16 | return tools.convertStyles([style, extStyle]); 17 | } 18 | 19 | function checkCurrent(current, index) { 20 | if (utils.isPlainArray(current)) { 21 | return current.indexOf(index) > -1; 22 | } else { 23 | return current === index; 24 | } 25 | } 26 | 27 | module.exports = { 28 | computedStyle: computedStyle, 29 | checkCurrent: checkCurrent 30 | }; 31 | -------------------------------------------------------------------------------- /packages/weapp/src/steps/index.json: -------------------------------------------------------------------------------- 1 | { 2 | "component": true, 3 | "usingComponents": { 4 | "ti-icon": "../icon/index", 5 | "ti-step-item": "../step-item/index" 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /packages/weapp/src/steps/index.ts: -------------------------------------------------------------------------------- 1 | import BasicComponent from '../common/basic/BasicComponent'; 2 | 3 | BasicComponent({ 4 | children: 'step-item', 5 | properties: { 6 | extStyle: String, 7 | options: Array, 8 | current: { 9 | type: Number, 10 | optionalTypes: [Array], 11 | value: 0 12 | }, 13 | activeColor: String, 14 | icon: String, 15 | 16 | // 取值 left、right 17 | subtitleAlign: String, 18 | alias: { 19 | type: Object, 20 | value: {} 21 | } 22 | } 23 | }); 24 | -------------------------------------------------------------------------------- /packages/weapp/src/steps/index.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /packages/weapp/src/steps/index.wxs: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var tools = require('../common/utils/wxs/convertStyles.wxs'); 4 | var utils = require('../common/utils/wxs/index.wxs'); 5 | 6 | function computedStyle(extStyle, activeColor) { 7 | var style = {}; 8 | if (activeColor) { 9 | style = { 10 | '--steps-icon-active-color': activeColor, 11 | '--steps-dot-active-color': activeColor, 12 | '--steps-title-active-color': activeColor, 13 | '--steps-subtitle-active-color': activeColor 14 | }; 15 | } 16 | return tools.convertStyles([style, extStyle]); 17 | } 18 | 19 | function checkCurrent(current, index) { 20 | if (utils.isPlainArray(current)) { 21 | return current.indexOf(index) > -1; 22 | } else { 23 | return current === index; 24 | } 25 | } 26 | module.exports = { 27 | computedStyle: computedStyle, 28 | checkCurrent: checkCurrent 29 | }; 30 | -------------------------------------------------------------------------------- /packages/weapp/src/sticky/index.json: -------------------------------------------------------------------------------- 1 | { 2 | "component": true, 3 | "usingComponents": {} 4 | } 5 | -------------------------------------------------------------------------------- /packages/weapp/src/sticky/index.less: -------------------------------------------------------------------------------- 1 | @import '../common/static/utils.less'; 2 | @import '../common/static/var.less'; 3 | @import '../common/static/mixins/index.less'; 4 | @sticky:~ '@{project}-sticky'; 5 | 6 | :host { 7 | display: contents; 8 | } 9 | .@{sticky} { 10 | position: relative; 11 | z-index: var(--sticky-z-index, 99); 12 | 13 | &-fixed { 14 | position: fixed; 15 | z-index: var(--sticky-z-index, 99); 16 | top: 0; 17 | width: 100%; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /packages/weapp/src/sticky/index.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 10 | 11 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /packages/weapp/src/sticky/index.wxs: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var tools = require('../common/utils/wxs/convertStyles.wxs'); 4 | 5 | function outStyle(fixed, width, height) { 6 | if (!fixed) return ''; 7 | var style = { height: height + 'px', width: width + 'px' }; 8 | return tools.convertStyles([style]); 9 | } 10 | function innerStyle(fixed, offsetTop) { 11 | if (!fixed) return ''; 12 | var style = { top: offsetTop + 'px' }; 13 | return tools.convertStyles([style]); 14 | } 15 | function setPureCss(disabled, offsetTop) { 16 | if (disabled) return ''; 17 | var style = { position: 'sticky', top: offsetTop + 'px' }; 18 | return tools.convertStyles([style]); 19 | } 20 | module.exports = { 21 | outStyle: outStyle, 22 | innerStyle: innerStyle, 23 | setPureCss: setPureCss 24 | }; 25 | -------------------------------------------------------------------------------- /packages/weapp/src/svg-path-view/index.json: -------------------------------------------------------------------------------- 1 | { 2 | "component": true 3 | } 4 | -------------------------------------------------------------------------------- /packages/weapp/src/svg-path-view/index.less: -------------------------------------------------------------------------------- 1 | @import '../common/static/utils.less'; 2 | @import '../common/static/var.less'; 3 | @keyframes spin { 4 | 0% { 5 | transform: rotate(0deg); 6 | } 7 | 8 | to { 9 | transform: rotate(1turn); 10 | } 11 | } 12 | @svg-path-view:~ '@{project}-svg-path-view'; 13 | 14 | .@{svg-path-view} { 15 | display: @svg-path-view-display; 16 | width: @svg-path-view-size; 17 | height: @svg-path-view-size; 18 | 19 | &-spin { 20 | animation: spin 1s linear infinite; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /packages/weapp/src/svg-path-view/index.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 10 | -------------------------------------------------------------------------------- /packages/weapp/src/swipe-cell/index.json: -------------------------------------------------------------------------------- 1 | { 2 | "component": true 3 | } 4 | -------------------------------------------------------------------------------- /packages/weapp/src/swipe-cell/index.less: -------------------------------------------------------------------------------- 1 | @import '../common/static/utils.less'; 2 | @import '../common/static/var.less'; 3 | @import '../common/static/mixins/index.less'; 4 | @swipeCell: ~'@{project}-swipe-cell'; 5 | 6 | :host { 7 | display: contents; 8 | } 9 | .@{swipeCell} { 10 | width: 100%; 11 | overflow: hidden; 12 | 13 | &-wrap { 14 | position: relative; 15 | 16 | transition: transform 0.2s cubic-bezier(0.5, 1, 0.89, 1); 17 | } 18 | 19 | &-left, 20 | &-right { 21 | display: flex; 22 | position: absolute; 23 | top: 0; 24 | height: 100%; 25 | } 26 | 27 | &-left { 28 | left: 0; 29 | 30 | transform: translateX(-100%); 31 | } 32 | 33 | &-right { 34 | right: 0; 35 | 36 | transform: translateX(100%); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /packages/weapp/src/swipe-cell/index.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /packages/weapp/src/switch/__test__/swipe-cell.test.js: -------------------------------------------------------------------------------- 1 | const simulate = require('miniprogram-simulate'); 2 | const { getComponent } = require('../../common/test/getComponent'); 3 | 4 | describe('test component', () => { 5 | it('should render success', () => { 6 | const comp = getComponent('switch'); 7 | comp.triggerLifeTime('attached'); 8 | 9 | expect(comp).toMatchSnapshot(); 10 | }); 11 | 12 | it('should render success props', async () => { 13 | const comp = getComponent('switch', { 14 | value: true 15 | }); 16 | comp.triggerLifeTime('attached'); 17 | 18 | expect(comp).toMatchSnapshot(); 19 | comp.setData({ value: false }); 20 | await simulate.sleep(0); 21 | expect(comp).toMatchSnapshot(); 22 | }); 23 | }); 24 | -------------------------------------------------------------------------------- /packages/weapp/src/switch/index.json: -------------------------------------------------------------------------------- 1 | { 2 | "component": true, 3 | "usingComponents": { 4 | "ti-loading": "../loading/index" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /packages/weapp/src/switch/index.less: -------------------------------------------------------------------------------- 1 | @import '../common/static/utils.less'; 2 | @import '../common/static/var.less'; 3 | @import '../common/static/mixins/index.less'; 4 | 5 | @switch: ~'@{project}-switch'; 6 | 7 | .@{switch} { 8 | display: flex; 9 | position: relative; 10 | box-sizing: border-box; 11 | align-items: center; 12 | 13 | transition: background-color 200ms cubic-bezier(0.48, 0.33, 0.24, 0.95); 14 | 15 | background-color: @switch-bg-color; 16 | 17 | --loading-color: @switch-loading-color; 18 | 19 | &-ball { 20 | display: flex; 21 | align-items: center; 22 | justify-content: center; 23 | 24 | transition: transform 200ms cubic-bezier(0.48, 0.33, 0.24, 0.95), width 60ms; 25 | 26 | background-color: @switch-ball-bg-color; 27 | } 28 | 29 | &-active { 30 | background-color: @switch-active-bg-color; 31 | } 32 | 33 | &-disabled { 34 | opacity: 0.4; 35 | touch-action: none; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /packages/weapp/src/switch/index.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /packages/weapp/src/tabbar-item/index.json: -------------------------------------------------------------------------------- 1 | { 2 | "component": true, 3 | "usingComponents": { 4 | "ti-icon": "../icon/index" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /packages/weapp/src/tabbar-item/index.less: -------------------------------------------------------------------------------- 1 | @import '../common/static/utils.less'; 2 | @import '../common/static/var.less'; 3 | @import '../common/static/mixins/index.less'; 4 | @tabbaritem:~ '@{project}-tab-bar-item'; 5 | 6 | :host { 7 | display: contents; 8 | } 9 | .@{tabbaritem} { 10 | display: flex; 11 | flex: 1; 12 | flex-direction: column; 13 | align-items: center; 14 | justify-content: center; 15 | 16 | &-title { 17 | margin: @tabbar-item-title-margin-top @tabbar-item-title-margin-h @tabbar-item-title-margin-bottom; 18 | 19 | line-height: @line-height; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /packages/weapp/src/tabbar-item/index.wxs: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | function completedStyle(status, activeColor, color, size) { 4 | var style = ''; 5 | if (status === 'select') { 6 | if (typeof activeColor === 'string' && activeColor) { 7 | style += 'color:' + activeColor; 8 | } 9 | } else { 10 | if (typeof color === 'string' && color) { 11 | style += 'color:' + color; 12 | } 13 | } 14 | style += ';font-size:' + size + 'rpx'; 15 | 16 | return style; 17 | } 18 | 19 | var TabBarItemStateEnum = { 20 | SELECT: 'select', 21 | NO_SELECT: 'no_select' 22 | }; 23 | function completedStatus(status) { 24 | return status === TabBarItemStateEnum.SELECT; 25 | } 26 | 27 | module.exports = { 28 | completedStyle: completedStyle, 29 | completedStatus: completedStatus 30 | }; 31 | -------------------------------------------------------------------------------- /packages/weapp/src/tabbar/__test__/mock/index.js: -------------------------------------------------------------------------------- 1 | const tabbarIndex = { 2 | label: '常规-下标', 3 | props: { 4 | value: 1, 5 | options: [ 6 | { icon: 'home', title: '首页' }, 7 | { icon: 'arrange', title: '分类' }, 8 | { icon: 'cart', title: '购物车' }, 9 | { icon: 'user-account-setting', title: '我的' } 10 | ] 11 | }, 12 | params: {}, 13 | expect: ['分类', 0] 14 | }; 15 | const tabbarValue = { 16 | label: '常规-值', 17 | props: { 18 | value: 'third', 19 | options: [ 20 | { icon: 'home', title: '首页', value: 'first' }, 21 | { icon: 'arrange', title: '分类', value: 'second' }, 22 | { icon: 'cart', title: '购物车', value: 'third' }, 23 | { icon: 'user-account-setting', title: '我的', value: 'fourth' } 24 | ] 25 | }, 26 | params: {}, 27 | expect: ['购物车', 'first'] 28 | }; 29 | const data = [tabbarIndex, tabbarValue]; 30 | module.exports.data = data; 31 | -------------------------------------------------------------------------------- /packages/weapp/src/tabbar/index.json: -------------------------------------------------------------------------------- 1 | { 2 | "component": true, 3 | "usingComponents": { 4 | "ti-tabbar-item": "../tabbar-item/index", 5 | "ti-safe-area": "../safe-area/index" 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /packages/weapp/src/tabbar/index.less: -------------------------------------------------------------------------------- 1 | @import '../common/static/utils.less'; 2 | @import '../common/static/var.less'; 3 | @import '../common/static/mixins/index.less'; 4 | @tabbar:~ '@{project}-tab-bar'; 5 | 6 | .@{tabbar} { 7 | position: fixed; 8 | right: 0; 9 | bottom: 0; 10 | left: 0; 11 | box-sizing: border-box; 12 | flex: 1; 13 | padding: @tabbar-padding-v @tabbar-padding-h; 14 | 15 | background: var(--tabbar-background, #fff); 16 | 17 | --safe-bg-color: var(--tabbar-background, #fff); 18 | 19 | &-box { 20 | display: flex; 21 | } 22 | 23 | &-shadow { 24 | position: absolute; 25 | top: 0; 26 | right: 0; 27 | left: 0; 28 | height: @tabbar-shadow-height; 29 | 30 | transform: translateY(-100%); 31 | 32 | opacity: 0.02; 33 | background: @tabbar-shadow-bg; 34 | } 35 | 36 | &-border { 37 | border-top: @tabbar-border-top; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /packages/weapp/src/tabbar/index.wxs: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | var SeparationEnum = { 3 | BORDER: 'border', 4 | SHADOW: 'shadow', 5 | EMPTY: '' 6 | }; 7 | function isBorder(status) { 8 | return status === SeparationEnum.BORDER; 9 | } 10 | function isShadow(status) { 11 | return status === SeparationEnum.SHADOW; 12 | } 13 | 14 | module.exports = { 15 | isBorder: isBorder, 16 | isShadow: isShadow 17 | }; 18 | -------------------------------------------------------------------------------- /packages/weapp/src/tabs/index.json: -------------------------------------------------------------------------------- 1 | { 2 | "component": true, 3 | "usingComponents": { 4 | "ti-sticky": "../sticky/index" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /packages/weapp/src/tag/const.ts: -------------------------------------------------------------------------------- 1 | enum ETagVariant { 2 | /** 实心 */ 3 | CONTAINED = 'contained', 4 | 5 | /** 填充 */ 6 | FILLED = 'filled', 7 | 8 | /** 描边 */ 9 | OUTLINED = 'outlined' 10 | } 11 | 12 | enum ETagSize { 13 | /** 小 */ 14 | SMALL = 'small', 15 | 16 | /** 中 */ 17 | MEDIUM = 'medium', 18 | 19 | /** 大 */ 20 | BIG = 'big' 21 | } 22 | 23 | enum ETagShape { 24 | /** 圆角胶囊 */ 25 | CAPSULE = 'capsule', 26 | 27 | /** 圆角 */ 28 | ROUND = 'round', 29 | 30 | /** 矩形 */ 31 | RECT = 'rect', 32 | 33 | /** 树叶形 */ 34 | LEAF = 'leaf' 35 | } 36 | 37 | export { ETagVariant, ETagSize, ETagShape }; 38 | -------------------------------------------------------------------------------- /packages/weapp/src/tag/index.json: -------------------------------------------------------------------------------- 1 | { 2 | "component": true, 3 | "usingComponents": { 4 | "ti-icon": "../icon/index" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /packages/weapp/src/tag/index.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /packages/weapp/src/textarea/index.json: -------------------------------------------------------------------------------- 1 | { 2 | "component": true, 3 | "usingComponents": {} 4 | } 5 | -------------------------------------------------------------------------------- /packages/weapp/src/title-bar/index.json: -------------------------------------------------------------------------------- 1 | { 2 | "component": true, 3 | "usingComponents": { 4 | "ti-icon": "../icon/index" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /packages/weapp/src/toast/const.ts: -------------------------------------------------------------------------------- 1 | enum EToastType { 2 | Text = 'text', 3 | Success = 'success', 4 | Fail = 'fail', 5 | Warn = 'warn', 6 | Loading = 'loading', 7 | Icon = 'icon' 8 | } 9 | 10 | export default EToastType; 11 | export { EToastType }; 12 | -------------------------------------------------------------------------------- /packages/weapp/src/toast/index.json: -------------------------------------------------------------------------------- 1 | { 2 | "component": true, 3 | "usingComponents": { 4 | "ti-icon": "../icon/index", 5 | "ti-popup": "../popup/index", 6 | "ti-loading": "../loading/index" 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /packages/weapp/src/tooltip/index.json: -------------------------------------------------------------------------------- 1 | { 2 | "component": true, 3 | "usingComponents": { 4 | "ti-icon": "../icon/index" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /packages/weapp/src/transition/__test__/__snapshots__/transition.test.js.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`test component should render success 1`] = `
`; 4 | -------------------------------------------------------------------------------- /packages/weapp/src/transition/__test__/transition.test.js: -------------------------------------------------------------------------------- 1 | const { getComponent } = require('../../common/test/getComponent'); 2 | 3 | describe('test component', () => { 4 | it('should render success', () => { 5 | const comp = getComponent('transition'); 6 | expect(comp).toMatchSnapshot(); 7 | }); 8 | }); 9 | -------------------------------------------------------------------------------- /packages/weapp/src/transition/index.json: -------------------------------------------------------------------------------- 1 | { 2 | "component": true 3 | } 4 | -------------------------------------------------------------------------------- /packages/weapp/src/transition/index.ts: -------------------------------------------------------------------------------- 1 | import transition from '../behaviors/transition'; 2 | import BasicComponent from '../common/basic/BasicComponent'; 3 | 4 | type Data = { 5 | // 自定义类名 6 | classes: string; 7 | 8 | // 是否被初始化 9 | initialized: boolean; 10 | 11 | // 是否展示 12 | display: boolean; 13 | 14 | // 过渡事件 15 | duration: number; 16 | 17 | preventScroll: boolean; 18 | }; 19 | 20 | BasicComponent({ 21 | externalClasses: [ 22 | 'enter-class', 23 | 'enter-active-class', 24 | 'enter-done-class', 25 | 'exit-class', 26 | 'exit-active-class', 27 | 'exit-done-class' 28 | ], 29 | behaviors: [transition()] 30 | }); 31 | -------------------------------------------------------------------------------- /packages/weapp/src/transition/index.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /packages/weapp/src/transition/index.wxs: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var _require = require('../common/utils/wxs/convertStyles.wxs'); 4 | var convertStyles = _require.convertStyles; 5 | 6 | var completedTransitionStyle = function completedTransitionStyle(data) { 7 | return convertStyles([ 8 | { 9 | '-webkit-transition-duration': ''.concat(data.duration, 'ms'), 10 | 'transition-duration': ''.concat(data.duration, 'ms'), 11 | '-webkit-transition-timing-function': data.timingFunction, 12 | 'transition-timing-function': data.timingFunction 13 | }, 14 | data.display ? null : 'display: none', 15 | data.extStyle 16 | ]); 17 | }; 18 | 19 | module.exports = { 20 | completedTransitionStyle: completedTransitionStyle 21 | }; 22 | -------------------------------------------------------------------------------- /packages/weapp/src/tree-select/index.json: -------------------------------------------------------------------------------- 1 | { 2 | "component": true, 3 | "usingComponents": { 4 | "ti-icon": "../icon/index", 5 | "ti-sidebar": "../sidebar/index", 6 | "ti-sidebar-item": "../sidebar-item/index" 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /packages/weapp/src/tree-select/index.less: -------------------------------------------------------------------------------- 1 | @import '../common/static/utils.less'; 2 | @import '../common/static/var.less'; 3 | @import '../common/static/mixins/index.less'; 4 | @tree-select:~ '@{project}-tree-select'; 5 | 6 | .@{tree-select} { 7 | display: flex; 8 | 9 | &-sidebar { 10 | width: auto; 11 | } 12 | 13 | &-container { 14 | flex: 1; 15 | } 16 | 17 | &-cell { 18 | display: flex; 19 | align-items: center; 20 | justify-content: space-between; 21 | height: var(--tree-select-cell-h, 108px); 22 | padding: 0 @gap-28; 23 | 24 | font-size: @T26; 25 | font-weight: @font-weight-bold; 26 | 27 | &-active { 28 | color: var(--tree-select-active-color, @brand-color-fade-100); 29 | } 30 | 31 | &-disabled { 32 | color: var(--tree-select-disabled-color, @neutral-color-4); 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /packages/weapp/src/tree-select/index.wxs: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | var tools = require('../common/utils/wxs/convertStyles.wxs'); 3 | var suffix = require('../common/utils/wxs/suffix.wxs'); 4 | 5 | var includes = function (array, searchElement) { 6 | return array.indexOf(searchElement) !== -1; 7 | }; 8 | function computedStyle(height, extStyle) { 9 | var style = { 10 | height: suffix.addUnit(height) 11 | }; 12 | return tools.convertStyles([style, extStyle]); 13 | } 14 | module.exports = { 15 | includes: includes, 16 | computedStyle: computedStyle 17 | }; 18 | -------------------------------------------------------------------------------- /packages/weapp/src/uploader/__test__/__snapshots__/uploader.test.js.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`test component should render success 1`] = ` 4 |
5 | 9 | 13 | 16 | 20 | 25 | 26 | 29 | 上传图片 30 | 31 | 32 | 33 | 34 |
35 | `; 36 | -------------------------------------------------------------------------------- /packages/weapp/src/uploader/index.json: -------------------------------------------------------------------------------- 1 | { 2 | "component": true, 3 | "usingComponents": { 4 | "ti-icon": "../icon/index", 5 | "ti-progress": "../progress/index", 6 | "ti-loading": "../loading/index", 7 | "ti-svg-path-view": "../svg-path-view/index" 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /packages/weapp/src/uploader/index.wxs: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var tools = require('../common/utils/wxs/convertStyles.wxs'); 4 | var UploadLoadComponentType = { 5 | NULL: '', 6 | LOADING: 'loading', 7 | PROGRESS: 'progress' 8 | }; 9 | module.exports = { 10 | isLoadStatus: function (loading) { 11 | return loading !== UploadLoadComponentType.NULL; 12 | }, 13 | isLoadComponent: function (loading) { 14 | return loading === UploadLoadComponentType.LOADING; 15 | }, 16 | getFile: function (fileMap, fileKey) { 17 | return fileMap[fileKey]; 18 | }, 19 | showAction: function (fileLength, count) { 20 | return fileLength < count; 21 | }, 22 | computedStyle: function (cols, extStyle) { 23 | var style = {}; 24 | if (cols) { 25 | style['--uploader-columns-count'] = cols < 6 ? cols : 6; 26 | } 27 | return tools.convertStyles([style, extStyle]); 28 | } 29 | }; 30 | -------------------------------------------------------------------------------- /pnpm-workspace.yaml: -------------------------------------------------------------------------------- 1 | packages: 2 | # all packages in direct subdirs of packages/ 3 | - 'packages/*' 4 | - 'examples/*' 5 | # exclude packages that are inside test directories 6 | # - '!**/test/**' 7 | -------------------------------------------------------------------------------- /tasks/config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | robot: 'https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=some-weixin-key' 3 | }; 4 | -------------------------------------------------------------------------------- /tasks/webhook.js: -------------------------------------------------------------------------------- 1 | const fetch = require('node-fetch-commonjs'); 2 | const { robot } = require('./config'); 3 | 4 | function webhook(data) { 5 | return new Promise((resolve, reject) => { 6 | fetch(robot, { 7 | method: 'POST', 8 | body: JSON.stringify(data), 9 | headers: { 10 | 'Content-Type': 'application/json' 11 | } 12 | }) 13 | .then((response) => response.json()) 14 | .then((res) => { 15 | const { errcode } = res; 16 | if (errcode === 0) { 17 | resolve(); 18 | } else { 19 | reject(res.errmsg); 20 | } 21 | }) 22 | .catch((e) => { 23 | console.log(e); 24 | reject(); 25 | }); 26 | }); 27 | } 28 | module.exports.webhook = webhook; 29 | -------------------------------------------------------------------------------- /test/global.d.ts: -------------------------------------------------------------------------------- 1 | export declare global { 2 | var ID_CACHE: Map; 3 | var CACHE: Record; 4 | 5 | var PREFIX: string; 6 | var __TITAN_CHANNEL__: string; 7 | 8 | function getRegExp(reg: RegExp | string): RegExp; 9 | } 10 | 11 | export default {}; 12 | -------------------------------------------------------------------------------- /titian.config.js: -------------------------------------------------------------------------------- 1 | const path = require('path'); 2 | const { wxTool } = require('./tasks/watchWxOutput'); 3 | // const { webhook } = require('./tasks/webhook'); 4 | 5 | function watch(hook) { 6 | // TODO example 自动构建 7 | // hook.afterRun.tap('build', wxTool.packNpm); 8 | // hook.watch.tap('packNpmWatch', wxTool.packNpmDebounce); 9 | hook.release.tap('release', ({ release, data }) => { 10 | // webhook(data); 11 | if (release) { 12 | wxTool.upload(); 13 | } 14 | }); 15 | } 16 | 17 | module.exports = (config) => ({ 18 | basedir: __dirname, 19 | compiler: config.command === 'release' ? '@titian-design/compiler' : path.join(__dirname, 'packages/compiler'), 20 | version: '0.2.0', 21 | entryPath: path.resolve(__dirname, 'packages', 'weapp', 'src'), 22 | output: { 23 | path: path.join(__dirname, 'examples', 'example-weapp', 'dist') 24 | }, 25 | tsconfig: './tsconfig.json', 26 | typesDir: path.join(__dirname, 'packages', 'weapp', 'types'), 27 | hooks: [watch], 28 | mainPackage: '@titian-design/weapp' 29 | }); 30 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "es6", 4 | "esModuleInterop": true, 5 | "target": "es6", 6 | "declaration": true, 7 | "noImplicitAny": true, 8 | "baseUrl": ".", 9 | "strict": true, 10 | "moduleResolution": "node", 11 | "lib": ["ESNext", "dom"], 12 | "types": ["@types/jest", "node", "miniprogram-api-typings"], 13 | "allowSyntheticDefaultImports": true, 14 | "skipLibCheck": true, 15 | "typeRoots": ["node_modules/@types", "node_modules/miniprogram-api-typings"] 16 | } 17 | } 18 | --------------------------------------------------------------------------------