@sakura-ui/sakura-ui 0.3.0 → 0.4.1
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 +61 -0
- package/package.json +26 -25
- package/packages/core/package.json +10 -8
- package/packages/core/src/components/Button.tsx +1 -1
- package/packages/core/src/components/Card.tsx +8 -3
- package/packages/core/src/components/IconButton.tsx +1 -1
- package/packages/core/src/components/LangSelector.tsx +2 -2
- package/packages/core/src/components/Link.tsx +0 -1
- package/packages/core/src/components/LinkCard.tsx +87 -52
- package/packages/core/src/components/MenuButton.tsx +2 -2
- package/packages/core/src/components/NavigationItem.tsx +1 -1
- package/packages/core/src/components/NotificationBanner.tsx +20 -0
- package/packages/core/src/components/PopoverMenu.tsx +1 -0
- package/packages/core/src/components/buttonStyle.ts +1 -1
- package/packages/core/src/components/index.ts +1 -1
- package/packages/core/src/icons/index.ts +1 -1
- package/packages/core/src/index.ts +1 -0
- package/packages/core/vite.config.ts +2 -1
- package/packages/forms/.turbo/turbo-build.log +12 -22
- package/packages/forms/dist/index.cjs.js +53 -80
- package/packages/forms/dist/index.es.js +484 -663
- package/packages/forms/dist/types/components/Checkbox.d.ts +2 -2
- package/packages/forms/dist/types/components/Checkbox.d.ts.map +1 -1
- package/packages/forms/dist/types/components/FieldsetControl.d.ts +2 -2
- package/packages/forms/dist/types/components/FieldsetControl.d.ts.map +1 -1
- package/packages/forms/dist/types/components/FileInput.d.ts +2 -2
- package/packages/forms/dist/types/components/FileInput.d.ts.map +1 -1
- package/packages/forms/dist/types/components/Input.d.ts +2 -2
- package/packages/forms/dist/types/components/Input.d.ts.map +1 -1
- package/packages/forms/dist/types/components/LabelControl.d.ts +2 -2
- package/packages/forms/dist/types/components/LabelControl.d.ts.map +1 -1
- package/packages/forms/dist/types/components/Radio.d.ts +2 -2
- package/packages/forms/dist/types/components/Radio.d.ts.map +1 -1
- package/packages/forms/dist/types/components/Select.d.ts +2 -2
- package/packages/forms/dist/types/components/Select.d.ts.map +1 -1
- package/packages/forms/dist/types/components/Textarea.d.ts +2 -2
- package/packages/forms/dist/types/components/Textarea.d.ts.map +1 -1
- package/packages/forms/dist/types/components/controlled/CheckboxGroup.d.ts +1 -1
- package/packages/forms/dist/types/components/controlled/RadioGroup.d.ts +1 -1
- package/packages/forms/dist/types/components/inputStyle.d.ts +1 -1
- package/packages/forms/dist/types/components/inputStyle.d.ts.map +1 -1
- package/packages/forms/node_modules/.bin/autoprefixer +44 -6
- package/packages/forms/package.json +9 -7
- package/packages/forms/src/components/Checkbox.tsx +1 -1
- package/packages/forms/src/components/FileInput.tsx +5 -0
- package/packages/forms/src/components/Radio.tsx +2 -0
- package/packages/forms/tests/FieldsetControl.test.tsx +8 -2
- package/packages/forms/tests/LabelControl.test.tsx +8 -2
- package/packages/forms/vite.config.ts +2 -1
- package/packages/helper/.turbo/turbo-build.log +12 -23
- package/packages/helper/dist/index.cjs.js +7 -9
- package/packages/helper/dist/index.es.js +23 -23
- package/packages/helper/dist/types/calc.d.ts.map +1 -1
- package/packages/helper/dist/types/cx.d.ts.map +1 -1
- package/packages/helper/dist/types/styles.d.ts +9 -9
- package/packages/helper/dist/types/styles.d.ts.map +1 -1
- package/packages/helper/dist/types/treefy.d.ts.map +1 -1
- package/packages/helper/node_modules/.bin/vitest +55 -0
- package/packages/helper/package.json +13 -3
- package/packages/helper/src/cx.ts +1 -1
- package/packages/helper/src/styles.ts +2 -4
- package/packages/helper/src/treefy.ts +3 -1
- package/packages/helper/tests/calc.test.ts +22 -0
- package/packages/helper/tests/cx.test.ts +30 -0
- package/packages/helper/tests/querySelector.test.ts +24 -0
- package/packages/helper/tests/treefy.test.ts +111 -0
- package/packages/helper/tests/vitest.setup.ts +2 -0
- package/packages/markdown/.turbo/turbo-build.log +12 -22
- package/packages/markdown/dist/index.cjs.js +37 -63
- package/packages/markdown/dist/index.es.js +4287 -4425
- package/packages/markdown/dist/types/components/Markdown.d.ts.map +1 -1
- package/packages/markdown/dist/types/plugins/attr.d.ts.map +1 -1
- package/packages/markdown/dist/types/plugins/card.d.ts.map +1 -1
- package/packages/markdown/dist/types/plugins/cell.d.ts.map +1 -1
- package/packages/markdown/dist/types/plugins/faq.d.ts.map +1 -1
- package/packages/markdown/dist/types/plugins/grid.d.ts.map +1 -1
- package/packages/markdown/dist/types/plugins/headings.d.ts +3 -1
- package/packages/markdown/dist/types/plugins/headings.d.ts.map +1 -1
- package/packages/markdown/dist/types/plugins/helper.d.ts.map +1 -1
- package/packages/markdown/dist/types/plugins/linkButton.d.ts.map +1 -1
- package/packages/markdown/dist/types/plugins/youtube.d.ts.map +1 -1
- package/packages/markdown/node_modules/.bin/autoprefixer +44 -6
- package/packages/markdown/package.json +16 -15
- package/packages/markdown/src/components/Markdown.tsx +4 -0
- package/packages/markdown/src/plugins/grid.ts +4 -1
- package/packages/markdown/src/plugins/headings.ts +6 -3
- package/packages/markdown/src/plugins/linkButton.ts +2 -1
- package/packages/markdown/src/plugins/youtube.ts +5 -4
- package/packages/tailwind-theme-plugin/#package.json# +51 -0
- package/packages/tailwind-theme-plugin/.turbo/turbo-build.log +12 -22
- package/packages/tailwind-theme-plugin/dist/index.cjs.js +1 -1
- package/packages/tailwind-theme-plugin/dist/index.es.js +1111 -1477
- package/packages/tailwind-theme-plugin/dist/types/index.d.ts +1 -4
- package/packages/tailwind-theme-plugin/dist/types/index.d.ts.map +1 -1
- package/packages/tailwind-theme-plugin/node_modules/.bin/autoprefixer +44 -6
- package/packages/tailwind-theme-plugin/package.json +8 -6
- package/packages/tailwind-theme-plugin/src/index.ts +15 -58
- package/packages/tailwind-theme-plugin/vite.config.ts +2 -0
- package/packages/forms/node_modules/.bin/tailwind +0 -17
- package/packages/forms/node_modules/.bin/tailwindcss +0 -17
- package/packages/forms/node_modules/.bin/ts-node +0 -17
- package/packages/forms/node_modules/.bin/ts-node-cwd +0 -17
- package/packages/forms/node_modules/.bin/ts-node-esm +0 -17
- package/packages/forms/node_modules/.bin/ts-node-script +0 -17
- package/packages/forms/node_modules/.bin/ts-node-transpile-only +0 -17
- package/packages/forms/node_modules/.bin/ts-script +0 -17
- package/packages/forms/node_modules/.bin/tsc +0 -17
- package/packages/forms/node_modules/.bin/tsserver +0 -17
- package/packages/forms/node_modules/.vite/vitest/results.json +0 -1
- package/packages/markdown/node_modules/.bin/tailwind +0 -17
- package/packages/markdown/node_modules/.bin/tailwindcss +0 -17
- package/packages/markdown/node_modules/.bin/ts-node +0 -17
- package/packages/markdown/node_modules/.bin/ts-node-cwd +0 -17
- package/packages/markdown/node_modules/.bin/ts-node-esm +0 -17
- package/packages/markdown/node_modules/.bin/ts-node-script +0 -17
- package/packages/markdown/node_modules/.bin/ts-node-transpile-only +0 -17
- package/packages/markdown/node_modules/.bin/ts-script +0 -17
- package/packages/markdown/node_modules/.bin/tsc +0 -17
- package/packages/markdown/node_modules/.bin/tsserver +0 -17
- package/packages/tailwind-theme-plugin/node_modules/.bin/tailwind +0 -17
- package/packages/tailwind-theme-plugin/node_modules/.bin/tailwindcss +0 -17
- package/packages/tailwind-theme-plugin/node_modules/.bin/ts-node +0 -17
- package/packages/tailwind-theme-plugin/node_modules/.bin/ts-node-cwd +0 -17
- package/packages/tailwind-theme-plugin/node_modules/.bin/ts-node-esm +0 -17
- package/packages/tailwind-theme-plugin/node_modules/.bin/ts-node-script +0 -17
- package/packages/tailwind-theme-plugin/node_modules/.bin/ts-node-transpile-only +0 -17
- package/packages/tailwind-theme-plugin/node_modules/.bin/ts-script +0 -17
- package/packages/tailwind-theme-plugin/node_modules/.bin/tsc +0 -17
- package/packages/tailwind-theme-plugin/node_modules/.bin/tsserver +0 -17
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
export declare namespace Style {
|
|
2
2
|
const clickable = "\n px-2\n min-h-[calc(44/16*1rem)]\n border\n border-transparent\n rounded-lg\n hover:bg-solid-grey-50\n ";
|
|
3
3
|
const selected = "\n rounded-full\n bg-yellow-50\n ";
|
|
4
|
-
const focusRectCondensed = "\n \n focus-visible:outline
|
|
5
|
-
const focusRectCondensedWithBg = "\n \n \n focus-visible:outline
|
|
6
|
-
const focusRect = "\n \n focus-visible:outline
|
|
7
|
-
const focusRounded = "\n \n \n focus-visible:outline
|
|
8
|
-
const focusCard = "\n \n \n focus-visible:outline
|
|
9
|
-
const focusRectWithBg = "\n \n \n focus-visible:outline
|
|
10
|
-
const focusRoundedWithBg = "\n \n \n \n focus-visible:outline
|
|
4
|
+
const focusRectCondensed = "\n \n focus-visible:outline-4\n focus-visible:outline-black\n focus-visible:ring-yellow-300\n \n focus-visible:-outline-offset-4\n focus-visible:ring-[calc(6/16*1rem)]\n focus-visible:ring-inset\n ";
|
|
5
|
+
const focusRectCondensedWithBg = "\n \n \n focus-visible:outline-4\n focus-visible:outline-black\n focus-visible:ring-yellow-300\n \n focus-visible:-outline-offset-4\n focus-visible:ring-[calc(6/16*1rem)]\n focus-visible:ring-inset\n \n focus-visible:bg-yellow-300\n ";
|
|
6
|
+
const focusRect = "\n \n focus-visible:outline-4\n focus-visible:outline-black\n focus-visible:ring-yellow-300\n \n focus-visible:outline-offset-[calc(2/16*1rem)]\n focus-visible:ring-[calc(2/16*1rem)]\n ";
|
|
7
|
+
const focusRounded = "\n \n \n focus-visible:outline-4\n focus-visible:outline-black\n focus-visible:ring-yellow-300\n \n focus-visible:outline-offset-[calc(2/16*1rem)]\n focus-visible:ring-[calc(2/16*1rem)]\n \n focus-visible:rounded-sm\n ";
|
|
8
|
+
const focusCard = "\n \n \n focus-visible:outline-4\n focus-visible:outline-black\n focus-visible:ring-yellow-300\n \n focus-visible:outline-offset-[calc(2/16*1rem)]\n focus-visible:ring-[calc(2/16*1rem)]\n \n focus-visible:rounded-2xl\n sm:focus-visible:rounded-3xl\n ";
|
|
9
|
+
const focusRectWithBg = "\n \n \n focus-visible:outline-4\n focus-visible:outline-black\n focus-visible:ring-yellow-300\n \n focus-visible:outline-offset-[calc(2/16*1rem)]\n focus-visible:ring-[calc(2/16*1rem)]\n \n focus-visible:bg-yellow-300\n ";
|
|
10
|
+
const focusRoundedWithBg = "\n \n \n \n focus-visible:outline-4\n focus-visible:outline-black\n focus-visible:ring-yellow-300\n \n focus-visible:outline-offset-[calc(2/16*1rem)]\n focus-visible:ring-[calc(2/16*1rem)]\n \n focus-visible:bg-yellow-300\n \n focus-visible:rounded-sm\n ";
|
|
11
11
|
const hoverUnderline = "\n hover:underline\n hover:underline-offset-[calc(3/16*1rem)]\n ";
|
|
12
12
|
const underline = "\n underline\n underline-offset-[calc(3/16*1rem)]\n hover:decoration-[calc(3/16*1rem)]\n ";
|
|
13
13
|
const underlineNoDeco = "\n underline\n underline-offset-[calc(3/16*1rem)]\n ";
|
|
@@ -15,8 +15,8 @@ export declare namespace Style {
|
|
|
15
15
|
const popoverPositionBottomRight = "\n absolute\n top-11\n right-0\n ";
|
|
16
16
|
const popoverPositionBottomLeft = "\n absolute\n top-11\n left-0\n ";
|
|
17
17
|
namespace Peer {
|
|
18
|
-
const focus = "\n peer-focus-visible:outline
|
|
19
|
-
const focusRect = "\n \n peer-focus-visible:outline
|
|
18
|
+
const focus = "\n peer-focus-visible:outline-4\n peer-focus-visible:outline-black\n peer-focus-visible:ring-yellow-300\n ";
|
|
19
|
+
const focusRect = "\n \n peer-focus-visible:outline-4\n peer-focus-visible:outline-black\n peer-focus-visible:ring-yellow-300\n \n peer-focus-visible:outline-offset-[calc(2/16*1rem)]\n peer-focus-visible:ring-[calc(2/16*1rem)]\n ";
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
22
|
//# sourceMappingURL=styles.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../src/styles.ts"],"names":[],"mappings":"AAAA,yBAAiB,KAAK,CAAC;IACd,MAAM,SAAS,iIAOrB,CAAA;IAEM,MAAM,QAAQ,6CAGpB,CAAA;
|
|
1
|
+
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../src/styles.ts"],"names":[],"mappings":"AAAA,yBAAiB,KAAK,CAAC;IACd,MAAM,SAAS,iIAOrB,CAAA;IAEM,MAAM,QAAQ,6CAGpB,CAAA;IAQM,MAAM,kBAAkB,iOAK9B,CAAA;IAEM,MAAM,wBAAwB,4QAGpC,CAAA;IAEM,MAAM,SAAS,kNAIrB,CAAA;IAEM,MAAM,YAAY,0PAGxB,CAAA;IAEM,MAAM,SAAS,6RAIrB,CAAA;IAEM,MAAM,eAAe,6PAG3B,CAAA;IAEM,MAAM,kBAAkB,qSAG9B,CAAA;IAEM,MAAM,cAAc,4EAG1B,CAAA;IAEM,MAAM,SAAS,wGAIrB,CAAA;IAEM,MAAM,eAAe,gEAG3B,CAAA;IAEM,MAAM,OAAO,0KAUnB,CAAA;IAEM,MAAM,0BAA0B,gDAItC,CAAA;IAEM,MAAM,yBAAyB,+CAIrC,CAAA;IAED,UAAiB,IAAI,CAAC;QACb,MAAM,KAAK,iIAIjB,CAAA;QAEM,MAAM,SAAS,2PAIrB,CAAA;KACF;CACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"treefy.d.ts","sourceRoot":"","sources":["../../src/treefy.ts"],"names":[],"mappings":"AAAA,KAAK,QAAQ,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,EAAE,UAAU,CAAC,GAAG;IAAE,QAAQ,CAAC,EAAE,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAA;CAAE,CAAA;AAGrE,eAAO,MAAM,MAAM,GAAI,CAAC,SAAS;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,
|
|
1
|
+
{"version":3,"file":"treefy.d.ts","sourceRoot":"","sources":["../../src/treefy.ts"],"names":[],"mappings":"AAAA,KAAK,QAAQ,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,EAAE,UAAU,CAAC,GAAG;IAAE,QAAQ,CAAC,EAAE,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAA;CAAE,CAAA;AAGrE,eAAO,MAAM,MAAM,GAAI,CAAC,SAAS;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,EAAE,OAAO,CAAC,EAAE,kBAoB7D,CAAA"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
#!/bin/sh
|
|
2
|
+
# Resolve $0 through symlinks so basedir is the shim's real directory.
|
|
3
|
+
# Cap hops at the kernel's ELOOP limit so a cycle cannot hang the shim.
|
|
4
|
+
link="$0"
|
|
5
|
+
hops=0
|
|
6
|
+
while [ -L "$link" ] && [ "$hops" -lt 40 ]; do
|
|
7
|
+
hops=$((hops+1))
|
|
8
|
+
target=$(readlink "$link")
|
|
9
|
+
case "$target" in
|
|
10
|
+
/*) link="$target" ;;
|
|
11
|
+
*) link="$(dirname "$link")/$target" ;;
|
|
12
|
+
esac
|
|
13
|
+
done
|
|
14
|
+
basedir=$(dirname "$(echo "$link" | sed -e 's,\\,/,g')")
|
|
15
|
+
basedir_win="$basedir"
|
|
16
|
+
exe=""
|
|
17
|
+
msys=""
|
|
18
|
+
|
|
19
|
+
case `uname -a` in
|
|
20
|
+
*CYGWIN*|*MINGW*|*MSYS*)
|
|
21
|
+
if command -v cygpath > /dev/null 2>&1; then
|
|
22
|
+
basedir_win=`cygpath -w "$basedir"`
|
|
23
|
+
fi
|
|
24
|
+
exe=".exe"
|
|
25
|
+
msys="true"
|
|
26
|
+
;;
|
|
27
|
+
*WSL2*)
|
|
28
|
+
if command -v wslpath > /dev/null 2>&1; then
|
|
29
|
+
basedir_win="$(wslpath -w "$basedir" 2> /dev/null)"
|
|
30
|
+
if [ $? -ne 0 ] || [ -z "$basedir_win" ]; then
|
|
31
|
+
basedir_win="$basedir"
|
|
32
|
+
else
|
|
33
|
+
exe=".exe"
|
|
34
|
+
fi
|
|
35
|
+
fi
|
|
36
|
+
;;
|
|
37
|
+
esac
|
|
38
|
+
|
|
39
|
+
if [ -z "$NODE_PATH" ]; then
|
|
40
|
+
export NODE_PATH="/home/runner/work/sakura-ui/sakura-ui/node_modules/.pnpm/vitest@4.1.11_@types+node@24.13.3_happy-dom@20.11.6_vite@7.3.6_@types+node@24.13.3_jiti@2.7.0_lightningcss@1.32.0_/node_modules/vitest/node_modules:/home/runner/work/sakura-ui/sakura-ui/node_modules/.pnpm/vitest@4.1.11_@types+node@24.13.3_happy-dom@20.11.6_vite@7.3.6_@types+node@24.13.3_jiti@2.7.0_lightningcss@1.32.0_/node_modules:/home/runner/work/sakura-ui/sakura-ui/node_modules/.pnpm/node_modules"
|
|
41
|
+
else
|
|
42
|
+
export NODE_PATH="/home/runner/work/sakura-ui/sakura-ui/node_modules/.pnpm/vitest@4.1.11_@types+node@24.13.3_happy-dom@20.11.6_vite@7.3.6_@types+node@24.13.3_jiti@2.7.0_lightningcss@1.32.0_/node_modules/vitest/node_modules:/home/runner/work/sakura-ui/sakura-ui/node_modules/.pnpm/vitest@4.1.11_@types+node@24.13.3_happy-dom@20.11.6_vite@7.3.6_@types+node@24.13.3_jiti@2.7.0_lightningcss@1.32.0_/node_modules:/home/runner/work/sakura-ui/sakura-ui/node_modules/.pnpm/node_modules:$NODE_PATH"
|
|
43
|
+
fi
|
|
44
|
+
if [ -n "$exe" ] && [ -x "$basedir/node.exe" ]; then
|
|
45
|
+
exec "$basedir/node.exe" "$basedir_win/../vitest/vitest.mjs" "$@"
|
|
46
|
+
elif [ -x "$basedir/node" ]; then
|
|
47
|
+
exec "$basedir/node" "$basedir/../vitest/vitest.mjs" "$@"
|
|
48
|
+
elif command -v node >/dev/null 2>&1; then
|
|
49
|
+
exec node "$basedir/../vitest/vitest.mjs" "$@"
|
|
50
|
+
elif [ -n "$exe" ] && command -v node.exe >/dev/null 2>&1; then
|
|
51
|
+
exec node.exe "$basedir_win/../vitest/vitest.mjs" "$@"
|
|
52
|
+
else
|
|
53
|
+
exec node "$basedir/../vitest/vitest.mjs" "$@"
|
|
54
|
+
fi
|
|
55
|
+
# cmd-shim-target=/home/runner/work/sakura-ui/sakura-ui/packages/helper/node_modules/vitest/vitest.mjs
|
|
@@ -1,7 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sakura-ui/helper",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.9",
|
|
4
|
+
"author": "glassonion1",
|
|
5
|
+
"homepage": "https://github.com/glassonion1/sakura-ui",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/glassonion1/sakura-ui.git",
|
|
9
|
+
"directory": "packages/helper"
|
|
10
|
+
},
|
|
4
11
|
"license": "MIT",
|
|
12
|
+
"type": "module",
|
|
5
13
|
"main": "dist/index.cjs.js",
|
|
6
14
|
"types": "dist/types/index.d.ts",
|
|
7
15
|
"exports": {
|
|
@@ -26,7 +34,8 @@
|
|
|
26
34
|
"build": "run-p build:*",
|
|
27
35
|
"build:scripts": "vite build",
|
|
28
36
|
"build:types": "tsc && tsc-alias",
|
|
29
|
-
"test": "vitest"
|
|
37
|
+
"test": "vitest run",
|
|
38
|
+
"test:watch": "vitest"
|
|
30
39
|
},
|
|
31
40
|
"devDependencies": {
|
|
32
41
|
"@testing-library/jest-dom": "catalog:",
|
|
@@ -35,6 +44,7 @@
|
|
|
35
44
|
"@types/react-dom": "catalog:",
|
|
36
45
|
"happy-dom": "catalog:",
|
|
37
46
|
"react": "catalog:",
|
|
38
|
-
"react-dom": "catalog:"
|
|
47
|
+
"react-dom": "catalog:",
|
|
48
|
+
"vitest": "catalog:"
|
|
39
49
|
}
|
|
40
50
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
// biome-ignore lint/suspicious/noExplicitAny:
|
|
1
|
+
// biome-ignore lint/suspicious/noExplicitAny: callers mix strings, booleans and undefined
|
|
2
2
|
export const cx = (...classNames: any[]) => classNames.filter(Boolean).join(' ')
|
|
@@ -14,7 +14,6 @@ export namespace Style {
|
|
|
14
14
|
`
|
|
15
15
|
|
|
16
16
|
const focus = `
|
|
17
|
-
focus-visible:outline
|
|
18
17
|
focus-visible:outline-4
|
|
19
18
|
focus-visible:outline-black
|
|
20
19
|
focus-visible:ring-yellow-300
|
|
@@ -40,7 +39,7 @@ export namespace Style {
|
|
|
40
39
|
|
|
41
40
|
export const focusRounded = `
|
|
42
41
|
${focusRect}
|
|
43
|
-
focus-visible:rounded
|
|
42
|
+
focus-visible:rounded-sm
|
|
44
43
|
`
|
|
45
44
|
|
|
46
45
|
export const focusCard = `
|
|
@@ -56,7 +55,7 @@ export namespace Style {
|
|
|
56
55
|
|
|
57
56
|
export const focusRoundedWithBg = `
|
|
58
57
|
${focusRectWithBg}
|
|
59
|
-
focus-visible:rounded
|
|
58
|
+
focus-visible:rounded-sm
|
|
60
59
|
`
|
|
61
60
|
|
|
62
61
|
export const hoverUnderline = `
|
|
@@ -101,7 +100,6 @@ export namespace Style {
|
|
|
101
100
|
|
|
102
101
|
export namespace Peer {
|
|
103
102
|
export const focus = `
|
|
104
|
-
peer-focus-visible:outline
|
|
105
103
|
peer-focus-visible:outline-4
|
|
106
104
|
peer-focus-visible:outline-black
|
|
107
105
|
peer-focus-visible:ring-yellow-300
|
|
@@ -10,7 +10,9 @@ export const treefy = <I extends { depth: number }>(input: I[]) => {
|
|
|
10
10
|
if (top < item.depth && item.depth <= bottom + 1) {
|
|
11
11
|
const idx = item.depth - top
|
|
12
12
|
bottom = item.depth
|
|
13
|
-
|
|
13
|
+
const parent = last[idx - 1]
|
|
14
|
+
parent.children ??= []
|
|
15
|
+
parent.children.push(item)
|
|
14
16
|
last[idx] = item
|
|
15
17
|
continue
|
|
16
18
|
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { describe, it, expect } from 'vitest'
|
|
2
|
+
import { mod } from '../src/calc'
|
|
3
|
+
|
|
4
|
+
describe('mod', () => {
|
|
5
|
+
it('should return the remainder for positive numbers', () => {
|
|
6
|
+
expect(mod(5, 3)).toBe(2)
|
|
7
|
+
})
|
|
8
|
+
|
|
9
|
+
it('should return a positive result for negative dividend', () => {
|
|
10
|
+
expect(mod(-1, 3)).toBe(2)
|
|
11
|
+
expect(mod(-5, 3)).toBe(1)
|
|
12
|
+
})
|
|
13
|
+
|
|
14
|
+
it('should return 0 when evenly divisible', () => {
|
|
15
|
+
expect(mod(6, 3)).toBe(0)
|
|
16
|
+
expect(mod(7, 7)).toBe(0)
|
|
17
|
+
})
|
|
18
|
+
|
|
19
|
+
it('should return 0 when dividend is 0', () => {
|
|
20
|
+
expect(mod(0, 5)).toBe(0)
|
|
21
|
+
})
|
|
22
|
+
})
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { describe, it, expect } from 'vitest'
|
|
2
|
+
import { cx } from '../src/cx'
|
|
3
|
+
|
|
4
|
+
describe('cx', () => {
|
|
5
|
+
it('should join multiple class names with a space', () => {
|
|
6
|
+
expect(cx('foo', 'bar', 'baz')).toBe('foo bar baz')
|
|
7
|
+
})
|
|
8
|
+
|
|
9
|
+
it('should filter out falsy values', () => {
|
|
10
|
+
expect(cx('foo', false, 'bar', null, undefined, 0, '', 'baz')).toBe(
|
|
11
|
+
'foo bar baz'
|
|
12
|
+
)
|
|
13
|
+
})
|
|
14
|
+
|
|
15
|
+
it('should handle conditional class names', () => {
|
|
16
|
+
const isActive = true
|
|
17
|
+
const isDisabled = false
|
|
18
|
+
expect(cx('base', isActive && 'active', isDisabled && 'disabled')).toBe(
|
|
19
|
+
'base active'
|
|
20
|
+
)
|
|
21
|
+
})
|
|
22
|
+
|
|
23
|
+
it('should return an empty string when no arguments', () => {
|
|
24
|
+
expect(cx()).toBe('')
|
|
25
|
+
})
|
|
26
|
+
|
|
27
|
+
it('should handle a single class name', () => {
|
|
28
|
+
expect(cx('only')).toBe('only')
|
|
29
|
+
})
|
|
30
|
+
})
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { describe, it, expect } from 'vitest'
|
|
2
|
+
import { focusableSelector } from '../src/querySelector'
|
|
3
|
+
|
|
4
|
+
describe('focusableSelector', () => {
|
|
5
|
+
it('should be a string', () => {
|
|
6
|
+
expect(typeof focusableSelector).toBe('string')
|
|
7
|
+
})
|
|
8
|
+
|
|
9
|
+
it('should include common focusable element selectors', () => {
|
|
10
|
+
expect(focusableSelector).toContain('a[href]')
|
|
11
|
+
expect(focusableSelector).toContain('button')
|
|
12
|
+
expect(focusableSelector).toContain('input')
|
|
13
|
+
expect(focusableSelector).toContain('select')
|
|
14
|
+
expect(focusableSelector).toContain('textarea')
|
|
15
|
+
})
|
|
16
|
+
|
|
17
|
+
it('should exclude elements with negative tabindex', () => {
|
|
18
|
+
expect(focusableSelector).toContain(':not([tabindex^="-"])')
|
|
19
|
+
})
|
|
20
|
+
|
|
21
|
+
it('should exclude disabled elements for interactive elements', () => {
|
|
22
|
+
expect(focusableSelector).toContain(':not(:disabled)')
|
|
23
|
+
})
|
|
24
|
+
})
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { describe, it, expect } from 'vitest'
|
|
2
|
+
import { treefy } from '../src/treefy'
|
|
3
|
+
|
|
4
|
+
describe('treefy', () => {
|
|
5
|
+
it('should return an empty array for empty input', () => {
|
|
6
|
+
expect(treefy([])).toEqual([])
|
|
7
|
+
})
|
|
8
|
+
|
|
9
|
+
it('should keep flat items at the root level when all depths are the same', () => {
|
|
10
|
+
const input = [
|
|
11
|
+
{ depth: 1, name: 'a' },
|
|
12
|
+
{ depth: 1, name: 'b' },
|
|
13
|
+
{ depth: 1, name: 'c' }
|
|
14
|
+
]
|
|
15
|
+
expect(treefy(input)).toEqual([
|
|
16
|
+
{ depth: 1, name: 'a' },
|
|
17
|
+
{ depth: 1, name: 'b' },
|
|
18
|
+
{ depth: 1, name: 'c' }
|
|
19
|
+
])
|
|
20
|
+
})
|
|
21
|
+
|
|
22
|
+
it('should nest children under their parent', () => {
|
|
23
|
+
const input = [
|
|
24
|
+
{ depth: 1, name: 'parent' },
|
|
25
|
+
{ depth: 2, name: 'child1' },
|
|
26
|
+
{ depth: 2, name: 'child2' }
|
|
27
|
+
]
|
|
28
|
+
expect(treefy(input)).toEqual([
|
|
29
|
+
{
|
|
30
|
+
depth: 1,
|
|
31
|
+
name: 'parent',
|
|
32
|
+
children: [
|
|
33
|
+
{ depth: 2, name: 'child1' },
|
|
34
|
+
{ depth: 2, name: 'child2' }
|
|
35
|
+
]
|
|
36
|
+
}
|
|
37
|
+
])
|
|
38
|
+
})
|
|
39
|
+
|
|
40
|
+
it('should nest deeply (depth 1 -> 2 -> 3)', () => {
|
|
41
|
+
const input = [
|
|
42
|
+
{ depth: 1, name: 'root' },
|
|
43
|
+
{ depth: 2, name: 'child' },
|
|
44
|
+
{ depth: 3, name: 'grandchild' }
|
|
45
|
+
]
|
|
46
|
+
expect(treefy(input)).toEqual([
|
|
47
|
+
{
|
|
48
|
+
depth: 1,
|
|
49
|
+
name: 'root',
|
|
50
|
+
children: [
|
|
51
|
+
{
|
|
52
|
+
depth: 2,
|
|
53
|
+
name: 'child',
|
|
54
|
+
children: [{ depth: 3, name: 'grandchild' }]
|
|
55
|
+
}
|
|
56
|
+
]
|
|
57
|
+
}
|
|
58
|
+
])
|
|
59
|
+
})
|
|
60
|
+
|
|
61
|
+
it('should handle multiple root nodes with children', () => {
|
|
62
|
+
const input = [
|
|
63
|
+
{ depth: 1, name: 'h1-first' },
|
|
64
|
+
{ depth: 2, name: 'h2-under-first' },
|
|
65
|
+
{ depth: 1, name: 'h1-second' },
|
|
66
|
+
{ depth: 2, name: 'h2-under-second' }
|
|
67
|
+
]
|
|
68
|
+
expect(treefy(input)).toEqual([
|
|
69
|
+
{
|
|
70
|
+
depth: 1,
|
|
71
|
+
name: 'h1-first',
|
|
72
|
+
children: [{ depth: 2, name: 'h2-under-first' }]
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
depth: 1,
|
|
76
|
+
name: 'h1-second',
|
|
77
|
+
children: [{ depth: 2, name: 'h2-under-second' }]
|
|
78
|
+
}
|
|
79
|
+
])
|
|
80
|
+
})
|
|
81
|
+
|
|
82
|
+
it('should strip existing children property from input items', () => {
|
|
83
|
+
const input = [
|
|
84
|
+
{ depth: 1, name: 'parent', children: 'should be removed' },
|
|
85
|
+
{ depth: 2, name: 'child', children: null }
|
|
86
|
+
]
|
|
87
|
+
expect(treefy(input)).toEqual([
|
|
88
|
+
{
|
|
89
|
+
depth: 1,
|
|
90
|
+
name: 'parent',
|
|
91
|
+
children: [{ depth: 2, name: 'child' }]
|
|
92
|
+
}
|
|
93
|
+
])
|
|
94
|
+
})
|
|
95
|
+
|
|
96
|
+
// PR #21: treefy bug fix - children were not properly attached to parent nodes
|
|
97
|
+
it('should correctly attach children to parent (regression test for PR #21)', () => {
|
|
98
|
+
const input = [
|
|
99
|
+
{ depth: 2, name: 'hogehoge1' },
|
|
100
|
+
{ depth: 3, name: 'fugafuga' },
|
|
101
|
+
{ depth: 2, name: 'hogehoge2' }
|
|
102
|
+
]
|
|
103
|
+
const result = treefy(input)
|
|
104
|
+
|
|
105
|
+
// hogehoge1 should have fugafuga as a child
|
|
106
|
+
expect(result[0].children).toEqual([{ depth: 3, name: 'fugafuga' }])
|
|
107
|
+
// hogehoge2 should be a separate root node, not nested under hogehoge1
|
|
108
|
+
expect(result).toHaveLength(2)
|
|
109
|
+
expect(result[1]).toEqual({ depth: 2, name: 'hogehoge2' })
|
|
110
|
+
})
|
|
111
|
+
})
|
|
@@ -1,22 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
> @sakura-ui/markdown@0.1.2 build:types /Users/t.fujita/Documents/Repos/sakura-ui/packages/markdown
|
|
16
|
-
> tsc && tsc-alias
|
|
17
|
-
|
|
18
|
-
[36mvite v6.0.3 [32mbuilding for production...[36m[39m
|
|
19
|
-
[2K[1Gtransforming (1) [2msrc/index.ts[22m[2K[1Gtransforming (35) [2msrc/plugins/youtube.ts[22m[2K[1Gtransforming (122) [2m../../node_modules/.pnpm/mdast-util-to-string@4.0.0/node_modules/mdast-util-to-string/index.js[22m[2K[1Gtransforming (201) [2m../../node_modules/.pnpm/micromark-extension-gfm-table@2.1.0/node_modules/micromark-extension-gfm-t[2K[1Gtransforming (262) [2m../../node_modules/.pnpm/property-information@6.5.0/node_modules/property-information/lib/find.js[[2K[1G[32m✓[39m 363 modules transformed.
|
|
20
|
-
[2K[1Grendering chunks (1)...[2K[1G[2K[1Gcomputing gzip size (0)...[2K[1Gcomputing gzip size (1)...[2K[1G[2mdist/[22m[36mindex.es.js [39m[1m[33m547.83 kB[39m[22m[2m │ gzip: 143.26 kB[22m
|
|
21
|
-
[2K[1Grendering chunks (1)...[2K[1G[2K[1Gcomputing gzip size (1)...[2K[1G[2mdist/[22m[36mindex.cjs.js [39m[1m[2m369.66 kB[22m[1m[22m[2m │ gzip: 118.08 kB[22m
|
|
22
|
-
[32m✓ built in 1.49s[39m
|
|
1
|
+
$ rimraf dist
|
|
2
|
+
$ run-p build:*
|
|
3
|
+
$ vite build
|
|
4
|
+
[36mvite v7.3.6 [32mbuilding client environment for production...[36m[39m
|
|
5
|
+
transforming...
|
|
6
|
+
$ tsc && tsc-alias
|
|
7
|
+
[32m✓[39m 365 modules transformed.
|
|
8
|
+
rendering chunks...
|
|
9
|
+
computing gzip size...
|
|
10
|
+
[2mdist/[22m[36mindex.es.js [39m[1m[33m554.27 kB[39m[22m[2m │ gzip: 141.23 kB[22m
|
|
11
|
+
[2mdist/[22m[36mindex.cjs.js [39m[1m[2m377.84 kB[22m[1m[22m[2m │ gzip: 117.18 kB[22m
|
|
12
|
+
[32m✓ built in 4.49s[39m
|