@airtable/blocks 0.0.0-experimental-f52bc4e5e-20250709 → 0.0.0-experimental-3649c7162-20250904

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 (667) hide show
  1. package/dist/esm/base/assert_run_context.js +12 -0
  2. package/dist/{cjs → esm}/base/index.js +30 -32
  3. package/dist/esm/base/models/abstract_model_with_async_data.js +190 -0
  4. package/dist/esm/base/models/base.js +252 -0
  5. package/dist/esm/base/models/create_aggregators.js +90 -0
  6. package/dist/esm/base/models/cursor.js +305 -0
  7. package/dist/esm/base/models/field.js +338 -0
  8. package/dist/esm/base/models/grouped_record_query_result.js +280 -0
  9. package/dist/esm/base/models/linked_records_query_result.js +553 -0
  10. package/dist/{cjs → esm}/base/models/models.js +19 -40
  11. package/dist/esm/base/models/mutations.js +312 -0
  12. package/dist/esm/base/models/object_pool.js +145 -0
  13. package/dist/esm/base/models/record.js +239 -0
  14. package/dist/{cjs → esm}/base/models/record_coloring.js +6 -6
  15. package/dist/esm/base/models/record_query_result.js +657 -0
  16. package/dist/esm/base/models/record_store.js +475 -0
  17. package/dist/esm/base/models/session.js +154 -0
  18. package/dist/esm/base/models/table.js +520 -0
  19. package/dist/esm/base/models/table_or_view_query_result.js +749 -0
  20. package/dist/esm/base/models/view.js +326 -0
  21. package/dist/esm/base/models/view_data_store.js +265 -0
  22. package/dist/esm/base/models/view_metadata_query_result.js +176 -0
  23. package/dist/esm/base/perform_record_action.js +215 -0
  24. package/dist/esm/base/sdk.js +178 -0
  25. package/dist/esm/base/settings_button.js +118 -0
  26. package/dist/{cjs → esm}/base/types/airtable_interface.js +1 -1
  27. package/dist/{cjs → esm}/base/types/mutations.js +5 -11
  28. package/dist/{cjs → esm}/base/types/undo_redo.js +1 -1
  29. package/dist/{cjs → esm}/base/types/view.js +1 -1
  30. package/dist/{cjs → esm}/base/ui/base_provider.js +6 -8
  31. package/dist/esm/base/ui/baymax_utils.js +461 -0
  32. package/dist/esm/base/ui/block_wrapper.js +118 -0
  33. package/dist/esm/base/ui/box.js +84 -0
  34. package/dist/esm/base/ui/button.js +152 -0
  35. package/dist/esm/base/ui/cell_renderer.js +198 -0
  36. package/dist/esm/base/ui/choice_token.js +93 -0
  37. package/dist/esm/base/ui/collaborator_token.js +123 -0
  38. package/dist/esm/base/ui/color_palette.js +196 -0
  39. package/dist/esm/base/ui/color_palette_synced.js +69 -0
  40. package/dist/esm/base/ui/confirmation_dialog.js +103 -0
  41. package/dist/{cjs → esm}/base/ui/control_sizes.js +24 -22
  42. package/dist/{cjs → esm}/base/ui/create_detect_element_resize.js +6 -10
  43. package/dist/{cjs → esm}/base/ui/css_helpers.js +1 -1
  44. package/dist/esm/base/ui/dialog.js +101 -0
  45. package/dist/esm/base/ui/dialog_close_button.js +106 -0
  46. package/dist/{cjs → esm}/base/ui/expand_record.js +1 -2
  47. package/dist/{cjs → esm}/base/ui/expand_record_list.js +3 -4
  48. package/dist/esm/base/ui/expand_record_picker_async.js +71 -0
  49. package/dist/esm/base/ui/field_icon.js +44 -0
  50. package/dist/esm/base/ui/field_picker.js +98 -0
  51. package/dist/esm/base/ui/field_picker_synced.js +66 -0
  52. package/dist/esm/base/ui/form_field.js +109 -0
  53. package/dist/{cjs → esm}/base/ui/geometry/geometry.js +5 -5
  54. package/dist/esm/base/ui/geometry/point.js +19 -0
  55. package/dist/esm/base/ui/geometry/rect.js +51 -0
  56. package/dist/esm/base/ui/geometry/size.js +19 -0
  57. package/dist/esm/base/ui/global_alert.js +71 -0
  58. package/dist/esm/base/ui/heading.js +132 -0
  59. package/dist/esm/base/ui/icon.js +109 -0
  60. package/dist/{cjs → esm}/base/ui/icon_config.js +6 -12
  61. package/dist/{cjs → esm}/base/ui/initialize_block.js +16 -35
  62. package/dist/esm/base/ui/input.js +161 -0
  63. package/dist/esm/base/ui/input_synced.js +66 -0
  64. package/dist/{cjs → esm}/base/ui/key_codes.js +2 -3
  65. package/dist/esm/base/ui/label.js +80 -0
  66. package/dist/esm/base/ui/link.js +196 -0
  67. package/dist/esm/base/ui/loader.js +61 -0
  68. package/dist/esm/base/ui/modal.js +145 -0
  69. package/dist/esm/base/ui/model_picker_select.js +57 -0
  70. package/dist/esm/base/ui/popover.js +315 -0
  71. package/dist/esm/base/ui/progress_bar.js +115 -0
  72. package/dist/esm/base/ui/record_card.js +564 -0
  73. package/dist/esm/base/ui/record_card_list.js +303 -0
  74. package/dist/esm/base/ui/select.js +191 -0
  75. package/dist/esm/base/ui/select_and_select_buttons_helpers.js +63 -0
  76. package/dist/esm/base/ui/select_buttons.js +159 -0
  77. package/dist/esm/base/ui/select_buttons_synced.js +62 -0
  78. package/dist/esm/base/ui/select_synced.js +65 -0
  79. package/dist/esm/base/ui/switch.js +167 -0
  80. package/dist/esm/base/ui/switch_synced.js +53 -0
  81. package/dist/esm/base/ui/synced.js +49 -0
  82. package/dist/{cjs → esm}/base/ui/system/all_styles_set.js +4 -12
  83. package/dist/esm/base/ui/system/appearance/appearance_set.js +27 -0
  84. package/dist/esm/base/ui/system/appearance/background_color.js +18 -0
  85. package/dist/{cjs → esm}/base/ui/system/appearance/border.js +3 -6
  86. package/dist/esm/base/ui/system/appearance/border_radius.js +18 -0
  87. package/dist/esm/base/ui/system/appearance/box_shadow.js +18 -0
  88. package/dist/esm/base/ui/system/appearance/opacity.js +18 -0
  89. package/dist/esm/base/ui/system/dimensions/dimensions_set.js +29 -0
  90. package/dist/esm/base/ui/system/dimensions/height.js +18 -0
  91. package/dist/esm/base/ui/system/dimensions/max_height.js +18 -0
  92. package/dist/esm/base/ui/system/dimensions/max_width.js +18 -0
  93. package/dist/esm/base/ui/system/dimensions/min_height.js +18 -0
  94. package/dist/esm/base/ui/system/dimensions/min_width.js +18 -0
  95. package/dist/esm/base/ui/system/dimensions/width.js +18 -0
  96. package/dist/esm/base/ui/system/display.js +19 -0
  97. package/dist/esm/base/ui/system/flex_container/align_content.js +15 -0
  98. package/dist/esm/base/ui/system/flex_container/align_items.js +15 -0
  99. package/dist/esm/base/ui/system/flex_container/flex_container_set.js +29 -0
  100. package/dist/esm/base/ui/system/flex_container/flex_direction.js +15 -0
  101. package/dist/esm/base/ui/system/flex_container/flex_wrap.js +15 -0
  102. package/dist/esm/base/ui/system/flex_container/justify_content.js +15 -0
  103. package/dist/esm/base/ui/system/flex_container/justify_items.js +16 -0
  104. package/dist/esm/base/ui/system/flex_item/align_self.js +15 -0
  105. package/dist/esm/base/ui/system/flex_item/flex.js +15 -0
  106. package/dist/esm/base/ui/system/flex_item/flex_basis.js +15 -0
  107. package/dist/esm/base/ui/system/flex_item/flex_grow.js +15 -0
  108. package/dist/esm/base/ui/system/flex_item/flex_item_set.js +31 -0
  109. package/dist/esm/base/ui/system/flex_item/flex_shrink.js +15 -0
  110. package/dist/esm/base/ui/system/flex_item/justify_self.js +16 -0
  111. package/dist/esm/base/ui/system/flex_item/order.js +15 -0
  112. package/dist/{cjs → esm}/base/ui/system/index.js +104 -416
  113. package/dist/esm/base/ui/system/overflow.js +21 -0
  114. package/dist/{cjs → esm}/base/ui/system/position/bottom.js +4 -6
  115. package/dist/{cjs → esm}/base/ui/system/position/left.js +4 -6
  116. package/dist/esm/base/ui/system/position/position.js +15 -0
  117. package/dist/esm/base/ui/system/position/position_set.js +29 -0
  118. package/dist/{cjs → esm}/base/ui/system/position/right.js +4 -6
  119. package/dist/{cjs → esm}/base/ui/system/position/top.js +4 -6
  120. package/dist/esm/base/ui/system/position/z_index.js +18 -0
  121. package/dist/{cjs → esm}/base/ui/system/spacing/margin.js +4 -6
  122. package/dist/{cjs → esm}/base/ui/system/spacing/padding.js +4 -6
  123. package/dist/esm/base/ui/system/spacing/spacing_set.js +21 -0
  124. package/dist/esm/base/ui/system/typography/font_family.js +18 -0
  125. package/dist/esm/base/ui/system/typography/font_size.js +18 -0
  126. package/dist/esm/base/ui/system/typography/font_style.js +15 -0
  127. package/dist/esm/base/ui/system/typography/font_weight.js +18 -0
  128. package/dist/esm/base/ui/system/typography/letter_spacing.js +18 -0
  129. package/dist/esm/base/ui/system/typography/line_height.js +15 -0
  130. package/dist/esm/base/ui/system/typography/text_align.js +15 -0
  131. package/dist/esm/base/ui/system/typography/text_color.js +18 -0
  132. package/dist/esm/base/ui/system/typography/text_decoration.js +15 -0
  133. package/dist/esm/base/ui/system/typography/text_transform.js +15 -0
  134. package/dist/esm/base/ui/system/typography/typography_set.js +37 -0
  135. package/dist/{cjs → esm}/base/ui/system/utils/ensure_numbers_are_within_scale.js +3 -4
  136. package/dist/esm/base/ui/system/utils/get_style_props_for_responsive_prop.js +73 -0
  137. package/dist/esm/base/ui/table_picker.js +71 -0
  138. package/dist/esm/base/ui/table_picker_synced.js +62 -0
  139. package/dist/esm/base/ui/text.js +117 -0
  140. package/dist/esm/base/ui/text_button.js +196 -0
  141. package/dist/{cjs → esm}/base/ui/theme/default_theme/button_variants.js +3 -3
  142. package/dist/esm/base/ui/theme/default_theme/control_sizes.js +102 -0
  143. package/dist/{cjs → esm}/base/ui/theme/default_theme/heading_styles.js +1 -1
  144. package/dist/{cjs → esm}/base/ui/theme/default_theme/index.js +9 -15
  145. package/dist/{cjs → esm}/base/ui/theme/default_theme/input_variants.js +3 -3
  146. package/dist/{cjs → esm}/base/ui/theme/default_theme/link_variants.js +3 -3
  147. package/dist/{cjs → esm}/base/ui/theme/default_theme/select_buttons_variants.js +4 -4
  148. package/dist/esm/base/ui/theme/default_theme/select_variants.js +50 -0
  149. package/dist/esm/base/ui/theme/default_theme/switch_variants.js +85 -0
  150. package/dist/{cjs → esm}/base/ui/theme/default_theme/text_button_variants.js +5 -5
  151. package/dist/{cjs → esm}/base/ui/theme/default_theme/text_styles.js +1 -1
  152. package/dist/{cjs → esm}/base/ui/theme/default_theme/tokens.js +14 -14
  153. package/dist/{cjs → esm}/base/ui/theme/theme_context.js +2 -2
  154. package/dist/{cjs → esm}/base/ui/theme/use_theme.js +2 -2
  155. package/dist/esm/base/ui/tooltip.js +175 -0
  156. package/dist/{cjs → esm}/base/ui/ui.js +48 -49
  157. package/dist/{cjs → esm}/base/ui/unstable_standalone_ui.js +27 -27
  158. package/dist/{cjs → esm}/base/ui/use_base.js +1 -1
  159. package/dist/{cjs → esm}/base/ui/use_cursor.js +5 -4
  160. package/dist/{cjs → esm}/base/ui/use_form_field.js +1 -1
  161. package/dist/{cjs → esm}/base/ui/use_loadable.js +25 -91
  162. package/dist/{cjs → esm}/base/ui/use_record_action_data.js +4 -3
  163. package/dist/{cjs → esm}/base/ui/use_records.js +9 -13
  164. package/dist/{cjs → esm}/base/ui/use_session.js +1 -1
  165. package/dist/{cjs → esm}/base/ui/use_settings_button.js +4 -3
  166. package/dist/esm/base/ui/use_styled_system.js +25 -0
  167. package/dist/{cjs → esm}/base/ui/use_text_color_for_background_color.js +4 -3
  168. package/dist/{cjs → esm}/base/ui/use_view_metadata.js +4 -4
  169. package/dist/{cjs → esm}/base/ui/use_viewport.js +2 -2
  170. package/dist/esm/base/ui/view_picker.js +89 -0
  171. package/dist/esm/base/ui/view_picker_synced.js +66 -0
  172. package/dist/esm/base/ui/viewport_constraint.js +129 -0
  173. package/dist/esm/base/ui/with_styled_system.js +129 -0
  174. package/dist/esm/base/undo_redo.js +37 -0
  175. package/dist/{cjs → esm}/base/unstable_testing_utils.js +27 -27
  176. package/dist/esm/base/viewport.js +353 -0
  177. package/dist/esm/injected/airtable_interface.js +22 -0
  178. package/dist/esm/interface/assert_run_context.js +12 -0
  179. package/dist/esm/interface/index.js +22 -0
  180. package/dist/esm/interface/models/base.js +35 -0
  181. package/dist/esm/interface/models/field.js +28 -0
  182. package/dist/{cjs → esm}/interface/models/models.js +8 -7
  183. package/dist/esm/interface/models/mutations.js +63 -0
  184. package/dist/esm/interface/models/record.js +51 -0
  185. package/dist/esm/interface/models/record_store.js +51 -0
  186. package/dist/esm/interface/models/session.js +28 -0
  187. package/dist/esm/interface/models/table.js +97 -0
  188. package/dist/esm/interface/sdk.js +78 -0
  189. package/dist/{cjs → esm}/interface/types/airtable_interface.js +2 -2
  190. package/dist/esm/interface/types/mutations.js +17 -0
  191. package/dist/esm/interface/ui/block_wrapper.js +69 -0
  192. package/dist/{cjs → esm}/interface/ui/initialize_block.js +13 -28
  193. package/dist/{cjs → esm}/interface/ui/ui.js +20 -19
  194. package/dist/{cjs → esm}/interface/ui/use_base.js +1 -1
  195. package/dist/{cjs → esm}/interface/ui/use_custom_properties.js +19 -35
  196. package/dist/{cjs → esm}/interface/ui/use_records.js +6 -5
  197. package/dist/{cjs → esm}/interface/ui/use_run_info.js +2 -2
  198. package/dist/{cjs → esm}/interface/ui/use_session.js +1 -1
  199. package/dist/{cjs → esm}/shared/color_utils.js +9 -16
  200. package/dist/{cjs → esm}/shared/colors.js +2 -2
  201. package/dist/{cjs → esm}/shared/error_utils.js +9 -11
  202. package/dist/{cjs → esm}/shared/event_tracker.js +3 -3
  203. package/dist/esm/shared/global_config.js +399 -0
  204. package/dist/esm/shared/models/abstract_model.js +94 -0
  205. package/dist/esm/shared/models/base_core.js +482 -0
  206. package/dist/esm/shared/models/field_core.js +288 -0
  207. package/dist/esm/shared/models/mutations_core.js +343 -0
  208. package/dist/esm/shared/models/record_core.js +215 -0
  209. package/dist/esm/shared/models/record_store_core.js +160 -0
  210. package/dist/esm/shared/models/session_core.js +160 -0
  211. package/dist/esm/shared/models/table_core.js +1318 -0
  212. package/dist/{cjs → esm}/shared/private_utils.js +54 -124
  213. package/dist/esm/shared/sdk_core.js +113 -0
  214. package/dist/{cjs → esm}/shared/types/field_core.js +1 -1
  215. package/dist/esm/shared/types/mutation_constants.js +11 -0
  216. package/dist/{cjs → esm}/shared/types/mutations_core.js +1 -1
  217. package/dist/{cjs → esm}/shared/types/permission_levels.js +1 -1
  218. package/dist/esm/shared/types/record.js +1 -0
  219. package/dist/esm/shared/types/stat.js +1 -0
  220. package/dist/esm/shared/types/table_core.js +1 -0
  221. package/dist/{cjs → esm}/shared/ui/global_config_synced_component_helpers.js +9 -9
  222. package/dist/esm/shared/ui/loader.js +47 -0
  223. package/dist/{cjs → esm}/shared/ui/remote_utils.js +5 -7
  224. package/dist/{cjs → esm}/shared/ui/sdk_context.js +4 -8
  225. package/dist/{cjs → esm}/shared/ui/use_array_identity.js +2 -2
  226. package/dist/{cjs → esm}/shared/ui/use_base.js +6 -5
  227. package/dist/{cjs → esm}/shared/ui/use_color_scheme.js +3 -8
  228. package/dist/{cjs → esm}/shared/ui/use_global_config.js +5 -4
  229. package/dist/{cjs → esm}/shared/ui/use_session.js +6 -5
  230. package/dist/{cjs → esm}/shared/ui/use_synced.js +7 -5
  231. package/dist/{cjs → esm}/shared/ui/use_watchable.js +13 -42
  232. package/dist/{cjs → esm}/shared/ui/with_hooks.js +6 -13
  233. package/dist/{cjs → esm}/shared/unstable_private_utils.js +4 -6
  234. package/dist/{cjs → esm}/shared/warning.js +5 -5
  235. package/dist/esm/shared/watchable.js +150 -0
  236. package/dist/esm/stats/block_stats.js +73 -0
  237. package/dist/esm/testing/base/abstract_mock_airtable_interface.js +208 -0
  238. package/dist/esm/testing/interface/abstract_mock_airtable_interface.js +124 -0
  239. package/dist/types/src/base/assert_run_context.d.ts +2 -0
  240. package/dist/types/src/base/assert_run_context.d.ts.map +1 -0
  241. package/dist/types/src/base/index.d.ts +1 -0
  242. package/dist/types/src/base/index.d.ts.map +1 -1
  243. package/dist/types/src/base/models/base.d.ts +19 -0
  244. package/dist/types/src/base/models/base.d.ts.map +1 -1
  245. package/dist/types/src/base/models/create_aggregators.d.ts +3 -4
  246. package/dist/types/src/base/models/create_aggregators.d.ts.map +1 -1
  247. package/dist/types/src/base/models/field.d.ts +3 -2
  248. package/dist/types/src/base/models/field.d.ts.map +1 -1
  249. package/dist/types/src/base/models/models.d.ts +1 -2
  250. package/dist/types/src/base/models/models.d.ts.map +1 -1
  251. package/dist/types/src/base/models/mutations.d.ts.map +1 -1
  252. package/dist/types/src/base/sdk.d.ts.map +1 -1
  253. package/dist/types/src/base/ui/block_wrapper.d.ts +1 -1
  254. package/dist/types/src/base/ui/box.d.ts.map +1 -1
  255. package/dist/types/src/base/ui/button.d.ts +0 -5
  256. package/dist/types/src/base/ui/button.d.ts.map +1 -1
  257. package/dist/types/src/base/ui/cell_renderer.d.ts +1 -22
  258. package/dist/types/src/base/ui/cell_renderer.d.ts.map +1 -1
  259. package/dist/types/src/base/ui/choice_token.d.ts +1 -21
  260. package/dist/types/src/base/ui/choice_token.d.ts.map +1 -1
  261. package/dist/types/src/base/ui/collaborator_token.d.ts +0 -20
  262. package/dist/types/src/base/ui/collaborator_token.d.ts.map +1 -1
  263. package/dist/types/src/base/ui/color_palette.d.ts +1 -32
  264. package/dist/types/src/base/ui/color_palette.d.ts.map +1 -1
  265. package/dist/types/src/base/ui/color_palette_synced.d.ts +0 -14
  266. package/dist/types/src/base/ui/color_palette_synced.d.ts.map +1 -1
  267. package/dist/types/src/base/ui/confirmation_dialog.d.ts +0 -17
  268. package/dist/types/src/base/ui/confirmation_dialog.d.ts.map +1 -1
  269. package/dist/types/src/base/ui/control_sizes.d.ts +0 -1
  270. package/dist/types/src/base/ui/control_sizes.d.ts.map +1 -1
  271. package/dist/types/src/base/ui/dialog.d.ts +1 -23
  272. package/dist/types/src/base/ui/dialog.d.ts.map +1 -1
  273. package/dist/types/src/base/ui/dialog_close_button.d.ts +2 -24
  274. package/dist/types/src/base/ui/dialog_close_button.d.ts.map +1 -1
  275. package/dist/types/src/base/ui/field_icon.d.ts +1 -17
  276. package/dist/types/src/base/ui/field_icon.d.ts.map +1 -1
  277. package/dist/types/src/base/ui/field_picker.d.ts +0 -23
  278. package/dist/types/src/base/ui/field_picker.d.ts.map +1 -1
  279. package/dist/types/src/base/ui/field_picker_synced.d.ts.map +1 -1
  280. package/dist/types/src/base/ui/form_field.d.ts +0 -4
  281. package/dist/types/src/base/ui/form_field.d.ts.map +1 -1
  282. package/dist/types/src/base/ui/heading.d.ts +1 -1
  283. package/dist/types/src/base/ui/heading.d.ts.map +1 -1
  284. package/dist/types/src/base/ui/icon.d.ts +0 -16
  285. package/dist/types/src/base/ui/icon.d.ts.map +1 -1
  286. package/dist/types/src/base/ui/icon_config.d.ts +50 -51
  287. package/dist/types/src/base/ui/icon_config.d.ts.map +1 -1
  288. package/dist/types/src/base/ui/initialize_block.d.ts.map +1 -1
  289. package/dist/types/src/base/ui/input.d.ts +12 -46
  290. package/dist/types/src/base/ui/input.d.ts.map +1 -1
  291. package/dist/types/src/base/ui/input_synced.d.ts.map +1 -1
  292. package/dist/types/src/base/ui/label.d.ts.map +1 -1
  293. package/dist/types/src/base/ui/link.d.ts +1 -5
  294. package/dist/types/src/base/ui/link.d.ts.map +1 -1
  295. package/dist/types/src/base/ui/loader.d.ts +3 -20
  296. package/dist/types/src/base/ui/loader.d.ts.map +1 -1
  297. package/dist/types/src/base/ui/modal.d.ts +1 -14
  298. package/dist/types/src/base/ui/modal.d.ts.map +1 -1
  299. package/dist/types/src/base/ui/model_picker_select.d.ts.map +1 -1
  300. package/dist/types/src/base/ui/popover.d.ts +1 -17
  301. package/dist/types/src/base/ui/popover.d.ts.map +1 -1
  302. package/dist/types/src/base/ui/progress_bar.d.ts +1 -24
  303. package/dist/types/src/base/ui/progress_bar.d.ts.map +1 -1
  304. package/dist/types/src/base/ui/record_card.d.ts +1 -23
  305. package/dist/types/src/base/ui/record_card.d.ts.map +1 -1
  306. package/dist/types/src/base/ui/record_card_list.d.ts +1 -18
  307. package/dist/types/src/base/ui/record_card_list.d.ts.map +1 -1
  308. package/dist/types/src/base/ui/select.d.ts +0 -44
  309. package/dist/types/src/base/ui/select.d.ts.map +1 -1
  310. package/dist/types/src/base/ui/select_and_select_buttons_helpers.d.ts +0 -2
  311. package/dist/types/src/base/ui/select_and_select_buttons_helpers.d.ts.map +1 -1
  312. package/dist/types/src/base/ui/select_buttons.d.ts +0 -22
  313. package/dist/types/src/base/ui/select_buttons.d.ts.map +1 -1
  314. package/dist/types/src/base/ui/select_buttons_synced.d.ts.map +1 -1
  315. package/dist/types/src/base/ui/select_synced.d.ts.map +1 -1
  316. package/dist/types/src/base/ui/switch.d.ts +0 -22
  317. package/dist/types/src/base/ui/switch.d.ts.map +1 -1
  318. package/dist/types/src/base/ui/switch_synced.d.ts.map +1 -1
  319. package/dist/types/src/base/ui/synced.d.ts +2 -8
  320. package/dist/types/src/base/ui/synced.d.ts.map +1 -1
  321. package/dist/types/src/base/ui/system/all_styles_set.d.ts +0 -3
  322. package/dist/types/src/base/ui/system/all_styles_set.d.ts.map +1 -1
  323. package/dist/types/src/base/ui/system/appearance/appearance_set.d.ts +0 -1
  324. package/dist/types/src/base/ui/system/appearance/appearance_set.d.ts.map +1 -1
  325. package/dist/types/src/base/ui/system/appearance/background_color.d.ts +0 -1
  326. package/dist/types/src/base/ui/system/appearance/background_color.d.ts.map +1 -1
  327. package/dist/types/src/base/ui/system/appearance/border.d.ts +0 -1
  328. package/dist/types/src/base/ui/system/appearance/border.d.ts.map +1 -1
  329. package/dist/types/src/base/ui/system/appearance/border_radius.d.ts +0 -1
  330. package/dist/types/src/base/ui/system/appearance/border_radius.d.ts.map +1 -1
  331. package/dist/types/src/base/ui/system/appearance/box_shadow.d.ts +0 -1
  332. package/dist/types/src/base/ui/system/appearance/box_shadow.d.ts.map +1 -1
  333. package/dist/types/src/base/ui/system/appearance/opacity.d.ts +0 -1
  334. package/dist/types/src/base/ui/system/appearance/opacity.d.ts.map +1 -1
  335. package/dist/types/src/base/ui/system/dimensions/dimensions_set.d.ts +0 -1
  336. package/dist/types/src/base/ui/system/dimensions/dimensions_set.d.ts.map +1 -1
  337. package/dist/types/src/base/ui/system/dimensions/height.d.ts +0 -1
  338. package/dist/types/src/base/ui/system/dimensions/height.d.ts.map +1 -1
  339. package/dist/types/src/base/ui/system/dimensions/max_height.d.ts +0 -1
  340. package/dist/types/src/base/ui/system/dimensions/max_height.d.ts.map +1 -1
  341. package/dist/types/src/base/ui/system/dimensions/max_width.d.ts +0 -1
  342. package/dist/types/src/base/ui/system/dimensions/max_width.d.ts.map +1 -1
  343. package/dist/types/src/base/ui/system/dimensions/min_height.d.ts +0 -1
  344. package/dist/types/src/base/ui/system/dimensions/min_height.d.ts.map +1 -1
  345. package/dist/types/src/base/ui/system/dimensions/min_width.d.ts +0 -1
  346. package/dist/types/src/base/ui/system/dimensions/min_width.d.ts.map +1 -1
  347. package/dist/types/src/base/ui/system/dimensions/width.d.ts +0 -1
  348. package/dist/types/src/base/ui/system/dimensions/width.d.ts.map +1 -1
  349. package/dist/types/src/base/ui/system/display.d.ts +0 -1
  350. package/dist/types/src/base/ui/system/display.d.ts.map +1 -1
  351. package/dist/types/src/base/ui/system/flex_container/align_content.d.ts +0 -1
  352. package/dist/types/src/base/ui/system/flex_container/align_content.d.ts.map +1 -1
  353. package/dist/types/src/base/ui/system/flex_container/align_items.d.ts +0 -1
  354. package/dist/types/src/base/ui/system/flex_container/align_items.d.ts.map +1 -1
  355. package/dist/types/src/base/ui/system/flex_container/flex_container_set.d.ts +0 -1
  356. package/dist/types/src/base/ui/system/flex_container/flex_container_set.d.ts.map +1 -1
  357. package/dist/types/src/base/ui/system/flex_container/flex_direction.d.ts +0 -1
  358. package/dist/types/src/base/ui/system/flex_container/flex_direction.d.ts.map +1 -1
  359. package/dist/types/src/base/ui/system/flex_container/flex_wrap.d.ts +0 -1
  360. package/dist/types/src/base/ui/system/flex_container/flex_wrap.d.ts.map +1 -1
  361. package/dist/types/src/base/ui/system/flex_container/justify_content.d.ts +0 -1
  362. package/dist/types/src/base/ui/system/flex_container/justify_content.d.ts.map +1 -1
  363. package/dist/types/src/base/ui/system/flex_container/justify_items.d.ts +0 -1
  364. package/dist/types/src/base/ui/system/flex_container/justify_items.d.ts.map +1 -1
  365. package/dist/types/src/base/ui/system/flex_item/align_self.d.ts +0 -1
  366. package/dist/types/src/base/ui/system/flex_item/align_self.d.ts.map +1 -1
  367. package/dist/types/src/base/ui/system/flex_item/flex.d.ts +0 -1
  368. package/dist/types/src/base/ui/system/flex_item/flex.d.ts.map +1 -1
  369. package/dist/types/src/base/ui/system/flex_item/flex_basis.d.ts +0 -1
  370. package/dist/types/src/base/ui/system/flex_item/flex_basis.d.ts.map +1 -1
  371. package/dist/types/src/base/ui/system/flex_item/flex_grow.d.ts +0 -1
  372. package/dist/types/src/base/ui/system/flex_item/flex_grow.d.ts.map +1 -1
  373. package/dist/types/src/base/ui/system/flex_item/flex_item_set.d.ts +0 -1
  374. package/dist/types/src/base/ui/system/flex_item/flex_item_set.d.ts.map +1 -1
  375. package/dist/types/src/base/ui/system/flex_item/flex_shrink.d.ts +0 -1
  376. package/dist/types/src/base/ui/system/flex_item/flex_shrink.d.ts.map +1 -1
  377. package/dist/types/src/base/ui/system/flex_item/justify_self.d.ts +0 -1
  378. package/dist/types/src/base/ui/system/flex_item/justify_self.d.ts.map +1 -1
  379. package/dist/types/src/base/ui/system/flex_item/order.d.ts +0 -1
  380. package/dist/types/src/base/ui/system/flex_item/order.d.ts.map +1 -1
  381. package/dist/types/src/base/ui/system/index.d.ts +52 -52
  382. package/dist/types/src/base/ui/system/index.d.ts.map +1 -1
  383. package/dist/types/src/base/ui/system/overflow.d.ts +0 -1
  384. package/dist/types/src/base/ui/system/overflow.d.ts.map +1 -1
  385. package/dist/types/src/base/ui/system/position/bottom.d.ts +0 -1
  386. package/dist/types/src/base/ui/system/position/bottom.d.ts.map +1 -1
  387. package/dist/types/src/base/ui/system/position/left.d.ts +0 -1
  388. package/dist/types/src/base/ui/system/position/left.d.ts.map +1 -1
  389. package/dist/types/src/base/ui/system/position/position.d.ts +0 -1
  390. package/dist/types/src/base/ui/system/position/position.d.ts.map +1 -1
  391. package/dist/types/src/base/ui/system/position/position_set.d.ts +0 -1
  392. package/dist/types/src/base/ui/system/position/position_set.d.ts.map +1 -1
  393. package/dist/types/src/base/ui/system/position/right.d.ts +0 -1
  394. package/dist/types/src/base/ui/system/position/right.d.ts.map +1 -1
  395. package/dist/types/src/base/ui/system/position/top.d.ts +0 -1
  396. package/dist/types/src/base/ui/system/position/top.d.ts.map +1 -1
  397. package/dist/types/src/base/ui/system/position/z_index.d.ts +0 -1
  398. package/dist/types/src/base/ui/system/position/z_index.d.ts.map +1 -1
  399. package/dist/types/src/base/ui/system/spacing/margin.d.ts +0 -1
  400. package/dist/types/src/base/ui/system/spacing/margin.d.ts.map +1 -1
  401. package/dist/types/src/base/ui/system/spacing/padding.d.ts +0 -1
  402. package/dist/types/src/base/ui/system/spacing/padding.d.ts.map +1 -1
  403. package/dist/types/src/base/ui/system/spacing/spacing_set.d.ts +0 -1
  404. package/dist/types/src/base/ui/system/spacing/spacing_set.d.ts.map +1 -1
  405. package/dist/types/src/base/ui/system/typography/font_family.d.ts +0 -1
  406. package/dist/types/src/base/ui/system/typography/font_family.d.ts.map +1 -1
  407. package/dist/types/src/base/ui/system/typography/font_size.d.ts +0 -1
  408. package/dist/types/src/base/ui/system/typography/font_size.d.ts.map +1 -1
  409. package/dist/types/src/base/ui/system/typography/font_style.d.ts +0 -1
  410. package/dist/types/src/base/ui/system/typography/font_style.d.ts.map +1 -1
  411. package/dist/types/src/base/ui/system/typography/font_weight.d.ts +0 -1
  412. package/dist/types/src/base/ui/system/typography/font_weight.d.ts.map +1 -1
  413. package/dist/types/src/base/ui/system/typography/letter_spacing.d.ts +0 -1
  414. package/dist/types/src/base/ui/system/typography/letter_spacing.d.ts.map +1 -1
  415. package/dist/types/src/base/ui/system/typography/line_height.d.ts +0 -1
  416. package/dist/types/src/base/ui/system/typography/line_height.d.ts.map +1 -1
  417. package/dist/types/src/base/ui/system/typography/text_align.d.ts +0 -1
  418. package/dist/types/src/base/ui/system/typography/text_align.d.ts.map +1 -1
  419. package/dist/types/src/base/ui/system/typography/text_color.d.ts +0 -1
  420. package/dist/types/src/base/ui/system/typography/text_color.d.ts.map +1 -1
  421. package/dist/types/src/base/ui/system/typography/text_decoration.d.ts +0 -1
  422. package/dist/types/src/base/ui/system/typography/text_decoration.d.ts.map +1 -1
  423. package/dist/types/src/base/ui/system/typography/text_transform.d.ts +0 -1
  424. package/dist/types/src/base/ui/system/typography/text_transform.d.ts.map +1 -1
  425. package/dist/types/src/base/ui/system/typography/typography_set.d.ts +0 -1
  426. package/dist/types/src/base/ui/system/typography/typography_set.d.ts.map +1 -1
  427. package/dist/types/src/base/ui/table_picker.d.ts +0 -21
  428. package/dist/types/src/base/ui/table_picker.d.ts.map +1 -1
  429. package/dist/types/src/base/ui/table_picker_synced.d.ts.map +1 -1
  430. package/dist/types/src/base/ui/text.d.ts +0 -3
  431. package/dist/types/src/base/ui/text.d.ts.map +1 -1
  432. package/dist/types/src/base/ui/text_button.d.ts +1 -5
  433. package/dist/types/src/base/ui/text_button.d.ts.map +1 -1
  434. package/dist/types/src/base/ui/theme/default_theme/index.d.ts +1 -1
  435. package/dist/types/src/base/ui/theme/theme_context.d.ts +1 -1
  436. package/dist/types/src/base/ui/theme/use_theme.d.ts +1 -1
  437. package/dist/types/src/base/ui/tooltip.d.ts +0 -16
  438. package/dist/types/src/base/ui/tooltip.d.ts.map +1 -1
  439. package/dist/types/src/base/ui/types/aria_props.d.ts.map +1 -1
  440. package/dist/types/src/base/ui/types/data_attributes_prop.d.ts +0 -4
  441. package/dist/types/src/base/ui/types/data_attributes_prop.d.ts.map +1 -1
  442. package/dist/types/src/base/ui/types/tooltip_anchor_props.d.ts +0 -7
  443. package/dist/types/src/base/ui/types/tooltip_anchor_props.d.ts.map +1 -1
  444. package/dist/types/src/base/ui/ui.d.ts +1 -0
  445. package/dist/types/src/base/ui/ui.d.ts.map +1 -1
  446. package/dist/types/src/base/ui/view_picker.d.ts +0 -23
  447. package/dist/types/src/base/ui/view_picker.d.ts.map +1 -1
  448. package/dist/types/src/base/ui/view_picker_synced.d.ts.map +1 -1
  449. package/dist/types/src/base/ui/viewport_constraint.d.ts +1 -14
  450. package/dist/types/src/base/ui/viewport_constraint.d.ts.map +1 -1
  451. package/dist/types/src/base/unstable_testing_utils.d.ts +1 -1
  452. package/dist/types/src/base/unstable_testing_utils.d.ts.map +1 -1
  453. package/dist/types/src/interface/assert_run_context.d.ts +2 -0
  454. package/dist/types/src/interface/assert_run_context.d.ts.map +1 -0
  455. package/dist/types/src/interface/index.d.ts +1 -6
  456. package/dist/types/src/interface/index.d.ts.map +1 -1
  457. package/dist/types/src/interface/models/models.d.ts +1 -0
  458. package/dist/types/src/interface/models/models.d.ts.map +1 -1
  459. package/dist/types/src/interface/models/mutations.d.ts.map +1 -1
  460. package/dist/types/src/interface/ui/initialize_block.d.ts.map +1 -1
  461. package/dist/types/src/interface/ui/ui.d.ts +1 -0
  462. package/dist/types/src/interface/ui/ui.d.ts.map +1 -1
  463. package/dist/types/src/interface/ui/use_custom_properties.d.ts +1 -1
  464. package/dist/types/src/shared/models/mutations_core.d.ts.map +1 -1
  465. package/dist/types/src/shared/private_utils.d.ts +0 -9
  466. package/dist/types/src/shared/private_utils.d.ts.map +1 -1
  467. package/dist/types/src/shared/ui/global_config_synced_component_helpers.d.ts +0 -2
  468. package/dist/types/src/shared/ui/global_config_synced_component_helpers.d.ts.map +1 -1
  469. package/dist/types/src/shared/ui/loader.d.ts.map +1 -1
  470. package/dist/types/src/shared/ui/with_hooks.d.ts +2 -2
  471. package/dist/types/src/shared/ui/with_hooks.d.ts.map +1 -1
  472. package/dist/types/src/testing/{abstract_mock_airtable_interface.d.ts → base/abstract_mock_airtable_interface.d.ts} +13 -13
  473. package/dist/types/src/testing/base/abstract_mock_airtable_interface.d.ts.map +1 -0
  474. package/dist/types/src/testing/interface/abstract_mock_airtable_interface.d.ts +51 -0
  475. package/dist/types/src/testing/interface/abstract_mock_airtable_interface.d.ts.map +1 -0
  476. package/models.js +1 -1
  477. package/package.json +24 -23
  478. package/types.js +1 -1
  479. package/dist/cjs/base/models/abstract_model_with_async_data.js +0 -273
  480. package/dist/cjs/base/models/base.js +0 -306
  481. package/dist/cjs/base/models/create_aggregators.js +0 -115
  482. package/dist/cjs/base/models/cursor.js +0 -393
  483. package/dist/cjs/base/models/field.js +0 -427
  484. package/dist/cjs/base/models/grouped_record_query_result.js +0 -399
  485. package/dist/cjs/base/models/linked_records_query_result.js +0 -728
  486. package/dist/cjs/base/models/mutations.js +0 -338
  487. package/dist/cjs/base/models/object_pool.js +0 -184
  488. package/dist/cjs/base/models/record.js +0 -304
  489. package/dist/cjs/base/models/record_query_result.js +0 -741
  490. package/dist/cjs/base/models/record_store.js +0 -825
  491. package/dist/cjs/base/models/session.js +0 -182
  492. package/dist/cjs/base/models/table.js +0 -668
  493. package/dist/cjs/base/models/table_or_view_query_result.js +0 -1013
  494. package/dist/cjs/base/models/view.js +0 -431
  495. package/dist/cjs/base/models/view_data_store.js +0 -403
  496. package/dist/cjs/base/models/view_metadata_query_result.js +0 -224
  497. package/dist/cjs/base/perform_record_action.js +0 -257
  498. package/dist/cjs/base/sdk.js +0 -233
  499. package/dist/cjs/base/settings_button.js +0 -138
  500. package/dist/cjs/base/ui/baymax_utils.js +0 -133
  501. package/dist/cjs/base/ui/block_wrapper.js +0 -143
  502. package/dist/cjs/base/ui/box.js +0 -110
  503. package/dist/cjs/base/ui/button.js +0 -182
  504. package/dist/cjs/base/ui/cell_renderer.js +0 -255
  505. package/dist/cjs/base/ui/choice_token.js +0 -110
  506. package/dist/cjs/base/ui/collaborator_token.js +0 -145
  507. package/dist/cjs/base/ui/color_palette.js +0 -239
  508. package/dist/cjs/base/ui/color_palette_synced.js +0 -98
  509. package/dist/cjs/base/ui/confirmation_dialog.js +0 -153
  510. package/dist/cjs/base/ui/dialog.js +0 -142
  511. package/dist/cjs/base/ui/dialog_close_button.js +0 -152
  512. package/dist/cjs/base/ui/expand_record_picker_async.js +0 -100
  513. package/dist/cjs/base/ui/field_icon.js +0 -62
  514. package/dist/cjs/base/ui/field_picker.js +0 -143
  515. package/dist/cjs/base/ui/field_picker_synced.js +0 -88
  516. package/dist/cjs/base/ui/form_field.js +0 -137
  517. package/dist/cjs/base/ui/geometry/point.js +0 -21
  518. package/dist/cjs/base/ui/geometry/rect.js +0 -67
  519. package/dist/cjs/base/ui/geometry/size.js +0 -21
  520. package/dist/cjs/base/ui/global_alert.js +0 -92
  521. package/dist/cjs/base/ui/heading.js +0 -181
  522. package/dist/cjs/base/ui/icon.js +0 -129
  523. package/dist/cjs/base/ui/input.js +0 -200
  524. package/dist/cjs/base/ui/input_synced.js +0 -89
  525. package/dist/cjs/base/ui/label.js +0 -105
  526. package/dist/cjs/base/ui/link.js +0 -229
  527. package/dist/cjs/base/ui/loader.js +0 -82
  528. package/dist/cjs/base/ui/modal.js +0 -184
  529. package/dist/cjs/base/ui/model_picker_select.js +0 -83
  530. package/dist/cjs/base/ui/popover.js +0 -407
  531. package/dist/cjs/base/ui/progress_bar.js +0 -128
  532. package/dist/cjs/base/ui/record_card.js +0 -653
  533. package/dist/cjs/base/ui/record_card_list.js +0 -377
  534. package/dist/cjs/base/ui/select.js +0 -247
  535. package/dist/cjs/base/ui/select_and_select_buttons_helpers.js +0 -87
  536. package/dist/cjs/base/ui/select_buttons.js +0 -192
  537. package/dist/cjs/base/ui/select_buttons_synced.js +0 -84
  538. package/dist/cjs/base/ui/select_synced.js +0 -87
  539. package/dist/cjs/base/ui/switch.js +0 -196
  540. package/dist/cjs/base/ui/switch_synced.js +0 -75
  541. package/dist/cjs/base/ui/synced.js +0 -70
  542. package/dist/cjs/base/ui/system/appearance/appearance_set.js +0 -30
  543. package/dist/cjs/base/ui/system/appearance/background_color.js +0 -21
  544. package/dist/cjs/base/ui/system/appearance/border_radius.js +0 -21
  545. package/dist/cjs/base/ui/system/appearance/box_shadow.js +0 -21
  546. package/dist/cjs/base/ui/system/appearance/opacity.js +0 -21
  547. package/dist/cjs/base/ui/system/dimensions/dimensions_set.js +0 -31
  548. package/dist/cjs/base/ui/system/dimensions/height.js +0 -21
  549. package/dist/cjs/base/ui/system/dimensions/max_height.js +0 -21
  550. package/dist/cjs/base/ui/system/dimensions/max_width.js +0 -21
  551. package/dist/cjs/base/ui/system/dimensions/min_height.js +0 -21
  552. package/dist/cjs/base/ui/system/dimensions/min_width.js +0 -21
  553. package/dist/cjs/base/ui/system/dimensions/width.js +0 -21
  554. package/dist/cjs/base/ui/system/display.js +0 -22
  555. package/dist/cjs/base/ui/system/flex_container/align_content.js +0 -18
  556. package/dist/cjs/base/ui/system/flex_container/align_items.js +0 -18
  557. package/dist/cjs/base/ui/system/flex_container/flex_container_set.js +0 -31
  558. package/dist/cjs/base/ui/system/flex_container/flex_direction.js +0 -18
  559. package/dist/cjs/base/ui/system/flex_container/flex_wrap.js +0 -18
  560. package/dist/cjs/base/ui/system/flex_container/justify_content.js +0 -18
  561. package/dist/cjs/base/ui/system/flex_container/justify_items.js +0 -19
  562. package/dist/cjs/base/ui/system/flex_item/align_self.js +0 -18
  563. package/dist/cjs/base/ui/system/flex_item/flex.js +0 -18
  564. package/dist/cjs/base/ui/system/flex_item/flex_basis.js +0 -18
  565. package/dist/cjs/base/ui/system/flex_item/flex_grow.js +0 -18
  566. package/dist/cjs/base/ui/system/flex_item/flex_item_set.js +0 -32
  567. package/dist/cjs/base/ui/system/flex_item/flex_shrink.js +0 -18
  568. package/dist/cjs/base/ui/system/flex_item/justify_self.js +0 -19
  569. package/dist/cjs/base/ui/system/flex_item/order.js +0 -18
  570. package/dist/cjs/base/ui/system/overflow.js +0 -24
  571. package/dist/cjs/base/ui/system/position/position.js +0 -18
  572. package/dist/cjs/base/ui/system/position/position_set.js +0 -31
  573. package/dist/cjs/base/ui/system/position/z_index.js +0 -21
  574. package/dist/cjs/base/ui/system/spacing/spacing_set.js +0 -27
  575. package/dist/cjs/base/ui/system/typography/font_family.js +0 -21
  576. package/dist/cjs/base/ui/system/typography/font_size.js +0 -21
  577. package/dist/cjs/base/ui/system/typography/font_style.js +0 -18
  578. package/dist/cjs/base/ui/system/typography/font_weight.js +0 -21
  579. package/dist/cjs/base/ui/system/typography/letter_spacing.js +0 -21
  580. package/dist/cjs/base/ui/system/typography/line_height.js +0 -18
  581. package/dist/cjs/base/ui/system/typography/text_align.js +0 -18
  582. package/dist/cjs/base/ui/system/typography/text_color.js +0 -21
  583. package/dist/cjs/base/ui/system/typography/text_decoration.js +0 -18
  584. package/dist/cjs/base/ui/system/typography/text_transform.js +0 -18
  585. package/dist/cjs/base/ui/system/typography/typography_set.js +0 -35
  586. package/dist/cjs/base/ui/system/utils/create_responsive_prop_type.js +0 -19
  587. package/dist/cjs/base/ui/system/utils/create_style_prop_types.js +0 -24
  588. package/dist/cjs/base/ui/system/utils/enum_prop_type_utils.js +0 -35
  589. package/dist/cjs/base/ui/system/utils/get_style_props_for_responsive_prop.js +0 -113
  590. package/dist/cjs/base/ui/table_picker.js +0 -95
  591. package/dist/cjs/base/ui/table_picker_synced.js +0 -84
  592. package/dist/cjs/base/ui/text.js +0 -150
  593. package/dist/cjs/base/ui/text_button.js +0 -228
  594. package/dist/cjs/base/ui/theme/default_theme/control_sizes.js +0 -96
  595. package/dist/cjs/base/ui/theme/default_theme/select_variants.js +0 -59
  596. package/dist/cjs/base/ui/theme/default_theme/switch_variants.js +0 -91
  597. package/dist/cjs/base/ui/tooltip.js +0 -215
  598. package/dist/cjs/base/ui/types/aria_props.js +0 -23
  599. package/dist/cjs/base/ui/types/data_attributes_prop.js +0 -18
  600. package/dist/cjs/base/ui/types/tooltip_anchor_props.js +0 -17
  601. package/dist/cjs/base/ui/use_styled_system.js +0 -32
  602. package/dist/cjs/base/ui/view_picker.js +0 -133
  603. package/dist/cjs/base/ui/view_picker_synced.js +0 -88
  604. package/dist/cjs/base/ui/viewport_constraint.js +0 -176
  605. package/dist/cjs/base/ui/with_styled_system.js +0 -165
  606. package/dist/cjs/base/undo_redo.js +0 -48
  607. package/dist/cjs/base/viewport.js +0 -397
  608. package/dist/cjs/injected/airtable_interface.js +0 -22
  609. package/dist/cjs/interface/index.js +0 -36
  610. package/dist/cjs/interface/models/base.js +0 -54
  611. package/dist/cjs/interface/models/field.js +0 -42
  612. package/dist/cjs/interface/models/mutations.js +0 -79
  613. package/dist/cjs/interface/models/record.js +0 -71
  614. package/dist/cjs/interface/models/record_store.js +0 -83
  615. package/dist/cjs/interface/models/session.js +0 -42
  616. package/dist/cjs/interface/models/table.js +0 -126
  617. package/dist/cjs/interface/sdk.js +0 -104
  618. package/dist/cjs/interface/types/mutations.js +0 -24
  619. package/dist/cjs/interface/ui/block_wrapper.js +0 -61
  620. package/dist/cjs/shared/global_config.js +0 -511
  621. package/dist/cjs/shared/models/abstract_model.js +0 -119
  622. package/dist/cjs/shared/models/base_core.js +0 -602
  623. package/dist/cjs/shared/models/field_core.js +0 -331
  624. package/dist/cjs/shared/models/mutations_core.js +0 -439
  625. package/dist/cjs/shared/models/record_core.js +0 -272
  626. package/dist/cjs/shared/models/record_store_core.js +0 -213
  627. package/dist/cjs/shared/models/session_core.js +0 -214
  628. package/dist/cjs/shared/models/table_core.js +0 -1561
  629. package/dist/cjs/shared/sdk_core.js +0 -115
  630. package/dist/cjs/shared/types/mutation_constants.js +0 -11
  631. package/dist/cjs/shared/ui/loader.js +0 -68
  632. package/dist/cjs/shared/watchable.js +0 -216
  633. package/dist/cjs/stats/block_stats.js +0 -96
  634. package/dist/cjs/testing/abstract_mock_airtable_interface.js +0 -277
  635. package/dist/types/src/base/ui/system/utils/create_responsive_prop_type.d.ts +0 -2
  636. package/dist/types/src/base/ui/system/utils/create_responsive_prop_type.d.ts.map +0 -1
  637. package/dist/types/src/base/ui/system/utils/create_style_prop_types.d.ts +0 -4
  638. package/dist/types/src/base/ui/system/utils/create_style_prop_types.d.ts.map +0 -1
  639. package/dist/types/src/base/ui/system/utils/enum_prop_type_utils.d.ts +0 -21
  640. package/dist/types/src/base/ui/system/utils/enum_prop_type_utils.d.ts.map +0 -1
  641. package/dist/types/src/testing/abstract_mock_airtable_interface.d.ts.map +0 -1
  642. /package/dist/{cjs → esm}/base/types/aggregators.js +0 -0
  643. /package/dist/{cjs → esm}/base/types/backend_fetch_types.js +0 -0
  644. /package/dist/{cjs → esm}/base/types/base.js +0 -0
  645. /package/dist/{cjs → esm}/base/types/cursor.js +0 -0
  646. /package/dist/{cjs → esm}/base/types/field.js +0 -0
  647. /package/dist/{cjs → esm}/base/types/record.js +0 -0
  648. /package/dist/{cjs → esm}/base/types/record_action_data.js +0 -0
  649. /package/dist/{cjs → esm}/base/types/table.js +0 -0
  650. /package/dist/{cjs → esm}/base/types/viewport.js +0 -0
  651. /package/dist/{cjs → esm}/base/ui/system/utils/csstype.js +0 -0
  652. /package/dist/{cjs → esm}/base/ui/system/utils/types.js +0 -0
  653. /package/dist/{cjs/interface/types/base.js → esm/base/ui/types/aria_props.js} +0 -0
  654. /package/dist/{cjs/interface/types/field.js → esm/base/ui/types/data_attributes_prop.js} +0 -0
  655. /package/dist/{cjs/interface/types/record.js → esm/base/ui/types/tooltip_anchor_props.js} +0 -0
  656. /package/dist/{cjs/interface/types/table.js → esm/interface/types/base.js} +0 -0
  657. /package/dist/{cjs/sdk_mode.js → esm/interface/types/field.js} +0 -0
  658. /package/dist/{cjs/shared → esm/interface}/types/record.js +0 -0
  659. /package/dist/{cjs/shared/types/airtable_interface_core.js → esm/interface/types/table.js} +0 -0
  660. /package/dist/{cjs → esm}/interface/ui/expand_record.js +0 -0
  661. /package/dist/{cjs/shared/types/attachment.js → esm/sdk_mode.js} +0 -0
  662. /package/dist/{cjs/shared/types/base_core.js → esm/shared/types/airtable_interface_core.js} +0 -0
  663. /package/dist/{cjs/shared/types/collaborator.js → esm/shared/types/attachment.js} +0 -0
  664. /package/dist/{cjs/shared/types/global_config.js → esm/shared/types/base_core.js} +0 -0
  665. /package/dist/{cjs/shared/types/hyper_ids.js → esm/shared/types/collaborator.js} +0 -0
  666. /package/dist/{cjs/shared/types/stat.js → esm/shared/types/global_config.js} +0 -0
  667. /package/dist/{cjs/shared/types/table_core.js → esm/shared/types/hyper_ids.js} +0 -0
@@ -0,0 +1,657 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ exports.normalizeSortsOrGroups = normalizeSortsOrGroups;
8
+ var _colors = _interopRequireDefault(require("../../shared/colors"));
9
+ var _field_core = require("../../shared/types/field_core");
10
+ var _private_utils = require("../../shared/private_utils");
11
+ var _error_utils = require("../../shared/error_utils");
12
+ var _abstract_model_with_async_data = _interopRequireDefault(require("./abstract_model_with_async_data"));
13
+ var _field = _interopRequireDefault(require("./field"));
14
+ var _record_coloring = require("./record_coloring");
15
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
16
+ /** @module @airtable/blocks/models: RecordQueryResult */ /** */
17
+
18
+ const WatchableRecordQueryResultKeys = Object.freeze({
19
+ records: 'records',
20
+ recordIds: 'recordIds',
21
+ cellValues: 'cellValues',
22
+ recordColors: 'recordColors',
23
+ groups: 'groups',
24
+ groupLevels: 'groupLevels',
25
+ isDataLoaded: 'isDataLoaded'
26
+ });
27
+ const WatchableCellValuesInFieldKeyPrefix = 'cellValuesInField:';
28
+
29
+ // The string case is to accommodate cellValuesInField:$FieldId.
30
+ /**
31
+ * A key in {@link RecordQueryResult} that can be watched
32
+ * - `records`
33
+ * - `recordIds`
34
+ * - `cellValues`
35
+ * - `recordColors`
36
+ * - `isDataLoaded`
37
+ * - `cellValuesInField:{FIELD_ID}`
38
+ */
39
+
40
+ /** */
41
+
42
+ /** @hidden */
43
+
44
+ /**
45
+ * NormalizedGroupLevel is in airtable_interface
46
+ *
47
+ * @hidden
48
+ */
49
+
50
+ /**
51
+ * View Config that can be set by developer
52
+ *
53
+ * @hidden
54
+ */
55
+
56
+ /**
57
+ * Used to control what data is loaded in a {@link RecordQueryResult}. Used when creating a
58
+ * query result using `table/view.selectRecords()` and in convenience hooks {@link useRecords}.
59
+ *
60
+ * ## sorts
61
+ * Pass an array of sorts to control the order of records. The first sort in the array has the
62
+ * highest priority. If you don't specify sorts, the result will use the inherent order of the
63
+ * source model: the same order you'd see in the main UI for views and linked record fields, and
64
+ * an arbitrary (but stable) order for tables.
65
+ *
66
+ * Record creation time is used as a tiebreaker: pass an empty array to sort by creation time.
67
+ *
68
+ * ```js
69
+ * const opts = {
70
+ * sorts: [
71
+ * // sort by someField in ascending order...
72
+ * {field: someField},
73
+ * // then by someOtherField in descending order
74
+ * {field: someOtherField, direction: 'desc'},
75
+ * ]
76
+ * };
77
+ * const records = useRecords(table, opts);
78
+ * const queryResult = table.selectRecords(opts);
79
+ * ```
80
+ *
81
+ * ## fields
82
+ * Generally, it's a good idea to load as little data into your extension as possible - Airtable bases
83
+ * can get pretty big, and we have to keep all that information in memory and up to date if you ask
84
+ * for it. The fields option lets you make sure that only data relevant to you is loaded.
85
+ *
86
+ * You can specify fields with a {@link Field}, by ID, or by name:
87
+ * ```js
88
+ * const opts = {
89
+ * fields: [
90
+ * // we want to only load fieldA:
91
+ * fieldA,
92
+ * // the field with this id:
93
+ * 'fldXXXXXXXXXXXXXX',
94
+ * // and the field named 'Rating':
95
+ * 'Rating',
96
+ * ],
97
+ * };
98
+ * const records = useRecords(table, opts);
99
+ * const queryResult = table.selectRecords(opts);
100
+ * ```
101
+ *
102
+ * ## recordColorMode
103
+ * Just like a view in Airtable, you can control the colors of records in a field. There are three
104
+ * supported record color modes: none, by a view, and by a select field.
105
+ *
106
+ * ```js
107
+ * import {recordColoring} from '@airtable/blocks/base/models';
108
+ * // No record coloring:
109
+ * const opts = {
110
+ * recordColorMode: recordColoring.modes.none(),
111
+ * };
112
+ *
113
+ * // Color according to the rules of a view:
114
+ * const opts = {
115
+ * recordColorMode: recordColoring.modes.byView(someView),
116
+ * };
117
+ *
118
+ * // Color by a single select field:
119
+ * const opts = {
120
+ * recordColorMode: recordColoring.modes.bySelectField(someSelectField),
121
+ * });
122
+ * ```
123
+ *
124
+ * You can access view coloring information directly from a {@link RecordQueryResult} or a
125
+ * {@link Record}, but you can only directly access single select coloring from a RecordQueryResult:
126
+ *
127
+ * ```
128
+ * const queryResult = table.selectRecords(opts);
129
+ * const records = useRecords(table, opts);
130
+ *
131
+ * // Returns based on opts coloring mode
132
+ * queryResult.getRecordColor(recordId);
133
+ *
134
+ * // Returns based on view
135
+ * // Will throw if you did not pass recordColoring.modes.byView(view) in opts
136
+ * records[0].getColorInView(view);
137
+ * ```
138
+ *
139
+ * Use `record.getCellValue(singleSelectField).color` to access the color of a single select field
140
+ * for a record.
141
+ *
142
+ * By default, views will have whichever coloring is set up in Airtable and tables won't have any
143
+ * record coloring:
144
+ *
145
+ * ```js
146
+ * // these two are the same:
147
+ * someView.selectRecords();
148
+ * someView.selectRecords({
149
+ * recordColorMode: recordColoring.modes.byView(someView),
150
+ * });
151
+ *
152
+ * // as are these two:
153
+ * someTable.selectRecords();
154
+ * someTable.selectRecords({
155
+ * recordColorMode: recordColoring.modes.none(),
156
+ * });
157
+ * ```
158
+ *
159
+ * */
160
+
161
+ /**
162
+ * A subset of {@link RecordQueryResultOpts} used in {@link useRecordById} that omits sorts, as
163
+ * there is only a single record.
164
+ *
165
+ * See RecordQueryResultOpts for full details and examples.
166
+ *
167
+ * ```js
168
+ * const opts = {
169
+ * fields: ['My field'],
170
+ * recordColorMode: recordColoring.modes.byView(view),
171
+ * };
172
+ * const record = useRecordById(table, recordId, opts);
173
+ * */
174
+
175
+ /**
176
+ * A subset of {@link RecordQueryResultOpts} used in {@link useRecordIds} that omits fields and
177
+ * recordColorMode, as record cell values and color are not accessible via this hook.
178
+ *
179
+ * See RecordQueryResultOpts for full details and examples.
180
+ *
181
+ * ```js
182
+ * const opts = {
183
+ * sorts: [
184
+ * // sort by someField in ascending order...
185
+ * {field: someField},
186
+ * // then by someOtherField in descending order
187
+ * {field: someOtherField, direction: 'desc'},
188
+ * ]
189
+ * };
190
+ * const recordIds = useRecordIds(table, opts);
191
+ * */
192
+
193
+ /** @internal */
194
+
195
+ /** @internal */
196
+
197
+ /**
198
+ * @internal
199
+ */
200
+ function _normalizeSortOrGroup(table, sortOrGroup) {
201
+ const field = table.__getFieldMatching(sortOrGroup.field);
202
+ if (sortOrGroup.direction !== undefined && sortOrGroup.direction !== 'asc' && sortOrGroup.direction !== 'desc') {
203
+ throw (0, _error_utils.spawnError)('Invalid sort direction: %s', sortOrGroup.direction);
204
+ }
205
+ return {
206
+ fieldId: field.id,
207
+ direction: sortOrGroup.direction ?? 'asc'
208
+ };
209
+ }
210
+
211
+ /**
212
+ * @internal
213
+ */
214
+ function normalizeSortsOrGroups(table, sortsOrGroups) {
215
+ if (sortsOrGroups === undefined || sortsOrGroups === null) {
216
+ return sortsOrGroups;
217
+ }
218
+ return sortsOrGroups.map(sortOrGroup => _normalizeSortOrGroup(table, sortOrGroup));
219
+ }
220
+
221
+ /**
222
+ * A RecordQueryResult represents a set of records. It's a little bit like a one-off View in Airtable: it
223
+ * contains a bunch of records, filtered to a useful subset of the records in the table. Those
224
+ * records can be sorted according to your specification, and they can be colored by a select field
225
+ * or using the color from a view. Just like a view, you can either have all the fields in a table
226
+ * available, or you can just ask for the fields that are relevant to you. There are two types of
227
+ * QueryResult:
228
+ *
229
+ * - {@link TableOrViewQueryResult} is the most common, and is a query result filtered to all the
230
+ * records in a specific {@link Table} or {@link View}. You can get one of these with
231
+ * `table.selectRecords()` or `view.selectRecords()`.
232
+ * - {@link LinkedRecordsQueryResult} is a query result of all the records in a particular
233
+ * [linked record cell](https://support.airtable.com/hc/en-us/articles/206452848-Linked-record-fields).
234
+ * You can get one of these with `record.selectLinkedRecordsFromCell(someField)`.
235
+ *
236
+ * Once you've got a query result, you need to load it before you can start working with it -
237
+ * extensions don't load record data by default. We recommend using {@link useRecords},
238
+ * {@link useRecordIds}, {@link useRecordById} or {@link useLoadable} to handle this.
239
+ *
240
+ * If you're not using a query result in a React component, you can manually load the data and
241
+ * unload it when you're finished:
242
+ *
243
+ * ```js
244
+ * async function fetchRecordsAndDoSomethingAsync(myTable) {
245
+ * // query for all the records in "myTable"
246
+ * const queryResult = myTable.selectRecords();
247
+ *
248
+ * // load the data in the query result:
249
+ * await queryResult.loadDataAsync();
250
+ *
251
+ * // work with the data in the query result
252
+ * doSomething(queryResult);
253
+ *
254
+ * // when you're done, unload the data:
255
+ * queryResult.unloadData();
256
+ * }
257
+ * ```
258
+ *
259
+ * Whilst loaded, a query result will automatically keep up to date with what's in Airtable:
260
+ * records will get added or removed, the order will change, cell values will be updated, etc.
261
+ * Again, if you're writing a React component then our hooks will look after that for you. If not,
262
+ * you can get notified of these changes with `.watch()`.
263
+ *
264
+ * When calling a `.select*` method, you can pass in a number of options to control the sort order,
265
+ * fields loaded and coloring mode of records: see {@link RecordQueryResultOpts} for examples.
266
+ *
267
+ * @docsPath models/query results/RecordQueryResult
268
+ */
269
+ class RecordQueryResult extends _abstract_model_with_async_data.default {
270
+ // Abstract properties - classes extending QueryResult must override these:
271
+ /** @internal */
272
+ static _className = 'RecordQueryResult';
273
+
274
+ /**
275
+ * The record IDs in this QueryResult.
276
+ * Throws if data is not loaded yet.
277
+ * Can be watched.
278
+ */
279
+
280
+ /**
281
+ * The set of record IDs in this QueryResult.
282
+ * Throws if data is not loaded yet.
283
+ *
284
+ * @internal
285
+ */
286
+
287
+ /**
288
+ * The fields that were used to create this QueryResult.
289
+ * Null if fields were not specified, which means the QueryResult
290
+ * will load all fields in the table.
291
+ */
292
+
293
+ /**
294
+ * @internal (since we may not be able to return parent model instances in the immutable models world)
295
+ * The table that records in this QueryResult are part of
296
+ */
297
+
298
+ // provided properties + methods:
299
+ /** @internal */
300
+ static WatchableKeys = WatchableRecordQueryResultKeys;
301
+ /** @internal */
302
+ static WatchableCellValuesInFieldKeyPrefix = WatchableCellValuesInFieldKeyPrefix;
303
+ /** @internal */
304
+ static _isWatchableKey(key) {
305
+ return (0, _private_utils.isEnumValue)(WatchableRecordQueryResultKeys, key) || key.startsWith(WatchableCellValuesInFieldKeyPrefix);
306
+ }
307
+ /** @internal */
308
+ static _shouldLoadDataForKey(key) {
309
+ return key === RecordQueryResult.WatchableKeys.records || key === RecordQueryResult.WatchableKeys.recordIds || key === RecordQueryResult.WatchableKeys.cellValues || key === RecordQueryResult.WatchableKeys.recordColors || key === RecordQueryResult.WatchableKeys.groups || key === RecordQueryResult.WatchableKeys.groupLevels || key.startsWith(RecordQueryResult.WatchableCellValuesInFieldKeyPrefix);
310
+ }
311
+
312
+ /** @internal */
313
+ static _normalizeOpts(table, recordStore, opts) {
314
+ const sorts = normalizeSortsOrGroups(table, opts.sorts) ?? null;
315
+ let fieldIdsOrNullIfAllFields = null;
316
+ if (opts.fields) {
317
+ (0, _error_utils.invariant)(Array.isArray(opts.fields), 'Must specify an array of fields');
318
+ fieldIdsOrNullIfAllFields = [];
319
+ for (const fieldOrFieldIdOrFieldName of opts.fields) {
320
+ if (!fieldOrFieldIdOrFieldName) {
321
+ // Filter out false-y values so users of this API
322
+ // can conveniently list conditional fields, e.g. [field1, isFoo && field2]
323
+ continue;
324
+ }
325
+ if (typeof fieldOrFieldIdOrFieldName !== 'string' && !(fieldOrFieldIdOrFieldName instanceof _field.default)) {
326
+ throw (0, _error_utils.spawnError)('Invalid value for field, expected a field, id, or name but got: %s', fieldOrFieldIdOrFieldName);
327
+ }
328
+ const field = table.__getFieldMatching(fieldOrFieldIdOrFieldName);
329
+ fieldIdsOrNullIfAllFields.push(field.id);
330
+ }
331
+ }
332
+ const recordColorMode = opts.recordColorMode || _record_coloring.modes.none();
333
+ switch (recordColorMode.type) {
334
+ case _record_coloring.ModeTypes.NONE:
335
+ break;
336
+ case _record_coloring.ModeTypes.BY_SELECT_FIELD:
337
+ (0, _error_utils.invariant)(recordColorMode.selectField.type === _field_core.FieldType.SINGLE_SELECT, 'Invalid field for coloring records by select field: expected a %s, but got a %s', _field_core.FieldType.SINGLE_SELECT, recordColorMode.selectField.type);
338
+ (0, _error_utils.invariant)(recordColorMode.selectField.parentTable === table, 'Invalid field for coloring records by select field: the single select field is not in the same table as the records');
339
+ if (fieldIdsOrNullIfAllFields) {
340
+ fieldIdsOrNullIfAllFields.push(recordColorMode.selectField.id);
341
+ }
342
+ break;
343
+ case _record_coloring.ModeTypes.BY_VIEW:
344
+ (0, _error_utils.invariant)(recordColorMode.view.parentTable === table, 'Invalid view for coloring records from view: the view is not in the same table as the records');
345
+ break;
346
+ default:
347
+ throw (0, _error_utils.spawnError)('Unknown record coloring mode type: %s', (0, _private_utils.cast)(recordColorMode).type);
348
+ }
349
+ (0, _error_utils.invariant)(table.id === recordStore.tableId, 'record store and table must match');
350
+ return {
351
+ sorts,
352
+ fieldIdsOrNullIfAllFields,
353
+ recordColorMode,
354
+ table,
355
+ recordStore
356
+ };
357
+ }
358
+
359
+ /** @internal */
360
+
361
+ /** @internal */
362
+
363
+ /** @internal */
364
+ _recordColorChangeHandler = null;
365
+
366
+ /**
367
+ * @internal
368
+ */
369
+ constructor(sdk, normalizedOpts) {
370
+ super(sdk, (0, _private_utils.getLocallyUniqueId)('RecordQueryResult'));
371
+ this._normalizedOpts = normalizedOpts;
372
+ this._recordStore = normalizedOpts.recordStore;
373
+ }
374
+
375
+ /**
376
+ * @internal
377
+ */
378
+ get _serializedOpts() {
379
+ return JSON.stringify([this._normalizedOpts.sorts, this._normalizedOpts.fieldIdsOrNullIfAllFields, this._normalizedOpts.table.id, (0, _record_coloring.serialize)(this._normalizedOpts.recordColorMode)]);
380
+ }
381
+
382
+ /**
383
+ * The records in this RecordQueryResult.
384
+ * Throws if data is not loaded yet.
385
+ * Can be watched.
386
+ */
387
+ get records() {
388
+ return this.recordIds.map(recordId => {
389
+ const record = this._recordStore.getRecordByIdIfExists(recordId);
390
+ (0, _error_utils.invariant)(record, 'Record missing in table');
391
+ return record;
392
+ });
393
+ }
394
+
395
+ /**
396
+ * Get a specific record in the query result, or null if that record doesn't exist or is
397
+ * filtered out. Throws if data is not loaded yet. Watch using `'recordIds'`.
398
+ *
399
+ * @param recordId the ID of the {@link Record} you want
400
+ */
401
+ getRecordByIdIfExists(recordId) {
402
+ const record = this._recordStore.getRecordByIdIfExists(recordId);
403
+ if (!record || !this.hasRecord(record)) {
404
+ return null;
405
+ }
406
+ return record;
407
+ }
408
+
409
+ /**
410
+ * Get a specific record in the query result, or throws if that record doesn't exist or is
411
+ * filtered out. Throws if data is not loaded yet. Watch using `'recordIds'`.
412
+ *
413
+ * @param recordId the ID of the {@link Record} you want
414
+ */
415
+ getRecordById(recordId) {
416
+ const record = this.getRecordByIdIfExists(recordId);
417
+ if (!record) {
418
+ throw (0, _error_utils.spawnError)('No record with ID %s in this query result', recordId);
419
+ }
420
+ return record;
421
+ }
422
+
423
+ /**
424
+ * @internal
425
+ */
426
+ _getRecord(recordOrRecordId) {
427
+ return this.getRecordById(typeof recordOrRecordId === 'string' ? recordOrRecordId : recordOrRecordId.id);
428
+ }
429
+
430
+ /**
431
+ * Check to see if a particular record or record id is present in this query result. Returns
432
+ * false if the record has been deleted or is filtered out.
433
+ *
434
+ * @param recordOrRecordId the record or record id to check the presence of
435
+ */
436
+ hasRecord(recordOrRecordId) {
437
+ const recordId = typeof recordOrRecordId === 'string' ? recordOrRecordId : recordOrRecordId.id;
438
+ return this._getOrGenerateRecordIdsSet()[recordId] === true;
439
+ }
440
+
441
+ /**
442
+ * Get the {@link Color} of a specific record in the query result. Returns null if the record
443
+ * has no color in this query result. Throws if the record isn't in the RecordQueryResult. Watch
444
+ * with the `'recordColors'` and `'recordIds` keys.
445
+ *
446
+ * @param recordOrRecordId the record or record ID you want the color of.
447
+ */
448
+ getRecordColor(recordOrRecordId) {
449
+ const record = this._getRecord(recordOrRecordId);
450
+ const recordColorMode = this._normalizedOpts.recordColorMode;
451
+ switch (recordColorMode.type) {
452
+ case _record_coloring.ModeTypes.NONE:
453
+ return null;
454
+ case _record_coloring.ModeTypes.BY_SELECT_FIELD:
455
+ {
456
+ if (recordColorMode.selectField.type !== _field_core.FieldType.SINGLE_SELECT) {
457
+ return null;
458
+ }
459
+ const value = record.getCellValue(recordColorMode.selectField);
460
+ return value && typeof value === 'object' && typeof value.color === 'string' ? (0, _private_utils.assertEnumValue)(_colors.default, value.color) : null;
461
+ }
462
+ case _record_coloring.ModeTypes.BY_VIEW:
463
+ return this._recordStore.getViewDataStore(recordColorMode.view.id).getRecordColor(record);
464
+ // istanbul ignore next
465
+ default:
466
+ throw (0, _error_utils.spawnError)('Unknown record coloring mode type: %s', (0, _private_utils.cast)(recordColorMode).type);
467
+ }
468
+ }
469
+
470
+ /**
471
+ * @internal
472
+ */
473
+ _onChangeIsDataLoaded() {
474
+ this._onChange(WatchableRecordQueryResultKeys.isDataLoaded);
475
+ }
476
+
477
+ /**
478
+ * Get notified of changes to the query result.
479
+ *
480
+ * Watchable keys are:
481
+ * - `'records'`
482
+ * - `'recordIds'`
483
+ * - `'cellValues'`
484
+ * - `'recordColors'`
485
+ * - `'isDataLoaded'`
486
+ * - `'cellValuesInField:' + someFieldId`
487
+ *
488
+ * Every call to `.watch` should have a matching call to `.unwatch`.
489
+ *
490
+ * Watching a key that needs to load data asynchronously will automatically
491
+ * cause the data to be fetched. Once the data is available, the `callback`
492
+ * will be called.
493
+ *
494
+ * Returns the array of keys that were watched.
495
+ *
496
+ * @param keys the keys to watch
497
+ * @param callback a function to call when those keys change
498
+ * @param context an optional context for `this` in `callback`.
499
+ */
500
+ watch(keys, callback, context) {
501
+ const validKeys = super.watch(keys, callback, context);
502
+ for (const key of validKeys) {
503
+ if (key === WatchableRecordQueryResultKeys.recordColors) {
504
+ this._watchRecordColorsIfNeeded();
505
+ }
506
+ }
507
+ return validKeys;
508
+ }
509
+
510
+ /**
511
+ * Unwatch keys watched with `.watch`.
512
+ *
513
+ * Should be called with the same arguments given to `.watch`.
514
+ *
515
+ * Unwatching a key that needs to load data asynchronously will automatically
516
+ * cause the data to be unloaded.
517
+ *
518
+ * Returns the array of keys that were unwatched
519
+ *
520
+ * @param keys the keys to unwatch
521
+ * @param callback the function passed to `.watch` for these keys
522
+ * @param context the context that was passed to `.watch` for this `callback`
523
+ */
524
+ unwatch(keys, callback, context) {
525
+ const validKeys = super.unwatch(keys, callback, context);
526
+ for (const key of validKeys) {
527
+ if (key === WatchableRecordQueryResultKeys.recordColors) {
528
+ this._unwatchRecordColorsIfPossible();
529
+ }
530
+ }
531
+ return validKeys;
532
+ }
533
+
534
+ /**
535
+ * @internal
536
+ */
537
+ _watchRecordColorsIfNeeded() {
538
+ (0, _error_utils.invariant)(this._changeWatchersByKey[WatchableRecordQueryResultKeys.recordColors], 'method may only be called when `recordColors` key has been watched');
539
+ const watchCount = this._changeWatchersByKey[WatchableRecordQueryResultKeys.recordColors].length;
540
+ if (!this._recordColorChangeHandler && watchCount >= 1) {
541
+ this._watchRecordColors();
542
+ }
543
+ }
544
+
545
+ /**
546
+ * @internal
547
+ */
548
+ _watchRecordColors() {
549
+ const recordColorMode = this._normalizedOpts.recordColorMode;
550
+ const handler = (model, key, recordIds) => {
551
+ if (model === this) {
552
+ this._onChange(WatchableRecordQueryResultKeys.recordColors, recordIds);
553
+ } else {
554
+ this._onChange(WatchableRecordQueryResultKeys.recordColors);
555
+ }
556
+ };
557
+ switch (recordColorMode.type) {
558
+ case _record_coloring.ModeTypes.NONE:
559
+ break;
560
+ case _record_coloring.ModeTypes.BY_SELECT_FIELD:
561
+ this.watch(`${WatchableCellValuesInFieldKeyPrefix}${recordColorMode.selectField.id}`, handler);
562
+ recordColorMode.selectField.watch('options', handler);
563
+ break;
564
+ case _record_coloring.ModeTypes.BY_VIEW:
565
+ {
566
+ this._recordStore.getViewDataStore(recordColorMode.view.id).watch('recordColors', handler);
567
+ break;
568
+ }
569
+ // istanbul ignore next
570
+ default:
571
+ throw (0, _error_utils.spawnError)('Unknown record coloring mode type: %s', (0, _private_utils.cast)(recordColorMode).type);
572
+ }
573
+ this._recordColorChangeHandler = handler;
574
+ }
575
+
576
+ /**
577
+ * @internal
578
+ */
579
+ _unwatchRecordColorsIfPossible() {
580
+ const watchCount = (this._changeWatchersByKey[WatchableRecordQueryResultKeys.recordColors] || []).length;
581
+ if (this._recordColorChangeHandler && watchCount === 0) {
582
+ this._unwatchRecordColors();
583
+ }
584
+ }
585
+
586
+ /**
587
+ * @internal
588
+ */
589
+ _unwatchRecordColors() {
590
+ const recordColorMode = this._normalizedOpts.recordColorMode;
591
+ const handler = this._recordColorChangeHandler;
592
+ (0, _error_utils.invariant)(handler, 'record color change handler must exist');
593
+ switch (recordColorMode.type) {
594
+ case _record_coloring.ModeTypes.NONE:
595
+ break;
596
+ case _record_coloring.ModeTypes.BY_SELECT_FIELD:
597
+ this.unwatch(`${WatchableCellValuesInFieldKeyPrefix}${recordColorMode.selectField.id}`, handler);
598
+ recordColorMode.selectField.unwatch('options', handler);
599
+ break;
600
+ case _record_coloring.ModeTypes.BY_VIEW:
601
+ {
602
+ if (!recordColorMode.view.isDeleted) {
603
+ this._recordStore.getViewDataStore(recordColorMode.view.id).unwatch('recordColors', handler);
604
+ }
605
+ break;
606
+ }
607
+ // istanbul ignore next
608
+ default:
609
+ throw (0, _error_utils.spawnError)('Unknown record coloring mode type: %s', (0, _private_utils.cast)(recordColorMode).type);
610
+ }
611
+ this._recordColorChangeHandler = null;
612
+ }
613
+
614
+ /**
615
+ * @internal
616
+ */
617
+ async _loadRecordColorsAsync() {
618
+ const recordColorMode = this._normalizedOpts.recordColorMode;
619
+ switch (recordColorMode.type) {
620
+ case _record_coloring.ModeTypes.NONE:
621
+ return;
622
+ case _record_coloring.ModeTypes.BY_SELECT_FIELD:
623
+ // The select field id gets added to fieldIdsOrNullIfAllFields,
624
+ // so we don't need to handle it here
625
+ return;
626
+ case _record_coloring.ModeTypes.BY_VIEW:
627
+ await this._recordStore.getViewDataStore(recordColorMode.view.id).loadDataAsync();
628
+ return;
629
+ // istanbul ignore next
630
+ default:
631
+ throw (0, _error_utils.spawnUnknownSwitchCaseError)('record color mode type', recordColorMode, 'type');
632
+ }
633
+ }
634
+
635
+ /**
636
+ * @internal
637
+ */
638
+ _unloadRecordColors() {
639
+ const recordColorMode = this._normalizedOpts.recordColorMode;
640
+ switch (recordColorMode.type) {
641
+ case _record_coloring.ModeTypes.NONE:
642
+ return;
643
+ case _record_coloring.ModeTypes.BY_SELECT_FIELD:
644
+ // handled as part of fieldIdsOrNullIfAllFields
645
+ return;
646
+ case _record_coloring.ModeTypes.BY_VIEW:
647
+ if (!recordColorMode.view.isDeleted) {
648
+ this._recordStore.getViewDataStore(recordColorMode.view.id).unloadData();
649
+ }
650
+ break;
651
+ // istanbul ignore next
652
+ default:
653
+ throw (0, _error_utils.spawnUnknownSwitchCaseError)('record color mode type', recordColorMode, 'type');
654
+ }
655
+ }
656
+ }
657
+ var _default = exports.default = RecordQueryResult;