@vexcms/core 0.0.20 → 0.1.0-alpha.3

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 (323) hide show
  1. package/LICENSE +202 -0
  2. package/dist/.build +1 -0
  3. package/dist/access/buildChecks.d.ts +58 -0
  4. package/dist/access/buildChecks.d.ts.map +1 -0
  5. package/dist/access/canAccessAdminPanel.d.ts +53 -0
  6. package/dist/access/canAccessAdminPanel.d.ts.map +1 -0
  7. package/dist/access/compileConstraints.d.ts +155 -0
  8. package/dist/access/compileConstraints.d.ts.map +1 -0
  9. package/dist/access/config.d.ts +62 -0
  10. package/dist/access/config.d.ts.map +1 -0
  11. package/dist/access/constants.d.ts +95 -0
  12. package/dist/access/constants.d.ts.map +1 -0
  13. package/dist/access/constraintTypes.d.ts +337 -0
  14. package/dist/access/constraintTypes.d.ts.map +1 -0
  15. package/dist/access/createAccessQueryBuilder.d.ts +59 -0
  16. package/dist/access/createAccessQueryBuilder.d.ts.map +1 -0
  17. package/dist/access/createFilterConstraintBuilder.d.ts +26 -0
  18. package/dist/access/createFilterConstraintBuilder.d.ts.map +1 -0
  19. package/dist/access/createIndexConstraintBuilder.d.ts +40 -0
  20. package/dist/access/createIndexConstraintBuilder.d.ts.map +1 -0
  21. package/dist/access/hasPermission.d.ts +85 -0
  22. package/dist/access/hasPermission.d.ts.map +1 -0
  23. package/dist/access/index.d.ts +13 -0
  24. package/dist/access/index.d.ts.map +1 -0
  25. package/dist/access/pickQueryIndex.d.ts +42 -0
  26. package/dist/access/pickQueryIndex.d.ts.map +1 -0
  27. package/dist/access/resolveAccessRule.d.ts +85 -0
  28. package/dist/access/resolveAccessRule.d.ts.map +1 -0
  29. package/dist/access/types.d.ts +738 -0
  30. package/dist/access/types.d.ts.map +1 -0
  31. package/dist/access/validateAccessConstraints.d.ts +57 -0
  32. package/dist/access/validateAccessConstraints.d.ts.map +1 -0
  33. package/dist/api/client.d.ts +20 -0
  34. package/dist/api/client.d.ts.map +1 -0
  35. package/dist/api/client.js +117 -0
  36. package/dist/api/client.js.map +1 -0
  37. package/dist/api/convex.d.ts +296 -0
  38. package/dist/api/convex.d.ts.map +1 -0
  39. package/dist/api/create/client.d.ts +50 -0
  40. package/dist/api/create/client.d.ts.map +1 -0
  41. package/dist/api/create/server.d.ts +43 -0
  42. package/dist/api/create/server.d.ts.map +1 -0
  43. package/dist/api/depth.d.ts +39 -0
  44. package/dist/api/depth.d.ts.map +1 -0
  45. package/dist/api/find/client.d.ts +90 -0
  46. package/dist/api/find/client.d.ts.map +1 -0
  47. package/dist/api/find/server.d.ts +73 -0
  48. package/dist/api/find/server.d.ts.map +1 -0
  49. package/dist/api/get/client.d.ts +56 -0
  50. package/dist/api/get/client.d.ts.map +1 -0
  51. package/dist/api/get/server.d.ts +49 -0
  52. package/dist/api/get/server.d.ts.map +1 -0
  53. package/dist/api/globals/find.client.d.ts +20 -0
  54. package/dist/api/globals/find.client.d.ts.map +1 -0
  55. package/dist/api/globals/find.server.d.ts +29 -0
  56. package/dist/api/globals/find.server.d.ts.map +1 -0
  57. package/dist/api/globals/get.client.d.ts +46 -0
  58. package/dist/api/globals/get.client.d.ts.map +1 -0
  59. package/dist/api/globals/get.server.d.ts +55 -0
  60. package/dist/api/globals/get.server.d.ts.map +1 -0
  61. package/dist/api/globals/types.d.ts +65 -0
  62. package/dist/api/globals/types.d.ts.map +1 -0
  63. package/dist/api/globals/upsert.client.d.ts +24 -0
  64. package/dist/api/globals/upsert.client.d.ts.map +1 -0
  65. package/dist/api/globals/upsert.server.d.ts +47 -0
  66. package/dist/api/globals/upsert.server.d.ts.map +1 -0
  67. package/dist/api/populate.d.ts +23 -0
  68. package/dist/api/populate.d.ts.map +1 -0
  69. package/dist/api/remove/client.d.ts +58 -0
  70. package/dist/api/remove/client.d.ts.map +1 -0
  71. package/dist/api/remove/server.d.ts +65 -0
  72. package/dist/api/remove/server.d.ts.map +1 -0
  73. package/dist/api/search/client.d.ts +58 -0
  74. package/dist/api/search/client.d.ts.map +1 -0
  75. package/dist/api/search/server.d.ts +54 -0
  76. package/dist/api/search/server.d.ts.map +1 -0
  77. package/dist/api/server.d.ts +370 -0
  78. package/dist/api/server.d.ts.map +1 -0
  79. package/dist/api/server.js +33 -0
  80. package/dist/api/server.js.map +1 -0
  81. package/dist/api/types.d.ts +525 -0
  82. package/dist/api/types.d.ts.map +1 -0
  83. package/dist/api/update/client.d.ts +53 -0
  84. package/dist/api/update/client.d.ts.map +1 -0
  85. package/dist/api/update/server.d.ts +47 -0
  86. package/dist/api/update/server.d.ts.map +1 -0
  87. package/dist/api/utils.d.ts +57 -0
  88. package/dist/api/utils.d.ts.map +1 -0
  89. package/dist/auth/mergeCollections.d.ts +28 -0
  90. package/dist/auth/mergeCollections.d.ts.map +1 -0
  91. package/dist/auth/types.d.ts +84 -0
  92. package/dist/auth/types.d.ts.map +1 -0
  93. package/dist/chunk-2DU7JDEX.js +1877 -0
  94. package/dist/chunk-2DU7JDEX.js.map +1 -0
  95. package/dist/chunk-2IB2DCN7.js +75 -0
  96. package/dist/chunk-2IB2DCN7.js.map +1 -0
  97. package/dist/collections/config.d.ts +28 -0
  98. package/dist/collections/config.d.ts.map +1 -0
  99. package/dist/collections/constants.d.ts +27 -0
  100. package/dist/collections/constants.d.ts.map +1 -0
  101. package/dist/collections/index.d.ts +7 -0
  102. package/dist/collections/index.d.ts.map +1 -0
  103. package/dist/collections/indexFields.d.ts +20 -0
  104. package/dist/collections/indexFields.d.ts.map +1 -0
  105. package/dist/collections/interfaceGen.d.ts +59 -0
  106. package/dist/collections/interfaceGen.d.ts.map +1 -0
  107. package/dist/collections/internal/index.d.ts +2 -0
  108. package/dist/collections/internal/index.d.ts.map +1 -0
  109. package/dist/collections/types.d.ts +282 -0
  110. package/dist/collections/types.d.ts.map +1 -0
  111. package/dist/collections/utils.d.ts +71 -0
  112. package/dist/collections/utils.d.ts.map +1 -0
  113. package/dist/collections/validator.d.ts +73 -0
  114. package/dist/collections/validator.d.ts.map +1 -0
  115. package/dist/config/config.d.ts +43 -0
  116. package/dist/config/config.d.ts.map +1 -0
  117. package/dist/config/index.d.ts +5 -0
  118. package/dist/config/index.d.ts.map +1 -0
  119. package/dist/config/sanitizeConfig.d.ts +82 -0
  120. package/dist/config/sanitizeConfig.d.ts.map +1 -0
  121. package/dist/config/types.d.ts +316 -0
  122. package/dist/config/types.d.ts.map +1 -0
  123. package/dist/fields/array/config.d.ts +57 -0
  124. package/dist/fields/array/config.d.ts.map +1 -0
  125. package/dist/fields/array/index.d.ts +5 -0
  126. package/dist/fields/array/index.d.ts.map +1 -0
  127. package/dist/fields/array/inputSchema.d.ts +32 -0
  128. package/dist/fields/array/inputSchema.d.ts.map +1 -0
  129. package/dist/fields/array/types.d.ts +127 -0
  130. package/dist/fields/array/types.d.ts.map +1 -0
  131. package/dist/fields/array/validator.d.ts +30 -0
  132. package/dist/fields/array/validator.d.ts.map +1 -0
  133. package/dist/fields/baseTypes.d.ts +251 -0
  134. package/dist/fields/baseTypes.d.ts.map +1 -0
  135. package/dist/fields/blocks/config.d.ts +63 -0
  136. package/dist/fields/blocks/config.d.ts.map +1 -0
  137. package/dist/fields/blocks/index.d.ts +5 -0
  138. package/dist/fields/blocks/index.d.ts.map +1 -0
  139. package/dist/fields/blocks/inputSchema.d.ts +22 -0
  140. package/dist/fields/blocks/inputSchema.d.ts.map +1 -0
  141. package/dist/fields/blocks/types.d.ts +253 -0
  142. package/dist/fields/blocks/types.d.ts.map +1 -0
  143. package/dist/fields/blocks/validator.d.ts +32 -0
  144. package/dist/fields/blocks/validator.d.ts.map +1 -0
  145. package/dist/fields/checkbox/config.d.ts +46 -0
  146. package/dist/fields/checkbox/config.d.ts.map +1 -0
  147. package/dist/fields/checkbox/index.d.ts +5 -0
  148. package/dist/fields/checkbox/index.d.ts.map +1 -0
  149. package/dist/fields/checkbox/inputSchema.d.ts +27 -0
  150. package/dist/fields/checkbox/inputSchema.d.ts.map +1 -0
  151. package/dist/fields/checkbox/types.d.ts +67 -0
  152. package/dist/fields/checkbox/types.d.ts.map +1 -0
  153. package/dist/fields/checkbox/validator.d.ts +34 -0
  154. package/dist/fields/checkbox/validator.d.ts.map +1 -0
  155. package/dist/fields/color/config.d.ts +49 -0
  156. package/dist/fields/color/config.d.ts.map +1 -0
  157. package/dist/fields/color/convert.d.ts +72 -0
  158. package/dist/fields/color/convert.d.ts.map +1 -0
  159. package/dist/fields/color/formats.d.ts +38 -0
  160. package/dist/fields/color/formats.d.ts.map +1 -0
  161. package/dist/fields/color/index.d.ts +8 -0
  162. package/dist/fields/color/index.d.ts.map +1 -0
  163. package/dist/fields/color/inputSchema.d.ts +29 -0
  164. package/dist/fields/color/inputSchema.d.ts.map +1 -0
  165. package/dist/fields/color/types.d.ts +100 -0
  166. package/dist/fields/color/types.d.ts.map +1 -0
  167. package/dist/fields/color/utils.d.ts +100 -0
  168. package/dist/fields/color/utils.d.ts.map +1 -0
  169. package/dist/fields/color/validator.d.ts +27 -0
  170. package/dist/fields/color/validator.d.ts.map +1 -0
  171. package/dist/fields/constants.d.ts +108 -0
  172. package/dist/fields/constants.d.ts.map +1 -0
  173. package/dist/fields/date/config.d.ts +57 -0
  174. package/dist/fields/date/config.d.ts.map +1 -0
  175. package/dist/fields/date/index.d.ts +5 -0
  176. package/dist/fields/date/index.d.ts.map +1 -0
  177. package/dist/fields/date/inputSchema.d.ts +29 -0
  178. package/dist/fields/date/inputSchema.d.ts.map +1 -0
  179. package/dist/fields/date/types.d.ts +147 -0
  180. package/dist/fields/date/types.d.ts.map +1 -0
  181. package/dist/fields/date/validator.d.ts +34 -0
  182. package/dist/fields/date/validator.d.ts.map +1 -0
  183. package/dist/fields/group/config.d.ts +47 -0
  184. package/dist/fields/group/config.d.ts.map +1 -0
  185. package/dist/fields/group/index.d.ts +5 -0
  186. package/dist/fields/group/index.d.ts.map +1 -0
  187. package/dist/fields/group/inputSchema.d.ts +27 -0
  188. package/dist/fields/group/inputSchema.d.ts.map +1 -0
  189. package/dist/fields/group/types.d.ts +105 -0
  190. package/dist/fields/group/types.d.ts.map +1 -0
  191. package/dist/fields/group/validator.d.ts +41 -0
  192. package/dist/fields/group/validator.d.ts.map +1 -0
  193. package/dist/fields/index.d.ts +20 -0
  194. package/dist/fields/index.d.ts.map +1 -0
  195. package/dist/fields/inputSchemas/index.d.ts +23 -0
  196. package/dist/fields/inputSchemas/index.d.ts.map +1 -0
  197. package/dist/fields/inputSchemas/utils.d.ts +25 -0
  198. package/dist/fields/inputSchemas/utils.d.ts.map +1 -0
  199. package/dist/fields/interfaceGen.d.ts +15 -0
  200. package/dist/fields/interfaceGen.d.ts.map +1 -0
  201. package/dist/fields/number/config.d.ts +48 -0
  202. package/dist/fields/number/config.d.ts.map +1 -0
  203. package/dist/fields/number/index.d.ts +5 -0
  204. package/dist/fields/number/index.d.ts.map +1 -0
  205. package/dist/fields/number/inputSchema.d.ts +23 -0
  206. package/dist/fields/number/inputSchema.d.ts.map +1 -0
  207. package/dist/fields/number/types.d.ts +100 -0
  208. package/dist/fields/number/types.d.ts.map +1 -0
  209. package/dist/fields/number/validator.d.ts +39 -0
  210. package/dist/fields/number/validator.d.ts.map +1 -0
  211. package/dist/fields/relationship/config.d.ts +45 -0
  212. package/dist/fields/relationship/config.d.ts.map +1 -0
  213. package/dist/fields/relationship/index.d.ts +5 -0
  214. package/dist/fields/relationship/index.d.ts.map +1 -0
  215. package/dist/fields/relationship/inputSchema.d.ts +31 -0
  216. package/dist/fields/relationship/inputSchema.d.ts.map +1 -0
  217. package/dist/fields/relationship/types.d.ts +126 -0
  218. package/dist/fields/relationship/types.d.ts.map +1 -0
  219. package/dist/fields/relationship/validator.d.ts +27 -0
  220. package/dist/fields/relationship/validator.d.ts.map +1 -0
  221. package/dist/fields/select/config.d.ts +59 -0
  222. package/dist/fields/select/config.d.ts.map +1 -0
  223. package/dist/fields/select/index.d.ts +5 -0
  224. package/dist/fields/select/index.d.ts.map +1 -0
  225. package/dist/fields/select/inputSchema.d.ts +28 -0
  226. package/dist/fields/select/inputSchema.d.ts.map +1 -0
  227. package/dist/fields/select/types.d.ts +89 -0
  228. package/dist/fields/select/types.d.ts.map +1 -0
  229. package/dist/fields/select/validator.d.ts +31 -0
  230. package/dist/fields/select/validator.d.ts.map +1 -0
  231. package/dist/fields/text/config.d.ts +48 -0
  232. package/dist/fields/text/config.d.ts.map +1 -0
  233. package/dist/fields/text/index.d.ts +5 -0
  234. package/dist/fields/text/index.d.ts.map +1 -0
  235. package/dist/fields/text/inputSchema.d.ts +24 -0
  236. package/dist/fields/text/inputSchema.d.ts.map +1 -0
  237. package/dist/fields/text/types.d.ts +132 -0
  238. package/dist/fields/text/types.d.ts.map +1 -0
  239. package/dist/fields/text/validator.d.ts +39 -0
  240. package/dist/fields/text/validator.d.ts.map +1 -0
  241. package/dist/fields/types.d.ts +135 -0
  242. package/dist/fields/types.d.ts.map +1 -0
  243. package/dist/fields/upload/config.d.ts +24 -0
  244. package/dist/fields/upload/config.d.ts.map +1 -0
  245. package/dist/fields/upload/index.d.ts +5 -0
  246. package/dist/fields/upload/index.d.ts.map +1 -0
  247. package/dist/fields/upload/inputSchema.d.ts +17 -0
  248. package/dist/fields/upload/inputSchema.d.ts.map +1 -0
  249. package/dist/fields/upload/types.d.ts +78 -0
  250. package/dist/fields/upload/types.d.ts.map +1 -0
  251. package/dist/fields/upload/validator.d.ts +16 -0
  252. package/dist/fields/upload/validator.d.ts.map +1 -0
  253. package/dist/fields/url/config.d.ts +49 -0
  254. package/dist/fields/url/config.d.ts.map +1 -0
  255. package/dist/fields/url/index.d.ts +5 -0
  256. package/dist/fields/url/index.d.ts.map +1 -0
  257. package/dist/fields/url/inputSchema.d.ts +31 -0
  258. package/dist/fields/url/inputSchema.d.ts.map +1 -0
  259. package/dist/fields/url/types.d.ts +70 -0
  260. package/dist/fields/url/types.d.ts.map +1 -0
  261. package/dist/fields/url/validator.d.ts +37 -0
  262. package/dist/fields/url/validator.d.ts.map +1 -0
  263. package/dist/fields/utils.d.ts +47 -0
  264. package/dist/fields/utils.d.ts.map +1 -0
  265. package/dist/fields/validators/index.d.ts +23 -0
  266. package/dist/fields/validators/index.d.ts.map +1 -0
  267. package/dist/fields/validators/utils.d.ts +24 -0
  268. package/dist/fields/validators/utils.d.ts.map +1 -0
  269. package/dist/framework.d.ts +227 -0
  270. package/dist/framework.d.ts.map +1 -0
  271. package/dist/globals/config/config.d.ts +1 -0
  272. package/dist/globals/config/config.d.ts.map +1 -0
  273. package/dist/globals/config/types.d.ts +1 -0
  274. package/dist/globals/config/types.d.ts.map +1 -0
  275. package/dist/globals/config.d.ts +47 -0
  276. package/dist/globals/config.d.ts.map +1 -0
  277. package/dist/globals/index.d.ts +5 -0
  278. package/dist/globals/index.d.ts.map +1 -0
  279. package/dist/globals/interfaceGen.d.ts +33 -0
  280. package/dist/globals/interfaceGen.d.ts.map +1 -0
  281. package/dist/globals/types.d.ts +175 -0
  282. package/dist/globals/types.d.ts.map +1 -0
  283. package/dist/globals/utils.d.ts +37 -0
  284. package/dist/globals/utils.d.ts.map +1 -0
  285. package/dist/index.d.ts +15 -3165
  286. package/dist/index.d.ts.map +1 -0
  287. package/dist/index.js +2101 -3475
  288. package/dist/index.js.map +1 -1
  289. package/dist/media/api/index.d.ts +5 -0
  290. package/dist/media/api/index.d.ts.map +1 -0
  291. package/dist/media/api/mutations.d.ts +76 -0
  292. package/dist/media/api/mutations.d.ts.map +1 -0
  293. package/dist/media/api/queries.d.ts +28 -0
  294. package/dist/media/api/queries.d.ts.map +1 -0
  295. package/dist/media/api/server.d.ts +68 -0
  296. package/dist/media/api/server.d.ts.map +1 -0
  297. package/dist/media/api/types.d.ts +171 -0
  298. package/dist/media/api/types.d.ts.map +1 -0
  299. package/dist/media/config.d.ts +25 -0
  300. package/dist/media/config.d.ts.map +1 -0
  301. package/dist/media/index.d.ts +6 -0
  302. package/dist/media/index.d.ts.map +1 -0
  303. package/dist/media/types.d.ts +332 -0
  304. package/dist/media/types.d.ts.map +1 -0
  305. package/dist/media/utils.d.ts +35 -0
  306. package/dist/media/utils.d.ts.map +1 -0
  307. package/dist/media/validators.d.ts +61 -0
  308. package/dist/media/validators.d.ts.map +1 -0
  309. package/dist/schema/generateVexSchema.d.ts +36 -0
  310. package/dist/schema/generateVexSchema.d.ts.map +1 -0
  311. package/dist/schema/index.d.ts +3 -0
  312. package/dist/schema/index.d.ts.map +1 -0
  313. package/dist/schema/migrate.d.ts +73 -0
  314. package/dist/schema/migrate.d.ts.map +1 -0
  315. package/dist/types/generateVexTypes.d.ts +41 -0
  316. package/dist/types/generateVexTypes.d.ts.map +1 -0
  317. package/dist/types/generated.d.ts +382 -0
  318. package/dist/types/generated.d.ts.map +1 -0
  319. package/dist/types/index.d.ts +5 -0
  320. package/dist/types/index.d.ts.map +1 -0
  321. package/dist/utils.d.ts +57 -0
  322. package/dist/utils.d.ts.map +1 -0
  323. package/package.json +67 -24
@@ -0,0 +1 @@
1
+ {"version":3,"file":"formats.d.ts","sourceRoot":"","sources":["../../../src/fields/color/formats.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,eAAO,MAAM,aAAa;;;QAGtB,iFAAiF;;;;;QAKjF,oDAAoD;;;;;QAMpD,0DAA0D;;;;;QAM1D,kEAAkE;;;CAI5D,CAAC;AAEX,6FAA6F;AAC7F,MAAM,MAAM,WAAW,GAAG,CAAC,OAAO,aAAa,CAAC,CAAC,MAAM,OAAO,aAAa,CAAC,CAAC,QAAQ,CAAC,CAAC;AAEvF,gEAAgE;AAChE,eAAO,MAAM,qBAAqB,UAAqD,CAAC;AAExF,oFAAoF;AACpF,eAAO,MAAM,iBAAiB,QAA8B,CAAC"}
@@ -0,0 +1,8 @@
1
+ export * from "./config";
2
+ export * from "./convert";
3
+ export * from "./formats";
4
+ export * from "./types";
5
+ export * from "./utils";
6
+ export * from "./validator";
7
+ export * from "./inputSchema";
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/fields/color/index.ts"],"names":[],"mappings":"AACA,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC"}
@@ -0,0 +1,29 @@
1
+ import { type ZodType } from "zod";
2
+ import { ColorField } from "./types";
3
+ /**
4
+ * Builds a Zod schema for validating a colour field value in the admin form.
5
+ *
6
+ * Accepts hex, `rgb()`, `hsl()` and `oklch()` notation — plus `var(--token)`
7
+ * when the field enables `themeColors`. Required fields add a `.min(1)` check so
8
+ * an empty field reports "required" rather than a notation complaint. Optional
9
+ * fields accept the empty string, since `color()` defaults `defaultValue` to
10
+ * `""` and a cleared picker must round-trip.
11
+ *
12
+ * @param props - Input props.
13
+ * @param props.field - The resolved colour field definition.
14
+ * @returns A Zod string schema. Optional fields are wrapped in `.optional()` by
15
+ * `applyBaseInputSchemaMeta` and carry `.default(field.defaultValue)`.
16
+ *
17
+ * @example
18
+ * ```ts
19
+ * // Required — rejects "", "#fff" and "var(--primary)"
20
+ * colorFieldToInputSchema({ field: color({ required: true }) })
21
+ *
22
+ * // themeColors — additionally accepts "var(--primary)"
23
+ * colorFieldToInputSchema({ field: color({ required: true, themeColors: true }) })
24
+ * ```
25
+ */
26
+ export declare function colorFieldToInputSchema(props: {
27
+ field: ColorField;
28
+ }): ZodType;
29
+ //# sourceMappingURL=inputSchema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"inputSchema.d.ts","sourceRoot":"","sources":["../../../src/fields/color/inputSchema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAK,KAAK,OAAO,EAAE,MAAM,KAAK,CAAC;AACtC,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAkDrC;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,uBAAuB,CAAC,KAAK,EAAE;IAAE,KAAK,EAAE,UAAU,CAAA;CAAE,GAAG,OAAO,CAkB7E"}
@@ -0,0 +1,100 @@
1
+ import { ADMIN_FIELDS } from "../constants";
2
+ import { BaseField, BaseFieldInput } from "../baseTypes";
3
+ import type { ColorFormat } from "./formats";
4
+ /**
5
+ * Configuration input for a `color()` field.
6
+ *
7
+ * Colour fields store a CSS colour string. `format` decides which notation the
8
+ * picker writes — `"hex"` (default), `"rgb"`, `"hsl"` or `"oklch"`. With
9
+ * `themeColors` the field may instead store a CSS custom-property reference,
10
+ * `var(--primary)`, which resolves per colour scheme at render time.
11
+ *
12
+ * **Defaults applied by `color()`:**
13
+ * ```ts
14
+ * {
15
+ * type: "color",
16
+ * label: "", // inferred from the field key by defineCollection
17
+ * required: false, // field is optional by default
18
+ * format: "hex", // picker writes #RRGGBB / #RRGGBBAA
19
+ * themeColors: false, // picker shows the custom swatch only
20
+ * admin: {
21
+ * hidden: false, // visible in the admin form
22
+ * readOnly: false, // editable by default
23
+ * position: "main", // placed in the main content column, not the sidebar
24
+ * width: "full", // spans the full form width, not half
25
+ * cellAlignment: "left", // swatch aligned left in the data table column
26
+ * }
27
+ * }
28
+ * ```
29
+ *
30
+ * @example
31
+ * ```ts
32
+ * // Minimal — label inferred from the key ("Brand Color"), stored as hex
33
+ * brandColor: color()
34
+ *
35
+ * // Stored as oklch, ready to interpolate straight into a CSS custom property
36
+ * primaryLight: color({ format: "oklch", required: true, defaultValue: "oklch(65.7% 0.179 40.9)" })
37
+ *
38
+ * // Half-width, and offer the host app's design tokens as a second tab
39
+ * overlayTint: color({ themeColors: true, admin: { width: "half" } })
40
+ * ```
41
+ *
42
+ * @see {@link BaseFieldInput} for shared properties (`label`, `description`, `required`, `admin`, `index`, `searchIndex`)
43
+ */
44
+ export interface ColorFieldInput<TFieldMeta extends {} = {}> extends BaseFieldInput<TFieldMeta> {
45
+ /**
46
+ * Pre-filled value shown in the admin form when creating a new document.
47
+ * Does not affect existing database values.
48
+ */
49
+ defaultValue?: string;
50
+ /**
51
+ * The CSS notation the picker writes.
52
+ *
53
+ * Validation is deliberately wider than this: every supported notation is
54
+ * accepted on save, so changing `format` never invalidates existing
55
+ * documents. `format` governs new writes, not stored history.
56
+ *
57
+ * Pick the notation the front end consumes. A theme collection feeding CSS
58
+ * custom properties should use `"oklch"` so values interpolate directly with
59
+ * no conversion step.
60
+ *
61
+ * @defaultValue `"hex"`
62
+ */
63
+ format?: ColorFormat;
64
+ /**
65
+ * When `true`, the picker gains a **Theme** tab listing the CSS custom
66
+ * properties declared by the host application's stylesheet, and selecting one
67
+ * stores a `var(--token)` reference instead of a literal colour.
68
+ *
69
+ * The admin panel renders inside the host app, so those tokens are the site's
70
+ * own tokens. Leave this `false` on the fields that *define* the tokens: a
71
+ * field whose value is written back out as `--primary: var(--primary)` is a
72
+ * custom-property cycle, which CSS discards at computed-value time.
73
+ *
74
+ * @defaultValue `false`
75
+ */
76
+ themeColors?: boolean;
77
+ }
78
+ /**
79
+ * Resolved configuration for a `color()` field, after all defaults are applied.
80
+ *
81
+ * This is the type framework adapters and field components receive —
82
+ * `fieldDef` in `InputComponentProps<ColorField>` and
83
+ * `CellComponentProps<ColorField>` is this type.
84
+ *
85
+ * @see {@link ColorFieldInput} for the user-facing input type
86
+ * @see {@link color} for the config function that produces this type
87
+ */
88
+ export interface ColorField<TFieldMeta extends {} = {}> extends BaseField<TFieldMeta> {
89
+ readonly type: typeof ADMIN_FIELDS.color.type;
90
+ /**
91
+ * Pre-filled value shown in the admin form when creating a new document.
92
+ * Defaults to `""` — an empty picker.
93
+ */
94
+ defaultValue?: string;
95
+ /** The CSS notation the picker writes. */
96
+ format: ColorFormat;
97
+ /** Whether the picker offers the host app's design tokens as a second tab. */
98
+ themeColors: boolean;
99
+ }
100
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/fields/color/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AACzD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAE7C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,MAAM,WAAW,eAAe,CAAC,UAAU,SAAS,EAAE,GAAG,EAAE,CACzD,SAAQ,cAAc,CAAC,UAAU,CAAC;IAClC;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;;;;;;;;;;;OAYG;IACH,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB;;;;;;;;;;;OAWG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAED;;;;;;;;;GASG;AACH,MAAM,WAAW,UAAU,CAAC,UAAU,SAAS,EAAE,GAAG,EAAE,CACpD,SAAQ,SAAS,CAAC,UAAU,CAAC;IAC7B,QAAQ,CAAC,IAAI,EAAE,OAAO,YAAY,CAAC,KAAK,CAAC,IAAI,CAAC;IAC9C;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,0CAA0C;IAC1C,MAAM,EAAE,WAAW,CAAC;IACpB,8EAA8E;IAC9E,WAAW,EAAE,OAAO,CAAC;CACtB"}
@@ -0,0 +1,100 @@
1
+ /**
2
+ * Theme field key → CSS custom property, for the 32 shadcn design tokens.
3
+ *
4
+ * This map is the theming system's contract. `themeColorFields` derives the
5
+ * collection's colour fields from it, and `buildThemeCss` emits one declaration
6
+ * per entry — so a token cannot exist in the stored document without also being
7
+ * applied, or vice versa. The names are exactly the custom properties shadcn
8
+ * components consume and exactly the set tweakcn exports, so a preset maps
9
+ * across with no gaps.
10
+ */
11
+ export declare const THEME_COLOR_TOKENS: {
12
+ readonly background: "--background";
13
+ readonly foreground: "--foreground";
14
+ readonly card: "--card";
15
+ readonly cardForeground: "--card-foreground";
16
+ readonly popover: "--popover";
17
+ readonly popoverForeground: "--popover-foreground";
18
+ readonly primary: "--primary";
19
+ readonly primaryForeground: "--primary-foreground";
20
+ readonly secondary: "--secondary";
21
+ readonly secondaryForeground: "--secondary-foreground";
22
+ readonly muted: "--muted";
23
+ readonly mutedForeground: "--muted-foreground";
24
+ readonly accent: "--accent";
25
+ readonly accentForeground: "--accent-foreground";
26
+ readonly destructive: "--destructive";
27
+ readonly destructiveForeground: "--destructive-foreground";
28
+ readonly border: "--border";
29
+ readonly input: "--input";
30
+ readonly ring: "--ring";
31
+ readonly chart1: "--chart-1";
32
+ readonly chart2: "--chart-2";
33
+ readonly chart3: "--chart-3";
34
+ readonly chart4: "--chart-4";
35
+ readonly chart5: "--chart-5";
36
+ readonly sidebar: "--sidebar";
37
+ readonly sidebarForeground: "--sidebar-foreground";
38
+ readonly sidebarPrimary: "--sidebar-primary";
39
+ readonly sidebarPrimaryForeground: "--sidebar-primary-foreground";
40
+ readonly sidebarAccent: "--sidebar-accent";
41
+ readonly sidebarAccentForeground: "--sidebar-accent-foreground";
42
+ readonly sidebarBorder: "--sidebar-border";
43
+ readonly sidebarRing: "--sidebar-ring";
44
+ };
45
+ /** One of the 32 shadcn colour-token keys, camelCased: `"cardForeground"`, `"chart1"`. */
46
+ export type ThemeColorTokenKey = keyof typeof THEME_COLOR_TOKENS;
47
+ /**
48
+ * Scheme-independent fields, read from the theme document root.
49
+ *
50
+ * `--font-sans` is commonly also set by the host's font loader (e.g.
51
+ * `next/font`) as a class on `<html>`; both are specificity (0,1,0), so the
52
+ * later declaration wins. A stack naming a font the app has not loaded degrades
53
+ * to the next entry rather than breaking.
54
+ */
55
+ export declare const THEME_SHARED_TOKENS: {
56
+ readonly radius: "--radius";
57
+ readonly fontFamily: "--font-sans";
58
+ };
59
+ /** Where a theme's CSS applies. */
60
+ export type ThemeScope = "admin" | "site";
61
+ /**
62
+ * Stark × Ember — this repo's house palette, lifted verbatim from the `:root`
63
+ * block of `globals.css`. A freshly created theme starts from these values, so
64
+ * "new theme" means "fork the current look", not "32 empty pickers".
65
+ */
66
+ export declare const EMBER_LIGHT: Record<ThemeColorTokenKey, string>;
67
+ /** Stark × Ember dark-mode values, from `globals.css`'s `.dark` block. */
68
+ export declare const EMBER_DARK: Record<ThemeColorTokenKey, string>;
69
+ /**
70
+ * Builds the stylesheet text applying a theme document at a scope.
71
+ *
72
+ * Values are written through verbatim — a `color()` field storing
73
+ * `oklch(60.5% 0.175 42)` needs no conversion, because custom properties accept
74
+ * any colour notation. `.dark` is assumed to sit on `<html>`, which *is*
75
+ * `:root`, so the dark selector is a compound, never a descendant.
76
+ *
77
+ * The two scopes form a specificity ladder that no injection order can upset:
78
+ * site light `:root` (0,1,0) < site dark `.dark` (0,1,0, later) < admin light
79
+ * `:root:root` (0,2,0) < admin dark `.dark:root:root` (0,3,0). Emit the site
80
+ * theme once for the whole document and the admin theme from the admin route
81
+ * only, and the admin block wins exactly where it renders.
82
+ *
83
+ * @param props - Input props.
84
+ * @param props.theme - The theme document — `light`/`dark` colour groups plus
85
+ * root-level `radius` and `fontFamily`, i.e. the shape `themeColorFields`
86
+ * stores.
87
+ * @param props.scope - `"site"` emits `:root`; `"admin"` emits `:root:root`.
88
+ * @returns The stylesheet text, or `""` when the theme sets nothing.
89
+ *
90
+ * @example
91
+ * ```ts
92
+ * const css = buildThemeCss({ theme, scope: "site" });
93
+ * // ":root {\n --background: oklch(96.1% 0 0);\n …\n}\n\n.dark {\n …\n}"
94
+ * ```
95
+ */
96
+ export declare function buildThemeCss(props: {
97
+ theme: Record<string, unknown>;
98
+ scope: ThemeScope;
99
+ }): string;
100
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/fields/color/utils.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiCrB,CAAC;AAEX,0FAA0F;AAC1F,MAAM,MAAM,kBAAkB,GAAG,MAAM,OAAO,kBAAkB,CAAC;AAEjE;;;;;;;GAOG;AACH,eAAO,MAAM,mBAAmB;;;CAGtB,CAAC;AAEX,mCAAmC;AACnC,MAAM,MAAM,UAAU,GAAG,OAAO,GAAG,MAAM,CAAC;AAE1C;;;;GAIG;AACH,eAAO,MAAM,WAAW,EAAE,MAAM,CAAC,kBAAkB,EAAE,MAAM,CAiC1D,CAAC;AAEF,0EAA0E;AAC1E,eAAO,MAAM,UAAU,EAAE,MAAM,CAAC,kBAAkB,EAAE,MAAM,CAiCzD,CAAC;AAuBF;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE;IACnC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC/B,KAAK,EAAE,UAAU,CAAC;CACnB,GAAG,MAAM,CAqBT"}
@@ -0,0 +1,27 @@
1
+ import type { ColorField } from "./types";
2
+ /**
3
+ * Converts a colour field definition to a Convex schema validator string.
4
+ *
5
+ * Colour fields are stored as plain strings in Convex — the notation (and the
6
+ * `var(--token)` alternative allowed by `themeColors`) is enforced at the admin
7
+ * form layer, not in the database schema. This function generates only the type
8
+ * constraint, so changing `format` never triggers a schema migration.
9
+ *
10
+ * @param props - Input props.
11
+ * @param props.field - The resolved colour field definition.
12
+ * @returns Convex validator string: `"v.string()"` for required fields,
13
+ * `"v.optional(v.string())"` for optional fields.
14
+ *
15
+ * @example
16
+ * ```ts
17
+ * colorFieldToValidator({ field: color({ required: true }) }) // "v.string()"
18
+ * colorFieldToValidator({ field: color({ required: false }) }) // "v.optional(v.string())"
19
+ * ```
20
+ *
21
+ * @see {@link colorFieldToInputSchema} for the admin-form Zod schema that enforces the notation
22
+ * @internal Used by schema generation, not typically called directly.
23
+ */
24
+ export declare function colorFieldToValidator(props: {
25
+ field: ColorField;
26
+ }): string;
27
+ //# sourceMappingURL=validator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validator.d.ts","sourceRoot":"","sources":["../../../src/fields/color/validator.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAE1C;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE;IAAE,KAAK,EAAE,UAAU,CAAA;CAAE,GAAG,MAAM,CAK1E"}
@@ -0,0 +1,108 @@
1
+ /**
2
+ * Convex schema value type constants for field types.
3
+ *
4
+ * These constants define the base Convex validator strings for each field type.
5
+ * They're used by schema generation logic to build the Convex schema.
6
+ *
7
+ * @internal
8
+ */
9
+ /** Convex schema metadata for each supported field type, keyed by field type name. */
10
+ export declare const ADMIN_FIELDS: {
11
+ readonly text: {
12
+ readonly type: "text";
13
+ readonly interfaceType: "string";
14
+ readonly validator: "v.string()";
15
+ readonly defaultValue: "";
16
+ };
17
+ readonly url: {
18
+ readonly type: "url";
19
+ readonly interfaceType: "string";
20
+ readonly validator: "v.string()";
21
+ readonly defaultValue: "";
22
+ };
23
+ readonly color: {
24
+ readonly type: "color";
25
+ readonly interfaceType: "string";
26
+ readonly validator: "v.string()";
27
+ readonly defaultValue: "";
28
+ };
29
+ readonly number: {
30
+ readonly type: "number";
31
+ readonly interfaceType: "number";
32
+ readonly validator: "v.number()";
33
+ readonly defaultValue: 0;
34
+ };
35
+ readonly checkbox: {
36
+ readonly type: "checkbox";
37
+ readonly interfaceType: "boolean";
38
+ readonly validator: "v.boolean()";
39
+ readonly defaultValue: false;
40
+ };
41
+ readonly date: {
42
+ readonly type: "date";
43
+ readonly interfaceType: "number";
44
+ readonly validator: "v.number()";
45
+ readonly defaultValue: undefined;
46
+ };
47
+ readonly select: {
48
+ readonly type: "select";
49
+ readonly interfaceType: "string[]";
50
+ readonly validator: "v.array(\nv.string()\n)";
51
+ readonly defaultValue: string[];
52
+ };
53
+ readonly relationship: {
54
+ readonly type: "relationship";
55
+ readonly interfaceType: "Id<CollectionSlug>[]";
56
+ readonly validator: "v.array(\nv.string()\n)";
57
+ readonly defaultValue: string[];
58
+ };
59
+ readonly array: {
60
+ readonly type: "array";
61
+ readonly interfaceType: "unknown[]";
62
+ readonly validator: "v.array(\nv.any()\n)";
63
+ readonly defaultValue: readonly [];
64
+ };
65
+ readonly group: {
66
+ readonly type: "group";
67
+ readonly interfaceType: "Record<string, any>";
68
+ readonly validator: "v.object({})";
69
+ readonly defaultValue: Record<string, any>;
70
+ };
71
+ readonly blocks: {
72
+ readonly type: "blocks";
73
+ readonly interfaceType: "Record<string, any>[]";
74
+ readonly validator: "v.array(v.any())";
75
+ readonly defaultValue: readonly [];
76
+ };
77
+ readonly upload: {
78
+ readonly type: "upload";
79
+ readonly interfaceType: "Id<MediaCollectionSlug>[]";
80
+ readonly validator: "v.array(\nv.string()\n)";
81
+ readonly defaultValue: undefined;
82
+ };
83
+ };
84
+ /** Union of all supported field type name strings (e.g. `"text"` | `"number"` | `"checkbox"` | ...). */
85
+ export type AdminFieldType = (typeof ADMIN_FIELDS)[keyof typeof ADMIN_FIELDS]["type"];
86
+ /** Union of all Convex validator strings for the supported field types (e.g. `"v.string()"` | `"v.number()"` | ...). */
87
+ export type AdminFieldValidator = (typeof ADMIN_FIELDS)[keyof typeof ADMIN_FIELDS]["validator"];
88
+ /** Union of all TypeScript type strings corresponding to the supported field types (e.g. `"string"` | `"number"` | ...). */
89
+ export type AdminFieldTsType = (typeof ADMIN_FIELDS)[keyof typeof ADMIN_FIELDS]["interfaceType"];
90
+ /** Literal type `"text"` — the discriminant value on {@link TextField}. */
91
+ export type TextFieldType = typeof ADMIN_FIELDS.text.type;
92
+ /** Literal type `"url"` — the discriminant value on {@link UrlField}. */
93
+ export type UrlFieldType = typeof ADMIN_FIELDS.url.type;
94
+ /** Literal type `"color"` — the discriminant value on {@link ColorField}. */
95
+ export type ColorFieldType = typeof ADMIN_FIELDS.color.type;
96
+ /** Literal type `"number"` — the discriminant value on {@link NumberField}. */
97
+ export type NumberFieldType = typeof ADMIN_FIELDS.number.type;
98
+ /** Literal type `"checkbox"` — the discriminant value on {@link CheckboxField}. */
99
+ export type CheckboxFieldType = typeof ADMIN_FIELDS.checkbox.type;
100
+ /** Literal type `"date"` — the discriminant value on {@link DateField}. */
101
+ export type DateFieldType = typeof ADMIN_FIELDS.date.type;
102
+ /** Literal type `"select"` — the discriminant value on {@link SelectField}. */
103
+ export type SelectFieldType = typeof ADMIN_FIELDS.select.type;
104
+ /** Literal type `"relationship"` — the discriminant value on {@link RelationshipField}. */
105
+ export type RelationshipFieldType = typeof ADMIN_FIELDS.relationship.type;
106
+ /** Literal type `"array"` — the discriminant value on {@link ArrayField}. */
107
+ export type ArrayFieldType = typeof ADMIN_FIELDS.array.type;
108
+ //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/fields/constants.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,sFAAsF;AACtF,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;+BAyCD,MAAM,EAAE;;;;;;+BAMR,MAAM,EAAE;;;;;;;;;;;;+BAaR,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;;;;;;;;;;;;;;CAmBjC,CAAC;AACX,wGAAwG;AACxG,MAAM,MAAM,cAAc,GAAG,CAAC,OAAO,YAAY,CAAC,CAAC,MAAM,OAAO,YAAY,CAAC,CAAC,MAAM,CAAC,CAAC;AACtF,wHAAwH;AACxH,MAAM,MAAM,mBAAmB,GAAG,CAAC,OAAO,YAAY,CAAC,CAAC,MAAM,OAAO,YAAY,CAAC,CAAC,WAAW,CAAC,CAAC;AAChG,4HAA4H;AAC5H,MAAM,MAAM,gBAAgB,GAAG,CAAC,OAAO,YAAY,CAAC,CAAC,MAAM,OAAO,YAAY,CAAC,CAAC,eAAe,CAAC,CAAC;AAEjG,2EAA2E;AAC3E,MAAM,MAAM,aAAa,GAAG,OAAO,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC;AAE1D,yEAAyE;AACzE,MAAM,MAAM,YAAY,GAAG,OAAO,YAAY,CAAC,GAAG,CAAC,IAAI,CAAC;AAExD,6EAA6E;AAC7E,MAAM,MAAM,cAAc,GAAG,OAAO,YAAY,CAAC,KAAK,CAAC,IAAI,CAAC;AAE5D,+EAA+E;AAC/E,MAAM,MAAM,eAAe,GAAG,OAAO,YAAY,CAAC,MAAM,CAAC,IAAI,CAAC;AAE9D,mFAAmF;AACnF,MAAM,MAAM,iBAAiB,GAAG,OAAO,YAAY,CAAC,QAAQ,CAAC,IAAI,CAAC;AAElE,2EAA2E;AAC3E,MAAM,MAAM,aAAa,GAAG,OAAO,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC;AAE1D,+EAA+E;AAC/E,MAAM,MAAM,eAAe,GAAG,OAAO,YAAY,CAAC,MAAM,CAAC,IAAI,CAAC;AAE9D,2FAA2F;AAC3F,MAAM,MAAM,qBAAqB,GAAG,OAAO,YAAY,CAAC,YAAY,CAAC,IAAI,CAAC;AAE1E,6EAA6E;AAC7E,MAAM,MAAM,cAAc,GAAG,OAAO,YAAY,CAAC,KAAK,CAAC,IAAI,CAAC"}
@@ -0,0 +1,57 @@
1
+ import { BaseFieldMeta } from "../types";
2
+ import type { DateFieldInput, DateField } from "./types";
3
+ /**
4
+ * Creates a date field with all defaults applied.
5
+ *
6
+ * Date fields store a Unix timestamp in milliseconds.
7
+ * Common uses: published dates, expiry dates, event times, timestamps.
8
+ *
9
+ * Accepts {@link DateFieldInput} (all optional) and returns {@link DateField} with all defaults applied.
10
+ *
11
+ * **Defaults applied:**
12
+ * - `label` — `""` (inferred from the field key by `defineCollection`)
13
+ * - `required` — `false`
14
+ * - `time.hidden` — `false` (time picker is visible)
15
+ * - `time.use12HourFormat` — `true` (AM/PM format)
16
+ * - `time.timePicker.hour` — `true`
17
+ * - `time.timePicker.minute` — `true`
18
+ * - `time.timePicker.second` — `false`
19
+ * - `admin.hidden` — `false`
20
+ * - `admin.readOnly` — `false`
21
+ * - `admin.position` — `"main"`
22
+ * - `admin.width` — `"full"`
23
+ * - `admin.cellAlignment` — `"left"`
24
+ *
25
+ * @param options - Date field configuration. All properties are optional.
26
+ * @returns Resolved date field definition with all defaults applied.
27
+ *
28
+ * @example
29
+ * ```ts
30
+ * import { date, defineCollection } from '@vexcms/core'
31
+ *
32
+ * posts: defineCollection({
33
+ * fields: {
34
+ * // Minimal — label inferred from key ("Published At")
35
+ * publishedAt: date(),
36
+ *
37
+ * // Required event date with a database index
38
+ * eventDate: date({ required: true, index: "by_event_date" }),
39
+ *
40
+ * // Date-only picker (hide the time UI)
41
+ * expiresOn: date({ time: { hidden: true } }),
42
+ *
43
+ * // Appointment in 24-hour format, shown in the sidebar
44
+ * appointmentAt: date({
45
+ * required: true,
46
+ * time: { use12HourFormat: false },
47
+ * admin: { position: "sidebar", width: "half" },
48
+ * }),
49
+ * }
50
+ * })
51
+ * ```
52
+ *
53
+ * @see {@link DateFieldInput} for the full input type
54
+ * @see {@link DateField} for the resolved output type
55
+ */
56
+ export declare function date<TFieldMeta extends BaseFieldMeta = BaseFieldMeta>(options?: DateFieldInput<TFieldMeta>): DateField<TFieldMeta>;
57
+ //# sourceMappingURL=config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../src/fields/date/config.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEzD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoDG;AACH,wBAAgB,IAAI,CAAC,UAAU,SAAS,aAAa,GAAG,aAAa,EACnE,OAAO,CAAC,EAAE,cAAc,CAAC,UAAU,CAAC,GACnC,SAAS,CAAC,UAAU,CAAC,CAsCvB"}
@@ -0,0 +1,5 @@
1
+ export * from "./config";
2
+ export * from "./types";
3
+ export * from "./validator";
4
+ export * from "./inputSchema";
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/fields/date/index.ts"],"names":[],"mappings":"AACA,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC"}
@@ -0,0 +1,29 @@
1
+ import { ZodType } from "zod";
2
+ import { DateField } from "./types";
3
+ /**
4
+ * Builds a Zod schema for validating a date field value in the admin form.
5
+ *
6
+ * Date values are Unix timestamps in milliseconds, so the base schema is
7
+ * `z.number()`. For required fields a `.default(Date.now())` is applied so
8
+ * the picker always has an initial value. Non-required fields are wrapped
9
+ * in `.optional()` via `applyBaseInputSchemaMeta`.
10
+ *
11
+ * @param props - Input props.
12
+ * @param props.field - The resolved date field definition
13
+ * @returns A Zod number schema with optionality applied
14
+ *
15
+ * @example
16
+ * ```ts
17
+ * const field = date({ required: true })
18
+ * dateFieldToInputSchema({ field })
19
+ * // → z.number().default(<now>)
20
+ *
21
+ * const optField = date({ required: false })
22
+ * dateFieldToInputSchema({ field: optField })
23
+ * // → z.number().optional()
24
+ * ```
25
+ */
26
+ export declare function dateFieldToInputSchema(props: {
27
+ field: DateField;
28
+ }): ZodType;
29
+ //# sourceMappingURL=inputSchema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"inputSchema.d.ts","sourceRoot":"","sources":["../../../src/fields/date/inputSchema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAK,OAAO,EAAyB,MAAM,KAAK,CAAC;AACxD,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAGpC;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,sBAAsB,CAAC,KAAK,EAAE;IAAE,KAAK,EAAE,SAAS,CAAA;CAAE,GAAG,OAAO,CAS3E"}
@@ -0,0 +1,147 @@
1
+ import { ADMIN_FIELDS } from "../constants";
2
+ import { BaseField, BaseFieldInput, FieldAdminConfig } from "../baseTypes";
3
+ /**
4
+ * Configuration input for a `date()` field.
5
+ *
6
+ * Date fields store a Unix timestamp in milliseconds — event dates, publish
7
+ * dates, expiry times, etc. All properties are optional; unset properties fall
8
+ * back to the defaults listed below.
9
+ *
10
+ * **Defaults applied by `date()`:**
11
+ * ```ts
12
+ * {
13
+ * type: "date",
14
+ * label: "", // inferred from the field key by defineCollection
15
+ * required: false, // field is optional by default
16
+ * time: {
17
+ * hidden: false, // time picker is visible alongside the calendar
18
+ * use12HourFormat: true, // AM/PM format (set false for 24-hour)
19
+ * timePicker: {
20
+ * hour: true, // hour selector shown
21
+ * minute: true, // minute selector shown
22
+ * second: false, // seconds hidden
23
+ * },
24
+ * },
25
+ * admin: {
26
+ * hidden: false, // visible in the admin form
27
+ * readOnly: false, // editable by default
28
+ * position: "main", // placed in the main content column, not the sidebar
29
+ * width: "full", // spans the full form width, not half
30
+ * cellAlignment: "left", // text aligned left in the data table column
31
+ * }
32
+ * }
33
+ * ```
34
+ *
35
+ * @example
36
+ * ```ts
37
+ * // Minimal — label is inferred from the key ("Published At")
38
+ * publishedAt: date()
39
+ *
40
+ * // Required event date with a database index
41
+ * eventDate: date({ required: true, index: "by_event_date" })
42
+ *
43
+ * // Appointment with 24-hour format and seconds hidden (overrides defaults)
44
+ * appointmentAt: date({
45
+ * required: true,
46
+ * time: { use12HourFormat: false },
47
+ * })
48
+ *
49
+ * // Date-only picker (hide the time UI entirely)
50
+ * expiresOn: date({ time: { hidden: true } })
51
+ *
52
+ * // Pre-filled default (Unix ms timestamp for 2025-01-01T00:00:00Z)
53
+ * startsAt: date({ defaultValue: 1735689600000 })
54
+ * ```
55
+ *
56
+ * @see {@link DateField} for the resolved type after defaults are applied
57
+ * @see {@link date} for the config function that applies defaults
58
+ * @see {@link BaseFieldInput} for shared properties (`label`, `description`, `required`, `admin`, `index`)
59
+ */
60
+ export interface DateFieldInput<TFieldMeta extends {} = {}> extends BaseFieldInput<TFieldMeta> {
61
+ /**
62
+ * Pre-filled Unix timestamp (milliseconds) shown in the admin form when creating a new document.
63
+ * Does not apply to existing database values.
64
+ */
65
+ defaultValue?: number | undefined;
66
+ /** Minimum allowed Unix timestamp (milliseconds). Validated in the input schema. */
67
+ min?: number;
68
+ /** Maximum allowed Unix timestamp (milliseconds). Validated in the input schema. */
69
+ max?: number;
70
+ /**
71
+ * Date/time picker display configuration. Each key is optional — omitted keys
72
+ * fall back to the defaults applied by `date()`. The `time` object is always
73
+ * fully resolved on `DateField` after defaults are merged.
74
+ */
75
+ time?: {
76
+ /**
77
+ * Hide the time-of-day picker, showing only the calendar date selector.
78
+ *
79
+ * Default: `false` (time picker is visible)
80
+ */
81
+ hidden?: boolean;
82
+ /**
83
+ * Display time in 12-hour AM/PM format instead of 24-hour.
84
+ *
85
+ * Default: `true`
86
+ */
87
+ use12HourFormat?: boolean;
88
+ /**
89
+ * Control which time units are shown in the time picker.
90
+ * Each unit defaults to `true` for `hour` and `minute`, `false` for `second`.
91
+ */
92
+ timePicker?: {
93
+ /** Show the hour selector. Default: `true`. */
94
+ hour: boolean;
95
+ /** Show the minute selector. Default: `true`. */
96
+ minute: boolean;
97
+ /** Show the seconds selector. Default: `false`. */
98
+ second: boolean;
99
+ };
100
+ };
101
+ }
102
+ /**
103
+ * Resolved configuration for a `date()` field, after all defaults are applied.
104
+ *
105
+ * This is the type that framework adapters and field components receive —
106
+ * `fieldDef` in `InputComponentProps<DateField>` and `CellComponentProps<DateField>`
107
+ * is this type.
108
+ *
109
+ * @see {@link DateFieldInput} for the user-facing input type
110
+ * @see {@link date} for the config function that produces this type
111
+ */
112
+ export interface DateField<TFieldMeta extends {} = {}> extends BaseField<TFieldMeta> {
113
+ readonly type: typeof ADMIN_FIELDS.date.type;
114
+ /** Display label shown in the admin form. Always set — inferred from the field key if not provided. */
115
+ label: string;
116
+ /** Whether this field is required in the database schema. */
117
+ required: boolean;
118
+ /** Resolved admin UI configuration with all defaults applied. */
119
+ admin: FieldAdminConfig;
120
+ /** Pre-filled Unix timestamp (milliseconds) shown in the admin form when creating a new document. */
121
+ defaultValue: number | undefined;
122
+ /** Minimum allowed Unix timestamp (milliseconds). */
123
+ min?: number;
124
+ /** Maximum allowed Unix timestamp (milliseconds). */
125
+ max?: number;
126
+ /**
127
+ * Resolved date/time picker display configuration — all keys always present after defaults are applied.
128
+ *
129
+ * @see {@link DateFieldInput} for the user-facing input type where each key is optional
130
+ */
131
+ time: {
132
+ /** Whether the time-of-day picker is hidden, leaving only the calendar date selector. */
133
+ hidden: boolean;
134
+ /** Whether time is displayed in 12-hour AM/PM format (`true`) or 24-hour format (`false`). */
135
+ use12HourFormat: boolean;
136
+ /** Which time unit selectors are shown in the time picker. */
137
+ timePicker: {
138
+ /** Whether the hour selector is shown. */
139
+ hour: boolean;
140
+ /** Whether the minute selector is shown. */
141
+ minute: boolean;
142
+ /** Whether the seconds selector is shown. */
143
+ second: boolean;
144
+ };
145
+ };
146
+ }
147
+ //# sourceMappingURL=types.d.ts.map