@superblocksteam/vite-plugin-file-sync 2.0.6 → 2.0.7

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 (288) hide show
  1. package/dist/ai-service/app-interface/linter.d.ts +7 -2
  2. package/dist/ai-service/app-interface/linter.d.ts.map +1 -1
  3. package/dist/ai-service/app-interface/linter.js +52 -41
  4. package/dist/ai-service/app-interface/linter.js.map +1 -1
  5. package/dist/ai-service/app-interface/shell.d.ts +2 -0
  6. package/dist/ai-service/app-interface/shell.d.ts.map +1 -1
  7. package/dist/ai-service/app-interface/shell.js +13 -4
  8. package/dist/ai-service/app-interface/shell.js.map +1 -1
  9. package/dist/ai-service/const.d.ts +2 -0
  10. package/dist/ai-service/const.d.ts.map +1 -1
  11. package/dist/ai-service/const.js +2 -0
  12. package/dist/ai-service/const.js.map +1 -1
  13. package/dist/ai-service/eval/template-renderer.d.ts.map +1 -1
  14. package/dist/ai-service/eval/template-renderer.js +1 -1
  15. package/dist/ai-service/eval/template-renderer.js.map +1 -1
  16. package/dist/ai-service/index.d.ts.map +1 -1
  17. package/dist/ai-service/index.js +4 -12
  18. package/dist/ai-service/index.js.map +1 -1
  19. package/dist/ai-service/integrations/from-prompt-context.d.ts +1 -1
  20. package/dist/ai-service/integrations/from-prompt-context.d.ts.map +1 -1
  21. package/dist/ai-service/prompts/generated/library-components/SbButtonPropsDocs.d.ts +1 -1
  22. package/dist/ai-service/prompts/generated/library-components/SbButtonPropsDocs.d.ts.map +1 -1
  23. package/dist/ai-service/prompts/generated/library-components/SbButtonPropsDocs.js +2 -2
  24. package/dist/ai-service/prompts/generated/library-components/SbButtonPropsDocs.js.map +1 -1
  25. package/dist/ai-service/prompts/generated/library-components/SbCheckboxPropsDocs.d.ts +1 -1
  26. package/dist/ai-service/prompts/generated/library-components/SbCheckboxPropsDocs.d.ts.map +1 -1
  27. package/dist/ai-service/prompts/generated/library-components/SbCheckboxPropsDocs.js +2 -2
  28. package/dist/ai-service/prompts/generated/library-components/SbCheckboxPropsDocs.js.map +1 -1
  29. package/dist/ai-service/prompts/generated/library-components/SbColumnPropsDocs.d.ts +1 -1
  30. package/dist/ai-service/prompts/generated/library-components/SbColumnPropsDocs.d.ts.map +1 -1
  31. package/dist/ai-service/prompts/generated/library-components/SbColumnPropsDocs.js +2 -2
  32. package/dist/ai-service/prompts/generated/library-components/SbColumnPropsDocs.js.map +1 -1
  33. package/dist/ai-service/prompts/generated/library-components/SbContainerPropsDocs.d.ts +1 -1
  34. package/dist/ai-service/prompts/generated/library-components/SbContainerPropsDocs.d.ts.map +1 -1
  35. package/dist/ai-service/prompts/generated/library-components/SbContainerPropsDocs.js +2 -2
  36. package/dist/ai-service/prompts/generated/library-components/SbContainerPropsDocs.js.map +1 -1
  37. package/dist/ai-service/prompts/generated/library-components/SbDatePickerPropsDocs.d.ts +1 -1
  38. package/dist/ai-service/prompts/generated/library-components/SbDatePickerPropsDocs.d.ts.map +1 -1
  39. package/dist/ai-service/prompts/generated/library-components/SbDatePickerPropsDocs.js +2 -2
  40. package/dist/ai-service/prompts/generated/library-components/SbDatePickerPropsDocs.js.map +1 -1
  41. package/dist/ai-service/prompts/generated/library-components/SbDropdownPropsDocs.d.ts +1 -1
  42. package/dist/ai-service/prompts/generated/library-components/SbDropdownPropsDocs.d.ts.map +1 -1
  43. package/dist/ai-service/prompts/generated/library-components/SbDropdownPropsDocs.js +2 -2
  44. package/dist/ai-service/prompts/generated/library-components/SbDropdownPropsDocs.js.map +1 -1
  45. package/dist/ai-service/prompts/generated/library-components/SbIconPropsDocs.d.ts +1 -1
  46. package/dist/ai-service/prompts/generated/library-components/SbIconPropsDocs.d.ts.map +1 -1
  47. package/dist/ai-service/prompts/generated/library-components/SbIconPropsDocs.js +2 -2
  48. package/dist/ai-service/prompts/generated/library-components/SbIconPropsDocs.js.map +1 -1
  49. package/dist/ai-service/prompts/generated/library-components/SbImagePropsDocs.d.ts +1 -1
  50. package/dist/ai-service/prompts/generated/library-components/SbImagePropsDocs.d.ts.map +1 -1
  51. package/dist/ai-service/prompts/generated/library-components/SbImagePropsDocs.js +2 -2
  52. package/dist/ai-service/prompts/generated/library-components/SbImagePropsDocs.js.map +1 -1
  53. package/dist/ai-service/prompts/generated/library-components/SbInputPropsDocs.d.ts +1 -1
  54. package/dist/ai-service/prompts/generated/library-components/SbInputPropsDocs.d.ts.map +1 -1
  55. package/dist/ai-service/prompts/generated/library-components/SbInputPropsDocs.js +2 -2
  56. package/dist/ai-service/prompts/generated/library-components/SbInputPropsDocs.js.map +1 -1
  57. package/dist/ai-service/prompts/generated/library-components/SbModalPropsDocs.d.ts +1 -1
  58. package/dist/ai-service/prompts/generated/library-components/SbModalPropsDocs.d.ts.map +1 -1
  59. package/dist/ai-service/prompts/generated/library-components/SbModalPropsDocs.js +2 -2
  60. package/dist/ai-service/prompts/generated/library-components/SbModalPropsDocs.js.map +1 -1
  61. package/dist/ai-service/prompts/generated/library-components/SbPagePropsDocs.d.ts +1 -1
  62. package/dist/ai-service/prompts/generated/library-components/SbPagePropsDocs.d.ts.map +1 -1
  63. package/dist/ai-service/prompts/generated/library-components/SbPagePropsDocs.js +2 -2
  64. package/dist/ai-service/prompts/generated/library-components/SbPagePropsDocs.js.map +1 -1
  65. package/dist/ai-service/prompts/generated/library-components/SbSectionPropsDocs.d.ts +1 -1
  66. package/dist/ai-service/prompts/generated/library-components/SbSectionPropsDocs.d.ts.map +1 -1
  67. package/dist/ai-service/prompts/generated/library-components/SbSectionPropsDocs.js +2 -2
  68. package/dist/ai-service/prompts/generated/library-components/SbSectionPropsDocs.js.map +1 -1
  69. package/dist/ai-service/prompts/generated/library-components/SbSlideoutPropsDocs.d.ts +1 -1
  70. package/dist/ai-service/prompts/generated/library-components/SbSlideoutPropsDocs.d.ts.map +1 -1
  71. package/dist/ai-service/prompts/generated/library-components/SbSlideoutPropsDocs.js +2 -2
  72. package/dist/ai-service/prompts/generated/library-components/SbSlideoutPropsDocs.js.map +1 -1
  73. package/dist/ai-service/prompts/generated/library-components/SbSwitchPropsDocs.d.ts +1 -1
  74. package/dist/ai-service/prompts/generated/library-components/SbSwitchPropsDocs.d.ts.map +1 -1
  75. package/dist/ai-service/prompts/generated/library-components/SbSwitchPropsDocs.js +2 -2
  76. package/dist/ai-service/prompts/generated/library-components/SbSwitchPropsDocs.js.map +1 -1
  77. package/dist/ai-service/prompts/generated/library-components/SbTablePropsDocs.d.ts +1 -1
  78. package/dist/ai-service/prompts/generated/library-components/SbTablePropsDocs.d.ts.map +1 -1
  79. package/dist/ai-service/prompts/generated/library-components/SbTablePropsDocs.js +2 -2
  80. package/dist/ai-service/prompts/generated/library-components/SbTablePropsDocs.js.map +1 -1
  81. package/dist/ai-service/prompts/generated/library-components/SbTextPropsDocs.d.ts +1 -1
  82. package/dist/ai-service/prompts/generated/library-components/SbTextPropsDocs.d.ts.map +1 -1
  83. package/dist/ai-service/prompts/generated/library-components/SbTextPropsDocs.js +2 -2
  84. package/dist/ai-service/prompts/generated/library-components/SbTextPropsDocs.js.map +1 -1
  85. package/dist/ai-service/prompts/generated/library-typedefs/Dim.js +1 -1
  86. package/dist/ai-service/prompts/generated/library-typedefs/SbEventFlow.js +1 -1
  87. package/dist/ai-service/prompts/generated/library-typedefs/TextStyleWithVariant.d.ts +2 -0
  88. package/dist/ai-service/prompts/generated/library-typedefs/TextStyleWithVariant.d.ts.map +1 -0
  89. package/dist/ai-service/prompts/generated/library-typedefs/TextStyleWithVariant.js +6 -0
  90. package/dist/ai-service/prompts/generated/library-typedefs/TextStyleWithVariant.js.map +1 -0
  91. package/dist/ai-service/prompts/generated/library-typedefs/index.d.ts +1 -0
  92. package/dist/ai-service/prompts/generated/library-typedefs/index.d.ts.map +1 -1
  93. package/dist/ai-service/prompts/generated/library-typedefs/index.js +1 -0
  94. package/dist/ai-service/prompts/generated/library-typedefs/index.js.map +1 -1
  95. package/dist/ai-service/prompts/generated/subprompts/full-examples.js +1 -1
  96. package/dist/ai-service/prompts/generated/subprompts/superblocks-api.d.ts +1 -1
  97. package/dist/ai-service/prompts/generated/subprompts/superblocks-api.d.ts.map +1 -1
  98. package/dist/ai-service/prompts/generated/subprompts/superblocks-api.js +2 -2
  99. package/dist/ai-service/prompts/generated/subprompts/superblocks-api.js.map +1 -1
  100. package/dist/ai-service/prompts/generated/subprompts/superblocks-components-rules.js +1 -1
  101. package/dist/ai-service/prompts/generated/subprompts/superblocks-custom-components.js +1 -1
  102. package/dist/ai-service/prompts/generated/subprompts/superblocks-data-filtering.js +1 -1
  103. package/dist/ai-service/prompts/generated/subprompts/superblocks-event-flow.js +1 -1
  104. package/dist/ai-service/prompts/generated/subprompts/superblocks-forms.js +1 -1
  105. package/dist/ai-service/prompts/generated/subprompts/superblocks-layouts.js +1 -1
  106. package/dist/ai-service/prompts/generated/subprompts/superblocks-page.js +1 -1
  107. package/dist/ai-service/prompts/generated/subprompts/superblocks-rbac.js +1 -1
  108. package/dist/ai-service/prompts/generated/subprompts/superblocks-routes.js +1 -1
  109. package/dist/ai-service/prompts/generated/subprompts/superblocks-state.js +1 -1
  110. package/dist/ai-service/prompts/generated/subprompts/superblocks-theming.js +1 -1
  111. package/dist/ai-service/prompts/generated/subprompts/system.js +1 -1
  112. package/dist/ai-service/prompts/system.d.ts.map +1 -1
  113. package/dist/ai-service/prompts/system.js +4 -0
  114. package/dist/ai-service/prompts/system.js.map +1 -1
  115. package/dist/ai-service/state-machine/clark-fsm.d.ts +2 -0
  116. package/dist/ai-service/state-machine/clark-fsm.d.ts.map +1 -1
  117. package/dist/ai-service/state-machine/handlers/agent-planning.d.ts.map +1 -1
  118. package/dist/ai-service/state-machine/handlers/agent-planning.js +13 -2
  119. package/dist/ai-service/state-machine/handlers/agent-planning.js.map +1 -1
  120. package/dist/ai-service/state-machine/handlers/llm-generating.d.ts +1 -1
  121. package/dist/ai-service/state-machine/handlers/llm-generating.d.ts.map +1 -1
  122. package/dist/ai-service/state-machine/handlers/llm-generating.js +75 -24
  123. package/dist/ai-service/state-machine/handlers/llm-generating.js.map +1 -1
  124. package/dist/ai-service/state-machine/handlers/runtime-reviewing.d.ts.map +1 -1
  125. package/dist/ai-service/state-machine/handlers/runtime-reviewing.js +18 -6
  126. package/dist/ai-service/state-machine/handlers/runtime-reviewing.js.map +1 -1
  127. package/dist/ai-service/state-machine/helpers/rate-limiting.d.ts +6 -0
  128. package/dist/ai-service/state-machine/helpers/rate-limiting.d.ts.map +1 -0
  129. package/dist/ai-service/state-machine/helpers/rate-limiting.js +26 -0
  130. package/dist/ai-service/state-machine/helpers/rate-limiting.js.map +1 -0
  131. package/dist/ai-service/test-utils/app-generation-mocks/orders-app.d.ts +3 -0
  132. package/dist/ai-service/test-utils/app-generation-mocks/orders-app.d.ts.map +1 -0
  133. package/dist/ai-service/test-utils/app-generation-mocks/orders-app.js +851 -0
  134. package/dist/ai-service/test-utils/app-generation-mocks/orders-app.js.map +1 -0
  135. package/dist/ai-service/test-utils/app-generation-mocks/smoketest.d.ts +3 -0
  136. package/dist/ai-service/test-utils/app-generation-mocks/smoketest.d.ts.map +1 -0
  137. package/dist/ai-service/test-utils/app-generation-mocks/smoketest.js +111 -0
  138. package/dist/ai-service/test-utils/app-generation-mocks/smoketest.js.map +1 -0
  139. package/dist/ai-service/test-utils/mock-utils.d.ts +22 -0
  140. package/dist/ai-service/test-utils/mock-utils.d.ts.map +1 -0
  141. package/dist/ai-service/test-utils/mock-utils.js +46 -0
  142. package/dist/ai-service/test-utils/mock-utils.js.map +1 -0
  143. package/dist/ai-service/transform/add-metadata-to-api-yaml/transformer.d.ts.map +1 -1
  144. package/dist/ai-service/transform/add-metadata-to-api-yaml/transformer.js +3 -2
  145. package/dist/ai-service/transform/add-metadata-to-api-yaml/transformer.js.map +1 -1
  146. package/dist/ai-service/transform/shared.d.ts.map +1 -1
  147. package/dist/ai-service/transform/shared.js +9 -8
  148. package/dist/ai-service/transform/shared.js.map +1 -1
  149. package/dist/ai-service/types.d.ts +23 -10
  150. package/dist/ai-service/types.d.ts.map +1 -1
  151. package/dist/ai-service/types.js.map +1 -1
  152. package/dist/binding-extraction/extract-control-block-identifiers.d.ts +1 -1
  153. package/dist/binding-extraction/extract-control-block-identifiers.d.ts.map +1 -1
  154. package/dist/binding-extraction/extract-control-block-identifiers.js +15 -13
  155. package/dist/binding-extraction/extract-control-block-identifiers.js.map +1 -1
  156. package/dist/binding-extraction/extract-identifiers.d.ts +3 -3
  157. package/dist/binding-extraction/extract-identifiers.d.ts.map +1 -1
  158. package/dist/binding-extraction/extract-identifiers.js +83 -52
  159. package/dist/binding-extraction/extract-identifiers.js.map +1 -1
  160. package/dist/binding-extraction/index.d.ts +2 -0
  161. package/dist/binding-extraction/index.d.ts.map +1 -0
  162. package/dist/binding-extraction/index.js +2 -0
  163. package/dist/binding-extraction/index.js.map +1 -0
  164. package/dist/binding-extraction/shared.d.ts +0 -199
  165. package/dist/binding-extraction/shared.d.ts.map +1 -1
  166. package/dist/binding-extraction/shared.js +1 -42
  167. package/dist/binding-extraction/shared.js.map +1 -1
  168. package/dist/codegen.js +1 -1
  169. package/dist/codegen.js.map +1 -1
  170. package/dist/components-manager.d.ts +4 -1
  171. package/dist/components-manager.d.ts.map +1 -1
  172. package/dist/components-manager.js +34 -4
  173. package/dist/components-manager.js.map +1 -1
  174. package/dist/file-sync-vite-plugin.d.ts.map +1 -1
  175. package/dist/file-sync-vite-plugin.js +44 -17
  176. package/dist/file-sync-vite-plugin.js.map +1 -1
  177. package/dist/file-system-helpers.d.ts +4 -0
  178. package/dist/file-system-helpers.d.ts.map +1 -1
  179. package/dist/file-system-helpers.js +10 -0
  180. package/dist/file-system-helpers.js.map +1 -1
  181. package/dist/file-system-manager.d.ts +52 -39
  182. package/dist/file-system-manager.d.ts.map +1 -1
  183. package/dist/file-system-manager.js +659 -532
  184. package/dist/file-system-manager.js.map +1 -1
  185. package/dist/index.d.ts +1 -0
  186. package/dist/index.d.ts.map +1 -1
  187. package/dist/index.js +1 -0
  188. package/dist/index.js.map +1 -1
  189. package/dist/inject-index-vite-plugin.d.ts +0 -2
  190. package/dist/inject-index-vite-plugin.d.ts.map +1 -1
  191. package/dist/inject-index-vite-plugin.js +2 -2
  192. package/dist/inject-index-vite-plugin.js.map +1 -1
  193. package/dist/injected-index.d.ts +2 -2
  194. package/dist/injected-index.d.ts.map +1 -1
  195. package/dist/injected-index.js.map +1 -1
  196. package/dist/lock-service/index.d.ts.map +1 -1
  197. package/dist/lock-service/index.js +13 -2
  198. package/dist/lock-service/index.js.map +1 -1
  199. package/dist/operations/operation-processor.d.ts +24 -0
  200. package/dist/operations/operation-processor.d.ts.map +1 -0
  201. package/dist/operations/operation-processor.js +80 -0
  202. package/dist/operations/operation-processor.js.map +1 -0
  203. package/dist/operations/types.d.ts +8 -0
  204. package/dist/operations/types.d.ts.map +1 -0
  205. package/dist/operations/types.js +2 -0
  206. package/dist/operations/types.js.map +1 -0
  207. package/dist/parsing/computed/to-code-computed.d.ts.map +1 -1
  208. package/dist/parsing/computed/to-code-computed.js +7 -3
  209. package/dist/parsing/computed/to-code-computed.js.map +1 -1
  210. package/dist/parsing/entity/to-value-entity.js.map +1 -1
  211. package/dist/parsing/events/to-code-events.d.ts +1 -1
  212. package/dist/parsing/events/to-code-events.d.ts.map +1 -1
  213. package/dist/parsing/events/to-code-events.js +15 -4
  214. package/dist/parsing/events/to-code-events.js.map +1 -1
  215. package/dist/parsing/events/to-value-events.d.ts.map +1 -1
  216. package/dist/parsing/events/to-value-events.js +47 -0
  217. package/dist/parsing/events/to-value-events.js.map +1 -1
  218. package/dist/parsing/index.d.ts +3 -0
  219. package/dist/parsing/index.d.ts.map +1 -0
  220. package/dist/parsing/index.js +3 -0
  221. package/dist/parsing/index.js.map +1 -0
  222. package/dist/parsing/properties.js.map +1 -1
  223. package/dist/parsing/template/index.js +1 -1
  224. package/dist/parsing/template/index.js.map +1 -1
  225. package/dist/parsing/template/to-code-template.d.ts +2 -1
  226. package/dist/parsing/template/to-code-template.d.ts.map +1 -1
  227. package/dist/parsing/template/to-code-template.js +2 -2
  228. package/dist/parsing/template/to-code-template.js.map +1 -1
  229. package/dist/plugin-options.d.ts +0 -2
  230. package/dist/plugin-options.d.ts.map +1 -1
  231. package/dist/plugin-options.js.map +1 -1
  232. package/dist/refactor/blocks.d.ts.map +1 -1
  233. package/dist/refactor/blocks.js +2 -69
  234. package/dist/refactor/blocks.js.map +1 -1
  235. package/dist/refactor/entities.d.ts +6 -0
  236. package/dist/refactor/entities.d.ts.map +1 -0
  237. package/dist/refactor/entities.js +62 -0
  238. package/dist/refactor/entities.js.map +1 -0
  239. package/dist/refactor/javascript.d.ts +0 -4
  240. package/dist/refactor/javascript.d.ts.map +1 -1
  241. package/dist/refactor/javascript.js +0 -8
  242. package/dist/refactor/javascript.js.map +1 -1
  243. package/dist/rename-manager.d.ts +0 -5
  244. package/dist/rename-manager.d.ts.map +1 -1
  245. package/dist/rename-manager.js +1 -27
  246. package/dist/rename-manager.js.map +1 -1
  247. package/dist/routing.d.ts +2 -2
  248. package/dist/routing.d.ts.map +1 -1
  249. package/dist/routing.js +21 -1
  250. package/dist/routing.js.map +1 -1
  251. package/dist/sb-scope-manager.d.ts +1 -1
  252. package/dist/sb-scope-manager.d.ts.map +1 -1
  253. package/dist/sb-scope-manager.js +10 -0
  254. package/dist/sb-scope-manager.js.map +1 -1
  255. package/dist/socket-manager.d.ts +2 -2
  256. package/dist/socket-manager.d.ts.map +1 -1
  257. package/dist/socket-manager.js +7 -5
  258. package/dist/socket-manager.js.map +1 -1
  259. package/dist/source-tracker.d.ts +20 -20
  260. package/dist/source-tracker.d.ts.map +1 -1
  261. package/dist/source-tracker.js +33 -17
  262. package/dist/source-tracker.js.map +1 -1
  263. package/dist/sync-service/hash-cache.d.ts +1 -0
  264. package/dist/sync-service/hash-cache.d.ts.map +1 -1
  265. package/dist/sync-service/hash-cache.js +4 -0
  266. package/dist/sync-service/hash-cache.js.map +1 -1
  267. package/dist/sync-service/index.d.ts +4 -0
  268. package/dist/sync-service/index.d.ts.map +1 -1
  269. package/dist/sync-service/index.js +30 -2
  270. package/dist/sync-service/index.js.map +1 -1
  271. package/dist/sync-service/list-dir.js +1 -1
  272. package/dist/sync-service/list-dir.js.map +1 -1
  273. package/dist/sync-service/server-rpc/client.d.ts.map +1 -1
  274. package/dist/sync-service/server-rpc/client.js +4 -1
  275. package/dist/sync-service/server-rpc/client.js.map +1 -1
  276. package/dist/util/logger.d.ts +13 -17
  277. package/dist/util/logger.d.ts.map +1 -1
  278. package/dist/util/logger.js +34 -44
  279. package/dist/util/logger.js.map +1 -1
  280. package/dist/util.d.ts +1 -0
  281. package/dist/util.d.ts.map +1 -1
  282. package/dist/util.js +8 -0
  283. package/dist/util.js.map +1 -1
  284. package/package.json +15 -6
  285. package/dist/util/tracing.d.ts +0 -4
  286. package/dist/util/tracing.d.ts.map +0 -1
  287. package/dist/util/tracing.js +0 -56
  288. package/dist/util/tracing.js.map +0 -1
@@ -1,2 +1,2 @@
1
- export declare const content = "## SbText\n\nThe following is the type definition for the SbText component.\n\n```typescript\ninterface SbTextProps {\n text?: string;\n /** @default \"text\" */\n textType?: \"text\" | \"number\" | \"currency\" | \"date\";\n /** @default \"Computed at runtime\" */\n textStyle?: Record<string, any>;\n /** @default \"left\" */\n horizontalAlign?: \"left\" | \"center\" | \"right\";\n /** @default \"center\" */\n verticalAlign?: \"top\" | \"center\" | \"bottom\";\n /** @default true */\n wrapText?: boolean;\n /** @default false */\n loading?: boolean;\n shouldScroll?: boolean;\n icon?: string;\n /** @default \"left\" */\n iconPosition?: \"left\" | \"right\";\n textType?: string;\n /** @default \"USD\" */\n currency?: \"AED\" | \"AFN\" | \"ALL\" | \"AMD\" | \"ANG\" | \"AOA\" | \"ARS\" | \"AUD\" | \"AWG\" | \"AZN\" | \"BAM\" | \"BBD\" | \"BDT\" | \"BGN\" | \"BHD\" | \"BIF\" | \"BMD\" | \"BND\" | \"BOB\" | \"BOV\" | \"BRL\" | \"BSD\" | \"BTN\" | \"BWP\" | \"BYN\" | \"BZD\" | \"CAD\" | \"CDF\" | \"CHE\" | \"CHF\" | \"CHW\" | \"CLF\" | \"CLP\" | \"CNY\" | \"COP\" | \"COU\" | \"CRC\" | \"CUC\" | \"CUP\" | \"CVE\" | \"CZK\" | \"DJF\" | \"DKK\" | \"DOP\" | \"DZD\" | \"EGP\" | \"ERN\" | \"ETB\" | \"EUR\" | \"FJD\" | \"FKP\" | \"GBP\" | \"GEL\" | \"GHS\" | \"GIP\" | \"GMD\" | \"GNF\" | \"GTQ\" | \"GYD\" | \"HKD\" | \"HNL\" | \"HRK\" | \"HTG\" | \"HUF\" | \"IDR\" | \"ILS\" | \"INR\" | \"IQD\" | \"IRR\" | \"ISK\" | \"JMD\" | \"JOD\" | \"JPY\" | \"KES\" | \"KGS\" | \"KHR\" | \"KMF\" | \"KPW\" | \"KRW\" | \"KWD\" | \"KYD\" | \"KZT\" | \"LAK\" | \"LBP\" | \"LKR\" | \"LRD\" | \"LSL\" | \"LYD\" | \"MAD\" | \"MDL\" | \"MGA\" | \"MKD\" | \"MMK\" | \"MNT\" | \"MOP\" | \"MRU\" | \"MUR\" | \"MVR\" | \"MWK\" | \"MXN\" | \"MXV\" | \"MYR\" | \"MZN\" | \"NAD\" | \"NGN\" | \"NIO\" | \"NOK\" | \"NPR\" | \"NZD\" | \"OMR\" | \"PAB\" | \"PEN\" | \"PGK\" | \"PHP\" | \"PKR\" | \"PLN\" | \"PYG\" | \"QAR\" | \"RON\" | \"RSD\" | \"RUB\" | \"RWF\" | \"SAR\" | \"SBD\" | \"SCR\" | \"SDG\" | \"SEK\" | \"SGD\" | \"SHP\" | \"SLL\" | \"SOS\" | \"SRD\" | \"SSP\" | \"STN\" | \"SVC\" | \"SYP\" | \"SZL\" | \"THB\" | \"TJS\" | \"TMT\" | \"TND\" | \"TOP\" | \"TRY\" | \"TTD\" | \"TWD\" | \"TZS\" | \"UAH\" | \"UGX\" | \"USD\" | \"USN\" | \"UYI\" | \"UYU\" | \"UYW\" | \"UZS\" | \"VED\" | \"VES\" | \"VND\" | \"VUV\" | \"WST\" | \"XAF\" | \"XAG\" | \"XAU\" | \"XBA\" | \"XBB\" | \"XBC\" | \"XBD\" | \"XCD\" | \"XDR\" | \"XOF\" | \"XPD\" | \"XPF\" | \"XPT\" | \"XSU\" | \"XTS\" | \"XUA\" | \"XXX\" | \"YER\" | \"ZAR\" | \"ZMW\" | \"ZWL\";\n /** @default \"standard\" */\n numberFormat?: \"unformatted\" | \"standard\" | \"compact\" | \"scientific\" | \"engineering\";\n minDecimals?: number;\n maxDecimals?: number;\n dateInputFormat?: \"undefined\" | \"X\" | \"x\" | \"MM-DD-YYYY\" | \"MM-DD-YYYY HH:mm\" | \"MM-DD-YYYY HH:mm:ss\" | \"MM-DD-YYYY hh:mm:ss a\" | \"MM-DD-YYYYTHH:mm:ss.sssZ\" | \"YYYY-MM-DD\" | \"YYYY-MM-DD HH:mm\" | \"YYYY-MM-DD HH:mm:ss\" | \"YYYY-MM-DD HH:mm:ssZ\" | \"YYYY-MM-DDTHH:mm:ss.sssZ\" | \"YYYY-MM-DD hh:mm:ss a\" | \"YYYY-MM-DDTHH:mm:ss\" | \"DD-MM-YYYY\" | \"DD-MM-YYYY HH:mm\" | \"DD-MM-YYYY HH:mm:ss\" | \"DD-MM-YYYY hh:mm:ss a\" | \"DD-MM-YYYYTHH:mm:ss.sssZ\" | \"Do MMM YYYY\" | \"MM/DD/YYYY\" | \"MM/DD/YYYY HH:mm\" | \"MM/DD/YYYY HH:mm:ss\" | \"MM/DD/YYYY hh:mm:ss a\" | \"MM/DD/YYYYTHH:mm:ss.sssZ\" | \"YYYY/MM/DD\" | \"YYYY/MM/DD HH:mm\" | \"YYYY/MM/DD HH:mm:ss\" | \"YYYY/MM/DD hh:mm:ss a\" | \"YYYY/MM/DDTHH:mm:ss\" | \"DD/MM/YYYY\" | \"DD/MM/YYYY HH:mm\" | \"DD/MM/YYYY HH:mm:ss\" | \"DD/MM/YYYY hh:mm:ss a\" | \"DD/MM/YYYYTHH:mm:ss.sssZ\";\n dateOutputFormat?: \"X\" | \"x\" | \"MM-DD-YYYY\" | \"MM-DD-YYYY HH:mm\" | \"MM-DD-YYYY HH:mm:ss\" | \"MM-DD-YYYY hh:mm:ss a\" | \"MM-DD-YYYYTHH:mm:ss.sssZ\" | \"YYYY-MM-DD\" | \"YYYY-MM-DD HH:mm\" | \"YYYY-MM-DD HH:mm:ss\" | \"YYYY-MM-DD HH:mm:ssZ\" | \"YYYY-MM-DDTHH:mm:ss.sssZ\" | \"YYYY-MM-DD hh:mm:ss a\" | \"YYYY-MM-DDTHH:mm:ss\" | \"DD-MM-YYYY\" | \"DD-MM-YYYY HH:mm\" | \"DD-MM-YYYY HH:mm:ss\" | \"DD-MM-YYYY hh:mm:ss a\" | \"DD-MM-YYYYTHH:mm:ss.sssZ\" | \"Do MMM YYYY\" | \"MM/DD/YYYY\" | \"MM/DD/YYYY HH:mm\" | \"MM/DD/YYYY HH:mm:ss\" | \"MM/DD/YYYY hh:mm:ss a\" | \"MM/DD/YYYYTHH:mm:ss.sssZ\" | \"YYYY/MM/DD\" | \"YYYY/MM/DD HH:mm\" | \"YYYY/MM/DD HH:mm:ss\" | \"YYYY/MM/DD hh:mm:ss a\" | \"YYYY/MM/DDTHH:mm:ss\" | \"DD/MM/YYYY\" | \"DD/MM/YYYY HH:mm\" | \"DD/MM/YYYY HH:mm:ss\" | \"DD/MM/YYYY hh:mm:ss a\" | \"DD/MM/YYYYTHH:mm:ss.sssZ\";\n width?: Dim;\n height?: Dim;\n minWidth?: Dim;\n maxWidth?: Dim;\n minHeight?: Dim;\n maxHeight?: Dim;\n /** @default {\"top\":{\"mode\":\"px\",\"value\":0},\"bottom\":{\"mode\":\"px\",\"value\":0},\"left\":{\"mode\":\"px\",\"value\":0},\"right\":{\"mode\":\"px\",\"value\":0}} */\n margin?: { left: Dim; right: Dim; top: Dim; bottom: Dim };\n /** @default true */\n isVisible?: boolean;\n shouldScroll?: boolean;\n}\n```\n";
1
+ export declare const content = "## SbText\n\nThe following is the type definition for the SbText component.\n\n```typescript\ninterface SbTextProps {\n text?: string;\n /** @default \"text\" */\n textType?: \"text\" | \"number\" | \"currency\" | \"date\";\n /** @default {\"variant\":\"label\"} */\n textStyle?: TextStyleWithVariant;\n /** @default \"left\" */\n horizontalAlign?: \"left\" | \"center\" | \"right\";\n /** @default \"center\" */\n verticalAlign?: \"top\" | \"center\" | \"bottom\";\n /** @default true */\n wrapText?: boolean;\n loading?: boolean;\n shouldScroll?: boolean;\n icon?: string;\n /** @default \"left\" */\n iconPosition?: \"left\" | \"right\";\n textType?: string;\n /** @default \"USD\" */\n currency?: \"AED\" | \"AFN\" | \"ALL\" | \"AMD\" | \"ANG\" | \"AOA\" | \"ARS\" | \"AUD\" | \"AWG\" | \"AZN\" | \"BAM\" | \"BBD\" | \"BDT\" | \"BGN\" | \"BHD\" | \"BIF\" | \"BMD\" | \"BND\" | \"BOB\" | \"BOV\" | \"BRL\" | \"BSD\" | \"BTN\" | \"BWP\" | \"BYN\" | \"BZD\" | \"CAD\" | \"CDF\" | \"CHE\" | \"CHF\" | \"CHW\" | \"CLF\" | \"CLP\" | \"CNY\" | \"COP\" | \"COU\" | \"CRC\" | \"CUC\" | \"CUP\" | \"CVE\" | \"CZK\" | \"DJF\" | \"DKK\" | \"DOP\" | \"DZD\" | \"EGP\" | \"ERN\" | \"ETB\" | \"EUR\" | \"FJD\" | \"FKP\" | \"GBP\" | \"GEL\" | \"GHS\" | \"GIP\" | \"GMD\" | \"GNF\" | \"GTQ\" | \"GYD\" | \"HKD\" | \"HNL\" | \"HRK\" | \"HTG\" | \"HUF\" | \"IDR\" | \"ILS\" | \"INR\" | \"IQD\" | \"IRR\" | \"ISK\" | \"JMD\" | \"JOD\" | \"JPY\" | \"KES\" | \"KGS\" | \"KHR\" | \"KMF\" | \"KPW\" | \"KRW\" | \"KWD\" | \"KYD\" | \"KZT\" | \"LAK\" | \"LBP\" | \"LKR\" | \"LRD\" | \"LSL\" | \"LYD\" | \"MAD\" | \"MDL\" | \"MGA\" | \"MKD\" | \"MMK\" | \"MNT\" | \"MOP\" | \"MRU\" | \"MUR\" | \"MVR\" | \"MWK\" | \"MXN\" | \"MXV\" | \"MYR\" | \"MZN\" | \"NAD\" | \"NGN\" | \"NIO\" | \"NOK\" | \"NPR\" | \"NZD\" | \"OMR\" | \"PAB\" | \"PEN\" | \"PGK\" | \"PHP\" | \"PKR\" | \"PLN\" | \"PYG\" | \"QAR\" | \"RON\" | \"RSD\" | \"RUB\" | \"RWF\" | \"SAR\" | \"SBD\" | \"SCR\" | \"SDG\" | \"SEK\" | \"SGD\" | \"SHP\" | \"SLL\" | \"SOS\" | \"SRD\" | \"SSP\" | \"STN\" | \"SVC\" | \"SYP\" | \"SZL\" | \"THB\" | \"TJS\" | \"TMT\" | \"TND\" | \"TOP\" | \"TRY\" | \"TTD\" | \"TWD\" | \"TZS\" | \"UAH\" | \"UGX\" | \"USD\" | \"USN\" | \"UYI\" | \"UYU\" | \"UYW\" | \"UZS\" | \"VED\" | \"VES\" | \"VND\" | \"VUV\" | \"WST\" | \"XAF\" | \"XAG\" | \"XAU\" | \"XBA\" | \"XBB\" | \"XBC\" | \"XBD\" | \"XCD\" | \"XDR\" | \"XOF\" | \"XPD\" | \"XPF\" | \"XPT\" | \"XSU\" | \"XTS\" | \"XUA\" | \"XXX\" | \"YER\" | \"ZAR\" | \"ZMW\" | \"ZWL\";\n /** @default \"standard\" */\n numberFormat?: \"unformatted\" | \"standard\" | \"compact\" | \"scientific\" | \"engineering\";\n minDecimals?: number;\n maxDecimals?: number;\n dateInputFormat?: \"undefined\" | \"X\" | \"x\" | \"MM-DD-YYYY\" | \"MM-DD-YYYY HH:mm\" | \"MM-DD-YYYY HH:mm:ss\" | \"MM-DD-YYYY hh:mm:ss a\" | \"MM-DD-YYYYTHH:mm:ss.sssZ\" | \"YYYY-MM-DD\" | \"YYYY-MM-DD HH:mm\" | \"YYYY-MM-DD HH:mm:ss\" | \"YYYY-MM-DD HH:mm:ssZ\" | \"YYYY-MM-DDTHH:mm:ss.sssZ\" | \"YYYY-MM-DD hh:mm:ss a\" | \"YYYY-MM-DDTHH:mm:ss\" | \"DD-MM-YYYY\" | \"DD-MM-YYYY HH:mm\" | \"DD-MM-YYYY HH:mm:ss\" | \"DD-MM-YYYY hh:mm:ss a\" | \"DD-MM-YYYYTHH:mm:ss.sssZ\" | \"Do MMM YYYY\" | \"MM/DD/YYYY\" | \"MM/DD/YYYY HH:mm\" | \"MM/DD/YYYY HH:mm:ss\" | \"MM/DD/YYYY hh:mm:ss a\" | \"MM/DD/YYYYTHH:mm:ss.sssZ\" | \"YYYY/MM/DD\" | \"YYYY/MM/DD HH:mm\" | \"YYYY/MM/DD HH:mm:ss\" | \"YYYY/MM/DD hh:mm:ss a\" | \"YYYY/MM/DDTHH:mm:ss\" | \"DD/MM/YYYY\" | \"DD/MM/YYYY HH:mm\" | \"DD/MM/YYYY HH:mm:ss\" | \"DD/MM/YYYY hh:mm:ss a\" | \"DD/MM/YYYYTHH:mm:ss.sssZ\";\n dateOutputFormat?: \"X\" | \"x\" | \"MM-DD-YYYY\" | \"MM-DD-YYYY HH:mm\" | \"MM-DD-YYYY HH:mm:ss\" | \"MM-DD-YYYY hh:mm:ss a\" | \"MM-DD-YYYYTHH:mm:ss.sssZ\" | \"YYYY-MM-DD\" | \"YYYY-MM-DD HH:mm\" | \"YYYY-MM-DD HH:mm:ss\" | \"YYYY-MM-DD HH:mm:ssZ\" | \"YYYY-MM-DDTHH:mm:ss.sssZ\" | \"YYYY-MM-DD hh:mm:ss a\" | \"YYYY-MM-DDTHH:mm:ss\" | \"DD-MM-YYYY\" | \"DD-MM-YYYY HH:mm\" | \"DD-MM-YYYY HH:mm:ss\" | \"DD-MM-YYYY hh:mm:ss a\" | \"DD-MM-YYYYTHH:mm:ss.sssZ\" | \"Do MMM YYYY\" | \"MM/DD/YYYY\" | \"MM/DD/YYYY HH:mm\" | \"MM/DD/YYYY HH:mm:ss\" | \"MM/DD/YYYY hh:mm:ss a\" | \"MM/DD/YYYYTHH:mm:ss.sssZ\" | \"YYYY/MM/DD\" | \"YYYY/MM/DD HH:mm\" | \"YYYY/MM/DD HH:mm:ss\" | \"YYYY/MM/DD hh:mm:ss a\" | \"YYYY/MM/DDTHH:mm:ss\" | \"DD/MM/YYYY\" | \"DD/MM/YYYY HH:mm\" | \"DD/MM/YYYY HH:mm:ss\" | \"DD/MM/YYYY hh:mm:ss a\" | \"DD/MM/YYYYTHH:mm:ss.sssZ\";\n width?: Dim;\n height?: Dim;\n minWidth?: Dim;\n maxWidth?: Dim;\n minHeight?: Dim;\n maxHeight?: Dim;\n /** @default {\"top\":{\"mode\":\"px\",\"value\":0},\"bottom\":{\"mode\":\"px\",\"value\":0},\"left\":{\"mode\":\"px\",\"value\":0},\"right\":{\"mode\":\"px\",\"value\":0}} */\n margin?: { left: Dim; right: Dim; top: Dim; bottom: Dim };\n /** @default true */\n isVisible?: boolean;\n shouldScroll?: boolean;\n}\n```\n";
2
2
  //# sourceMappingURL=SbTextPropsDocs.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"SbTextPropsDocs.d.ts","sourceRoot":"","sources":["../../../../../src/ai-service/prompts/generated/library-components/SbTextPropsDocs.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,OAAO,sxJAAsxJ,CAAC"}
1
+ {"version":3,"file":"SbTextPropsDocs.d.ts","sourceRoot":"","sources":["../../../../../src/ai-service/prompts/generated/library-components/SbTextPropsDocs.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,OAAO,8vJAA8vJ,CAAC"}
@@ -1,6 +1,6 @@
1
1
  /* eslint-disable */
2
2
  // Auto-generated from SbTextPropsDocs.md
3
3
  // Do not edit this file directly
4
- // Generated at: 2025-06-23T22:36:02.235Z
5
- export const content = "## SbText\n\nThe following is the type definition for the SbText component.\n\n```typescript\ninterface SbTextProps {\n text?: string;\n /** @default \"text\" */\n textType?: \"text\" | \"number\" | \"currency\" | \"date\";\n /** @default \"Computed at runtime\" */\n textStyle?: Record<string, any>;\n /** @default \"left\" */\n horizontalAlign?: \"left\" | \"center\" | \"right\";\n /** @default \"center\" */\n verticalAlign?: \"top\" | \"center\" | \"bottom\";\n /** @default true */\n wrapText?: boolean;\n /** @default false */\n loading?: boolean;\n shouldScroll?: boolean;\n icon?: string;\n /** @default \"left\" */\n iconPosition?: \"left\" | \"right\";\n textType?: string;\n /** @default \"USD\" */\n currency?: \"AED\" | \"AFN\" | \"ALL\" | \"AMD\" | \"ANG\" | \"AOA\" | \"ARS\" | \"AUD\" | \"AWG\" | \"AZN\" | \"BAM\" | \"BBD\" | \"BDT\" | \"BGN\" | \"BHD\" | \"BIF\" | \"BMD\" | \"BND\" | \"BOB\" | \"BOV\" | \"BRL\" | \"BSD\" | \"BTN\" | \"BWP\" | \"BYN\" | \"BZD\" | \"CAD\" | \"CDF\" | \"CHE\" | \"CHF\" | \"CHW\" | \"CLF\" | \"CLP\" | \"CNY\" | \"COP\" | \"COU\" | \"CRC\" | \"CUC\" | \"CUP\" | \"CVE\" | \"CZK\" | \"DJF\" | \"DKK\" | \"DOP\" | \"DZD\" | \"EGP\" | \"ERN\" | \"ETB\" | \"EUR\" | \"FJD\" | \"FKP\" | \"GBP\" | \"GEL\" | \"GHS\" | \"GIP\" | \"GMD\" | \"GNF\" | \"GTQ\" | \"GYD\" | \"HKD\" | \"HNL\" | \"HRK\" | \"HTG\" | \"HUF\" | \"IDR\" | \"ILS\" | \"INR\" | \"IQD\" | \"IRR\" | \"ISK\" | \"JMD\" | \"JOD\" | \"JPY\" | \"KES\" | \"KGS\" | \"KHR\" | \"KMF\" | \"KPW\" | \"KRW\" | \"KWD\" | \"KYD\" | \"KZT\" | \"LAK\" | \"LBP\" | \"LKR\" | \"LRD\" | \"LSL\" | \"LYD\" | \"MAD\" | \"MDL\" | \"MGA\" | \"MKD\" | \"MMK\" | \"MNT\" | \"MOP\" | \"MRU\" | \"MUR\" | \"MVR\" | \"MWK\" | \"MXN\" | \"MXV\" | \"MYR\" | \"MZN\" | \"NAD\" | \"NGN\" | \"NIO\" | \"NOK\" | \"NPR\" | \"NZD\" | \"OMR\" | \"PAB\" | \"PEN\" | \"PGK\" | \"PHP\" | \"PKR\" | \"PLN\" | \"PYG\" | \"QAR\" | \"RON\" | \"RSD\" | \"RUB\" | \"RWF\" | \"SAR\" | \"SBD\" | \"SCR\" | \"SDG\" | \"SEK\" | \"SGD\" | \"SHP\" | \"SLL\" | \"SOS\" | \"SRD\" | \"SSP\" | \"STN\" | \"SVC\" | \"SYP\" | \"SZL\" | \"THB\" | \"TJS\" | \"TMT\" | \"TND\" | \"TOP\" | \"TRY\" | \"TTD\" | \"TWD\" | \"TZS\" | \"UAH\" | \"UGX\" | \"USD\" | \"USN\" | \"UYI\" | \"UYU\" | \"UYW\" | \"UZS\" | \"VED\" | \"VES\" | \"VND\" | \"VUV\" | \"WST\" | \"XAF\" | \"XAG\" | \"XAU\" | \"XBA\" | \"XBB\" | \"XBC\" | \"XBD\" | \"XCD\" | \"XDR\" | \"XOF\" | \"XPD\" | \"XPF\" | \"XPT\" | \"XSU\" | \"XTS\" | \"XUA\" | \"XXX\" | \"YER\" | \"ZAR\" | \"ZMW\" | \"ZWL\";\n /** @default \"standard\" */\n numberFormat?: \"unformatted\" | \"standard\" | \"compact\" | \"scientific\" | \"engineering\";\n minDecimals?: number;\n maxDecimals?: number;\n dateInputFormat?: \"undefined\" | \"X\" | \"x\" | \"MM-DD-YYYY\" | \"MM-DD-YYYY HH:mm\" | \"MM-DD-YYYY HH:mm:ss\" | \"MM-DD-YYYY hh:mm:ss a\" | \"MM-DD-YYYYTHH:mm:ss.sssZ\" | \"YYYY-MM-DD\" | \"YYYY-MM-DD HH:mm\" | \"YYYY-MM-DD HH:mm:ss\" | \"YYYY-MM-DD HH:mm:ssZ\" | \"YYYY-MM-DDTHH:mm:ss.sssZ\" | \"YYYY-MM-DD hh:mm:ss a\" | \"YYYY-MM-DDTHH:mm:ss\" | \"DD-MM-YYYY\" | \"DD-MM-YYYY HH:mm\" | \"DD-MM-YYYY HH:mm:ss\" | \"DD-MM-YYYY hh:mm:ss a\" | \"DD-MM-YYYYTHH:mm:ss.sssZ\" | \"Do MMM YYYY\" | \"MM/DD/YYYY\" | \"MM/DD/YYYY HH:mm\" | \"MM/DD/YYYY HH:mm:ss\" | \"MM/DD/YYYY hh:mm:ss a\" | \"MM/DD/YYYYTHH:mm:ss.sssZ\" | \"YYYY/MM/DD\" | \"YYYY/MM/DD HH:mm\" | \"YYYY/MM/DD HH:mm:ss\" | \"YYYY/MM/DD hh:mm:ss a\" | \"YYYY/MM/DDTHH:mm:ss\" | \"DD/MM/YYYY\" | \"DD/MM/YYYY HH:mm\" | \"DD/MM/YYYY HH:mm:ss\" | \"DD/MM/YYYY hh:mm:ss a\" | \"DD/MM/YYYYTHH:mm:ss.sssZ\";\n dateOutputFormat?: \"X\" | \"x\" | \"MM-DD-YYYY\" | \"MM-DD-YYYY HH:mm\" | \"MM-DD-YYYY HH:mm:ss\" | \"MM-DD-YYYY hh:mm:ss a\" | \"MM-DD-YYYYTHH:mm:ss.sssZ\" | \"YYYY-MM-DD\" | \"YYYY-MM-DD HH:mm\" | \"YYYY-MM-DD HH:mm:ss\" | \"YYYY-MM-DD HH:mm:ssZ\" | \"YYYY-MM-DDTHH:mm:ss.sssZ\" | \"YYYY-MM-DD hh:mm:ss a\" | \"YYYY-MM-DDTHH:mm:ss\" | \"DD-MM-YYYY\" | \"DD-MM-YYYY HH:mm\" | \"DD-MM-YYYY HH:mm:ss\" | \"DD-MM-YYYY hh:mm:ss a\" | \"DD-MM-YYYYTHH:mm:ss.sssZ\" | \"Do MMM YYYY\" | \"MM/DD/YYYY\" | \"MM/DD/YYYY HH:mm\" | \"MM/DD/YYYY HH:mm:ss\" | \"MM/DD/YYYY hh:mm:ss a\" | \"MM/DD/YYYYTHH:mm:ss.sssZ\" | \"YYYY/MM/DD\" | \"YYYY/MM/DD HH:mm\" | \"YYYY/MM/DD HH:mm:ss\" | \"YYYY/MM/DD hh:mm:ss a\" | \"YYYY/MM/DDTHH:mm:ss\" | \"DD/MM/YYYY\" | \"DD/MM/YYYY HH:mm\" | \"DD/MM/YYYY HH:mm:ss\" | \"DD/MM/YYYY hh:mm:ss a\" | \"DD/MM/YYYYTHH:mm:ss.sssZ\";\n width?: Dim;\n height?: Dim;\n minWidth?: Dim;\n maxWidth?: Dim;\n minHeight?: Dim;\n maxHeight?: Dim;\n /** @default {\"top\":{\"mode\":\"px\",\"value\":0},\"bottom\":{\"mode\":\"px\",\"value\":0},\"left\":{\"mode\":\"px\",\"value\":0},\"right\":{\"mode\":\"px\",\"value\":0}} */\n margin?: { left: Dim; right: Dim; top: Dim; bottom: Dim };\n /** @default true */\n isVisible?: boolean;\n shouldScroll?: boolean;\n}\n```\n";
4
+ // Generated at: 2025-07-03T14:10:55.163Z
5
+ export const content = "## SbText\n\nThe following is the type definition for the SbText component.\n\n```typescript\ninterface SbTextProps {\n text?: string;\n /** @default \"text\" */\n textType?: \"text\" | \"number\" | \"currency\" | \"date\";\n /** @default {\"variant\":\"label\"} */\n textStyle?: TextStyleWithVariant;\n /** @default \"left\" */\n horizontalAlign?: \"left\" | \"center\" | \"right\";\n /** @default \"center\" */\n verticalAlign?: \"top\" | \"center\" | \"bottom\";\n /** @default true */\n wrapText?: boolean;\n loading?: boolean;\n shouldScroll?: boolean;\n icon?: string;\n /** @default \"left\" */\n iconPosition?: \"left\" | \"right\";\n textType?: string;\n /** @default \"USD\" */\n currency?: \"AED\" | \"AFN\" | \"ALL\" | \"AMD\" | \"ANG\" | \"AOA\" | \"ARS\" | \"AUD\" | \"AWG\" | \"AZN\" | \"BAM\" | \"BBD\" | \"BDT\" | \"BGN\" | \"BHD\" | \"BIF\" | \"BMD\" | \"BND\" | \"BOB\" | \"BOV\" | \"BRL\" | \"BSD\" | \"BTN\" | \"BWP\" | \"BYN\" | \"BZD\" | \"CAD\" | \"CDF\" | \"CHE\" | \"CHF\" | \"CHW\" | \"CLF\" | \"CLP\" | \"CNY\" | \"COP\" | \"COU\" | \"CRC\" | \"CUC\" | \"CUP\" | \"CVE\" | \"CZK\" | \"DJF\" | \"DKK\" | \"DOP\" | \"DZD\" | \"EGP\" | \"ERN\" | \"ETB\" | \"EUR\" | \"FJD\" | \"FKP\" | \"GBP\" | \"GEL\" | \"GHS\" | \"GIP\" | \"GMD\" | \"GNF\" | \"GTQ\" | \"GYD\" | \"HKD\" | \"HNL\" | \"HRK\" | \"HTG\" | \"HUF\" | \"IDR\" | \"ILS\" | \"INR\" | \"IQD\" | \"IRR\" | \"ISK\" | \"JMD\" | \"JOD\" | \"JPY\" | \"KES\" | \"KGS\" | \"KHR\" | \"KMF\" | \"KPW\" | \"KRW\" | \"KWD\" | \"KYD\" | \"KZT\" | \"LAK\" | \"LBP\" | \"LKR\" | \"LRD\" | \"LSL\" | \"LYD\" | \"MAD\" | \"MDL\" | \"MGA\" | \"MKD\" | \"MMK\" | \"MNT\" | \"MOP\" | \"MRU\" | \"MUR\" | \"MVR\" | \"MWK\" | \"MXN\" | \"MXV\" | \"MYR\" | \"MZN\" | \"NAD\" | \"NGN\" | \"NIO\" | \"NOK\" | \"NPR\" | \"NZD\" | \"OMR\" | \"PAB\" | \"PEN\" | \"PGK\" | \"PHP\" | \"PKR\" | \"PLN\" | \"PYG\" | \"QAR\" | \"RON\" | \"RSD\" | \"RUB\" | \"RWF\" | \"SAR\" | \"SBD\" | \"SCR\" | \"SDG\" | \"SEK\" | \"SGD\" | \"SHP\" | \"SLL\" | \"SOS\" | \"SRD\" | \"SSP\" | \"STN\" | \"SVC\" | \"SYP\" | \"SZL\" | \"THB\" | \"TJS\" | \"TMT\" | \"TND\" | \"TOP\" | \"TRY\" | \"TTD\" | \"TWD\" | \"TZS\" | \"UAH\" | \"UGX\" | \"USD\" | \"USN\" | \"UYI\" | \"UYU\" | \"UYW\" | \"UZS\" | \"VED\" | \"VES\" | \"VND\" | \"VUV\" | \"WST\" | \"XAF\" | \"XAG\" | \"XAU\" | \"XBA\" | \"XBB\" | \"XBC\" | \"XBD\" | \"XCD\" | \"XDR\" | \"XOF\" | \"XPD\" | \"XPF\" | \"XPT\" | \"XSU\" | \"XTS\" | \"XUA\" | \"XXX\" | \"YER\" | \"ZAR\" | \"ZMW\" | \"ZWL\";\n /** @default \"standard\" */\n numberFormat?: \"unformatted\" | \"standard\" | \"compact\" | \"scientific\" | \"engineering\";\n minDecimals?: number;\n maxDecimals?: number;\n dateInputFormat?: \"undefined\" | \"X\" | \"x\" | \"MM-DD-YYYY\" | \"MM-DD-YYYY HH:mm\" | \"MM-DD-YYYY HH:mm:ss\" | \"MM-DD-YYYY hh:mm:ss a\" | \"MM-DD-YYYYTHH:mm:ss.sssZ\" | \"YYYY-MM-DD\" | \"YYYY-MM-DD HH:mm\" | \"YYYY-MM-DD HH:mm:ss\" | \"YYYY-MM-DD HH:mm:ssZ\" | \"YYYY-MM-DDTHH:mm:ss.sssZ\" | \"YYYY-MM-DD hh:mm:ss a\" | \"YYYY-MM-DDTHH:mm:ss\" | \"DD-MM-YYYY\" | \"DD-MM-YYYY HH:mm\" | \"DD-MM-YYYY HH:mm:ss\" | \"DD-MM-YYYY hh:mm:ss a\" | \"DD-MM-YYYYTHH:mm:ss.sssZ\" | \"Do MMM YYYY\" | \"MM/DD/YYYY\" | \"MM/DD/YYYY HH:mm\" | \"MM/DD/YYYY HH:mm:ss\" | \"MM/DD/YYYY hh:mm:ss a\" | \"MM/DD/YYYYTHH:mm:ss.sssZ\" | \"YYYY/MM/DD\" | \"YYYY/MM/DD HH:mm\" | \"YYYY/MM/DD HH:mm:ss\" | \"YYYY/MM/DD hh:mm:ss a\" | \"YYYY/MM/DDTHH:mm:ss\" | \"DD/MM/YYYY\" | \"DD/MM/YYYY HH:mm\" | \"DD/MM/YYYY HH:mm:ss\" | \"DD/MM/YYYY hh:mm:ss a\" | \"DD/MM/YYYYTHH:mm:ss.sssZ\";\n dateOutputFormat?: \"X\" | \"x\" | \"MM-DD-YYYY\" | \"MM-DD-YYYY HH:mm\" | \"MM-DD-YYYY HH:mm:ss\" | \"MM-DD-YYYY hh:mm:ss a\" | \"MM-DD-YYYYTHH:mm:ss.sssZ\" | \"YYYY-MM-DD\" | \"YYYY-MM-DD HH:mm\" | \"YYYY-MM-DD HH:mm:ss\" | \"YYYY-MM-DD HH:mm:ssZ\" | \"YYYY-MM-DDTHH:mm:ss.sssZ\" | \"YYYY-MM-DD hh:mm:ss a\" | \"YYYY-MM-DDTHH:mm:ss\" | \"DD-MM-YYYY\" | \"DD-MM-YYYY HH:mm\" | \"DD-MM-YYYY HH:mm:ss\" | \"DD-MM-YYYY hh:mm:ss a\" | \"DD-MM-YYYYTHH:mm:ss.sssZ\" | \"Do MMM YYYY\" | \"MM/DD/YYYY\" | \"MM/DD/YYYY HH:mm\" | \"MM/DD/YYYY HH:mm:ss\" | \"MM/DD/YYYY hh:mm:ss a\" | \"MM/DD/YYYYTHH:mm:ss.sssZ\" | \"YYYY/MM/DD\" | \"YYYY/MM/DD HH:mm\" | \"YYYY/MM/DD HH:mm:ss\" | \"YYYY/MM/DD hh:mm:ss a\" | \"YYYY/MM/DDTHH:mm:ss\" | \"DD/MM/YYYY\" | \"DD/MM/YYYY HH:mm\" | \"DD/MM/YYYY HH:mm:ss\" | \"DD/MM/YYYY hh:mm:ss a\" | \"DD/MM/YYYYTHH:mm:ss.sssZ\";\n width?: Dim;\n height?: Dim;\n minWidth?: Dim;\n maxWidth?: Dim;\n minHeight?: Dim;\n maxHeight?: Dim;\n /** @default {\"top\":{\"mode\":\"px\",\"value\":0},\"bottom\":{\"mode\":\"px\",\"value\":0},\"left\":{\"mode\":\"px\",\"value\":0},\"right\":{\"mode\":\"px\",\"value\":0}} */\n margin?: { left: Dim; right: Dim; top: Dim; bottom: Dim };\n /** @default true */\n isVisible?: boolean;\n shouldScroll?: boolean;\n}\n```\n";
6
6
  //# sourceMappingURL=SbTextPropsDocs.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SbTextPropsDocs.js","sourceRoot":"","sources":["../../../../../src/ai-service/prompts/generated/library-components/SbTextPropsDocs.ts"],"names":[],"mappings":"AAAA,oBAAoB;AACpB,yCAAyC;AACzC,iCAAiC;AACjC,yCAAyC;AAEzC,MAAM,CAAC,MAAM,OAAO,GAAG,mxJAAmxJ,CAAC"}
1
+ {"version":3,"file":"SbTextPropsDocs.js","sourceRoot":"","sources":["../../../../../src/ai-service/prompts/generated/library-components/SbTextPropsDocs.ts"],"names":[],"mappings":"AAAA,oBAAoB;AACpB,yCAAyC;AACzC,iCAAiC;AACjC,yCAAyC;AAEzC,MAAM,CAAC,MAAM,OAAO,GAAG,2vJAA2vJ,CAAC"}
@@ -1,6 +1,6 @@
1
1
  /* eslint-disable */
2
2
  // Auto-generated from Dim.md
3
3
  // Do not edit this file directly
4
- // Generated at: 2025-06-23T22:36:02.243Z
4
+ // Generated at: 2025-07-03T14:10:55.171Z
5
5
  export const content = "## Dim\n\nThe `Dim` class is used to define dimensions for size properties in Superblocks (especially width and height). It has three main modes: `px`, `fit`, and `fill`.\n\n```typescript\nclass Dim {\n mode: \"px\" | \"fit\" | \"fill\";\n value?: number;\n}\n```\n";
6
6
  //# sourceMappingURL=Dim.js.map
@@ -1,6 +1,6 @@
1
1
  /* eslint-disable */
2
2
  // Auto-generated from SbEventFlow.md
3
3
  // Do not edit this file directly
4
- // Generated at: 2025-06-23T22:36:02.242Z
4
+ // Generated at: 2025-07-03T14:10:55.171Z
5
5
  export const content = "## SbEventFlow\n\nThe `SbEventFlow` class is used to define responses to events triggered on components (like onClick) in Superblocks. It has a number of methods that can be chained together.\n\n```typescript\nclass SbEventFlow {\n // Run custom JavaScript code\n static runJS(handler: () => void): SbEventFlow;\n runJS(handler: () => void): this;\n\n // Navigation methods\n static navigateTo(props: { url: string; newWindow?: boolean }): SbEventFlow;\n navigateTo(props: { url: string; newWindow?: boolean }): this;\n\n static navigateToApp(appId: string): SbEventFlow;\n navigateToApp(appId: string): this;\n\n static navigateToRoute(route: string): SbEventFlow;\n navigateToRoute(route: string): this;\n\n static setQueryParams(\n params: Record<string, string>,\n keepQueryParams?: boolean,\n ): SbEventFlow;\n setQueryParams(\n params: Record<string, string>,\n keepQueryParams?: boolean,\n ): this;\n\n // Control whether modals are opened or closed\n // Pass the bound modal component directly rather than its id\n static controlModal(\n modal: WithBindingIdentifier,\n action: \"open\" | \"close\",\n ): SbEventFlow;\n controlModal(modal: WithBindingIdentifier, action: \"open\" | \"close\"): this;\n\n static controlTimer(\n timerId: string,\n action: \"start\" | \"stop\" | \"toggle\",\n ): SbEventFlow;\n controlTimer(timerId: string, action: \"start\" | \"stop\" | \"toggle\"): this;\n\n // API methods\n static runApis(\n apis: SbApi[],\n onSuccess?: SbEventFlow,\n onError?: SbEventFlow,\n ): SbEventFlow;\n runApis(apis: SbApi[], onSuccess?: SbEventFlow, onError?: SbEventFlow): this;\n\n static cancelApis(apiNames: string[], onCancel?: SbEventFlow): SbEventFlow;\n cancelApis(apiNames: string[], onCancel?: SbEventFlow): this;\n\n // Component and state manipulation\n static resetComponent(\n widget: { id: string },\n propertyName: string,\n resetChildren: boolean,\n ): SbEventFlow;\n resetComponent(\n widget: { id: string },\n propertyName: string,\n resetChildren: boolean,\n ): this;\n\n static resetStateVar(stateVar: SbVariable): SbEventFlow;\n resetStateVar(stateVar: SbVariable): this;\n\n static setStateVar(stateVar: SbVariable, value: any): SbEventFlow;\n setStateVar(stateVar: SbVariable, value: any): this;\n\n static setComponentProperty(\n widget: { id: string },\n propertyName: string,\n value: any,\n ): SbEventFlow;\n setComponentProperty(\n widget: { id: string },\n propertyName: string,\n value: any,\n ): this;\n\n // Utility methods\n static showAlert(\n message: string,\n alertType: \"info\" | \"success\" | \"warning\" | \"error\",\n ): SbEventFlow;\n showAlert(\n message: string,\n alertType: \"info\" | \"success\" | \"warning\" | \"error\",\n ): this;\n\n static setProfile(\n profileId: string,\n profileAction: \"set\" | \"unset\",\n ): SbEventFlow;\n setProfile(profileId: string, profileAction: \"set\" | \"unset\"): this;\n\n static triggerEvent(\n eventName: string,\n eventData: Record<string, string>,\n ): SbEventFlow;\n triggerEvent(eventName: string, eventData: Record<string, string>): this;\n}\n```\n";
6
6
  //# sourceMappingURL=SbEventFlow.js.map
@@ -0,0 +1,2 @@
1
+ export declare const content = "## TextStyleWithVariant\n\nThe `TextStyleWithVariant` type is used to define the text styling values. Usually a variant is chosen which comes with pre-defined styling that you can see the details of in the Theme object, but also the naming is semantic. You can override the color using the textColor property. You can use \"SB_CUSTOM_TEXT_STYLE\" as the variant type if you want to define ad hoc text style values for a given component.\n\n```typescript\ntype TextStyleWithVariant {\n variant: \"heading1\" | \"heading2\" | \"heading3\" | \"heading4\" | \"heading5\" | \"heading6\" | \"body1\" | \"body2\" | \"body3\" | \"label\" | \"inputLabel\" | \"inputPlaceholder\" | \"inputText\" | \"buttonLabel\" | \"link\" | \"code\" | \"SB_CUSTOM_TEXT_STYLE\" | string; // This could also be a variant name that's user-created if it's available in the Theme\n textColor?: {\n default: string;\n }\n // If variant is SB_CUSTOM_TEXT_STYLE, then we set the custom\n // styling using these properties\n fontFamily?: string;\n fontSize?: string; // ex: \"14px\"\n fontWeight?: number;\n lineHeight?: number | string; // ex: 1.2, \"18px\", etc.\n textDecoration?: string; // the css text-decoration values\n fontStyle?: \"normal\" | \"italic\" | \"inherit\";\n letterSpacing?: string; // ex: \"-2px\"\n textTransform?: \"uppercase\" | \"lowercase\" | \"capitalize\" | \"none\" | \"inherit\";\n}\n```\n";
2
+ //# sourceMappingURL=TextStyleWithVariant.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TextStyleWithVariant.d.ts","sourceRoot":"","sources":["../../../../../src/ai-service/prompts/generated/library-typedefs/TextStyleWithVariant.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,OAAO,i4CAAi4C,CAAC"}
@@ -0,0 +1,6 @@
1
+ /* eslint-disable */
2
+ // Auto-generated from TextStyleWithVariant.md
3
+ // Do not edit this file directly
4
+ // Generated at: 2025-07-03T14:10:55.170Z
5
+ export const content = "## TextStyleWithVariant\n\nThe `TextStyleWithVariant` type is used to define the text styling values. Usually a variant is chosen which comes with pre-defined styling that you can see the details of in the Theme object, but also the naming is semantic. You can override the color using the textColor property. You can use \"SB_CUSTOM_TEXT_STYLE\" as the variant type if you want to define ad hoc text style values for a given component.\n\n```typescript\ntype TextStyleWithVariant {\n variant: \"heading1\" | \"heading2\" | \"heading3\" | \"heading4\" | \"heading5\" | \"heading6\" | \"body1\" | \"body2\" | \"body3\" | \"label\" | \"inputLabel\" | \"inputPlaceholder\" | \"inputText\" | \"buttonLabel\" | \"link\" | \"code\" | \"SB_CUSTOM_TEXT_STYLE\" | string; // This could also be a variant name that's user-created if it's available in the Theme\n textColor?: {\n default: string;\n }\n // If variant is SB_CUSTOM_TEXT_STYLE, then we set the custom\n // styling using these properties\n fontFamily?: string;\n fontSize?: string; // ex: \"14px\"\n fontWeight?: number;\n lineHeight?: number | string; // ex: 1.2, \"18px\", etc.\n textDecoration?: string; // the css text-decoration values\n fontStyle?: \"normal\" | \"italic\" | \"inherit\";\n letterSpacing?: string; // ex: \"-2px\"\n textTransform?: \"uppercase\" | \"lowercase\" | \"capitalize\" | \"none\" | \"inherit\";\n}\n```\n";
6
+ //# sourceMappingURL=TextStyleWithVariant.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TextStyleWithVariant.js","sourceRoot":"","sources":["../../../../../src/ai-service/prompts/generated/library-typedefs/TextStyleWithVariant.ts"],"names":[],"mappings":"AAAA,oBAAoB;AACpB,8CAA8C;AAC9C,iCAAiC;AACjC,yCAAyC;AAEzC,MAAM,CAAC,MAAM,OAAO,GAAG,83CAA83C,CAAC"}
@@ -1,3 +1,4 @@
1
1
  export { content as Dim } from "./Dim.js";
2
2
  export { content as SbEventFlow } from "./SbEventFlow.js";
3
+ export { content as TextStyleWithVariant } from "./TextStyleWithVariant.js";
3
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/ai-service/prompts/generated/library-typedefs/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,IAAI,GAAG,EAAE,MAAM,UAAU,CAAC;AAC1C,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,kBAAkB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/ai-service/prompts/generated/library-typedefs/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,IAAI,GAAG,EAAE,MAAM,UAAU,CAAC;AAC1C,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC1D,OAAO,EAAE,OAAO,IAAI,oBAAoB,EAAE,MAAM,2BAA2B,CAAC"}
@@ -2,4 +2,5 @@
2
2
  // Do not edit this file directly
3
3
  export { content as Dim } from "./Dim.js";
4
4
  export { content as SbEventFlow } from "./SbEventFlow.js";
5
+ export { content as TextStyleWithVariant } from "./TextStyleWithVariant.js";
5
6
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/ai-service/prompts/generated/library-typedefs/index.ts"],"names":[],"mappings":"AAAA,2BAA2B;AAC3B,iCAAiC;AAEjC,OAAO,EAAE,OAAO,IAAI,GAAG,EAAE,MAAM,UAAU,CAAC;AAC1C,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,kBAAkB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/ai-service/prompts/generated/library-typedefs/index.ts"],"names":[],"mappings":"AAAA,2BAA2B;AAC3B,iCAAiC;AAEjC,OAAO,EAAE,OAAO,IAAI,GAAG,EAAE,MAAM,UAAU,CAAC;AAC1C,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC1D,OAAO,EAAE,OAAO,IAAI,oBAAoB,EAAE,MAAM,2BAA2B,CAAC"}
@@ -1,6 +1,6 @@
1
1
  /* eslint-disable */
2
2
  // Auto-generated from full-examples.md
3
3
  // Do not edit this file directly
4
- // Generated at: 2025-06-23T22:36:02.234Z
4
+ // Generated at: 2025-07-03T14:10:55.161Z
5
5
  export const content = "### FULL EXAMPLES\n\n#### Full example 1:\n\nBelow is a full example of a user's prompt and acceptable app. Note that AppHeader, AppSidebar, MetricCard and Chart components are part of the default set of custom components available in every app.\n\nGiven this prompt:\n\n```text\nCreate a restaurant delivery dashboard with the following features:\n\n- A sidebar with navigation for restaurants, orders, and delivery sections\n- Key metrics displayed as cards showing total orders, active restaurants, active drivers, and average delivery time\n- A chart showing order trends over time\n- A filterable table of restaurants with search by name, cuisine type, and status\n- The ability to edit restaurant details through a modal\n- All data should be dynamically filtered based on user input\n```\n\nFiles generated:\n\n```pages/Page1/scope.ts\nimport {\n createSbScope,\n SbApi,\n SbEventFlow,\n SbVariable,\n sbComputed,\n SB,\n} from \"@superblocksteam/library\";\nexport const Page1Scope = createSbScope<{\n Column1: any;\n AppSidebar1: any;\n AppHeader1: any;\n MetricCard1: any;\n MetricCard2: any;\n MetricCard3: any;\n MetricCard4: any;\n RevenueChart: any;\n RestaurantsTable: any;\n Modal1: any;\n RestaurantNameInput: any;\n CuisineTypeDropdown: any;\n StatusDropdown: any;\n ResetButton: any;\n CustomerNameInput: any;\n PurchaseTypeDropdown: any;\n CustomersTable: any;\n ModalRestaurantNameInput: any;\n ModalRestaurantEmailInput: any;\n ModalRestaurantOwnerInput: any;\n ModalRestaurantCuisineDropdown: any;\n ModalRestaurantStatusDropdown: any;\n}>(\n ({\n entities: {\n Column1,\n AppSidebar1,\n AppHeader1,\n MetricCard1,\n MetricCard2,\n MetricCard3,\n MetricCard4,\n RevenueChart,\n RestaurantsTable,\n Modal1,\n RestaurantNameInput,\n CuisineTypeDropdown,\n StatusDropdown,\n ResetButton,\n CustomerNameInput,\n PurchaseTypeDropdown,\n CustomersTable,\n getMetricsApi,\n getRestaurantsDataApi,\n ChartDataVar,\n RestaurantsTableDataVar,\n ModalRestaurantNameInput,\n ModalRestaurantEmailInput,\n ModalRestaurantOwnerInput,\n ModalRestaurantCuisineDropdown,\n ModalRestaurantStatusDropdown,\n updateRestaurantApi,\n },\n }) => ({\n getMetricsApi: SbApi({}),\n getRestaurantsDataApi: SbApi({}),\n ChartDataVar: SbVariable({\n defaultValue: sbComputed(() => {\n const restaurantName =\n RestaurantNameInput.value && RestaurantNameInput.value !== \"\"\n ? RestaurantNameInput.value\n : null;\n const cuisineType =\n CuisineTypeDropdown.selectedOptionValue === \"All\"\n ? null\n : CuisineTypeDropdown.selectedOptionValue;\n const status =\n StatusDropdown.selectedOptionValue === \"All\"\n ? null\n : StatusDropdown.selectedOptionValue;\n let data = getRestaurantsDataApi.response || [];\n\n data = data.filter((restaurant: any) => {\n if (\n restaurantName &&\n !restaurant.name\n .toLowerCase()\n .includes(restaurantName.toLowerCase())\n ) {\n return false;\n }\n if (cuisineType && restaurant.cuisine !== cuisineType) {\n return false;\n }\n if (status && restaurant.status !== status) {\n return false;\n }\n return true;\n });\n const months = [\"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\", \"Jul\"];\n return months.map((month) => {\n const totalOrders = data.reduce((sum: number, restaurant: any) => {\n return sum + (restaurant.monthlyOrders[month] || 0);\n }, 0);\n return {\n name: month,\n orders: totalOrders,\n };\n });\n }),\n }),\n RestaurantsTableDataVar: SbVariable({\n defaultValue: sbComputed(() => {\n const restaurantName =\n RestaurantNameInput.value && RestaurantNameInput.value !== \"\"\n ? RestaurantNameInput.value\n : null;\n const cuisineType =\n CuisineTypeDropdown.selectedOptionValue === \"All\"\n ? null\n : CuisineTypeDropdown.selectedOptionValue;\n const status =\n StatusDropdown.selectedOptionValue === \"All\"\n ? null\n : StatusDropdown.selectedOptionValue;\n let data = getRestaurantsDataApi.response || [];\n\n data = data.filter((restaurant: any) => {\n if (\n restaurantName &&\n !restaurant.name\n .toLowerCase()\n .includes(restaurantName.toLowerCase())\n ) {\n return false;\n }\n if (cuisineType && restaurant.cuisine !== cuisineType) {\n return false;\n }\n if (status && restaurant.status !== status) {\n return false;\n }\n return true;\n });\n return data.map((restaurant: any) => ({\n photo: restaurant.photo,\n name: restaurant.name,\n email: restaurant.email,\n cuisine: restaurant.cuisine,\n owner: restaurant.owner,\n status: restaurant.status,\n date_joined: restaurant.date_joined,\n last_activity: restaurant.last_activity,\n }));\n }),\n }),\n updateRestaurantApi: SbApi({\n onError: SbEventFlow.controlModal(Modal1, \"close\"),\n onSuccess: SbEventFlow.runApis([getRestaurantsDataApi]),\n }),\n }),\n {\n name: \"Page1\",\n },\n);\nexport const Page1 = Page1Scope.entities;\n```\n\nNote that the layout in the index file here makes use of SbContainer components to logically group sections and ensure everything is spaced out and aligned well.\n\n```pages/Page1/index.tsx\nimport {\n SbPage,\n Dim,\n SbSection,\n SbColumn,\n registerPage,\n SbTable,\n sbComputed,\n SbContainer,\n SbInput,\n SbDropdown,\n SbButton,\n SbEventFlow,\n SbModal,\n SbText,\n SbIcon,\n Theme,\n} from \"@superblocksteam/library\";\nimport Chart from \"components/Chart/Chart\";\nimport MetricCard from \"components/MetricCard/MetricCard\";\nimport AppHeader from \"components/AppHeader/AppHeader\";\nimport AppSidebar from \"components/AppSidebar/AppSidebar\";\nimport KeyValue from \"components/KeyValue\";\nimport { Page1, Page1Scope } from \"./scope\";\nfunction Page() {\n const {\n Column1,\n AppSidebar1,\n AppHeader1,\n MetricCard1,\n MetricCard2,\n MetricCard3,\n MetricCard4,\n RevenueChart,\n RestaurantsTable,\n Modal1,\n RestaurantNameInput,\n CuisineTypeDropdown,\n StatusDropdown,\n ResetButton,\n CustomerNameInput,\n PurchaseTypeDropdown,\n CustomersTable,\n ModalRestaurantNameInput,\n ModalRestaurantEmailInput,\n ModalRestaurantOwnerInput,\n ModalRestaurantCuisineDropdown,\n ModalRestaurantStatusDropdown,\n getMetricsApi,\n getRestaurantsDataApi,\n ChartDataVar,\n RestaurantsTableDataVar,\n updateRestaurantApi,\n } = Page1;\n return (\n <SbPage\n name=\"Page1\"\n height={Dim.fill()}\n width={Dim.fill()}\n onLoad={SbEventFlow.runApis([getMetricsApi, getRestaurantsDataApi])}\n >\n <SbSection height={Dim.fill()}>\n <SbColumn\n width={Dim.fit()}\n padding={{\n top: {\n value: 0,\n mode: \"px\",\n },\n bottom: {\n value: 0,\n mode: \"px\",\n },\n left: {\n value: 0,\n mode: \"px\",\n },\n right: {\n value: 0,\n mode: \"px\",\n },\n }}\n >\n <AppSidebar\n width={Dim.fill()}\n bind={AppSidebar1}\n logoUrl=\"your-app-logo-url.png\"\n sidebarLinks={[\n {\n header: \"Restaurants\",\n links: [\n {\n label: \"All Restaurants\",\n icon: \"restaurant\",\n },\n {\n label: \"Onboarding\",\n icon: \"add_business\",\n },\n ],\n },\n {\n header: \"Orders\",\n links: [\n {\n label: \"Active Orders\",\n icon: \"receipt_long\",\n },\n {\n label: \"Order History\",\n icon: \"history\",\n },\n ],\n },\n {\n header: \"Delivery\",\n links: [\n {\n label: \"Drivers\",\n icon: \"directions_car\",\n },\n {\n label: \"Live Tracking\",\n icon: \"map\",\n },\n {\n label: \"Analytics\",\n icon: \"analytics\",\n },\n ],\n },\n ]}\n height={Dim.fill()}\n />\n </SbColumn>\n <SbColumn\n width={Dim.fill()}\n bind={Column1}\n padding={{\n top: {\n value: 0,\n mode: \"px\",\n },\n bottom: {\n value: 0,\n mode: \"px\",\n },\n left: {\n value: 0,\n mode: \"px\",\n },\n right: {\n value: 0,\n mode: \"px\",\n },\n }}\n spacing={Dim.px(0)}\n >\n <AppHeader\n width={Dim.fill()}\n height={Dim.fit()}\n bind={AppHeader1}\n title=\"Delivery Dashboard\"\n avatarUrl=\"your-user-avatar-here.png\"\n userEmail=\"user@workdoamin.com\"\n />\n <SbContainer\n width={Dim.fill()}\n height={Dim.fill()}\n layout=\"vertical\"\n padding={{\n top: {\n value: 12,\n mode: \"px\",\n },\n bottom: {\n value: 12,\n mode: \"px\",\n },\n left: {\n value: 12,\n mode: \"px\",\n },\n right: {\n value: 12,\n mode: \"px\",\n },\n }}\n >\n <SbContainer\n width={Dim.fill()}\n height={Dim.fit()}\n layout=\"horizontal\"\n >\n <MetricCard\n width={Dim.fill()}\n height={Dim.fill()}\n bind={MetricCard1}\n title=\"Total Orders\"\n value={sbComputed(\n () => getMetricsApi.response?.totalOrders.value,\n )}\n changeValue={sbComputed(\n () => getMetricsApi.response?.totalOrders.changeValue,\n )}\n changeType={getMetricsApi.response?.totalOrders.changeType}\n icon=\"receipt_long\"\n />\n <MetricCard\n width={Dim.fill()}\n height={Dim.fill()}\n bind={MetricCard2}\n title=\"Active Restaurants\"\n value={sbComputed(\n () => getMetricsApi.response?.activeRestaurants.value,\n )}\n changeValue={\n getMetricsApi.response?.activeRestaurants.changeValue\n }\n changeType={\n getMetricsApi.response?.activeRestaurants.changeType\n }\n icon=\"restaurant\"\n />\n <MetricCard\n width={Dim.fill()}\n height={Dim.fill()}\n bind={MetricCard3}\n title=\"Active Drivers\"\n value={sbComputed(\n () => getMetricsApi.response?.activeDrivers.value,\n )}\n changeValue={getMetricsApi.response?.activeDrivers.changeValue}\n changeType={getMetricsApi.response?.activeDrivers.changeType}\n icon=\"directions_car\"\n />\n <MetricCard\n width={Dim.fill()}\n height={Dim.fill()}\n bind={MetricCard4}\n title=\"Avg Delivery Time\"\n value={getMetricsApi.response?.avgDeliveryTime.value}\n changeType={getMetricsApi.response?.avgDeliveryTime.changeType}\n icon=\"schedule\"\n changeValue={sbComputed(\n () => getMetricsApi.response?.avgDeliveryTime.changeValue,\n )}\n />\n </SbContainer>\n <Chart\n width={Dim.fill()}\n height={Dim.px(180)}\n bind={RevenueChart}\n title=\"Orders\"\n data={sbComputed(() => ChartDataVar.value || [])}\n />\n <SbContainer\n width={Dim.fill()}\n height={Dim.fit()}\n variant=\"card\"\n layout=\"horizontal\"\n verticalAlign=\"bottom\"\n >\n <SbInput\n label=\"Restaurant Name\"\n placeholderText=\"Search restaurants...\"\n bind={RestaurantNameInput}\n />\n <SbDropdown\n label=\"Cuisine Type\"\n options={[\n {\n label: \"All\",\n value: \"All\",\n },\n {\n label: \"Italian\",\n value: \"Italian\",\n },\n {\n label: \"Chinese\",\n value: \"Chinese\",\n },\n {\n label: \"Mexican\",\n value: \"Mexican\",\n },\n {\n label: \"American\",\n value: \"American\",\n },\n ]}\n defaultOptionValue=\"All\"\n bind={CuisineTypeDropdown}\n />\n <SbDropdown\n label=\"Status\"\n options={[\n {\n label: \"All\",\n value: \"All\",\n },\n {\n label: \"Online\",\n value: \"Online\",\n },\n {\n label: \"Offline\",\n value: \"Offline\",\n },\n {\n label: \"Busy\",\n value: \"Busy\",\n },\n ]}\n defaultOptionValue=\"All\"\n bind={StatusDropdown}\n />\n <SbButton\n label=\"Reset Filters\"\n bind={ResetButton}\n onClick={SbEventFlow.runJS(() => {\n RestaurantNameInput.text = \"\";\n CuisineTypeDropdown.metaSelectedOptionValue = \"All\";\n StatusDropdown.metaSelectedOptionValue = \"All\";\n })}\n />\n </SbContainer>\n <SbTable\n width={Dim.fill()}\n height={Dim.fit()}\n tableData={sbComputed(() => RestaurantsTableDataVar.value || [])}\n columns={{\n name: {\n columnType: \"text\",\n label: \"Restaurant\",\n },\n email: {\n columnType: \"email\",\n label: \"Email\",\n },\n cuisine: {\n columnType: \"text\",\n label: \"Cuisine\",\n },\n owner: {\n columnType: \"text\",\n label: \"Owner\",\n },\n status: {\n columnType: \"tags\",\n tagDisplayConfig: {\n Online: {\n color: \"#14CDB733\",\n },\n Busy: {\n color: \"#FF9F3533\",\n },\n Offline: {\n color: \"#a6a0a033\",\n },\n },\n label: \"Status\",\n },\n date_joined: {\n columnType: \"date\",\n inputFormat: \"YYYY-MM-DD\",\n outputFormat: \"MM-DD-YYYY\",\n label: \"Date joined\",\n },\n last_activity: {\n columnType: \"date\",\n inputFormat: \"YYYY-MM-DDTHH:mm:ssZ\",\n outputFormat: \"MM-DD-YYYY\",\n label: \"Last activity\",\n },\n photo: {\n columnType: \"image\",\n label: \"Photo\",\n imageBorderRadius: {\n topLeft: {\n mode: \"px\",\n value: 16,\n },\n topRight: {\n mode: \"px\",\n value: 16,\n },\n bottomLeft: {\n mode: \"px\",\n value: 16,\n },\n bottomRight: {\n mode: \"px\",\n value: 16,\n },\n },\n },\n }}\n header=\"Restaurants\"\n isSearchable={false}\n bind={RestaurantsTable}\n onRowClick={SbEventFlow.runJS(() => {\n // set values of all the modal inputs to the values of the selected row\n ModalRestaurantNameInput.text =\n RestaurantsTable.selectedRow?.name;\n ModalRestaurantEmailInput.text =\n RestaurantsTable.selectedRow?.email;\n ModalRestaurantOwnerInput.text =\n RestaurantsTable.selectedRow?.owner;\n ModalRestaurantCuisineDropdown.metaSelectedOptionValue =\n RestaurantsTable.selectedRow?.cuisine;\n ModalRestaurantStatusDropdown.metaSelectedOptionValue =\n RestaurantsTable.selectedRow?.status;\n }).controlModal(Modal1, \"open\")}\n paginationType=\"client-side\"\n configuredPageSize={10}\n />\n </SbContainer>\n </SbColumn>\n </SbSection>\n <SbModal\n width={Dim.fill()}\n height={Dim.fit()}\n bind={Modal1}\n spacing={Dim.px(0)}\n padding={{\n top: {\n value: 0,\n mode: \"px\",\n },\n bottom: {\n value: 0,\n mode: \"px\",\n },\n left: {\n value: 0,\n mode: \"px\",\n },\n right: {\n value: 0,\n mode: \"px\",\n },\n }}\n >\n <SbContainer\n variant=\"none\"\n width={Dim.fill()}\n layout=\"vertical\"\n spacing={Dim.px(4)}\n horizontalAlign=\"left\"\n padding={{\n top: {\n value: 16,\n mode: \"px\",\n },\n bottom: {\n value: 16,\n mode: \"px\",\n },\n left: {\n value: 16,\n mode: \"px\",\n },\n right: {\n value: 16,\n mode: \"px\",\n },\n }}\n border={{\n left: {\n color: Theme.colors.neutral100,\n width: {\n mode: \"px\",\n value: 0,\n },\n style: \"solid\",\n },\n right: {\n color: Theme.colors.neutral100,\n width: {\n mode: \"px\",\n value: 0,\n },\n style: \"solid\",\n },\n top: {\n color: Theme.colors.neutral100,\n width: {\n mode: \"px\",\n value: 0,\n },\n style: \"solid\",\n },\n bottom: {\n color: Theme.colors.neutral100,\n width: {\n mode: \"px\",\n value: 1,\n },\n style: \"solid\",\n },\n }}\n >\n <SbText\n text={sbComputed(() => {\n return RestaurantsTable.selectedRow?.name || \"Restaurant Details\";\n })}\n textStyle={{\n variant: \"heading3\",\n }}\n />\n </SbContainer>\n <SbContainer\n variant=\"none\"\n width={Dim.fill()}\n horizontalAlign=\"left\"\n padding={{\n top: {\n value: 16,\n mode: \"px\",\n },\n bottom: {\n value: 16,\n mode: \"px\",\n },\n left: {\n value: 16,\n mode: \"px\",\n },\n right: {\n value: 16,\n mode: \"px\",\n },\n }}\n >\n {/* <SbText\n text={sbComputed(() => {\n return `Joined ${RestaurantsTable.selectedRow?.date_joined} and last active ${RestaurantsTable.selectedRow?.last_activity}`;\n })}\n textStyle={{\n variant: \"body2\",\n }}\n isVisible={sbComputed(() => {\n return (\n RestaurantsTable.selectedRow?.date_joined !== undefined &&\n RestaurantsTable.selectedRow?.last_activity !== undefined\n );\n })}\n /> */}\n\n <SbInput label=\"Restaurant Name\" bind={ModalRestaurantNameInput} />\n <SbInput label=\"Email\" bind={ModalRestaurantEmailInput} />\n <SbInput label=\"Owner\" bind={ModalRestaurantOwnerInput} />\n <SbDropdown\n label=\"Cuisine\"\n options={[\n {\n label: \"Italian\",\n value: \"Italian\",\n },\n {\n label: \"Chinese\",\n value: \"Chinese\",\n },\n {\n label: \"Mexican\",\n value: \"Mexican\",\n },\n {\n label: \"American\",\n value: \"American\",\n },\n ]}\n bind={ModalRestaurantCuisineDropdown}\n />\n <SbDropdown\n label=\"Status\"\n options={[\n {\n label: \"Online\",\n value: \"Online\",\n },\n {\n label: \"Offline\",\n value: \"Offline\",\n },\n {\n label: \"Busy\",\n value: \"Busy\",\n },\n ]}\n bind={ModalRestaurantStatusDropdown}\n />\n </SbContainer>\n <SbContainer\n spacing={Dim.px(8)}\n width={Dim.fill()}\n variant=\"none\"\n layout=\"horizontal\"\n horizontalAlign=\"right\"\n padding={{\n top: {\n value: 16,\n mode: \"px\",\n },\n bottom: {\n value: 16,\n mode: \"px\",\n },\n left: {\n value: 16,\n mode: \"px\",\n },\n right: {\n value: 16,\n mode: \"px\",\n },\n }}\n border={{\n left: {\n color: Theme.colors.neutral100,\n width: {\n mode: \"px\",\n value: 0,\n },\n style: \"solid\",\n },\n right: {\n color: Theme.colors.neutral100,\n width: {\n mode: \"px\",\n value: 0,\n },\n style: \"solid\",\n },\n top: {\n color: Theme.colors.neutral100,\n width: {\n mode: \"px\",\n value: 1,\n },\n style: \"solid\",\n },\n bottom: {\n color: Theme.colors.neutral100,\n width: {\n mode: \"px\",\n value: 0,\n },\n style: \"solid\",\n },\n }}\n >\n <SbButton\n label=\"Close\"\n variant=\"secondary\"\n onClick={SbEventFlow.controlModal(Modal1, \"close\")}\n />\n <SbButton\n label=\"Save Changes\"\n onClick={SbEventFlow.runApis([updateRestaurantApi]).controlModal(\n Modal1,\n \"close\",\n )}\n />\n </SbContainer>\n </SbModal>\n </SbPage>\n );\n}\nexport default registerPage(Page, Page1Scope);\n```\n\n```pages/Page1/apis/getMetricsApi.ts\nimport {\n Api,\n JavaScript,\n Python,\n Databricks,\n Snowflake,\n PostgreSQL,\n RestApi,\n Email,\n Conditional,\n TryCatch,\n Variables,\n Loop,\n Parallel,\n Throw,\n Return,\n} from \"@superblocksteam/library\";\n\nexport default new Api(\"getMetricsApi\", [\n new JavaScript(\"getMetrics\", {\n fn: () => {\n return {\n totalOrders: {\n value: \"24.7K\",\n changeValue: \"+18.2%\",\n changeType: \"positive\",\n },\n activeRestaurants: {\n value: \"1.8K\",\n changeValue: \"+12.5%\",\n changeType: \"positive\",\n },\n activeDrivers: {\n value: \"523\",\n changeValue: \"+5.8%\",\n changeType: \"positive\",\n },\n avgDeliveryTime: {\n value: \"28 min\",\n changeValue: \"-2.3 min\",\n changeType: \"positive\",\n },\n };\n },\n }),\n]);\n```\n\n```pages/Page1/apis/getRestaurantsDataApi.ts\nimport {\n Api,\n JavaScript,\n Python,\n Databricks,\n Snowflake,\n PostgreSQL,\n RestApi,\n Email,\n Conditional,\n TryCatch,\n Variables,\n Loop,\n Parallel,\n Throw,\n Return,\n} from \"@superblocksteam/library\";\n\nexport default new Api(\"getRestaurantsDataApi\", [\n new JavaScript(\"getData\", {\n fn: () => {\n return [\n {\n photo: \"https://images.unsplash.com/photo-1517248135467-4c7edcad34c4?w=50&h=50&fit=crop&crop=face\",\n name: \"Bella Vista Italian\",\n email: \"contact@bellavista.com\",\n cuisine: \"Italian\",\n owner: \"Marco Rossi\",\n status: \"Active\",\n date_joined: \"2023-01-15\",\n last_activity: \"2024-01-20\",\n monthlyOrders: {\n Jan: 450,\n Feb: 520,\n Mar: 480,\n Apr: 610,\n May: 590,\n Jun: 650,\n Jul: 720,\n },\n },\n {\n photo: \"https://images.unsplash.com/photo-1555396273-367ea4eb4db5?w=50&h=50&fit=crop&crop=face\",\n name: \"Golden Dragon\",\n email: \"info@goldendragon.com\",\n cuisine: \"Chinese\",\n owner: \"Wei Chen\",\n status: \"Active\",\n date_joined: \"2023-02-22\",\n last_activity: \"2024-01-19\",\n monthlyOrders: {\n Jan: 380,\n Feb: 420,\n Mar: 460,\n Apr: 510,\n May: 540,\n Jun: 580,\n Jul: 620,\n },\n },\n {\n photo: \"https://images.unsplash.com/photo-1565299624946-b28f40a0ca4b?w=50&h=50&fit=crop&crop=face\",\n name: \"Taco Fiesta\",\n email: \"orders@tacofiesta.com\",\n cuisine: \"Mexican\",\n owner: \"Carlos Rodriguez\",\n status: \"Pending\",\n date_joined: \"2023-12-10\",\n last_activity: \"2024-01-18\",\n monthlyOrders: {\n Jan: 280,\n Feb: 320,\n Mar: 350,\n Apr: 390,\n May: 420,\n Jun: 450,\n Jul: 480,\n },\n },\n {\n photo: \"https://images.unsplash.com/photo-1571091718767-18b5b1457add?w=50&h=50&fit=crop&crop=face\",\n name: \"Burger Palace\",\n email: \"hello@burgerpalace.com\",\n cuisine: \"American\",\n owner: \"John Smith\",\n status: \"Active\",\n date_joined: \"2022-11-08\",\n last_activity: \"2024-01-21\",\n monthlyOrders: {\n Jan: 680,\n Feb: 720,\n Mar: 650,\n Apr: 780,\n May: 810,\n Jun: 850,\n Jul: 920,\n },\n },\n {\n photo: \"https://images.unsplash.com/photo-1414235077428-338989a2e8c0?w=50&h=50&fit=crop&crop=face\",\n name: \"Sakura Sushi\",\n email: \"reservations@sakurasushi.com\",\n cuisine: \"Japanese\",\n owner: \"Takeshi Yamamoto\",\n status: \"Inactive\",\n date_joined: \"2023-06-12\",\n last_activity: \"2023-12-15\",\n monthlyOrders: {\n Jan: 320,\n Feb: 280,\n Mar: 260,\n Apr: 240,\n May: 200,\n Jun: 180,\n Jul: 150,\n },\n },\n ];\n },\n }),\n]);\n```\n\n```pages/Page1/apis/updateRestaurantApi.ts\nimport {\n Api,\n JavaScript,\n Python,\n Databricks,\n Snowflake,\n PostgreSQL,\n RestApi,\n Email,\n Conditional,\n TryCatch,\n Variables,\n Loop,\n Parallel,\n Throw,\n Return,\n} from \"@superblocksteam/library\";\n\nexport default new Api(\"updateRestaurantApi\", [\n new Conditional(\"validate_inputs\", {\n if: {\n when: ({\n ModalRestaurantNameInput,\n ModalRestaurantEmailInput,\n ModalRestaurantOwnerInput,\n }): boolean =>\n !ModalRestaurantNameInput.value ||\n !ModalRestaurantEmailInput.value ||\n !ModalRestaurantOwnerInput.value,\n then: [\n new Throw(\"validation_error\", {\n error: \"Restaurant name, email, and owner are required fields\",\n }),\n ],\n },\n }),\n new JavaScript(\"updateRestaurantData\", {\n fn: ({\n ModalRestaurantNameInput,\n ModalRestaurantEmailInput,\n ModalRestaurantOwnerInput,\n ModalRestaurantCuisineDropdown,\n ModalRestaurantStatusDropdown,\n }) => {\n const updatedRestaurant = {\n name: ModalRestaurantNameInput.value,\n email: ModalRestaurantEmailInput.value,\n cuisine: ModalRestaurantCuisineDropdown.selectedOptionValue,\n owner: ModalRestaurantOwnerInput.value,\n status: ModalRestaurantStatusDropdown.selectedOptionValue,\n updated_at: new Date().toISOString(),\n };\n\n return {\n success: true,\n message: \"Restaurant updated successfully\",\n data: updatedRestaurant,\n };\n },\n }),\n]);\n```\n\n##### Important notes about the choices made in the code generated here:\n\n1. **API Implementation Strategy**: All APIs use dummy data implementations for demonstration purposes. In production applications:\n\n - `getMetricsApi` and `getRestaurantsDataApi` should connect to actual databases or external services using SQL queries, REST API calls, or other data connectors\n - `updateRestaurantApi` should perform real database updates or API calls to persist changes\n - Consider replacing dummy implementations with actual integrations when users specify particular data sources in their prompts\n\n2. **Layout Architecture**:\n\n - `SbColumn` components have padding removed to allow `AppSidebar` and `AppHeader` to extend to screen edges\n - Content sections use `SbContainer` components for proper spacing and alignment\n - This pattern ensures consistent visual hierarchy and responsive behavior\n\n3. **Component Styling Patterns**:\n\n - Filter controls are wrapped together in a `SbContainer` with `variant=\"card\"` to provide visual containment\n - Components like `MetricCard`, `SbTable`, and `Chart` have built-in containers and don't require additional wrapping\n - Form elements (`SbInput`, `SbDropdown`, `SbButton`) need explicit container styling for proper presentation\n\n4. **State Management**:\n\n - Computed variables (`ChartDataVar`, `RestaurantsTableDataVar`) automatically recalculate when filter inputs change\n - Modal state is managed through event flows that handle open/close actions and API responses\n - Error handling and validation are implemented at the API level with appropriate user feedback\n";
6
6
  //# sourceMappingURL=full-examples.js.map
@@ -1,2 +1,2 @@
1
- export declare const content = "### APIs\n\nThe Superblocks framework allows you to create backend APIs. The high level structure for creating APIs is as follows:\n\n1. APIs are defined using TypeScript files that live inside the apis directory inside the page they are scoped to. Example: /pages/Page1/apis/myApi.ts\n2. This pattern is a declarative workflow builder, where you define each API step, its configuration, and its execution order within the API workflow.\n3. To make the API available for use, you must import it into the scope file and register it with `SbApi()`, then import and destructure it in your page component for use.\n\n#### CRITICAL VARIABLE SCOPING RULES\n\n**\uD83D\uDEA8 EXTREMELY IMPORTANT**: Variables referenced in API blocks can ONLY come from these sources:\n\n1. **Outputs of previous blocks** in the same API (accessed via the block name)\n2. **Page entities defined in the scope file** (passed as destructured parameters)\n3. **Never reference variables that don't exist** - this is the #1 cause of API generation errors\n\n**\u274C WRONG - Variables that don't exist in scope:**\n\n```ts\nnew PostgreSQL(\"insert_data\", \"postgres-integration-id\", {\n statement: ({ SelectedCustomerIdVar, ProductNameInput, IssueTypeDropdown }) =>\n `INSERT INTO issues VALUES (${SelectedCustomerIdVar.value}, '${ProductNameInput.value}', '${IssueTypeDropdown.selectedOptionValue}')`,\n // \u274C ERROR: SelectedCustomerIdVar, ProductNameInput, IssueTypeDropdown are not defined anywhere!\n});\n```\n\n**\u2705 CORRECT - Variables from scope entities:**\n\n```ts\n// First, define in scope.ts:\nexport const Page1Scope = createSbScope<{\n SelectedCustomerIdVar: any;\n ProductNameInput: any;\n IssueTypeDropdown: any;\n}>(\n () => ({\n // Register the API\n submitIssueApi: SbApi({}),\n }),\n { name: \"Page1\" },\n);\n\n// Then use in API:\nnew PostgreSQL(\"insert_data\", \"postgres-integration-id\", {\n statement: ({ SelectedCustomerIdVar, ProductNameInput, IssueTypeDropdown }) =>\n `INSERT INTO issues VALUES (${SelectedCustomerIdVar.value}, '${ProductNameInput.value}', '${IssueTypeDropdown.selectedOptionValue}')`,\n // \u2705 CORRECT: These are page entities defined in the scope\n});\n```\n\n**\u2705 CORRECT - Variables from previous blocks:**\n\n```ts\nexport default new Api(\"processOrderApi\", [\n new JavaScript(\"get_customer_data\", {\n fn: () => ({ customerId: 123, customerName: \"John Doe\" }),\n }),\n new PostgreSQL(\"insert_order\", \"postgres-integration-id\", {\n statement: ({ get_customer_data }) =>\n `INSERT INTO orders VALUES (${get_customer_data.output.customerId}, '${get_customer_data.output.customerName}')`,\n // \u2705 CORRECT: get_customer_data is a previous block in this API\n }),\n]);\n```\n\n#### CRITICAL MENTAL MODEL: APIs Access Page Scope (They Don't Define Parameters)\n\n**\uD83D\uDEA8 FUNDAMENTAL MISCONCEPTION TO AVOID:**\n\n\u274C **WRONG THINKING**: \"APIs define their input parameters like traditional backend services\"\n\n```ts\n// WRONG - This is NOT how Superblocks APIs work!\nfunction submitOrder(customerId, productName) {\n // \u274C APIs don't define parameters!\n // API logic here\n}\n```\n\n\u2705 **CORRECT THINKING**: \"APIs are frontend-coupled functions that automatically access the page's existing scope\"\n\n```ts\n// CORRECT - APIs inherit page scope automatically\nnew PostgreSQL(\"insert_order\", \"postgres-integration-id\", {\n statement: ({ SelectedCustomerIdVar, ProductNameInput }) =>\n // \u2191 This is NOT defining parameters - this is accessing existing page scope!\n // These variables must ALREADY exist in your page scope\n `INSERT INTO orders VALUES (${SelectedCustomerIdVar.value}, '${ProductNameInput.value}')`,\n});\n```\n\n**KEY CONCEPTS:**\n\n1. **APIs are frontend-aware**: They're tightly coupled to your page, not independent backend services\n2. **No parameter definition**: APIs cannot define their own input parameters\n3. **Scope inheritance only**: APIs automatically access whatever exists in your page scope\n4. **Mandatory order**: Page Scope \u2192 Components \u2192 APIs (scope must exist first)\n\n**The Flow:**\n\n```\nPage Scope Variables \u2192 APIs Automatically Access \u2192 Use in API Logic\n(Must exist first) \u2192 (No parameter passing) \u2192 (Just destructure from scope)\n```\n\n**Contrasting Examples:**\n\n\u274C **Traditional Backend API (NOT how Superblocks works):**\n\n```ts\n// This is how traditional APIs work - NOT Superblocks!\nfunction createOrder(customerId, productName, quantity) {\n // \u274C Defines own parameters\n return database.insert({\n customer_id: customerId,\n product: productName,\n qty: quantity,\n });\n}\n\n// Called like: createOrder(123, \"Widget\", 5) - parameters passed in\n```\n\n\u2705 **Superblocks API (Frontend-coupled):**\n\n```ts\n// This is how Superblocks APIs work - inherits page scope\nnew PostgreSQL(\"insert_order\", \"postgres-integration-id\", {\n statement: ({ CustomerIdInput, ProductNameInput, QuantityInput }) => {\n // \u2191 NOT defining parameters! These must exist in page scope already\n return `INSERT INTO orders VALUES (${CustomerIdInput.value}, '${ProductNameInput.value}', ${QuantityInput.value})`;\n },\n});\n\n// No \"calling with parameters\" - scope variables are automatically available\n```\n\n#### Rules\n\n1. CRITICAL: The name of the API must be consistent across the API's TypeScript definition, the API's file name, references in page files, and the key used to register it in the scope file. See the consistent use of 'myApi' below as an example.\n2. ALWAYS import ALL API classes from the superblocks library at the top of every API file. Use this complete import statement for every API file:\n3. When using database integrations (PostgreSQL, Snowflake, Databricks), the integration_id parameter should be the actual integration ID from your Superblocks workspace, not a placeholder string.\n4. **CRITICAL**: DO NOT reference variables that are not in scope. The ONLY things in scope are (1) the outputs of previous blocks that are in lexical scope and (2) page entities defined in the scope file.\n\n```ts\nimport {\n Api,\n JavaScript,\n Python,\n Databricks,\n Snowflake,\n PostgreSQL,\n RestApi,\n Email,\n Conditional,\n TryCatch,\n Variables,\n Loop,\n Parallel,\n Throw,\n Return,\n} from \"@superblocksteam/library\";\n```\n\n#### Examples\n\n##### Complete Example: Scope \u2192 Components \u2192 API Flow\n\nThis example shows the complete flow from defining variables in scope, to binding them to components, to using them in APIs.\n\n**Step 1: Define entities in scope file**\n\n```ts\n// /pages/Page1/scope.ts\nimport { createSbScope, SbApi } from \"@superblocksteam/library\";\n\nexport const Page1Scope = createSbScope<{\n CustomerNameInput: any;\n ProductNameInput: any;\n IssueTypeDropdown: any;\n IssueNotesInput: any;\n}>(\n () => ({\n // Register the API\n submitProductIssueApi: SbApi({}),\n }),\n {\n name: \"Page1\",\n },\n);\n\nexport const Page1 = Page1Scope.entities;\n```\n\n**Step 2: Use entities in page components**\n\n```tsx\n// /pages/Page1/index.tsx\nimport {\n SbPage,\n SbSection,\n SbColumn,\n SbInput,\n SbDropdown,\n SbButton,\n SbEventFlow,\n registerPage,\n} from \"@superblocksteam/library\";\nimport { Page1, Page1Scope } from \"./scope\";\n\nconst Page1Component = () => {\n const {\n CustomerNameInput,\n ProductNameInput,\n IssueTypeDropdown,\n IssueNotesInput,\n submitProductIssueApi,\n } = Page1;\n\n return (\n <SbPage name=\"Page1\" height={Dim.fill()} width={Dim.fill()}>\n <SbSection height={Dim.fill()}>\n <SbColumn width={Dim.fill()}>\n <SbInput bind={CustomerNameInput} label=\"Customer Name\" />\n <SbInput bind={ProductNameInput} label=\"Product Name\" />\n <SbDropdown\n bind={IssueTypeDropdown}\n label=\"Issue Type\"\n options={[\n { label: \"Defect\", value: \"defect\" },\n { label: \"Complaint\", value: \"complaint\" },\n { label: \"Return\", value: \"return\" },\n ]}\n />\n <SbInput bind={IssueNotesInput} label=\"Notes\" multiline={true} />\n <SbButton\n label=\"Submit Issue\"\n onClick={SbEventFlow.runApis([submitProductIssueApi])}\n />\n </SbColumn>\n </SbSection>\n </SbPage>\n );\n};\n\nexport default registerPage(Page1Component, Page1Scope);\n```\n\n**Step 3: Create API that uses the scope entities**\n\n```ts\n// /pages/Page1/apis/submitProductIssueApi.ts\n\nimport {\n Api,\n JavaScript,\n Python,\n Databricks,\n Snowflake,\n PostgreSQL,\n RestApi,\n Email,\n Conditional,\n TryCatch,\n Variables,\n Loop,\n Parallel,\n Throw,\n Return,\n} from \"@superblocksteam/library\";\n\nexport default new Api(\"submitProductIssueApi\", [\n new Conditional(\"validate_inputs\", {\n if: {\n when: ({\n CustomerNameInput,\n ProductNameInput,\n IssueTypeDropdown,\n }): boolean =>\n !CustomerNameInput.value ||\n !ProductNameInput.value ||\n !IssueTypeDropdown.selectedOptionValue,\n then: [\n new Throw(\"validation_error\", {\n error: \"Customer name, product name, and issue type are required\",\n }),\n ],\n },\n }),\n new PostgreSQL(\"insert_issue\", \"your-postgresql-integration-id\", {\n statement: ({\n CustomerNameInput,\n ProductNameInput,\n IssueTypeDropdown,\n IssueNotesInput,\n }) =>\n `INSERT INTO product_issues \n (customer_name, product_name, issue_type, notes, status, date_reported, created_by)\n VALUES (\n '${CustomerNameInput.value}', \n '${ProductNameInput.value}', \n '${IssueTypeDropdown.selectedOptionValue}', \n '${IssueNotesInput.value || \"\"}', \n 'Open', \n NOW(), \n 1\n )`,\n }),\n new JavaScript(\"return_success\", {\n fn: ({ insert_issue }) => ({\n success: true,\n message: \"Issue submitted successfully\",\n issueId: insert_issue.output?.insertId || null,\n }),\n }),\n]);\n```\n\n##### \u274C COMMON MISTAKES TO AVOID\n\n**\u274C WRONG: Using undefined variables**\n\n```ts\n// This is WRONG - these variables don't exist!\nexport default new Api(\"badExampleApi\", [\n new PostgreSQL(\"insert_data\", \"postgres-integration-id\", {\n statement: ({\n SelectedCustomerIdVar,\n ProductNameInput,\n IssueTypeDropdown,\n }) =>\n `INSERT INTO issues VALUES (${SelectedCustomerIdVar.value}, '${ProductNameInput.value}', '${IssueTypeDropdown.selectedOptionValue}')`,\n // \u274C ERROR: SelectedCustomerIdVar, ProductNameInput, IssueTypeDropdown are not defined in scope!\n }),\n]);\n```\n\n**\u274C WRONG: Mixing up variable names**\n\n```ts\n// Scope defines CustomerNameInput but API tries to use CustomerName\nexport default new Api(\"badExampleApi\", [\n new PostgreSQL(\"insert_data\", \"postgres-integration-id\", {\n statement: (\n { CustomerName }, // \u274C ERROR: Should be CustomerNameInput\n ) => `INSERT INTO issues VALUES ('${CustomerName.value}')`,\n }),\n]);\n```\n\n**\u274C WRONG: Not destructuring function parameters**\n\n```ts\n// This is WRONG - you must destructure the parameters\nexport default new Api(\"badExampleApi\", [\n new PostgreSQL(\"insert_data\", \"postgres-integration-id\", {\n statement: (\n state, // \u274C ERROR: Should destructure { CustomerNameInput }\n ) => `INSERT INTO issues VALUES ('${state.CustomerNameInput.value}')`,\n }),\n]);\n```\n\n##### Creating and registering a Superblocks API\n\nCreate the API by adding the myApi.ts file:\n\n```ts\n// /pages/Page1/apis/myApi.ts\n\nimport {\n Api,\n JavaScript,\n Python,\n Databricks,\n Snowflake,\n PostgreSQL,\n RestApi,\n Email,\n Conditional,\n TryCatch,\n Variables,\n Loop,\n Parallel,\n Throw,\n Return,\n} from \"@superblocksteam/library\";\n\nexport default new Api(\"myApi\", [\n new JavaScript(\"retrieve_orders\", {\n fn: () => {\n return [\n {\n id: \"ORD-001\",\n customerName: \"John Smith\",\n total: 149.99,\n },\n {\n id: \"ORD-002\",\n customerName: \"Sarah Jones\",\n total: 89.5,\n },\n ];\n },\n }),\n]);\n```\n\nThen register the myApi API in the scope file:\n\n```ts\n// /pages/Page1/scope.ts\n\nimport { createSbScope, SbApi } from \"@superblocksteam/library\";\n\nexport const Page1Scope = createSbScope(\n () => ({\n // Register the API in the scope\n retrieveOrdersApi: SbApi({}),\n }),\n {\n name: \"Page1\",\n },\n);\n\nexport const Page1 = Page1Scope.entities;\n```\n\nThen use the API in your page component:\n\n```tsx\n// /pages/Page1/index.tsx\n\nimport {\n SbPage,\n SbSection,\n SbColumn,\n SbButton,\n SbTable,\n sbComputed,\n SbEventFlow,\n registerPage,\n} from \"@superblocksteam/library\";\nimport { Page1, Page1Scope } from \"./scope\";\n\nconst Page1Component = () => {\n const { retrieveOrdersApi } = Page1;\n\n return (\n <SbPage name=\"Page1\" height={Dim.fill()} width={Dim.fill()}>\n <SbSection height={Dim.fill()}>\n <SbColumn width={Dim.fill()}>\n <SbButton\n // APIs can be invoked with the SbEventFlow API\n onClick={SbEventFlow.runApis([retrieveOrdersApi])}\n label=\"Fetch Data\"\n />\n {/* Access API response using sbComputed */}\n <SbTable tableData={sbComputed(() => retrieveOrdersApi.response)} />\n </SbColumn>\n </SbSection>\n </SbPage>\n );\n};\n\nexport default registerPage(Page1Component, Page1Scope);\n```\n\n##### Referencing the output of a previous block\n\nThink hard about how you access the output of previous steps. You MUST use the output property of the previous step variable. There is no other way to access the output of a previous step (other than using a Variable block, but that is not what you want in this case and should only be used in very specific cases).\n\n```ts\n// Path to this api would be: /pages/Page1/apis/getOrdersApi.ts\n\nimport {\n Api,\n JavaScript,\n Python,\n Databricks,\n Snowflake,\n PostgreSQL,\n RestApi,\n Email,\n Conditional,\n TryCatch,\n Variables,\n Loop,\n Parallel,\n Throw,\n Return,\n} from \"@superblocksteam/library\";\n\nexport default new Api(\"getOrdersApi\", [\n new JavaScript(\"retrieve_orders\", {\n fn: () => {\n return [\n {\n id: 1,\n customer: \"John Smith\",\n date: \"2024-01-15\",\n total: 199.99,\n status: \"Pending\",\n },\n {\n id: 2,\n customer: \"Jane Doe\",\n date: \"2024-01-14\",\n total: 149.99,\n status: \"Shipped\",\n },\n {\n id: 3,\n customer: \"Bob Wilson\",\n date: \"2024-01-13\",\n total: 299.99,\n status: \"Delivered\",\n },\n ];\n },\n }),\n new JavaScript(\"format_orders\", {\n fn: ({ retrieve_orders }) => {\n return retrieve_orders.output.map((order) => ({\n ...order,\n date: new Date(order.date).toLocaleDateString(),\n }));\n },\n }),\n]);\n```\n\nThen you would register the API in your scope file and use it in your page component:\n\n```ts\n// /pages/Page1/scope.ts\nexport const Page1Scope = createSbScope(\n () => ({\n getOrdersApi: SbApi({}),\n }),\n {\n name: \"Page1\",\n },\n);\n```\n\n```tsx\n// /pages/Page1/index.tsx\nimport {\n SbPage,\n SbSection,\n SbColumn,\n SbTable,\n sbComputed,\n registerPage,\n} from \"@superblocksteam/library\";\nimport { Page1, Page1Scope } from \"./scope\";\n\nconst Page1Component = () => {\n const { getOrdersApi } = Page1;\n\n return (\n <SbPage name=\"Page1\" height={Dim.fill()} width={Dim.fill()}>\n <SbSection height={Dim.fill()}>\n <SbColumn width={Dim.fill()}>\n <SbTable tableData={sbComputed(() => getOrdersApi.response)} />\n </SbColumn>\n </SbSection>\n </SbPage>\n );\n};\n\nexport default registerPage(Page1Component, Page1Scope);\n```\n\n##### Ensuring variable existence in application\n\n**\uD83D\uDEA8 CRITICAL**: APIs cannot create their own variables - they only access what already exists in page scope!\n\nWhen creating an API that references variables like `FirstNameInput`, `LastNameInput`, and `SelectedUserIdVar`, these variables MUST exist in your page scope BEFORE you write the API. APIs don't define parameters - they inherit scope.\n\n**Mandatory Flow: Scope \u2192 Components \u2192 APIs**\n\n**STEP 1: Create variables in scope FIRST** (APIs cannot access variables that don't exist)\n\nSince you've determined that we'll use input components to take in the first name and last name, you MUST ensure that you use the same names for the entities in the `scope.ts` file as the variable names in the API.\n\n```ts\n// /pages/Page1/scope.ts\n\nimport {\n createSbScope,\n SbApi,\n SbVariable,\n SbVariablePersistence,\n Global,\n} from \"@superblocksteam/library\";\n\nexport const Page1Scope = createSbScope<{\n FirstNameInput: any;\n LastNameInput: any;\n}>(\n // register non-component entities in the scope\n ({\n entities: {\n FirstNameInput,\n LastNameInput,\n handlePeopleUpdates,\n SelectedUserIdVar,\n },\n }) => ({\n handlePeopleUpdatesApi: SbApi({}),\n SelectedUserIdVar: SbVariable({\n defaultValue: Global.user.id,\n persistence: SbVariablePersistence.TEMPORARY,\n }),\n }),\n // configure page options\n {\n name: \"Page1\",\n },\n);\n\nexport const Page1 = Page1Scope.entities;\n```\n\nThen, use the variables in your page component:\n\n```tsx\n// /pages/Page1/index.tsx\n\nimport {\n SbPage,\n SbInput,\n SbEventFlow,\n registerPage,\n} from \"@superblocksteam/library\";\nimport { Page1, Page1Scope } from \"./scope\";\n\nconst Page1Component = () => {\n const {\n handlePeopleUpdatesApi,\n FirstNameInput,\n LastNameInput,\n SelectedUserIdVar,\n } = Page1;\n\n return (\n <SbPage name=\"Page1\">\n <SbInput\n label=\"First Name\"\n bind={FirstNameInput}\n minLength={1}\n inputType=\"TEXT\"\n />\n <SbInput\n label=\"Last Name\"\n bind={LastNameInput}\n minLength={1}\n inputType=\"TEXT\"\n />\n {/* The rest of the page... */}\n </SbPage>\n );\n};\n\nexport default registerPage(Page1Component, Page1Scope);\n```\n\nFinally, create the API that references these variables:\n\n```ts\n// /pages/Page1/apis/handlePeopleUpdatesApi.ts\n\nimport {\n Api,\n JavaScript,\n Python,\n Databricks,\n Snowflake,\n PostgreSQL,\n RestApi,\n Email,\n Conditional,\n TryCatch,\n Variables,\n Loop,\n Parallel,\n Throw,\n Return,\n} from \"@superblocksteam/library\";\n\nexport default new Api(\"handlePeopleUpdatesApi\", [\n new Conditional(\"validate\", {\n if: {\n when: ({ FirstNameInput, LastNameInput }): boolean =>\n !FirstNameInput.isValid || !LastNameInput.isValid,\n then: [\n new Throw(\"reject\", {\n error: \"either the first name or last name is invalid\",\n }),\n ],\n },\n }),\n new PostgreSQL(\"update\", \"your-postgresql-integration-id\", {\n statement: ({ FirstNameInput, LastNameInput, SelectedUserIdVar }) =>\n `UPDATE people SET first_name = '${FirstNameInput.value}', last_name = '${LastNameInput.value}' WHERE id = ${SelectedUserIdVar.value}`,\n }),\n]);\n```\n\n#### The Superblocks API TypeScript Type\n\nBelow is the full TypeScript spec for the APIs you create:\n\n````ts\n// @superblocksteam/library\n\nexport type JsonValue =\n | undefined\n | null\n | number\n | string\n | boolean\n | JsonValue[]\n | object;\nexport type State = { [key: string]: JsonValue };\nexport type Binding<T> = T | ((state: State) => T);\ntype Integrations = { id: string; description: string; metadata: JsonValue }[];\n\nclass Block {\n constructor(name: string) {}\n public run(): { output: JsonValue } {\n /* ... */\n }\n}\n\nclass Integration extends Block {\n constructor(name: string, integration_id: string) {}\n}\n\ntype State = Record<string, JsonValue>;\n\nclass JavaScript extends Integration {\n constructor(\n name: string,\n config: {\n fn: (\n {\n /* ... */\n },\n ) => JsonValue;\n },\n ) {\n super(name, \"javascript\");\n }\n}\n\nclass Python extends Integration {\n constructor(\n name: string,\n config: {\n // We want to just put the python function body here. The scope is the same as it would be if it were a JavaScript integration.\n fn: string;\n },\n ) {\n super(name, \"python\");\n }\n}\n\nclass Databricks extends Integration {\n static integrations: Integrations = [\n /* ... */\n ];\n\n /**\n * @param {string} name The name of the block.\n * @param {string} integration_id The id of the integration.\n * @param {object} config The config object.\n * @returns {void}\n */\n constructor(\n name: string,\n integration_id: string,\n config: {\n statement: Binding<string>;\n },\n ) {\n super(name, integration_id);\n }\n}\n\nclass Snowflake extends Integration {\n static integrations: Integrations = [\n /* ... */\n ];\n\n /**\n * @param {string} name The name of the block.\n * @param {string} integration_id The id of the integration.\n * @param {object} config The config object.\n * @returns {void}\n */\n constructor(\n name: string,\n integration_id: string,\n config: {\n statement: Binding<string>;\n },\n ) {\n super(name, integration_id);\n }\n}\n\nclass PostgreSQL extends Integration {\n static integrations: Integrations = [\n /* ... */\n ];\n\n /**\n * @param {string} name The name of the block.\n * @param {string} integration_id The id of the integration.\n * @param {object} config The config object.\n * @returns {void}\n */\n constructor(\n name: string,\n integration_id: string,\n config: {\n statement: Binding<string>;\n },\n ) {\n super(name, integration_id);\n }\n}\n\nclass RestApi extends Integration {\n static integrations: Integrations = [\n /* ... */\n ];\n\n constructor(\n name: string,\n // If you need to make a request that is detached from an integration, you MUST set this to \"restapi\".\n integration: string = \"restapi\",\n config: {\n method: string;\n url: Binding<string>;\n headers?: { key: Binding<string>; value: Binding<string> }[];\n params?: { key: Binding<string>; value: Binding<string> }[];\n body?: Binding<string>;\n },\n openapi?: {\n /**\n * This is the path exactly as it appears in the OpenAPI spec.\n *\n * For example, if we had the following OpenAPI specification.\n *\n * paths:\n * /resources/{id}:\n * get: # ...\n *\n * If you determine that this is the path we should use, then the path would be \"/resources/{id}\".\n */\n path: string;\n },\n ) {\n super(name, integration);\n }\n}\n\nclass GitHub extends RestApi {\n constructor(\n name: string,\n integration: string,\n config: {\n method: string;\n url: Binding<string>;\n headers?: { key: Binding<string>; value: Binding<string> }[];\n params?: { key: Binding<string>; value: Binding<string> }[];\n body?: Binding<string>;\n },\n openapi?: {\n /**\n * This is the path exactly as it appears in the OpenAPI spec.\n *\n * For example, if we had the following OpenAPI specification.\n *\n * paths:\n * /resources/{id}:\n * get: # ...\n *\n * If you determine that this is the path we should use, then the path would be \"/resources/{id}\".\n */\n path: string;\n },\n ) {\n super(name, integration, config, openapi);\n }\n}\n\nclass Jira extends RestApi {\n constructor(\n name: string,\n integration: string,\n config: {\n method: string;\n url: Binding<string>;\n headers?: { key: Binding<string>; value: Binding<string> }[];\n params?: { key: Binding<string>; value: Binding<string> }[];\n body?: Binding<string>;\n },\n openapi?: {\n /**\n * This is the path exactly as it appears in the OpenAPI spec.\n *\n * For example, if we had the following OpenAPI specification.\n *\n * paths:\n * /resources/{id}:\n * get: # ...\n *\n * If you determine that this is the path we should use, then the path would be \"/resources/{id}\".\n */\n path: string;\n },\n ) {\n super(name, integration, config, openapi);\n }\n}\n\nclass Email extends Integration {\n constructor(\n name: string,\n config: {\n from: Binding<string>;\n to: Binding<string>;\n subject: Binding<string>;\n cc?: Binding<string>;\n bcc?: Binding<string>;\n body?: Binding<string>;\n },\n ) {\n super(name);\n }\n}\n\nexport type Condition = {\n when: boolean | ((state: State) => boolean);\n then: Block[];\n};\n\nexport type Conditions = {\n if: Condition;\n elif?: Condition[];\n else?: Block[];\n};\n\nclass Conditional extends Block {\n constructor(name: string, config: Conditions) {\n super(name);\n }\n}\n\nclass TryCatch extends Block {\n constructor(\n name: string,\n config: {\n try: Block[];\n catch: Block[];\n finally?: Block[];\n variables: { error: string };\n },\n ) {\n super(name);\n }\n}\n\n/**\n * A Superblocks variable has the following access pattern:\n *\n * How to retrieve the value of a variable:\n * ```ts\n * CORRECT\n * my_variable.value\n *\n * // INCORRECT\n * my_variable\n * ```\n *\n * How to set the value of a variable:\n * ```ts\n * CORRECT\n * my_variable.set(value)\n *\n * // INCORRECT\n * my_variable = value\n * ```\n *\n */\n\nclass Variables extends Block {\n constructor(\n name: string,\n variables: {\n // The name of the variable.\n key: string;\n // The value of the variable.\n value: Binding<JsonValue>;\n }[],\n ) {\n super(name);\n }\n}\n\nclass Loop extends Block {\n constructor(\n name: string,\n config: {\n over: Binding<JsonValue[]>;\n variables: {\n // What the variable name for the current item is.\n item: string;\n // What the variable name for the current index is.\n index: string;\n };\n blocks: Block[];\n },\n ) {\n super(name);\n }\n}\n\nclass Parallel extends Block {\n constructor(\n name: string,\n config: {\n over: Binding<JsonValue[]>;\n variables: {\n // What the variable name for the current item is.\n item: string;\n };\n blocks: Block[];\n },\n ) {\n super(name);\n }\n}\n\nclass Throw extends Block {\n constructor(\n name: string,\n config: {\n error: Binding<JsonValue>;\n },\n ) {\n super(name);\n }\n}\n\nclass Return extends Block {\n constructor(\n name: string,\n config: {\n data: Binding<JsonValue>;\n },\n ) {\n super(name);\n }\n}\n\nclass Api {\n constructor(\n name: string,\n steps: Block[],\n authorization:\n | {\n type: \"AUTHORIZATION_TYPE_APP_USERS\";\n }\n | {\n type: \"AUTHORIZATION_TYPE_JS_EXPRESSION\";\n expression: Binding<boolean>;\n } = { type: \"AUTHORIZATION_TYPE_APP_USERS\" },\n ) {\n /* ... */\n }\n public get response(): JsonValue {\n /* ... */\n }\n public get error(): string | undefined {\n /* ... */\n }\n public run(): void {\n /* ... */\n }\n public cancel(): void {\n /* ... */\n }\n}\n````\n\n#### Rules for using Superblocks APIs\n\nThink hard about the following important rules for correctly using Superblocks APIs:\n\n- You MUST use a destructured object to access page scope variables in dynamic block fields. This syntax is NOT defining function parameters - it's accessing the inherited page scope.\n\n```ts\n// CORRECT: destructuring to access page scope variables that must already exist\n({ Dropdown1, TextInput1 }) => Dropdown1.selectedOptionsValue + TextInput1.value\n// \u2191 These variables (Dropdown1, TextInput1) must exist in your page scope!\n\n// INCORRECT: trying to use scope object directly\n(state) => state.Dropdown1.selectedOptionsValue + state.TextInput1.value\n// \u2191 This syntax doesn't work in Superblocks\n```\n\n- DO NOT reference variables that are not in scope or that don't exist. The ONLY things in scope are (1) the outputs of previous blocks that are in lexical scope and (2) page entities.\n\n- The result of each scope is the result of the last block in that scope. In the following example, the value of `sendEmail.response` is the result of the `return_summary` block. Use this information to carefully ensure that the last block in your API is the one that returns the value you want.\n\n```ts\nexport default new Api(\"sendEmailApi\", [\n new Email(\"send_email\", {\n from: \"noreply@company.com\",\n to: \"test@test.com\",\n subject: \"Test Email\",\n body: \"This is a test email\",\n }),\n new JavaScript(\"return_summary\", {\n fn: () => \"Email sent successfully!\",\n }),\n]);\n```\n\n- Block outputs are immutable. Do not mutate the output of a block.\n\n- Backend APIs CANNOT mutate frontend state inside of the API\n\n- APIs are registered in scope files using `SbApi()` and then accessed in page components by destructuring from the scope entities. Make sure you name the key used in registerScope the same as the imported API, but do not pass the imported Api into the SbApi() call.\n\n- To access API responses in your UI, use `sbComputed(() => apiName.response)` or `sbComputed(() => apiName.error)`.\n\n- You will not always be told which integrations to use in your API; you will have to determine that yourself based on the data you need to fetch.\n\n- Never add comments to code you (the ai) generate. User added comments are fine - leave those!\n";
1
+ export declare const content = "### APIs\n\nThe Superblocks framework allows you to create backend APIs. The high level structure for creating APIs is as follows:\n\n1. APIs are defined using TypeScript files that live inside the apis directory inside the page they are scoped to. Example: /pages/Page1/apis/myApi.ts\n2. This pattern is a declarative workflow builder, where you define each API step, its configuration, and its execution order within the API workflow.\n3. To make the API available for use, you must import it into the scope file and register it with `SbApi()`, then import and destructure it in your page component for use.\n4. **CRITICAL INTEGRATION RULE**:\n - DO NOT create API steps with integrations that require a configuration ID (PostgreSQL, Snowflake, Databricks, etc.) unless you have been explicitly provided with valid integration configuration IDs\n - NEVER make up or hallucinate integration IDs like \"postgres-integration-id\", a uuid, or similar placeholder strings\n - User mentions like \"@some-intgration-name\" or \"use the postgres database\" do NOT constitute valid integration configurations. You must match the user's request to a valid integration configuration\n - The only integrations that do not require a configuration are: JavaScript, Python, Conditional, TryCatch, Variables, Loop, Parallel, Wait, Throw, Return\n - If a user requests integration functionality but no valid integration configurations have been provided, you can ignore that part of their request and in your description of what you've built, add that there was no integration configuration provided for their request\n - Only use integration IDs that appear in the explicitly provided list of integration configurations\n\n#### CRITICAL VARIABLE SCOPING RULES\n\n**\uD83D\uDEA8 EXTREMELY IMPORTANT**: Variables referenced in API blocks can ONLY come from these sources:\n\n1. **Outputs of previous blocks** in the same API (accessed via the block name)\n2. **Page entities defined in the scope file** (passed as destructured parameters)\n3. **Never reference variables that don't exist** - this is the #1 cause of API generation errors\n\n**\u274C WRONG - Variables that don't exist in scope:**\n\n```ts\nnew PostgreSQL(\"insert_data\", \"postgres-integration-id\", {\n statement: ({ SelectedCustomerIdVar, ProductNameInput, IssueTypeDropdown }) =>\n `INSERT INTO issues VALUES (${SelectedCustomerIdVar.value}, '${ProductNameInput.value}', '${IssueTypeDropdown.selectedOptionValue}')`,\n // \u274C ERROR: SelectedCustomerIdVar, ProductNameInput, IssueTypeDropdown are not defined anywhere!\n});\n```\n\n**\u2705 CORRECT - Variables from scope entities:**\n\n```ts\n// First, define in scope.ts:\nexport const Page1Scope = createSbScope<{\n SelectedCustomerIdVar: any;\n ProductNameInput: any;\n IssueTypeDropdown: any;\n}>(\n () => ({\n // Register the API\n submitIssueApi: SbApi({}),\n }),\n { name: \"Page1\" },\n);\n\n// Then use in API:\nnew PostgreSQL(\"insert_data\", \"postgres-integration-id\", {\n statement: ({ SelectedCustomerIdVar, ProductNameInput, IssueTypeDropdown }) =>\n `INSERT INTO issues VALUES (${SelectedCustomerIdVar.value}, '${ProductNameInput.value}', '${IssueTypeDropdown.selectedOptionValue}')`,\n // \u2705 CORRECT: These are page entities defined in the scope\n});\n```\n\n**\u2705 CORRECT - Variables from previous blocks:**\n\n```ts\nexport default new Api(\"processOrderApi\", [\n new JavaScript(\"get_customer_data\", {\n fn: () => ({ customerId: 123, customerName: \"John Doe\" }),\n }),\n new PostgreSQL(\"insert_order\", \"postgres-integration-id\", {\n statement: ({ get_customer_data }) =>\n `INSERT INTO orders VALUES (${get_customer_data.output.customerId}, '${get_customer_data.output.customerName}')`,\n // \u2705 CORRECT: get_customer_data is a previous block in this API\n }),\n]);\n```\n\n#### CRITICAL MENTAL MODEL: APIs Access Page Scope (They Don't Define Parameters)\n\n**\uD83D\uDEA8 FUNDAMENTAL MISCONCEPTION TO AVOID:**\n\n\u274C **WRONG THINKING**: \"APIs define their input parameters like traditional backend services\"\n\n```ts\n// WRONG - This is NOT how Superblocks APIs work!\nfunction submitOrder(customerId, productName) {\n // \u274C APIs don't define parameters!\n // API logic here\n}\n```\n\n\u2705 **CORRECT THINKING**: \"APIs are frontend-coupled functions that automatically access the page's existing scope\"\n\n```ts\n// CORRECT - APIs inherit page scope automatically\nnew PostgreSQL(\"insert_order\", \"postgres-integration-id\", {\n statement: ({ SelectedCustomerIdVar, ProductNameInput }) =>\n // \u2191 This is NOT defining parameters - this is accessing existing page scope!\n // These variables must ALREADY exist in your page scope\n `INSERT INTO orders VALUES (${SelectedCustomerIdVar.value}, '${ProductNameInput.value}')`,\n});\n```\n\n**KEY CONCEPTS:**\n\n1. **APIs are frontend-aware**: They're tightly coupled to your page, not independent backend services\n2. **No parameter definition**: APIs cannot define their own input parameters\n3. **Scope inheritance only**: APIs automatically access whatever exists in your page scope\n4. **Mandatory order**: Page Scope \u2192 Components \u2192 APIs (scope must exist first)\n\n**The Flow:**\n\n```\nPage Scope Variables \u2192 APIs Automatically Access \u2192 Use in API Logic\n(Must exist first) \u2192 (No parameter passing) \u2192 (Just destructure from scope)\n```\n\n**Contrasting Examples:**\n\n\u274C **Traditional Backend API (NOT how Superblocks works):**\n\n```ts\n// This is how traditional APIs work - NOT Superblocks!\nfunction createOrder(customerId, productName, quantity) {\n // \u274C Defines own parameters\n return database.insert({\n customer_id: customerId,\n product: productName,\n qty: quantity,\n });\n}\n\n// Called like: createOrder(123, \"Widget\", 5) - parameters passed in\n```\n\n\u2705 **Superblocks API (Frontend-coupled):**\n\n```ts\n// This is how Superblocks APIs work - inherits page scope\nnew PostgreSQL(\"insert_order\", \"postgres-integration-id\", {\n statement: ({ CustomerIdInput, ProductNameInput, QuantityInput }) => {\n // \u2191 NOT defining parameters! These must exist in page scope already\n return `INSERT INTO orders VALUES (${CustomerIdInput.value}, '${ProductNameInput.value}', ${QuantityInput.value})`;\n },\n});\n\n// No \"calling with parameters\" - scope variables are automatically available\n```\n\n#### Rules\n\n1. CRITICAL: The name of the API must be consistent across the API's TypeScript definition, the API's file name, references in page files, and the key used to register it in the scope file. See the consistent use of 'myApi' below as an example.\n2. ALWAYS import ALL API classes from the superblocks library at the top of every API file. Use this complete import statement for every API file:\n3. When using database integrations (PostgreSQL, Snowflake, Databricks), the integration_id parameter should be the actual integration ID from your Superblocks workspace, not a placeholder string.\n4. **CRITICAL**: DO NOT reference variables that are not in scope. The ONLY things in scope are (1) the outputs of previous blocks that are in lexical scope and (2) page entities defined in the scope file.\n\n```ts\nimport {\n Api,\n JavaScript,\n Python,\n Databricks,\n Snowflake,\n PostgreSQL,\n RestApi,\n Email,\n Conditional,\n TryCatch,\n Variables,\n Loop,\n Parallel,\n Throw,\n Return,\n} from \"@superblocksteam/library\";\n```\n\n#### Examples\n\n##### Complete Example: Scope \u2192 Components \u2192 API Flow\n\nThis example shows the complete flow from defining variables in scope, to binding them to components, to using them in APIs.\n\n**Step 1: Define entities in scope file**\n\n```ts\n// /pages/Page1/scope.ts\nimport { createSbScope, SbApi } from \"@superblocksteam/library\";\n\nexport const Page1Scope = createSbScope<{\n CustomerNameInput: any;\n ProductNameInput: any;\n IssueTypeDropdown: any;\n IssueNotesInput: any;\n}>(\n () => ({\n // Register the API\n submitProductIssueApi: SbApi({}),\n }),\n {\n name: \"Page1\",\n },\n);\n\nexport const Page1 = Page1Scope.entities;\n```\n\n**Step 2: Use entities in page components**\n\n```tsx\n// /pages/Page1/index.tsx\nimport {\n SbPage,\n SbSection,\n SbColumn,\n SbInput,\n SbDropdown,\n SbButton,\n SbEventFlow,\n registerPage,\n} from \"@superblocksteam/library\";\nimport { Page1, Page1Scope } from \"./scope\";\n\nconst Page1Component = () => {\n const {\n CustomerNameInput,\n ProductNameInput,\n IssueTypeDropdown,\n IssueNotesInput,\n submitProductIssueApi,\n } = Page1;\n\n return (\n <SbPage name=\"Page1\" height={Dim.fill()} width={Dim.fill()}>\n <SbSection height={Dim.fill()}>\n <SbColumn width={Dim.fill()}>\n <SbInput bind={CustomerNameInput} label=\"Customer Name\" />\n <SbInput bind={ProductNameInput} label=\"Product Name\" />\n <SbDropdown\n bind={IssueTypeDropdown}\n label=\"Issue Type\"\n options={[\n { label: \"Defect\", value: \"defect\" },\n { label: \"Complaint\", value: \"complaint\" },\n { label: \"Return\", value: \"return\" },\n ]}\n />\n <SbInput bind={IssueNotesInput} label=\"Notes\" multiline={true} />\n <SbButton\n label=\"Submit Issue\"\n onClick={SbEventFlow.runApis([submitProductIssueApi])}\n />\n </SbColumn>\n </SbSection>\n </SbPage>\n );\n};\n\nexport default registerPage(Page1Component, Page1Scope);\n```\n\n**Step 3: Create API that uses the scope entities**\n\n```ts\n// /pages/Page1/apis/submitProductIssueApi.ts\n\nimport {\n Api,\n JavaScript,\n Python,\n Databricks,\n Snowflake,\n PostgreSQL,\n RestApi,\n Email,\n Conditional,\n TryCatch,\n Variables,\n Loop,\n Parallel,\n Throw,\n Return,\n} from \"@superblocksteam/library\";\n\nexport default new Api(\"submitProductIssueApi\", [\n new Conditional(\"validate_inputs\", {\n if: {\n when: ({\n CustomerNameInput,\n ProductNameInput,\n IssueTypeDropdown,\n }): boolean =>\n !CustomerNameInput.value ||\n !ProductNameInput.value ||\n !IssueTypeDropdown.selectedOptionValue,\n then: [\n new Throw(\"validation_error\", {\n error: \"Customer name, product name, and issue type are required\",\n }),\n ],\n },\n }),\n new PostgreSQL(\"insert_issue\", \"your-postgresql-integration-id\", {\n statement: ({\n CustomerNameInput,\n ProductNameInput,\n IssueTypeDropdown,\n IssueNotesInput,\n }) =>\n `INSERT INTO product_issues \n (customer_name, product_name, issue_type, notes, status, date_reported, created_by)\n VALUES (\n '${CustomerNameInput.value}', \n '${ProductNameInput.value}', \n '${IssueTypeDropdown.selectedOptionValue}', \n '${IssueNotesInput.value || \"\"}', \n 'Open', \n NOW(), \n 1\n )`,\n }),\n new JavaScript(\"return_success\", {\n fn: ({ insert_issue }) => ({\n success: true,\n message: \"Issue submitted successfully\",\n issueId: insert_issue.output?.insertId || null,\n }),\n }),\n]);\n```\n\n##### \u274C COMMON MISTAKES TO AVOID\n\n**\u274C WRONG: Using undefined variables**\n\n```ts\n// This is WRONG - these variables don't exist!\nexport default new Api(\"badExampleApi\", [\n new PostgreSQL(\"insert_data\", \"postgres-integration-id\", {\n statement: ({\n SelectedCustomerIdVar,\n ProductNameInput,\n IssueTypeDropdown,\n }) =>\n `INSERT INTO issues VALUES (${SelectedCustomerIdVar.value}, '${ProductNameInput.value}', '${IssueTypeDropdown.selectedOptionValue}')`,\n // \u274C ERROR: SelectedCustomerIdVar, ProductNameInput, IssueTypeDropdown are not defined in scope!\n }),\n]);\n```\n\n**\u274C WRONG: Mixing up variable names**\n\n```ts\n// Scope defines CustomerNameInput but API tries to use CustomerName\nexport default new Api(\"badExampleApi\", [\n new PostgreSQL(\"insert_data\", \"postgres-integration-id\", {\n statement: (\n { CustomerName }, // \u274C ERROR: Should be CustomerNameInput\n ) => `INSERT INTO issues VALUES ('${CustomerName.value}')`,\n }),\n]);\n```\n\n**\u274C WRONG: Not destructuring function parameters**\n\n```ts\n// This is WRONG - you must destructure the parameters\nexport default new Api(\"badExampleApi\", [\n new PostgreSQL(\"insert_data\", \"postgres-integration-id\", {\n statement: (\n state, // \u274C ERROR: Should destructure { CustomerNameInput }\n ) => `INSERT INTO issues VALUES ('${state.CustomerNameInput.value}')`,\n }),\n]);\n```\n\n##### Creating and registering a Superblocks API\n\nCreate the API by adding the myApi.ts file:\n\n```ts\n// /pages/Page1/apis/myApi.ts\n\nimport {\n Api,\n JavaScript,\n Python,\n Databricks,\n Snowflake,\n PostgreSQL,\n RestApi,\n Email,\n Conditional,\n TryCatch,\n Variables,\n Loop,\n Parallel,\n Throw,\n Return,\n} from \"@superblocksteam/library\";\n\nexport default new Api(\"myApi\", [\n new JavaScript(\"retrieve_orders\", {\n fn: () => {\n return [\n {\n id: \"ORD-001\",\n customerName: \"John Smith\",\n total: 149.99,\n },\n {\n id: \"ORD-002\",\n customerName: \"Sarah Jones\",\n total: 89.5,\n },\n ];\n },\n }),\n]);\n```\n\nThen register the myApi API in the scope file:\n\n```ts\n// /pages/Page1/scope.ts\n\nimport { createSbScope, SbApi } from \"@superblocksteam/library\";\n\nexport const Page1Scope = createSbScope(\n () => ({\n // Register the API in the scope\n retrieveOrdersApi: SbApi({}),\n }),\n {\n name: \"Page1\",\n },\n);\n\nexport const Page1 = Page1Scope.entities;\n```\n\nThen use the API in your page component:\n\n```tsx\n// /pages/Page1/index.tsx\n\nimport {\n SbPage,\n SbSection,\n SbColumn,\n SbButton,\n SbTable,\n sbComputed,\n SbEventFlow,\n registerPage,\n} from \"@superblocksteam/library\";\nimport { Page1, Page1Scope } from \"./scope\";\n\nconst Page1Component = () => {\n const { retrieveOrdersApi } = Page1;\n\n return (\n <SbPage name=\"Page1\" height={Dim.fill()} width={Dim.fill()}>\n <SbSection height={Dim.fill()}>\n <SbColumn width={Dim.fill()}>\n <SbButton\n // APIs can be invoked with the SbEventFlow API\n onClick={SbEventFlow.runApis([retrieveOrdersApi])}\n label=\"Fetch Data\"\n />\n {/* Access API response using sbComputed */}\n <SbTable tableData={sbComputed(() => retrieveOrdersApi.response)} />\n </SbColumn>\n </SbSection>\n </SbPage>\n );\n};\n\nexport default registerPage(Page1Component, Page1Scope);\n```\n\n##### Referencing the output of a previous block\n\nThink hard about how you access the output of previous steps. You MUST use the output property of the previous step variable. There is no other way to access the output of a previous step (other than using a Variable block, but that is not what you want in this case and should only be used in very specific cases).\n\n```ts\n// Path to this api would be: /pages/Page1/apis/getOrdersApi.ts\n\nimport {\n Api,\n JavaScript,\n Python,\n Databricks,\n Snowflake,\n PostgreSQL,\n RestApi,\n Email,\n Conditional,\n TryCatch,\n Variables,\n Loop,\n Parallel,\n Throw,\n Return,\n} from \"@superblocksteam/library\";\n\nexport default new Api(\"getOrdersApi\", [\n new JavaScript(\"retrieve_orders\", {\n fn: () => {\n return [\n {\n id: 1,\n customer: \"John Smith\",\n date: \"2024-01-15\",\n total: 199.99,\n status: \"Pending\",\n },\n {\n id: 2,\n customer: \"Jane Doe\",\n date: \"2024-01-14\",\n total: 149.99,\n status: \"Shipped\",\n },\n {\n id: 3,\n customer: \"Bob Wilson\",\n date: \"2024-01-13\",\n total: 299.99,\n status: \"Delivered\",\n },\n ];\n },\n }),\n new JavaScript(\"format_orders\", {\n fn: ({ retrieve_orders }) => {\n return retrieve_orders.output.map((order) => ({\n ...order,\n date: new Date(order.date).toLocaleDateString(),\n }));\n },\n }),\n]);\n```\n\nThen you would register the API in your scope file and use it in your page component:\n\n```ts\n// /pages/Page1/scope.ts\nexport const Page1Scope = createSbScope(\n () => ({\n getOrdersApi: SbApi({}),\n }),\n {\n name: \"Page1\",\n },\n);\n```\n\n```tsx\n// /pages/Page1/index.tsx\nimport {\n SbPage,\n SbSection,\n SbColumn,\n SbTable,\n sbComputed,\n registerPage,\n} from \"@superblocksteam/library\";\nimport { Page1, Page1Scope } from \"./scope\";\n\nconst Page1Component = () => {\n const { getOrdersApi } = Page1;\n\n return (\n <SbPage name=\"Page1\" height={Dim.fill()} width={Dim.fill()}>\n <SbSection height={Dim.fill()}>\n <SbColumn width={Dim.fill()}>\n <SbTable tableData={sbComputed(() => getOrdersApi.response)} />\n </SbColumn>\n </SbSection>\n </SbPage>\n );\n};\n\nexport default registerPage(Page1Component, Page1Scope);\n```\n\n##### Ensuring variable existence in application\n\n**\uD83D\uDEA8 CRITICAL**: APIs cannot create their own variables - they only access what already exists in page scope!\n\nWhen creating an API that references variables like `FirstNameInput`, `LastNameInput`, and `SelectedUserIdVar`, these variables MUST exist in your page scope BEFORE you write the API. APIs don't define parameters - they inherit scope.\n\n**Mandatory Flow: Scope \u2192 Components \u2192 APIs**\n\n**STEP 1: Create variables in scope FIRST** (APIs cannot access variables that don't exist)\n\nSince you've determined that we'll use input components to take in the first name and last name, you MUST ensure that you use the same names for the entities in the `scope.ts` file as the variable names in the API.\n\n```ts\n// /pages/Page1/scope.ts\n\nimport {\n createSbScope,\n SbApi,\n SbVariable,\n SbVariablePersistence,\n Global,\n} from \"@superblocksteam/library\";\n\nexport const Page1Scope = createSbScope<{\n FirstNameInput: any;\n LastNameInput: any;\n}>(\n // register non-component entities in the scope\n ({\n entities: {\n FirstNameInput,\n LastNameInput,\n handlePeopleUpdates,\n SelectedUserIdVar,\n },\n }) => ({\n handlePeopleUpdatesApi: SbApi({}),\n SelectedUserIdVar: SbVariable({\n defaultValue: Global.user.id,\n persistence: SbVariablePersistence.TEMPORARY,\n }),\n }),\n // configure page options\n {\n name: \"Page1\",\n },\n);\n\nexport const Page1 = Page1Scope.entities;\n```\n\nThen, use the variables in your page component:\n\n```tsx\n// /pages/Page1/index.tsx\n\nimport {\n SbPage,\n SbInput,\n SbEventFlow,\n registerPage,\n} from \"@superblocksteam/library\";\nimport { Page1, Page1Scope } from \"./scope\";\n\nconst Page1Component = () => {\n const {\n handlePeopleUpdatesApi,\n FirstNameInput,\n LastNameInput,\n SelectedUserIdVar,\n } = Page1;\n\n return (\n <SbPage name=\"Page1\">\n <SbInput\n label=\"First Name\"\n bind={FirstNameInput}\n minLength={1}\n inputType=\"TEXT\"\n />\n <SbInput\n label=\"Last Name\"\n bind={LastNameInput}\n minLength={1}\n inputType=\"TEXT\"\n />\n {/* The rest of the page... */}\n </SbPage>\n );\n};\n\nexport default registerPage(Page1Component, Page1Scope);\n```\n\nFinally, create the API that references these variables:\n\n```ts\n// /pages/Page1/apis/handlePeopleUpdatesApi.ts\n\nimport {\n Api,\n JavaScript,\n Python,\n Databricks,\n Snowflake,\n PostgreSQL,\n RestApi,\n Email,\n Conditional,\n TryCatch,\n Variables,\n Loop,\n Parallel,\n Throw,\n Return,\n} from \"@superblocksteam/library\";\n\nexport default new Api(\"handlePeopleUpdatesApi\", [\n new Conditional(\"validate\", {\n if: {\n when: ({ FirstNameInput, LastNameInput }): boolean =>\n !FirstNameInput.isValid || !LastNameInput.isValid,\n then: [\n new Throw(\"reject\", {\n error: \"either the first name or last name is invalid\",\n }),\n ],\n },\n }),\n new PostgreSQL(\"update\", \"your-postgresql-integration-id\", {\n statement: ({ FirstNameInput, LastNameInput, SelectedUserIdVar }) =>\n `UPDATE people SET first_name = '${FirstNameInput.value}', last_name = '${LastNameInput.value}' WHERE id = ${SelectedUserIdVar.value}`,\n }),\n]);\n```\n\n#### The Superblocks API TypeScript Type\n\nBelow is the full TypeScript spec for the APIs you create:\n\n````ts\n// @superblocksteam/library\n\nexport type JsonValue =\n | undefined\n | null\n | number\n | string\n | boolean\n | JsonValue[]\n | object;\nexport type State = { [key: string]: JsonValue };\nexport type Binding<T> = T | ((state: State) => T);\ntype Integrations = { id: string; description: string; metadata: JsonValue }[];\n\nclass Block {\n constructor(name: string) {}\n public run(): { output: JsonValue } {\n /* ... */\n }\n}\n\nclass Integration extends Block {\n constructor(name: string, integration_id: string) {}\n}\n\ntype State = Record<string, JsonValue>;\n\nclass JavaScript extends Integration {\n constructor(\n name: string,\n config: {\n fn: (\n {\n /* ... */\n },\n ) => JsonValue;\n },\n ) {\n super(name, \"javascript\");\n }\n}\n\nclass Python extends Integration {\n constructor(\n name: string,\n config: {\n // We want to just put the python function body here. The scope is the same as it would be if it were a JavaScript integration.\n fn: string;\n },\n ) {\n super(name, \"python\");\n }\n}\n\nclass Databricks extends Integration {\n static integrations: Integrations = [\n /* ... */\n ];\n\n /**\n * @param {string} name The name of the block.\n * @param {string} integration_id The id of the integration.\n * @param {object} config The config object.\n * @returns {void}\n */\n constructor(\n name: string,\n integration_id: string,\n config: {\n statement: Binding<string>;\n },\n ) {\n super(name, integration_id);\n }\n}\n\nclass Snowflake extends Integration {\n static integrations: Integrations = [\n /* ... */\n ];\n\n /**\n * @param {string} name The name of the block.\n * @param {string} integration_id The id of the integration.\n * @param {object} config The config object.\n * @returns {void}\n */\n constructor(\n name: string,\n integration_id: string,\n config: {\n statement: Binding<string>;\n },\n ) {\n super(name, integration_id);\n }\n}\n\nclass PostgreSQL extends Integration {\n static integrations: Integrations = [\n /* ... */\n ];\n\n /**\n * @param {string} name The name of the block.\n * @param {string} integration_id The id of the integration.\n * @param {object} config The config object.\n * @returns {void}\n */\n constructor(\n name: string,\n integration_id: string,\n config: {\n statement: Binding<string>;\n },\n ) {\n super(name, integration_id);\n }\n}\n\nclass RestApi extends Integration {\n static integrations: Integrations = [\n /* ... */\n ];\n\n constructor(\n name: string,\n // If you need to make a request that is detached from an integration, you MUST set this to \"restapi\".\n integration: string = \"restapi\",\n config: {\n method: string;\n url: Binding<string>;\n headers?: { key: Binding<string>; value: Binding<string> }[];\n params?: { key: Binding<string>; value: Binding<string> }[];\n body?: Binding<string>;\n },\n openapi?: {\n /**\n * This is the path exactly as it appears in the OpenAPI spec.\n *\n * For example, if we had the following OpenAPI specification.\n *\n * paths:\n * /resources/{id}:\n * get: # ...\n *\n * If you determine that this is the path we should use, then the path would be \"/resources/{id}\".\n */\n path: string;\n },\n ) {\n super(name, integration);\n }\n}\n\nclass GitHub extends RestApi {\n constructor(\n name: string,\n integration: string,\n config: {\n method: string;\n url: Binding<string>;\n headers?: { key: Binding<string>; value: Binding<string> }[];\n params?: { key: Binding<string>; value: Binding<string> }[];\n body?: Binding<string>;\n },\n openapi?: {\n /**\n * This is the path exactly as it appears in the OpenAPI spec.\n *\n * For example, if we had the following OpenAPI specification.\n *\n * paths:\n * /resources/{id}:\n * get: # ...\n *\n * If you determine that this is the path we should use, then the path would be \"/resources/{id}\".\n */\n path: string;\n },\n ) {\n super(name, integration, config, openapi);\n }\n}\n\nclass Jira extends RestApi {\n constructor(\n name: string,\n integration: string,\n config: {\n method: string;\n url: Binding<string>;\n headers?: { key: Binding<string>; value: Binding<string> }[];\n params?: { key: Binding<string>; value: Binding<string> }[];\n body?: Binding<string>;\n },\n openapi?: {\n /**\n * This is the path exactly as it appears in the OpenAPI spec.\n *\n * For example, if we had the following OpenAPI specification.\n *\n * paths:\n * /resources/{id}:\n * get: # ...\n *\n * If you determine that this is the path we should use, then the path would be \"/resources/{id}\".\n */\n path: string;\n },\n ) {\n super(name, integration, config, openapi);\n }\n}\n\nclass Email extends Integration {\n constructor(\n name: string,\n config: {\n from: Binding<string>;\n to: Binding<string>;\n subject: Binding<string>;\n cc?: Binding<string>;\n bcc?: Binding<string>;\n body?: Binding<string>;\n },\n ) {\n super(name);\n }\n}\n\nexport type Condition = {\n when: boolean | ((state: State) => boolean);\n then: Block[];\n};\n\nexport type Conditions = {\n if: Condition;\n elif?: Condition[];\n else?: Block[];\n};\n\nclass Conditional extends Block {\n constructor(name: string, config: Conditions) {\n super(name);\n }\n}\n\nclass TryCatch extends Block {\n constructor(\n name: string,\n config: {\n try: Block[];\n catch: Block[];\n finally?: Block[];\n variables: { error: string };\n },\n ) {\n super(name);\n }\n}\n\n/**\n * A Superblocks variable has the following access pattern:\n *\n * How to retrieve the value of a variable:\n * ```ts\n * CORRECT\n * my_variable.value\n *\n * // INCORRECT\n * my_variable\n * ```\n *\n * How to set the value of a variable:\n * ```ts\n * CORRECT\n * my_variable.set(value)\n *\n * // INCORRECT\n * my_variable = value\n * ```\n *\n */\n\nclass Variables extends Block {\n constructor(\n name: string,\n variables: {\n // The name of the variable.\n key: string;\n // The value of the variable.\n value: Binding<JsonValue>;\n }[],\n ) {\n super(name);\n }\n}\n\nclass Loop extends Block {\n constructor(\n name: string,\n config: {\n over: Binding<JsonValue[]>;\n variables: {\n // What the variable name for the current item is.\n item: string;\n // What the variable name for the current index is.\n index: string;\n };\n blocks: Block[];\n },\n ) {\n super(name);\n }\n}\n\nclass Parallel extends Block {\n constructor(\n name: string,\n config: {\n over: Binding<JsonValue[]>;\n variables: {\n // What the variable name for the current item is.\n item: string;\n };\n blocks: Block[];\n },\n ) {\n super(name);\n }\n}\n\nclass Throw extends Block {\n constructor(\n name: string,\n config: {\n error: Binding<JsonValue>;\n },\n ) {\n super(name);\n }\n}\n\nclass Return extends Block {\n constructor(\n name: string,\n config: {\n data: Binding<JsonValue>;\n },\n ) {\n super(name);\n }\n}\n\nclass Api {\n constructor(\n name: string,\n steps: Block[],\n authorization:\n | {\n type: \"AUTHORIZATION_TYPE_APP_USERS\";\n }\n | {\n type: \"AUTHORIZATION_TYPE_JS_EXPRESSION\";\n expression: Binding<boolean>;\n } = { type: \"AUTHORIZATION_TYPE_APP_USERS\" },\n ) {\n /* ... */\n }\n public get response(): JsonValue {\n /* ... */\n }\n public get error(): string | undefined {\n /* ... */\n }\n public run(): void {\n /* ... */\n }\n public cancel(): void {\n /* ... */\n }\n}\n````\n\n#### Rules for using Superblocks APIs\n\nThink hard about the following important rules for correctly using Superblocks APIs:\n\n- You MUST use a destructured object to access page scope variables in dynamic block fields. This syntax is NOT defining function parameters - it's accessing the inherited page scope.\n\n```ts\n// CORRECT: destructuring to access page scope variables that must already exist\n({ Dropdown1, TextInput1 }) => Dropdown1.selectedOptionsValue + TextInput1.value\n// \u2191 These variables (Dropdown1, TextInput1) must exist in your page scope!\n\n// INCORRECT: trying to use scope object directly\n(state) => state.Dropdown1.selectedOptionsValue + state.TextInput1.value\n// \u2191 This syntax doesn't work in Superblocks\n```\n\n- DO NOT reference variables that are not in scope or that don't exist. The ONLY things in scope are (1) the outputs of previous blocks that are in lexical scope and (2) page entities.\n\n- The result of each scope is the result of the last block in that scope. In the following example, the value of `sendEmail.response` is the result of the `return_summary` block. Use this information to carefully ensure that the last block in your API is the one that returns the value you want.\n\n```ts\nexport default new Api(\"sendEmailApi\", [\n new Email(\"send_email\", {\n from: \"noreply@company.com\",\n to: \"test@test.com\",\n subject: \"Test Email\",\n body: \"This is a test email\",\n }),\n new JavaScript(\"return_summary\", {\n fn: () => \"Email sent successfully!\",\n }),\n]);\n```\n\n- Block outputs are immutable. Do not mutate the output of a block.\n\n- Backend APIs CANNOT mutate frontend state inside of the API\n\n- APIs are registered in scope files using `SbApi()` and then accessed in page components by destructuring from the scope entities. Make sure you name the key used in registerScope the same as the imported API, but do not pass the imported Api into the SbApi() call.\n\n- To access API responses in your UI, use `sbComputed(() => apiName.response)` or `sbComputed(() => apiName.error)`.\n\n- You will not always be told which integrations to use in your API; you will have to determine that yourself based on the data you need to fetch.\n\n- Never add comments to code you (the ai) generate. User added comments are fine - leave those!\n";
2
2
  //# sourceMappingURL=superblocks-api.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"superblocks-api.d.ts","sourceRoot":"","sources":["../../../../../src/ai-service/prompts/generated/subprompts/superblocks-api.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,OAAO,mu7BAAgi7B,CAAC"}
1
+ {"version":3,"file":"superblocks-api.d.ts","sourceRoot":"","sources":["../../../../../src/ai-service/prompts/generated/subprompts/superblocks-api.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,OAAO,uz9BAAon9B,CAAC"}