@remix-run/ui 0.0.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (272) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +195 -2
  3. package/dist/animation/animate-layout-mixin.d.ts +12 -0
  4. package/dist/animation/animate-layout-mixin.js +214 -0
  5. package/dist/animation/animate-layout-mixin.js.map +1 -0
  6. package/dist/animation/animate-mixins.d.ts +29 -0
  7. package/dist/animation/animate-mixins.js +235 -0
  8. package/dist/animation/animate-mixins.js.map +1 -0
  9. package/dist/animation/index.d.ts +6 -0
  10. package/dist/animation/index.js +5 -0
  11. package/dist/animation/index.js.map +1 -0
  12. package/dist/animation/spring.d.ts +75 -0
  13. package/dist/animation/spring.js +183 -0
  14. package/dist/animation/spring.js.map +1 -0
  15. package/dist/animation/tween.d.ts +70 -0
  16. package/dist/animation/tween.js +93 -0
  17. package/dist/animation/tween.js.map +1 -0
  18. package/dist/components/accordion/accordion.d.ts +92 -0
  19. package/dist/components/accordion/accordion.js +337 -0
  20. package/dist/components/accordion/accordion.js.map +1 -0
  21. package/dist/components/anchor/anchor.d.ts +13 -0
  22. package/dist/components/anchor/anchor.js +558 -0
  23. package/dist/components/anchor/anchor.js.map +1 -0
  24. package/dist/components/breadcrumbs/breadcrumbs.d.ts +11 -0
  25. package/dist/components/breadcrumbs/breadcrumbs.js +78 -0
  26. package/dist/components/breadcrumbs/breadcrumbs.js.map +1 -0
  27. package/dist/components/button/button.d.ts +23 -0
  28. package/dist/components/button/button.js +147 -0
  29. package/dist/components/button/button.js.map +1 -0
  30. package/dist/components/combobox/combobox.d.ts +101 -0
  31. package/dist/components/combobox/combobox.js +708 -0
  32. package/dist/components/combobox/combobox.js.map +1 -0
  33. package/dist/components/glyph/glyph.d.ts +14 -0
  34. package/dist/components/glyph/glyph.js +65 -0
  35. package/dist/components/glyph/glyph.js.map +1 -0
  36. package/dist/components/listbox/listbox.d.ts +67 -0
  37. package/dist/components/listbox/listbox.js +340 -0
  38. package/dist/components/listbox/listbox.js.map +1 -0
  39. package/dist/components/menu/hover-aim.d.ts +5 -0
  40. package/dist/components/menu/hover-aim.js +308 -0
  41. package/dist/components/menu/hover-aim.js.map +1 -0
  42. package/dist/components/menu/menu.d.ts +164 -0
  43. package/dist/components/menu/menu.js +1106 -0
  44. package/dist/components/menu/menu.js.map +1 -0
  45. package/dist/components/popover/popover.d.ts +35 -0
  46. package/dist/components/popover/popover.js +138 -0
  47. package/dist/components/popover/popover.js.map +1 -0
  48. package/dist/components/select/select.d.ts +67 -0
  49. package/dist/components/select/select.js +397 -0
  50. package/dist/components/select/select.js.map +1 -0
  51. package/dist/components/separator/separator.d.ts +2 -0
  52. package/dist/components/separator/separator.js +15 -0
  53. package/dist/components/separator/separator.js.map +1 -0
  54. package/dist/components/tabs/tabs.d.ts +78 -0
  55. package/dist/components/tabs/tabs.js +341 -0
  56. package/dist/components/tabs/tabs.js.map +1 -0
  57. package/dist/index.d.ts +28 -0
  58. package/dist/index.js +21 -0
  59. package/dist/index.js.map +1 -0
  60. package/dist/interactions/keydown/keydown.d.ts +1 -0
  61. package/dist/interactions/keydown/keydown.js +8 -0
  62. package/dist/interactions/keydown/keydown.js.map +1 -0
  63. package/dist/interactions/outside-click/outside-click-mixin.d.ts +2 -0
  64. package/dist/interactions/outside-click/outside-click-mixin.js +29 -0
  65. package/dist/interactions/outside-click/outside-click-mixin.js.map +1 -0
  66. package/dist/interactions/typeahead/typeahead-mixin.d.ts +8 -0
  67. package/dist/interactions/typeahead/typeahead-mixin.js +59 -0
  68. package/dist/interactions/typeahead/typeahead-mixin.js.map +1 -0
  69. package/dist/jsx-runtime.d.ts +2 -0
  70. package/dist/jsx-runtime.js +3 -0
  71. package/dist/jsx-runtime.js.map +1 -0
  72. package/dist/runtime/client-entries.d.ts +91 -0
  73. package/dist/runtime/client-entries.js +40 -0
  74. package/dist/runtime/client-entries.js.map +1 -0
  75. package/dist/runtime/component.d.ts +223 -0
  76. package/dist/runtime/component.js +152 -0
  77. package/dist/runtime/component.js.map +1 -0
  78. package/dist/runtime/create-element.d.ts +10 -0
  79. package/dist/runtime/create-element.js +29 -0
  80. package/dist/runtime/create-element.js.map +1 -0
  81. package/dist/runtime/diff-dom.d.ts +2 -0
  82. package/dist/runtime/diff-dom.js +364 -0
  83. package/dist/runtime/diff-dom.js.map +1 -0
  84. package/dist/runtime/diff-props.d.ts +9 -0
  85. package/dist/runtime/diff-props.js +195 -0
  86. package/dist/runtime/diff-props.js.map +1 -0
  87. package/dist/runtime/document-state.d.ts +11 -0
  88. package/dist/runtime/document-state.js +106 -0
  89. package/dist/runtime/document-state.js.map +1 -0
  90. package/dist/runtime/dom.d.ts +3189 -0
  91. package/dist/runtime/dom.js +2 -0
  92. package/dist/runtime/dom.js.map +1 -0
  93. package/dist/runtime/error-event.d.ts +20 -0
  94. package/dist/runtime/error-event.js +19 -0
  95. package/dist/runtime/error-event.js.map +1 -0
  96. package/dist/runtime/event-listeners.d.ts +50 -0
  97. package/dist/runtime/event-listeners.js +31 -0
  98. package/dist/runtime/event-listeners.js.map +1 -0
  99. package/dist/runtime/frame.d.ts +119 -0
  100. package/dist/runtime/frame.js +920 -0
  101. package/dist/runtime/frame.js.map +1 -0
  102. package/dist/runtime/invariant.d.ts +23 -0
  103. package/dist/runtime/invariant.js +33 -0
  104. package/dist/runtime/invariant.js.map +1 -0
  105. package/dist/runtime/jsx.d.ts +320 -0
  106. package/dist/runtime/jsx.js +32 -0
  107. package/dist/runtime/jsx.js.map +1 -0
  108. package/dist/runtime/mixins/attrs-mixin.d.ts +9 -0
  109. package/dist/runtime/mixins/attrs-mixin.js +23 -0
  110. package/dist/runtime/mixins/attrs-mixin.js.map +1 -0
  111. package/dist/runtime/mixins/link-mixin.d.ts +17 -0
  112. package/dist/runtime/mixins/link-mixin.js +101 -0
  113. package/dist/runtime/mixins/link-mixin.js.map +1 -0
  114. package/dist/runtime/mixins/mixin.d.ts +145 -0
  115. package/dist/runtime/mixins/mixin.js +570 -0
  116. package/dist/runtime/mixins/mixin.js.map +1 -0
  117. package/dist/runtime/mixins/on-mixin.d.ts +16 -0
  118. package/dist/runtime/mixins/on-mixin.js +49 -0
  119. package/dist/runtime/mixins/on-mixin.js.map +1 -0
  120. package/dist/runtime/mixins/ref-mixin.d.ts +9 -0
  121. package/dist/runtime/mixins/ref-mixin.js +21 -0
  122. package/dist/runtime/mixins/ref-mixin.js.map +1 -0
  123. package/dist/runtime/navigation.d.ts +28 -0
  124. package/dist/runtime/navigation.js +107 -0
  125. package/dist/runtime/navigation.js.map +1 -0
  126. package/dist/runtime/reconcile.d.ts +11 -0
  127. package/dist/runtime/reconcile.js +1262 -0
  128. package/dist/runtime/reconcile.js.map +1 -0
  129. package/dist/runtime/render.d.ts +54 -0
  130. package/dist/runtime/render.js +50 -0
  131. package/dist/runtime/render.js.map +1 -0
  132. package/dist/runtime/run.d.ts +45 -0
  133. package/dist/runtime/run.js +68 -0
  134. package/dist/runtime/run.js.map +1 -0
  135. package/dist/runtime/scheduler.d.ts +30 -0
  136. package/dist/runtime/scheduler.js +195 -0
  137. package/dist/runtime/scheduler.js.map +1 -0
  138. package/dist/runtime/svg-attributes.d.ts +5 -0
  139. package/dist/runtime/svg-attributes.js +124 -0
  140. package/dist/runtime/svg-attributes.js.map +1 -0
  141. package/dist/runtime/to-vnode.d.ts +3 -0
  142. package/dist/runtime/to-vnode.js +46 -0
  143. package/dist/runtime/to-vnode.js.map +1 -0
  144. package/dist/runtime/typed-event-target.d.ts +50 -0
  145. package/dist/runtime/typed-event-target.js +6 -0
  146. package/dist/runtime/typed-event-target.js.map +1 -0
  147. package/dist/runtime/vdom.d.ts +55 -0
  148. package/dist/runtime/vdom.js +198 -0
  149. package/dist/runtime/vdom.js.map +1 -0
  150. package/dist/runtime/vnode.d.ts +79 -0
  151. package/dist/runtime/vnode.js +38 -0
  152. package/dist/runtime/vnode.js.map +1 -0
  153. package/dist/server/stream.d.ts +57 -0
  154. package/dist/server/stream.js +1011 -0
  155. package/dist/server/stream.js.map +1 -0
  156. package/dist/style/css-mixin.d.ts +8 -0
  157. package/dist/style/css-mixin.js +54 -0
  158. package/dist/style/css-mixin.js.map +1 -0
  159. package/dist/style/index.d.ts +5 -0
  160. package/dist/style/index.js +4 -0
  161. package/dist/style/index.js.map +1 -0
  162. package/dist/style/style.d.ts +24 -0
  163. package/dist/style/style.js +269 -0
  164. package/dist/style/style.js.map +1 -0
  165. package/dist/style/stylesheet.d.ts +11 -0
  166. package/dist/style/stylesheet.js +174 -0
  167. package/dist/style/stylesheet.js.map +1 -0
  168. package/dist/test.d.ts +2 -0
  169. package/dist/test.js +2 -0
  170. package/dist/test.js.map +1 -0
  171. package/dist/theme/contract.d.ts +259 -0
  172. package/dist/theme/contract.js +131 -0
  173. package/dist/theme/contract.js.map +1 -0
  174. package/dist/theme/glyph-contract.d.ts +13 -0
  175. package/dist/theme/glyph-contract.js +34 -0
  176. package/dist/theme/glyph-contract.js.map +1 -0
  177. package/dist/theme/presets/rmx-01/glyphs.d.ts +2 -0
  178. package/dist/theme/presets/rmx-01/glyphs.js +252 -0
  179. package/dist/theme/presets/rmx-01/glyphs.js.map +1 -0
  180. package/dist/theme/presets/rmx-01/index.d.ts +2 -0
  181. package/dist/theme/presets/rmx-01/index.js +119 -0
  182. package/dist/theme/presets/rmx-01/index.js.map +1 -0
  183. package/dist/theme/runtime.d.ts +2 -0
  184. package/dist/theme/runtime.js +81 -0
  185. package/dist/theme/runtime.js.map +1 -0
  186. package/dist/theme/theme.d.ts +6 -0
  187. package/dist/theme/theme.js +5 -0
  188. package/dist/theme/theme.js.map +1 -0
  189. package/dist/utils/flash-attribute.d.ts +1 -0
  190. package/dist/utils/flash-attribute.js +11 -0
  191. package/dist/utils/flash-attribute.js.map +1 -0
  192. package/dist/utils/scroll-lock.d.ts +3 -0
  193. package/dist/utils/scroll-lock.js +69 -0
  194. package/dist/utils/scroll-lock.js.map +1 -0
  195. package/dist/utils/wait-for-css-transition.d.ts +1 -0
  196. package/dist/utils/wait-for-css-transition.js +58 -0
  197. package/dist/utils/wait-for-css-transition.js.map +1 -0
  198. package/dist/utils/wait.d.ts +1 -0
  199. package/dist/utils/wait.js +6 -0
  200. package/dist/utils/wait.js.map +1 -0
  201. package/package.json +124 -5
  202. package/src/animation/animate-layout-mixin.ts +266 -0
  203. package/src/animation/animate-mixins.ts +292 -0
  204. package/src/animation/index.ts +6 -0
  205. package/src/animation/spring.ts +299 -0
  206. package/src/animation/tween.ts +134 -0
  207. package/src/components/accordion/accordion.tsx +565 -0
  208. package/src/components/anchor/anchor.ts +904 -0
  209. package/src/components/breadcrumbs/breadcrumbs.tsx +124 -0
  210. package/src/components/button/README.md +44 -0
  211. package/src/components/button/button.tsx +188 -0
  212. package/src/components/combobox/README.md +145 -0
  213. package/src/components/combobox/combobox.tsx +1014 -0
  214. package/src/components/glyph/glyph.tsx +110 -0
  215. package/src/components/listbox/listbox.ts +447 -0
  216. package/src/components/menu/hover-aim.ts +428 -0
  217. package/src/components/menu/menu.tsx +1547 -0
  218. package/src/components/popover/README.md +122 -0
  219. package/src/components/popover/popover.ts +201 -0
  220. package/src/components/select/select.tsx +585 -0
  221. package/src/components/separator/separator.ts +19 -0
  222. package/src/components/tabs/README.md +105 -0
  223. package/src/components/tabs/tabs.tsx +499 -0
  224. package/src/index.ts +72 -0
  225. package/src/interactions/keydown/keydown.ts +14 -0
  226. package/src/interactions/outside-click/outside-click-mixin.ts +55 -0
  227. package/src/interactions/typeahead/typeahead-mixin.ts +89 -0
  228. package/src/jsx-runtime.ts +2 -0
  229. package/src/runtime/client-entries.ts +137 -0
  230. package/src/runtime/component.ts +402 -0
  231. package/src/runtime/create-element.ts +38 -0
  232. package/src/runtime/diff-dom.ts +404 -0
  233. package/src/runtime/diff-props.ts +209 -0
  234. package/src/runtime/document-state.ts +130 -0
  235. package/src/runtime/dom.ts +3971 -0
  236. package/src/runtime/error-event.ts +26 -0
  237. package/src/runtime/event-listeners.ts +171 -0
  238. package/src/runtime/frame.ts +1218 -0
  239. package/src/runtime/invariant.ts +31 -0
  240. package/src/runtime/jsx.ts +397 -0
  241. package/src/runtime/mixins/attrs-mixin.ts +35 -0
  242. package/src/runtime/mixins/link-mixin.ts +131 -0
  243. package/src/runtime/mixins/mixin.ts +908 -0
  244. package/src/runtime/mixins/on-mixin.ts +89 -0
  245. package/src/runtime/mixins/ref-mixin.ts +32 -0
  246. package/src/runtime/navigation.ts +148 -0
  247. package/src/runtime/reconcile.ts +1757 -0
  248. package/src/runtime/render.ts +101 -0
  249. package/src/runtime/run.ts +100 -0
  250. package/src/runtime/scheduler.ts +269 -0
  251. package/src/runtime/svg-attributes.ts +133 -0
  252. package/src/runtime/to-vnode.ts +51 -0
  253. package/src/runtime/typed-event-target.ts +67 -0
  254. package/src/runtime/vdom.ts +295 -0
  255. package/src/runtime/vnode.ts +137 -0
  256. package/src/server/stream.ts +1347 -0
  257. package/src/style/css-mixin.ts +82 -0
  258. package/src/style/index.ts +10 -0
  259. package/src/style/style.ts +312 -0
  260. package/src/style/stylesheet.ts +209 -0
  261. package/src/test/utils.ts +45 -0
  262. package/src/test.ts +2 -0
  263. package/src/theme/contract.ts +183 -0
  264. package/src/theme/glyph-contract.ts +57 -0
  265. package/src/theme/presets/rmx-01/glyphs.tsx +308 -0
  266. package/src/theme/presets/rmx-01/index.ts +121 -0
  267. package/src/theme/runtime.ts +116 -0
  268. package/src/theme/theme.ts +15 -0
  269. package/src/utils/flash-attribute.ts +11 -0
  270. package/src/utils/scroll-lock.ts +97 -0
  271. package/src/utils/wait-for-css-transition.ts +66 -0
  272. package/src/utils/wait.ts +5 -0
@@ -0,0 +1,183 @@
1
+ import type { css, Handle, MixinDescriptor, RemixElement } from '@remix-run/ui'
2
+
3
+ export interface ThemeVariableTree {
4
+ [key: string]: string | ThemeVariableTree
5
+ }
6
+
7
+ const themeVariableNames = {
8
+ space: {
9
+ none: '--rmx-space-none',
10
+ px: '--rmx-space-px',
11
+ xs: '--rmx-space-xs',
12
+ sm: '--rmx-space-sm',
13
+ md: '--rmx-space-md',
14
+ lg: '--rmx-space-lg',
15
+ xl: '--rmx-space-xl',
16
+ xxl: '--rmx-space-xxl',
17
+ },
18
+ radius: {
19
+ none: '--rmx-radius-none',
20
+ sm: '--rmx-radius-sm',
21
+ md: '--rmx-radius-md',
22
+ lg: '--rmx-radius-lg',
23
+ xl: '--rmx-radius-xl',
24
+ full: '--rmx-radius-full',
25
+ },
26
+ fontFamily: {
27
+ sans: '--rmx-font-family-sans',
28
+ mono: '--rmx-font-family-mono',
29
+ },
30
+ fontSize: {
31
+ xxxs: '--rmx-font-size-xxxs',
32
+ xxs: '--rmx-font-size-xxs',
33
+ xs: '--rmx-font-size-xs',
34
+ sm: '--rmx-font-size-sm',
35
+ md: '--rmx-font-size-md',
36
+ lg: '--rmx-font-size-lg',
37
+ xl: '--rmx-font-size-xl',
38
+ xxl: '--rmx-font-size-xxl',
39
+ },
40
+ lineHeight: {
41
+ tight: '--rmx-line-height-tight',
42
+ normal: '--rmx-line-height-normal',
43
+ relaxed: '--rmx-line-height-relaxed',
44
+ },
45
+ letterSpacing: {
46
+ tight: '--rmx-letter-spacing-tight',
47
+ normal: '--rmx-letter-spacing-normal',
48
+ meta: '--rmx-letter-spacing-meta',
49
+ wide: '--rmx-letter-spacing-wide',
50
+ },
51
+ fontWeight: {
52
+ normal: '--rmx-font-weight-normal',
53
+ medium: '--rmx-font-weight-medium',
54
+ semibold: '--rmx-font-weight-semibold',
55
+ bold: '--rmx-font-weight-bold',
56
+ },
57
+ control: {
58
+ height: {
59
+ sm: '--rmx-control-height-sm',
60
+ md: '--rmx-control-height-md',
61
+ lg: '--rmx-control-height-lg',
62
+ },
63
+ },
64
+ surface: {
65
+ lvl0: '--rmx-surface-lvl0',
66
+ lvl1: '--rmx-surface-lvl1',
67
+ lvl2: '--rmx-surface-lvl2',
68
+ lvl3: '--rmx-surface-lvl3',
69
+ lvl4: '--rmx-surface-lvl4',
70
+ },
71
+ shadow: {
72
+ xs: '--rmx-shadow-xs',
73
+ sm: '--rmx-shadow-sm',
74
+ md: '--rmx-shadow-md',
75
+ lg: '--rmx-shadow-lg',
76
+ xl: '--rmx-shadow-xl',
77
+ },
78
+ colors: {
79
+ text: {
80
+ primary: '--rmx-color-text-primary',
81
+ secondary: '--rmx-color-text-secondary',
82
+ muted: '--rmx-color-text-muted',
83
+ link: '--rmx-color-text-link',
84
+ },
85
+ border: {
86
+ subtle: '--rmx-color-border-subtle',
87
+ default: '--rmx-color-border-default',
88
+ strong: '--rmx-color-border-strong',
89
+ },
90
+ focus: {
91
+ ring: '--rmx-color-focus-ring',
92
+ },
93
+ overlay: {
94
+ scrim: '--rmx-color-overlay-scrim',
95
+ },
96
+ action: {
97
+ primary: {
98
+ background: '--rmx-color-action-primary-background',
99
+ backgroundHover: '--rmx-color-action-primary-background-hover',
100
+ backgroundActive: '--rmx-color-action-primary-background-active',
101
+ foreground: '--rmx-color-action-primary-foreground',
102
+ border: '--rmx-color-action-primary-border',
103
+ },
104
+ secondary: {
105
+ background: '--rmx-color-action-secondary-background',
106
+ backgroundHover: '--rmx-color-action-secondary-background-hover',
107
+ backgroundActive: '--rmx-color-action-secondary-background-active',
108
+ foreground: '--rmx-color-action-secondary-foreground',
109
+ border: '--rmx-color-action-secondary-border',
110
+ },
111
+ danger: {
112
+ background: '--rmx-color-action-danger-background',
113
+ backgroundHover: '--rmx-color-action-danger-background-hover',
114
+ backgroundActive: '--rmx-color-action-danger-background-active',
115
+ foreground: '--rmx-color-action-danger-foreground',
116
+ border: '--rmx-color-action-danger-border',
117
+ },
118
+ },
119
+ },
120
+ } as const satisfies ThemeVariableTree
121
+
122
+ type MapLeaves<source, leaf> = source extends string
123
+ ? leaf
124
+ : {
125
+ [key in keyof source]: MapLeaves<source[key], leaf>
126
+ }
127
+
128
+ export type ThemeValue = string | number
129
+ export type ThemeValues = MapLeaves<typeof themeVariableNames, ThemeValue>
130
+ export type ThemeVars = Readonly<Record<string, string>>
131
+ export type CreateThemeOptions = {
132
+ selector?: string
133
+ reset?: boolean
134
+ }
135
+ export type ThemeStyleProps = {
136
+ nonce?: string
137
+ }
138
+
139
+ type ThemeRenderer = (handle: Handle<ThemeStyleProps>) => () => RemixElement
140
+
141
+ export type ThemeComponent = ThemeRenderer & {
142
+ Style: ThemeRenderer
143
+ cssText: string
144
+ selector: string
145
+ values: ThemeValues
146
+ vars: ThemeVars
147
+ }
148
+
149
+ export const theme = createThemeContract(themeVariableNames)
150
+
151
+ export type ThemeUtility = ReturnType<typeof css>
152
+
153
+ type ThemeMixLeaf = MixinDescriptor<any, any, any>
154
+ type PreviousThemeMixDepth = [0, 0, 1, 2, 3, 4]
155
+ type NestedThemeMix<value, depth extends number = 4> = depth extends 0
156
+ ? value | ReadonlyArray<value>
157
+ : value | ReadonlyArray<NestedThemeMix<value, PreviousThemeMixDepth[depth]>>
158
+
159
+ export type ThemeMix = NestedThemeMix<ThemeMixLeaf>
160
+
161
+ export { themeVariableNames }
162
+
163
+ function createThemeContract<tree extends ThemeVariableTree>(tree: tree): MapLeaves<tree, string> {
164
+ return mapTreeLeaves(tree, (variableName) => `var(${variableName})`) as MapLeaves<tree, string>
165
+ }
166
+
167
+ function mapTreeLeaves(
168
+ tree: ThemeVariableTree,
169
+ mapLeaf: (value: string) => string,
170
+ ): ThemeVariableTree {
171
+ let output: ThemeVariableTree = {}
172
+
173
+ for (let [key, value] of Object.entries(tree)) {
174
+ if (typeof value === 'string') {
175
+ output[key] = mapLeaf(value)
176
+ continue
177
+ }
178
+
179
+ output[key] = mapTreeLeaves(value, mapLeaf)
180
+ }
181
+
182
+ return output
183
+ }
@@ -0,0 +1,57 @@
1
+ import type { RemixElement } from '@remix-run/ui'
2
+
3
+ export const glyphNames = [
4
+ 'add',
5
+ 'alert',
6
+ 'check',
7
+ 'chevronDown',
8
+ 'chevronVertical',
9
+ 'chevronUp',
10
+ 'chevronRight',
11
+ 'close',
12
+ 'copy',
13
+ 'edit',
14
+ 'expand',
15
+ 'info',
16
+ 'menu',
17
+ 'open',
18
+ 'search',
19
+ 'spinner',
20
+ 'trash',
21
+ ] as const
22
+
23
+ export type GlyphName = (typeof glyphNames)[number]
24
+
25
+ export type GlyphSymbol = RemixElement
26
+
27
+ export type GlyphValues = {
28
+ readonly [key in GlyphName]: GlyphSymbol
29
+ }
30
+
31
+ export type GlyphContract = Readonly<Record<GlyphName, { id: string }>>
32
+
33
+ const DEFAULT_GLYPH_ID_PREFIX = 'rmx-glyph'
34
+
35
+ export const glyphContract = Object.freeze(createGlyphContract(DEFAULT_GLYPH_ID_PREFIX))
36
+
37
+ function createGlyphIds(idPrefix: string): Record<GlyphName, string> {
38
+ return Object.fromEntries(glyphNames.map((name) => [name, `${idPrefix}-${name}`])) as Record<
39
+ GlyphName,
40
+ string
41
+ >
42
+ }
43
+
44
+ function createGlyphContract(idPrefix: string): GlyphContract {
45
+ let ids = createGlyphIds(idPrefix)
46
+
47
+ return Object.freeze(
48
+ Object.fromEntries(
49
+ glyphNames.map((name) => [
50
+ name,
51
+ {
52
+ id: ids[name],
53
+ },
54
+ ]),
55
+ ) as GlyphContract,
56
+ )
57
+ }
@@ -0,0 +1,308 @@
1
+ import { createElement } from '@remix-run/ui'
2
+ import type { RemixNode } from '@remix-run/ui'
3
+
4
+ import type { GlyphValues } from '../../glyph-contract.ts'
5
+
6
+ const defaultViewBox = '0 0 16 16'
7
+
8
+ function symbol(...content: RemixNode[]) {
9
+ return createElement('symbol', { viewBox: defaultViewBox }, ...content)
10
+ }
11
+
12
+ export const glyphValues: GlyphValues = {
13
+ add: symbol(
14
+ createElement('path', {
15
+ d: 'M8 3.25v9.5M3.25 8h9.5',
16
+ fill: 'none',
17
+ stroke: 'currentColor',
18
+ strokeLinecap: 'round',
19
+ strokeLinejoin: 'round',
20
+ strokeWidth: '1.5',
21
+ }),
22
+ ),
23
+ alert: symbol(
24
+ createElement('path', {
25
+ d: 'M8 2.5 13.75 12.5H2.25Z',
26
+ fill: 'none',
27
+ stroke: 'currentColor',
28
+ strokeLinejoin: 'round',
29
+ strokeWidth: '1.5',
30
+ }),
31
+ createElement('path', {
32
+ d: 'M8 5.75v3.5',
33
+ fill: 'none',
34
+ stroke: 'currentColor',
35
+ strokeLinecap: 'round',
36
+ strokeWidth: '1.5',
37
+ }),
38
+ createElement('circle', {
39
+ cx: '8',
40
+ cy: '11.25',
41
+ fill: 'currentColor',
42
+ r: '0.75',
43
+ }),
44
+ ),
45
+ check: symbol(
46
+ createElement('path', {
47
+ d: 'm3.5 8.25 2.75 2.75L12.5 4.75',
48
+ fill: 'none',
49
+ stroke: 'currentColor',
50
+ strokeLinecap: 'round',
51
+ strokeLinejoin: 'round',
52
+ strokeWidth: '1.5',
53
+ }),
54
+ ),
55
+ chevronDown: symbol(
56
+ createElement('path', {
57
+ d: 'm3.75 6.25 4.25 4 4.25-4',
58
+ fill: 'none',
59
+ stroke: 'currentColor',
60
+ strokeLinecap: 'round',
61
+ strokeLinejoin: 'round',
62
+ strokeWidth: '1.5',
63
+ }),
64
+ ),
65
+ chevronVertical: symbol(
66
+ createElement('path', {
67
+ d: 'm3.75 6.5 4.25-4 4.25 4',
68
+ fill: 'none',
69
+ stroke: 'currentColor',
70
+ strokeLinecap: 'round',
71
+ strokeLinejoin: 'round',
72
+ strokeWidth: '1.5',
73
+ }),
74
+ createElement('path', {
75
+ d: 'm3.75 9.5 4.25 4 4.25-4',
76
+ fill: 'none',
77
+ stroke: 'currentColor',
78
+ strokeLinecap: 'round',
79
+ strokeLinejoin: 'round',
80
+ strokeWidth: '1.5',
81
+ }),
82
+ ),
83
+ chevronUp: symbol(
84
+ createElement('path', {
85
+ d: 'm3.75 9.75 4.25-4 4.25 4',
86
+ fill: 'none',
87
+ stroke: 'currentColor',
88
+ strokeLinecap: 'round',
89
+ strokeLinejoin: 'round',
90
+ strokeWidth: '1.5',
91
+ }),
92
+ ),
93
+ chevronRight: symbol(
94
+ createElement('path', {
95
+ d: 'm6 4 4 4-4 4',
96
+ fill: 'none',
97
+ stroke: 'currentColor',
98
+ strokeLinecap: 'round',
99
+ strokeLinejoin: 'round',
100
+ strokeWidth: '1.5',
101
+ }),
102
+ ),
103
+ close: symbol(
104
+ createElement('path', {
105
+ d: 'm4.5 4.5 7 7m0-7-7 7',
106
+ fill: 'none',
107
+ stroke: 'currentColor',
108
+ strokeLinecap: 'round',
109
+ strokeWidth: '1.5',
110
+ }),
111
+ ),
112
+ copy: symbol(
113
+ createElement('rect', {
114
+ x: '5.25',
115
+ y: '3.25',
116
+ width: '7.5',
117
+ height: '7.5',
118
+ rx: '1.5',
119
+ fill: 'none',
120
+ stroke: 'currentColor',
121
+ strokeWidth: '1.5',
122
+ }),
123
+ createElement('path', {
124
+ d: 'M10.75 12.75h-5.5a2 2 0 0 1-2-2v-5.5',
125
+ fill: 'none',
126
+ stroke: 'currentColor',
127
+ strokeLinecap: 'round',
128
+ strokeLinejoin: 'round',
129
+ strokeWidth: '1.5',
130
+ }),
131
+ ),
132
+ edit: symbol(
133
+ createElement('path', {
134
+ d: 'm10.75 3.75 1.5 1.5',
135
+ fill: 'none',
136
+ stroke: 'currentColor',
137
+ strokeLinecap: 'round',
138
+ strokeLinejoin: 'round',
139
+ strokeWidth: '1.5',
140
+ }),
141
+ createElement('path', {
142
+ d: 'm4 12 2.5-.5 5.75-5.75a1.06 1.06 0 0 0 0-1.5l-.5-.5a1.06 1.06 0 0 0-1.5 0L4.5 9.5 4 12Z',
143
+ fill: 'none',
144
+ stroke: 'currentColor',
145
+ strokeLinejoin: 'round',
146
+ strokeWidth: '1.5',
147
+ }),
148
+ ),
149
+ expand: symbol(
150
+ createElement('path', {
151
+ d: 'M9.25 3.5h3.25v3.25',
152
+ fill: 'none',
153
+ stroke: 'currentColor',
154
+ strokeLinecap: 'round',
155
+ strokeLinejoin: 'round',
156
+ strokeWidth: '1.5',
157
+ }),
158
+ createElement('path', {
159
+ d: 'm12.5 3.5-5.5 5.5',
160
+ fill: 'none',
161
+ stroke: 'currentColor',
162
+ strokeLinecap: 'round',
163
+ strokeLinejoin: 'round',
164
+ strokeWidth: '1.5',
165
+ }),
166
+ createElement('path', {
167
+ d: 'M6.75 12.5H3.5V9.25',
168
+ fill: 'none',
169
+ stroke: 'currentColor',
170
+ strokeLinecap: 'round',
171
+ strokeLinejoin: 'round',
172
+ strokeWidth: '1.5',
173
+ }),
174
+ createElement('path', {
175
+ d: 'm3.5 12.5 5.5-5.5',
176
+ fill: 'none',
177
+ stroke: 'currentColor',
178
+ strokeLinecap: 'round',
179
+ strokeLinejoin: 'round',
180
+ strokeWidth: '1.5',
181
+ }),
182
+ ),
183
+ info: symbol(
184
+ createElement('circle', {
185
+ cx: '8',
186
+ cy: '8',
187
+ fill: 'none',
188
+ r: '5.75',
189
+ stroke: 'currentColor',
190
+ strokeWidth: '1.5',
191
+ }),
192
+ createElement('path', {
193
+ d: 'M8 7.25v3',
194
+ fill: 'none',
195
+ stroke: 'currentColor',
196
+ strokeLinecap: 'round',
197
+ strokeWidth: '1.5',
198
+ }),
199
+ createElement('circle', {
200
+ cx: '8',
201
+ cy: '5',
202
+ fill: 'currentColor',
203
+ r: '0.75',
204
+ }),
205
+ ),
206
+ menu: symbol(
207
+ createElement('path', {
208
+ d: 'M3 4.75h10M3 8h10M3 11.25h10',
209
+ fill: 'none',
210
+ stroke: 'currentColor',
211
+ strokeLinecap: 'round',
212
+ strokeWidth: '1.5',
213
+ }),
214
+ ),
215
+ open: symbol(
216
+ createElement('path', {
217
+ d: 'M6.25 4H4.5A1.5 1.5 0 0 0 3 5.5v6A1.5 1.5 0 0 0 4.5 13h6A1.5 1.5 0 0 0 12 11.5V9.75',
218
+ fill: 'none',
219
+ stroke: 'currentColor',
220
+ strokeLinecap: 'round',
221
+ strokeLinejoin: 'round',
222
+ strokeWidth: '1.5',
223
+ }),
224
+ createElement('path', {
225
+ d: 'M8 3h5v5',
226
+ fill: 'none',
227
+ stroke: 'currentColor',
228
+ strokeLinecap: 'round',
229
+ strokeLinejoin: 'round',
230
+ strokeWidth: '1.5',
231
+ }),
232
+ createElement('path', {
233
+ d: 'm13 3-6.25 6.25',
234
+ fill: 'none',
235
+ stroke: 'currentColor',
236
+ strokeLinecap: 'round',
237
+ strokeLinejoin: 'round',
238
+ strokeWidth: '1.5',
239
+ }),
240
+ ),
241
+ search: symbol(
242
+ createElement('circle', {
243
+ cx: '7',
244
+ cy: '7',
245
+ fill: 'none',
246
+ r: '4.25',
247
+ stroke: 'currentColor',
248
+ strokeWidth: '1.5',
249
+ }),
250
+ createElement('path', {
251
+ d: 'm10.25 10.25 3 3',
252
+ fill: 'none',
253
+ stroke: 'currentColor',
254
+ strokeLinecap: 'round',
255
+ strokeWidth: '1.5',
256
+ }),
257
+ ),
258
+ spinner: symbol(
259
+ createElement('circle', {
260
+ cx: '8',
261
+ cy: '8',
262
+ fill: 'none',
263
+ opacity: '0.24',
264
+ r: '5.25',
265
+ stroke: 'currentColor',
266
+ strokeWidth: '1.5',
267
+ }),
268
+ createElement('path', {
269
+ d: 'M8 2.75a5.25 5.25 0 0 1 5.25 5.25',
270
+ fill: 'none',
271
+ stroke: 'currentColor',
272
+ strokeLinecap: 'round',
273
+ strokeWidth: '1.5',
274
+ }),
275
+ ),
276
+ trash: symbol(
277
+ createElement('path', {
278
+ d: 'M3.75 4.75h8.5',
279
+ fill: 'none',
280
+ stroke: 'currentColor',
281
+ strokeLinecap: 'round',
282
+ strokeWidth: '1.5',
283
+ }),
284
+ createElement('path', {
285
+ d: 'M6.25 4.75V4a1 1 0 0 1 1-1h1.5a1 1 0 0 1 1 1v.75',
286
+ fill: 'none',
287
+ stroke: 'currentColor',
288
+ strokeLinecap: 'round',
289
+ strokeLinejoin: 'round',
290
+ strokeWidth: '1.5',
291
+ }),
292
+ createElement('path', {
293
+ d: 'm5 6.25.45 5.1A1.5 1.5 0 0 0 6.94 12.75h2.12a1.5 1.5 0 0 0 1.49-1.4L11 6.25',
294
+ fill: 'none',
295
+ stroke: 'currentColor',
296
+ strokeLinecap: 'round',
297
+ strokeLinejoin: 'round',
298
+ strokeWidth: '1.5',
299
+ }),
300
+ createElement('path', {
301
+ d: 'M7 7.25v3.5M9 7.25v3.5',
302
+ fill: 'none',
303
+ stroke: 'currentColor',
304
+ strokeLinecap: 'round',
305
+ strokeWidth: '1.5',
306
+ }),
307
+ ),
308
+ }
@@ -0,0 +1,121 @@
1
+ import { createGlyphSheet } from '../../../components/glyph/glyph.tsx'
2
+ import { createTheme } from '../../runtime.ts'
3
+
4
+ import { glyphValues } from './glyphs.tsx'
5
+
6
+ export const RMX_01 = createTheme({
7
+ space: {
8
+ none: '0px',
9
+ px: '1px',
10
+ xs: '4px',
11
+ sm: '8px',
12
+ md: '12px',
13
+ lg: '16px',
14
+ xl: '24px',
15
+ xxl: '32px',
16
+ },
17
+ radius: {
18
+ none: '0px',
19
+ sm: '4px',
20
+ md: '8px',
21
+ lg: '12px',
22
+ xl: '16px',
23
+ full: '9999px',
24
+ },
25
+ fontSize: {
26
+ xxxs: '10px',
27
+ xxs: '11px',
28
+ xs: '12px',
29
+ sm: '13px',
30
+ md: '14px',
31
+ lg: '16px',
32
+ xl: '20px',
33
+ xxl: '28px',
34
+ },
35
+ fontFamily: {
36
+ sans: '"Inter", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',
37
+ mono: 'ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace',
38
+ },
39
+ lineHeight: {
40
+ tight: '1.25',
41
+ normal: '1.45',
42
+ relaxed: '1.65',
43
+ },
44
+ letterSpacing: {
45
+ tight: '-0.03em',
46
+ normal: '0',
47
+ meta: '0.06em',
48
+ wide: '0.08em',
49
+ },
50
+ fontWeight: {
51
+ normal: '400',
52
+ medium: '500',
53
+ semibold: '600',
54
+ bold: '700',
55
+ },
56
+ control: {
57
+ height: {
58
+ sm: '28px',
59
+ md: '32px',
60
+ lg: '36px',
61
+ },
62
+ },
63
+ surface: {
64
+ lvl0: '#ffffff',
65
+ lvl1: '#f8f8f8',
66
+ lvl2: '#f5f5f5',
67
+ lvl3: '#f3f3f3',
68
+ lvl4: '#efefef',
69
+ },
70
+ shadow: {
71
+ xs: '0 1px 1px rgb(0 0 0 / 0.05)',
72
+ sm: '0 1px 2px rgb(0 0 0 / 0.07)',
73
+ md: '0 6px 18px rgb(0 0 0 / 0.08)',
74
+ lg: '0 16px 34px rgb(0 0 0 / 0.10)',
75
+ xl: '0 24px 52px rgb(0 0 0 / 0.14)',
76
+ },
77
+ colors: {
78
+ text: {
79
+ primary: '#151515',
80
+ secondary: '#4f4f4f',
81
+ muted: '#6d6d6d',
82
+ link: '#1A72FF',
83
+ },
84
+ border: {
85
+ subtle: '#e7e7e7',
86
+ default: '#d1d1d1',
87
+ strong: '#b0b0b0',
88
+ },
89
+ focus: {
90
+ ring: '#1A72FF',
91
+ },
92
+ overlay: {
93
+ scrim: 'rgb(0 0 0 / 0.28)',
94
+ },
95
+ action: {
96
+ primary: {
97
+ background: '#1A72FF',
98
+ backgroundHover: '#1463e0',
99
+ backgroundActive: '#0f55c9',
100
+ foreground: 'rgb(255 255 255 / 0.92)',
101
+ border: '#1A72FF',
102
+ },
103
+ secondary: {
104
+ background: '#ffffff',
105
+ backgroundHover: '#fbfbfb',
106
+ backgroundActive: '#f3f3f3',
107
+ foreground: '#202020',
108
+ border: '#d1d1d1',
109
+ },
110
+ danger: {
111
+ background: '#FF3000',
112
+ backgroundHover: '#e12b00',
113
+ backgroundActive: '#c52600',
114
+ foreground: 'rgb(255 255 255 / 0.92)',
115
+ border: '#FF3000',
116
+ },
117
+ },
118
+ },
119
+ })
120
+
121
+ export const RMX_01_GLYPHS = createGlyphSheet(glyphValues)