@sakura-ui/sakura-ui 0.2.0 → 0.3.0

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 (215) hide show
  1. package/README.md +16 -6
  2. package/package.json +21 -15
  3. package/packages/core/package.json +26 -15
  4. package/packages/core/src/components/Button.tsx +33 -32
  5. package/packages/core/src/components/Card.tsx +29 -17
  6. package/packages/core/src/components/Code.tsx +6 -4
  7. package/packages/core/src/components/Faq.tsx +13 -7
  8. package/packages/core/src/components/Heading.tsx +42 -32
  9. package/packages/core/src/components/Icon.tsx +43 -13
  10. package/packages/core/src/components/IconButton.tsx +54 -43
  11. package/packages/core/src/components/LangSelector.tsx +135 -0
  12. package/packages/core/src/components/Link.tsx +38 -66
  13. package/packages/core/src/components/LinkCard.tsx +91 -0
  14. package/packages/core/src/components/List.tsx +14 -12
  15. package/packages/core/src/components/MenuButton.tsx +112 -0
  16. package/packages/core/src/components/NavigationItem.tsx +41 -0
  17. package/packages/core/src/components/OverflowContainer.tsx +24 -0
  18. package/packages/core/src/components/PopoverMenu.tsx +81 -0
  19. package/packages/core/src/components/Pre.tsx +6 -4
  20. package/packages/core/src/components/Table.tsx +31 -25
  21. package/packages/core/src/components/buttonStyle.ts +42 -31
  22. package/packages/core/src/components/index.ts +13 -25
  23. package/packages/core/src/icons/Close.tsx +21 -0
  24. package/packages/core/src/icons/CloseMobile.tsx +43 -0
  25. package/packages/core/src/icons/KeyboardArrowDown.tsx +24 -0
  26. package/packages/core/src/icons/Language.tsx +25 -0
  27. package/packages/core/src/icons/LanguageMobile.tsx +40 -0
  28. package/packages/core/src/icons/Menu.tsx +24 -0
  29. package/packages/core/src/icons/MenuMobile.tsx +40 -0
  30. package/packages/core/src/icons/index.ts +8 -0
  31. package/packages/core/src/icons/props.ts +5 -0
  32. package/packages/core/src/index.ts +9 -28
  33. package/packages/core/src/type.d.ts +1 -0
  34. package/packages/core/tests/Button.test.tsx +20 -10
  35. package/packages/core/tests/Card.test.tsx +16 -11
  36. package/packages/core/tests/IconButton.test.tsx +57 -0
  37. package/packages/core/tests/Link.test.tsx +60 -0
  38. package/packages/core/tests/vitest.setup.ts +1 -0
  39. package/packages/core/tsconfig.node.json +3 -2
  40. package/packages/forms/.turbo/turbo-build.log +22 -0
  41. package/packages/forms/dist/index.cjs.js +199 -120
  42. package/packages/forms/dist/index.es.js +890 -1023
  43. package/packages/forms/dist/types/components/Checkbox.d.ts +9 -4
  44. package/packages/forms/dist/types/components/Checkbox.d.ts.map +1 -1
  45. package/packages/forms/dist/types/components/FieldsetControl.d.ts +14 -9
  46. package/packages/forms/dist/types/components/FieldsetControl.d.ts.map +1 -1
  47. package/packages/forms/dist/types/components/FileInput.d.ts +10 -3
  48. package/packages/forms/dist/types/components/FileInput.d.ts.map +1 -1
  49. package/packages/forms/dist/types/components/Input.d.ts +9 -4
  50. package/packages/forms/dist/types/components/Input.d.ts.map +1 -1
  51. package/packages/forms/dist/types/components/LabelControl.d.ts +13 -8
  52. package/packages/forms/dist/types/components/LabelControl.d.ts.map +1 -1
  53. package/packages/forms/dist/types/components/Radio.d.ts +9 -4
  54. package/packages/forms/dist/types/components/Radio.d.ts.map +1 -1
  55. package/packages/forms/dist/types/components/Select.d.ts +9 -4
  56. package/packages/forms/dist/types/components/Select.d.ts.map +1 -1
  57. package/packages/forms/dist/types/components/Textarea.d.ts +8 -3
  58. package/packages/forms/dist/types/components/Textarea.d.ts.map +1 -1
  59. package/packages/forms/dist/types/components/controlled/CheckboxGroup.d.ts +16 -11
  60. package/packages/forms/dist/types/components/controlled/CheckboxGroup.d.ts.map +1 -1
  61. package/packages/forms/dist/types/components/controlled/RadioGroup.d.ts +17 -12
  62. package/packages/forms/dist/types/components/controlled/RadioGroup.d.ts.map +1 -1
  63. package/packages/forms/dist/types/components/index.d.ts +8 -8
  64. package/packages/forms/dist/types/components/index.d.ts.map +1 -1
  65. package/packages/forms/dist/types/components/inputStyle.d.ts +1 -1
  66. package/packages/forms/dist/types/components/inputStyle.d.ts.map +1 -1
  67. package/packages/forms/dist/types/index.d.ts +0 -1
  68. package/packages/forms/dist/types/index.d.ts.map +1 -1
  69. package/packages/forms/node_modules/.bin/autoprefixer +2 -2
  70. package/packages/forms/node_modules/.bin/tailwind +2 -2
  71. package/packages/forms/node_modules/.bin/tailwindcss +2 -2
  72. package/packages/forms/node_modules/.bin/ts-node +4 -4
  73. package/packages/forms/node_modules/.bin/ts-node-cwd +4 -4
  74. package/packages/forms/node_modules/.bin/ts-node-esm +4 -4
  75. package/packages/forms/node_modules/.bin/ts-node-script +4 -4
  76. package/packages/forms/node_modules/.bin/ts-node-transpile-only +4 -4
  77. package/packages/forms/node_modules/.bin/ts-script +4 -4
  78. package/packages/forms/node_modules/.bin/tsc +17 -0
  79. package/packages/forms/node_modules/.bin/tsserver +17 -0
  80. package/packages/forms/node_modules/.vite/vitest/results.json +1 -0
  81. package/packages/forms/package.json +17 -14
  82. package/packages/forms/src/components/Checkbox.tsx +76 -80
  83. package/packages/forms/src/components/FieldsetControl.tsx +21 -28
  84. package/packages/forms/src/components/FileInput.tsx +87 -63
  85. package/packages/forms/src/components/Input.tsx +29 -31
  86. package/packages/forms/src/components/LabelControl.tsx +19 -25
  87. package/packages/forms/src/components/Radio.tsx +66 -69
  88. package/packages/forms/src/components/Select.tsx +65 -65
  89. package/packages/forms/src/components/Textarea.tsx +49 -54
  90. package/packages/forms/src/components/controlled/CheckboxGroup.tsx +15 -17
  91. package/packages/forms/src/components/controlled/RadioGroup.tsx +16 -18
  92. package/packages/forms/src/components/index.ts +8 -8
  93. package/packages/forms/src/components/inputStyle.ts +7 -8
  94. package/packages/forms/src/index.ts +0 -11
  95. package/packages/forms/tests/Checkbox.test.tsx +44 -0
  96. package/packages/forms/tests/FieldsetControl.test.tsx +62 -11
  97. package/packages/forms/tests/FileInput.test.tsx +25 -0
  98. package/packages/forms/tests/Input.test.tsx +12 -83
  99. package/packages/forms/tests/LabelControl.test.tsx +82 -20
  100. package/packages/forms/tests/Radio.test.tsx +23 -78
  101. package/packages/forms/tests/Select.test.tsx +30 -0
  102. package/packages/forms/tests/Textarea.test.tsx +25 -0
  103. package/packages/forms/tests/vitest.setup.ts +1 -0
  104. package/packages/forms/tsconfig.node.json +3 -2
  105. package/packages/helper/.turbo/turbo-build.log +23 -0
  106. package/packages/helper/dist/index.cjs.js +78 -0
  107. package/packages/helper/dist/index.es.js +119 -0
  108. package/packages/helper/dist/types/calc.d.ts +2 -0
  109. package/packages/helper/dist/types/calc.d.ts.map +1 -0
  110. package/packages/{forms/dist/types/utils/class.d.ts → helper/dist/types/cx.d.ts} +1 -1
  111. package/packages/helper/dist/types/cx.d.ts.map +1 -0
  112. package/packages/helper/dist/types/index.d.ts +6 -0
  113. package/packages/helper/dist/types/index.d.ts.map +1 -0
  114. package/packages/helper/dist/types/querySelector.d.ts +2 -0
  115. package/packages/helper/dist/types/querySelector.d.ts.map +1 -0
  116. package/packages/helper/dist/types/styles.d.ts +22 -0
  117. package/packages/helper/dist/types/styles.d.ts.map +1 -0
  118. package/packages/helper/dist/types/treefy.d.ts +8 -0
  119. package/packages/helper/dist/types/treefy.d.ts.map +1 -0
  120. package/packages/helper/package.json +40 -0
  121. package/packages/helper/src/calc.ts +1 -0
  122. package/packages/helper/src/index.ts +5 -0
  123. package/packages/helper/src/querySelector.ts +20 -0
  124. package/packages/helper/src/styles.ts +116 -0
  125. package/packages/helper/src/treefy.ts +22 -0
  126. package/packages/helper/tsconfig.json +13 -0
  127. package/packages/helper/tsconfig.node.json +6 -0
  128. package/packages/helper/vite.config.ts +26 -0
  129. package/packages/markdown/.turbo/turbo-build.log +22 -0
  130. package/packages/markdown/README.md +129 -0
  131. package/packages/markdown/dist/index.cjs.js +175 -0
  132. package/packages/markdown/dist/index.es.js +17098 -0
  133. package/packages/markdown/dist/types/components/Markdown.d.ts +15 -0
  134. package/packages/markdown/dist/types/components/Markdown.d.ts.map +1 -0
  135. package/packages/markdown/dist/types/components/index.d.ts +2 -0
  136. package/packages/markdown/dist/types/components/index.d.ts.map +1 -0
  137. package/packages/markdown/dist/types/index.d.ts +2 -0
  138. package/packages/markdown/dist/types/index.d.ts.map +1 -0
  139. package/packages/markdown/dist/types/plugins/attr.d.ts +3 -0
  140. package/packages/markdown/dist/types/plugins/attr.d.ts.map +1 -0
  141. package/packages/markdown/dist/types/plugins/card.d.ts +3 -0
  142. package/packages/markdown/dist/types/plugins/card.d.ts.map +1 -0
  143. package/packages/markdown/dist/types/plugins/cell.d.ts +3 -0
  144. package/packages/markdown/dist/types/plugins/cell.d.ts.map +1 -0
  145. package/packages/markdown/dist/types/plugins/faq.d.ts +3 -0
  146. package/packages/markdown/dist/types/plugins/faq.d.ts.map +1 -0
  147. package/packages/markdown/dist/types/plugins/grid.d.ts +3 -0
  148. package/packages/markdown/dist/types/plugins/grid.d.ts.map +1 -0
  149. package/packages/markdown/dist/types/plugins/headings.d.ts +9 -0
  150. package/packages/markdown/dist/types/plugins/headings.d.ts.map +1 -0
  151. package/packages/markdown/dist/types/plugins/helper.d.ts +9 -0
  152. package/packages/markdown/dist/types/plugins/helper.d.ts.map +1 -0
  153. package/packages/markdown/dist/types/plugins/index.d.ts +9 -0
  154. package/packages/markdown/dist/types/plugins/index.d.ts.map +1 -0
  155. package/packages/markdown/dist/types/plugins/linkButton.d.ts +3 -0
  156. package/packages/markdown/dist/types/plugins/linkButton.d.ts.map +1 -0
  157. package/packages/markdown/dist/types/plugins/youtube.d.ts +3 -0
  158. package/packages/markdown/dist/types/plugins/youtube.d.ts.map +1 -0
  159. package/packages/markdown/node_modules/.bin/autoprefixer +17 -0
  160. package/packages/markdown/node_modules/.bin/tailwind +17 -0
  161. package/packages/markdown/node_modules/.bin/tailwindcss +17 -0
  162. package/packages/markdown/node_modules/.bin/ts-node +17 -0
  163. package/packages/markdown/node_modules/.bin/ts-node-cwd +17 -0
  164. package/packages/markdown/node_modules/.bin/ts-node-esm +17 -0
  165. package/packages/markdown/node_modules/.bin/ts-node-script +17 -0
  166. package/packages/markdown/node_modules/.bin/ts-node-transpile-only +17 -0
  167. package/packages/markdown/node_modules/.bin/ts-script +17 -0
  168. package/packages/markdown/node_modules/.bin/tsc +17 -0
  169. package/packages/markdown/node_modules/.bin/tsserver +17 -0
  170. package/packages/markdown/package.json +83 -0
  171. package/packages/markdown/src/components/Markdown.tsx +361 -0
  172. package/packages/markdown/src/components/index.ts +1 -0
  173. package/packages/markdown/src/global.d.ts +9 -0
  174. package/packages/markdown/src/index.ts +1 -0
  175. package/packages/markdown/src/plugins/attr.ts +19 -0
  176. package/packages/markdown/src/plugins/card.ts +57 -0
  177. package/packages/markdown/src/plugins/cell.ts +47 -0
  178. package/packages/markdown/src/plugins/faq.ts +40 -0
  179. package/packages/markdown/src/plugins/grid.ts +51 -0
  180. package/packages/markdown/src/plugins/headings.ts +35 -0
  181. package/packages/markdown/src/plugins/helper.ts +27 -0
  182. package/packages/markdown/src/plugins/index.ts +8 -0
  183. package/packages/markdown/src/plugins/linkButton.ts +25 -0
  184. package/packages/markdown/src/plugins/youtube.ts +48 -0
  185. package/packages/markdown/tsconfig.json +13 -0
  186. package/packages/markdown/tsconfig.node.json +7 -0
  187. package/packages/markdown/vite.config.ts +30 -0
  188. package/packages/tailwind-theme-plugin/.turbo/turbo-build.log +22 -0
  189. package/packages/tailwind-theme-plugin/dist/index.cjs.js +1 -1
  190. package/packages/tailwind-theme-plugin/dist/index.es.js +5354 -6111
  191. package/packages/tailwind-theme-plugin/dist/types/index.d.ts +1 -1
  192. package/packages/tailwind-theme-plugin/dist/types/index.d.ts.map +1 -1
  193. package/packages/tailwind-theme-plugin/node_modules/.bin/autoprefixer +2 -2
  194. package/packages/tailwind-theme-plugin/node_modules/.bin/tailwind +2 -2
  195. package/packages/tailwind-theme-plugin/node_modules/.bin/tailwindcss +2 -2
  196. package/packages/tailwind-theme-plugin/node_modules/.bin/ts-node +4 -4
  197. package/packages/tailwind-theme-plugin/node_modules/.bin/ts-node-cwd +4 -4
  198. package/packages/tailwind-theme-plugin/node_modules/.bin/ts-node-esm +4 -4
  199. package/packages/tailwind-theme-plugin/node_modules/.bin/ts-node-script +4 -4
  200. package/packages/tailwind-theme-plugin/node_modules/.bin/ts-node-transpile-only +4 -4
  201. package/packages/tailwind-theme-plugin/node_modules/.bin/ts-script +4 -4
  202. package/packages/tailwind-theme-plugin/node_modules/.bin/tsc +17 -0
  203. package/packages/tailwind-theme-plugin/node_modules/.bin/tsserver +17 -0
  204. package/packages/tailwind-theme-plugin/package.json +6 -6
  205. package/packages/tailwind-theme-plugin/src/index.ts +226 -291
  206. package/packages/core/src/libs/forward-ref.ts +0 -44
  207. package/packages/core/src/types/component.ts +0 -83
  208. package/packages/forms/dist/types/utils/class.d.ts.map +0 -1
  209. package/packages/forms/node_modules/.bin/acorn +0 -17
  210. package/packages/forms/node_modules/.bin/browserslist +0 -17
  211. package/packages/forms/node_modules/.bin/eslint +0 -17
  212. package/packages/forms/node_modules/.bin/vitest +0 -17
  213. package/packages/forms/src/utils/class.ts +0 -2
  214. package/packages/tailwind-theme-plugin/node_modules/.bin/browserslist +0 -17
  215. /package/packages/{core/src/libs → helper/src}/cx.ts +0 -0
@@ -0,0 +1,78 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=':not([tabindex^="-"])',n=":not(:disabled)",l=[`a[href]${o}`,`area[href]${o}`,`input:not([type="hidden"])${o}${n}`,`select${o}${n}`,`textarea${o}${n}`,`button${o}${n}`,`details > summary:first-of-type${o}`,`details:not(:has(> summary))${o}`,`iframe${o}`,`audio[controls]${o}`,`video[controls]${o}`,`[contenteditable]${o}`,`[tabindex]${o}`],d=l.join(","),f=(e,i)=>(e%i+i)%i,b=(...e)=>e.filter(Boolean).join(" "),a=e=>{const i=[],c=[];let t=-1,r=-1;for(const{children:v,...s}of e){if(t<s.depth&&s.depth<=r+1){const u=s.depth-t;r=s.depth,(c[u-1].children??[]).push(s),c[u]=s;continue}i.push(s),c[0]=s,t=r=s.depth}return i};exports.Style=void 0;(e=>{e.clickable=`
2
+ px-2
3
+ min-h-[calc(44/16*1rem)]
4
+ border
5
+ border-transparent
6
+ rounded-lg
7
+ hover:bg-solid-grey-50
8
+ `,e.selected=`
9
+ rounded-full
10
+ bg-yellow-50
11
+ `;const i=`
12
+ focus-visible:outline
13
+ focus-visible:outline-4
14
+ focus-visible:outline-black
15
+ focus-visible:ring-yellow-300
16
+ `;e.focusRectCondensed=`
17
+ ${i}
18
+ focus-visible:-outline-offset-4
19
+ focus-visible:ring-[calc(6/16*1rem)]
20
+ focus-visible:ring-inset
21
+ `,e.focusRectCondensedWithBg=`
22
+ ${e.focusRectCondensed}
23
+ focus-visible:bg-yellow-300
24
+ `,e.focusRect=`
25
+ ${i}
26
+ focus-visible:outline-offset-[calc(2/16*1rem)]
27
+ focus-visible:ring-[calc(2/16*1rem)]
28
+ `,e.focusRounded=`
29
+ ${e.focusRect}
30
+ focus-visible:rounded
31
+ `,e.focusCard=`
32
+ ${e.focusRect}
33
+ focus-visible:rounded-2xl
34
+ sm:focus-visible:rounded-3xl
35
+ `,e.focusRectWithBg=`
36
+ ${e.focusRect}
37
+ focus-visible:bg-yellow-300
38
+ `,e.focusRoundedWithBg=`
39
+ ${e.focusRectWithBg}
40
+ focus-visible:rounded
41
+ `,e.hoverUnderline=`
42
+ hover:underline
43
+ hover:underline-offset-[calc(3/16*1rem)]
44
+ `,e.underline=`
45
+ underline
46
+ underline-offset-[calc(3/16*1rem)]
47
+ hover:decoration-[calc(3/16*1rem)]
48
+ `,e.underlineNoDeco=`
49
+ underline
50
+ underline-offset-[calc(3/16*1rem)]
51
+ `,e.popover=`
52
+ min-w-fit
53
+ w-auto
54
+ py-2
55
+ bg-white
56
+ shadow-1
57
+ rounded-lg
58
+ border
59
+ border-solid-grey-420
60
+ has-[>:nth-child(7)]:rounded-r-none
61
+ `,e.popoverPositionBottomRight=`
62
+ absolute
63
+ top-11
64
+ right-0
65
+ `,e.popoverPositionBottomLeft=`
66
+ absolute
67
+ top-11
68
+ left-0
69
+ `,(c=>{c.focus=`
70
+ peer-focus-visible:outline
71
+ peer-focus-visible:outline-4
72
+ peer-focus-visible:outline-black
73
+ peer-focus-visible:ring-yellow-300
74
+ `,c.focusRect=`
75
+ ${c.focus}
76
+ peer-focus-visible:outline-offset-[calc(2/16*1rem)]
77
+ peer-focus-visible:ring-[calc(2/16*1rem)]
78
+ `})(e.Peer||(e.Peer={}))})(exports.Style||(exports.Style={}));exports.cx=b;exports.focusableSelector=d;exports.mod=f;exports.treefy=a;
@@ -0,0 +1,119 @@
1
+ const o = ':not([tabindex^="-"])', n = ":not(:disabled)", d = [
2
+ `a[href]${o}`,
3
+ `area[href]${o}`,
4
+ `input:not([type="hidden"])${o}${n}`,
5
+ `select${o}${n}`,
6
+ `textarea${o}${n}`,
7
+ `button${o}${n}`,
8
+ `details > summary:first-of-type${o}`,
9
+ `details:not(:has(> summary))${o}`,
10
+ `iframe${o}`,
11
+ `audio[controls]${o}`,
12
+ `video[controls]${o}`,
13
+ `[contenteditable]${o}`,
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 = [];
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;
22
+ continue;
23
+ }
24
+ i.push(s), c[0] = s, t = r = s.depth;
25
+ }
26
+ return i;
27
+ };
28
+ var l;
29
+ ((e) => {
30
+ e.clickable = `
31
+ px-2
32
+ min-h-[calc(44/16*1rem)]
33
+ border
34
+ border-transparent
35
+ rounded-lg
36
+ hover:bg-solid-grey-50
37
+ `, e.selected = `
38
+ rounded-full
39
+ bg-yellow-50
40
+ `;
41
+ const i = `
42
+ focus-visible:outline
43
+ focus-visible:outline-4
44
+ focus-visible:outline-black
45
+ focus-visible:ring-yellow-300
46
+ `;
47
+ e.focusRectCondensed = `
48
+ ${i}
49
+ focus-visible:-outline-offset-4
50
+ focus-visible:ring-[calc(6/16*1rem)]
51
+ focus-visible:ring-inset
52
+ `, e.focusRectCondensedWithBg = `
53
+ ${e.focusRectCondensed}
54
+ focus-visible:bg-yellow-300
55
+ `, e.focusRect = `
56
+ ${i}
57
+ focus-visible:outline-offset-[calc(2/16*1rem)]
58
+ focus-visible:ring-[calc(2/16*1rem)]
59
+ `, e.focusRounded = `
60
+ ${e.focusRect}
61
+ focus-visible:rounded
62
+ `, e.focusCard = `
63
+ ${e.focusRect}
64
+ focus-visible:rounded-2xl
65
+ sm:focus-visible:rounded-3xl
66
+ `, e.focusRectWithBg = `
67
+ ${e.focusRect}
68
+ focus-visible:bg-yellow-300
69
+ `, e.focusRoundedWithBg = `
70
+ ${e.focusRectWithBg}
71
+ focus-visible:rounded
72
+ `, e.hoverUnderline = `
73
+ hover:underline
74
+ hover:underline-offset-[calc(3/16*1rem)]
75
+ `, e.underline = `
76
+ underline
77
+ underline-offset-[calc(3/16*1rem)]
78
+ hover:decoration-[calc(3/16*1rem)]
79
+ `, e.underlineNoDeco = `
80
+ underline
81
+ underline-offset-[calc(3/16*1rem)]
82
+ `, e.popover = `
83
+ min-w-fit
84
+ w-auto
85
+ py-2
86
+ bg-white
87
+ shadow-1
88
+ rounded-lg
89
+ border
90
+ border-solid-grey-420
91
+ has-[>:nth-child(7)]:rounded-r-none
92
+ `, e.popoverPositionBottomRight = `
93
+ absolute
94
+ top-11
95
+ right-0
96
+ `, e.popoverPositionBottomLeft = `
97
+ absolute
98
+ top-11
99
+ left-0
100
+ `, ((c) => {
101
+ c.focus = `
102
+ peer-focus-visible:outline
103
+ peer-focus-visible:outline-4
104
+ peer-focus-visible:outline-black
105
+ peer-focus-visible:ring-yellow-300
106
+ `, c.focusRect = `
107
+ ${c.focus}
108
+ peer-focus-visible:outline-offset-[calc(2/16*1rem)]
109
+ peer-focus-visible:ring-[calc(2/16*1rem)]
110
+ `;
111
+ })(e.Peer || (e.Peer = {}));
112
+ })(l || (l = {}));
113
+ export {
114
+ l as Style,
115
+ v as cx,
116
+ a as focusableSelector,
117
+ b as mod,
118
+ h as treefy
119
+ };
@@ -0,0 +1,2 @@
1
+ export declare const mod: (n: number, m: number) => number;
2
+ //# sourceMappingURL=calc.d.ts.map
@@ -0,0 +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,2 +1,2 @@
1
1
  export declare const cx: (...classNames: any[]) => string;
2
- //# sourceMappingURL=class.d.ts.map
2
+ //# sourceMappingURL=cx.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cx.d.ts","sourceRoot":"","sources":["../../src/cx.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,EAAE,kBAAmB,GAAG,EAAE,WAAyC,CAAA"}
@@ -0,0 +1,6 @@
1
+ export { focusableSelector } from './querySelector';
2
+ export { mod } from './calc';
3
+ export { cx } from './cx';
4
+ export { treefy } from './treefy';
5
+ export { Style } from './styles';
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAA;AACnD,OAAO,EAAE,GAAG,EAAE,MAAM,QAAQ,CAAA;AAC5B,OAAO,EAAE,EAAE,EAAE,MAAM,MAAM,CAAA;AACzB,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AACjC,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAA"}
@@ -0,0 +1,2 @@
1
+ export declare const focusableSelector: string;
2
+ //# sourceMappingURL=querySelector.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"querySelector.d.ts","sourceRoot":"","sources":["../../src/querySelector.ts"],"names":[],"mappings":"AAmBA,eAAO,MAAM,iBAAiB,QAAsB,CAAA"}
@@ -0,0 +1,22 @@
1
+ export declare namespace Style {
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
+ 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 ";
11
+ const hoverUnderline = "\n hover:underline\n hover:underline-offset-[calc(3/16*1rem)]\n ";
12
+ const underline = "\n underline\n underline-offset-[calc(3/16*1rem)]\n hover:decoration-[calc(3/16*1rem)]\n ";
13
+ const underlineNoDeco = "\n underline\n underline-offset-[calc(3/16*1rem)]\n ";
14
+ const popover = "\n min-w-fit\n w-auto\n py-2\n bg-white\n shadow-1\n rounded-lg\n border\n border-solid-grey-420\n has-[>:nth-child(7)]:rounded-r-none\n ";
15
+ const popoverPositionBottomRight = "\n absolute\n top-11\n right-0\n ";
16
+ const popoverPositionBottomLeft = "\n absolute\n top-11\n left-0\n ";
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 ";
20
+ }
21
+ }
22
+ //# sourceMappingURL=styles.d.ts.map
@@ -0,0 +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"}
@@ -0,0 +1,8 @@
1
+ type TreeNode<I> = Omit<I, 'children'> & {
2
+ children?: TreeNode<I>[];
3
+ };
4
+ export declare const treefy: <I extends {
5
+ depth: number;
6
+ }>(input: I[]) => TreeNode<I>[];
7
+ export {};
8
+ //# sourceMappingURL=treefy.d.ts.map
@@ -0,0 +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"}
@@ -0,0 +1,40 @@
1
+ {
2
+ "name": "@sakura-ui/helper",
3
+ "version": "0.0.5",
4
+ "license": "MIT",
5
+ "main": "dist/index.cjs.js",
6
+ "types": "dist/types/index.d.ts",
7
+ "exports": {
8
+ ".": {
9
+ "types": "./dist/types/index.d.ts",
10
+ "require": "./dist/index.cjs.js",
11
+ "import": "./dist/index.es.js"
12
+ }
13
+ },
14
+ "sideEffects": false,
15
+ "files": [
16
+ "dist"
17
+ ],
18
+ "publishConfig": {
19
+ "access": "public"
20
+ },
21
+ "scripts": {
22
+ "lint": "run-s lint:*",
23
+ "lint:lint": "biome lint ./",
24
+ "lint:prettier": "prettier --write --ignore-path .gitignore './src/*.ts'",
25
+ "prebuild": "rimraf dist",
26
+ "build": "run-p build:*",
27
+ "build:scripts": "vite build",
28
+ "build:types": "tsc && tsc-alias",
29
+ "test": "vitest"
30
+ },
31
+ "devDependencies": {
32
+ "@testing-library/jest-dom": "catalog:",
33
+ "@testing-library/react": "catalog:",
34
+ "@types/react": "catalog:",
35
+ "@types/react-dom": "catalog:",
36
+ "happy-dom": "catalog:",
37
+ "react": "catalog:",
38
+ "react-dom": "catalog:"
39
+ }
40
+ }
@@ -0,0 +1 @@
1
+ export const mod = (n: number, m: number): number => ((n % m) + m) % m
@@ -0,0 +1,5 @@
1
+ export { focusableSelector } from './querySelector'
2
+ export { mod } from './calc'
3
+ export { cx } from './cx'
4
+ export { treefy } from './treefy'
5
+ export { Style } from './styles'
@@ -0,0 +1,20 @@
1
+ const notNegTabIndex = ':not([tabindex^="-"])'
2
+ const notDisabled = ':not(:disabled)'
3
+
4
+ const selectors = [
5
+ `a[href]${notNegTabIndex}`,
6
+ `area[href]${notNegTabIndex}`,
7
+ `input:not([type="hidden"])${notNegTabIndex}${notDisabled}`,
8
+ `select${notNegTabIndex}${notDisabled}`,
9
+ `textarea${notNegTabIndex}${notDisabled}`,
10
+ `button${notNegTabIndex}${notDisabled}`,
11
+ `details > summary:first-of-type${notNegTabIndex}`,
12
+ `details:not(:has(> summary))${notNegTabIndex}`,
13
+ `iframe${notNegTabIndex}`,
14
+ `audio[controls]${notNegTabIndex}`,
15
+ `video[controls]${notNegTabIndex}`,
16
+ `[contenteditable]${notNegTabIndex}`,
17
+ `[tabindex]${notNegTabIndex}`
18
+ ]
19
+
20
+ export const focusableSelector = selectors.join(',')
@@ -0,0 +1,116 @@
1
+ export namespace Style {
2
+ export const clickable = `
3
+ px-2
4
+ min-h-[calc(44/16*1rem)]
5
+ border
6
+ border-transparent
7
+ rounded-lg
8
+ hover:bg-solid-grey-50
9
+ `
10
+
11
+ export const selected = `
12
+ rounded-full
13
+ bg-yellow-50
14
+ `
15
+
16
+ const focus = `
17
+ focus-visible:outline
18
+ focus-visible:outline-4
19
+ focus-visible:outline-black
20
+ focus-visible:ring-yellow-300
21
+ `
22
+
23
+ export const focusRectCondensed = `
24
+ ${focus}
25
+ focus-visible:-outline-offset-4
26
+ focus-visible:ring-[calc(6/16*1rem)]
27
+ focus-visible:ring-inset
28
+ `
29
+
30
+ export const focusRectCondensedWithBg = `
31
+ ${focusRectCondensed}
32
+ focus-visible:bg-yellow-300
33
+ `
34
+
35
+ export const focusRect = `
36
+ ${focus}
37
+ focus-visible:outline-offset-[calc(2/16*1rem)]
38
+ focus-visible:ring-[calc(2/16*1rem)]
39
+ `
40
+
41
+ export const focusRounded = `
42
+ ${focusRect}
43
+ focus-visible:rounded
44
+ `
45
+
46
+ export const focusCard = `
47
+ ${focusRect}
48
+ focus-visible:rounded-2xl
49
+ sm:focus-visible:rounded-3xl
50
+ `
51
+
52
+ export const focusRectWithBg = `
53
+ ${focusRect}
54
+ focus-visible:bg-yellow-300
55
+ `
56
+
57
+ export const focusRoundedWithBg = `
58
+ ${focusRectWithBg}
59
+ focus-visible:rounded
60
+ `
61
+
62
+ export const hoverUnderline = `
63
+ hover:underline
64
+ hover:underline-offset-[calc(3/16*1rem)]
65
+ `
66
+
67
+ export const underline = `
68
+ underline
69
+ underline-offset-[calc(3/16*1rem)]
70
+ hover:decoration-[calc(3/16*1rem)]
71
+ `
72
+
73
+ export const underlineNoDeco = `
74
+ underline
75
+ underline-offset-[calc(3/16*1rem)]
76
+ `
77
+
78
+ export const popover = `
79
+ min-w-fit
80
+ w-auto
81
+ py-2
82
+ bg-white
83
+ shadow-1
84
+ rounded-lg
85
+ border
86
+ border-solid-grey-420
87
+ has-[>:nth-child(7)]:rounded-r-none
88
+ `
89
+
90
+ export const popoverPositionBottomRight = `
91
+ absolute
92
+ top-11
93
+ right-0
94
+ `
95
+
96
+ export const popoverPositionBottomLeft = `
97
+ absolute
98
+ top-11
99
+ left-0
100
+ `
101
+
102
+ export namespace Peer {
103
+ export const focus = `
104
+ peer-focus-visible:outline
105
+ peer-focus-visible:outline-4
106
+ peer-focus-visible:outline-black
107
+ peer-focus-visible:ring-yellow-300
108
+ `
109
+
110
+ export const focusRect = `
111
+ ${focus}
112
+ peer-focus-visible:outline-offset-[calc(2/16*1rem)]
113
+ peer-focus-visible:ring-[calc(2/16*1rem)]
114
+ `
115
+ }
116
+ }
@@ -0,0 +1,22 @@
1
+ type TreeNode<I> = Omit<I, 'children'> & { children?: TreeNode<I>[] }
2
+ type Input<I> = (I & { children: unknown })[]
3
+
4
+ export const treefy = <I extends { depth: number }>(input: I[]) => {
5
+ const tree: TreeNode<I>[] = []
6
+ const last: TreeNode<I>[] = []
7
+ let top = -1
8
+ let bottom = -1
9
+ for (const { children: _, ...item } of input as Input<I>) {
10
+ if (top < item.depth && item.depth <= bottom + 1) {
11
+ const idx = item.depth - top
12
+ bottom = item.depth
13
+ ;(last[idx - 1].children ?? []).push(item)
14
+ last[idx] = item
15
+ continue
16
+ }
17
+ tree.push(item)
18
+ last[0] = item
19
+ top = bottom = item.depth
20
+ }
21
+ return tree
22
+ }
@@ -0,0 +1,13 @@
1
+ {
2
+ "extends": "../../tsconfig.json",
3
+ "compilerOptions": {
4
+ "declarationDir": "./dist/types",
5
+ "outDir": "./dist",
6
+ "baseUrl": ".",
7
+ "paths": {
8
+ "@/*": ["src/*"]
9
+ }
10
+ },
11
+ "include": ["src"],
12
+ "references": [{ "path": "./tsconfig.node.json" }]
13
+ }
@@ -0,0 +1,6 @@
1
+ {
2
+ "compilerOptions": {
3
+ "composite": true
4
+ },
5
+ "include": ["vite.config.ts"]
6
+ }
@@ -0,0 +1,26 @@
1
+ /// <reference types="vitest" />
2
+ import { resolve } from 'node:path'
3
+ import { defineConfig } from 'vite'
4
+ import react from '@vitejs/plugin-react-swc'
5
+
6
+ // https://vitejs.dev/config/
7
+ export default defineConfig({
8
+ plugins: [react()],
9
+ resolve: {
10
+ alias: {
11
+ '@': resolve(__dirname, 'src')
12
+ }
13
+ },
14
+ build: {
15
+ lib: {
16
+ entry: resolve(__dirname, 'src', 'index.ts'),
17
+ formats: ['es', 'cjs'],
18
+ fileName: (ext: string) => `index.${ext}.js`
19
+ }
20
+ },
21
+ test: {
22
+ globals: true,
23
+ environment: 'happy-dom',
24
+ setupFiles: 'tests/vitest.setup.ts'
25
+ }
26
+ })
@@ -0,0 +1,22 @@
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