@lt-three/love3 0.0.0 → 0.1.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 (377) hide show
  1. package/README.md +85 -1
  2. package/dist/native/analytics/animation.d.ts +4 -0
  3. package/dist/native/analytics/animation.js +6 -0
  4. package/dist/native/analytics/chart.types.d.ts +25 -0
  5. package/dist/native/analytics/chart.types.js +0 -0
  6. package/dist/native/analytics/line-chart.d.ts +4 -0
  7. package/dist/native/analytics/line-chart.ios.d.ts +4 -0
  8. package/dist/native/analytics/line-chart.ios.js +24 -0
  9. package/dist/native/analytics/line-chart.js +33 -0
  10. package/dist/native/analytics/metric-card.d.ts +10 -0
  11. package/dist/native/analytics/metric-card.js +29 -0
  12. package/dist/native/analytics/multi-line-chart.d.ts +17 -0
  13. package/dist/native/analytics/multi-line-chart.js +215 -0
  14. package/dist/native/analytics/pie-chart.d.ts +15 -0
  15. package/dist/native/analytics/pie-chart.ios.d.ts +4 -0
  16. package/dist/native/analytics/pie-chart.ios.js +24 -0
  17. package/dist/native/analytics/pie-chart.js +92 -0
  18. package/dist/native/analytics/single-number.d.ts +19 -0
  19. package/dist/native/analytics/single-number.js +101 -0
  20. package/dist/native/atom/avatar.d.ts +21 -0
  21. package/dist/native/atom/avatar.js +46 -0
  22. package/dist/native/atom/badge.d.ts +28 -0
  23. package/dist/native/atom/badge.js +51 -0
  24. package/dist/native/atom/button.d.ts +46 -0
  25. package/dist/native/atom/button.js +109 -0
  26. package/dist/native/atom/checkbox.d.ts +21 -0
  27. package/dist/native/atom/checkbox.js +47 -0
  28. package/dist/native/atom/colored-value.d.ts +12 -0
  29. package/dist/native/atom/colored-value.js +24 -0
  30. package/dist/native/atom/image.d.ts +21 -0
  31. package/dist/native/atom/image.js +72 -0
  32. package/dist/native/atom/label.d.ts +18 -0
  33. package/dist/native/atom/label.js +33 -0
  34. package/dist/native/atom/link.d.ts +18 -0
  35. package/dist/native/atom/link.js +25 -0
  36. package/dist/native/atom/readout.d.ts +22 -0
  37. package/dist/native/atom/readout.js +39 -0
  38. package/dist/native/atom/search-input.d.ts +12 -0
  39. package/dist/native/atom/search-input.js +36 -0
  40. package/dist/native/atom/select.d.ts +54 -0
  41. package/dist/native/atom/select.js +200 -0
  42. package/dist/native/atom/separator.d.ts +13 -0
  43. package/dist/native/atom/separator.js +17 -0
  44. package/dist/native/atom/skeleton.d.ts +12 -0
  45. package/dist/native/atom/skeleton.js +39 -0
  46. package/dist/native/atom/slider.d.ts +32 -0
  47. package/dist/native/atom/slider.js +75 -0
  48. package/dist/native/atom/spinner.d.ts +15 -0
  49. package/dist/native/atom/spinner.js +25 -0
  50. package/dist/native/atom/switch.d.ts +18 -0
  51. package/dist/native/atom/switch.js +52 -0
  52. package/dist/native/atom/symbol.d.ts +16 -0
  53. package/dist/native/atom/symbol.js +38 -0
  54. package/dist/native/atom/symbol.types.d.ts +25 -0
  55. package/dist/native/atom/symbol.types.js +49 -0
  56. package/dist/native/atom/text-field.d.ts +49 -0
  57. package/dist/native/atom/text-field.js +56 -0
  58. package/dist/native/atom/text.d.ts +2 -0
  59. package/dist/native/atom/text.js +3 -0
  60. package/dist/native/atom/theme-toggle.d.ts +21 -0
  61. package/dist/native/atom/theme-toggle.js +36 -0
  62. package/dist/native/atom/timezone-select.d.ts +16 -0
  63. package/dist/native/atom/timezone-select.js +28 -0
  64. package/dist/native/atom/typography.d.ts +13 -0
  65. package/dist/native/atom/typography.js +28 -0
  66. package/dist/native/base/button.d.ts +61 -0
  67. package/dist/native/base/button.js +92 -0
  68. package/dist/native/base/form.d.ts +72 -0
  69. package/dist/native/base/form.js +113 -0
  70. package/dist/native/base/glass-card.d.ts +15 -0
  71. package/dist/native/base/glass-card.js +38 -0
  72. package/dist/native/base/input.d.ts +29 -0
  73. package/dist/native/base/input.js +27 -0
  74. package/dist/native/base/sheet.d.ts +71 -0
  75. package/dist/native/base/sheet.js +187 -0
  76. package/dist/native/base/text.d.ts +14 -0
  77. package/dist/native/base/text.js +53 -0
  78. package/dist/native/form/checkbox.d.ts +13 -0
  79. package/dist/native/form/checkbox.js +55 -0
  80. package/dist/native/form/date-picker.d.ts +23 -0
  81. package/dist/native/form/date-picker.js +119 -0
  82. package/dist/native/form/form.d.ts +23 -0
  83. package/dist/native/form/form.js +45 -0
  84. package/dist/native/form/radio-group.d.ts +23 -0
  85. package/dist/native/form/radio-group.js +88 -0
  86. package/dist/native/form/select.d.ts +13 -0
  87. package/dist/native/form/select.js +45 -0
  88. package/dist/native/form/slider.d.ts +14 -0
  89. package/dist/native/form/slider.js +42 -0
  90. package/dist/native/form/switch.d.ts +9 -0
  91. package/dist/native/form/switch.js +59 -0
  92. package/dist/native/form/text-area.d.ts +11 -0
  93. package/dist/native/form/text-area.js +50 -0
  94. package/dist/native/form/text-input.d.ts +18 -0
  95. package/dist/native/form/text-input.js +90 -0
  96. package/dist/native/index.d.ts +1 -0
  97. package/dist/native/index.js +0 -0
  98. package/dist/native/layout/accordion.d.ts +25 -0
  99. package/dist/native/layout/accordion.js +54 -0
  100. package/dist/native/layout/card.d.ts +47 -0
  101. package/dist/native/layout/card.js +57 -0
  102. package/dist/native/layout/description.d.ts +16 -0
  103. package/dist/native/layout/description.js +32 -0
  104. package/dist/native/layout/error.d.ts +21 -0
  105. package/dist/native/layout/error.js +44 -0
  106. package/dist/native/layout/information.d.ts +25 -0
  107. package/dist/native/layout/information.js +35 -0
  108. package/dist/native/layout/locked.d.ts +38 -0
  109. package/dist/native/layout/locked.js +94 -0
  110. package/dist/native/layout/modal.d.ts +25 -0
  111. package/dist/native/layout/modal.js +93 -0
  112. package/dist/native/layout/not-found.d.ts +17 -0
  113. package/dist/native/layout/not-found.js +30 -0
  114. package/dist/native/layout/page-frame.d.ts +23 -0
  115. package/dist/native/layout/page-frame.js +46 -0
  116. package/dist/native/layout/panel.d.ts +18 -0
  117. package/dist/native/layout/panel.js +23 -0
  118. package/dist/native/layout/reorderable-list.d.ts +42 -0
  119. package/dist/native/layout/reorderable-list.js +52 -0
  120. package/dist/native/layout/sheet.d.ts +30 -0
  121. package/dist/native/layout/sheet.js +46 -0
  122. package/dist/native/layout/simple-dialog.d.ts +16 -0
  123. package/dist/native/layout/simple-dialog.js +20 -0
  124. package/dist/native/layout/simple-table.d.ts +50 -0
  125. package/dist/native/layout/simple-table.js +75 -0
  126. package/dist/native/layout/tab-bar.d.ts +33 -0
  127. package/dist/native/layout/tab-bar.js +48 -0
  128. package/dist/native/layout/tabs.d.ts +28 -0
  129. package/dist/native/layout/tabs.js +54 -0
  130. package/dist/native/layout/tuning-panel.d.ts +24 -0
  131. package/dist/native/layout/tuning-panel.js +246 -0
  132. package/dist/native/lib/autocomplete.d.ts +7 -0
  133. package/dist/native/lib/autocomplete.js +34 -0
  134. package/dist/native/lib/breakpoints.d.ts +14 -0
  135. package/dist/native/lib/breakpoints.js +17 -0
  136. package/dist/native/lib/chart-palette.d.ts +8 -0
  137. package/dist/native/lib/chart-palette.js +20 -0
  138. package/dist/native/lib/confirm.d.ts +49 -0
  139. package/dist/native/lib/confirm.js +70 -0
  140. package/dist/native/lib/control.d.ts +24 -0
  141. package/dist/native/lib/control.js +0 -0
  142. package/dist/native/lib/external-store.d.ts +17 -0
  143. package/dist/native/lib/external-store.js +30 -0
  144. package/dist/native/lib/keyboard.d.ts +15 -0
  145. package/dist/native/lib/keyboard.js +24 -0
  146. package/dist/native/lib/labels.d.ts +15 -0
  147. package/dist/native/lib/labels.js +17 -0
  148. package/dist/native/lib/loading.d.ts +10 -0
  149. package/dist/native/lib/loading.js +15 -0
  150. package/dist/native/lib/network.d.ts +12 -0
  151. package/dist/native/lib/network.js +21 -0
  152. package/dist/native/lib/scheme.d.ts +18 -0
  153. package/dist/native/lib/scheme.js +22 -0
  154. package/dist/native/lib/snackbar.d.ts +46 -0
  155. package/dist/native/lib/snackbar.js +60 -0
  156. package/dist/native/lib/theme.d.ts +34 -0
  157. package/dist/native/lib/theme.js +53 -0
  158. package/dist/native/lib/timezone.d.ts +26 -0
  159. package/dist/native/lib/timezone.js +95 -0
  160. package/dist/native/lib/token-color.d.ts +5 -0
  161. package/dist/native/lib/token-color.js +13 -0
  162. package/dist/native/lib/token-color.web.d.ts +4 -0
  163. package/dist/native/lib/token-color.web.js +7 -0
  164. package/dist/native/lib/tuning-context.d.ts +9 -0
  165. package/dist/native/lib/tuning-context.js +7 -0
  166. package/dist/native/lib/tuning.d.ts +24 -0
  167. package/dist/native/lib/tuning.js +42 -0
  168. package/dist/native/lib/typography.d.ts +10 -0
  169. package/dist/native/lib/typography.js +11 -0
  170. package/dist/native/lib/utils.d.ts +11 -0
  171. package/dist/native/lib/utils.js +21 -0
  172. package/dist/native/once/confirm.d.ts +7 -0
  173. package/dist/native/once/confirm.js +60 -0
  174. package/dist/native/once/error-boundary.d.ts +28 -0
  175. package/dist/native/once/error-boundary.js +55 -0
  176. package/dist/native/once/loading-lock.d.ts +8 -0
  177. package/dist/native/once/loading-lock.js +28 -0
  178. package/dist/native/once/offline-banner.d.ts +15 -0
  179. package/dist/native/once/offline-banner.js +35 -0
  180. package/dist/native/once/snackbar.d.ts +17 -0
  181. package/dist/native/once/snackbar.js +106 -0
  182. package/dist/native/styles.css +46 -0
  183. package/dist/shared/analytics.d.ts +71 -0
  184. package/dist/shared/analytics.js +0 -0
  185. package/dist/shared/button.d.ts +7 -0
  186. package/dist/shared/button.js +23 -0
  187. package/dist/shared/form.d.ts +45 -0
  188. package/dist/shared/form.js +46 -0
  189. package/dist/shared/index.d.ts +3 -0
  190. package/dist/shared/index.js +3 -0
  191. package/dist/tokens/contrast-pairs.d.ts +30 -0
  192. package/dist/tokens/contrast-pairs.js +404 -0
  193. package/dist/tokens/index.d.ts +6 -0
  194. package/dist/tokens/index.js +10 -0
  195. package/dist/tokens/styles.gen.css +250 -0
  196. package/dist/tokens/tokens.gen.d.ts +141 -0
  197. package/dist/tokens/tokens.gen.js +206 -0
  198. package/dist/tuning/catalog.d.ts +27 -0
  199. package/dist/tuning/catalog.gen.d.ts +4 -0
  200. package/dist/tuning/catalog.gen.js +397 -0
  201. package/dist/tuning/catalog.js +128 -0
  202. package/dist/tuning/color.d.ts +20 -0
  203. package/dist/tuning/color.js +80 -0
  204. package/dist/tuning/css.d.ts +35 -0
  205. package/dist/tuning/css.js +147 -0
  206. package/dist/tuning/index.d.ts +8 -0
  207. package/dist/tuning/index.js +9 -0
  208. package/dist/tuning/model.d.ts +33 -0
  209. package/dist/tuning/model.js +154 -0
  210. package/dist/tuning/native.d.ts +35 -0
  211. package/dist/tuning/native.js +80 -0
  212. package/dist/tuning/schema.d.ts +69 -0
  213. package/dist/tuning/schema.js +247 -0
  214. package/dist/tuning/types.d.ts +75 -0
  215. package/dist/tuning/types.js +39 -0
  216. package/dist/web/analytics/line-chart.d.ts +20 -0
  217. package/dist/web/analytics/line-chart.js +28 -0
  218. package/dist/web/analytics/metric-card.d.ts +18 -0
  219. package/dist/web/analytics/metric-card.js +40 -0
  220. package/dist/web/analytics/multi-line-chart.d.ts +39 -0
  221. package/dist/web/analytics/multi-line-chart.js +345 -0
  222. package/dist/web/atom/avatar.d.ts +11 -0
  223. package/dist/web/atom/avatar.js +24 -0
  224. package/dist/web/atom/badge.d.ts +2 -0
  225. package/dist/web/atom/badge.js +3 -0
  226. package/dist/web/atom/button.d.ts +23 -0
  227. package/dist/web/atom/button.js +35 -0
  228. package/dist/web/atom/checkbox.d.ts +19 -0
  229. package/dist/web/atom/checkbox.js +33 -0
  230. package/dist/web/atom/colored-value.d.ts +13 -0
  231. package/dist/web/atom/colored-value.js +24 -0
  232. package/dist/web/atom/help.d.ts +10 -0
  233. package/dist/web/atom/help.js +18 -0
  234. package/dist/web/atom/label.d.ts +2 -0
  235. package/dist/web/atom/label.js +3 -0
  236. package/dist/web/atom/segmented-control.d.ts +40 -0
  237. package/dist/web/atom/segmented-control.js +43 -0
  238. package/dist/web/atom/select.d.ts +43 -0
  239. package/dist/web/atom/select.js +93 -0
  240. package/dist/web/atom/separator.d.ts +2 -0
  241. package/dist/web/atom/separator.js +3 -0
  242. package/dist/web/atom/skeleton.d.ts +2 -0
  243. package/dist/web/atom/skeleton.js +3 -0
  244. package/dist/web/atom/slider.d.ts +33 -0
  245. package/dist/web/atom/slider.js +70 -0
  246. package/dist/web/atom/spinner.d.ts +8 -0
  247. package/dist/web/atom/spinner.js +14 -0
  248. package/dist/web/atom/switch.d.ts +11 -0
  249. package/dist/web/atom/switch.js +10 -0
  250. package/dist/web/atom/text-area.d.ts +22 -0
  251. package/dist/web/atom/text-area.js +26 -0
  252. package/dist/web/atom/text-field.d.ts +17 -0
  253. package/dist/web/atom/text-field.js +21 -0
  254. package/dist/web/atom/toggle-chip.d.ts +22 -0
  255. package/dist/web/atom/toggle-chip.js +28 -0
  256. package/dist/web/atom/tooltip.d.ts +23 -0
  257. package/dist/web/atom/tooltip.js +26 -0
  258. package/dist/web/atom/typography.d.ts +6 -0
  259. package/dist/web/atom/typography.js +23 -0
  260. package/dist/web/base/accordion.d.ts +9 -0
  261. package/dist/web/base/accordion.js +44 -0
  262. package/dist/web/base/alert.d.ts +11 -0
  263. package/dist/web/base/alert.js +37 -0
  264. package/dist/web/base/avatar.d.ts +8 -0
  265. package/dist/web/base/avatar.js +29 -0
  266. package/dist/web/base/badge.d.ts +12 -0
  267. package/dist/web/base/badge.js +26 -0
  268. package/dist/web/base/breadcrumb.d.ts +16 -0
  269. package/dist/web/base/breadcrumb.js +72 -0
  270. package/dist/web/base/button.d.ts +12 -0
  271. package/dist/web/base/button.js +47 -0
  272. package/dist/web/base/card.d.ts +19 -0
  273. package/dist/web/base/card.js +74 -0
  274. package/dist/web/base/checkbox.d.ts +6 -0
  275. package/dist/web/base/checkbox.js +21 -0
  276. package/dist/web/base/dialog.d.ts +20 -0
  277. package/dist/web/base/dialog.js +92 -0
  278. package/dist/web/base/dropdown-menu.d.ts +29 -0
  279. package/dist/web/base/dropdown-menu.js +125 -0
  280. package/dist/web/base/field.d.ts +27 -0
  281. package/dist/web/base/field.js +118 -0
  282. package/dist/web/base/form.d.ts +38 -0
  283. package/dist/web/base/form.js +110 -0
  284. package/dist/web/base/input.d.ts +9 -0
  285. package/dist/web/base/input.js +23 -0
  286. package/dist/web/base/label.d.ts +6 -0
  287. package/dist/web/base/label.js +15 -0
  288. package/dist/web/base/pagination.d.ts +34 -0
  289. package/dist/web/base/pagination.js +90 -0
  290. package/dist/web/base/popover.d.ts +11 -0
  291. package/dist/web/base/popover.js +37 -0
  292. package/dist/web/base/radio-group.d.ts +7 -0
  293. package/dist/web/base/radio-group.js +27 -0
  294. package/dist/web/base/scroll-area.d.ts +10 -0
  295. package/dist/web/base/scroll-area.js +41 -0
  296. package/dist/web/base/select.d.ts +17 -0
  297. package/dist/web/base/select.js +96 -0
  298. package/dist/web/base/separator.d.ts +6 -0
  299. package/dist/web/base/separator.js +17 -0
  300. package/dist/web/base/sheet.d.ts +19 -0
  301. package/dist/web/base/sheet.js +88 -0
  302. package/dist/web/base/skeleton.d.ts +5 -0
  303. package/dist/web/base/skeleton.js +14 -0
  304. package/dist/web/base/slider.d.ts +9 -0
  305. package/dist/web/base/slider.js +39 -0
  306. package/dist/web/base/sonner.d.ts +9 -0
  307. package/dist/web/base/sonner.js +25 -0
  308. package/dist/web/base/spinner.d.ts +5 -0
  309. package/dist/web/base/spinner.js +17 -0
  310. package/dist/web/base/switch.d.ts +6 -0
  311. package/dist/web/base/switch.js +19 -0
  312. package/dist/web/base/table.d.ts +14 -0
  313. package/dist/web/base/table.js +68 -0
  314. package/dist/web/base/tabs.d.ts +9 -0
  315. package/dist/web/base/tabs.js +36 -0
  316. package/dist/web/base/textarea.d.ts +9 -0
  317. package/dist/web/base/textarea.js +23 -0
  318. package/dist/web/base/tooltip.d.ts +9 -0
  319. package/dist/web/base/tooltip.js +36 -0
  320. package/dist/web/form/checkbox.d.ts +35 -0
  321. package/dist/web/form/checkbox.js +91 -0
  322. package/dist/web/form/radio-group.d.ts +24 -0
  323. package/dist/web/form/radio-group.js +75 -0
  324. package/dist/web/form/select.d.ts +16 -0
  325. package/dist/web/form/select.js +44 -0
  326. package/dist/web/form/slider.d.ts +19 -0
  327. package/dist/web/form/slider.js +51 -0
  328. package/dist/web/form/switch.d.ts +11 -0
  329. package/dist/web/form/switch.js +50 -0
  330. package/dist/web/form/text-area.d.ts +10 -0
  331. package/dist/web/form/text-area.js +31 -0
  332. package/dist/web/form/text-input.d.ts +10 -0
  333. package/dist/web/form/text-input.js +42 -0
  334. package/dist/web/index.d.ts +1 -0
  335. package/dist/web/index.js +0 -0
  336. package/dist/web/layout/accordion.d.ts +26 -0
  337. package/dist/web/layout/accordion.js +29 -0
  338. package/dist/web/layout/alert-modal.d.ts +41 -0
  339. package/dist/web/layout/alert-modal.js +71 -0
  340. package/dist/web/layout/card.d.ts +17 -0
  341. package/dist/web/layout/card.js +35 -0
  342. package/dist/web/layout/description.d.ts +12 -0
  343. package/dist/web/layout/description.js +20 -0
  344. package/dist/web/layout/information.d.ts +36 -0
  345. package/dist/web/layout/information.js +53 -0
  346. package/dist/web/layout/modal.d.ts +16 -0
  347. package/dist/web/layout/modal.js +37 -0
  348. package/dist/web/layout/page-frame.d.ts +37 -0
  349. package/dist/web/layout/page-frame.js +79 -0
  350. package/dist/web/layout/scroll-area.d.ts +10 -0
  351. package/dist/web/layout/scroll-area.js +13 -0
  352. package/dist/web/layout/sheet.d.ts +32 -0
  353. package/dist/web/layout/sheet.js +68 -0
  354. package/dist/web/layout/simple-dialog.d.ts +11 -0
  355. package/dist/web/layout/simple-dialog.js +24 -0
  356. package/dist/web/layout/simple-table.d.ts +49 -0
  357. package/dist/web/layout/simple-table.js +58 -0
  358. package/dist/web/layout/tabs.d.ts +26 -0
  359. package/dist/web/layout/tabs.js +42 -0
  360. package/dist/web/layout/titled-modal.d.ts +33 -0
  361. package/dist/web/layout/titled-modal.js +59 -0
  362. package/dist/web/lib/css-vars.d.ts +14 -0
  363. package/dist/web/lib/css-vars.js +18 -0
  364. package/dist/web/lib/dialog.d.ts +13 -0
  365. package/dist/web/lib/dialog.js +0 -0
  366. package/dist/web/lib/form.d.ts +2 -0
  367. package/dist/web/lib/form.js +3 -0
  368. package/dist/web/lib/labels.d.ts +27 -0
  369. package/dist/web/lib/labels.js +29 -0
  370. package/dist/web/lib/modal-open-focus.d.ts +17 -0
  371. package/dist/web/lib/modal-open-focus.js +44 -0
  372. package/dist/web/lib/restore-focus.d.ts +12 -0
  373. package/dist/web/lib/restore-focus.js +32 -0
  374. package/dist/web/lib/utils.d.ts +4 -0
  375. package/dist/web/lib/utils.js +10 -0
  376. package/dist/web/styles.css +162 -0
  377. package/package.json +203 -4
@@ -0,0 +1,42 @@
1
+ import { catalog } from "../../tuning/catalog.gen.js";
2
+ import { effectiveTokens, normalize } from "../../tuning/model.js";
3
+ import { toNativeVariables } from "../../tuning/native.js";
4
+ import { useActiveScheme } from "./theme.js";
5
+ import { TuningTokensContext } from "./tuning-context.js";
6
+ import { useMemo } from "react";
7
+ import { jsx } from "react/jsx-runtime";
8
+ import { VariableContextProvider } from "react-native-css";
9
+
10
+ //#region src/native/lib/tuning.tsx
11
+ /**
12
+ * 調整(トークンの実行時の上書き)を、子孫の部品に反映するルート。**`ThemeRoot` の内側**に置く(有効テーマと、ダークの変数を受け取るため)。
13
+ *
14
+ * - `react-native-css` の `VariableContextProvider` で、変えた色・角丸・書体を CSS 変数として配る。実機で効くのは、
15
+ * ライト・ダークで値が違う色のトークンを使うクラス(`bg-card` など)と書体。`bg-action` などビルド時にリテラルへ
16
+ * 畳み込まれるクラス・角丸・本文サイズ・セマンティックの参照先は、**実機では効かない**(`nativeLimits` が説明を返す。
17
+ * react-native-web では CSS 変数なので全部効く)
18
+ * - TS から色を引く部品(`useTokenColor`)は、実効値(参照を解決した値)を `TuningTokensContext` から引くので、**全部追従する**
19
+ * - 調整が無い(既定と同じ)なら、何も変えない(`tuning` を空にすれば元の見た目)
20
+ *
21
+ * 実機(Expo)での確認は未実施。react-native-web の browser test で確かめた範囲を README に書いてある。
22
+ */
23
+ function TuningRoot({ tuning, catalog: catalog$1 = catalog, children }) {
24
+ const scheme = useActiveScheme();
25
+ const normalized = useMemo(() => normalize(tuning, catalog$1), [tuning, catalog$1]);
26
+ const variables = useMemo(() => toNativeVariables(normalized, catalog$1, scheme), [
27
+ normalized,
28
+ catalog$1,
29
+ scheme
30
+ ]);
31
+ const tokens = useMemo(() => effectiveTokens(normalized, catalog$1), [normalized, catalog$1]);
32
+ return /* @__PURE__ */ jsx(TuningTokensContext.Provider, {
33
+ value: tokens,
34
+ children: /* @__PURE__ */ jsx(VariableContextProvider, {
35
+ value: variables,
36
+ children
37
+ })
38
+ });
39
+ }
40
+
41
+ //#endregion
42
+ export { TuningRoot };
@@ -0,0 +1,10 @@
1
+ import { TextStyle } from "react-native";
2
+ //#region src/native/lib/typography.d.ts
3
+ /**
4
+ * 数字を等幅(タブラー)で揃えるスタイル。
5
+ *
6
+ * Tailwind の `tabular-nums`(`font-variant-numeric`)は react-native-css が
7
+ * 未対応のため className では表現できない。数値表示にはこれを `style` で渡す。
8
+ */
9
+ export declare const tabularNums: TextStyle;
10
+ //#endregion
@@ -0,0 +1,11 @@
1
+ //#region src/native/lib/typography.ts
2
+ /**
3
+ * 数字を等幅(タブラー)で揃えるスタイル。
4
+ *
5
+ * Tailwind の `tabular-nums`(`font-variant-numeric`)は react-native-css が
6
+ * 未対応のため className では表現できない。数値表示にはこれを `style` で渡す。
7
+ */
8
+ const tabularNums = { fontVariant: ["tabular-nums"] };
9
+
10
+ //#endregion
11
+ export { tabularNums };
@@ -0,0 +1,11 @@
1
+ import { ReactNode } from "react";
2
+ import { ClassValue } from "clsx";
3
+ //#region src/native/lib/utils.d.ts
4
+ export declare function cn(...inputs: ClassValue[]): string;
5
+ /**
6
+ * 何も描かない `ReactNode`(`null`・`undefined`・真偽値・空文字・それだけを持つ配列や `<></>`)。
7
+ * 見出しやラベルが「ある」かの判定に使う(`""` や `<></>` のような空の見出しを、名前として指さない)。
8
+ * 要素(`<Text />` など)は、中身が空でも「ある」とする(描かれる)。Fragment だけは、中身で決める。
9
+ */
10
+ export declare function isBlankNode(node: ReactNode): boolean;
11
+ //#endregion
@@ -0,0 +1,21 @@
1
+ import { Fragment, isValidElement } from "react";
2
+ import { clsx } from "clsx";
3
+ import { twMerge } from "tailwind-merge";
4
+
5
+ //#region src/native/lib/utils.ts
6
+ function cn(...inputs) {
7
+ return twMerge(clsx(inputs));
8
+ }
9
+ /**
10
+ * 何も描かない `ReactNode`(`null`・`undefined`・真偽値・空文字・それだけを持つ配列や `<></>`)。
11
+ * 見出しやラベルが「ある」かの判定に使う(`""` や `<></>` のような空の見出しを、名前として指さない)。
12
+ * 要素(`<Text />` など)は、中身が空でも「ある」とする(描かれる)。Fragment だけは、中身で決める。
13
+ */
14
+ function isBlankNode(node) {
15
+ if (node === null || node === void 0 || typeof node === "boolean" || node === "") return true;
16
+ if (Array.isArray(node)) return node.every(isBlankNode);
17
+ return isValidElement(node) && node.type === Fragment && isBlankNode(node.props.children);
18
+ }
19
+
20
+ //#endregion
21
+ export { cn, isBlankNode };
@@ -0,0 +1,7 @@
1
+ //#region src/native/once/confirm.d.ts
2
+ /**
3
+ * `confirm()`(`lib/confirm.ts`)から呼ばれる確認ダイアログ。アプリのルートに 1 つだけ置く。
4
+ * 移植元は jotai の `confirmDialogAtom` を読んでいたが、love3 は外部ストア(`confirmDialogStore`)を読む。
5
+ */
6
+ export declare function ConfirmDialog(): import("react").JSX.Element;
7
+ //#endregion
@@ -0,0 +1,60 @@
1
+ import { Text as Text$1 } from "../base/text.js";
2
+ import { Button } from "../atom/button.js";
3
+ import { closeConfirmDialog, confirmDialogStore, registerConfirmDialog } from "../lib/confirm.js";
4
+ import { useEffect } from "react";
5
+ import { Modal, Pressable, View } from "react-native";
6
+ import { jsx, jsxs } from "react/jsx-runtime";
7
+
8
+ //#region src/native/once/confirm.tsx
9
+ /**
10
+ * `confirm()`(`lib/confirm.ts`)から呼ばれる確認ダイアログ。アプリのルートに 1 つだけ置く。
11
+ * 移植元は jotai の `confirmDialogAtom` を読んでいたが、love3 は外部ストア(`confirmDialogStore`)を読む。
12
+ */
13
+ function ConfirmDialog() {
14
+ const dialog = confirmDialogStore.use();
15
+ useEffect(() => registerConfirmDialog(), []);
16
+ const dismiss = () => {
17
+ dialog.onDismiss?.();
18
+ closeConfirmDialog();
19
+ };
20
+ return /* @__PURE__ */ jsx(Modal, {
21
+ visible: dialog.isOpen,
22
+ transparent: true,
23
+ animationType: "fade",
24
+ onRequestClose: dismiss,
25
+ "aria-label": dialog.title,
26
+ children: /* @__PURE__ */ jsx(Pressable, {
27
+ accessible: false,
28
+ className: "flex-1 items-center justify-center bg-scrim p-6",
29
+ onPress: dialog.onOutsideClick ? () => dialog.onOutsideClick?.(closeConfirmDialog) : void 0,
30
+ children: /* @__PURE__ */ jsxs(Pressable, {
31
+ accessible: false,
32
+ className: "w-full max-w-[400px] self-center rounded-surface bg-popover p-5 shadow-lg",
33
+ onPress: () => {},
34
+ children: [/* @__PURE__ */ jsxs(View, {
35
+ className: "gap-1.5",
36
+ children: [dialog.title ? /* @__PURE__ */ jsx(Text$1, {
37
+ className: "text-base leading-6 font-semibold",
38
+ children: dialog.title
39
+ }) : null, dialog.description ? /* @__PURE__ */ jsx(Text$1, {
40
+ className: "text-muted-foreground text-[13px] leading-5",
41
+ children: dialog.description
42
+ }) : null]
43
+ }), /* @__PURE__ */ jsx(View, {
44
+ className: "mt-4 flex-row justify-end gap-2",
45
+ children: dialog.buttons?.map(({ text, onClick, variant }) => /* @__PURE__ */ jsx(Button, {
46
+ variant,
47
+ onPress: () => {
48
+ onClick();
49
+ closeConfirmDialog();
50
+ },
51
+ children: text
52
+ }, text))
53
+ })]
54
+ })
55
+ })
56
+ });
57
+ }
58
+
59
+ //#endregion
60
+ export { ConfirmDialog };
@@ -0,0 +1,28 @@
1
+ import { Component, ReactNode } from "react";
2
+ //#region src/native/once/error-boundary.d.ts
3
+ export type ErrorBoundaryLabels = {
4
+ title: string;
5
+ description: string;
6
+ retry: string;
7
+ };
8
+ export type ErrorBoundaryProps = {
9
+ children: ReactNode;
10
+ /** フォールバック画面の文言。i18n はアプリ側で解決して渡す。 */
11
+ labels: ErrorBoundaryLabels;
12
+ };
13
+ type State = {
14
+ hasError: boolean;
15
+ };
16
+ /**
17
+ * アプリ全体を包むエラーバウンダリ。子ツリーのレンダリング例外を捕捉し、
18
+ * 白画面クラッシュの代わりに復帰導線付きのフォールバックを表示する。
19
+ */
20
+ export declare class ErrorBoundary extends Component<ErrorBoundaryProps, State> {
21
+ state: State;
22
+ static getDerivedStateFromError(): State;
23
+ componentDidCatch(error: unknown): void;
24
+ reset: () => void;
25
+ render(): string | number | bigint | boolean | import("react").JSX.Element | Iterable<ReactNode> | Promise<string | number | bigint | boolean | Iterable<ReactNode> | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | import("react").ReactPortal | null | undefined> | null | undefined;
26
+ }
27
+ //#endregion
28
+ export {};
@@ -0,0 +1,55 @@
1
+ import { Text as Text$1 } from "../base/text.js";
2
+ import { Button } from "../atom/button.js";
3
+ import { Component } from "react";
4
+ import { View } from "react-native";
5
+ import { jsx, jsxs } from "react/jsx-runtime";
6
+
7
+ //#region src/native/once/error-boundary.tsx
8
+ function ErrorFallback({ title, description, retry, onRetry }) {
9
+ return /* @__PURE__ */ jsxs(View, {
10
+ role: "alert",
11
+ className: "flex-1 items-center justify-center gap-4 bg-background p-8",
12
+ children: [
13
+ /* @__PURE__ */ jsx(Text$1, {
14
+ className: "text-lg font-bold text-foreground",
15
+ children: title
16
+ }),
17
+ /* @__PURE__ */ jsx(Text$1, {
18
+ variant: "muted",
19
+ className: "text-center leading-5",
20
+ children: description
21
+ }),
22
+ /* @__PURE__ */ jsx(Button, {
23
+ onPress: onRetry,
24
+ children: retry
25
+ })
26
+ ]
27
+ });
28
+ }
29
+ /**
30
+ * アプリ全体を包むエラーバウンダリ。子ツリーのレンダリング例外を捕捉し、
31
+ * 白画面クラッシュの代わりに復帰導線付きのフォールバックを表示する。
32
+ */
33
+ var ErrorBoundary = class extends Component {
34
+ constructor(..._args) {
35
+ super(..._args);
36
+ this.state = { hasError: false };
37
+ this.reset = () => this.setState({ hasError: false });
38
+ }
39
+ static getDerivedStateFromError() {
40
+ return { hasError: true };
41
+ }
42
+ componentDidCatch(error) {
43
+ console.error("Uncaught render error:", error);
44
+ }
45
+ render() {
46
+ if (this.state.hasError) return /* @__PURE__ */ jsx(ErrorFallback, {
47
+ ...this.props.labels,
48
+ onRetry: this.reset
49
+ });
50
+ return this.props.children;
51
+ }
52
+ };
53
+
54
+ //#endregion
55
+ export { ErrorBoundary };
@@ -0,0 +1,8 @@
1
+ //#region src/native/once/loading-lock.d.ts
2
+ /**
3
+ * グローバルローディング中に操作を塞ぐオーバーレイ。アプリのルートに 1 つだけ置く。
4
+ * `globalLoading(true)`(`lib/loading.ts`)で出て、`false` で消える。
5
+ * 移植元は jotai の `loadingAtom` を読んでいたが、love3 は外部ストア(`loadingStore`)を読む。
6
+ */
7
+ export declare function LoadingLock(): import("react").JSX.Element;
8
+ //#endregion
@@ -0,0 +1,28 @@
1
+ import { LOADING_LABEL } from "../lib/labels.js";
2
+ import { Spinner } from "../atom/spinner.js";
3
+ import { loadingStore } from "../lib/loading.js";
4
+ import { Modal, View } from "react-native";
5
+ import { jsx } from "react/jsx-runtime";
6
+
7
+ //#region src/native/once/loading-lock.tsx
8
+ /**
9
+ * グローバルローディング中に操作を塞ぐオーバーレイ。アプリのルートに 1 つだけ置く。
10
+ * `globalLoading(true)`(`lib/loading.ts`)で出て、`false` で消える。
11
+ * 移植元は jotai の `loadingAtom` を読んでいたが、love3 は外部ストア(`loadingStore`)を読む。
12
+ */
13
+ function LoadingLock() {
14
+ const loading = loadingStore.use();
15
+ return /* @__PURE__ */ jsx(Modal, {
16
+ visible: loading,
17
+ transparent: true,
18
+ animationType: "fade",
19
+ "aria-label": LOADING_LABEL,
20
+ children: /* @__PURE__ */ jsx(View, {
21
+ className: "flex-1 items-center justify-center bg-scrim",
22
+ children: /* @__PURE__ */ jsx(Spinner, { size: "large" })
23
+ })
24
+ });
25
+ }
26
+
27
+ //#endregion
28
+ export { LoadingLock };
@@ -0,0 +1,15 @@
1
+ //#region src/native/once/offline-banner.d.ts
2
+ export type OfflineBannerProps = {
3
+ /** 表示する文言。love3 は i18n に依存しないので、アプリ側で解決して渡す。 */
4
+ message: string;
5
+ };
6
+ /**
7
+ * 通信断中に画面最上部へ常設表示するバナー。復帰すると自動的に消える。
8
+ * ルートには `react-native-safe-area-context` の `SafeAreaProvider` が要る(Expo Router は標準で入れる)。
9
+ *
10
+ * 配色は `destructive` の面と、その上の文字(`paper`。`atom/button` の destructive と同じ組)。
11
+ * 移植元は色リテラル(赤の `#B91C1C` と白)でテーマ非依存に固定していたが、love3 は色リテラルを持たない(トークンを使う)。
12
+ * 状態は `lib/network.ts` の `useIsOnline`(NetInfo。web は `navigator.onLine`)。切れると `role="alert"` で読み上げる。
13
+ */
14
+ export declare function OfflineBanner({ message }: OfflineBannerProps): import("react").JSX.Element | null;
15
+ //#endregion
@@ -0,0 +1,35 @@
1
+ import { Text as Text$1 } from "../base/text.js";
2
+ import { useIsOnline } from "../lib/network.js";
3
+ import { View } from "react-native";
4
+ import { jsx } from "react/jsx-runtime";
5
+ import { useSafeAreaInsets } from "react-native-safe-area-context";
6
+
7
+ //#region src/native/once/offline-banner.tsx
8
+ /**
9
+ * 通信断中に画面最上部へ常設表示するバナー。復帰すると自動的に消える。
10
+ * ルートには `react-native-safe-area-context` の `SafeAreaProvider` が要る(Expo Router は標準で入れる)。
11
+ *
12
+ * 配色は `destructive` の面と、その上の文字(`paper`。`atom/button` の destructive と同じ組)。
13
+ * 移植元は色リテラル(赤の `#B91C1C` と白)でテーマ非依存に固定していたが、love3 は色リテラルを持たない(トークンを使う)。
14
+ * 状態は `lib/network.ts` の `useIsOnline`(NetInfo。web は `navigator.onLine`)。切れると `role="alert"` で読み上げる。
15
+ */
16
+ function OfflineBanner({ message }) {
17
+ const online = useIsOnline();
18
+ const insets = useSafeAreaInsets();
19
+ if (online) return null;
20
+ return /* @__PURE__ */ jsx(View, {
21
+ role: "alert",
22
+ className: "bg-destructive",
23
+ style: { paddingTop: insets.top },
24
+ children: /* @__PURE__ */ jsx(View, {
25
+ className: "items-center py-1.5",
26
+ children: /* @__PURE__ */ jsx(Text$1, {
27
+ className: "text-paper text-[13px] font-semibold",
28
+ children: message
29
+ })
30
+ })
31
+ });
32
+ }
33
+
34
+ //#endregion
35
+ export { OfflineBanner };
@@ -0,0 +1,17 @@
1
+ //#region src/native/once/snackbar.d.ts
2
+ export type SnackbarProps = {
3
+ /** 上端から出す(既定)か下端から出すか。 */
4
+ position?: "top" | "bottom";
5
+ /** 各トーストの閉じるボタンの読み上げ名(既定は「閉じる」)。 */
6
+ closeLabel?: string;
7
+ };
8
+ /**
9
+ * トーストの置き場。アプリのルートに 1 つだけ置く(親は画面いっぱいの View にする。位置はその親の上端・下端)。
10
+ * `@lt-three/web` の once/snackbar(sonner の Toaster)に対応する。
11
+ * ルートには `react-native-safe-area-context` の `SafeAreaProvider` が要る(Expo Router は標準で入れる)。
12
+ *
13
+ * 表示は `lib/snackbar.ts` の `snackbar()` から行う。**置いていないと出ない**(開発時は `snackbar()` が警告を出す)。
14
+ * エラーは `role="alert"`、ほかは `role="status"`(支援技術が読み上げる)。iOS は live region が無いので、出たとき `announceForAccessibility` で読ませる。
15
+ */
16
+ export declare function Snackbar({ position, closeLabel }: SnackbarProps): import("react").JSX.Element | null;
17
+ //#endregion
@@ -0,0 +1,106 @@
1
+ import { useTokenColor } from "../lib/token-color.js";
2
+ import { Text as Text$1 } from "../base/text.js";
3
+ import { CLOSE_LABEL } from "../lib/labels.js";
4
+ import { dismissSnackbar, registerSnackbarHost, snackbarStore } from "../lib/snackbar.js";
5
+ import { useEffect } from "react";
6
+ import { AccessibilityInfo, Platform, Pressable, View } from "react-native";
7
+ import { jsx, jsxs } from "react/jsx-runtime";
8
+ import Feather from "@expo/vector-icons/Feather";
9
+ import { useSafeAreaInsets } from "react-native-safe-area-context";
10
+
11
+ //#region src/native/once/snackbar.tsx
12
+ const ICON = {
13
+ success: "check-circle",
14
+ error: "alert-octagon",
15
+ info: "info",
16
+ warning: "alert-triangle"
17
+ };
18
+ /**
19
+ * トーストの置き場。アプリのルートに 1 つだけ置く(親は画面いっぱいの View にする。位置はその親の上端・下端)。
20
+ * `@lt-three/web` の once/snackbar(sonner の Toaster)に対応する。
21
+ * ルートには `react-native-safe-area-context` の `SafeAreaProvider` が要る(Expo Router は標準で入れる)。
22
+ *
23
+ * 表示は `lib/snackbar.ts` の `snackbar()` から行う。**置いていないと出ない**(開発時は `snackbar()` が警告を出す)。
24
+ * エラーは `role="alert"`、ほかは `role="status"`(支援技術が読み上げる)。iOS は live region が無いので、出たとき `announceForAccessibility` で読ませる。
25
+ */
26
+ function Snackbar({ position = "top", closeLabel = CLOSE_LABEL }) {
27
+ const items = snackbarStore.use();
28
+ const insets = useSafeAreaInsets();
29
+ useEffect(() => registerSnackbarHost(), []);
30
+ if (items.length === 0) return null;
31
+ return /* @__PURE__ */ jsx(View, {
32
+ pointerEvents: "box-none",
33
+ style: {
34
+ position: "absolute",
35
+ left: 0,
36
+ right: 0,
37
+ ...position === "top" ? { top: insets.top } : { bottom: insets.bottom }
38
+ },
39
+ className: "gap-2 p-4",
40
+ children: items.map((item) => /* @__PURE__ */ jsx(Toast, {
41
+ item,
42
+ closeLabel
43
+ }, item.id))
44
+ });
45
+ }
46
+ function Toast({ item, closeLabel }) {
47
+ const ink = useTokenColor("--ink-1000");
48
+ const iconColor = {
49
+ success: useTokenColor("--state-success"),
50
+ error: useTokenColor("--state-error"),
51
+ warning: useTokenColor("--state-warning"),
52
+ info: ink
53
+ }[item.icon];
54
+ const { id, title, description, action } = item;
55
+ useEffect(() => {
56
+ if (Platform.OS === "ios") AccessibilityInfo.announceForAccessibility(description ? `${title}。${description}` : title);
57
+ }, [title, description]);
58
+ return /* @__PURE__ */ jsxs(View, {
59
+ role: item.icon === "error" ? "alert" : "status",
60
+ "aria-live": item.icon === "error" ? "assertive" : "polite",
61
+ className: "flex-row items-start gap-3 rounded-surface border border-line bg-popover p-3 shadow-md",
62
+ children: [
63
+ /* @__PURE__ */ jsx(Feather, {
64
+ name: ICON[item.icon],
65
+ size: 16,
66
+ color: iconColor
67
+ }),
68
+ /* @__PURE__ */ jsxs(View, {
69
+ className: "shrink grow gap-1",
70
+ children: [/* @__PURE__ */ jsx(Text$1, {
71
+ className: "text-sm font-medium",
72
+ children: title
73
+ }), description ? /* @__PURE__ */ jsx(Text$1, {
74
+ className: "text-muted-foreground text-xs",
75
+ children: description
76
+ }) : null]
77
+ }),
78
+ action ? /* @__PURE__ */ jsx(Pressable, {
79
+ accessibilityRole: "button",
80
+ hitSlop: 8,
81
+ onPress: () => {
82
+ dismissSnackbar(id);
83
+ action.onPress();
84
+ },
85
+ children: /* @__PURE__ */ jsx(Text$1, {
86
+ className: "text-action-ink text-xs font-medium underline",
87
+ children: action.label
88
+ })
89
+ }) : null,
90
+ /* @__PURE__ */ jsx(Pressable, {
91
+ accessibilityRole: "button",
92
+ accessibilityLabel: closeLabel,
93
+ hitSlop: 8,
94
+ onPress: () => dismissSnackbar(id),
95
+ children: /* @__PURE__ */ jsx(Feather, {
96
+ name: "x",
97
+ size: 14,
98
+ color: ink
99
+ })
100
+ })
101
+ ]
102
+ });
103
+ }
104
+
105
+ //#endregion
106
+ export { Snackbar };
@@ -0,0 +1,46 @@
1
+ /*
2
+ * love3 の native 用スタイル(`@lt-three/love3/native/styles.css`)。**Metro(実機)の CSS の入口**。
3
+ * アプリの `global.css` で 1 度だけ import する(NativeWind v5 / react-native-css が Tailwind v4 としてコンパイルする)。
4
+ *
5
+ * @import "@lt-three/love3/native/styles.css";
6
+ *
7
+ * **`native/web/styles.css` とは別物。** あちらは preview・vitest が react-native-web で描くときの入口
8
+ * (web の Tailwind に乗るので `nativewind/theme` も要らず、ダークは `<html class="dark">`)。実機では使わない。
9
+ *
10
+ * 中身は、Tailwind v4 の本体・NativeWind のテーマ・トークン(`@lt-three/love3/styles.css`)・部品のクラスの検出。
11
+ * トークンの値は `src/tokens/definition.ts`(SSOT)が持つ。ここにはトークンを書かない。
12
+ */
13
+ @import "tailwindcss/theme.css" layer(theme);
14
+ @import "tailwindcss/preflight.css" layer(base);
15
+ @import "tailwindcss/utilities.css";
16
+
17
+ @import "nativewind/theme";
18
+
19
+ /* トークン本体(@theme・ライト・ダーク)。生成物なので、値を変えるときは definition.ts を直す */
20
+ @import "@lt-three/love3/styles.css";
21
+
22
+ /*
23
+ * love3 の native の部品が使う Tailwind のクラスを拾う。node_modules(workspace の symlink 越し)は
24
+ * 自動検出の対象外なので、ここで明示する。`@source` のパスは、この CSS ファイルの位置が基準。
25
+ * 公開物(`dist/`)では部品が `*.js` になるので、`tsx` と `js` の両方を拾う(同じファイルを src と dist の両方に置く)。
26
+ * `web/` は react-native-web 用の補助(クラスを持たない)なので除く。
27
+ */
28
+ @source "./**/*.{tsx,js}";
29
+ @source not "./**/*.test.tsx";
30
+ @source not "./web/**";
31
+
32
+ /*
33
+ * native の `dark:` は **クラスではなく OS の配色設定**で解決する。
34
+ *
35
+ * `@lt-three/love3/styles.css` の既定は `&:is(.dark *)`(web の `<html class="dark">` 前提)。
36
+ * これを native でも使うと、`dark:` を持つ規則の祖先セレクタとして `.dark` が現れるため
37
+ * react-native-css が `.dark` の付いたビューを **container** として扱い、
38
+ * hover/active/focus の追跡ハンドラを載せる。すると**そのビューの子孫にある
39
+ * ScrollView が pan を受け取れなくなり、アプリ全体がスクロール不能になる**
40
+ * (タップは通るので気づきにくい。実機で確認)。
41
+ *
42
+ * OS の配色は `Appearance.setColorScheme()` で切り替えられる(`ThemeRoot` がやっている)ので、
43
+ * アプリ内のテーマ設定はこれまで通り効く。`.dark` は**変数を配るだけ**のクラスに戻る。
44
+ * `lib/tokens-check.ts`(`tokens.test.ts`)が、container を作るクラスが無いことを守る。
45
+ */
46
+ @custom-variant dark (@media (prefers-color-scheme: dark));
@@ -0,0 +1,71 @@
1
+ //#region src/shared/analytics.d.ts
2
+ export type LinePoint = {
3
+ /** 読み出しに出す見出し(日付など)。 */
4
+ x: string | number;
5
+ y: number;
6
+ /**
7
+ * 横位置に使う値(Unix 秒などの連続量)。
8
+ *
9
+ * **複数系列を重ねるときは必ず入れる。** 省略すると並び順で等間隔に置くので、
10
+ * 刻みの違う系列(日次の残高と不定間隔のエクイティ)を重ねたときに
11
+ * 同じ横位置が別の時刻を指してしまう。
12
+ */
13
+ t?: number;
14
+ };
15
+ /** 複数系列の折れ線 1 本ぶん。 */
16
+ export type LineSeries = {
17
+ /** React の key と系列の識別子。 */
18
+ key: string;
19
+ /** 凡例に出す名前。 */
20
+ label: string;
21
+ points: LinePoint[];
22
+ /** 線の色。CSS の色(`var(--chart-1)` などトークンの参照を推奨)。 */
23
+ color: string;
24
+ /** 破線にする(副系列を主系列と見分けるため)。 */
25
+ dashed?: boolean;
26
+ };
27
+ /** 折れ線の props のうち、見た目の寸法と読み上げの要約(web と native で共通)。 */
28
+ export type ChartCommonProps = {
29
+ height?: number;
30
+ /**
31
+ * チャートの要約(読み上げ用。例: 「残高は 1 月 1 日の $1,000 から 7 日の $1,210 へ上がった」)。渡すと `role="img"` の
32
+ * 名前になる。**図形(svg)そのものは名前を持たない**ので、値が読めないユーザー(スクリーンリーダー・キーボード)へは
33
+ * これで伝える。共有パッケージなので文言は使用側が持つ。
34
+ */
35
+ accessibilityLabel?: string;
36
+ };
37
+ /** 単一系列の折れ線(`LineChart`)。 */
38
+ export type LineChartSharedProps = {
39
+ data: LinePoint[];
40
+ color?: string;
41
+ };
42
+ /** 複数系列の折れ線(`MultiLineChart`)。 */
43
+ export type MultiLineChartSharedProps = {
44
+ series: LineSeries[];
45
+ /** 縦軸の目盛りの整形。通貨記号などは使用側が決める。 */
46
+ formatValue?: (value: number) => string;
47
+ /** 全系列が空のときに出す文言。 */
48
+ emptyText?: string;
49
+ };
50
+ /** 面付きの単一指標(`MetricCard`)。 */
51
+ export type MetricCardSharedProps = {
52
+ label: string;
53
+ value: string;
54
+ subValue?: string;
55
+ /** 増減の符号。正なら state-success・負なら state-error で値を塗る(トークンの色。ダークにも追従する)。 */
56
+ trend?: number;
57
+ className?: string;
58
+ };
59
+ /** 符号で色が変わる数値(`ColoredValue`)。 */
60
+ export interface ColoredValueSharedProps<TValue> {
61
+ value: TValue;
62
+ format?: (value: TValue) => string;
63
+ isPositive?: (value: TValue) => boolean;
64
+ isNegative?: (value: TValue) => boolean;
65
+ /** 増を表すクラス。既定は `text-state-success`(トークン。ダークに追従する)。 */
66
+ positiveColor?: string;
67
+ /** 減を表すクラス。既定は `text-state-error`。 */
68
+ negativeColor?: string;
69
+ className?: string;
70
+ }
71
+ //#endregion
File without changes
@@ -0,0 +1,7 @@
1
+ //#region src/shared/button.d.ts
2
+ export declare const BUTTON_VARIANTS: readonly ["default", "destructive", "outline", "secondary", "ghost", "link", "plate", "<3"];
3
+ /** `"<3"` は Less Than Three のブランド色(ピンク塗り)。画面に 1 つだけ置く想定の確定操作用 */
4
+ export type ButtonVariant = (typeof BUTTON_VARIANTS)[number];
5
+ export declare const BUTTON_SIZES: readonly ["default", "xs", "sm", "lg", "xl", "icon", "icon-xs"];
6
+ export type ButtonSize = (typeof BUTTON_SIZES)[number];
7
+ //#endregion
@@ -0,0 +1,23 @@
1
+ //#region src/shared/button.ts
2
+ const BUTTON_VARIANTS = [
3
+ "default",
4
+ "destructive",
5
+ "outline",
6
+ "secondary",
7
+ "ghost",
8
+ "link",
9
+ "plate",
10
+ "<3"
11
+ ];
12
+ const BUTTON_SIZES = [
13
+ "default",
14
+ "xs",
15
+ "sm",
16
+ "lg",
17
+ "xl",
18
+ "icon",
19
+ "icon-xs"
20
+ ];
21
+
22
+ //#endregion
23
+ export { BUTTON_SIZES, BUTTON_VARIANTS };