feat: initial commit - Phase 1 & 2 core features

This commit is contained in:
hiderfong
2026-04-22 17:07:33 +08:00
commit 1773bda06b
25005 changed files with 6252106 additions and 0 deletions
+19
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 };
+35
View File
@@ -0,0 +1,35 @@
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
@@ -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;AAC1D,SAAO,oBAAoB,MAAM;AACjC,cAAY,QAAQ;;CAGtB,MAAM,2BAA2B,UAA4B;AAC3D,SAAO,qBAAqB,MAAM;AAClC,cAAY,QAAQ;;CAGtB,MAAM,wBAAwB,UAA4B;AACxD,SAAO,kBAAkB,MAAM;AAC/B,MAAI,YAAY,OAAO;AACrB,eAAY,QAAQ;AACpB,kBAAe,iBAAiB,MAAM,CAAC;;;CAI3C,MAAM,qBAAqB,UAA4B;AACrD,QAAM,SAAS,mBACX,qBAAqB,MAAM,GAC3B,wBAAwB,MAAM;;AAGpC,QAAO;EACL;EACA;EACA;EACA;EACA;EACD"}