完全跑通1.0版本

This commit is contained in:
2026-05-26 12:56:03 +08:00
parent 2ece5174a7
commit 93c714a93b
11557 changed files with 1648225 additions and 36 deletions

View File

@@ -0,0 +1,19 @@
import * as _$vue from "vue";
//#region ../../packages/hooks/use-composition/index.d.ts
interface UseCompositionOptions {
afterComposition: (event: CompositionEvent) => void;
emit?: ((event: 'compositionstart', evt: CompositionEvent) => void) & ((event: 'compositionupdate', evt: CompositionEvent) => void) & ((event: 'compositionend', evt: CompositionEvent) => void);
}
declare function useComposition({
afterComposition,
emit
}: UseCompositionOptions): {
isComposing: _$vue.Ref<boolean, boolean>;
handleComposition: (event: CompositionEvent) => void;
handleCompositionStart: (event: CompositionEvent) => void;
handleCompositionUpdate: (event: CompositionEvent) => void;
handleCompositionEnd: (event: CompositionEvent) => void;
};
//#endregion
export { useComposition };

View File

@@ -0,0 +1,34 @@
import { nextTick, ref } from "vue";
//#region ../../packages/hooks/use-composition/index.ts
function useComposition({ afterComposition, emit }) {
const isComposing = ref(false);
const handleCompositionStart = (event) => {
emit?.("compositionstart", event);
isComposing.value = true;
};
const handleCompositionUpdate = (event) => {
emit?.("compositionupdate", event);
isComposing.value = true;
};
const handleCompositionEnd = (event) => {
emit?.("compositionend", event);
if (isComposing.value) {
isComposing.value = false;
nextTick(() => afterComposition(event));
}
};
const handleComposition = (event) => {
event.type === "compositionend" ? handleCompositionEnd(event) : handleCompositionUpdate(event);
};
return {
isComposing,
handleComposition,
handleCompositionStart,
handleCompositionUpdate,
handleCompositionEnd
};
}
//#endregion
export { useComposition };
//# sourceMappingURL=index.mjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.mjs","names":[],"sources":["../../../../../packages/hooks/use-composition/index.ts"],"sourcesContent":["import { nextTick, ref } from 'vue'\n\ninterface UseCompositionOptions {\n afterComposition: (event: CompositionEvent) => void\n emit?: ((event: 'compositionstart', evt: CompositionEvent) => void) &\n ((event: 'compositionupdate', evt: CompositionEvent) => void) &\n ((event: 'compositionend', evt: CompositionEvent) => void)\n}\n\nexport function useComposition({\n afterComposition,\n emit,\n}: UseCompositionOptions) {\n const isComposing = ref(false)\n\n const handleCompositionStart = (event: CompositionEvent) => {\n emit?.('compositionstart', event)\n isComposing.value = true\n }\n\n const handleCompositionUpdate = (event: CompositionEvent) => {\n emit?.('compositionupdate', event)\n isComposing.value = true\n }\n\n const handleCompositionEnd = (event: CompositionEvent) => {\n emit?.('compositionend', event)\n if (isComposing.value) {\n isComposing.value = false\n nextTick(() => afterComposition(event))\n }\n }\n\n const handleComposition = (event: CompositionEvent) => {\n event.type === 'compositionend'\n ? handleCompositionEnd(event)\n : handleCompositionUpdate(event)\n }\n\n return {\n isComposing,\n handleComposition,\n handleCompositionStart,\n handleCompositionUpdate,\n handleCompositionEnd,\n }\n}\n"],"mappings":";;AASA,SAAgB,eAAe,EAC7B,kBACA,QACwB;CACxB,MAAM,cAAc,IAAI,MAAM;CAE9B,MAAM,0BAA0B,UAA4B;EAC1D,OAAO,oBAAoB,MAAM;EACjC,YAAY,QAAQ;;CAGtB,MAAM,2BAA2B,UAA4B;EAC3D,OAAO,qBAAqB,MAAM;EAClC,YAAY,QAAQ;;CAGtB,MAAM,wBAAwB,UAA4B;EACxD,OAAO,kBAAkB,MAAM;EAC/B,IAAI,YAAY,OAAO;GACrB,YAAY,QAAQ;GACpB,eAAe,iBAAiB,MAAM,CAAC;;;CAI3C,MAAM,qBAAqB,UAA4B;EACrD,MAAM,SAAS,mBACX,qBAAqB,MAAM,GAC3B,wBAAwB,MAAM;;CAGpC,OAAO;EACL;EACA;EACA;EACA;EACA;EACD"}