Skip to content

Commit

Permalink
chore: 🤖 update
Browse files Browse the repository at this point in the history
  • Loading branch information
RSoraM committed Dec 24, 2024
1 parent 9fa599c commit 8080175
Show file tree
Hide file tree
Showing 36 changed files with 702 additions and 690 deletions.
2 changes: 2 additions & 0 deletions auto-imports.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ declare global {
const t_des: typeof import('./node_modules/.pnpm/[email protected]/node_modules/mima-kit/dist/index.mjs')['t_des']
const tea: typeof import('./node_modules/.pnpm/[email protected]/node_modules/mima-kit/dist/index.mjs')['tea']
const templateRef: typeof import('@vueuse/core')['templateRef']
const themes: typeof import('./src/composables/utils')['themes']
const throttledRef: typeof import('@vueuse/core')['throttledRef']
const throttledWatch: typeof import('@vueuse/core')['throttledWatch']
const toRaw: typeof import('vue')['toRaw']
Expand Down Expand Up @@ -599,6 +600,7 @@ declare module 'vue' {
readonly t_des: UnwrapRef<typeof import('./node_modules/.pnpm/[email protected]/node_modules/mima-kit/dist/index.mjs')['t_des']>
readonly tea: UnwrapRef<typeof import('./node_modules/.pnpm/[email protected]/node_modules/mima-kit/dist/index.mjs')['tea']>
readonly templateRef: UnwrapRef<typeof import('@vueuse/core')['templateRef']>
readonly themes: UnwrapRef<typeof import('./src/composables/utils')['themes']>
readonly throttledRef: UnwrapRef<typeof import('@vueuse/core')['throttledRef']>
readonly throttledWatch: UnwrapRef<typeof import('@vueuse/core')['throttledWatch']>
readonly toRaw: UnwrapRef<typeof import('vue')['toRaw']>
Expand Down
1 change: 1 addition & 0 deletions components.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ declare module 'vue' {
KitMenuItem: typeof import('./src/components/KitMenu/KitMenuItem.vue')['default']
KitRefLink: typeof import('./src/components/KitRefLink.vue')['default']
KitStat: typeof import('./src/components/KitStat.vue')['default']
KitTheme: typeof import('./src/components/KitTheme.vue')['default']
RouterLink: typeof import('vue-router')['RouterLink']
RouterView: typeof import('vue-router')['RouterView']
TheKitMenu: typeof import('./src/components/TheKitMenu.vue')['default']
Expand Down
5 changes: 4 additions & 1 deletion src/components/KitForm/Input/KitFormU8.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,12 @@ const buffer = defineModel<InstanceType<typeof U8>>({ required: true });
<KitFormControl :title="title">
<KitFormU8Base
v-model="buffer"
:="$attrs"
:codec="codec"
:textarea="textarea"
:immediate="immediate"
/>
>
<slot />
</KitFormU8Base>
</KitFormControl>
</template>
16 changes: 8 additions & 8 deletions src/components/KitForm/Input/KitFormU8Array.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,19 @@ function del(index: number) {

<template>
<KitFormControl :title="title">
<div class="join join-vertical flex flex-col">
<KitFormU8Base
<div class="mb-2 flex flex-col gap-2">
<KitFormU8
v-for="(m, i) in model" :key="i"
v-model="m.value" :codec="UTF8"
:immediate="immediate"
>
<button class="btn btn-outline join-item" @click="del(i)">
Delete
<button class="btn btn-outline join-item input-bordered" @click="del(i)">
DELETE
</button>
</KitFormU8Base>
<button class="btn btn-outline join-item" @click="add">
ADD
</button>
</KitFormU8>
</div>
</KitFormControl>
<button class="btn btn-outline" @click="add">
ADD
</button>
</template>
28 changes: 21 additions & 7 deletions src/components/KitForm/Input/KitFormU8Base.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ const { textarea = false, codec = HEX, immediate = false } = defineProps<{
}>();
const buffer = defineModel<InstanceType<typeof U8>>({ required: true });
const text_codec = ref(codec);
const text = ref<string>('');
const auto = useTextareaAutosize({ styleProp: 'minHeight' });
const text = auto.input;
const size = auto.textarea;
const t2b = () => buffer.value = text_codec.value(text.value);
watch(
Expand All @@ -32,18 +34,30 @@ onMounted(() => {
</script>

<template>
<div class="join" :class="{ 'join-vertical': textarea, 'join-vertical md:join-horizontal': !textarea }">
<KitFormSelectCodec v-model="text_codec" class="join-item" />
<div
v-if="textarea"
class="join join-vertical"
>
<KitFormSelectCodec v-model="text_codec" />
<textarea
v-if="textarea"
v-model="text" class="join-item textarea textarea-bordered h-24 text-xs"
ref="size"
v-model="text"
class="join-item textarea textarea-bordered h-24 w-full text-xs"
name="textarea"
spellcheck="false"
@change="t2b"
/>
</div>
<div
v-else
class="join join-vertical md:join-horizontal"
>
<KitFormSelectCodec v-model="text_codec" />
<input
v-else
v-model="text" type="text" class="input join-item input-bordered w-full text-xs"
v-model="text" type="text"
class="input join-item input-bordered w-full text-xs"
name="text"
spellcheck="false"
@change="t2b"
>
<slot />
Expand Down
36 changes: 22 additions & 14 deletions src/components/KitForm/KitFormECKey.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,16 @@
defineOptions({ name: 'KitFormECKey' });
// props
const { curve, name = '', fold = true } = defineProps<{
const {
curve,
name = '',
fold = true,
pointOnly: point_only = false,
} = defineProps<{
curve: typeof secp256r1;
name?: string;
fold?: boolean;
pointOnly?: boolean;
}>();
const ec = computed(() => FpECC(curve));
Expand Down Expand Up @@ -53,19 +59,21 @@ onMounted(() => nextTick(() => genKey()));
</script>

<template>
<KitDivider :class="name ? 'divider-start' : ''">
{{ name ? `# Key ${name}:` : '' }}
<KitButton @click="clearKey">
Clear
</KitButton>/
<KitButton @click="genKey">
Generate
</KitButton>
</KitDivider>
<KitFormBigint
v-model="key.d"
:title="`Private Key d${name} (${getBIBits(key.d)} bit)`"
/>
<template v-if="!point_only">
<KitDivider :class="name ? 'divider-start' : ''">
{{ name ? `# Key ${name}:` : '' }}
<KitButton @click="clearKey">
Clear
</KitButton>/
<KitButton @click="genKey">
Generate
</KitButton>
</KitDivider>
<KitFormBigint
v-model="key.d"
:title="`Private Key d${name} (${getBIBits(key.d)} bit)`"
/>
</template>
<KitFormBigint
v-model="key.Q.x"
:title="`Public Key Q${name}.x (${getBIBits(key.Q.x)} bit)`"
Expand Down
2 changes: 1 addition & 1 deletion src/components/KitForm/KitFormModeConfig.vue
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ const verify = catchNotify(() => {
</script>

<template>
<div class="flex gap-2">
<div class="flex flex-col md:flex-row md:gap-2">
<KitFormSelectMode
v-model="mode"
:blocksize="block_cipher.BLOCK_SIZE"
Expand Down
5 changes: 3 additions & 2 deletions src/components/KitForm/Select/KitFormSelect.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,13 @@ const model = defineModel();
</script>

<template>
<KitFormControl :title="title">
<KitFormControl :title="title" :="$attrs">
<select
v-model="model"
class="select text-xs"
class="join-item select text-xs"
:class="{ 'select-bordered': border }"
name="selector"
:="$attrs"
>
<option
v-for="option in options" :key="option.label"
Expand Down
14 changes: 7 additions & 7 deletions src/components/KitForm/Select/KitFormSelectBlockCipher.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
defineOptions({ name: 'KitFormSelectKDF' });
const {
options: cipher_alg = [
options: cipher_option = [
{ label: 'SM4', value: 'SM4' },
{ label: 'AES', value: 'AES' },
{ label: 'ARIA', value: 'ARIA' },
Expand Down Expand Up @@ -96,23 +96,23 @@ watchEffect(catchNotifySync(() => {
<div>
<KitFormSelect
v-model="alg"
:options="cipher_alg"
:options="cipher_option"
:title="title"
/>
<KitFormSelect
v-show="show_key_size_option"
v-if="show_key_size_option"
v-model="key_size"
:options="key_size_option"
title="Key Size"
title="Key Size (bit)"
/>
<div v-show="show_arc5_option" class="flex gap-2">
<div v-if="show_arc5_option" class="flex flex-col md:flex-row md:gap-2">
<KitFormSelect
v-model="arc5_ws"
:options="arc5_ws_option"
title="Word Size (byte)"
title="Word Size (bit)"
/>
<KitFormNumber v-model="arc5_r" title="Rounds" />
</div>
<KitFormNumber v-show="show_tea_r" v-model="tea_r" title="Rounds" />
<KitFormNumber v-if="show_tea_r" v-model="tea_r" title="Rounds" />
</div>
</template>
5 changes: 3 additions & 2 deletions src/components/KitForm/Select/KitFormSelectHash.vue
Original file line number Diff line number Diff line change
Expand Up @@ -185,13 +185,14 @@ watchEffect(catchNotifySync(() => {
<KitFormSelect
v-model="alg"
:options="hash_options"
:title="title "
:title="title"
:="$attrs"
/>
<KitCollapse v-if="show_config" class="input-bordered my-2 border bg-base-300">
<template #header>
Hash Config
</template>
<div class="flex gap-2">
<div class="flex flex-col md:flex-row md:gap-2">
<KitFormNumber
v-if="show_t"
v-model="t"
Expand Down
21 changes: 9 additions & 12 deletions src/components/KitForm/Select/KitFormSelectKDF.vue
Original file line number Diff line number Diff line change
Expand Up @@ -51,37 +51,34 @@ watchEffect(catchNotifySync(() => {
<span class="text-sm font-bold">KDF Config</span>
</template>
<template v-if="show_hash">
<div class="divider divider-start my-4 text-sm">
<KitDivider class="divider-start">
# 1: Hash
</div>
<KitFormSelectHash
v-model="kdf_hash"
title="Hash"
/>
</KitDivider>
<KitFormSelectHash v-model="kdf_hash" class="w-full" />
</template>
<template v-if="show_mac">
<div class="divider divider-start my-4 text-sm">
<KitDivider class="divider-start">
# 1: Mac
</div>
</KitDivider>
<KitFormSelectMAC
v-model="kdf_mac"
title="MAC"
/>
</template>
<template v-if="show_salt">
<div class="divider divider-start my-4 text-sm">
<KitDivider class="divider-start">
# 2: Salt
</div>
</KitDivider>
<KitFormU8
v-model="kdf_salt"
title="Salt"
:codec="UTF8"
/>
</template>
<template v-if="show_iterations">
<div class="divider divider-start my-4 text-sm">
<KitDivider class="divider-start">
# 3: Iterations
</div>
</KitDivider>
<KitFormNumber
v-model="kdf_iterations"
title="Iterations"
Expand Down
51 changes: 17 additions & 34 deletions src/components/KitForm/Select/KitFormSelectMAC.vue
Original file line number Diff line number Diff line change
Expand Up @@ -75,40 +75,23 @@ watchEffect(catchNotifySync(() => {
:options="mac_options"
:title="title"
/>
<KitCollapse class="my-2 bg-base-300">
<template #header>
Mac Config
</template>
<template v-if="mac_alg === 'HMAC'">
<KitDivider class="divider-start">
# 1 Hash
</KitDivider>
<KitFormSelectHash
v-model="mac_hash"
title="Hash"
/>
</template>
<template v-else>
<KitDivider class="divider-start">
# 1 KMAC Config
</KitDivider>
<KitFormU8
v-model="mac_custom"
:codec="UTF8"
title="Customization"
/>
</template>
<KitDivider class="divider-start">
# 2 MAC Info
</KitDivider>
<KitFormNumber
v-model="mac_digest_size"
title="Digest Size (bit)"
<template v-if="mac_alg === 'HMAC'">
<KitFormSelectHash v-model="mac_hash" title="Hash" />
</template>
<template v-else>
<KitFormU8
v-model="mac_custom"
:codec="UTF8"
title="Customization"
/>
<KitFormNumber
v-model="mac_key_size"
title="Key Size (bit)"
/>
</KitCollapse>
</template>
<KitFormNumber
v-model="mac_digest_size"
title="Digest Size (bit)"
/>
<KitFormNumber
v-model="mac_key_size"
title="Key Size (bit)"
/>
</div>
</template>
4 changes: 3 additions & 1 deletion src/components/KitMenu/KitMenuGroup.vue
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ watchEffect(() => {
class="menu-dropdown-toggle"
@click="isOpenInside = !isOpenInside"
>
{{ title }}
<slot name="title">
{{ title }}
</slot>
</span>
<ul
class="menu-dropdown"
Expand Down
Loading

0 comments on commit 8080175

Please sign in to comment.