@a-drowned-fish/rox-v 1.0.0 → 1.0.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/README.md +190 -18
- package/dist/es/_virtual/_plugin-vue_export-helper.js +8 -0
- package/dist/es/_virtual/_rolldown/runtime.js +11 -0
- package/dist/es/components.js +6 -0
- package/dist/es/index.js +9 -0
- package/dist/es/input-otp/index.js +6 -0
- package/dist/es/input-otp/input-otp.js +7 -0
- package/dist/es/input-otp/input-otp.vue_vue_type_script_setup_true_lang.js +63 -0
- package/dist/es/input-otp/style.css +1 -0
- package/dist/index.js +1 -75
- package/dist/lib/_virtual/_plugin-vue_export-helper.js +1 -0
- package/dist/lib/_virtual/_rolldown/runtime.js +1 -0
- package/dist/lib/components.js +1 -0
- package/dist/lib/index.js +1 -0
- package/dist/lib/input-otp/index.js +1 -0
- package/dist/lib/input-otp/input-otp.js +1 -0
- package/dist/lib/input-otp/input-otp.vue_vue_type_script_setup_true_lang.js +1 -0
- package/dist/lib/input-otp/style.css +1 -0
- package/dist/resolver/index.cjs.js +1 -0
- package/dist/resolver/index.js +20 -0
- package/{resolver → dist/resolver}/resolver.d.ts +5 -3
- package/dist/style.css +2 -1
- package/dist/types/components/components.d.ts +2 -0
- package/dist/types/components/index.d.ts +7 -0
- package/dist/types/components/input-otp/index.d.ts +5 -0
- package/{es → dist/types/components}/input-otp/input-otp.vue.d.ts +5 -10
- package/dist/types/components/input-otp/types.d.ts +8 -0
- package/package.json +52 -56
- package/dist/index.iife.js +0 -1
- package/dist/index.umd.cjs +0 -1
- package/es/components.d.ts +0 -1
- package/es/components.js +0 -69
- package/es/index.d.ts +0 -9
- package/es/index.js +0 -75
- package/es/input-otp/index.css +0 -28
- package/es/input-otp/index.d.ts +0 -3
- package/es/input-otp/index.js +0 -89
- package/lib/components.d.ts +0 -1
- package/lib/components.js +0 -1
- package/lib/index.d.ts +0 -9
- package/lib/index.js +0 -1
- package/lib/input-otp/index.css +0 -28
- package/lib/input-otp/index.d.ts +0 -3
- package/lib/input-otp/index.js +0 -89
- package/lib/input-otp/input-otp.vue.d.ts +0 -23
- package/resolver/resolver.cjs +0 -25
- package/resolver/resolver.js +0 -25
package/README.md
CHANGED
|
@@ -1,32 +1,39 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Rox V
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
一个基于 Vue 3 的组件库,支持按需引入和自动导入。
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
## 安装
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
|
-
npm
|
|
8
|
+
npm install @a-drowned-fish/rox-v
|
|
9
|
+
# 或
|
|
10
|
+
yarn add @a-drowned-fish/rox-v
|
|
11
|
+
# 或
|
|
12
|
+
pnpm add @a-drowned-fish/rox-v
|
|
9
13
|
```
|
|
10
14
|
|
|
11
|
-
|
|
15
|
+
## 使用方式
|
|
16
|
+
|
|
17
|
+
### 1. 完整引入
|
|
12
18
|
|
|
13
19
|
```ts
|
|
14
20
|
import { createApp } from "vue";
|
|
15
21
|
import RoxV from "@a-drowned-fish/rox-v";
|
|
16
|
-
import "@a-drowned-fish/rox-v/dist/style.css";
|
|
22
|
+
import "@a-drowned-fish/rox-v/dist/es/style.css"; // 如果需要样式
|
|
17
23
|
|
|
18
24
|
const app = createApp(App);
|
|
19
25
|
app.use(RoxV);
|
|
20
26
|
```
|
|
21
27
|
|
|
22
|
-
###
|
|
28
|
+
### 2. 按需引入(配合 unplugin-vue-components)
|
|
23
29
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
30
|
+
安装依赖:
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
npm install unplugin-vue-components -D
|
|
27
34
|
```
|
|
28
35
|
|
|
29
|
-
|
|
36
|
+
在 Vite 配置中使用:
|
|
30
37
|
|
|
31
38
|
```ts
|
|
32
39
|
// vite.config.ts
|
|
@@ -35,17 +42,182 @@ import vue from "@vitejs/plugin-vue";
|
|
|
35
42
|
import Components from "unplugin-vue-components/vite";
|
|
36
43
|
import { RoxVResolver } from "@a-drowned-fish/rox-v/resolver";
|
|
37
44
|
|
|
38
|
-
// https://vitejs.dev/config/
|
|
39
45
|
export default defineConfig({
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
+
plugins: [
|
|
47
|
+
vue(),
|
|
48
|
+
Components({
|
|
49
|
+
resolvers: [RoxVResolver()], // 默认会自动引入样式
|
|
50
|
+
}),
|
|
51
|
+
],
|
|
52
|
+
});
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
然后在模板中直接使用组件,无需手动导入:
|
|
56
|
+
|
|
57
|
+
```vue
|
|
58
|
+
<template>
|
|
59
|
+
<Button>点击我</Button>
|
|
60
|
+
<InputOtp />
|
|
61
|
+
</template>
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
**注意**:Resolver 默认会自动引入每个组件的样式文件。如果不需要自动引入样式,可以配置 `importStyle: false`:
|
|
65
|
+
|
|
66
|
+
```ts
|
|
67
|
+
Components({
|
|
68
|
+
resolvers: [RoxVResolver({ importStyle: false })],
|
|
69
|
+
});
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
### 3. 手动按需引入
|
|
73
|
+
|
|
74
|
+
```ts
|
|
75
|
+
import { Button, InputOtp } from "@a-drowned-fish/rox-v";
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
## Resolver 选项
|
|
79
|
+
|
|
80
|
+
`RoxVResolver` 接受一个可选的配置对象:
|
|
81
|
+
|
|
82
|
+
```ts
|
|
83
|
+
interface RoxVResolverOptions {
|
|
84
|
+
/**
|
|
85
|
+
* 使用 CommonJS 构建 (lib) 而不是 ES 模块 (es)
|
|
86
|
+
* @default false
|
|
87
|
+
*/
|
|
88
|
+
cjs?: boolean;
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* 自动引入组件样式
|
|
92
|
+
* @default true
|
|
93
|
+
*/
|
|
94
|
+
importStyle?: boolean;
|
|
95
|
+
}
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
示例:
|
|
99
|
+
|
|
100
|
+
```ts
|
|
101
|
+
// 使用 CommonJS 构建
|
|
102
|
+
Components({
|
|
103
|
+
resolvers: [RoxVResolver({ cjs: true })],
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
// 禁用自动引入样式
|
|
107
|
+
Components({
|
|
108
|
+
resolvers: [RoxVResolver({ importStyle: false })],
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
// 同时配置多个选项
|
|
112
|
+
Components({
|
|
113
|
+
resolvers: [RoxVResolver({ cjs: true, importStyle: true })],
|
|
46
114
|
});
|
|
47
115
|
```
|
|
48
116
|
|
|
117
|
+
## 可用组件
|
|
118
|
+
|
|
119
|
+
### InputOtp - OTP 输入组件
|
|
120
|
+
|
|
121
|
+
一个用于输入一次性密码(OTP)的组件,支持自定义长度、样式和间距。
|
|
122
|
+
|
|
123
|
+
#### 基础用法
|
|
124
|
+
|
|
125
|
+
```vue
|
|
126
|
+
<template>
|
|
127
|
+
<InputOtp v-model="code" />
|
|
128
|
+
</template>
|
|
129
|
+
|
|
130
|
+
<script setup lang="ts">
|
|
131
|
+
import { ref } from "vue";
|
|
132
|
+
|
|
133
|
+
const code = ref("");
|
|
134
|
+
</script>
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
#### 自定义长度
|
|
138
|
+
|
|
139
|
+
```vue
|
|
140
|
+
<template>
|
|
141
|
+
<!-- 4位验证码 -->
|
|
142
|
+
<InputOtp v-model="code" :length="4" />
|
|
143
|
+
|
|
144
|
+
<!-- 8位验证码 -->
|
|
145
|
+
<InputOtp v-model="code" :length="8" />
|
|
146
|
+
</template>
|
|
147
|
+
|
|
148
|
+
<script setup lang="ts">
|
|
149
|
+
import { ref } from "vue";
|
|
150
|
+
|
|
151
|
+
const code = ref("");
|
|
152
|
+
</script>
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
#### 自定义样式
|
|
156
|
+
|
|
157
|
+
```vue
|
|
158
|
+
<template>
|
|
159
|
+
<InputOtp v-model="code" item-class="custom-item" active-item-class="custom-active" gap="15px" />
|
|
160
|
+
</template>
|
|
161
|
+
|
|
162
|
+
<script setup lang="ts">
|
|
163
|
+
import { ref } from "vue";
|
|
164
|
+
|
|
165
|
+
const code = ref("");
|
|
166
|
+
</script>
|
|
167
|
+
|
|
168
|
+
<style scoped>
|
|
169
|
+
.custom-item {
|
|
170
|
+
width: 50px;
|
|
171
|
+
height: 60px;
|
|
172
|
+
border: 2px solid #ddd;
|
|
173
|
+
border-radius: 12px;
|
|
174
|
+
font-size: 24px;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
.custom-active {
|
|
178
|
+
border-color: #67c23a;
|
|
179
|
+
box-shadow: 0 0 0 3px rgba(103, 194, 58, 0.2);
|
|
180
|
+
}
|
|
181
|
+
</style>
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
#### 监听完成事件
|
|
185
|
+
|
|
186
|
+
```vue
|
|
187
|
+
<template>
|
|
188
|
+
<InputOtp v-model="code" @complete="handleComplete" />
|
|
189
|
+
</template>
|
|
190
|
+
|
|
191
|
+
<script setup lang="ts">
|
|
192
|
+
import { ref } from "vue";
|
|
193
|
+
|
|
194
|
+
const code = ref("");
|
|
195
|
+
|
|
196
|
+
const handleComplete = (value: string) => {
|
|
197
|
+
console.log("验证码输入完成:", value);
|
|
198
|
+
// 在这里执行验证逻辑
|
|
199
|
+
};
|
|
200
|
+
</script>
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
#### Props
|
|
204
|
+
|
|
205
|
+
| 属性 | 说明 | 类型 | 默认值 |
|
|
206
|
+
| ------------------ | -------------------------------------------- | -------- | ---------- |
|
|
207
|
+
| modelValue | 绑定值 | `string` | `''` |
|
|
208
|
+
| length | 输入框数量 | `number` | `6` |
|
|
209
|
+
| itemClass | 每个输入项的自定义类名 | `string` | `''` |
|
|
210
|
+
| activeItemClass | 激活状态输入项的自定义类名 | `string` | `''` |
|
|
211
|
+
| gap | 输入项之间的间距 | `string` | `'10px'` |
|
|
212
|
+
| hasFilledItemClass | 具有内容的输入项的类名[active前面选项的类名] | `string` | `'active'` |
|
|
213
|
+
|
|
214
|
+
#### Events
|
|
215
|
+
|
|
216
|
+
| 事件名 | 说明 | 回调参数 |
|
|
217
|
+
| ----------------- | ------------------------------ | ----------------- |
|
|
218
|
+
| update:modelValue | 输入值变化时触发 | `(value: string)` |
|
|
219
|
+
| complete | 输入完成时触发(达到指定长度) | `(value: string)` |
|
|
220
|
+
|
|
49
221
|
## License
|
|
50
222
|
|
|
51
223
|
MIT
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
//#region \0rolldown/runtime.js
|
|
2
|
+
var e = Object.defineProperty, t = (t, n) => {
|
|
3
|
+
let r = {};
|
|
4
|
+
for (var i in t) e(r, i, {
|
|
5
|
+
get: t[i],
|
|
6
|
+
enumerable: !0
|
|
7
|
+
});
|
|
8
|
+
return n || e(r, Symbol.toStringTag, { value: "Module" }), r;
|
|
9
|
+
};
|
|
10
|
+
//#endregion
|
|
11
|
+
export { t as __exportAll };
|
package/dist/es/index.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import e from "./input-otp/index.js";
|
|
2
|
+
import { components_exports as t } from "./components.js";
|
|
3
|
+
//#region components/index.ts
|
|
4
|
+
var n = (e) => (Object.keys(t).forEach((n) => {
|
|
5
|
+
let r = t[n];
|
|
6
|
+
r.install && e.use(r);
|
|
7
|
+
}), e), r = { install: n };
|
|
8
|
+
//#endregion
|
|
9
|
+
export { e as InputOtp, r as default, n as install };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import e from "./input-otp.vue_vue_type_script_setup_true_lang.js";
|
|
2
|
+
/* empty css */
|
|
3
|
+
import t from "../_virtual/_plugin-vue_export-helper.js";
|
|
4
|
+
//#region components/input-otp/input-otp.vue
|
|
5
|
+
var n = /* @__PURE__ */ t(e, [["__scopeId", "data-v-9ff7490d"]]);
|
|
6
|
+
//#endregion
|
|
7
|
+
export { n as default };
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { Fragment as e, createElementBlock as t, createElementVNode as n, defineComponent as r, normalizeClass as i, normalizeStyle as a, openBlock as o, ref as s, renderList as c, toDisplayString as l, vModelText as u, watch as d, withDirectives as f } from "vue";
|
|
2
|
+
//#region components/input-otp/input-otp.vue?vue&type=script&setup=true&lang.ts
|
|
3
|
+
var p = ["maxlength"], m = /* @__PURE__ */ r({
|
|
4
|
+
name: "InputOtp",
|
|
5
|
+
__name: "input-otp",
|
|
6
|
+
props: {
|
|
7
|
+
modelValue: { default: "" },
|
|
8
|
+
length: { default: 6 },
|
|
9
|
+
itemClass: { default: "" },
|
|
10
|
+
activeItemClass: { default: "" },
|
|
11
|
+
gap: { default: "10px" },
|
|
12
|
+
hasFilledItemClass: { default: "active" }
|
|
13
|
+
},
|
|
14
|
+
emits: ["update:modelValue", "complete"],
|
|
15
|
+
setup(r, { emit: m }) {
|
|
16
|
+
let h = r, g = m, _ = s(null), v = s(h.modelValue);
|
|
17
|
+
d(() => h.modelValue, (e) => {
|
|
18
|
+
e !== v.value && (v.value = e);
|
|
19
|
+
});
|
|
20
|
+
function y(e) {
|
|
21
|
+
let t = e.target.value;
|
|
22
|
+
t = t.replace(/\D/g, ""), t = t.slice(0, h.length), v.value = t, g("update:modelValue", t), t.length === h.length && g("complete", t);
|
|
23
|
+
}
|
|
24
|
+
function b() {
|
|
25
|
+
_.value?.focus();
|
|
26
|
+
}
|
|
27
|
+
function x(e) {
|
|
28
|
+
return e === v.value.length;
|
|
29
|
+
}
|
|
30
|
+
function S(e) {
|
|
31
|
+
return e < v.value.length;
|
|
32
|
+
}
|
|
33
|
+
return (s, d) => (o(), t("div", {
|
|
34
|
+
class: "otp-wrapper",
|
|
35
|
+
onClick: b
|
|
36
|
+
}, [f(n("input", {
|
|
37
|
+
inputmode: "numeric",
|
|
38
|
+
autocomplete: "one-time-code",
|
|
39
|
+
ref_key: "inputRef",
|
|
40
|
+
ref: _,
|
|
41
|
+
"onUpdate:modelValue": d[0] ||= (e) => v.value = e,
|
|
42
|
+
maxlength: r.length,
|
|
43
|
+
onInput: y,
|
|
44
|
+
style: {
|
|
45
|
+
position: "absolute",
|
|
46
|
+
opacity: "0",
|
|
47
|
+
"pointer-events": "none"
|
|
48
|
+
}
|
|
49
|
+
}, null, 40, p), [[u, v.value]]), n("div", {
|
|
50
|
+
class: "otp-box",
|
|
51
|
+
style: a({ gap: h.gap })
|
|
52
|
+
}, [(o(!0), t(e, null, c(r.length, (e, n) => (o(), t("div", {
|
|
53
|
+
key: n,
|
|
54
|
+
class: i(["otp-item", [
|
|
55
|
+
{ [h.activeItemClass]: x(n) },
|
|
56
|
+
{ [h.hasFilledItemClass]: S(n) },
|
|
57
|
+
h.itemClass
|
|
58
|
+
]])
|
|
59
|
+
}, l(v.value[n] || ""), 3))), 128))], 4)]));
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
//#endregion
|
|
63
|
+
export { m as default };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.otp-wrapper[data-v-9ff7490d]{cursor:pointer;width:max-content;position:relative}.otp-box[data-v-9ff7490d]{display:flex}.otp-item[data-v-9ff7490d]{border-bottom:1px solid #00000029;justify-content:center;align-items:center;width:60px;height:60px;transition:all .2s;display:flex}.otp-item.active[data-v-9ff7490d]{border-bottom:1px solid #000}
|
package/dist/index.js
CHANGED
|
@@ -1,75 +1 @@
|
|
|
1
|
-
|
|
2
|
-
const w = ["maxlength"], D = /* @__PURE__ */ h({
|
|
3
|
-
__name: "input-otp",
|
|
4
|
-
props: {
|
|
5
|
-
modelValue: { default: "" },
|
|
6
|
-
length: { default: 6 },
|
|
7
|
-
itemClass: { default: "" },
|
|
8
|
-
activeItemClass: { default: "" },
|
|
9
|
-
gap: { default: "10px" }
|
|
10
|
-
},
|
|
11
|
-
emits: ["update:modelValue", "complete"],
|
|
12
|
-
setup(n, { emit: c }) {
|
|
13
|
-
const t = n, o = c, u = d(null), a = d(t.modelValue);
|
|
14
|
-
_(
|
|
15
|
-
() => t.modelValue,
|
|
16
|
-
(l) => {
|
|
17
|
-
l !== a.value && (a.value = l);
|
|
18
|
-
}
|
|
19
|
-
);
|
|
20
|
-
function v(l) {
|
|
21
|
-
let e = l.target.value;
|
|
22
|
-
e = e.replace(/\D/g, ""), e = e.slice(0, t.length), a.value = e, o("update:modelValue", e), e.length === t.length && o("complete", e);
|
|
23
|
-
}
|
|
24
|
-
function g() {
|
|
25
|
-
var l;
|
|
26
|
-
(l = u.value) == null || l.focus();
|
|
27
|
-
}
|
|
28
|
-
function r(l) {
|
|
29
|
-
return l === a.value.length;
|
|
30
|
-
}
|
|
31
|
-
return (l, e) => (i(), p("div", {
|
|
32
|
-
class: "otp-wrapper",
|
|
33
|
-
onClick: g
|
|
34
|
-
}, [
|
|
35
|
-
I(f("input", {
|
|
36
|
-
inputmode: "numeric",
|
|
37
|
-
autocomplete: "one-time-code",
|
|
38
|
-
ref_key: "inputRef",
|
|
39
|
-
ref: u,
|
|
40
|
-
"onUpdate:modelValue": e[0] || (e[0] = (m) => a.value = m),
|
|
41
|
-
maxlength: n.length,
|
|
42
|
-
onInput: v,
|
|
43
|
-
class: "otp-input"
|
|
44
|
-
}, null, 40, w), [
|
|
45
|
-
[V, a.value]
|
|
46
|
-
]),
|
|
47
|
-
f("div", {
|
|
48
|
-
class: "otp-box",
|
|
49
|
-
style: C({ gap: t.gap })
|
|
50
|
-
}, [
|
|
51
|
-
(i(!0), p(k, null, x(n.length, (m, s) => (i(), p("div", {
|
|
52
|
-
key: s,
|
|
53
|
-
class: y(["otp-item", [
|
|
54
|
-
{ active: r(s), [t.activeItemClass]: r(s) },
|
|
55
|
-
t.itemClass
|
|
56
|
-
]])
|
|
57
|
-
}, b(a.value[s] || ""), 3))), 128))
|
|
58
|
-
], 4)
|
|
59
|
-
]));
|
|
60
|
-
}
|
|
61
|
-
}), O = (n, c) => {
|
|
62
|
-
const t = n.__vccOpts || n;
|
|
63
|
-
for (const [o, u] of c)
|
|
64
|
-
t[o] = u;
|
|
65
|
-
return t;
|
|
66
|
-
}, R = /* @__PURE__ */ O(D, [["__scopeId", "data-v-14ecb7bd"]]), z = "1.0.0", B = (n) => {
|
|
67
|
-
n.component("RInputOtp", R);
|
|
68
|
-
}, S = {
|
|
69
|
-
version: z,
|
|
70
|
-
install: B
|
|
71
|
-
};
|
|
72
|
-
export {
|
|
73
|
-
R as InputOtp,
|
|
74
|
-
S as default
|
|
75
|
-
};
|
|
1
|
+
(function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require(`vue`)):typeof define==`function`&&define.amd?define([`exports`,`vue`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e[`rox-v`]={},e.Vue))})(this,function(e,t){Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});var n=Object.defineProperty,r=(e,t)=>{let r={};for(var i in e)n(r,i,{get:e[i],enumerable:!0});return t||n(r,Symbol.toStringTag,{value:`Module`}),r},i=[`maxlength`],a=((e,t)=>{let n=e.__vccOpts||e;for(let[e,r]of t)n[e]=r;return n})((0,t.defineComponent)({name:`InputOtp`,__name:`input-otp`,props:{modelValue:{default:``},length:{default:6},itemClass:{default:``},activeItemClass:{default:``},gap:{default:`10px`},hasFilledItemClass:{default:`active`}},emits:[`update:modelValue`,`complete`],setup(e,{emit:n}){let r=e,a=n,o=(0,t.ref)(null),s=(0,t.ref)(r.modelValue);(0,t.watch)(()=>r.modelValue,e=>{e!==s.value&&(s.value=e)});function c(e){let t=e.target.value;t=t.replace(/\D/g,``),t=t.slice(0,r.length),s.value=t,a(`update:modelValue`,t),t.length===r.length&&a(`complete`,t)}function l(){o.value?.focus()}function u(e){return e===s.value.length}function d(e){return e<s.value.length}return(n,a)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{class:`otp-wrapper`,onClick:l},[(0,t.withDirectives)((0,t.createElementVNode)(`input`,{inputmode:`numeric`,autocomplete:`one-time-code`,ref_key:`inputRef`,ref:o,"onUpdate:modelValue":a[0]||=e=>s.value=e,maxlength:e.length,onInput:c,style:{position:`absolute`,opacity:`0`,"pointer-events":`none`}},null,40,i),[[t.vModelText,s.value]]),(0,t.createElementVNode)(`div`,{class:`otp-box`,style:(0,t.normalizeStyle)({gap:r.gap})},[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(e.length,(e,n)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:n,class:(0,t.normalizeClass)([`otp-item`,[{[r.activeItemClass]:u(n)},{[r.hasFilledItemClass]:d(n)},r.itemClass]])},(0,t.toDisplayString)(s.value[n]||``),3))),128))],4)]))}}),[[`__scopeId`,`data-v-9ff7490d`]]);a.install=e=>(a.name&&e.component(a.name,a),e);var o=a,s=r({InputOtp:()=>o}),c=e=>(Object.keys(s).forEach(t=>{let n=s[t];n.install&&e.use(n)}),e),l={install:c};e.InputOtp=o,e.default=l,e.install=c});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e=(e,t)=>{let n=e.__vccOpts||e;for(let[e,r]of t)n[e]=r;return n};exports.default=e;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e=Object.defineProperty,t=(t,n)=>{let r={};for(var i in t)e(r,i,{get:t[i],enumerable:!0});return n||e(r,Symbol.toStringTag,{value:`Module`}),r};exports.__exportAll=t;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require(`./_virtual/_rolldown/runtime.js`),t=require(`./input-otp/index.js`);var n=e.__exportAll({InputOtp:()=>t.default});Object.defineProperty(exports,`components_exports`,{enumerable:!0,get:function(){return n}});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require(`./input-otp/index.js`),t=require(`./components.js`);var n=e=>(Object.keys(t.components_exports).forEach(n=>{let r=t.components_exports[n];r.install&&e.use(r)}),e),r={install:n};exports.InputOtp=e.default,exports.default=r,exports.install=n;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require(`./input-otp.js`);e.default.install=t=>(e.default.name&&t.component(e.default.name,e.default),t);var t=e.default;exports.default=t;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require(`./input-otp.vue_vue_type_script_setup_true_lang.js`);;/* empty css */var t=require(`../_virtual/_plugin-vue_export-helper.js`).default(e.default,[[`__scopeId`,`data-v-9ff7490d`]]);exports.default=t;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
let e=require(`vue`);var t=[`maxlength`],n=(0,e.defineComponent)({name:`InputOtp`,__name:`input-otp`,props:{modelValue:{default:``},length:{default:6},itemClass:{default:``},activeItemClass:{default:``},gap:{default:`10px`},hasFilledItemClass:{default:`active`}},emits:[`update:modelValue`,`complete`],setup(n,{emit:r}){let i=n,a=r,o=(0,e.ref)(null),s=(0,e.ref)(i.modelValue);(0,e.watch)(()=>i.modelValue,e=>{e!==s.value&&(s.value=e)});function c(e){let t=e.target.value;t=t.replace(/\D/g,``),t=t.slice(0,i.length),s.value=t,a(`update:modelValue`,t),t.length===i.length&&a(`complete`,t)}function l(){o.value?.focus()}function u(e){return e===s.value.length}function d(e){return e<s.value.length}return(r,a)=>((0,e.openBlock)(),(0,e.createElementBlock)(`div`,{class:`otp-wrapper`,onClick:l},[(0,e.withDirectives)((0,e.createElementVNode)(`input`,{inputmode:`numeric`,autocomplete:`one-time-code`,ref_key:`inputRef`,ref:o,"onUpdate:modelValue":a[0]||=e=>s.value=e,maxlength:n.length,onInput:c,style:{position:`absolute`,opacity:`0`,"pointer-events":`none`}},null,40,t),[[e.vModelText,s.value]]),(0,e.createElementVNode)(`div`,{class:`otp-box`,style:(0,e.normalizeStyle)({gap:i.gap})},[((0,e.openBlock)(!0),(0,e.createElementBlock)(e.Fragment,null,(0,e.renderList)(n.length,(t,n)=>((0,e.openBlock)(),(0,e.createElementBlock)(`div`,{key:n,class:(0,e.normalizeClass)([`otp-item`,[{[i.activeItemClass]:u(n)},{[i.hasFilledItemClass]:d(n)},i.itemClass]])},(0,e.toDisplayString)(s.value[n]||``),3))),128))],4)]))}});exports.default=n;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.otp-wrapper[data-v-9ff7490d]{cursor:pointer;width:max-content;position:relative}.otp-box[data-v-9ff7490d]{display:flex}.otp-item[data-v-9ff7490d]{border-bottom:1px solid #00000029;justify-content:center;align-items:center;width:60px;height:60px;transition:all .2s;display:flex}.otp-item.active[data-v-9ff7490d]{border-bottom:1px solid #000}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});function e(e){return e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase()}function t(t={}){let{cjs:n=!1,importStyle:r=!0}=t,i=n?`lib`:`es`;return{type:`component`,resolve:t=>{let n=e(t);return{name:`default`,from:`@a-drowned-fish/rox-v/dist/${i}/${n}/index`,sideEffects:r?`@a-drowned-fish/rox-v/dist/${i}/${n}/style.css`:void 0}}}}exports.RoxVResolver=t,exports.default=t;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
//#region components/resolver.ts
|
|
2
|
+
function e(e) {
|
|
3
|
+
return e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
|
|
4
|
+
}
|
|
5
|
+
function t(t = {}) {
|
|
6
|
+
let { cjs: n = !1, importStyle: r = !0 } = t, i = n ? "lib" : "es";
|
|
7
|
+
return {
|
|
8
|
+
type: "component",
|
|
9
|
+
resolve: (t) => {
|
|
10
|
+
let n = e(t);
|
|
11
|
+
return {
|
|
12
|
+
name: "default",
|
|
13
|
+
from: `@a-drowned-fish/rox-v/dist/${i}/${n}/index`,
|
|
14
|
+
sideEffects: r ? `@a-drowned-fish/rox-v/dist/${i}/${n}/style.css` : void 0
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
//#endregion
|
|
20
|
+
export { t as RoxVResolver, t as default };
|
|
@@ -5,9 +5,11 @@ export interface RoxVResolverOptions {
|
|
|
5
5
|
* @default false
|
|
6
6
|
*/
|
|
7
7
|
cjs?: boolean;
|
|
8
|
+
/**
|
|
9
|
+
* Automatically import component styles
|
|
10
|
+
* @default true
|
|
11
|
+
*/
|
|
12
|
+
importStyle?: boolean;
|
|
8
13
|
}
|
|
9
|
-
/**
|
|
10
|
-
* Create a resolver for rox-v components
|
|
11
|
-
*/
|
|
12
14
|
export declare function RoxVResolver(options?: RoxVResolverOptions): ComponentResolver;
|
|
13
15
|
export default RoxVResolver;
|
package/dist/style.css
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
.otp-wrapper[data-v-
|
|
1
|
+
.otp-wrapper[data-v-9ff7490d]{cursor:pointer;width:max-content;position:relative}.otp-box[data-v-9ff7490d]{display:flex}.otp-item[data-v-9ff7490d]{border-bottom:1px solid #00000029;justify-content:center;align-items:center;width:60px;height:60px;transition:all .2s;display:flex}.otp-item.active[data-v-9ff7490d]{border-bottom:1px solid #000}
|
|
2
|
+
/*$vite$:1*/
|
|
@@ -1,22 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
length?: number;
|
|
4
|
-
itemClass?: string;
|
|
5
|
-
activeItemClass?: string;
|
|
6
|
-
gap?: string;
|
|
7
|
-
}
|
|
8
|
-
declare const _default: import('vue').DefineComponent<Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {} & {
|
|
1
|
+
import { RoxInputOtpProps } from './types';
|
|
2
|
+
declare const _default: import('vue').DefineComponent<RoxInputOtpProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {} & {
|
|
9
3
|
"update:modelValue": (value: string) => any;
|
|
10
4
|
complete: (value: string) => any;
|
|
11
|
-
}, string, import('vue').PublicProps, Readonly<
|
|
5
|
+
}, string, import('vue').PublicProps, Readonly<RoxInputOtpProps> & Readonly<{
|
|
12
6
|
"onUpdate:modelValue"?: ((value: string) => any) | undefined;
|
|
13
7
|
onComplete?: ((value: string) => any) | undefined;
|
|
14
8
|
}>, {
|
|
15
|
-
modelValue: string;
|
|
16
9
|
length: number;
|
|
10
|
+
modelValue: string;
|
|
17
11
|
itemClass: string;
|
|
18
12
|
activeItemClass: string;
|
|
19
13
|
gap: string;
|
|
14
|
+
hasFilledItemClass: string;
|
|
20
15
|
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
|
|
21
16
|
inputRef: HTMLInputElement;
|
|
22
17
|
}, HTMLDivElement>;
|
package/package.json
CHANGED
|
@@ -1,77 +1,73 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@a-drowned-fish/rox-v",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"description": "
|
|
5
|
-
"main": "lib/index.js",
|
|
6
|
-
"module": "es/index.js",
|
|
7
|
-
"types": "
|
|
8
|
-
"browser": "dist/index.iife.js",
|
|
9
|
-
"unpkg": "dist/index.iife.js",
|
|
10
|
-
"jsdelivr": "dist/index.iife.js",
|
|
3
|
+
"version": "1.0.1",
|
|
4
|
+
"description": "vue ui library",
|
|
5
|
+
"main": "dist/lib/index.js",
|
|
6
|
+
"module": "dist/es/index.js",
|
|
7
|
+
"types": "dist/types/components/index.d.ts",
|
|
11
8
|
"files": [
|
|
12
|
-
"dist"
|
|
13
|
-
"es",
|
|
14
|
-
"lib",
|
|
15
|
-
"resolver"
|
|
9
|
+
"dist"
|
|
16
10
|
],
|
|
17
11
|
"exports": {
|
|
18
12
|
".": {
|
|
19
|
-
"import": "./es/index.js",
|
|
20
|
-
"require": "./lib/index.js",
|
|
21
|
-
"types": "./
|
|
13
|
+
"import": "./dist/es/index.js",
|
|
14
|
+
"require": "./dist/lib/index.js",
|
|
15
|
+
"types": "./dist/types/components/index.d.ts"
|
|
22
16
|
},
|
|
23
|
-
"./
|
|
24
|
-
"import": "./es/
|
|
25
|
-
"
|
|
26
|
-
|
|
17
|
+
"./es": {
|
|
18
|
+
"import": "./dist/es/index.js",
|
|
19
|
+
"types": "./dist/types/components/index.d.ts"
|
|
20
|
+
},
|
|
21
|
+
"./lib": {
|
|
22
|
+
"require": "./dist/lib/index.js",
|
|
23
|
+
"types": "./dist/types/components/index.d.ts"
|
|
27
24
|
},
|
|
28
25
|
"./resolver": {
|
|
29
|
-
"import": "./resolver/
|
|
30
|
-
"require": "./resolver/
|
|
31
|
-
"types": "./resolver/resolver.d.ts"
|
|
26
|
+
"import": "./dist/resolver/index.js",
|
|
27
|
+
"require": "./dist/resolver/index.cjs.js",
|
|
28
|
+
"types": "./dist/resolver/resolver.d.ts"
|
|
32
29
|
},
|
|
33
|
-
"./
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
"
|
|
30
|
+
"./es/*": {
|
|
31
|
+
"import": "./dist/es/*.js",
|
|
32
|
+
"types": [
|
|
33
|
+
"./dist/types/*.d.ts",
|
|
34
|
+
"./dist/types/components/index.d.ts"
|
|
35
|
+
]
|
|
36
|
+
},
|
|
37
|
+
"./lib/*": {
|
|
38
|
+
"require": "./dist/lib/*.js",
|
|
39
|
+
"types": "./dist/types/components/index.d.ts"
|
|
40
|
+
},
|
|
41
|
+
"./lib/*.js": {
|
|
42
|
+
"require": "./dist/lib/*.js",
|
|
43
|
+
"types": "./dist/types/components/index.d.ts"
|
|
44
|
+
},
|
|
45
|
+
"./*": "./*"
|
|
45
46
|
},
|
|
46
47
|
"keywords": [
|
|
47
|
-
"vue",
|
|
48
|
-
"
|
|
49
|
-
"component-library",
|
|
50
|
-
"auto-import",
|
|
51
|
-
"unplugin-vue-components"
|
|
48
|
+
"vue-ui",
|
|
49
|
+
"otp"
|
|
52
50
|
],
|
|
53
|
-
"author": "",
|
|
51
|
+
"author": "yangsuzhou",
|
|
54
52
|
"license": "MIT",
|
|
55
|
-
"peerDependencies": {
|
|
56
|
-
"vue": "^3.0.0"
|
|
57
|
-
},
|
|
58
53
|
"peerDependenciesMeta": {
|
|
59
54
|
"unplugin-vue-components": {
|
|
60
55
|
"optional": true
|
|
61
56
|
}
|
|
62
57
|
},
|
|
63
|
-
"
|
|
64
|
-
"vue": "^3.
|
|
58
|
+
"peerDependencies": {
|
|
59
|
+
"vue": "^3.5.0"
|
|
65
60
|
},
|
|
66
|
-
"
|
|
67
|
-
"
|
|
68
|
-
"
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
"
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
"
|
|
75
|
-
"
|
|
61
|
+
"sideEffects": [
|
|
62
|
+
"dist/*",
|
|
63
|
+
"*.css"
|
|
64
|
+
],
|
|
65
|
+
"publishConfig": {
|
|
66
|
+
"access": "public"
|
|
67
|
+
},
|
|
68
|
+
"scripts": {
|
|
69
|
+
"build:es": "vite build --config vite.build.config.ts",
|
|
70
|
+
"build:lib": "vite build --config vite.umd.config.ts",
|
|
71
|
+
"build:resolver": "vite build --config vite.resolver.config.ts"
|
|
76
72
|
}
|
|
77
|
-
}
|
|
73
|
+
}
|
package/dist/index.iife.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var RoxV=function(c,e){"use strict";const f=["maxlength"],p=((o,r)=>{const l=o.__vccOpts||o;for(const[s,i]of r)l[s]=i;return l})(e.defineComponent({__name:"input-otp",props:{modelValue:{default:""},length:{default:6},itemClass:{default:""},activeItemClass:{default:""},gap:{default:"10px"}},emits:["update:modelValue","complete"],setup(o,{emit:r}){const l=o,s=r,i=e.ref(null),a=e.ref(l.modelValue);e.watch(()=>l.modelValue,n=>{n!==a.value&&(a.value=n)});function _(n){let t=n.target.value;t=t.replace(/\D/g,""),t=t.slice(0,l.length),a.value=t,s("update:modelValue",t),t.length===l.length&&s("complete",t)}function h(){var n;(n=i.value)==null||n.focus()}function m(n){return n===a.value.length}return(n,t)=>(e.openBlock(),e.createElementBlock("div",{class:"otp-wrapper",onClick:h},[e.withDirectives(e.createElementVNode("input",{inputmode:"numeric",autocomplete:"one-time-code",ref_key:"inputRef",ref:i,"onUpdate:modelValue":t[0]||(t[0]=d=>a.value=d),maxlength:o.length,onInput:_,class:"otp-input"},null,40,f),[[e.vModelText,a.value]]),e.createElementVNode("div",{class:"otp-box",style:e.normalizeStyle({gap:l.gap})},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.length,(d,u)=>(e.openBlock(),e.createElementBlock("div",{key:u,class:e.normalizeClass(["otp-item",[{active:m(u),[l.activeItemClass]:m(u)},l.itemClass]])},e.toDisplayString(a.value[u]||""),3))),128))],4)]))}}),[["__scopeId","data-v-14ecb7bd"]]),g={version:"1.0.0",install:o=>{o.component("RInputOtp",p)}};return c.InputOtp=p,c.default=g,Object.defineProperties(c,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}}),c}({},Vue);
|
package/dist/index.umd.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(function(o,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(o=typeof globalThis<"u"?globalThis:o||self,e(o.RoxV={},o.Vue))})(this,function(o,e){"use strict";const f=["maxlength"],r=((a,p)=>{const n=a.__vccOpts||a;for(const[s,c]of p)n[s]=c;return n})(e.defineComponent({__name:"input-otp",props:{modelValue:{default:""},length:{default:6},itemClass:{default:""},activeItemClass:{default:""},gap:{default:"10px"}},emits:["update:modelValue","complete"],setup(a,{emit:p}){const n=a,s=p,c=e.ref(null),i=e.ref(n.modelValue);e.watch(()=>n.modelValue,l=>{l!==i.value&&(i.value=l)});function _(l){let t=l.target.value;t=t.replace(/\D/g,""),t=t.slice(0,n.length),i.value=t,s("update:modelValue",t),t.length===n.length&&s("complete",t)}function h(){var l;(l=c.value)==null||l.focus()}function d(l){return l===i.value.length}return(l,t)=>(e.openBlock(),e.createElementBlock("div",{class:"otp-wrapper",onClick:h},[e.withDirectives(e.createElementVNode("input",{inputmode:"numeric",autocomplete:"one-time-code",ref_key:"inputRef",ref:c,"onUpdate:modelValue":t[0]||(t[0]=m=>i.value=m),maxlength:a.length,onInput:_,class:"otp-input"},null,40,f),[[e.vModelText,i.value]]),e.createElementVNode("div",{class:"otp-box",style:e.normalizeStyle({gap:n.gap})},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.length,(m,u)=>(e.openBlock(),e.createElementBlock("div",{key:u,class:e.normalizeClass(["otp-item",[{active:d(u),[n.activeItemClass]:d(u)},n.itemClass]])},e.toDisplayString(i.value[u]||""),3))),128))],4)]))}}),[["__scopeId","data-v-14ecb7bd"]]),g={version:"1.0.0",install:a=>{a.component("RInputOtp",r)}};o.InputOtp=r,o.default=g,Object.defineProperties(o,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
package/es/components.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { InputOtp } from './components/input-otp';
|
package/es/components.js
DELETED
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import { defineComponent as h, ref as d, watch as _, openBlock as i, createElementBlock as p, withDirectives as V, createElementVNode as f, vModelText as C, normalizeStyle as I, Fragment as k, renderList as y, normalizeClass as x, toDisplayString as b } from "vue";
|
|
2
|
-
const w = ["maxlength"], D = /* @__PURE__ */ h({
|
|
3
|
-
__name: "input-otp",
|
|
4
|
-
props: {
|
|
5
|
-
modelValue: { default: "" },
|
|
6
|
-
length: { default: 6 },
|
|
7
|
-
itemClass: { default: "" },
|
|
8
|
-
activeItemClass: { default: "" },
|
|
9
|
-
gap: { default: "10px" }
|
|
10
|
-
},
|
|
11
|
-
emits: ["update:modelValue", "complete"],
|
|
12
|
-
setup(a, { emit: c }) {
|
|
13
|
-
const t = a, o = c, u = d(null), n = d(t.modelValue);
|
|
14
|
-
_(
|
|
15
|
-
() => t.modelValue,
|
|
16
|
-
(l) => {
|
|
17
|
-
l !== n.value && (n.value = l);
|
|
18
|
-
}
|
|
19
|
-
);
|
|
20
|
-
function v(l) {
|
|
21
|
-
let e = l.target.value;
|
|
22
|
-
e = e.replace(/\D/g, ""), e = e.slice(0, t.length), n.value = e, o("update:modelValue", e), e.length === t.length && o("complete", e);
|
|
23
|
-
}
|
|
24
|
-
function g() {
|
|
25
|
-
var l;
|
|
26
|
-
(l = u.value) == null || l.focus();
|
|
27
|
-
}
|
|
28
|
-
function r(l) {
|
|
29
|
-
return l === n.value.length;
|
|
30
|
-
}
|
|
31
|
-
return (l, e) => (i(), p("div", {
|
|
32
|
-
class: "otp-wrapper",
|
|
33
|
-
onClick: g
|
|
34
|
-
}, [
|
|
35
|
-
V(f("input", {
|
|
36
|
-
inputmode: "numeric",
|
|
37
|
-
autocomplete: "one-time-code",
|
|
38
|
-
ref_key: "inputRef",
|
|
39
|
-
ref: u,
|
|
40
|
-
"onUpdate:modelValue": e[0] || (e[0] = (m) => n.value = m),
|
|
41
|
-
maxlength: a.length,
|
|
42
|
-
onInput: v,
|
|
43
|
-
class: "otp-input"
|
|
44
|
-
}, null, 40, w), [
|
|
45
|
-
[C, n.value]
|
|
46
|
-
]),
|
|
47
|
-
f("div", {
|
|
48
|
-
class: "otp-box",
|
|
49
|
-
style: I({ gap: t.gap })
|
|
50
|
-
}, [
|
|
51
|
-
(i(!0), p(k, null, y(a.length, (m, s) => (i(), p("div", {
|
|
52
|
-
key: s,
|
|
53
|
-
class: x(["otp-item", [
|
|
54
|
-
{ active: r(s), [t.activeItemClass]: r(s) },
|
|
55
|
-
t.itemClass
|
|
56
|
-
]])
|
|
57
|
-
}, b(n.value[s] || ""), 3))), 128))
|
|
58
|
-
], 4)
|
|
59
|
-
]));
|
|
60
|
-
}
|
|
61
|
-
}), z = (a, c) => {
|
|
62
|
-
const t = a.__vccOpts || a;
|
|
63
|
-
for (const [o, u] of c)
|
|
64
|
-
t[o] = u;
|
|
65
|
-
return t;
|
|
66
|
-
}, E = /* @__PURE__ */ z(D, [["__scopeId", "data-v-14ecb7bd"]]);
|
|
67
|
-
export {
|
|
68
|
-
E as InputOtp
|
|
69
|
-
};
|
package/es/index.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { App } from 'vue';
|
|
2
|
-
import { default as InputOtp } from './components/input-otp/input-otp.vue';
|
|
3
|
-
export * from './components';
|
|
4
|
-
export { InputOtp };
|
|
5
|
-
declare const _default: {
|
|
6
|
-
version: string;
|
|
7
|
-
install: (app: App) => void;
|
|
8
|
-
};
|
|
9
|
-
export default _default;
|
package/es/index.js
DELETED
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
import { defineComponent as h, ref as d, watch as _, openBlock as i, createElementBlock as p, withDirectives as I, createElementVNode as f, vModelText as V, normalizeStyle as C, Fragment as k, renderList as x, normalizeClass as y, toDisplayString as b } from "vue";
|
|
2
|
-
const w = ["maxlength"], D = /* @__PURE__ */ h({
|
|
3
|
-
__name: "input-otp",
|
|
4
|
-
props: {
|
|
5
|
-
modelValue: { default: "" },
|
|
6
|
-
length: { default: 6 },
|
|
7
|
-
itemClass: { default: "" },
|
|
8
|
-
activeItemClass: { default: "" },
|
|
9
|
-
gap: { default: "10px" }
|
|
10
|
-
},
|
|
11
|
-
emits: ["update:modelValue", "complete"],
|
|
12
|
-
setup(n, { emit: c }) {
|
|
13
|
-
const t = n, o = c, u = d(null), a = d(t.modelValue);
|
|
14
|
-
_(
|
|
15
|
-
() => t.modelValue,
|
|
16
|
-
(l) => {
|
|
17
|
-
l !== a.value && (a.value = l);
|
|
18
|
-
}
|
|
19
|
-
);
|
|
20
|
-
function v(l) {
|
|
21
|
-
let e = l.target.value;
|
|
22
|
-
e = e.replace(/\D/g, ""), e = e.slice(0, t.length), a.value = e, o("update:modelValue", e), e.length === t.length && o("complete", e);
|
|
23
|
-
}
|
|
24
|
-
function g() {
|
|
25
|
-
var l;
|
|
26
|
-
(l = u.value) == null || l.focus();
|
|
27
|
-
}
|
|
28
|
-
function r(l) {
|
|
29
|
-
return l === a.value.length;
|
|
30
|
-
}
|
|
31
|
-
return (l, e) => (i(), p("div", {
|
|
32
|
-
class: "otp-wrapper",
|
|
33
|
-
onClick: g
|
|
34
|
-
}, [
|
|
35
|
-
I(f("input", {
|
|
36
|
-
inputmode: "numeric",
|
|
37
|
-
autocomplete: "one-time-code",
|
|
38
|
-
ref_key: "inputRef",
|
|
39
|
-
ref: u,
|
|
40
|
-
"onUpdate:modelValue": e[0] || (e[0] = (m) => a.value = m),
|
|
41
|
-
maxlength: n.length,
|
|
42
|
-
onInput: v,
|
|
43
|
-
class: "otp-input"
|
|
44
|
-
}, null, 40, w), [
|
|
45
|
-
[V, a.value]
|
|
46
|
-
]),
|
|
47
|
-
f("div", {
|
|
48
|
-
class: "otp-box",
|
|
49
|
-
style: C({ gap: t.gap })
|
|
50
|
-
}, [
|
|
51
|
-
(i(!0), p(k, null, x(n.length, (m, s) => (i(), p("div", {
|
|
52
|
-
key: s,
|
|
53
|
-
class: y(["otp-item", [
|
|
54
|
-
{ active: r(s), [t.activeItemClass]: r(s) },
|
|
55
|
-
t.itemClass
|
|
56
|
-
]])
|
|
57
|
-
}, b(a.value[s] || ""), 3))), 128))
|
|
58
|
-
], 4)
|
|
59
|
-
]));
|
|
60
|
-
}
|
|
61
|
-
}), O = (n, c) => {
|
|
62
|
-
const t = n.__vccOpts || n;
|
|
63
|
-
for (const [o, u] of c)
|
|
64
|
-
t[o] = u;
|
|
65
|
-
return t;
|
|
66
|
-
}, R = /* @__PURE__ */ O(D, [["__scopeId", "data-v-14ecb7bd"]]), z = "1.0.0", B = (n) => {
|
|
67
|
-
n.component("RInputOtp", R);
|
|
68
|
-
}, S = {
|
|
69
|
-
version: z,
|
|
70
|
-
install: B
|
|
71
|
-
};
|
|
72
|
-
export {
|
|
73
|
-
R as InputOtp,
|
|
74
|
-
S as default
|
|
75
|
-
};
|
package/es/input-otp/index.css
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
.otp-wrapper[data-v-14ecb7bd] {
|
|
3
|
-
position: relative;
|
|
4
|
-
width: max-content;
|
|
5
|
-
cursor: pointer;
|
|
6
|
-
}
|
|
7
|
-
.otp-input[data-v-14ecb7bd] {
|
|
8
|
-
position: absolute;
|
|
9
|
-
opacity: 0;
|
|
10
|
-
pointer-events: none;
|
|
11
|
-
}
|
|
12
|
-
.otp-box[data-v-14ecb7bd] {
|
|
13
|
-
display: flex;
|
|
14
|
-
}
|
|
15
|
-
.otp-item[data-v-14ecb7bd] {
|
|
16
|
-
width: 40px;
|
|
17
|
-
height: 50px;
|
|
18
|
-
border: 1px solid #ccc;
|
|
19
|
-
border-radius: 8px;
|
|
20
|
-
text-align: center;
|
|
21
|
-
line-height: 50px;
|
|
22
|
-
font-size: 20px;
|
|
23
|
-
transition: all 0.2s;
|
|
24
|
-
}
|
|
25
|
-
.otp-item.active[data-v-14ecb7bd] {
|
|
26
|
-
border-color: #409eff;
|
|
27
|
-
box-shadow: 0 0 0 2px rgba(64, 158, 255, 0.2);
|
|
28
|
-
}
|
package/es/input-otp/index.d.ts
DELETED
package/es/input-otp/index.js
DELETED
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
import { defineComponent, ref, watch, openBlock, createElementBlock, withDirectives, createElementVNode, vModelText, normalizeStyle, Fragment, renderList, normalizeClass, toDisplayString } from "vue";
|
|
2
|
-
const _hoisted_1 = ["maxlength"];
|
|
3
|
-
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
4
|
-
__name: "input-otp",
|
|
5
|
-
props: {
|
|
6
|
-
modelValue: { default: "" },
|
|
7
|
-
length: { default: 6 },
|
|
8
|
-
itemClass: { default: "" },
|
|
9
|
-
activeItemClass: { default: "" },
|
|
10
|
-
gap: { default: "10px" }
|
|
11
|
-
},
|
|
12
|
-
emits: ["update:modelValue", "complete"],
|
|
13
|
-
setup(__props, { emit: __emit }) {
|
|
14
|
-
const props = __props;
|
|
15
|
-
const emit = __emit;
|
|
16
|
-
const inputRef = ref(null);
|
|
17
|
-
const innerValue = ref(props.modelValue);
|
|
18
|
-
watch(
|
|
19
|
-
() => props.modelValue,
|
|
20
|
-
(val) => {
|
|
21
|
-
if (val !== innerValue.value) {
|
|
22
|
-
innerValue.value = val;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
);
|
|
26
|
-
function handleInput(e) {
|
|
27
|
-
let value = e.target.value;
|
|
28
|
-
value = value.replace(/\D/g, "");
|
|
29
|
-
value = value.slice(0, props.length);
|
|
30
|
-
innerValue.value = value;
|
|
31
|
-
emit("update:modelValue", value);
|
|
32
|
-
if (value.length === props.length) {
|
|
33
|
-
emit("complete", value);
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
function focusInput() {
|
|
37
|
-
var _a;
|
|
38
|
-
(_a = inputRef.value) == null ? void 0 : _a.focus();
|
|
39
|
-
}
|
|
40
|
-
function isActive(index) {
|
|
41
|
-
return index === innerValue.value.length;
|
|
42
|
-
}
|
|
43
|
-
return (_ctx, _cache) => {
|
|
44
|
-
return openBlock(), createElementBlock("div", {
|
|
45
|
-
class: "otp-wrapper",
|
|
46
|
-
onClick: focusInput
|
|
47
|
-
}, [
|
|
48
|
-
withDirectives(createElementVNode("input", {
|
|
49
|
-
inputmode: "numeric",
|
|
50
|
-
autocomplete: "one-time-code",
|
|
51
|
-
ref_key: "inputRef",
|
|
52
|
-
ref: inputRef,
|
|
53
|
-
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => innerValue.value = $event),
|
|
54
|
-
maxlength: __props.length,
|
|
55
|
-
onInput: handleInput,
|
|
56
|
-
class: "otp-input"
|
|
57
|
-
}, null, 40, _hoisted_1), [
|
|
58
|
-
[vModelText, innerValue.value]
|
|
59
|
-
]),
|
|
60
|
-
createElementVNode("div", {
|
|
61
|
-
class: "otp-box",
|
|
62
|
-
style: normalizeStyle({ gap: props.gap })
|
|
63
|
-
}, [
|
|
64
|
-
(openBlock(true), createElementBlock(Fragment, null, renderList(__props.length, (_, index) => {
|
|
65
|
-
return openBlock(), createElementBlock("div", {
|
|
66
|
-
key: index,
|
|
67
|
-
class: normalizeClass(["otp-item", [
|
|
68
|
-
{ active: isActive(index), [props.activeItemClass]: isActive(index) },
|
|
69
|
-
props.itemClass
|
|
70
|
-
]])
|
|
71
|
-
}, toDisplayString(innerValue.value[index] || ""), 3);
|
|
72
|
-
}), 128))
|
|
73
|
-
], 4)
|
|
74
|
-
]);
|
|
75
|
-
};
|
|
76
|
-
}
|
|
77
|
-
});
|
|
78
|
-
const _export_sfc = (sfc, props) => {
|
|
79
|
-
const target = sfc.__vccOpts || sfc;
|
|
80
|
-
for (const [key, val] of props) {
|
|
81
|
-
target[key] = val;
|
|
82
|
-
}
|
|
83
|
-
return target;
|
|
84
|
-
};
|
|
85
|
-
const InputOtp = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-14ecb7bd"]]);
|
|
86
|
-
export {
|
|
87
|
-
InputOtp,
|
|
88
|
-
InputOtp as default
|
|
89
|
-
};
|
package/lib/components.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { InputOtp } from './components/input-otp';
|
package/lib/components.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),f=["maxlength"],v=e.defineComponent({__name:"input-otp",props:{modelValue:{default:""},length:{default:6},itemClass:{default:""},activeItemClass:{default:""},gap:{default:"10px"}},emits:["update:modelValue","complete"],setup(a,{emit:i}){const l=a,u=i,c=e.ref(null),o=e.ref(l.modelValue);e.watch(()=>l.modelValue,n=>{n!==o.value&&(o.value=n)});function m(n){let t=n.target.value;t=t.replace(/\D/g,""),t=t.slice(0,l.length),o.value=t,u("update:modelValue",t),t.length===l.length&&u("complete",t)}function d(){var n;(n=c.value)==null||n.focus()}function r(n){return n===o.value.length}return(n,t)=>(e.openBlock(),e.createElementBlock("div",{class:"otp-wrapper",onClick:d},[e.withDirectives(e.createElementVNode("input",{inputmode:"numeric",autocomplete:"one-time-code",ref_key:"inputRef",ref:c,"onUpdate:modelValue":t[0]||(t[0]=p=>o.value=p),maxlength:a.length,onInput:m,class:"otp-input"},null,40,f),[[e.vModelText,o.value]]),e.createElementVNode("div",{class:"otp-box",style:e.normalizeStyle({gap:l.gap})},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.length,(p,s)=>(e.openBlock(),e.createElementBlock("div",{key:s,class:e.normalizeClass(["otp-item",[{active:r(s),[l.activeItemClass]:r(s)},l.itemClass]])},e.toDisplayString(o.value[s]||""),3))),128))],4)]))}}),g=(a,i)=>{const l=a.__vccOpts||a;for(const[u,c]of i)l[u]=c;return l},h=g(v,[["__scopeId","data-v-14ecb7bd"]]);exports.InputOtp=h;
|
package/lib/index.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { App } from 'vue';
|
|
2
|
-
import { default as InputOtp } from './components/input-otp/input-otp.vue';
|
|
3
|
-
export * from './components';
|
|
4
|
-
export { InputOtp };
|
|
5
|
-
declare const _default: {
|
|
6
|
-
version: string;
|
|
7
|
-
install: (app: App) => void;
|
|
8
|
-
};
|
|
9
|
-
export default _default;
|
package/lib/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),f=["maxlength"],g=e.defineComponent({__name:"input-otp",props:{modelValue:{default:""},length:{default:6},itemClass:{default:""},activeItemClass:{default:""},gap:{default:"10px"}},emits:["update:modelValue","complete"],setup(o,{emit:i}){const l=o,u=i,c=e.ref(null),a=e.ref(l.modelValue);e.watch(()=>l.modelValue,n=>{n!==a.value&&(a.value=n)});function d(n){let t=n.target.value;t=t.replace(/\D/g,""),t=t.slice(0,l.length),a.value=t,u("update:modelValue",t),t.length===l.length&&u("complete",t)}function v(){var n;(n=c.value)==null||n.focus()}function p(n){return n===a.value.length}return(n,t)=>(e.openBlock(),e.createElementBlock("div",{class:"otp-wrapper",onClick:v},[e.withDirectives(e.createElementVNode("input",{inputmode:"numeric",autocomplete:"one-time-code",ref_key:"inputRef",ref:c,"onUpdate:modelValue":t[0]||(t[0]=r=>a.value=r),maxlength:o.length,onInput:d,class:"otp-input"},null,40,f),[[e.vModelText,a.value]]),e.createElementVNode("div",{class:"otp-box",style:e.normalizeStyle({gap:l.gap})},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.length,(r,s)=>(e.openBlock(),e.createElementBlock("div",{key:s,class:e.normalizeClass(["otp-item",[{active:p(s),[l.activeItemClass]:p(s)},l.itemClass]])},e.toDisplayString(a.value[s]||""),3))),128))],4)]))}}),h=(o,i)=>{const l=o.__vccOpts||o;for(const[u,c]of i)l[u]=c;return l},m=h(g,[["__scopeId","data-v-14ecb7bd"]]),_="1.0.0",k=o=>{o.component("RInputOtp",m)},I={version:_,install:k};exports.InputOtp=m;exports.default=I;
|
package/lib/input-otp/index.css
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
.otp-wrapper[data-v-14ecb7bd] {
|
|
3
|
-
position: relative;
|
|
4
|
-
width: max-content;
|
|
5
|
-
cursor: pointer;
|
|
6
|
-
}
|
|
7
|
-
.otp-input[data-v-14ecb7bd] {
|
|
8
|
-
position: absolute;
|
|
9
|
-
opacity: 0;
|
|
10
|
-
pointer-events: none;
|
|
11
|
-
}
|
|
12
|
-
.otp-box[data-v-14ecb7bd] {
|
|
13
|
-
display: flex;
|
|
14
|
-
}
|
|
15
|
-
.otp-item[data-v-14ecb7bd] {
|
|
16
|
-
width: 40px;
|
|
17
|
-
height: 50px;
|
|
18
|
-
border: 1px solid #ccc;
|
|
19
|
-
border-radius: 8px;
|
|
20
|
-
text-align: center;
|
|
21
|
-
line-height: 50px;
|
|
22
|
-
font-size: 20px;
|
|
23
|
-
transition: all 0.2s;
|
|
24
|
-
}
|
|
25
|
-
.otp-item.active[data-v-14ecb7bd] {
|
|
26
|
-
border-color: #409eff;
|
|
27
|
-
box-shadow: 0 0 0 2px rgba(64, 158, 255, 0.2);
|
|
28
|
-
}
|
package/lib/input-otp/index.d.ts
DELETED
package/lib/input-otp/index.js
DELETED
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
3
|
-
const vue = require("vue");
|
|
4
|
-
const _hoisted_1 = ["maxlength"];
|
|
5
|
-
const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
6
|
-
__name: "input-otp",
|
|
7
|
-
props: {
|
|
8
|
-
modelValue: { default: "" },
|
|
9
|
-
length: { default: 6 },
|
|
10
|
-
itemClass: { default: "" },
|
|
11
|
-
activeItemClass: { default: "" },
|
|
12
|
-
gap: { default: "10px" }
|
|
13
|
-
},
|
|
14
|
-
emits: ["update:modelValue", "complete"],
|
|
15
|
-
setup(__props, { emit: __emit }) {
|
|
16
|
-
const props = __props;
|
|
17
|
-
const emit = __emit;
|
|
18
|
-
const inputRef = vue.ref(null);
|
|
19
|
-
const innerValue = vue.ref(props.modelValue);
|
|
20
|
-
vue.watch(
|
|
21
|
-
() => props.modelValue,
|
|
22
|
-
(val) => {
|
|
23
|
-
if (val !== innerValue.value) {
|
|
24
|
-
innerValue.value = val;
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
);
|
|
28
|
-
function handleInput(e) {
|
|
29
|
-
let value = e.target.value;
|
|
30
|
-
value = value.replace(/\D/g, "");
|
|
31
|
-
value = value.slice(0, props.length);
|
|
32
|
-
innerValue.value = value;
|
|
33
|
-
emit("update:modelValue", value);
|
|
34
|
-
if (value.length === props.length) {
|
|
35
|
-
emit("complete", value);
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
function focusInput() {
|
|
39
|
-
var _a;
|
|
40
|
-
(_a = inputRef.value) == null ? void 0 : _a.focus();
|
|
41
|
-
}
|
|
42
|
-
function isActive(index) {
|
|
43
|
-
return index === innerValue.value.length;
|
|
44
|
-
}
|
|
45
|
-
return (_ctx, _cache) => {
|
|
46
|
-
return vue.openBlock(), vue.createElementBlock("div", {
|
|
47
|
-
class: "otp-wrapper",
|
|
48
|
-
onClick: focusInput
|
|
49
|
-
}, [
|
|
50
|
-
vue.withDirectives(vue.createElementVNode("input", {
|
|
51
|
-
inputmode: "numeric",
|
|
52
|
-
autocomplete: "one-time-code",
|
|
53
|
-
ref_key: "inputRef",
|
|
54
|
-
ref: inputRef,
|
|
55
|
-
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => innerValue.value = $event),
|
|
56
|
-
maxlength: __props.length,
|
|
57
|
-
onInput: handleInput,
|
|
58
|
-
class: "otp-input"
|
|
59
|
-
}, null, 40, _hoisted_1), [
|
|
60
|
-
[vue.vModelText, innerValue.value]
|
|
61
|
-
]),
|
|
62
|
-
vue.createElementVNode("div", {
|
|
63
|
-
class: "otp-box",
|
|
64
|
-
style: vue.normalizeStyle({ gap: props.gap })
|
|
65
|
-
}, [
|
|
66
|
-
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(__props.length, (_, index) => {
|
|
67
|
-
return vue.openBlock(), vue.createElementBlock("div", {
|
|
68
|
-
key: index,
|
|
69
|
-
class: vue.normalizeClass(["otp-item", [
|
|
70
|
-
{ active: isActive(index), [props.activeItemClass]: isActive(index) },
|
|
71
|
-
props.itemClass
|
|
72
|
-
]])
|
|
73
|
-
}, vue.toDisplayString(innerValue.value[index] || ""), 3);
|
|
74
|
-
}), 128))
|
|
75
|
-
], 4)
|
|
76
|
-
]);
|
|
77
|
-
};
|
|
78
|
-
}
|
|
79
|
-
});
|
|
80
|
-
const _export_sfc = (sfc, props) => {
|
|
81
|
-
const target = sfc.__vccOpts || sfc;
|
|
82
|
-
for (const [key, val] of props) {
|
|
83
|
-
target[key] = val;
|
|
84
|
-
}
|
|
85
|
-
return target;
|
|
86
|
-
};
|
|
87
|
-
const InputOtp = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-14ecb7bd"]]);
|
|
88
|
-
exports.InputOtp = InputOtp;
|
|
89
|
-
exports.default = InputOtp;
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
interface Props {
|
|
2
|
-
modelValue?: string;
|
|
3
|
-
length?: number;
|
|
4
|
-
itemClass?: string;
|
|
5
|
-
activeItemClass?: string;
|
|
6
|
-
gap?: string;
|
|
7
|
-
}
|
|
8
|
-
declare const _default: import('vue').DefineComponent<Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {} & {
|
|
9
|
-
"update:modelValue": (value: string) => any;
|
|
10
|
-
complete: (value: string) => any;
|
|
11
|
-
}, string, import('vue').PublicProps, Readonly<Props> & Readonly<{
|
|
12
|
-
"onUpdate:modelValue"?: ((value: string) => any) | undefined;
|
|
13
|
-
onComplete?: ((value: string) => any) | undefined;
|
|
14
|
-
}>, {
|
|
15
|
-
modelValue: string;
|
|
16
|
-
length: number;
|
|
17
|
-
itemClass: string;
|
|
18
|
-
activeItemClass: string;
|
|
19
|
-
gap: string;
|
|
20
|
-
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
|
|
21
|
-
inputRef: HTMLInputElement;
|
|
22
|
-
}, HTMLDivElement>;
|
|
23
|
-
export default _default;
|
package/resolver/resolver.cjs
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
3
|
-
const componentMap = {
|
|
4
|
-
RInputOtp: "input-otp"
|
|
5
|
-
};
|
|
6
|
-
function RoxVResolver(options = {}) {
|
|
7
|
-
const { cjs = false } = options;
|
|
8
|
-
const moduleType = cjs ? "lib" : "es";
|
|
9
|
-
return {
|
|
10
|
-
type: "component",
|
|
11
|
-
resolve: (name) => {
|
|
12
|
-
const componentName = componentMap[name];
|
|
13
|
-
if (!componentName) {
|
|
14
|
-
return void 0;
|
|
15
|
-
}
|
|
16
|
-
return {
|
|
17
|
-
name,
|
|
18
|
-
path: `rox-v/${moduleType}/${componentName}`,
|
|
19
|
-
sideEffects: `rox-v/${moduleType}/${componentName}/index.css`
|
|
20
|
-
};
|
|
21
|
-
}
|
|
22
|
-
};
|
|
23
|
-
}
|
|
24
|
-
exports.RoxVResolver = RoxVResolver;
|
|
25
|
-
exports.default = RoxVResolver;
|
package/resolver/resolver.js
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
const componentMap = {
|
|
2
|
-
RInputOtp: "input-otp"
|
|
3
|
-
};
|
|
4
|
-
function RoxVResolver(options = {}) {
|
|
5
|
-
const { cjs = false } = options;
|
|
6
|
-
const moduleType = cjs ? "lib" : "es";
|
|
7
|
-
return {
|
|
8
|
-
type: "component",
|
|
9
|
-
resolve: (name) => {
|
|
10
|
-
const componentName = componentMap[name];
|
|
11
|
-
if (!componentName) {
|
|
12
|
-
return void 0;
|
|
13
|
-
}
|
|
14
|
-
return {
|
|
15
|
-
name,
|
|
16
|
-
path: `rox-v/${moduleType}/${componentName}`,
|
|
17
|
-
sideEffects: `rox-v/${moduleType}/${componentName}/index.css`
|
|
18
|
-
};
|
|
19
|
-
}
|
|
20
|
-
};
|
|
21
|
-
}
|
|
22
|
-
export {
|
|
23
|
-
RoxVResolver,
|
|
24
|
-
RoxVResolver as default
|
|
25
|
-
};
|