@upstart.gg/sdk 0.0.103 → 0.0.105

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 (225) hide show
  1. package/dist/shared/ajv.js +1 -1
  2. package/dist/shared/attributes.js +1 -1
  3. package/dist/shared/bricks/manifests/accordion.manifest.js +1 -1
  4. package/dist/shared/bricks/manifests/all-manifests.js +1 -1
  5. package/dist/shared/bricks/manifests/button.manifest.js +1 -1
  6. package/dist/shared/bricks/manifests/card.manifest.js +1 -1
  7. package/dist/shared/bricks/manifests/carousel.manifest.js +1 -1
  8. package/dist/shared/bricks/manifests/container.manifest.js +1 -1
  9. package/dist/shared/bricks/manifests/divider.manifest.js +1 -1
  10. package/dist/shared/bricks/manifests/footer.manifest.js +1 -1
  11. package/dist/shared/bricks/manifests/form.manifest.js +1 -1
  12. package/dist/shared/bricks/manifests/hero.manifest.js +1 -1
  13. package/dist/shared/bricks/manifests/icon.manifest.js +1 -1
  14. package/dist/shared/bricks/manifests/image.manifest.js +1 -1
  15. package/dist/shared/bricks/manifests/images-gallery.manifest.js +1 -1
  16. package/dist/shared/bricks/manifests/map.manifest.js +1 -1
  17. package/dist/shared/bricks/manifests/navbar.manifest.js +1 -1
  18. package/dist/shared/bricks/manifests/sidebar.manifest.js +1 -1
  19. package/dist/shared/bricks/manifests/social-links.manifest.js +1 -1
  20. package/dist/shared/bricks/manifests/testimonials.manifest.js +1 -1
  21. package/dist/shared/bricks/manifests/text.manifest.js +1 -1
  22. package/dist/shared/bricks/manifests/timeline.manifest.js +1 -1
  23. package/dist/shared/bricks/manifests/video.manifest.js +1 -1
  24. package/dist/shared/bricks.js +1 -1
  25. package/dist/shared/chunk-245ZLDVB.js +3 -0
  26. package/dist/shared/{chunk-QALNFBY7.js → chunk-2D6ZEIDX.js} +1 -1
  27. package/dist/shared/{chunk-CW5FWW5W.js → chunk-4BLCQRF5.js} +1 -1
  28. package/dist/shared/{chunk-TEPFFY32.js → chunk-5MGYT6FI.js} +1 -1
  29. package/dist/shared/{chunk-HQQYIKTE.js → chunk-CS5N4UQU.js} +1 -1
  30. package/dist/shared/{chunk-5IEGQ7YT.js → chunk-FRWB3BF3.js} +1 -1
  31. package/dist/shared/{chunk-I5S2MPPR.js → chunk-HYXCHFS5.js} +1 -1
  32. package/dist/shared/{chunk-TCZBR3ZU.js → chunk-IKSRCRZZ.js} +1 -1
  33. package/dist/shared/{chunk-LJQXN32B.js → chunk-ISF6EBPX.js} +1 -1
  34. package/dist/shared/{chunk-UK6H3FDX.js → chunk-JDBVMPSI.js} +1 -1
  35. package/dist/shared/{chunk-UISES3HA.js → chunk-M3Z3XDUC.js} +1 -1
  36. package/dist/shared/{chunk-22KRCQK5.js → chunk-MWP5IU33.js} +1 -1
  37. package/dist/shared/{chunk-7L3UOEMR.js → chunk-NCSLTHKN.js} +1 -1
  38. package/dist/shared/{chunk-O22VV7YR.js → chunk-OWON727Q.js} +1 -1
  39. package/dist/shared/{chunk-CEXHD4BO.js → chunk-P5RC56CL.js} +2 -2
  40. package/dist/shared/{chunk-ZFTWLZ3G.js → chunk-QI3BZDXL.js} +1 -1
  41. package/dist/shared/{chunk-F6MLW6DO.js → chunk-RDSK2G6V.js} +1 -1
  42. package/dist/shared/{chunk-I43NIQ2K.js → chunk-RXRPFXDF.js} +1 -1
  43. package/dist/shared/{chunk-POYVTV5F.js → chunk-VFGMOA4M.js} +1 -1
  44. package/dist/shared/{chunk-VDHLON5R.js → chunk-VPD626ML.js} +1 -1
  45. package/dist/shared/{chunk-WCNVFVDK.js → chunk-VROOAFFW.js} +1 -1
  46. package/dist/shared/{chunk-E2EBTWJI.js → chunk-WB4PGCZQ.js} +1 -1
  47. package/dist/shared/chunk-X2RJL33B.js +3 -0
  48. package/dist/shared/{chunk-OQIFFJ7I.js → chunk-X4ZBUWUL.js} +1 -1
  49. package/dist/shared/datasources/external/rss/fetcher.d.ts +1 -1
  50. package/dist/shared/datasources/external/rss/fetcher.d.ts.map +1 -1
  51. package/dist/shared/page.js +1 -1
  52. package/dist/shared/site.js +1 -1
  53. package/package.json +5 -9
  54. package/dist/shared/chunk-GPKRRX3D.js +0 -3
  55. package/dist/shared/chunk-JFDOR3UH.js +0 -3
  56. package/src/node/cli/api.ts +0 -101
  57. package/src/node/cli/commands/cmd-build.ts +0 -64
  58. package/src/node/cli/commands/login/cmd-login.ts +0 -111
  59. package/src/node/cli/commands/logout/cmd-logout.ts +0 -11
  60. package/src/node/cli/commands/publish/cmd-publish.ts +0 -135
  61. package/src/node/cli/commands/publish/parse-gitignore.ts +0 -278
  62. package/src/node/cli/commands/publish/uploader.ts +0 -333
  63. package/src/node/cli/constants.ts +0 -14
  64. package/src/node/cli/is-logged-in.ts +0 -28
  65. package/src/node/cli/program.ts +0 -77
  66. package/src/node/cli/store.ts +0 -64
  67. package/src/node/cli/tests/api.test.ts +0 -161
  68. package/src/node/cli/types.ts +0 -34
  69. package/src/node/cli/utils.ts +0 -20
  70. package/src/node/shared/config.ts +0 -69
  71. package/src/node/shared/logger.ts +0 -44
  72. package/src/shared/ajv.ts +0 -103
  73. package/src/shared/analytics/init.ts +0 -14
  74. package/src/shared/analytics/track.ts +0 -21
  75. package/src/shared/analytics/types.ts +0 -13
  76. package/src/shared/attributes.ts +0 -211
  77. package/src/shared/brick-manifest.ts +0 -110
  78. package/src/shared/bricks/manifests/accordion.manifest.ts +0 -179
  79. package/src/shared/bricks/manifests/all-manifests.ts +0 -92
  80. package/src/shared/bricks/manifests/button.manifest.ts +0 -145
  81. package/src/shared/bricks/manifests/card.manifest.ts +0 -269
  82. package/src/shared/bricks/manifests/carousel.manifest.ts +0 -106
  83. package/src/shared/bricks/manifests/container.manifest.ts +0 -357
  84. package/src/shared/bricks/manifests/divider.manifest.ts +0 -121
  85. package/src/shared/bricks/manifests/footer.manifest.ts +0 -487
  86. package/src/shared/bricks/manifests/form.manifest.ts +0 -112
  87. package/src/shared/bricks/manifests/hero.manifest.ts +0 -132
  88. package/src/shared/bricks/manifests/icon.manifest.ts +0 -130
  89. package/src/shared/bricks/manifests/image.manifest.ts +0 -203
  90. package/src/shared/bricks/manifests/images-gallery.manifest.ts +0 -227
  91. package/src/shared/bricks/manifests/map.manifest.ts +0 -75
  92. package/src/shared/bricks/manifests/navbar.manifest.ts +0 -344
  93. package/src/shared/bricks/manifests/sidebar.manifest.ts +0 -90
  94. package/src/shared/bricks/manifests/social-links.manifest.ts +0 -370
  95. package/src/shared/bricks/manifests/testimonials.manifest.ts +0 -397
  96. package/src/shared/bricks/manifests/tests/header.manifest.test.ts +0 -10
  97. package/src/shared/bricks/manifests/text.manifest.ts +0 -164
  98. package/src/shared/bricks/manifests/timeline.manifest.ts +0 -456
  99. package/src/shared/bricks/manifests/video.manifest.ts +0 -59
  100. package/src/shared/bricks/props/_style-presets.ts +0 -352
  101. package/src/shared/bricks/props/align.ts +0 -59
  102. package/src/shared/bricks/props/background.ts +0 -118
  103. package/src/shared/bricks/props/boolean.ts +0 -11
  104. package/src/shared/bricks/props/border.ts +0 -84
  105. package/src/shared/bricks/props/color.ts +0 -24
  106. package/src/shared/bricks/props/common.ts +0 -37
  107. package/src/shared/bricks/props/container.ts +0 -356
  108. package/src/shared/bricks/props/css-length.ts +0 -25
  109. package/src/shared/bricks/props/datasource.ts +0 -60
  110. package/src/shared/bricks/props/date.ts +0 -24
  111. package/src/shared/bricks/props/effects.ts +0 -123
  112. package/src/shared/bricks/props/enum.ts +0 -42
  113. package/src/shared/bricks/props/file.ts +0 -12
  114. package/src/shared/bricks/props/geolocation.ts +0 -30
  115. package/src/shared/bricks/props/helpers.ts +0 -101
  116. package/src/shared/bricks/props/image.ts +0 -90
  117. package/src/shared/bricks/props/number.ts +0 -16
  118. package/src/shared/bricks/props/padding.ts +0 -21
  119. package/src/shared/bricks/props/position.ts +0 -27
  120. package/src/shared/bricks/props/preset.ts +0 -136
  121. package/src/shared/bricks/props/string.ts +0 -56
  122. package/src/shared/bricks/props/tests/align.test.ts +0 -37
  123. package/src/shared/bricks/props/tests/background.test.ts +0 -102
  124. package/src/shared/bricks/props/tests/border.test.ts +0 -38
  125. package/src/shared/bricks/props/tests/effects.test.ts +0 -37
  126. package/src/shared/bricks/props/tests/helpers.test.ts +0 -133
  127. package/src/shared/bricks/props/tests/image.test.ts +0 -71
  128. package/src/shared/bricks/props/tests/padding.ts +0 -12
  129. package/src/shared/bricks/props/tests/string.test.ts +0 -79
  130. package/src/shared/bricks/props/text.ts +0 -66
  131. package/src/shared/bricks/props/types.ts +0 -57
  132. package/src/shared/bricks.ts +0 -232
  133. package/src/shared/context.ts +0 -39
  134. package/src/shared/datarecords/external/airtable/handler.ts +0 -21
  135. package/src/shared/datarecords/external/airtable/options.ts +0 -22
  136. package/src/shared/datarecords/external/generic-webhook/handler.ts +0 -10
  137. package/src/shared/datarecords/external/generic-webhook/options.ts +0 -13
  138. package/src/shared/datarecords/external/google/oauth/config.ts +0 -30
  139. package/src/shared/datarecords/external/google/sheets/handler.ts +0 -26
  140. package/src/shared/datarecords/external/google/sheets/options.ts +0 -9
  141. package/src/shared/datarecords/types.ts +0 -120
  142. package/src/shared/datarecords.ts +0 -5
  143. package/src/shared/datasources/README.md +0 -3
  144. package/src/shared/datasources/external/facebook/posts/fetcher.ts +0 -52
  145. package/src/shared/datasources/external/facebook/posts/sample.ts +0 -35
  146. package/src/shared/datasources/external/facebook/posts/schema.ts +0 -33
  147. package/src/shared/datasources/external/facebook/posts/tests/fetcher.test.ts +0 -73
  148. package/src/shared/datasources/external/http-json/fetcher.ts +0 -28
  149. package/src/shared/datasources/external/http-json/options.ts +0 -12
  150. package/src/shared/datasources/external/http-json/schema.ts +0 -6
  151. package/src/shared/datasources/external/http-json/tests/fetcher.test.ts +0 -70
  152. package/src/shared/datasources/external/instagram/feed/fetcher.ts +0 -33
  153. package/src/shared/datasources/external/instagram/feed/sample.ts +0 -22
  154. package/src/shared/datasources/external/instagram/feed/schema.ts +0 -23
  155. package/src/shared/datasources/external/instagram/feed/tests/fetcher.test.ts +0 -64
  156. package/src/shared/datasources/external/mastodon/account/fetcher.ts +0 -24
  157. package/src/shared/datasources/external/mastodon/account/sample.ts +0 -33
  158. package/src/shared/datasources/external/mastodon/account/schema.ts +0 -45
  159. package/src/shared/datasources/external/mastodon/account/tests/fetcher.test.ts +0 -47
  160. package/src/shared/datasources/external/mastodon/options.ts +0 -11
  161. package/src/shared/datasources/external/mastodon/status/fetcher.ts +0 -35
  162. package/src/shared/datasources/external/mastodon/status/sample.array.ts +0 -59
  163. package/src/shared/datasources/external/mastodon/status/sample.single.ts +0 -55
  164. package/src/shared/datasources/external/mastodon/status/schema.ts +0 -130
  165. package/src/shared/datasources/external/mastodon/status/tests/fetcher.test.ts +0 -74
  166. package/src/shared/datasources/external/meta/oauth/config.ts +0 -16
  167. package/src/shared/datasources/external/meta/options.ts +0 -11
  168. package/src/shared/datasources/external/rss/fetcher.ts +0 -29
  169. package/src/shared/datasources/external/rss/options.ts +0 -11
  170. package/src/shared/datasources/external/rss/sample.ts +0 -22
  171. package/src/shared/datasources/external/rss/schema.ts +0 -42
  172. package/src/shared/datasources/external/threads/media/fetcher.ts +0 -53
  173. package/src/shared/datasources/external/threads/media/sample.ts +0 -44
  174. package/src/shared/datasources/external/threads/media/schema.ts +0 -37
  175. package/src/shared/datasources/external/tiktok/oauth/config.ts +0 -17
  176. package/src/shared/datasources/external/tiktok/video/fetcher.ts +0 -39
  177. package/src/shared/datasources/external/tiktok/video/options.ts +0 -12
  178. package/src/shared/datasources/external/tiktok/video/sample.ts +0 -26
  179. package/src/shared/datasources/external/tiktok/video/schema.ts +0 -27
  180. package/src/shared/datasources/external/youtube/list/fetcher.ts +0 -37
  181. package/src/shared/datasources/external/youtube/list/options.ts +0 -15
  182. package/src/shared/datasources/external/youtube/list/sample.ts +0 -33
  183. package/src/shared/datasources/external/youtube/list/schema.ts +0 -38
  184. package/src/shared/datasources/external/youtube/oauth/config.ts +0 -15
  185. package/src/shared/datasources/fetcher.ts +0 -17
  186. package/src/shared/datasources/internal/blog/schema.ts +0 -69
  187. package/src/shared/datasources/internal/changelog/schema.ts +0 -48
  188. package/src/shared/datasources/internal/contact-info/schema.ts +0 -20
  189. package/src/shared/datasources/internal/cv/schema.ts +0 -217
  190. package/src/shared/datasources/internal/faq/schema.ts +0 -27
  191. package/src/shared/datasources/internal/job-board/schema.ts +0 -228
  192. package/src/shared/datasources/internal/links/schema.ts +0 -15
  193. package/src/shared/datasources/internal/recipes/schema.ts +0 -42
  194. package/src/shared/datasources/internal/restaurant/schema.ts +0 -225
  195. package/src/shared/datasources/provider-options.ts +0 -7
  196. package/src/shared/datasources/samples.ts +0 -26
  197. package/src/shared/datasources/schemas.ts +0 -45
  198. package/src/shared/datasources/types.ts +0 -276
  199. package/src/shared/datasources/utils.ts +0 -16
  200. package/src/shared/datasources.ts +0 -42
  201. package/src/shared/env.ts +0 -23
  202. package/src/shared/errors.ts +0 -1
  203. package/src/shared/images.ts +0 -44
  204. package/src/shared/index.ts +0 -3
  205. package/src/shared/layout-constants.ts +0 -25
  206. package/src/shared/manifest.ts +0 -50
  207. package/src/shared/oauth.ts +0 -16
  208. package/src/shared/page.ts +0 -61
  209. package/src/shared/prompt.ts +0 -9
  210. package/src/shared/responsive.ts +0 -5
  211. package/src/shared/site.ts +0 -97
  212. package/src/shared/sitemap.ts +0 -66
  213. package/src/shared/social-icons.ts +0 -307
  214. package/src/shared/tests/attributes.test.ts +0 -37
  215. package/src/shared/theme.ts +0 -245
  216. package/src/shared/themes/README.md +0 -34
  217. package/src/shared/themes/color-system.ts +0 -127
  218. package/src/shared/utils/canvas-data-uri.ts +0 -2
  219. package/src/shared/utils/invariant.ts +0 -25
  220. package/src/shared/utils/json-date.ts +0 -8
  221. package/src/shared/utils/merge.ts +0 -12
  222. package/src/shared/utils/object-hash.ts +0 -7
  223. package/src/shared/utils/schema.ts +0 -35
  224. package/src/shared/utils/try-catch.ts +0 -12
  225. package/src/shared/utils/typed-ref.ts +0 -41
@@ -1,356 +0,0 @@
1
- import { type TObject, Type, type Static, type SchemaOptions } from "@sinclair/typebox";
2
- import { getStyleProperties, getStyleValueById, group, optional, prop } from "./helpers";
3
- import { StringEnum } from "~/shared/utils/schema";
4
- import { typedRef } from "~/shared/utils/typed-ref";
5
-
6
- // type FlexOptions = {
7
- // title?: string;
8
- // defaultValue?: {
9
- // direction: string;
10
- // wrap: string;
11
- // gap: string;
12
- // justifyContent: string;
13
- // alignItems: string;
14
- // };
15
- // };
16
-
17
- // export function flex(opts: FlexOptions = {}) {
18
- // const {
19
- // title = "Layout",
20
- // defaultValue = {
21
- // direction: "flex-row",
22
- // gap: "gap-1",
23
- // wrap: "flex-wrap",
24
- // justifyContent: "justify-stretch",
25
- // alignItems: "items-stretch",
26
- // },
27
- // } = opts;
28
- // return prop({
29
- // title,
30
- // schema: Type.Object(
31
- // {
32
- // direction: Type.Optional(
33
- // StringEnum(["flex-row", "flex-col"], {
34
- // enumNames: ["Row", "Column"],
35
- // title: "Direction",
36
- // description: "The direction of the container.",
37
- // default: defaultValue.direction,
38
- // }),
39
- // ),
40
- // gap: Type.Optional(
41
- // Type.String({
42
- // title: "Gap",
43
- // description:
44
- // "Space between items. Can be a tailwind gap class like 'gap-1' or 'gap-2', or a custom value like '10px'",
45
- // default: defaultValue.gap,
46
- // // todo: make a specific field for gap
47
- // // "ui:field": "enum",
48
- // }),
49
- // ),
50
- // wrap: Type.Optional(
51
- // StringEnum(["flex-wrap", "flex-nowrap"], {
52
- // enumNames: ["Wrap", "No wrap"],
53
- // title: "Wrap",
54
- // description: "Wether to wrap items in the container.",
55
- // default: defaultValue.wrap,
56
- // }),
57
- // ),
58
- // justifyContent: Type.Optional(
59
- // StringEnum(
60
- // [
61
- // "justify-start",
62
- // "justify-center",
63
- // "justify-end",
64
- // "justify-between",
65
- // "justify-around",
66
- // "justify-evenly",
67
- // "justify-stretch",
68
- // ],
69
- // {
70
- // enumNames: [
71
- // "Start",
72
- // "Center",
73
- // "End",
74
- // "Space between",
75
- // "Space around",
76
- // "Evenly distributed",
77
- // "Stretch",
78
- // ],
79
- // title: "Justify",
80
- // description: "Justify content along the main axis (horizontal for row, vertical for column).",
81
- // default: defaultValue.justifyContent,
82
- // },
83
- // ),
84
- // ),
85
- // alignItems: Type.Optional(
86
- // StringEnum(["items-start", "items-center", "items-end", "items-stretch"], {
87
- // enumNames: ["Start", "Center", "End", "Stretch"],
88
- // title: "Alignment",
89
- // description: "Align items along the cross axis (vertical for row, horizontal for column).",
90
- // default: defaultValue.alignItems,
91
- // }),
92
- // ),
93
- // },
94
- // {
95
- // "ui:styleId": "#styles:flex",
96
- // "ui:field": "flex",
97
- // "ui:responsive": true,
98
- // default: {
99
- // direction: defaultValue.direction,
100
- // gap: defaultValue.gap,
101
- // wrap: defaultValue.wrap,
102
- // justifyContent: defaultValue.justifyContent,
103
- // alignItems: defaultValue.alignItems,
104
- // },
105
- // },
106
- // ),
107
- // });
108
- // }
109
-
110
- // export type FlexSettings = Static<ReturnType<typeof flex>>;
111
-
112
- // type GridOptions = {
113
- // title?: string;
114
- // defaultValue?: {
115
- // gap: string;
116
- // columns: number;
117
- // };
118
- // };
119
-
120
- // export function grid(options: GridOptions = {}) {
121
- // const { title = "Layout", defaultValue = { gap: "gap-1", columns: 2 } } = options;
122
- // return prop({
123
- // title,
124
- // schema: Type.Object(
125
- // {
126
- // columns: Type.Number({
127
- // title: "Columns",
128
- // description: "Number of columns",
129
- // "ui:group": "grid",
130
- // "ui:field": "slider",
131
- // default: 2,
132
- // minimum: 1,
133
- // maximum: 12,
134
- // }),
135
- // gap: Type.Optional(
136
- // Type.String({
137
- // title: "Gap",
138
- // description:
139
- // "Space between items. Can be a tailwind gap class like 'gap-1' or 'gap-2', or a custom value like '10px'",
140
- // default: defaultValue.gap,
141
- // // todo: make a specific field for gap
142
- // // "ui:field": "enum",
143
- // }),
144
- // ),
145
- // },
146
- // {
147
- // "ui:styleId": "#styles:grid",
148
- // "ui:field": "grid",
149
- // "ui:responsive": true,
150
- // default: defaultValue,
151
- // },
152
- // ),
153
- // });
154
- // }
155
-
156
- // export type GridSettings = Static<ReturnType<typeof grid>>;
157
-
158
- const isFlexLayoutFilter = (manifestProps: TObject, formData: Record<string, unknown>) => {
159
- const stylesProps = getStyleProperties(manifestProps);
160
- const currentStyle = getStyleValueById<ContainerLayoutSettings>(
161
- stylesProps,
162
- formData,
163
- "#styles:containerLayout",
164
- );
165
- return currentStyle?.type === "flex" || !currentStyle?.type;
166
- };
167
-
168
- const isGridLayoutFilter = (manifestProps: TObject, formData: Record<string, unknown>) => {
169
- return !isFlexLayoutFilter(manifestProps, formData);
170
- };
171
-
172
- type ContainerLayoutOptions = {
173
- title?: string;
174
- defaults?: {
175
- type?: "flex" | "grid";
176
- gap?: string;
177
- direction?: string;
178
- columns?: {
179
- max?: number;
180
- default?: number;
181
- };
182
- wrap?: boolean;
183
- fillSpace?: boolean;
184
- justifyContent?: string;
185
- alignItems?: string;
186
- };
187
- options?: {
188
- disableGrid?: boolean;
189
- };
190
- };
191
-
192
- function containerlayoutStyle(options: SchemaOptions = {}) {
193
- return Type.Object(
194
- {
195
- ...(!options.disableGrid
196
- ? {
197
- type: StringEnum(["flex", "grid"], {
198
- enumNames: ["Flex", "Grid"],
199
- title: "Layout type",
200
- description:
201
- "Type of the container. Flex layout arranges items in a one-dimensional line. Grid layout arranges items in a two-dimensional grid",
202
- "ui:field": "enum",
203
- "ui:responsive": true,
204
- }),
205
- }
206
- : {}),
207
-
208
- gap: Type.Optional(
209
- Type.String({
210
- title: "Gap",
211
- description:
212
- "Space between items. Can be a tailwind gap class like 'gap-1' or 'gap-2', or a custom value like '10px'",
213
- "ui:placeholder": "Not specified",
214
- // todo: make a specific field for gap
215
- // "ui:field": "enum",
216
- }),
217
- ),
218
- direction: optional(
219
- StringEnum(["flex-row", "flex-col"], {
220
- enumNames: ["Row", "Column"],
221
- title: "Direction",
222
- description: "The direction of the container. Only applies to flex layout",
223
- metadata: {
224
- filter: isFlexLayoutFilter,
225
- },
226
- }),
227
- ),
228
- columns: optional(
229
- Type.Number({
230
- title: "Columns",
231
- description: "Number of columns. Only applies to grid layout",
232
- "ui:field": "slider",
233
- minimum: 1,
234
- maximum: 16,
235
- metadata: {
236
- filter: isGridLayoutFilter,
237
- },
238
- }),
239
- ),
240
- wrap: optional(
241
- Type.Boolean({
242
- title: "Wrap",
243
- description: "Wrap items.",
244
- "ai:instructions": "Only applies to flex layout",
245
- metadata: {
246
- filter: isFlexLayoutFilter,
247
- },
248
- }),
249
- ),
250
- fillSpace: optional(
251
- Type.Boolean({
252
- title: "Fill space",
253
- description: "Makes items of the container fill the available space",
254
- "ai:instructions": "Only applies to flex layout",
255
- metadata: {
256
- filter: isFlexLayoutFilter,
257
- },
258
- }),
259
- ),
260
- justifyContent: Type.Optional(
261
- StringEnum(
262
- [
263
- "justify-start",
264
- "justify-center",
265
- "justify-end",
266
- "justify-between",
267
- "justify-around",
268
- "justify-evenly",
269
- "justify-stretch",
270
- ],
271
- {
272
- enumNames: [
273
- "Start",
274
- "Center",
275
- "End",
276
- "Space between",
277
- "Space around",
278
- "Evenly distributed",
279
- "Stretch",
280
- ],
281
- title: "Justify",
282
- description: "Justify content along the main axis (horizontal for row, vertical for column)",
283
- "ai:instructions": "Only applies to flex layout",
284
- metadata: {
285
- filter: isFlexLayoutFilter,
286
- },
287
- },
288
- ),
289
- ),
290
-
291
- alignItems: optional(
292
- Type.Union(
293
- [
294
- Type.Literal("items-start", { title: "Start" }),
295
- Type.Literal("items-center", { title: "Center" }),
296
- Type.Literal("items-end", { title: "End" }),
297
- Type.Literal("items-stretch", { title: "Stretch" }),
298
- ],
299
- {
300
- title: "Alignment",
301
- description: "Align items along the cross axis (vertical for row, horizontal for column)",
302
- "ai:instructions": "Only applies to flex layout",
303
- metadata: {
304
- filter: isFlexLayoutFilter,
305
- },
306
- },
307
- ),
308
- ),
309
- },
310
- { $id: "styles:containerLayout" },
311
- );
312
- }
313
-
314
- export function containerLayout({ title = "Layout", options = {} }: ContainerLayoutOptions = {}) {
315
- return group({
316
- title,
317
- options: {
318
- "ui:styleId": "#styles:containerLayout",
319
- $id: "styles:containerLayout",
320
- },
321
- children: containerlayoutStyle(options),
322
- });
323
- }
324
-
325
- export type ContainerLayoutSettings = Static<ReturnType<typeof containerLayout>>;
326
-
327
- export function containerLayoutRef(options: SchemaOptions = {}) {
328
- return typedRef("styles:containerLayout", {
329
- title: "Container layout",
330
- description: "Settings for the layout of the container",
331
- options: {
332
- ...options,
333
- disableGrid: options.disableGrid ?? false,
334
- },
335
- });
336
- }
337
-
338
- export function makeContainerProps() {
339
- return {
340
- $childrenType: Type.Optional(
341
- Type.String({
342
- title: "Dynamic child brick type",
343
- description: "Type of the child bricks that will be created when container is dynamic",
344
- "ui:field": "brick-type",
345
- metadata: {
346
- category: "content",
347
- },
348
- }),
349
- ),
350
- $children: Type.Array(Type.Any(), {
351
- "ui:field": "hidden",
352
- description: "List of nested bricks",
353
- default: [],
354
- }),
355
- };
356
- }
@@ -1,25 +0,0 @@
1
- import { type Static, Type, type StringOptions } from "@sinclair/typebox";
2
- import { prop } from "./helpers";
3
- import { typedRef } from "~/shared/utils/typed-ref";
4
-
5
- export function cssLength(options: StringOptions = {}) {
6
- const units = ["px", "%", "em", "rem", "vh", "vw", "dvh", "dvw", "rlh", "lh", "cqh", "cqw"];
7
- return prop({
8
- title: "Length",
9
- schema: Type.String({
10
- $id: "styles:cssLength",
11
- description: `A CSS length value. Must be a number with a unit (e.g. "10px", "50%"). The unit can be one of the following: ${units?.join(", ")}.`,
12
- title: "Length",
13
- default: options.default,
14
- ...options,
15
- "ui:field": "css-length",
16
- "ui:css-units": units,
17
- }),
18
- });
19
- }
20
-
21
- export type CssLength = Static<ReturnType<typeof cssLength>>;
22
-
23
- export function cssLengthRef(options: StringOptions = {}) {
24
- return typedRef("styles:cssLength", options);
25
- }
@@ -1,60 +0,0 @@
1
- import { Type, type Static } from "@sinclair/typebox";
2
- import { prop } from "./helpers";
3
-
4
- export function datasourceRef() {
5
- return prop({
6
- title: "Database",
7
- description: "Reference to a data source. Only used for dynamic websites",
8
- schema: Type.Object(
9
- {
10
- id: Type.String({
11
- title: "Data Source ID",
12
- }),
13
- mapping: Type.Record(Type.String(), Type.String(), {
14
- description: "Mapping of data source fields to brick props",
15
- }),
16
- filters: Type.Optional(
17
- Type.Record(
18
- Type.String(),
19
- Type.Object({
20
- op: Type.Union([
21
- Type.Literal("eq"),
22
- Type.Literal("ne"),
23
- Type.Literal("lt"),
24
- Type.Literal("lte"),
25
- Type.Literal("gt"),
26
- Type.Literal("gte"),
27
- Type.Literal("in"),
28
- Type.Literal("nin"),
29
- Type.Literal("contains"),
30
- Type.Literal("startsWith"),
31
- Type.Literal("endsWith"),
32
- ]),
33
- value: Type.String(),
34
- }),
35
- { description: "Filter data source records" },
36
- ),
37
- ),
38
- sort: Type.Optional(
39
- Type.Record(
40
- Type.String(),
41
- Type.Union([
42
- Type.Literal("asc", { title: "Ascending" }),
43
- Type.Literal("desc", { title: "Descending" }),
44
- ]),
45
- { description: "Sort data source records" },
46
- ),
47
- ),
48
- limit: Type.Optional(Type.Number({ description: "Limit the number of records to fetch" })),
49
- offset: Type.Optional(Type.Number({ description: "Offset the records to fetch" })),
50
- },
51
- {
52
- "ui:field": "datasource-ref",
53
- "ui:meta-type": "datasource-ref",
54
- description: "Datasource reference. Only used for dynamic websites. Do not use for static websites",
55
- },
56
- ),
57
- });
58
- }
59
-
60
- export type DatasourceRefSettings = Static<ReturnType<typeof datasourceRef>>;
@@ -1,24 +0,0 @@
1
- import { Type, type StringOptions } from "@sinclair/typebox";
2
- import { prop } from "./helpers";
3
-
4
- export function date(title = "Date", options?: StringOptions) {
5
- return prop({
6
- title,
7
- schema: Type.String({
8
- format: "date",
9
- "ui:field": "date",
10
- ...options,
11
- }),
12
- });
13
- }
14
-
15
- export function datetime(title = "Date and Time", options?: StringOptions) {
16
- return prop({
17
- title,
18
- schema: Type.String({
19
- format: "date-time",
20
- "ui:field": "datetime",
21
- ...options,
22
- }),
23
- });
24
- }
@@ -1,123 +0,0 @@
1
- import { type SchemaOptions, Type, type Static } from "@sinclair/typebox";
2
- import { group, optional, prop } from "./helpers";
3
- import { StringEnum } from "~/shared/utils/schema";
4
- import { typedRef } from "~/shared/utils/typed-ref";
5
-
6
- type ShadowOptions = {
7
- title?: string;
8
- defaultValue?: string;
9
- };
10
-
11
- export function shadow({ title = "Shadow", defaultValue = "shadow-none" }: ShadowOptions = {}) {
12
- return prop({
13
- title,
14
- schema: StringEnum(["shadow-none", "shadow-sm", "shadow-md", "shadow-lg", "shadow-xl", "shadow-2xl"], {
15
- $id: "styles:shadow",
16
- title,
17
- default: defaultValue,
18
- enumNames: ["None", "S", "M", "L", "XL", "2XL"],
19
- "ui:placeholder": "Not specified",
20
- "ui:field": "enum",
21
- "ui:display": "select",
22
- }),
23
- });
24
- }
25
-
26
- export type ShadowSettings = Static<ReturnType<typeof shadow>>;
27
-
28
- export function shadowRef(options: SchemaOptions & ShadowOptions = {}) {
29
- return typedRef("styles:shadow", { ...options, "ui:styleId": "#styles:shadow" });
30
- }
31
-
32
- type TextShadowOptions = {
33
- title?: string;
34
- defaultValue?: string;
35
- };
36
-
37
- export function textShadow({
38
- title = "Text shadow",
39
- defaultValue = "text-shadow-none",
40
- }: TextShadowOptions = {}) {
41
- return prop({
42
- title,
43
- schema: StringEnum(
44
- ["text-shadow-none", "text-shadow-sm", "text-shadow-md", "text-shadow-lg", "text-shadow-xl"],
45
- {
46
- default: defaultValue,
47
- enumNames: ["None", "Small", "Medium", "Large", "Extra large"],
48
- "ui:placeholder": "Not specified",
49
- "ui:field": "enum",
50
- },
51
- ),
52
- });
53
- }
54
-
55
- export type TextShadowSettings = Static<ReturnType<typeof textShadow>>;
56
-
57
- type OpacityOptions = {
58
- title?: string;
59
- defaultValue?: number;
60
- };
61
-
62
- export function opacity({ defaultValue = 1, title = "Opacity" }: OpacityOptions = {}) {
63
- return prop({
64
- title,
65
- schema: Type.Number({
66
- minimum: 0.1,
67
- maximum: 1,
68
- default: defaultValue,
69
- multipleOf: 0.1,
70
- "ui:field": "slider",
71
- "ui:unit": "%",
72
- "ui:multiplier": 100,
73
- }),
74
- });
75
- }
76
-
77
- export type OpacitySettings = Static<ReturnType<typeof opacity>>;
78
-
79
- type EffectsOptions = {
80
- title?: string;
81
- defaultValue?: {
82
- opacity?: number;
83
- shadow?: string;
84
- textShadow?: string;
85
- };
86
- enableTextShadow?: boolean;
87
- };
88
-
89
- // export function effects({ title = "Effects", defaultValue = {}, enableTextShadow }: EffectsOptions = {}) {
90
- // return group({
91
- // title,
92
- // options: {
93
- // default: defaultValue,
94
- // $id: "styles:effects",
95
- // },
96
- // children: {
97
- // opacity: optional(
98
- // opacity({
99
- // title: "Opacity",
100
- // defaultValue: defaultValue.opacity,
101
- // }),
102
- // ),
103
- // shadow: optional(
104
- // shadowRef({
105
- // title: "Shadow",
106
- // defaultValue: defaultValue.shadow,
107
- // }),
108
- // ),
109
- // ...(enableTextShadow && {
110
- // textShadow: optional(
111
- // textShadow({
112
- // title: "Text shadow",
113
- // defaultValue: defaultValue.textShadow,
114
- // }),
115
- // ),
116
- // }),
117
- // },
118
- // });
119
- // }
120
-
121
- // export function effectsRef(options: SchemaOptions & EffectsOptions = {}) {
122
- // return typedRef("styles:effects", options);
123
- // }
@@ -1,42 +0,0 @@
1
- import { type SchemaOptions, Type, type StringOptions } from "@sinclair/typebox";
2
- import { prop } from "./helpers";
3
-
4
- type EnumOption = {
5
- title?: string;
6
- description?: string;
7
- value: string;
8
- icon?: string;
9
- };
10
-
11
- export function enumProp(
12
- title: string,
13
- defaultValue: string,
14
- opts: Omit<SchemaOptions, "title" | "default"> & {
15
- options: EnumOption[] | string[];
16
- displayAs?: "radio" | "select" | "button-group" | "icon-group";
17
- },
18
- ) {
19
- const defaultOpts = {
20
- "ui:field": "enum",
21
- "ui:display": opts.displayAs || "select",
22
- };
23
- const { options, displayAs, ...commonOpts } = opts;
24
-
25
- return prop({
26
- title,
27
- schema: Type.Union(
28
- options.map((opt) =>
29
- Type.Literal(typeof opt === "string" ? opt : opt.value, {
30
- title: typeof opt === "string" ? opt : opt.title,
31
- "ui:icon": typeof opt === "string" ? undefined : opt.icon,
32
- }),
33
- ),
34
- {
35
- title,
36
- default: defaultValue,
37
- ...defaultOpts,
38
- ...commonOpts,
39
- },
40
- ),
41
- });
42
- }
@@ -1,12 +0,0 @@
1
- import { Type } from "@sinclair/typebox";
2
- import { prop } from "./helpers";
3
-
4
- export function file(title = "File") {
5
- return prop({
6
- title,
7
- schema: Type.String({
8
- format: "data-url",
9
- "ui:field": "file",
10
- }),
11
- });
12
- }
@@ -1,30 +0,0 @@
1
- import { Type, type Static } from "@sinclair/typebox";
2
- import { prop } from "./helpers";
3
-
4
- type GeolocationOptions = {
5
- title?: string;
6
- defaultValue?: {
7
- lat: number;
8
- lng: number;
9
- };
10
- };
11
-
12
- export function geolocation(opts: GeolocationOptions = {}) {
13
- const { title = "Geolocation", defaultValue = { lat: 48.864716, lng: 2.349014 } } = opts;
14
- return prop({
15
- title,
16
- schema: Type.Object(
17
- {
18
- lat: Type.Number({ minimum: -90, maximum: 90 }),
19
- lng: Type.Number({ minimum: -180, maximum: 180 }),
20
- label: Type.Optional(Type.String({ title: "Tooltip" })),
21
- },
22
- {
23
- "ui:field": "geo-point",
24
- default: defaultValue,
25
- },
26
- ),
27
- });
28
- }
29
-
30
- export type GeolocationSettings = Static<ReturnType<typeof geolocation>>;