@sakura-ui/sakura-ui 0.3.0 → 0.4.2

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.
Files changed (133) hide show
  1. package/README.md +71 -0
  2. package/package.json +26 -25
  3. package/packages/core/package.json +10 -8
  4. package/packages/core/src/components/Button.tsx +1 -1
  5. package/packages/core/src/components/Card.tsx +8 -3
  6. package/packages/core/src/components/IconButton.tsx +1 -1
  7. package/packages/core/src/components/LangSelector.tsx +2 -2
  8. package/packages/core/src/components/Link.tsx +0 -1
  9. package/packages/core/src/components/LinkCard.tsx +87 -52
  10. package/packages/core/src/components/MenuButton.tsx +2 -2
  11. package/packages/core/src/components/NavigationItem.tsx +1 -1
  12. package/packages/core/src/components/NotificationBanner.tsx +20 -0
  13. package/packages/core/src/components/PopoverMenu.tsx +1 -0
  14. package/packages/core/src/components/buttonStyle.ts +1 -1
  15. package/packages/core/src/components/index.ts +1 -1
  16. package/packages/core/src/icons/index.ts +1 -1
  17. package/packages/core/src/index.ts +1 -0
  18. package/packages/core/vite.config.ts +2 -1
  19. package/packages/forms/.turbo/turbo-build.log +12 -22
  20. package/packages/forms/dist/index.cjs.js +52 -79
  21. package/packages/forms/dist/index.es.js +455 -646
  22. package/packages/forms/dist/types/components/Checkbox.d.ts +2 -2
  23. package/packages/forms/dist/types/components/Checkbox.d.ts.map +1 -1
  24. package/packages/forms/dist/types/components/FieldsetControl.d.ts +2 -2
  25. package/packages/forms/dist/types/components/FieldsetControl.d.ts.map +1 -1
  26. package/packages/forms/dist/types/components/FileInput.d.ts +2 -2
  27. package/packages/forms/dist/types/components/FileInput.d.ts.map +1 -1
  28. package/packages/forms/dist/types/components/Input.d.ts +2 -2
  29. package/packages/forms/dist/types/components/Input.d.ts.map +1 -1
  30. package/packages/forms/dist/types/components/LabelControl.d.ts +2 -2
  31. package/packages/forms/dist/types/components/LabelControl.d.ts.map +1 -1
  32. package/packages/forms/dist/types/components/Radio.d.ts +2 -2
  33. package/packages/forms/dist/types/components/Radio.d.ts.map +1 -1
  34. package/packages/forms/dist/types/components/Select.d.ts +2 -2
  35. package/packages/forms/dist/types/components/Select.d.ts.map +1 -1
  36. package/packages/forms/dist/types/components/Textarea.d.ts +2 -2
  37. package/packages/forms/dist/types/components/Textarea.d.ts.map +1 -1
  38. package/packages/forms/dist/types/components/controlled/CheckboxGroup.d.ts +1 -1
  39. package/packages/forms/dist/types/components/controlled/RadioGroup.d.ts +1 -1
  40. package/packages/forms/dist/types/components/inputStyle.d.ts +1 -1
  41. package/packages/forms/dist/types/components/inputStyle.d.ts.map +1 -1
  42. package/packages/forms/node_modules/.bin/autoprefixer +44 -6
  43. package/packages/forms/package.json +9 -7
  44. package/packages/forms/src/components/Checkbox.tsx +1 -2
  45. package/packages/forms/src/components/FileInput.tsx +3 -3
  46. package/packages/forms/src/components/Input.tsx +0 -1
  47. package/packages/forms/src/components/Radio.tsx +0 -1
  48. package/packages/forms/src/components/Select.tsx +0 -1
  49. package/packages/forms/src/components/Textarea.tsx +0 -1
  50. package/packages/forms/tests/FieldsetControl.test.tsx +8 -2
  51. package/packages/forms/tests/FileInput.test.tsx +30 -5
  52. package/packages/forms/tests/LabelControl.test.tsx +8 -2
  53. package/packages/forms/vite.config.ts +2 -1
  54. package/packages/helper/.turbo/turbo-build.log +12 -23
  55. package/packages/helper/dist/index.cjs.js +7 -9
  56. package/packages/helper/dist/index.es.js +23 -23
  57. package/packages/helper/dist/types/calc.d.ts.map +1 -1
  58. package/packages/helper/dist/types/cx.d.ts.map +1 -1
  59. package/packages/helper/dist/types/styles.d.ts +9 -9
  60. package/packages/helper/dist/types/styles.d.ts.map +1 -1
  61. package/packages/helper/dist/types/treefy.d.ts.map +1 -1
  62. package/packages/helper/node_modules/.bin/vitest +55 -0
  63. package/packages/helper/package.json +13 -3
  64. package/packages/helper/src/cx.ts +1 -1
  65. package/packages/helper/src/styles.ts +2 -4
  66. package/packages/helper/src/treefy.ts +3 -1
  67. package/packages/helper/tests/calc.test.ts +22 -0
  68. package/packages/helper/tests/cx.test.ts +30 -0
  69. package/packages/helper/tests/querySelector.test.ts +24 -0
  70. package/packages/helper/tests/treefy.test.ts +111 -0
  71. package/packages/helper/tests/vitest.setup.ts +2 -0
  72. package/packages/markdown/.turbo/turbo-build.log +12 -22
  73. package/packages/markdown/dist/index.cjs.js +37 -63
  74. package/packages/markdown/dist/index.es.js +4287 -4425
  75. package/packages/markdown/dist/types/components/Markdown.d.ts.map +1 -1
  76. package/packages/markdown/dist/types/plugins/attr.d.ts.map +1 -1
  77. package/packages/markdown/dist/types/plugins/card.d.ts.map +1 -1
  78. package/packages/markdown/dist/types/plugins/cell.d.ts.map +1 -1
  79. package/packages/markdown/dist/types/plugins/faq.d.ts.map +1 -1
  80. package/packages/markdown/dist/types/plugins/grid.d.ts.map +1 -1
  81. package/packages/markdown/dist/types/plugins/headings.d.ts +3 -1
  82. package/packages/markdown/dist/types/plugins/headings.d.ts.map +1 -1
  83. package/packages/markdown/dist/types/plugins/helper.d.ts.map +1 -1
  84. package/packages/markdown/dist/types/plugins/linkButton.d.ts.map +1 -1
  85. package/packages/markdown/dist/types/plugins/youtube.d.ts.map +1 -1
  86. package/packages/markdown/node_modules/.bin/autoprefixer +44 -6
  87. package/packages/markdown/package.json +16 -15
  88. package/packages/markdown/src/components/Markdown.tsx +4 -0
  89. package/packages/markdown/src/plugins/grid.ts +4 -1
  90. package/packages/markdown/src/plugins/headings.ts +6 -3
  91. package/packages/markdown/src/plugins/linkButton.ts +2 -1
  92. package/packages/markdown/src/plugins/youtube.ts +5 -4
  93. package/packages/tailwind-theme-plugin/#package.json# +51 -0
  94. package/packages/tailwind-theme-plugin/.turbo/turbo-build.log +12 -22
  95. package/packages/tailwind-theme-plugin/dist/index.cjs.js +1 -1
  96. package/packages/tailwind-theme-plugin/dist/index.es.js +1111 -1477
  97. package/packages/tailwind-theme-plugin/dist/types/index.d.ts +1 -4
  98. package/packages/tailwind-theme-plugin/dist/types/index.d.ts.map +1 -1
  99. package/packages/tailwind-theme-plugin/node_modules/.bin/autoprefixer +44 -6
  100. package/packages/tailwind-theme-plugin/package.json +8 -6
  101. package/packages/tailwind-theme-plugin/src/index.ts +15 -58
  102. package/packages/tailwind-theme-plugin/vite.config.ts +2 -0
  103. package/packages/forms/node_modules/.bin/tailwind +0 -17
  104. package/packages/forms/node_modules/.bin/tailwindcss +0 -17
  105. package/packages/forms/node_modules/.bin/ts-node +0 -17
  106. package/packages/forms/node_modules/.bin/ts-node-cwd +0 -17
  107. package/packages/forms/node_modules/.bin/ts-node-esm +0 -17
  108. package/packages/forms/node_modules/.bin/ts-node-script +0 -17
  109. package/packages/forms/node_modules/.bin/ts-node-transpile-only +0 -17
  110. package/packages/forms/node_modules/.bin/ts-script +0 -17
  111. package/packages/forms/node_modules/.bin/tsc +0 -17
  112. package/packages/forms/node_modules/.bin/tsserver +0 -17
  113. package/packages/forms/node_modules/.vite/vitest/results.json +0 -1
  114. package/packages/markdown/node_modules/.bin/tailwind +0 -17
  115. package/packages/markdown/node_modules/.bin/tailwindcss +0 -17
  116. package/packages/markdown/node_modules/.bin/ts-node +0 -17
  117. package/packages/markdown/node_modules/.bin/ts-node-cwd +0 -17
  118. package/packages/markdown/node_modules/.bin/ts-node-esm +0 -17
  119. package/packages/markdown/node_modules/.bin/ts-node-script +0 -17
  120. package/packages/markdown/node_modules/.bin/ts-node-transpile-only +0 -17
  121. package/packages/markdown/node_modules/.bin/ts-script +0 -17
  122. package/packages/markdown/node_modules/.bin/tsc +0 -17
  123. package/packages/markdown/node_modules/.bin/tsserver +0 -17
  124. package/packages/tailwind-theme-plugin/node_modules/.bin/tailwind +0 -17
  125. package/packages/tailwind-theme-plugin/node_modules/.bin/tailwindcss +0 -17
  126. package/packages/tailwind-theme-plugin/node_modules/.bin/ts-node +0 -17
  127. package/packages/tailwind-theme-plugin/node_modules/.bin/ts-node-cwd +0 -17
  128. package/packages/tailwind-theme-plugin/node_modules/.bin/ts-node-esm +0 -17
  129. package/packages/tailwind-theme-plugin/node_modules/.bin/ts-node-script +0 -17
  130. package/packages/tailwind-theme-plugin/node_modules/.bin/ts-node-transpile-only +0 -17
  131. package/packages/tailwind-theme-plugin/node_modules/.bin/ts-script +0 -17
  132. package/packages/tailwind-theme-plugin/node_modules/.bin/tsc +0 -17
  133. package/packages/tailwind-theme-plugin/node_modules/.bin/tsserver +0 -17
@@ -1,4 +1,4 @@
1
- const o = ':not([tabindex^="-"])', n = ":not(:disabled)", d = [
1
+ const o = ':not([tabindex^="-"])', n = ":not(:disabled)", f = [
2
2
  `a[href]${o}`,
3
3
  `area[href]${o}`,
4
4
  `input:not([type="hidden"])${o}${n}`,
@@ -12,20 +12,22 @@ const o = ':not([tabindex^="-"])', n = ":not(:disabled)", d = [
12
12
  `video[controls]${o}`,
13
13
  `[contenteditable]${o}`,
14
14
  `[tabindex]${o}`
15
- ], a = d.join(","), b = (e, i) => (e % i + i) % i, v = (...e) => e.filter(Boolean).join(" "), h = (e) => {
16
- const i = [], c = [];
15
+ ], b = f.join(","), h = (e, s) => (e % s + s) % s, p = (...e) => e.filter(Boolean).join(" "), v = (e) => {
16
+ const s = [], c = [];
17
17
  let t = -1, r = -1;
18
- for (const { children: f, ...s } of e) {
19
- if (t < s.depth && s.depth <= r + 1) {
20
- const u = s.depth - t;
21
- r = s.depth, (c[u - 1].children ?? []).push(s), c[u] = s;
18
+ for (const { children: a, ...i } of e) {
19
+ if (t < i.depth && i.depth <= r + 1) {
20
+ const u = i.depth - t;
21
+ r = i.depth;
22
+ const l = c[u - 1];
23
+ l.children ??= [], l.children.push(i), c[u] = i;
22
24
  continue;
23
25
  }
24
- i.push(s), c[0] = s, t = r = s.depth;
26
+ s.push(i), c[0] = i, t = r = i.depth;
25
27
  }
26
- return i;
28
+ return s;
27
29
  };
28
- var l;
30
+ var d;
29
31
  ((e) => {
30
32
  e.clickable = `
31
33
  px-2
@@ -38,14 +40,13 @@ var l;
38
40
  rounded-full
39
41
  bg-yellow-50
40
42
  `;
41
- const i = `
42
- focus-visible:outline
43
+ const s = `
43
44
  focus-visible:outline-4
44
45
  focus-visible:outline-black
45
46
  focus-visible:ring-yellow-300
46
47
  `;
47
48
  e.focusRectCondensed = `
48
- ${i}
49
+ ${s}
49
50
  focus-visible:-outline-offset-4
50
51
  focus-visible:ring-[calc(6/16*1rem)]
51
52
  focus-visible:ring-inset
@@ -53,12 +54,12 @@ var l;
53
54
  ${e.focusRectCondensed}
54
55
  focus-visible:bg-yellow-300
55
56
  `, e.focusRect = `
56
- ${i}
57
+ ${s}
57
58
  focus-visible:outline-offset-[calc(2/16*1rem)]
58
59
  focus-visible:ring-[calc(2/16*1rem)]
59
60
  `, e.focusRounded = `
60
61
  ${e.focusRect}
61
- focus-visible:rounded
62
+ focus-visible:rounded-sm
62
63
  `, e.focusCard = `
63
64
  ${e.focusRect}
64
65
  focus-visible:rounded-2xl
@@ -68,7 +69,7 @@ var l;
68
69
  focus-visible:bg-yellow-300
69
70
  `, e.focusRoundedWithBg = `
70
71
  ${e.focusRectWithBg}
71
- focus-visible:rounded
72
+ focus-visible:rounded-sm
72
73
  `, e.hoverUnderline = `
73
74
  hover:underline
74
75
  hover:underline-offset-[calc(3/16*1rem)]
@@ -99,7 +100,6 @@ var l;
99
100
  left-0
100
101
  `, ((c) => {
101
102
  c.focus = `
102
- peer-focus-visible:outline
103
103
  peer-focus-visible:outline-4
104
104
  peer-focus-visible:outline-black
105
105
  peer-focus-visible:ring-yellow-300
@@ -109,11 +109,11 @@ var l;
109
109
  peer-focus-visible:ring-[calc(2/16*1rem)]
110
110
  `;
111
111
  })(e.Peer || (e.Peer = {}));
112
- })(l || (l = {}));
112
+ })(d || (d = {}));
113
113
  export {
114
- l as Style,
115
- v as cx,
116
- a as focusableSelector,
117
- b as mod,
118
- h as treefy
114
+ d as Style,
115
+ p as cx,
116
+ b as focusableSelector,
117
+ h as mod,
118
+ v as treefy
119
119
  };
@@ -1 +1 @@
1
- {"version":3,"file":"calc.d.ts","sourceRoot":"","sources":["../../src/calc.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,GAAG,MAAO,MAAM,KAAK,MAAM,KAAG,MAA2B,CAAA"}
1
+ {"version":3,"file":"calc.d.ts","sourceRoot":"","sources":["../../src/calc.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,GAAG,GAAI,GAAG,MAAM,EAAE,GAAG,MAAM,KAAG,MAA2B,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"cx.d.ts","sourceRoot":"","sources":["../../src/cx.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,EAAE,kBAAmB,GAAG,EAAE,WAAyC,CAAA"}
1
+ {"version":3,"file":"cx.d.ts","sourceRoot":"","sources":["../../src/cx.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,EAAE,GAAI,GAAG,YAAY,GAAG,EAAE,WAAyC,CAAA"}
@@ -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\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\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\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\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\n ";
8
- const focusCard = "\n \n \n focus-visible:outline\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\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\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\n ";
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\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\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 ";
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;IASM,MAAM,kBAAkB,4PAK9B,CAAA;IAEM,MAAM,wBAAwB,uSAGpC,CAAA;IAEM,MAAM,SAAS,6OAIrB,CAAA;IAEM,MAAM,YAAY,kRAGxB,CAAA;IAEM,MAAM,SAAS,wTAIrB,CAAA;IAEM,MAAM,eAAe,wRAG3B,CAAA;IAEM,MAAM,kBAAkB,6TAG9B,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,mKAKjB,CAAA;QAEM,MAAM,SAAS,6RAIrB,CAAA;KACF;CACF"}
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,SAAS,CAAC,EAAE,kBAkB7D,CAAA"}
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.5",
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
- ;(last[idx - 1].children ?? []).push(item)
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
+ })
@@ -0,0 +1,2 @@
1
+ /// <reference types="vitest" />
2
+ import '@testing-library/jest-dom'
@@ -1,22 +1,12 @@
1
-
2
- 
3
- > @sakura-ui/markdown@0.1.2 prebuild /Users/t.fujita/Documents/Repos/sakura-ui/packages/markdown
4
- > rimraf dist
5
-
6
-
7
- > @sakura-ui/markdown@0.1.2 build /Users/t.fujita/Documents/Repos/sakura-ui/packages/markdown
8
- > run-p build:*
9
-
10
-
11
- > @sakura-ui/markdown@0.1.2 build:scripts /Users/t.fujita/Documents/Repos/sakura-ui/packages/markdown
12
- > vite build
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
- vite v6.0.3 building for production...
19
- transforming (1) src/index.tstransforming (35) src/plugins/youtube.tstransforming (122) ../../node_modules/.pnpm/mdast-util-to-string@4.0.0/node_modules/mdast-util-to-string/index.jstransforming (201) ../../node_modules/.pnpm/micromark-extension-gfm-table@2.1.0/node_modules/micromark-extension-gfm-ttransforming (262) ../../node_modules/.pnpm/property-information@6.5.0/node_modules/property-information/lib/find.js[✓ 363 modules transformed.
20
- rendering chunks (1)...computing gzip size (0)...computing gzip size (1)...dist/index.es.js 547.83 kB │ gzip: 143.26 kB
21
- rendering chunks (1)...computing gzip size (1)...dist/index.cjs.js 369.66 kB │ gzip: 118.08 kB
22
- ✓ built in 1.49s
1
+ $ rimraf dist
2
+ $ run-p build:*
3
+ $ vite build
4
+ vite v7.3.6 building client environment for production...
5
+ $ tsc && tsc-alias
6
+ transforming...
7
+ ✓ 365 modules transformed.
8
+ rendering chunks...
9
+ computing gzip size...
10
+ dist/index.es.js 554.27 kB │ gzip: 141.23 kB
11
+ dist/index.cjs.js 377.84 kB │ gzip: 117.18 kB
12
+ ✓ built in 4.31s