-
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
79 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
{ | ||
"name": "@uni-helper/unocss-preset-uni", | ||
"name": "@uni-helper/unocss-uni", | ||
"type": "module", | ||
"version": "0.0.1", | ||
"packageManager": "[email protected]", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -67,4 +67,4 @@ | |
"darkmode": true, | ||
"themeLocation": "theme.json" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,4 +16,4 @@ | |
"navigationStyle": "custom" | ||
}, | ||
"subPackages": [] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
<template> | ||
<div container mx-auto py-10> | ||
<view class="bg-blue cursor-pointer border-1 inline-block p-2 rounded">weixin page</view> | ||
<view class="bg-blue cursor-pointer border-1 inline-block p-2 rounded"> | ||
weixin page | ||
</view> | ||
</div> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { defineConfig as defineUnoCSSConfig } from 'unocss' | ||
import type { UserConfig } from 'unocss' | ||
import type { Theme } from '@unocss/preset-mini' | ||
import type { UserUniPresetOptions } from './types' | ||
import { resolveOptions } from './options' | ||
import { presetUni } from './presetUni' | ||
import { createTransformers } from './transformers' | ||
|
||
export function defineConfig<T extends object = Theme>(config: UserConfig<T> & UserUniPresetOptions) { | ||
const options: UserUniPresetOptions = { | ||
uno: config.uno, | ||
attributify: config.attributify, | ||
} | ||
if (!config.presets) | ||
// @ts-expect-error ignore | ||
config.presets = [presetUni(options)] | ||
|
||
const transformers = createTransformers(resolveOptions(options)) | ||
|
||
if (!config.transformers) | ||
config.transformers = transformers | ||
else | ||
config.transformers = [...config.transformers, ...transformers] | ||
|
||
return defineUnoCSSConfig(config) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,4 @@ | ||
import { definePreset } from '@unocss/core' | ||
import { builtInPlatforms } from '@uni-helper/uni-env' | ||
import { resolveOptions } from './options' | ||
import { createPresets } from './presets' | ||
import type { UserUniPresetOptions } from './types' | ||
import { createTransformers } from './transformers' | ||
import { createVariants } from './variants' | ||
|
||
export default definePreset((userOptions: UserUniPresetOptions = {}) => { | ||
const options = resolveOptions(userOptions) | ||
const presets = createPresets(options) | ||
const transformers = createTransformers(options) | ||
const variants = createVariants() | ||
|
||
return { | ||
name: 'unocss-preset-uni', | ||
transformers, | ||
presets, | ||
variants, | ||
theme: { | ||
platform: builtInPlatforms.reduce((acc, platform) => { | ||
acc[platform] = platform | ||
return acc | ||
}, {} as any), | ||
}, | ||
} | ||
}) | ||
export * from './presetUni' | ||
export * from './transformers' | ||
export * from './config' | ||
export * from './types' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { builtInPlatforms } from '@uni-helper/uni-env' | ||
import type { PresetFactory } from 'unocss' | ||
import { definePreset } from 'unocss' | ||
|
||
import { resolveOptions } from './options' | ||
import { createPresets } from './presets' | ||
import type { UserUniPresetOptions } from './types' | ||
import { createVariants } from './variants' | ||
|
||
const presetFactoryUni: PresetFactory = (userOptions: UserUniPresetOptions = {}) => { | ||
const options = resolveOptions(userOptions) | ||
const presets = createPresets(options) | ||
const variants = createVariants() | ||
|
||
return { | ||
name: 'unocss-preset-uni', | ||
presets, | ||
variants, | ||
theme: { | ||
platform: builtInPlatforms.reduce((acc, platform) => { | ||
acc[platform] = platform | ||
return acc | ||
}, {} as any), | ||
}, | ||
} | ||
} | ||
|
||
export const presetUni = definePreset(presetFactoryUni) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters