Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
9d672c6
Merge branch 'feat_v3.x_datepickerview' into feat_datepickerview
irisSong Feb 25, 2025
9031780
feat: datepickerview初始化
irisSong Feb 26, 2025
7816059
fix: 合并picker分支
irisSong Feb 26, 2025
6789d5a
Merge branch 'feat_v3.x_picker' into feat_datepickerview
irisSong Feb 26, 2025
7f8309d
fix: 合并picker
irisSong Feb 26, 2025
fd9d3ec
fix: ts fixed
irisSong Feb 26, 2025
c1bea93
fix: ts lint
irisSong Feb 26, 2025
6c11115
fix: 初版完成
irisSong Feb 26, 2025
f4742e8
Merge branch 'feat_v3.x_datepickerview' into feat_datepickerview
irisSong Feb 27, 2025
0c933d4
fix: 合并refactor_datepicker
irisSong Feb 27, 2025
6befb47
fix: demo丰富
irisSong Feb 27, 2025
3c3e865
feat: test
irisSong Feb 27, 2025
f459311
Merge remote-tracking branch 'upstream/feat_v3.x' into feat_datepicke…
irisSong Feb 27, 2025
29a6b47
fix: update doc
irisSong Feb 27, 2025
381f113
fix: 优化比较方法
irisSong Feb 27, 2025
9df16f9
chore: upgrade the jdharmonycpp version (#3028)
irisSong Feb 27, 2025
321b549
docs: 修复文档错误 (#3024)
Miles-hxy Feb 27, 2025
6fb6898
docs: correct docs mistakes (#3018)
Miles-hxy Feb 27, 2025
d4dfbc4
chore: 明亮模式和暗黑模式主题分别打包 (#3020)
oasis-cloud Feb 27, 2025
df82d6b
refactor: datepicker (#3023)
irisSong Feb 28, 2025
dd4d13b
Merge branch 'refactor_datepicker' into feat_datepickerview
irisSong Feb 28, 2025
5c0f71c
fix: correct some docs content (#3030)
Miles-hxy Feb 28, 2025
3080c9c
docs: update configprovider docs (#3031)
xiaoyatong Feb 28, 2025
7e1f79b
fix: popup 鸿蒙适配弹出时退出app的问题 (#3033)
xiaoyatong Feb 28, 2025
9f7341f
fix: harmony review (#3002)
oasis-cloud Feb 28, 2025
90700a9
fix: dialog 在鸿蒙下问题修复 (#3032)
xiaoyatong Feb 28, 2025
6697e45
chore(release): v3.0.0
oasis-cloud Feb 28, 2025
827ab5c
fix: textarea 鸿蒙适配 (#3037)
xiaoyatong Mar 4, 2025
b4ee30a
fix(collapse): 去掉 demo 顶部留白 (#3041)
oasis-cloud Mar 4, 2025
1f7f105
fix(watermark): 小程序图片高度未撑开 (#3040)
oasis-cloud Mar 4, 2025
c5f27c5
fix: popup 鸿蒙下层级问题修复,dialog 的适配做了调整,日历卡片调整了demo (#3038)
xiaoyatong Mar 4, 2025
484f828
fix: 合并3.x
irisSong Mar 4, 2025
12da798
fix: pr修改
irisSong Mar 4, 2025
e14d223
fix: 修改ts报错
irisSong Mar 5, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,439 changes: 99 additions & 1,340 deletions CHANGELOG.md

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@nutui/nutui-react-taro",
"version": "3.0.0-beta.15",
"version": "3.0.0",
"style": "dist/style.css",
"main": "dist/nutui.react.umd.js",
"module": "dist/es/packages/nutui.react.build.js",
Expand Down Expand Up @@ -221,7 +221,7 @@
"vinyl-fs": "^4.0.0",
"vite": "^5.1.3",
"vite-plugin-dts": "4.2.1",
"vitest": "^3.0.0",
"vitest": "^3.0.7",
"vitest-canvas-mock": "^0.3.3",
"yargs": "^17.7.2"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/nutui-taro-demo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
"@dongdesign/inject-jd-platform-styles": "1.0.4",
"@jdtaro/plugin-platform-jdhybrid": "0.2.1",
"@jdtaro/taro-platform-jdharmony": "2.0.70",
"@jdtaro/plugin-platform-jdharmony-cpp": "0.1.22",
"@jdtaro/plugin-platform-jdharmony-cpp": "0.1.29-beta.0",
"@nutui/replace-icons": "^1.0.0",
"@nutui/touch-emulator": "^1.0.0",
"@pmmmwh/react-refresh-webpack-plugin": "^0.5.11",
Expand Down
381 changes: 252 additions & 129 deletions pnpm-lock.yaml

Large diffs are not rendered by default.

67 changes: 30 additions & 37 deletions scripts/build-taro.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { access, mkdir, readFile, writeFile } from 'fs/promises'
import { basename, dirname, extname, join, relative, resolve } from 'path'
import j from 'jscodeshift'
import { readFileSync } from 'fs'
import { relativeFilePath } from './relative-path.mjs'
import { relativePath } from './relative-path.mjs'
import { codeShift } from './build-comments-to-dts.mjs'
import { generate } from './build-theme-typings.mjs'

Expand Down Expand Up @@ -59,7 +59,7 @@ const transform = (file, api, replace) => {
return
}
const dir = join(__dirname, alias.replace('@/', '../src/'))
path.node.source.value = relativeFilePath(file.path, dir)?.replace(
path.node.source.value = relativePath(dir, file.path)?.replace(
'.taro',
'',
)
Expand Down Expand Up @@ -232,32 +232,23 @@ async function buildUMD() {

async function buildAllCSS() {
// 拷贝styles
async function copyStyles() {
await copy(
resolve(__dirname, '../src/styles'),
resolve(__dirname, `../${dist}/styles`),
)

async function generateAllStyles() {
const projectID = process.env.VITE_APP_PROJECT_ID
const content = [
`@import './styles/theme-default.scss';`,
`@import './styles/variables.scss';`,
`@import './styles/variables${projectID ? `-${projectID}` : ''}.scss';`,
`@import './styles/mixins/index.scss';`,
`@import './styles/animation/index.scss';`,
]
const projectID = process.env.VITE_APP_PROJECT_ID
if (projectID) {
content[1] = `@import '../variables-${projectID}.scss';`
}
const scssFiles = await glob([`${dist}/es/packages/**/*.scss`])
scssFiles.forEach((file) => {
content.push(
`@import '${relativeFilePath(`/${dist}/style.scss`, '/' + file)}';`,
`@import '${relativePath('/' + file, `/${dist}/style.scss`)}';`,
)
})
dest(`${dist}/style.scss`, content.join('\n'))
}

await copyStyles()
await generateAllStyles()
await vite.build({
logLevel: 'error',
resolve: {
Expand All @@ -277,6 +268,25 @@ async function buildAllCSS() {
}

async function buildThemeCSS() {
const files = await glob([`${dist}/styles/theme-*.scss`], {
ignore: [`${dist}/types/src/**/*.taro.d.ts`],
})
const projectID = process.env.VITE_APP_PROJECT_ID
const inputFiles = {}
files.forEach(filePath => {
const themeName = basename(filePath, 'scss').replace('theme-', '')
if (!projectID) {
inputFiles[themeName] = `./${filePath}`
} else {
if (themeName === projectID) {
inputFiles['default'] = `./${filePath}`
}
if (themeName === `${projectID}-dark`) {
inputFiles['dark'] = `./${filePath}`
}
}
})

await vite.build({
logLevel: 'error',
resolve: {
Expand All @@ -285,16 +295,14 @@ async function buildThemeCSS() {
build: {
emptyOutDir: false,
rollupOptions: {
input: inputFiles,
output: [
{
dir: `${dist}/styles/themes`,
assetFileNames: 'default.css',
assetFileNames: '[name].css',
},
],
},
lib: {
entry: `./${dist}/styles/themes/default.scss`,
},
},
})
}
Expand All @@ -305,21 +313,6 @@ async function copyStyles() {
resolve(__dirname, '../src/styles'),
resolve(__dirname, `../${dist}/styles`),
)

let content = [
`@import '../theme-default.scss';`,
`@import '../theme-dark.scss';`,
`@import '../jd-font';`,
]
const projectID = process.env.VITE_APP_PROJECT_ID
if (projectID) {
content = [
`@import '../theme-${projectID}.scss';`,
`@import '../jd-font';`,
]
}

dest(`${dist}/styles/themes/default.scss`, content.join('\n'))
}

// 构建样式
Expand Down Expand Up @@ -443,6 +436,8 @@ async function copyReleaseFiles() {
const npmPublishDir = dist.replace('dist', '')
await copy(join(__dirname, '../README.md'), join(`${npmPublishDir}/README.md`))
await copy(join(__dirname, '../CHANGELOG.md'), join(`${npmPublishDir}/CHANGELOG.md`))
await copy(join(__dirname, '../src/packages/lottie/animation'), join(`${npmPublishDir}/dist/es/packages/lottie/animation`))
await copy(join(__dirname, '../src/packages/lottie/animation'), join(`${npmPublishDir}/dist/cjs/packages/lottie/animation`))
await writeFile(join(__dirname, `../${npmPublishDir}/package.json`), generateReleasePackageJson())
}

Expand Down Expand Up @@ -484,8 +479,6 @@ console.time('Build Declaration')
await buildDeclaration()
console.timeEnd('Build Declaration')

// await exportProps()

await deleteAsync([
`${dist}/es/packages/nutui.react.js`,
`${dist}/es/packages/nutui.react.d.ts`,
Expand Down
75 changes: 37 additions & 38 deletions scripts/build.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { access, mkdir, readFile, writeFile } from 'fs/promises'
import { basename, dirname, extname, join, relative, resolve } from 'path'
import j from 'jscodeshift'
import { readFileSync } from 'fs'
import { relativeFilePath } from './relative-path.mjs'
import { relativePath } from './relative-path.mjs'
import { codeShift } from './build-comments-to-dts.mjs'
import { generate } from './build-theme-typings.mjs'

Expand Down Expand Up @@ -120,7 +120,7 @@ async function buildDeclaration() {
: ''
if (!importAlias) return
const dir = join(__dirname, importAlias.replace('@/', '../src/'))
path.node.source.value = relativeFilePath(file.path, dir)
path.node.source.value = relativePath(dir, file.path)
})
.toSource()
}
Expand Down Expand Up @@ -177,35 +177,26 @@ async function buildUMD(p) {
},
})
}

// 针对不同包构建全量的 style
async function buildAllCSS() {
// 拷贝styles
async function copyStyles() {
await copy(
resolve(__dirname, '../src/styles'),
resolve(__dirname, `../${dist}/styles`),
)

async function generateAllStyles() {
const projectID = process.env.VITE_APP_PROJECT_ID
const content = [
`@import './styles/theme-default.scss';`,
`@import './styles/variables.scss';`,
`@import './styles/variables${projectID ? `-${projectID}` : ''}.scss';`,
`@import './styles/mixins/index.scss';`,
`@import './styles/animation/index.scss';`,
]
const projectID = process.env.VITE_APP_PROJECT_ID
if (projectID) {
content[1] = `@import '../variables-${projectID}.scss';`
}
const scssFiles = await glob([`${dist}/es/packages/**/*.scss`])
scssFiles.forEach((file) => {
content.push(
`@import '${relativeFilePath(`/${dist}/style.scss`, '/' + file)}';`,
`@import '${relativePath('/' + file, `/${dist}/style.scss`)}';`,
)
})
dest(`${dist}/style.scss`, content.join('\n'))
}

await copyStyles()
await generateAllStyles()
await vite.build({
logLevel: 'error',
resolve: {
Expand All @@ -225,6 +216,30 @@ async function buildAllCSS() {
}

async function buildThemeCSS() {
const files = await glob([`${dist}/styles/theme-*.scss`], {
ignore: [`${dist}/types/src/**/*.taro.d.ts`],
})
const projectID = process.env.VITE_APP_PROJECT_ID
const inputFiles = {}
// nuitui 官方包包含全部主题文件,包括:
// default.css 默认明亮主题
// dark.css 默认暗黑主题
// jmapp.css、jrkf.css 主题
// 例如:jmapp 包只包含 jmapp 的主题文件,且是默认主题文件。
files.forEach(filePath => {
const themeName = basename(filePath, 'scss').replace('theme-', '')
if (!projectID) {
inputFiles[themeName] = `./${filePath}`
} else {
if (themeName === projectID) {
inputFiles['default'] = `./${filePath}`
}
if (themeName === `${projectID}-dark`) {
inputFiles['dark'] = `./${filePath}`
}
}
})

await vite.build({
logLevel: 'error',
resolve: {
Expand All @@ -233,41 +248,23 @@ async function buildThemeCSS() {
build: {
emptyOutDir: false,
rollupOptions: {
input: inputFiles,
output: [
{
dir: `${dist}/styles/themes`,
assetFileNames: 'default.css',
assetFileNames: '[name].css',
},
],
},
lib: {
entry: `./${dist}/styles/themes/default.scss`,
},
},
})
}

// 拷贝styles
async function copyStyles() {
await copy(
resolve(__dirname, '../src/styles'),
resolve(__dirname, `../${dist}/styles`),
)

let content = [
`@import '../theme-default.scss';`,
`@import '../theme-dark.scss';`,
`@import '../jd-font';`,
]
const projectID = process.env.VITE_APP_PROJECT_ID
if (projectID) {
content = [
`@import '../theme-${projectID}.scss';`,
`@import '../jd-font';`,
]
}

dest(`${dist}/styles/themes/default.scss`, content.join('\n'))
}

// 构建样式
Expand Down Expand Up @@ -384,6 +381,8 @@ async function copyReleaseFiles() {
const npmPublishDir = dist.replace('dist', '')
await copy(join(__dirname, '../README.md'), join(`${npmPublishDir}/README.md`))
await copy(join(__dirname, '../CHANGELOG.md'), join(`${npmPublishDir}/CHANGELOG.md`))
await copy(join(__dirname, '../src/packages/lottie/animation'), join(`${npmPublishDir}/dist/es/packages/lottie/animation`))
await copy(join(__dirname, '../src/packages/lottie/animation'), join(`${npmPublishDir}/dist/cjs/packages/lottie/animation`))
await writeFile(join(__dirname, `../${npmPublishDir}/package.json`), generateReleasePackageJson())
}

Expand Down Expand Up @@ -438,4 +437,4 @@ console.timeEnd('Build JSDoc')

console.time('Copy package.json readme.md')
await copyReleaseFiles()
console.timeEnd('Copy package.json readme.md')
console.timeEnd('Copy package.json readme.md')
44 changes: 16 additions & 28 deletions scripts/relative-path.mjs
Original file line number Diff line number Diff line change
@@ -1,33 +1,21 @@
import * as path from 'path'
import { resolve } from 'path'

export function relativeFilePath(from, to) {
if (
(from[0] === path.sep && to[0] !== path.sep) ||
(from[0] !== path.sep && to[0] === path.sep)
) {
return ''
}

if (from[from.length - 1] === path.sep || to[to.length - 1] === path.sep) {
return ''
}
export function relativePath(target, source) {
const resolveSource = resolve(source)
const resolveTarget = resolve(target)

const fromPath = from.split(path.sep)
const toPath = to.split(path.sep)

let i = 0
while (i < fromPath.length - 1) {
if (toPath[i] === undefined || fromPath[i] !== toPath[i]) {
break
}
++i
let str = resolveTarget.substr(0, resolve(resolveTarget).lastIndexOf('/'))
while (resolveSource.indexOf(str) == -1) {
str = str.substr(0, str.lastIndexOf('/'))
}

const val = toPath.slice(i).join(path.sep)

if (i === fromPath.length - 1) {
return '.' + path.sep + val
const remain = resolveSource.replace(str+'/', '')
const matchedSlash = remain.match(/\//g)
let res = ''
if (!matchedSlash) {
res = resolveTarget.replace(str+'/', './')
} else {
res = resolveTarget.replace(str+'/', '../'.repeat(matchedSlash.length))
}

return `..${path.sep}`.repeat(fromPath.length - 1 - i) + val
}
return res
}
2 changes: 1 addition & 1 deletion scripts/replace-css-var.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const variables = fs.readFileSync(

const theme = fs.readFileSync(
path.join(__dirname, '../src/styles/theme-default.scss'),
).toString()
).toString().replace('@import "./jd-font";', '').replace(`@import './jd-font';`, '')

const exclude = ['icon']
components.forEach((component) => {
Expand Down
Loading
Loading