@nexxtmove/ui 1.32.0 → 1.33.0
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/package.json
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
* `full` is last and carries no px: it is a pill, not a size on the scale, so
|
|
12
12
|
* the readout names it instead of measuring it.
|
|
13
13
|
*/
|
|
14
|
-
const
|
|
14
|
+
export const EDITOR_RADIUS_STEPS = [
|
|
15
15
|
{ token: 'none', px: 0 },
|
|
16
16
|
{ token: 'xs', px: 2 },
|
|
17
17
|
{ token: 'sm', px: 4 },
|
|
@@ -28,7 +28,7 @@ const RADIUS_STEPS = [
|
|
|
28
28
|
* The radius as the editor needs it: the Tailwind class itself, so the consumer
|
|
29
29
|
* can put the model value straight on the element it styles.
|
|
30
30
|
*/
|
|
31
|
-
export type EditorRadiusValue = `rounded-${(typeof
|
|
31
|
+
export type EditorRadiusValue = `rounded-${(typeof EDITOR_RADIUS_STEPS)[number]['token']}`
|
|
32
32
|
|
|
33
33
|
/** Overridable copy of the value readout. Every key is optional. */
|
|
34
34
|
export interface EditorRadiusMessages {
|
|
@@ -75,7 +75,7 @@ const model = defineModel<EditorRadiusValue>({ required: true })
|
|
|
75
75
|
|
|
76
76
|
const copy = computed(() => ({ ...DEFAULT_MESSAGES, ...messages }))
|
|
77
77
|
|
|
78
|
-
const maxIndex =
|
|
78
|
+
const maxIndex = EDITOR_RADIUS_STEPS.length - 1
|
|
79
79
|
|
|
80
80
|
/**
|
|
81
81
|
* Position of the current value on the step list. A value that is not on the
|
|
@@ -86,7 +86,7 @@ const maxIndex = RADIUS_STEPS.length - 1
|
|
|
86
86
|
const stepIndex = computed(() =>
|
|
87
87
|
Math.max(
|
|
88
88
|
0,
|
|
89
|
-
|
|
89
|
+
EDITOR_RADIUS_STEPS.findIndex(({ token }) => `rounded-${token}` === model.value),
|
|
90
90
|
),
|
|
91
91
|
)
|
|
92
92
|
|
|
@@ -95,12 +95,12 @@ const stepIndex = computed(() =>
|
|
|
95
95
|
const sliderValue = computed({
|
|
96
96
|
get: () => [stepIndex.value],
|
|
97
97
|
set: ([index]) => {
|
|
98
|
-
model.value = `rounded-${
|
|
98
|
+
model.value = `rounded-${EDITOR_RADIUS_STEPS[index].token}`
|
|
99
99
|
},
|
|
100
100
|
})
|
|
101
101
|
|
|
102
102
|
const displayValue = computed(() => {
|
|
103
|
-
const { px } =
|
|
103
|
+
const { px } = EDITOR_RADIUS_STEPS[stepIndex.value]
|
|
104
104
|
|
|
105
105
|
return px === null ? copy.value.full : `${px} ${copy.value.unit}`
|
|
106
106
|
})
|
package/src/index.ts
CHANGED
|
@@ -57,6 +57,7 @@ export type {
|
|
|
57
57
|
EditorHeadingTypeMessages,
|
|
58
58
|
EditorHeadingTypeValue,
|
|
59
59
|
} from './components/editor/molecules/EditorHeadingType/EditorHeadingType.vue'
|
|
60
|
+
export { EDITOR_RADIUS_STEPS } from './components/editor/molecules/EditorRadius/EditorRadius.vue'
|
|
60
61
|
export type {
|
|
61
62
|
EditorRadiusMessages,
|
|
62
63
|
EditorRadiusValue,
|