Skip to content

Commit

Permalink
Merge pull request #11 from unpreset/fix-when-add-prefix
Browse files Browse the repository at this point in the history
fix: should work when set prefix in preset-uno/mini/wind
  • Loading branch information
action-hong authored Sep 21, 2023
2 parents 0446eca + 1f57427 commit 7ca8216
Show file tree
Hide file tree
Showing 11 changed files with 3,044 additions and 2,452 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,8 @@ export default defineConfig({
|`scrollbarTrackColor`|`#f5f5f5`|default scrollbar track background color|
|`scrollbarThumbColor`|`#ddd`|default scrollbar thumb background color|
|`numberToUnit`|``value => `${value / 4}rem` ``| number to unit
|`varPrefix`|`''`|the css variable prefix of this preset
|`varPrefix`|`''`|the css variable prefix of this preset|
|`prefix`|`''`|Apply prefix to all utilities and shortcuts|


for example
Expand Down
1 change: 1 addition & 0 deletions README.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ export default defineConfig({
|`scrollbarThumbColor`|`#ddd`|默认的滚动条滑块的背景色|
|`numberToUnit`|``value => `${value / 4}rem` ``|捕获到的数字转化成单位的方法|
|`varPrefix`|`''`|该预设生成的`css`变量的前缀|
|`prefix`|`''`|该预设生成的shortcuts加上前缀|


举个例子
Expand Down
70 changes: 36 additions & 34 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,69 +1,71 @@
{
"name": "unocss-preset-scrollbar",
"version": "0.2.1",
"packageManager": "pnpm@6.32.3",
"packageManager": "pnpm@8.7.6",
"description": "unocss preset for scrollbar",
"author": "kkopite <[email protected]>",
"license": "MIT",
"homepage": "https://github.com/action-hong/unocss-preset-scrollbar#readme",
"repository": {
"type": "git",
"url": "git+https://github.com/action-hong/unocss-preset-scrollbar.git"
},
"bugs": {
"url": "https://github.com/action-hong/unocss-preset-scrollbar/issues"
},
"keywords": [
"unocss",
"unocss-preset",
"scrollbar",
"unocss-preset-scrollbar"
],
"homepage": "https://github.com/action-hong/unocss-preset-scrollbar#readme",
"bugs": {
"url": "https://github.com/action-hong/unocss-preset-scrollbar/issues"
},
"license": "MIT",
"author": "kkopite <[email protected]>",
"repository": {
"type": "git",
"url": "git+https://github.com/action-hong/unocss-preset-scrollbar.git"
},
"main": "./dist/index.cjs",
"module": "./dist/index.mjs",
"types": "./dist/index.d.ts",
"sideEffects": false,
"exports": {
".": {
"require": "./dist/index.cjs",
"types": "./dist/index.d.ts",
"import": "./dist/index.mjs",
"types": "./dist/index.d.ts"
"require": "./dist/index.cjs"
}
},
"main": "./dist/index.cjs",
"module": "./dist/index.mjs",
"types": "./dist/index.d.ts",
"files": [
"dist"
],
"sideEffects": false,
"scripts": {
"build": "rimraf dist && unbuild",
"dev": "unbuild --stub",
"lint": "eslint .",
"lint:fix": "eslint . --fix",
"prepublishOnly": "nr build",
"release": "bumpp --commit --push --tag && pnpm publish",
"start": "esno src/index.ts",
"test": "vitest",
"typecheck": "tsc --noEmit"
"typecheck": "tsc --noEmit",
"play": "npm -C playground run dev"
},
"peerDependencies": {
"unocss": ">= 0.31.13 < 1"
},
"dependencies": {
"@unocss/preset-mini": "^0.31.13"
"@unocss/preset-mini": "^0.56.0"
},
"devDependencies": {
"@antfu/eslint-config": "^0.20.7",
"@antfu/ni": "^0.14.0",
"@babel/types": "^7.17.0",
"@types/node": "^17.0.26",
"@unocss/autocomplete": "^0.31.13",
"bumpp": "^7.1.1",
"eslint": "^8.14.0",
"esno": "^0.14.1",
"pnpm": "^6.32.9",
"rimraf": "^3.0.2",
"typescript": "^4.6.3",
"unbuild": "^0.7.4",
"unocss": "^0.31.13",
"vite": "^2.9.5",
"vitest": "^0.9.4"
"@antfu/eslint-config": "^0.43.0",
"@antfu/ni": "^0.21.8",
"@babel/types": "^7.22.19",
"@types/node": "^18.17.18",
"@unocss/autocomplete": "^0.56.0",
"bumpp": "^9.2.0",
"eslint": "^8.49.0",
"esno": "^0.17.0",
"pnpm": "^8.7.6",
"rimraf": "^5.0.1",
"typescript": "^5.2.2",
"unbuild": "^2.0.0",
"unocss": "^0.56.0",
"vite": "^4.4.9",
"vitest": "^0.34.4"
}
}
51 changes: 26 additions & 25 deletions playground/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,58 +9,59 @@
<body bg="gray-50">
<div id="app">
<div
p="4"
m="2"
flex="~ col" items="center" justify="center"
tw-p="4"
tw-m="2"
tw-flex="~ col" items="center" justify="center"
border="~">
<div p="4" w="50" scrollbar="~">
<div w="200">
<div tw-p="4" tw-w="50" un-scrollbar="~">
<div tw-w="200">
default scrollbar default scrollbar default scrollbar default scrollbar
</div>
</div>
<div p="4" w="50" class="foo">
<div w="200">
<div tw-p="4" tw-w="50" class="foo">
<div tw-w="200">
default scrollbar default scrollbar default scrollbar default scrollbar
</div>
</div>
<div p="4" w="50" scrollbar="~ track-color-gray-800 thumb-color-teal-700">
<div w="200">
<div tw-p="4" tw-w="50" un-scrollbar="~ track-color-gray-800 thumb-color-teal-700">
<div tw-w="200">
track color is gray-800 thumb color is teal-700
</div>
</div>
<div p="4" w="50" scrollbar="~ rounded">
<div w="200">
<div tw-p="4" tw-w="50" scrollbar="~ rounded">
<div tw-w="200">
rounded scrollbar rounded scrollbar rounded scrollbar rounded scrollbar
</div>
</div>
<div p="4" w="50" scrollbar="~ h-4px">
<div w="200">
<div tw-p="4" tw-w="50" scrollbar="~ h-4px">
<div tw-w="200">
scrollbar height is 4px scrollbar height is 4px scrollbar height is 4px
</div>
</div>
</div>
<div
p="4"
m="2"
flex="~" items="center" justify="center"
border="~">
<div p="4" h="50" flex="1" scrollbar="~">
<div h="200">
tw-p="4"
tw-m="2"
tw-flex="~"
tw-items="center" tw-justify="center"
tw-border="~">
<div tw-p="4" tw-h="50" tw-flex="1" un-scrollbar="~">
<div tw-h="200">
default scrollbar default scrollbar default scrollbar default scrollbar
</div>
</div>
<div p="4" h="50" flex="1" scrollbar="~ track-color-gray-800 thumb-color-teal-700">
<div h="200">
<div tw-p="4" tw-h="50" tw-flex="1" scrollbar="~ track-color-gray-800 thumb-color-teal-700">
<div tw-h="200">
track color is gray-800 thumb color is teal-700
</div>
</div>
<div p="4" h="50" flex="1" scrollbar="~ rounded">
<div h="200">
<div tw-p="4" tw-h="50" tw-flex="1" scrollbar="~ rounded">
<div tw-h="200">
rounded scrollbar rounded scrollbar rounded scrollbar rounded scrollbar
</div>
</div>
<div p="4" h="50" flex="1" scrollbar="~ w-4px">
<div h="200">
<div tw-p="4" tw-h="50" tw-flex="1" scrollbar="~ w-4px">
<div tw-h="200">
scrollbar width is 4px scrollbar height is 4px scrollbar width is 4px
</div>
</div>
Expand Down
12 changes: 6 additions & 6 deletions playground/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
{
"compilerOptions": {
"target": "ESNext",
"lib": ["ESNext", "DOM"],
"useDefineForClassFields": true,
"module": "ESNext",
"lib": ["ESNext", "DOM"],
"moduleResolution": "Node",
"strict": true,
"sourceMap": true,
"resolveJsonModule": true,
"esModuleInterop": true,
"sourceMap": true,
"noEmit": true,
"esModuleInterop": true,
"strict": true,
"noImplicitReturns": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noImplicitReturns": true
"noUnusedParameters": true
},
"include": ["src"]
}
5 changes: 4 additions & 1 deletion playground/unocss.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,13 @@ import { presetScrollbar } from '../src'

export default defineConfig({
presets: [
presetUno(),
presetUno({
prefix: 'tw-',
}),
presetAttributify(),
presetScrollbar({
varPrefix: 'un',
prefix: ['un', ''],
}),
],
transformers: [
Expand Down
Loading

0 comments on commit 7ca8216

Please sign in to comment.