looseleaf-uni 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/CHANGELOG.md +6 -0
- package/lib/common/theme.ts +3 -3
- package/lib/components/ll-attachment/ll-attachment.vue +6 -2
- package/lib/components/ll-avatar/ll-avatar.vue +8 -1
- package/lib/components/ll-badge/ll-badge.vue +6 -1
- package/lib/components/ll-button/ll-button.vue +7 -1
- package/lib/components/ll-checkbox/ll-checkbox.vue +18 -4
- package/lib/components/ll-input-otp/ll-input-otp.vue +17 -4
- package/lib/components/ll-progress/ll-progress.vue +12 -2
- package/lib/components/ll-radio-group/ll-radio-group.vue +25 -0
- package/lib/components/ll-ribbon/ll-ribbon.vue +10 -3
- package/lib/components/ll-slider/ll-slider.vue +25 -1
- package/lib/components/ll-switch/ll-switch.vue +40 -0
- package/lib/components/ll-textarea/ll-textarea.vue +7 -2
- package/package.json +1 -1
- package/web-types.json +1 -1
package/lib/CHANGELOG.md
CHANGED
package/lib/common/theme.ts
CHANGED
|
@@ -13,7 +13,7 @@ export interface LooseleafTheme {
|
|
|
13
13
|
highlight: string
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
//
|
|
16
|
+
// 使用固定快照的纸色、石墨与橙色记号笔,主色上的文字沿用深墨色。
|
|
17
17
|
export const looseleafTheme: Readonly<LooseleafTheme> = {
|
|
18
18
|
ink: '#2a2420',
|
|
19
19
|
paper: '#f8f5ee',
|
|
@@ -21,8 +21,8 @@ export const looseleafTheme: Readonly<LooseleafTheme> = {
|
|
|
21
21
|
graph: '#f4f7ef',
|
|
22
22
|
slip: '#fbf8f1',
|
|
23
23
|
muted: '#6f6256',
|
|
24
|
-
primary: '#
|
|
25
|
-
onPrimary: '#
|
|
24
|
+
primary: '#df6b3c',
|
|
25
|
+
onPrimary: '#2a2420',
|
|
26
26
|
destructive: '#a9362d',
|
|
27
27
|
highlight: '#f3d47c',
|
|
28
28
|
}
|
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
+
import { useLooseleafTheme } from '../../common/theme'
|
|
2
3
|
import LlIcon from '../ll-icon/ll-icon.vue'
|
|
3
4
|
import LlButton from '../ll-button/ll-button.vue'
|
|
4
5
|
withDefaults(defineProps<{ name: string; description?: string; state?: 'done' | 'uploading' | 'error'; removable?: boolean }>(), { state: 'done' })
|
|
5
6
|
const emit = defineEmits<{ remove: [] }>()
|
|
7
|
+
const theme = useLooseleafTheme()
|
|
6
8
|
</script>
|
|
7
9
|
<template>
|
|
8
10
|
<view
|
|
9
11
|
class="ll-attachment"
|
|
10
12
|
:class="'ll-attachment--' + state"
|
|
13
|
+
:style="{ '--ll-attachment-uploading': theme.primary, '--ll-attachment-error': theme.destructive }"
|
|
11
14
|
>
|
|
12
15
|
<ll-icon
|
|
13
16
|
name="paperclip"
|
|
@@ -37,6 +40,7 @@ const emit = defineEmits<{ remove: [] }>()
|
|
|
37
40
|
.ll-attachment { display: flex; align-items: center; gap: 8px; padding: 8px; border: 1px dashed #8b745f; }
|
|
38
41
|
.ll-attachment__body { flex: 1; min-width: 0; overflow-wrap: anywhere; }
|
|
39
42
|
.ll-attachment__description { display: block; color: #6b5d50; font-size: 13px; }
|
|
40
|
-
|
|
41
|
-
.ll-attachment--
|
|
43
|
+
/* 上传中使用记号笔主色,错误边框使用主题的危险色。 */
|
|
44
|
+
.ll-attachment--error { border-color: var(--ll-attachment-error); }
|
|
45
|
+
.ll-attachment--uploading { border-color: var(--ll-attachment-uploading); }
|
|
42
46
|
</style>
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import { ref, watch } from 'vue'
|
|
3
|
+
import { useLooseleafTheme } from '../../common/theme'
|
|
4
|
+
|
|
3
5
|
const props = withDefaults(defineProps<{ src?: string; label: string; size?: 'sm' | 'default' | 'lg' | 'xl'; ring?: 'ink' | 'you' | 'marker' | 'none' }>(), { size: 'default', ring: 'ink' })
|
|
6
|
+
const theme = useLooseleafTheme()
|
|
4
7
|
const loaded = ref(false)
|
|
5
8
|
watch(() => props.src, () => { loaded.value = false })
|
|
6
9
|
</script>
|
|
@@ -8,6 +11,7 @@ watch(() => props.src, () => { loaded.value = false })
|
|
|
8
11
|
<view
|
|
9
12
|
class="ll-avatar"
|
|
10
13
|
:class="['ll-avatar--' + size, 'll-avatar--' + ring]"
|
|
14
|
+
:style="{ '--ll-avatar-marker': theme.primary }"
|
|
11
15
|
role="img"
|
|
12
16
|
:aria-label="label"
|
|
13
17
|
>
|
|
@@ -41,7 +45,10 @@ watch(() => props.src, () => { loaded.value = false })
|
|
|
41
45
|
<style scoped>
|
|
42
46
|
.ll-avatar { display: inline-flex; position: relative; width: 36px; height: 36px; border: 1px solid #59493b; border-radius: 49% 51% 47% 53%; background: #efdfbf; vertical-align: middle; }
|
|
43
47
|
.ll-avatar--sm { width: 24px; height: 24px; }.ll-avatar--lg { width: 44px; height: 44px; }.ll-avatar--xl { width: 58px; height: 58px; }
|
|
44
|
-
|
|
48
|
+
/* 记号笔环随主色切换,蓝墨签名环仍使用独立笔色。 */
|
|
49
|
+
.ll-avatar--you { border-color: #36547a; }
|
|
50
|
+
.ll-avatar--marker { border-color: var(--ll-avatar-marker); }
|
|
51
|
+
.ll-avatar--none { border-color: transparent; }
|
|
45
52
|
.ll-avatar__photo, .ll-avatar__fallback { position: absolute; inset: 0; width: 100%; height: 100%; border-radius: inherit; }
|
|
46
53
|
.ll-avatar__photo { opacity: 0; }.ll-avatar__photo--loaded { opacity: 1; }
|
|
47
54
|
.ll-avatar__fallback { display: grid; place-items: center; }.ll-avatar__badge { position: absolute; inset-inline-end: -2px; inset-block-end: -1px; }
|
|
@@ -7,7 +7,12 @@ const props = withDefaults(defineProps<{ variant?: ButtonVariant; size?: 'sm' |
|
|
|
7
7
|
const theme = useLooseleafTheme()
|
|
8
8
|
const style = computed(() => {
|
|
9
9
|
const fill = { default: theme.value.primary, destructive: theme.value.destructive, secondary: theme.value.highlight, outline: 'transparent', ghost: 'transparent', link: 'transparent' }
|
|
10
|
-
|
|
10
|
+
// 危险徽记在深红底上使用纸白色,主色徽记使用主题的主色文字。
|
|
11
|
+
const ink = props.variant === 'destructive' ? theme.value.slip : theme.value.ink
|
|
12
|
+
return {
|
|
13
|
+
backgroundColor: fill[props.variant],
|
|
14
|
+
color: props.variant === 'default' ? theme.value.onPrimary : ink,
|
|
15
|
+
}
|
|
11
16
|
})
|
|
12
17
|
</script>
|
|
13
18
|
|
|
@@ -12,8 +12,14 @@ const theme = useLooseleafTheme()
|
|
|
12
12
|
const box = useInkBox('.ll-button')
|
|
13
13
|
const isSolid = computed(() => props.variant === 'default' || props.variant === 'destructive')
|
|
14
14
|
const tone = computed(() => props.variant === 'destructive' ? theme.value.destructive : theme.value.primary)
|
|
15
|
+
// 橙色主按钮使用深墨字,红色危险按钮使用浅色纸白字以保留对比度。
|
|
16
|
+
const textColor = computed(() => {
|
|
17
|
+
if (props.disabled) return theme.value.muted
|
|
18
|
+
if (props.variant === 'destructive') return theme.value.slip
|
|
19
|
+
return isSolid.value ? theme.value.onPrimary : theme.value.ink
|
|
20
|
+
})
|
|
15
21
|
const style = computed(() => ({
|
|
16
|
-
color:
|
|
22
|
+
color: textColor.value,
|
|
17
23
|
'--ll-btn-fill': isSolid.value && !props.disabled ? tone.value : 'transparent',
|
|
18
24
|
'--ll-btn-focus': theme.value.primary,
|
|
19
25
|
backgroundImage: box.value && buttonInk(box.value.width, box.value.height, props.variant, props.seed, theme.value, props.disabled),
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
+
import { useLooseleafTheme } from '../../common/theme'
|
|
2
3
|
import LlIcon from '../ll-icon/ll-icon.vue'
|
|
3
4
|
|
|
4
5
|
const props = defineProps<{ modelValue: boolean; indeterminate?: boolean; disabled?: boolean; invalid?: boolean; label?: string }>()
|
|
5
6
|
const emit = defineEmits<{ 'update:modelValue': [checked: boolean] }>()
|
|
7
|
+
const theme = useLooseleafTheme()
|
|
6
8
|
function toggle() {
|
|
7
9
|
// 半选完成后变为全选,宿主同步自己的父子选项状态。
|
|
8
10
|
if (!props.disabled) emit('update:modelValue', props.indeterminate || !props.modelValue)
|
|
@@ -22,7 +24,13 @@ function toggle() {
|
|
|
22
24
|
<view
|
|
23
25
|
class="ll-checkbox__box"
|
|
24
26
|
aria-hidden="true"
|
|
25
|
-
:class="{ 'll-checkbox__box--invalid': invalid }"
|
|
27
|
+
:class="{ 'll-checkbox__box--invalid': invalid, 'll-checkbox__box--marked': indeterminate || modelValue }"
|
|
28
|
+
:style="{
|
|
29
|
+
'--ll-checkbox-paper': theme.slip,
|
|
30
|
+
'--ll-checkbox-ink': theme.ink,
|
|
31
|
+
'--ll-checkbox-fill': disabled ? theme.muted : theme.primary,
|
|
32
|
+
'--ll-checkbox-error': theme.destructive,
|
|
33
|
+
}"
|
|
26
34
|
>
|
|
27
35
|
<ll-icon
|
|
28
36
|
v-if="indeterminate || modelValue"
|
|
@@ -45,10 +53,16 @@ function toggle() {
|
|
|
45
53
|
width: 16px;
|
|
46
54
|
height: 16px;
|
|
47
55
|
padding: 1px;
|
|
48
|
-
background-color:
|
|
49
|
-
border: 1px solid
|
|
56
|
+
background-color: var(--ll-checkbox-paper);
|
|
57
|
+
border: 1px solid var(--ll-checkbox-ink);
|
|
50
58
|
border-radius: 4px 2px 4px 3px;
|
|
51
59
|
}
|
|
52
|
-
|
|
60
|
+
/* 勾选和半选叠同一层记号笔,具体状态由勾或横线区分。 */
|
|
61
|
+
.ll-checkbox__box--marked {
|
|
62
|
+
background-color: var(--ll-checkbox-fill);
|
|
63
|
+
background-image: radial-gradient(rgb(42 36 32 / 12%) .4px, transparent .75px);
|
|
64
|
+
background-size: 3px 3px;
|
|
65
|
+
}
|
|
66
|
+
.ll-checkbox__box--invalid { border-color: var(--ll-checkbox-error); }
|
|
53
67
|
.ll-checkbox[disabled] { opacity: .55; }
|
|
54
68
|
</style>
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import { computed, ref } from 'vue'
|
|
3
|
+
import { useLooseleafTheme } from '../../common/theme'
|
|
4
|
+
|
|
3
5
|
const props = withDefaults(defineProps<{ modelValue: string; maxLength?: number; separatorAfter?: number[]; disabled?: boolean; invalid?: boolean; label?: string }>(), { maxLength: 6, separatorAfter: () => [] })
|
|
4
6
|
const emit = defineEmits<{ 'update:modelValue': [value: string]; complete: [value: string] }>()
|
|
7
|
+
const theme = useLooseleafTheme()
|
|
5
8
|
const focused = ref(false)
|
|
6
9
|
const positions = computed(() => Array.from({ length: props.maxLength }, (_, index) => index))
|
|
7
10
|
function update(event: Event) {
|
|
@@ -15,7 +18,16 @@ function update(event: Event) {
|
|
|
15
18
|
</script>
|
|
16
19
|
|
|
17
20
|
<template>
|
|
18
|
-
<view
|
|
21
|
+
<view
|
|
22
|
+
class="ll-otp"
|
|
23
|
+
:style="{
|
|
24
|
+
color: theme.ink,
|
|
25
|
+
'--ll-otp-paper': theme.slip,
|
|
26
|
+
'--ll-otp-edge': theme.muted,
|
|
27
|
+
'--ll-otp-focus': theme.primary,
|
|
28
|
+
'--ll-otp-error': theme.destructive,
|
|
29
|
+
}"
|
|
30
|
+
>
|
|
19
31
|
<view
|
|
20
32
|
v-for="position in positions"
|
|
21
33
|
:key="position"
|
|
@@ -52,9 +64,10 @@ function update(event: Event) {
|
|
|
52
64
|
<style scoped>
|
|
53
65
|
.ll-otp { display: inline-flex; position: relative; gap: 4px; }
|
|
54
66
|
.ll-otp__unit { display: inline-flex; align-items: center; }
|
|
55
|
-
.ll-otp__slot { display: inline-flex; width: 29px; height: 34px; align-items: center; justify-content: center; border: 1px dashed
|
|
56
|
-
|
|
57
|
-
.ll-otp__slot--
|
|
67
|
+
.ll-otp__slot { display: inline-flex; width: 29px; height: 34px; align-items: center; justify-content: center; border: 1px dashed var(--ll-otp-edge); border-radius: 3px 5px 3px 4px; background: var(--ll-otp-paper); }
|
|
68
|
+
/* 焦点继承主色,错误仍由危险色边框标记。 */
|
|
69
|
+
.ll-otp__slot--focus { outline: 2px solid var(--ll-otp-focus); outline-offset: 1px; }
|
|
70
|
+
.ll-otp__slot--invalid { border-color: var(--ll-otp-error); }
|
|
58
71
|
.ll-otp__separator { margin: 0 3px; }
|
|
59
72
|
.ll-otp__input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: .01; color: transparent; font-size: 16px; }
|
|
60
73
|
</style>
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import { computed } from 'vue'
|
|
3
|
+
import { useLooseleafTheme } from '../../common/theme'
|
|
4
|
+
|
|
3
5
|
const props = withDefaults(defineProps<{ value?: number; max?: number; size?: 'sm' | 'default' | 'lg'; ariaLabel?: string }>(), { max: 100, size: 'default' })
|
|
6
|
+
const theme = useLooseleafTheme()
|
|
4
7
|
// 进度的比例会限制在轨道内,零值仍显示已确定的空轨道。
|
|
5
8
|
const percent = computed(() => props.value === undefined ? undefined : Math.min(props.max, Math.max(0, props.value)) / props.max * 100)
|
|
6
9
|
</script>
|
|
@@ -9,6 +12,7 @@ const percent = computed(() => props.value === undefined ? undefined : Math.min(
|
|
|
9
12
|
<view
|
|
10
13
|
class="ll-progress"
|
|
11
14
|
:class="'ll-progress--' + size"
|
|
15
|
+
:style="{ '--ll-progress-paper': theme.slip, '--ll-progress-edge': theme.muted, '--ll-progress-fill': theme.primary }"
|
|
12
16
|
role="progressbar"
|
|
13
17
|
:aria-label="ariaLabel"
|
|
14
18
|
:aria-valuemin="0"
|
|
@@ -28,10 +32,16 @@ const percent = computed(() => props.value === undefined ? undefined : Math.min(
|
|
|
28
32
|
</template>
|
|
29
33
|
|
|
30
34
|
<style scoped>
|
|
31
|
-
|
|
35
|
+
/* 已知进度和加载动画共用同一层记号笔填色。 */
|
|
36
|
+
.ll-progress { position: relative; overflow: hidden; height: 9px; border: 1px solid var(--ll-progress-edge); border-radius: 5px 4px 5px 3px; background: var(--ll-progress-paper); }
|
|
32
37
|
.ll-progress--sm { height: 5px; }
|
|
33
38
|
.ll-progress--lg { height: 16px; }
|
|
34
|
-
.ll-progress__ink {
|
|
39
|
+
.ll-progress__ink {
|
|
40
|
+
height: 100%;
|
|
41
|
+
background-color: var(--ll-progress-fill);
|
|
42
|
+
background-image: repeating-linear-gradient(101deg, transparent 0 6px, rgb(255 255 255 / 14%) 7px 8px);
|
|
43
|
+
border-radius: 4px 6px 3px 4px;
|
|
44
|
+
}
|
|
35
45
|
.ll-progress__ink--moving { width: 33%; animation: ll-progress-slip 1.35s ease-in-out infinite alternate; }
|
|
36
46
|
@keyframes ll-progress-slip { to { transform: translateX(200%); } }
|
|
37
47
|
@media (prefers-reduced-motion: reduce) { .ll-progress__ink--moving { animation: none; } }
|
|
@@ -16,6 +16,7 @@ function update(event: unknown) {
|
|
|
16
16
|
<radio-group
|
|
17
17
|
class="ll-radio-group"
|
|
18
18
|
:class="'ll-radio-group--' + orientation"
|
|
19
|
+
:style="{ '--ll-radio-paper': theme.slip, '--ll-radio-ink': theme.ink, '--ll-radio-fill': theme.primary, '--ll-radio-muted': theme.muted }"
|
|
19
20
|
:aria-label="label"
|
|
20
21
|
@change="update"
|
|
21
22
|
>
|
|
@@ -41,4 +42,28 @@ function update(event: unknown) {
|
|
|
41
42
|
.ll-radio-group--vertical { flex-direction: column; align-items: flex-start; }
|
|
42
43
|
.ll-radio-group--horizontal { flex-wrap: wrap; }
|
|
43
44
|
.ll-radio-group__entry { display: inline-flex; align-items: center; gap: 6px; }
|
|
45
|
+
|
|
46
|
+
/* #ifdef H5 */
|
|
47
|
+
/* 原生单选仅在选中时插入图标,用它的位置绘制橙色墨点,保持分组和重置行为。 */
|
|
48
|
+
.ll-radio-group :deep(.uni-radio-input) {
|
|
49
|
+
box-sizing: border-box;
|
|
50
|
+
width: 20px;
|
|
51
|
+
height: 20px;
|
|
52
|
+
margin-right: 0;
|
|
53
|
+
border: 0;
|
|
54
|
+
border-radius: 49% 52% 47% 51%;
|
|
55
|
+
background-color: var(--ll-radio-paper) !important;
|
|
56
|
+
box-shadow: inset 0 0 0 1.5px var(--ll-radio-ink);
|
|
57
|
+
}
|
|
58
|
+
.ll-radio-group :deep(.uni-radio-input > svg) {
|
|
59
|
+
width: 12px;
|
|
60
|
+
height: 11px;
|
|
61
|
+
transform: translate(-50%, -50%) rotate(-8deg);
|
|
62
|
+
border-radius: 53% 47% 51% 49%;
|
|
63
|
+
background-color: var(--ll-radio-fill);
|
|
64
|
+
}
|
|
65
|
+
.ll-radio-group :deep(.uni-radio-input > svg path) { opacity: 0; }
|
|
66
|
+
.ll-radio-group :deep(.uni-radio-input-disabled) { opacity: .55; }
|
|
67
|
+
.ll-radio-group :deep(.uni-radio-input-disabled > svg) { background-color: var(--ll-radio-muted); }
|
|
68
|
+
/* #endif */
|
|
44
69
|
</style>
|
|
@@ -1,8 +1,15 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import { computed } from 'vue'
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const
|
|
3
|
+
import { useLooseleafTheme } from '../../common/theme'
|
|
4
|
+
|
|
5
|
+
const tones = { tangerine: '#edaa76', lemon: '#f1db75', grass: '#aec881', teal: '#93c8bf', sky: '#9cc7dd', bubblegum: '#e6adc3' }
|
|
6
|
+
const props = withDefaults(defineProps<{ variant?: 'banner' | 'swallow' | 'flag'; tone?: keyof typeof tones | 'marker' | 'hi' | 'paper'; size?: 'sm' | 'default' | 'lg' }>(), { variant: 'banner', tone: 'marker', size: 'default' })
|
|
7
|
+
const theme = useLooseleafTheme()
|
|
8
|
+
// 默认记号笔、荧光笔和纸色沿用主题,具名颜料仍有各自的色样。
|
|
9
|
+
const style = computed(() => ({
|
|
10
|
+
color: props.tone === 'marker' ? theme.value.onPrimary : theme.value.ink,
|
|
11
|
+
backgroundColor: { ...tones, marker: theme.value.primary, hi: theme.value.highlight, paper: theme.value.paper }[props.tone],
|
|
12
|
+
}))
|
|
6
13
|
</script>
|
|
7
14
|
|
|
8
15
|
<template>
|
|
@@ -12,6 +12,9 @@ function valueFrom(event: unknown) {
|
|
|
12
12
|
|
|
13
13
|
<template>
|
|
14
14
|
<slider
|
|
15
|
+
class="ll-slider"
|
|
16
|
+
:class="{ 'll-slider--disabled': disabled }"
|
|
17
|
+
:style="{ '--ll-slider-ink': theme.ink }"
|
|
15
18
|
:aria-label="label"
|
|
16
19
|
:value="modelValue"
|
|
17
20
|
:min="min"
|
|
@@ -20,9 +23,30 @@ function valueFrom(event: unknown) {
|
|
|
20
23
|
:disabled="disabled"
|
|
21
24
|
:show-value="showValue"
|
|
22
25
|
:active-color="theme.primary"
|
|
23
|
-
:background-color="theme.
|
|
26
|
+
:background-color="theme.slip"
|
|
27
|
+
:block-color="theme.slip"
|
|
24
28
|
:block-size="18"
|
|
25
29
|
@changing="emit('changing', valueFrom($event))"
|
|
26
30
|
@change="emit('update:modelValue', valueFrom($event))"
|
|
27
31
|
/>
|
|
28
32
|
</template>
|
|
33
|
+
|
|
34
|
+
<style scoped>
|
|
35
|
+
/* #ifdef H5 */
|
|
36
|
+
/* 只绘制纸底、墨线和滑块外观,拖拽热区和数值换算交给端侧组件。 */
|
|
37
|
+
.ll-slider :deep(.uni-slider-handle-wrapper) {
|
|
38
|
+
height: 5px;
|
|
39
|
+
border-radius: 4px 2px 4px 3px;
|
|
40
|
+
box-shadow: 0 0 0 1px var(--ll-slider-ink);
|
|
41
|
+
}
|
|
42
|
+
.ll-slider :deep(.uni-slider-track) {
|
|
43
|
+
border-radius: 4px 3px 2px 4px;
|
|
44
|
+
background-image: repeating-linear-gradient(101deg, transparent 0 5px, rgb(255 255 255 / 14%) 6px 7px);
|
|
45
|
+
}
|
|
46
|
+
.ll-slider :deep(.uni-slider-thumb) {
|
|
47
|
+
border-radius: 49% 52% 47% 51%;
|
|
48
|
+
box-shadow: inset 0 0 0 1.5px var(--ll-slider-ink);
|
|
49
|
+
}
|
|
50
|
+
.ll-slider--disabled { opacity: .55; }
|
|
51
|
+
/* #endif */
|
|
52
|
+
</style>
|
|
@@ -11,11 +11,51 @@ function change(event: unknown) {
|
|
|
11
11
|
|
|
12
12
|
<template>
|
|
13
13
|
<switch
|
|
14
|
+
class="ll-switch"
|
|
14
15
|
:checked="modelValue"
|
|
15
16
|
:disabled="disabled"
|
|
16
17
|
:aria-label="ariaLabel"
|
|
17
18
|
:name="name"
|
|
18
19
|
:color="theme.primary"
|
|
20
|
+
:style="{ '--ll-switch-ink': theme.ink, '--ll-switch-paper': theme.slip }"
|
|
19
21
|
@change="change"
|
|
20
22
|
/>
|
|
21
23
|
</template>
|
|
24
|
+
|
|
25
|
+
<style scoped>
|
|
26
|
+
/* #ifdef H5 */
|
|
27
|
+
/* 只改 H5 原生开关的绘制,沿用组件自己的勾选类以同步表单重置。 */
|
|
28
|
+
.ll-switch {
|
|
29
|
+
padding: 4px;
|
|
30
|
+
vertical-align: middle;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.ll-switch :deep(.uni-switch-input) {
|
|
34
|
+
width: 44px;
|
|
35
|
+
height: 24px;
|
|
36
|
+
margin-right: 0;
|
|
37
|
+
border: 0;
|
|
38
|
+
border-radius: 12px 13px 12px 11px / 11px 11px 12px 12px;
|
|
39
|
+
background-color: var(--ll-switch-paper);
|
|
40
|
+
background-image: radial-gradient(rgb(42 36 32 / 12%) .4px, transparent .75px);
|
|
41
|
+
background-size: 3px 3px;
|
|
42
|
+
box-shadow: inset 0 0 0 1.5px var(--ll-switch-ink);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.ll-switch :deep(.uni-switch-input::before) {
|
|
46
|
+
content: none;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.ll-switch :deep(.uni-switch-input::after) {
|
|
50
|
+
top: 4px;
|
|
51
|
+
left: 4px;
|
|
52
|
+
box-sizing: border-box;
|
|
53
|
+
width: 16px;
|
|
54
|
+
height: 16px;
|
|
55
|
+
border: 1.5px solid var(--ll-switch-ink);
|
|
56
|
+
border-radius: 49% 52% 47% 51%;
|
|
57
|
+
background-color: var(--ll-switch-paper);
|
|
58
|
+
box-shadow: none;
|
|
59
|
+
}
|
|
60
|
+
/* #endif */
|
|
61
|
+
</style>
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
+
import { useLooseleafTheme } from '../../common/theme'
|
|
3
|
+
|
|
2
4
|
withDefaults(defineProps<{ modelValue: string; placeholder?: string; maxlength?: number; autoHeight?: boolean; disabled?: boolean; ariaLabel?: string }>(), { maxlength: 140 })
|
|
3
5
|
const emit = defineEmits<{ 'update:modelValue': [value: string] }>()
|
|
6
|
+
const theme = useLooseleafTheme()
|
|
4
7
|
function update(event: Event) {
|
|
5
8
|
// 多行输入与单行输入共享 uni-app 的 detail.value 结构。
|
|
6
9
|
emit('update:modelValue', (event as Event & { detail: { value: string } }).detail.value)
|
|
@@ -10,6 +13,7 @@ function update(event: Event) {
|
|
|
10
13
|
<template>
|
|
11
14
|
<textarea
|
|
12
15
|
class="ll-textarea"
|
|
16
|
+
:style="{ color: theme.ink, backgroundColor: theme.slip, '--ll-textarea-edge': theme.muted, '--ll-textarea-focus': theme.primary }"
|
|
13
17
|
:value="modelValue"
|
|
14
18
|
:placeholder="placeholder"
|
|
15
19
|
:auto-height="autoHeight"
|
|
@@ -21,6 +25,7 @@ function update(event: Event) {
|
|
|
21
25
|
</template>
|
|
22
26
|
|
|
23
27
|
<style scoped>
|
|
24
|
-
|
|
25
|
-
.ll-textarea:
|
|
28
|
+
/* 多行输入和单行输入使用相同的纸底与焦点墨色。 */
|
|
29
|
+
.ll-textarea { box-sizing: border-box; display: block; width: 100%; min-height: 80px; padding: 10px 12px; border: 1px solid var(--ll-textarea-edge); border-radius: 5px 3px 5px 3px; font: inherit; }
|
|
30
|
+
.ll-textarea:focus-within { outline: 2px dashed var(--ll-textarea-focus); outline-offset: 2px; }
|
|
26
31
|
</style>
|
package/package.json
CHANGED