refactor core into composables & components

This commit is contained in:
riqo 2021-01-30 16:05:59 -06:00 • committed by Enrique Hernandez
commit a84019da0d
37 changed files with 409 additions and 469 deletions

View file

@ -1,17 +0,0 @@
export default function useTextWrap() {
// text wraps a string to a given width
function textWrap({ s, w }: { s: string; w: number }): string[] {
// return tspan elements for text with correct size
const wrap = (s: string, w: number) =>
s.replace(
new RegExp(`(?![^\\n]{1,${w}}$)([^\\n]{1,${w}})\\s`, "g"),
"$1\n"
);
const result = wrap(s, w).split("\n");
return result;
}
return {
textWrap
};
}