@a-drowned-fish/rox-v 1.0.0 → 1.0.2
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 +255 -27
- 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 +10 -0
- package/dist/es/index.js +11 -0
- package/dist/es/input-otp/index.js +7 -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 +89 -0
- package/dist/es/input-otp/style.css +1 -0
- package/dist/es/popup/index.js +7 -0
- package/dist/es/popup/popup.js +7 -0
- package/dist/es/popup/popup.vue_vue_type_script_setup_true_lang.js +51 -0
- package/dist/es/popup/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/lib/popup/index.js +1 -0
- package/dist/lib/popup/popup.js +1 -0
- package/dist/lib/popup/popup.vue_vue_type_script_setup_true_lang.js +1 -0
- package/dist/lib/popup/style.css +1 -0
- package/dist/style.css +2 -1
- package/dist/types/components/components.d.ts +4 -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/style.css.d.ts +1 -0
- package/dist/types/components/input-otp/types.d.ts +8 -0
- package/dist/types/components/popup/index.d.ts +5 -0
- package/dist/types/components/popup/popup.vue.d.ts +33 -0
- package/dist/types/components/popup/style.css.d.ts +1 -0
- package/dist/types/components/popup/types.d.ts +8 -0
- package/dist/types/components/style.css.d.ts +1 -0
- package/package.json +48 -57
- 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.d.ts +0 -13
- package/resolver/resolver.js +0 -25
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.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { ComponentResolver } from 'unplugin-vue-components/types';
|
|
2
|
-
export interface RoxVResolverOptions {
|
|
3
|
-
/**
|
|
4
|
-
* Use CommonJS build (lib) instead of ES modules (es)
|
|
5
|
-
* @default false
|
|
6
|
-
*/
|
|
7
|
-
cjs?: boolean;
|
|
8
|
-
}
|
|
9
|
-
/**
|
|
10
|
-
* Create a resolver for rox-v components
|
|
11
|
-
*/
|
|
12
|
-
export declare function RoxVResolver(options?: RoxVResolverOptions): ComponentResolver;
|
|
13
|
-
export 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
|
-
};
|