@pg-labs-incubator/cobweb 0.0.0-stage → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (320) hide show
  1. package/LICENSE +163 -0
  2. package/README.md +82 -2
  3. package/package.json +112 -3
  4. package/src/action/action.yaml +291 -0
  5. package/src/action/button-group.yaml +56 -0
  6. package/src/action/button.yaml +239 -0
  7. package/src/action/split-button.yaml +87 -0
  8. package/src/color/color.yaml +181 -0
  9. package/src/color/palette.yaml +147 -0
  10. package/src/container/card.yaml +170 -0
  11. package/src/container/corner-radius.yaml +50 -0
  12. package/src/container/elevation.yaml +19 -0
  13. package/src/design.yaml +41 -0
  14. package/src/feedback/feedback.yaml +225 -0
  15. package/src/icon/icon-font.yaml +28 -0
  16. package/src/icon/icon.yaml +31 -0
  17. package/src/input/date-picker.yaml +144 -0
  18. package/src/input/date-range-input.yaml +162 -0
  19. package/src/input/range-slider.yaml +161 -0
  20. package/src/input/select.yaml +230 -0
  21. package/src/input/slider.yaml +172 -0
  22. package/src/input/text-field.yaml +240 -0
  23. package/src/input/time-picker.yaml +220 -0
  24. package/src/motion/motion.yaml +371 -0
  25. package/src/navigation/app-bar.yaml +147 -0
  26. package/src/navigation/navigation.yaml +339 -0
  27. package/src/navigation/scroll.yaml +23 -0
  28. package/src/navigation/search.yaml +112 -0
  29. package/src/navigation/tabs.yaml +144 -0
  30. package/src/navigation/toolbar.yaml +130 -0
  31. package/src/selection/checkbox.yaml +162 -0
  32. package/src/selection/chip.yaml +219 -0
  33. package/src/selection/radio.yaml +125 -0
  34. package/src/selection/segmented-group.yaml +11 -0
  35. package/src/selection/segmented.yaml +69 -0
  36. package/src/selection/switch.yaml +209 -0
  37. package/src/spacing/measurement.yaml +80 -0
  38. package/src/state/state.yaml +38 -0
  39. package/src/surface/surface.yaml +483 -0
  40. package/src/text/line-height.yaml +144 -0
  41. package/src/text/typeface.yaml +31 -0
  42. package/src/text/typescale.yaml +726 -0
  43. package/target/esbuild/action/action.css +1 -0
  44. package/target/esbuild/action/base.jsx +1 -0
  45. package/target/esbuild/action/button.jsx +17 -0
  46. package/target/esbuild/action/fab-menu-context.jsx +1 -0
  47. package/target/esbuild/action/fab-menu.jsx +15 -0
  48. package/target/esbuild/action/fab.jsx +7 -0
  49. package/target/esbuild/action/group.jsx +22 -0
  50. package/target/esbuild/action/icon-button.jsx +5 -0
  51. package/target/esbuild/action/index.jsx +1 -0
  52. package/target/esbuild/action/split-button.jsx +12 -0
  53. package/target/esbuild/color/contrast.jsx +1 -0
  54. package/target/esbuild/color/dynamic.jsx +1 -0
  55. package/target/esbuild/color/hct.jsx +1 -0
  56. package/target/esbuild/color/index.css +1 -0
  57. package/target/esbuild/color/index.jsx +1 -0
  58. package/target/esbuild/color/palette.jsx +1 -0
  59. package/target/esbuild/color/scheme.jsx +1 -0
  60. package/target/esbuild/color/temperature.jsx +1 -0
  61. package/target/esbuild/container/card.css +1 -0
  62. package/target/esbuild/container/card.jsx +1 -0
  63. package/target/esbuild/container/elevation-shadow.css +1 -0
  64. package/target/esbuild/container/elevation-shadow.jsx +1 -0
  65. package/target/esbuild/container/index.jsx +1 -0
  66. package/target/esbuild/dom/client.jsx +1 -0
  67. package/target/esbuild/dom/index.jsx +1 -0
  68. package/target/esbuild/dom/server.jsx +1 -0
  69. package/target/esbuild/dom/types.jsx +1 -0
  70. package/target/esbuild/feedback/badge.jsx +15 -0
  71. package/target/esbuild/feedback/feedback.css +1 -0
  72. package/target/esbuild/feedback/focus.jsx +1 -0
  73. package/target/esbuild/feedback/index.jsx +1 -0
  74. package/target/esbuild/feedback/loading.jsx +7 -0
  75. package/target/esbuild/feedback/observe.jsx +1 -0
  76. package/target/esbuild/feedback/progress.jsx +35 -0
  77. package/target/esbuild/feedback/snackbar.jsx +23 -0
  78. package/target/esbuild/feedback/tooltip.jsx +24 -0
  79. package/target/esbuild/icon/icon.css +1 -0
  80. package/target/esbuild/icon/icon.jsx +1 -0
  81. package/target/esbuild/icon/index.jsx +1 -0
  82. package/target/esbuild/index.css +1 -0
  83. package/target/esbuild/index.jsx +1 -0
  84. package/target/esbuild/input/autocomplete.jsx +5 -0
  85. package/target/esbuild/input/base.jsx +4 -0
  86. package/target/esbuild/input/date-picker.css +1 -0
  87. package/target/esbuild/input/date-picker.jsx +104 -0
  88. package/target/esbuild/input/date-range-input.css +1 -0
  89. package/target/esbuild/input/date-time.jsx +21 -0
  90. package/target/esbuild/input/index.css +1 -0
  91. package/target/esbuild/input/index.jsx +1 -0
  92. package/target/esbuild/input/paired-input.jsx +1 -0
  93. package/target/esbuild/input/picker-dialog.css +1 -0
  94. package/target/esbuild/input/picker-dialog.jsx +14 -0
  95. package/target/esbuild/input/select.css +1 -0
  96. package/target/esbuild/input/select.jsx +63 -0
  97. package/target/esbuild/input/slider.css +1 -0
  98. package/target/esbuild/input/slider.jsx +51 -0
  99. package/target/esbuild/input/text-field.css +1 -0
  100. package/target/esbuild/input/text-field.jsx +67 -0
  101. package/target/esbuild/input/time-picker.css +1 -0
  102. package/target/esbuild/input/time-picker.jsx +29 -0
  103. package/target/esbuild/motion/frame.jsx +1 -0
  104. package/target/esbuild/motion/index.css +1 -0
  105. package/target/esbuild/motion/index.jsx +1 -0
  106. package/target/esbuild/motion/material.jsx +1 -0
  107. package/target/esbuild/motion/motion.jsx +1 -0
  108. package/target/esbuild/motion/spring.jsx +1 -0
  109. package/target/esbuild/motion/transition.css +1 -0
  110. package/target/esbuild/motion/transition.jsx +1 -0
  111. package/target/esbuild/motion/velocity.jsx +1 -0
  112. package/target/esbuild/navigation/app-bar.jsx +51 -0
  113. package/target/esbuild/navigation/base.jsx +1 -0
  114. package/target/esbuild/navigation/drawer.jsx +25 -0
  115. package/target/esbuild/navigation/index.jsx +1 -0
  116. package/target/esbuild/navigation/navigation.css +1 -0
  117. package/target/esbuild/navigation/navigation.jsx +29 -0
  118. package/target/esbuild/navigation/scroll.jsx +1 -0
  119. package/target/esbuild/navigation/search.jsx +29 -0
  120. package/target/esbuild/navigation/tabs.jsx +7 -0
  121. package/target/esbuild/navigation/toolbar.jsx +23 -0
  122. package/target/esbuild/selection/base.jsx +1 -0
  123. package/target/esbuild/selection/checkbox.jsx +14 -0
  124. package/target/esbuild/selection/chip.jsx +23 -0
  125. package/target/esbuild/selection/index.jsx +1 -0
  126. package/target/esbuild/selection/radio.jsx +9 -0
  127. package/target/esbuild/selection/segmented.jsx +15 -0
  128. package/target/esbuild/selection/selection.css +1 -0
  129. package/target/esbuild/selection/switch.jsx +14 -0
  130. package/target/esbuild/shape/corner-rounding.jsx +1 -0
  131. package/target/esbuild/shape/cubic.jsx +1 -0
  132. package/target/esbuild/shape/index.jsx +1 -0
  133. package/target/esbuild/shape/material-shapes.jsx +1 -0
  134. package/target/esbuild/shape/morph.jsx +1 -0
  135. package/target/esbuild/shape/path.jsx +1 -0
  136. package/target/esbuild/shape/point.jsx +1 -0
  137. package/target/esbuild/shape/rounded-polygon.jsx +1 -0
  138. package/target/esbuild/shape/shapes.jsx +1 -0
  139. package/target/esbuild/spacing/index.jsx +1 -0
  140. package/target/esbuild/state/component.css +1 -0
  141. package/target/esbuild/state/component.jsx +1 -0
  142. package/target/esbuild/state/controller.jsx +1 -0
  143. package/target/esbuild/state/index.jsx +1 -0
  144. package/target/esbuild/state/ripple.jsx +1 -0
  145. package/target/esbuild/state/state.jsx +1 -0
  146. package/target/esbuild/state/style.jsx +1 -0
  147. package/target/esbuild/surface/carousel-layout.jsx +1 -0
  148. package/target/esbuild/surface/carousel.css +1 -0
  149. package/target/esbuild/surface/carousel.jsx +10 -0
  150. package/target/esbuild/surface/dialog.jsx +35 -0
  151. package/target/esbuild/surface/divider.jsx +1 -0
  152. package/target/esbuild/surface/drag.jsx +1 -0
  153. package/target/esbuild/surface/gestures.css +1 -0
  154. package/target/esbuild/surface/gestures.jsx +7 -0
  155. package/target/esbuild/surface/index.css +1 -0
  156. package/target/esbuild/surface/index.jsx +1 -0
  157. package/target/esbuild/surface/interactive.jsx +1 -0
  158. package/target/esbuild/surface/list-patterns.jsx +26 -0
  159. package/target/esbuild/surface/list.css +1 -0
  160. package/target/esbuild/surface/list.jsx +9 -0
  161. package/target/esbuild/surface/menu.css +1 -0
  162. package/target/esbuild/surface/menu.jsx +12 -0
  163. package/target/esbuild/surface/scaffold.jsx +47 -0
  164. package/target/esbuild/surface/sheet.jsx +21 -0
  165. package/target/esbuild/surface/side-sheet.jsx +17 -0
  166. package/target/esbuild/surface/slots.jsx +1 -0
  167. package/target/esbuild/surface/surface.css +1 -0
  168. package/target/esbuild/surface/surface.jsx +1 -0
  169. package/target/esbuild/text/index.css +1 -0
  170. package/target/esbuild/text/index.jsx +1 -0
  171. package/target/esbuild/text/text.css +1 -0
  172. package/target/esbuild/text/text.jsx +3 -0
  173. package/target/esbuild/text/typography.css +1 -0
  174. package/target/esbuild/text/typography.jsx +1 -0
  175. package/target/esbuild/util/box-side.jsx +1 -0
  176. package/target/esbuild/util/debug.jsx +1 -0
  177. package/target/esbuild/util/dom.jsx +1 -0
  178. package/target/esbuild/util/event.jsx +1 -0
  179. package/target/esbuild/util/index.jsx +1 -0
  180. package/target/esbuild/util/preconditions.jsx +1 -0
  181. package/target/esbuild/util/reactive.jsx +1 -0
  182. package/target/tsc/action/action.css.d.ts +3 -0
  183. package/target/tsc/action/base.d.ts +211 -0
  184. package/target/tsc/action/button.d.ts +126 -0
  185. package/target/tsc/action/fab-menu-context.d.ts +16 -0
  186. package/target/tsc/action/fab-menu.d.ts +112 -0
  187. package/target/tsc/action/fab.d.ts +98 -0
  188. package/target/tsc/action/group.d.ts +166 -0
  189. package/target/tsc/action/icon-button.d.ts +79 -0
  190. package/target/tsc/action/index.d.ts +24 -0
  191. package/target/tsc/action/split-button.d.ts +78 -0
  192. package/target/tsc/color/contrast.d.ts +48 -0
  193. package/target/tsc/color/dynamic.d.ts +203 -0
  194. package/target/tsc/color/hct.d.ts +114 -0
  195. package/target/tsc/color/index.css.d.ts +3 -0
  196. package/target/tsc/color/index.d.ts +23 -0
  197. package/target/tsc/color/palette.d.ts +30 -0
  198. package/target/tsc/color/scheme.d.ts +446 -0
  199. package/target/tsc/color/temperature.d.ts +24 -0
  200. package/target/tsc/container/card.css.d.ts +3 -0
  201. package/target/tsc/container/card.d.ts +110 -0
  202. package/target/tsc/container/elevation-shadow.css.d.ts +3 -0
  203. package/target/tsc/container/elevation-shadow.d.ts +23 -0
  204. package/target/tsc/container/index.d.ts +44 -0
  205. package/target/tsc/dom/client.d.ts +387 -0
  206. package/target/tsc/dom/index.d.ts +93 -0
  207. package/target/tsc/dom/server.d.ts +65 -0
  208. package/target/tsc/dom/types.d.ts +134 -0
  209. package/target/tsc/feedback/badge.d.ts +116 -0
  210. package/target/tsc/feedback/feedback.css.d.ts +3 -0
  211. package/target/tsc/feedback/focus.d.ts +20 -0
  212. package/target/tsc/feedback/index.d.ts +17 -0
  213. package/target/tsc/feedback/loading.d.ts +194 -0
  214. package/target/tsc/feedback/observe.d.ts +75 -0
  215. package/target/tsc/feedback/progress.d.ts +281 -0
  216. package/target/tsc/feedback/snackbar.d.ts +398 -0
  217. package/target/tsc/feedback/tooltip.d.ts +326 -0
  218. package/target/tsc/icon/icon.css.d.ts +3 -0
  219. package/target/tsc/icon/icon.d.ts +69 -0
  220. package/target/tsc/icon/index.d.ts +13 -0
  221. package/target/tsc/index.css.d.ts +3 -0
  222. package/target/tsc/index.d.ts +7 -0
  223. package/target/tsc/input/autocomplete.d.ts +119 -0
  224. package/target/tsc/input/base.d.ts +282 -0
  225. package/target/tsc/input/date-picker.css.d.ts +3 -0
  226. package/target/tsc/input/date-picker.d.ts +351 -0
  227. package/target/tsc/input/date-range-input.css.d.ts +3 -0
  228. package/target/tsc/input/date-time.d.ts +171 -0
  229. package/target/tsc/input/index.css.d.ts +3 -0
  230. package/target/tsc/input/index.d.ts +27 -0
  231. package/target/tsc/input/paired-input.d.ts +435 -0
  232. package/target/tsc/input/picker-dialog.css.d.ts +3 -0
  233. package/target/tsc/input/picker-dialog.d.ts +84 -0
  234. package/target/tsc/input/select.css.d.ts +3 -0
  235. package/target/tsc/input/select.d.ts +267 -0
  236. package/target/tsc/input/slider.css.d.ts +3 -0
  237. package/target/tsc/input/slider.d.ts +372 -0
  238. package/target/tsc/input/text-field.css.d.ts +3 -0
  239. package/target/tsc/input/text-field.d.ts +415 -0
  240. package/target/tsc/input/time-picker.css.d.ts +3 -0
  241. package/target/tsc/input/time-picker.d.ts +212 -0
  242. package/target/tsc/motion/frame.d.ts +36 -0
  243. package/target/tsc/motion/index.css.d.ts +3 -0
  244. package/target/tsc/motion/index.d.ts +34 -0
  245. package/target/tsc/motion/material.d.ts +110 -0
  246. package/target/tsc/motion/motion.d.ts +235 -0
  247. package/target/tsc/motion/spring.d.ts +223 -0
  248. package/target/tsc/motion/transition.css.d.ts +3 -0
  249. package/target/tsc/motion/transition.d.ts +597 -0
  250. package/target/tsc/motion/velocity.d.ts +54 -0
  251. package/target/tsc/navigation/app-bar.d.ts +473 -0
  252. package/target/tsc/navigation/base.d.ts +331 -0
  253. package/target/tsc/navigation/drawer.d.ts +301 -0
  254. package/target/tsc/navigation/index.d.ts +25 -0
  255. package/target/tsc/navigation/navigation.css.d.ts +3 -0
  256. package/target/tsc/navigation/navigation.d.ts +537 -0
  257. package/target/tsc/navigation/scroll.d.ts +218 -0
  258. package/target/tsc/navigation/search.d.ts +332 -0
  259. package/target/tsc/navigation/tabs.d.ts +497 -0
  260. package/target/tsc/navigation/toolbar.d.ts +248 -0
  261. package/target/tsc/selection/base.d.ts +100 -0
  262. package/target/tsc/selection/checkbox.d.ts +194 -0
  263. package/target/tsc/selection/chip.d.ts +358 -0
  264. package/target/tsc/selection/index.d.ts +21 -0
  265. package/target/tsc/selection/radio.d.ts +198 -0
  266. package/target/tsc/selection/segmented.d.ts +333 -0
  267. package/target/tsc/selection/selection.css.d.ts +3 -0
  268. package/target/tsc/selection/switch.d.ts +165 -0
  269. package/target/tsc/shape/corner-rounding.d.ts +36 -0
  270. package/target/tsc/shape/cubic.d.ts +215 -0
  271. package/target/tsc/shape/index.d.ts +35 -0
  272. package/target/tsc/shape/material-shapes.d.ts +176 -0
  273. package/target/tsc/shape/morph.d.ts +91 -0
  274. package/target/tsc/shape/path.d.ts +177 -0
  275. package/target/tsc/shape/point.d.ts +165 -0
  276. package/target/tsc/shape/rounded-polygon.d.ts +289 -0
  277. package/target/tsc/shape/shapes.d.ts +76 -0
  278. package/target/tsc/spacing/index.d.ts +19 -0
  279. package/target/tsc/state/component.css.d.ts +3 -0
  280. package/target/tsc/state/component.d.ts +276 -0
  281. package/target/tsc/state/controller.d.ts +257 -0
  282. package/target/tsc/state/index.d.ts +19 -0
  283. package/target/tsc/state/ripple.d.ts +50 -0
  284. package/target/tsc/state/state.d.ts +129 -0
  285. package/target/tsc/state/style.d.ts +22 -0
  286. package/target/tsc/surface/carousel-layout.d.ts +212 -0
  287. package/target/tsc/surface/carousel.css.d.ts +3 -0
  288. package/target/tsc/surface/carousel.d.ts +231 -0
  289. package/target/tsc/surface/dialog.d.ts +582 -0
  290. package/target/tsc/surface/divider.d.ts +92 -0
  291. package/target/tsc/surface/drag.d.ts +92 -0
  292. package/target/tsc/surface/gestures.css.d.ts +3 -0
  293. package/target/tsc/surface/gestures.d.ts +292 -0
  294. package/target/tsc/surface/index.css.d.ts +3 -0
  295. package/target/tsc/surface/index.d.ts +29 -0
  296. package/target/tsc/surface/interactive.d.ts +22 -0
  297. package/target/tsc/surface/list-patterns.d.ts +384 -0
  298. package/target/tsc/surface/list.css.d.ts +3 -0
  299. package/target/tsc/surface/list.d.ts +340 -0
  300. package/target/tsc/surface/menu.css.d.ts +3 -0
  301. package/target/tsc/surface/menu.d.ts +590 -0
  302. package/target/tsc/surface/scaffold.d.ts +337 -0
  303. package/target/tsc/surface/sheet.d.ts +384 -0
  304. package/target/tsc/surface/side-sheet.d.ts +183 -0
  305. package/target/tsc/surface/slots.d.ts +21 -0
  306. package/target/tsc/surface/surface.css.d.ts +3 -0
  307. package/target/tsc/surface/surface.d.ts +192 -0
  308. package/target/tsc/text/index.css.d.ts +3 -0
  309. package/target/tsc/text/index.d.ts +18 -0
  310. package/target/tsc/text/text.css.d.ts +3 -0
  311. package/target/tsc/text/text.d.ts +94 -0
  312. package/target/tsc/text/typography.css.d.ts +3 -0
  313. package/target/tsc/text/typography.d.ts +82 -0
  314. package/target/tsc/util/box-side.d.ts +76 -0
  315. package/target/tsc/util/debug.d.ts +20 -0
  316. package/target/tsc/util/dom.d.ts +35 -0
  317. package/target/tsc/util/event.d.ts +93 -0
  318. package/target/tsc/util/index.d.ts +12 -0
  319. package/target/tsc/util/preconditions.d.ts +79 -0
  320. package/target/tsc/util/reactive.d.ts +36 -0
@@ -0,0 +1,110 @@
1
+ import type { JSX } from "solid-js";
2
+ import type { DomProps } from "..";
3
+ import type { InteractableComponent } from "../state";
4
+ import "./elevation-shadow.css";
5
+ import "./card.css";
6
+ /**
7
+ * {@link Card} component properties.
8
+ */
9
+ export type CardProps = DomProps<HTMLDivElement, Omit<JSX.HTMLElementTags["div"], "aria-disabled" | "role" | "tabindex">> & {
10
+ /**
11
+ * Card is disabled.
12
+ *
13
+ * When `true`, interaction, if any, with the card is disabled.
14
+ *
15
+ * @defaultValue `false`
16
+ */
17
+ disabled?: boolean;
18
+ /**
19
+ * Card represents a single button action.
20
+ *
21
+ * Enable this only when the entire card is one action and its children contain no links,
22
+ * buttons, or other interactive controls. Cards containing secondary actions should leave this
23
+ * disabled and give those actions their own native semantics.
24
+ *
25
+ * When `true`, the card is exposed as an ARIA button, is keyboard activatable, and is also
26
+ * {@link CardProps.pressable | pressable}.
27
+ *
28
+ * @defaultValue `false`
29
+ */
30
+ button?: boolean;
31
+ /**
32
+ * Card can be dragged.
33
+ *
34
+ * When `true`, the {@link ../state#DragState | drag} state is {@link
35
+ * ../state#InteractableController.setEnabledInteractionStates | enabled} for the rendered
36
+ * card, which raises the card to its dragged elevation and shows the dragged state layer while
37
+ * the primary pointer drags it. The card does not move itself; the application moves it, for
38
+ * example while the drag state is entered, as reported by `onInteractionStateEntered` and
39
+ * `onInteractionStateExited`. Touch drags compete with native scrolling, unless the application
40
+ * restricts `touch-action` of the card.
41
+ *
42
+ * @defaultValue `false`
43
+ */
44
+ draggable?: boolean;
45
+ /**
46
+ * Card has pressable interaction styling.
47
+ *
48
+ * When `true`, the {@link ../state#FocusState | focus}, {@link ../state#HoverState |
49
+ * hover}, and {@link ../state#PressState | press} states are {@link
50
+ * ../state#InteractableController.setEnabledInteractionStates | enabled} for the rendered
51
+ * card. This property does not assign an accessibility role or make the card a keyboard action;
52
+ * use {@link CardProps.button | `button`} for a card that represents one button action.
53
+ *
54
+ * @defaultValue `false`
55
+ */
56
+ pressable?: boolean;
57
+ /**
58
+ * Sequential focus index.
59
+ */
60
+ tabIndex?: number;
61
+ /**
62
+ * Card design theme.
63
+ *
64
+ * This controls the design theme applied to the rendered card. The standard `"elevated"`,
65
+ * `"filled"`, and `"outlined"` themes apply `elevated`, `filled`, and `outlined` themes,
66
+ * respectively.
67
+ *
68
+ * @defaultValue `"filled"`
69
+ */
70
+ design?: "elevated" | "filled" | "outlined";
71
+ };
72
+ /**
73
+ * Card container component.
74
+ *
75
+ * Cards contain content, and optional actions, for a single subject. Cards support standard design
76
+ * themes controlled using {@link CardProps.design | `props.design`}.
77
+ *
78
+ * # States
79
+ *
80
+ * Cards are optionally interactable, depending on whether {@link CardProps.pressable |
81
+ * `props.pressable`} is `true` or not. When `props.pressable` is `true`, the card may be
82
+ * interacted with in terms of the {@link FocusState | focus}, {@link HoverState | hover}, and
83
+ * {@link PressState | press} states. A card representing a single button action should instead
84
+ * set {@link CardProps.button | `props.button`}; cards containing links, buttons, or other
85
+ * actions must not use button semantics on their container. Independently, a card the
86
+ * application can drag sets {@link CardProps.draggable | `props.draggable`} to enter the {@link
87
+ * DragState | drag} state while dragged.
88
+ *
89
+ * Additionally, cards can enter into a disabled state, controlled through {@link
90
+ * CardProps.disabled | `props.disabled`}. When `props.disabled` is `true`, the disabled design
91
+ * styling is applied, along with `pointer-events` and `user-select` being assigned to `none`.
92
+ *
93
+ * # Design
94
+ *
95
+ * Card design is controlled through the [`cw-Card`](./card.yaml) component design attribute. The
96
+ * design theme a card is rendered with can be controlled using {@link CardProps.design |
97
+ * `props.design`}. Content inherits the content color paired with the container color, which is
98
+ * dimmed while the card is disabled.
99
+ *
100
+ * When a card is {@link CardProps.disabled | disabled}, the `cw-Card-disabled` is added to the
101
+ * card element. Likewise, when non-disabled {@link CardProps.pressable | pressable} or {@link
102
+ * CardProps.draggable | draggable} cards are interacted with, `cw-Card-<state>` class is added
103
+ * to the card element, where `<state>` is the name of the interaction state the card entered
104
+ * into. Note that interaction state classes are added and removed based on their precedence, see
105
+ * {@link InteractionState} for more information.
106
+ *
107
+ * @param props - component properties
108
+ * @returns rendered element
109
+ */
110
+ export declare const Card: InteractableComponent<CardProps>;
@@ -0,0 +1,3 @@
1
+ // SPDX-License-Identifier: MPL-2.0
2
+
3
+ export {};
@@ -0,0 +1,23 @@
1
+ import "./elevation-shadow.css";
2
+ /**
3
+ * Name of CSS class which applies elevation styling, in terms of a shadow.
4
+ *
5
+ * When applied to an element, the `box-shadow` property is used to apply an elevation shadow,
6
+ * based on configured elevation shadow properties. The element is expected to define the following
7
+ * CSS properties.
8
+ *
9
+ * | Property | Description |
10
+ * | ---------------------------- | ------------------------------------------------------------- |
11
+ * | `--cw-elevationShadow-color` | A `<color>` value to use for drawing elevation shadow. If not specified, defaults to `--cw-Color-shadow`. |
12
+ * | `--cw-elevationShadow-level` | A `<number>` value between `0` (no elevation) and `5` (highest elevation). When `0`, no elevation shadow is drawn. Any other positive value will draw an elevation shadow, where a value of `5` will draw the largest elevation shadow. If not specified, this defaults to `1`. |
13
+ *
14
+ * Levels are those of the [`cw-Elevation`](./elevation.yaml) design attribute; values between
15
+ * two levels draw an intermediate shadow, such that transitions between levels are continuous.
16
+ *
17
+ * The defaults have no specificity, so any rule assigning either property takes precedence over
18
+ * them, regardless of stylesheet order. These properties cannot be inherited by child elements.
19
+ * Both of these properties support transitions, as such, if either can change, and a motion is
20
+ * required, then they should be included within `transition-property`; otherwise, `box-shadow`
21
+ * itself could also be added to `transition-property`.
22
+ */
23
+ export declare const ELEVATION_SHADOW_CSS_CLASS: string;
@@ -0,0 +1,44 @@
1
+ /**
2
+ * Container component definitions.
3
+ *
4
+ * This module defines components for containing other components, as well as components and
5
+ * styles for visual separation between components.
6
+ *
7
+ * # Elevation
8
+ *
9
+ * Elevation shadow around containers, using elevation levels defined by the
10
+ * [`cw-Elevation`](./elevation.yaml) system design attribute, can be implemented for a container
11
+ * by applying the elevation shadow {@link ./elevation-shadow#ELEVATION_SHADOW_CSS_CLASS | CSS
12
+ * class} to the respective container.
13
+ *
14
+ * # Cards
15
+ *
16
+ * [Card](https://m3.material.io/components/cards/overview) containers are used to contain content,
17
+ * with optional actions, for a single subject. Material 3 defines three card themes, `elevated`,
18
+ * `filled`, and `outlined`, which are implemented by {@link ./card#Card} through {@link
19
+ * ./card#CardProps.design | `props.design`}.
20
+ *
21
+ * All card designs support elevation, with only the elevated design having a resting elevation.
22
+ * Additionally, cards are {@link ../state#InteractableComponent | interactable}, with no
23
+ * interaction {@link ../state#InteractionState | state} enabled by default. See {@link
24
+ * ./card#Card} for more information.
25
+ *
26
+ * ```tsx
27
+ * import type { JSX } from "solid-js";
28
+ *
29
+ * import { Card } from "@pg-labs-incubator/cobweb/container";
30
+ *
31
+ * export default function(): JSX.Element {
32
+ * return <>
33
+ * <Card design="elevated">Elevated Card</Card>
34
+ * <Card design="filled">Filled Card</Card>
35
+ * <Card design="outlined">Outlined Card</Card>
36
+ * </>;
37
+ * }
38
+ * ```
39
+ *
40
+ * @packageDocumentation
41
+ */
42
+ export type { CardProps } from "./card";
43
+ export { Card } from "./card";
44
+ export { ELEVATION_SHADOW_CSS_CLASS } from "./elevation-shadow";
@@ -0,0 +1,387 @@
1
+ import type { Accessor, JSX } from "solid-js";
2
+ import type { DomProps, FunctionElement, StyleElement } from "./types";
3
+ declare module "solid-js/web" {
4
+ function assign(node: Element, props: object, isSVG: boolean, skipChildren: boolean, prevProps: object, skipRef: boolean): void;
5
+ }
6
+ /**
7
+ * DOM component properties accepted by a {@link ..#defineDomComponent | defined} component.
8
+ *
9
+ * @typeParam P - base component properties
10
+ */
11
+ export type ClientDomProps<P extends DomProps> = P & {
12
+ /**
13
+ * Reference to client-side DOM controller.
14
+ *
15
+ * When the component is constructed in a client environment, this is invoked with the
16
+ * constructed controller, *before* the component is rendered. This is **not** invoked during
17
+ * server rendering.
18
+ *
19
+ * @remarks
20
+ * This is **not** reactive.
21
+ */
22
+ readonly controllerRef?: (cont: DomController<P>) => void;
23
+ };
24
+ /**
25
+ * DOM element rendering component.
26
+ *
27
+ * DOM components are guaranteed to render a DOM element, possibly reactively. Components which
28
+ * support transitions, the component may return an array of DOM elements, of which the last
29
+ * element is the element which will persist after the transition.
30
+ *
31
+ * These components render two types of elements, a style and function element. The element
32
+ * returned is *always* the style element, while {@link DomProps.ref | `props.ref`} is updated
33
+ * with the function element. Style element is responsible for applying component style. The
34
+ * function element, however, *may* be the style element *or* an element within the sub-tree of
35
+ * the style element. Function element provide user-interface functions the component provides.
36
+ * For example, a component providing user input functions would likely have an `input` element
37
+ * as its function element and may have an outer `div` container, serving as the style element.
38
+ *
39
+ * This distinction is important in order to determine which properties are applied to which
40
+ * element. See {@link DomProps} for more information.
41
+ *
42
+ * @typeParam P - component {@link DomProps | properties} type
43
+ * @param props - component properties
44
+ * @returns style element or style element accessor
45
+ * @see {@link DomProps}
46
+ * @see {@link StyleElement}
47
+ * @see {@link ./index#defineDomComponent}
48
+ */
49
+ export type DomComponent<P extends DomProps> = (props: ClientDomProps<P>) => JSX.Element;
50
+ /**
51
+ * DOM component {@link DomController | controller} options.
52
+ *
53
+ * These optional options are used to construct a controller instance.
54
+ */
55
+ export interface DomControllerOptions {
56
+ /**
57
+ * Function element is static.
58
+ *
59
+ * @defaultValue `true` if, and only if, {@link
60
+ * DomControllerOptions.styleElementIsFunction | `styleElementIsFunction`} is `true` *and*
61
+ * {@link DomController.render} does not return an accessor; otherwise, `false`
62
+ * @see {@link DomController.isFunctionElementStatic}
63
+ */
64
+ functionElementIsStatic?: boolean;
65
+ /**
66
+ * Component has no distinct function element.
67
+ *
68
+ * When `true`, the style element returned by {@link DomController.render} is used as
69
+ * the function element.
70
+ *
71
+ * @defaultValue `false`
72
+ * @see {@link DomController.isFunctionElementStyle}
73
+ */
74
+ styleElementIsFunction?: boolean;
75
+ }
76
+ /**
77
+ * {@link DomController.readProps | Read} DOM properties.
78
+ *
79
+ * This evaluates to a mapping of read DOM properties `K`. Each property `Ki` in `K` has two
80
+ * additional properties, `${Ki}Changed` and `${Ki}Previous` for whether the property value has
81
+ * changed since its last observed value and its last observed value, respectively.
82
+ *
83
+ * @typeParam P - component properties type
84
+ * @typeParam K - read properties type
85
+ * @see {@link DomController.readProps}
86
+ */
87
+ export type ReadProps<P extends DomProps, K extends (keyof P)[]> = Pick<P, K[number]> & {
88
+ [C in K[number] as C extends string ? `${C}Changed` : never]: boolean;
89
+ } & {
90
+ [C in K[number] as C extends string ? `${C}Previous` : never]: P[C] | undefined;
91
+ };
92
+ /**
93
+ * Client-side controller of a DOM {@link DomComponent | component}.
94
+ *
95
+ * Instances of this control the state of a component instance, with respect to the {@link
96
+ * DomProps | properties} the component is constructed with. Based on properties, the state of the
97
+ * function and style elements is updated. The base implementation of this controls all {@link
98
+ * DomEventHandlerProps | event handler}, {@link ./types#DomAttributes | attributes}, and {@link
99
+ * ./types#BaseDomProps | base} component properties, implementations are expected to control their
100
+ * local component properties, if any.
101
+ *
102
+ * Implementations are required to implement the {@link DomController.render} method. This method
103
+ * must return a style element or style element accessor. Additionally, the function reference
104
+ * the method is invoked with, if any, must be used to update the function element reference of
105
+ * the controller.
106
+ *
107
+ * A controller maintains a reference to the {@link DomController.styleElement | style} and {@link
108
+ * DomController.functionElement | function} elements of the component. As the style and function
109
+ * elements are rendered, including when the elements change, the respective elements are updated
110
+ * based on the controller defined state.
111
+ *
112
+ * Implementations must override {@link DomController.applyComponentProps} to control their local
113
+ * component properties. This method is invoked in a tracking context, as such, when properties,
114
+ * accessed during an invocation, change, the method will be invoked again. Properties must be
115
+ * accessed using {@link DomController.readProp}. The `readProp` method tracks the last observed
116
+ * value, and allows the caller to determine if the value has changed from its last observed value.
117
+ *
118
+ * Based on property changes, implementations can apply {@link DomController.setAttribute |
119
+ * attributes}, CSS {@link DomController.setClass | classes}, and inline CSS {@link
120
+ * DomController.setStyle | style}. When style or function elements change, if at all, the applied
121
+ * attributes, CSS classes, and inline CSS style are applied to the new element.
122
+ *
123
+ * @typeParam P - component properties type
124
+ * @see {@link ./index#defineDomComponent}
125
+ */
126
+ export declare abstract class DomController<P extends DomProps = DomProps> {
127
+ #private;
128
+ /**
129
+ * Underlying component properties.
130
+ *
131
+ * Avoid accessing this directly, instead use {@link DomController.readProp | `readProp()`}.
132
+ */
133
+ readonly props: P;
134
+ /**
135
+ * Construct a new DOM controller.
136
+ *
137
+ * @param props - owning component properties
138
+ * @param opts - controller options
139
+ */
140
+ constructor(props: P, opts?: DomControllerOptions);
141
+ /**
142
+ * Release controller-owned resources when the component owner is disposed.
143
+ *
144
+ * Subclasses which retain document-level resources should override this method and invoke
145
+ * `super.onControllerCleanup()` after releasing their own resources.
146
+ */
147
+ protected onControllerCleanup(): void;
148
+ /**
149
+ * Read value of a property.
150
+ *
151
+ * This reads the last observed and current values of a property, identified by `key`.
152
+ * If the last observed value is not strictly equal to the current value, then this
153
+ * returns a tuple of current value, `true`, and last observed value, respectively;
154
+ * otherwise, this returns a tuple of the last observed value and `false`, respectively.
155
+ * When tracked in a tracking context, the property access for `key` will result in a
156
+ * dependency edge between the access and the property.
157
+ *
158
+ * Note, however, when `onlyObserved` is `true` this does *not* access the property at
159
+ * all, instead, this returns the last observed value, if any, followed by `false`,
160
+ * respectively. Thus, when `onlyObserved` is `true`, an invocation of this will *not*
161
+ * result in a dependency edge when invoked within a tracking context.
162
+ *
163
+ * @typeParam K - property key type
164
+ * @param key - property key to read value of
165
+ * @param onlyObserved - `true` if, and only if, only last observed value should be
166
+ * returned
167
+ * @returns tuple of current value, `true`, and last observed value, or, tuple of
168
+ * last observed value and `false`
169
+ */
170
+ readProp<K extends keyof P>(key: K, onlyObserved?: boolean): [
171
+ P[K],
172
+ false
173
+ ] | [P[K], true, P[K] | undefined];
174
+ /**
175
+ * Read zero or more property values.
176
+ *
177
+ * This {@link DomController.readProp | reads} each property specified in `props`, and
178
+ * returns an object containing, for each property `Ki`:
179
+ *
180
+ * 1. `Ki` is set to the current or last observed value of the `Ki` if the value has or
181
+ * has not changed, respectively.
182
+ *
183
+ * 2. `${Ki}Changed` is set to `true` or `false` if the property value has changed.
184
+ *
185
+ * 3. `${Ki}Previous` is set to the last observed value if, and only if, the value has
186
+ * changed.
187
+ *
188
+ * @typeParam K - property keys type
189
+ * @param props - property keys to read
190
+ * @param onlyObserved - `true` if, and only if, only last observed value should be
191
+ * returned
192
+ * @returns read properties
193
+ */
194
+ readProps<K extends (keyof P)[]>(props: K, onlyObserved?: boolean): ReadProps<P, K>;
195
+ /**
196
+ * Consume possibly static property values.
197
+ *
198
+ * This {@link ../util#consumeProps | consumes} properties underlying this controller. See
199
+ * {@link ../util#consumeProps} for more information.
200
+ *
201
+ * @typeParam KO - optional property keys type
202
+ * @typeParam KR - required property keys type
203
+ * @param optKeys - optional keys to consume
204
+ * @param reqKeys - required keys to consume
205
+ * @returns resulting object with consumed property values
206
+ */
207
+ consumeProps<KO extends (keyof P)[], KR extends (keyof P)[]>(optKeys: KO, reqKeys?: KR): (Partial<Pick<P, KO[number]>> & Pick<P, KR[number]>);
208
+ /**
209
+ * Component style element.
210
+ *
211
+ * The element returned, if any, is the element to which the component applies its
212
+ * styling.
213
+ *
214
+ * @returns rendered style element or `null` if an element is not rendered
215
+ */
216
+ get styleElement(): StyleElement | null;
217
+ /**
218
+ * Component function element.
219
+ *
220
+ * The element returned, if any, is the element which applies the user-facing function of
221
+ * the component.
222
+ *
223
+ * @returns rendered function element or `null` if an element is not rendered
224
+ */
225
+ get functionElement(): FunctionElement<P> | null;
226
+ /**
227
+ * {@link DomController.functionElement | Function} element cannot change once rendered.
228
+ *
229
+ * @returns `true` if, and only if, function element cannot be modified after initial
230
+ * render
231
+ * @see {@link DomControllerOptions.functionElementIsStatic}
232
+ */
233
+ isFunctionElementStatic(): boolean;
234
+ /**
235
+ * {@link DomController.styleElement | Style} element cannot change once rendered.
236
+ *
237
+ * This returns `true` *only* after component is {@link DomController.render | rendered}
238
+ * *and* the rendered style element is reactive.
239
+ *
240
+ * @returns `true` if, and only if, style element cannot be modified after initial render
241
+ */
242
+ isStyleElementStatic(): boolean;
243
+ /**
244
+ * {@link DomController.functionElement | Function} element and {@link
245
+ * DomController.styleElement | style} element are the same element.
246
+ *
247
+ * If this returns `true`, then it's guaranteed that {@link DomController.functionElement |
248
+ * `functionElement`} and {@link DomController.styleElement | `styleElement`} return the
249
+ * same value.
250
+ *
251
+ * @returns `true` if, and only if, component has no distinct function element and the
252
+ * style element provides the component function
253
+ * @see {@link DomControllerOptions.styleElementIsFunction}
254
+ */
255
+ isFunctionElementStyle(): boolean;
256
+ /**
257
+ * Assign style to {@link DomController.styleElement | style} element.
258
+ *
259
+ * If `value` is `undefined`, then the style declaration for `name` is removed from the
260
+ * style element; otherwise, `value` is set for the style property `name`. When a style
261
+ * element has not yet rendered, the resulting style declaration is noted and applied
262
+ * when a style element is rendered.
263
+ *
264
+ * @param name - name of style property to assign
265
+ * @param value - value to assign to or `undefined` to remove assignment
266
+ */
267
+ setStyle(name: string, value?: number | string | undefined): void;
268
+ /**
269
+ * Add, replace, or remove CSS class applied to {@link DomController.styleElement | style}
270
+ * element.
271
+ *
272
+ * If `name` is `undefined`, then the previous class set for `key` is removed from the
273
+ * style element, if any. If `key` was previously mapped to a class, the previously applied
274
+ * class is replaced with `name`; otherwise, `name` is applied to the style element and set
275
+ * as the class applied for `key`. `name` may also list several CSS classes, separated by
276
+ * whitespace, which are then added, replaced, or removed together.
277
+ *
278
+ * @param key - styling key to add, replace, or remove CSS class for
279
+ * @param name - name of CSS class, or whitespace-separated names of CSS classes, to add or
280
+ * replace, or, an empty string or `undefined` to remove class
281
+ * @throws {@link Error} `key` is equal to `name`
282
+ */
283
+ setClass(key: string, name?: string | undefined): void;
284
+ /**
285
+ * Add or remove CSS class applied to {@link DomController.styleElement | style} element.
286
+ *
287
+ * This adds or removes the CSS class `name` to or from the style element based on whether
288
+ * `add` is `true` or `false`, respectively. `name` may also list several CSS classes,
289
+ * separated by whitespace, which are then added or removed together.
290
+ *
291
+ * @param name - name of CSS class, or whitespace-separated names of CSS classes, to add or
292
+ * remove
293
+ * @param add - `true` or `false` if class should be added or removed, respectively
294
+ */
295
+ setClass(name: string, add: boolean): void;
296
+ /**
297
+ * Assign attribute to {@link DomController.functionElement | function} element.
298
+ *
299
+ * The attribute is assigned to the value {@link ../util#attributeValueOf | resolved} for
300
+ * `value`. If `value` is a `boolean`, then a value of `true` assigns the attribute `name` to
301
+ * an empty string; otherwise, a `false` value removes the attribute assignment. ARIA and
302
+ * enumerated attributes, such as `aria-expanded` or `draggable`, are an exception, and are
303
+ * instead assigned the keyword of the respective state, such as `"true"` or `"false"`.
304
+ * Additionally, an `undefined` or `null` value also removes the attribute assignment. All
305
+ * other values are converted to a `string` value, which is then assigned to the function
306
+ * element.
307
+ *
308
+ * If a function element is not yet present, then the attribute assignment is deferred
309
+ * until a function element is rendered, while an `undefined` or `null` value cancels the
310
+ * deferred assignment, if any.
311
+ *
312
+ * @param name - name of attribute to assign
313
+ * @param value - value to assign to
314
+ * @see {@link ../util#attributeValueOf}
315
+ */
316
+ setAttribute(name: string, value?: boolean | number | string | undefined): void;
317
+ /**
318
+ * Apply component updates from properties.
319
+ *
320
+ * This is invoked in a reactive tracking context to apply updates from non-DOM component
321
+ * properties. Implementations may override this to apply updates from properties not
322
+ * directly defined by {@link DomProps}. Component properties should be accessed using
323
+ * {@link DomController.readProp}.
324
+ *
325
+ * @remarks
326
+ * It is guaranteed that the {@link DomController.styleElement | style} element will be
327
+ * non-`null` when this is *first* invoked.
328
+ */
329
+ protected applyComponentProps(): void;
330
+ /**
331
+ * Render DOM elements.
332
+ *
333
+ * This is invoked, at most *once*, when the component, which owns this controller, is
334
+ * first initialized. This must render the style and function elements of the component.
335
+ * This should always render DOM elements without reactive attributes. Instead, reactive
336
+ * attributes should be controlled through this controller.
337
+ *
338
+ * The style element must be returned, while the function element must be specified using
339
+ * `funcRef`. This may return a DOM element as the style element, or a reactive {@link
340
+ * Accessor | accessor} which returns the style DOM element. When a reactive accessor is
341
+ * returned, it must return the same DOM element for every invocation, until the
342
+ * underlying reactive state changes.
343
+ *
344
+ * If a DOM element is returned, it is assumed the style element is static and cannot be
345
+ * changed. This results in some additional optimizations. If this controller was
346
+ * configured for a {@link DomControllerOptions.functionElementIsStatic | static} function
347
+ * element, then `funcRef`, if specified, may be invoked at most once.
348
+ *
349
+ * The `funcRef` function is guaranteed to be defined when this controller was *not*
350
+ * configured with an {@link DomControllerOptions.styleElementIsFunction | function
351
+ * identity}. If the controller was configured with a function identity, then the style
352
+ * element returned is used as the function element.
353
+ *
354
+ * @param children - nested children
355
+ * @param funcRef - function to invoke with function element
356
+ * @returns style element or style element accessor
357
+ */
358
+ protected abstract render(children: JSX.Element, funcRef?: (elem: FunctionElement<P>) => void): Accessor<JSX.Element> | JSX.Element;
359
+ /**
360
+ * Handle style element change.
361
+ *
362
+ * This is invoked whenever the style element changes, *before* the {@link
363
+ * DomController.styleElement | style} element is updated. The new style element, if any,
364
+ * is supplied in `curr`.
365
+ *
366
+ * @param curr - new style element, if any
367
+ */
368
+ protected onStyleElementChanged(curr: StyleElement | null): void;
369
+ /**
370
+ * Handle function element change.
371
+ *
372
+ * This is invoked whenever the function element changes, *before* the {@link
373
+ * DomController.functionElement | function} element is updated. The new function element,
374
+ * if any, is supplied in `curr`.
375
+ *
376
+ * @param curr - new function element, if any
377
+ */
378
+ protected onFunctionElementChanged(curr: FunctionElement<P> | null): void;
379
+ }
380
+ /**
381
+ * Define a new client-side DOM {@link DomComponent | component}.
382
+ *
383
+ * @typeParam P - component properties type
384
+ * @param supp - controller constructor provider
385
+ * @returns resulting component
386
+ */
387
+ export declare function defineClientDomComponent<P extends DomProps>(supp: (Controller: typeof DomController) => (new (props: P) => DomController<P>)): DomComponent<P>;
@@ -0,0 +1,93 @@
1
+ /**
2
+ * DOM component definitions.
3
+ *
4
+ * @packageDocumentation
5
+ */
6
+ export type { BaseDomProps, DomAttributes, DomEventHandlerProps, DomProps, DomTag, FunctionElement, PickDomAttributes, StyleElement } from "./types";
7
+ export type { ClientDomProps, DomComponent, DomController, DomControllerOptions, ReadProps } from "./client";
8
+ export type { ElementDomProps, PickLocalDomProps, RenderServerDom } from "./server";
9
+ import type { DomComponent, DomController } from "./client";
10
+ import type { RenderServerDom } from "./server";
11
+ import type { DomProps } from "./types";
12
+ /**
13
+ * Define a new DOM {@link DomComponent | component} in terms of a render function and controller.
14
+ *
15
+ * This defines a new component which uses the render function, returned by `server`, or {@link
16
+ * DomController | controller}, returned by `client` for rendering DOM elements in a server or
17
+ * client -side environment, respectively. When invoked in a server or client -side environment,
18
+ * `server` or `client` is invoked **once** to return the respective render function or controller
19
+ * implementation, respectively.
20
+ *
21
+ * The server-side render function is expected to return a DOM element with {@link
22
+ * ./server#ElementDomProps | element} and {@link ./server#PickLocalDomProps | local} component
23
+ * properties it is invoked with, respectively. The element and local component properties are
24
+ * {@link solid-js#splitProps | split} from the properties the component is invoked with. The
25
+ * element returned must match, structurally, the element {@link DomController.render | rendered}
26
+ * by the client-side controller implementation, returned by `client`.
27
+ *
28
+ * The client-side controller implementation, returned by `client`, must accept component
29
+ * properties, returning a new controller implementation instance. The controller implementation
30
+ * must render structurally the same DOM as what the server-side render function renders, creating
31
+ * the elements in the same order, since hydration identifies each element by the order in which it
32
+ * is created. The server-side render function must therefore not read a slot property, such as
33
+ * `children`, before it creates the element the slot is nested within; see {@link RenderServerDom}.
34
+ * State of the component must be controlled using the controller. The controller need only track
35
+ * state with respect to its local properties. Properties defined directly by {@link DomProps} are
36
+ * managed automatically by the base controller.
37
+ *
38
+ * The component returned accepts a `controllerRef` parameter, which, when component is constructed
39
+ * within client environment, is invoked with the controller instance of the component.
40
+ *
41
+ * ```tsx
42
+ * import type { DomComponent, DomProps } from "@pg-labs-incubator/cobweb";
43
+ * import type { JSX } from "solid-js";
44
+ *
45
+ * import { defineDomComponent } from "@pg-labs-incubator/cobweb";
46
+ *
47
+ * export type MyProps = DomProps<HTMLSpanElement, JSX.HTMLElementTags["span"]> & {
48
+ * size?: "large" | "medium" | "small";
49
+ * };
50
+ *
51
+ * export const MyComponent: DomComponent<MyProps> = defineDomComponent(
52
+ * // Render on server-side:
53
+ * () => (elemProps, localProps) => <span
54
+ * {...elemProps}
55
+ * classList={{
56
+ * ...elemProps.classList,
57
+ * [`MyComponent-size-${localProps.size ?? "small"}`]: true,
58
+ * "MyComponent": true
59
+ * }}
60
+ * />,
61
+ * // Render on client-side:
62
+ * (Base) => class extends Base<MyProps> {
63
+ * constructor(props: MyProps) {
64
+ * super(props, {
65
+ * // Our style element is our function element; without this, we would need to
66
+ * // include the function reference.
67
+ * styleElementIsFunction: true
68
+ * });
69
+ * }
70
+ *
71
+ * protected override applyComponentProps(): void {
72
+ * // Invoked in a reactive context. When `size` changes, we'll get invoked again.
73
+ * const [size, sizeChanged] = super.readProp("size");
74
+ *
75
+ * if (sizeChanged) {
76
+ * // `size` changed, update the style
77
+ * super.setClass("size", `MyComponent-size-${size ?? "small"}`);
78
+ * }
79
+ * }
80
+ *
81
+ * protected override render(children: JSX.Element): JSX.Element {
82
+ * return <span class="MyComponent">{children}</span>;
83
+ * }
84
+ * }
85
+ * );
86
+ * ```
87
+ *
88
+ * @typeParam P - component properties type
89
+ * @param server - server-side DOM render function supplier
90
+ * @param client - client-side DOM controller implementation provider
91
+ * @returns resulting component
92
+ */
93
+ export declare const defineDomComponent: <P extends DomProps>(server: () => RenderServerDom<P>, client: (Controller: typeof DomController) => (new (props: P) => DomController<P>)) => DomComponent<P>;