@airtable/blocks 0.0.0-experimental-f52bc4e5e-20250709 → 0.0.0-experimental-75d011284-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 (481) hide show
  1. package/dist/cjs/base/assert_run_context.js +12 -0
  2. package/dist/cjs/base/index.js +30 -30
  3. package/dist/cjs/base/models/abstract_model_with_async_data.js +154 -237
  4. package/dist/cjs/base/models/base.js +188 -267
  5. package/dist/cjs/base/models/create_aggregators.js +29 -46
  6. package/dist/cjs/base/models/cursor.js +206 -294
  7. package/dist/cjs/base/models/field.js +307 -395
  8. package/dist/cjs/base/models/grouped_record_query_result.js +219 -338
  9. package/dist/cjs/base/models/linked_records_query_result.js +450 -625
  10. package/dist/cjs/base/models/models.js +19 -22
  11. package/dist/cjs/base/models/mutations.js +267 -293
  12. package/dist/cjs/base/models/object_pool.js +117 -156
  13. package/dist/cjs/base/models/record.js +191 -256
  14. package/dist/cjs/base/models/record_coloring.js +6 -6
  15. package/dist/cjs/base/models/record_query_result.js +351 -435
  16. package/dist/cjs/base/models/record_store.js +403 -753
  17. package/dist/cjs/base/models/session.js +125 -153
  18. package/dist/cjs/base/models/table.js +457 -605
  19. package/dist/cjs/base/models/table_or_view_query_result.js +656 -920
  20. package/dist/cjs/base/models/view.js +284 -389
  21. package/dist/cjs/base/models/view_data_store.js +218 -356
  22. package/dist/cjs/base/models/view_metadata_query_result.js +109 -157
  23. package/dist/cjs/base/perform_record_action.js +89 -131
  24. package/dist/cjs/base/sdk.js +129 -184
  25. package/dist/cjs/base/settings_button.js +54 -74
  26. package/dist/cjs/base/types/airtable_interface.js +1 -1
  27. package/dist/cjs/base/types/mutations.js +5 -11
  28. package/dist/cjs/base/types/undo_redo.js +1 -1
  29. package/dist/cjs/base/types/view.js +1 -1
  30. package/dist/cjs/base/ui/base_provider.js +6 -8
  31. package/dist/cjs/base/ui/baymax_utils.js +436 -108
  32. package/dist/cjs/base/ui/block_wrapper.js +81 -106
  33. package/dist/cjs/base/ui/box.js +34 -60
  34. package/dist/cjs/base/ui/button.js +44 -74
  35. package/dist/cjs/base/ui/cell_renderer.js +132 -189
  36. package/dist/cjs/base/ui/choice_token.js +25 -42
  37. package/dist/cjs/base/ui/collaborator_token.js +31 -53
  38. package/dist/cjs/base/ui/color_palette.js +130 -173
  39. package/dist/cjs/base/ui/color_palette_synced.js +41 -70
  40. package/dist/cjs/base/ui/confirmation_dialog.js +70 -120
  41. package/dist/cjs/base/ui/control_sizes.js +24 -22
  42. package/dist/cjs/base/ui/create_detect_element_resize.js +6 -10
  43. package/dist/cjs/base/ui/css_helpers.js +1 -1
  44. package/dist/cjs/base/ui/dialog.js +57 -98
  45. package/dist/cjs/base/ui/dialog_close_button.js +52 -98
  46. package/dist/cjs/base/ui/expand_record.js +1 -2
  47. package/dist/cjs/base/ui/expand_record_list.js +3 -4
  48. package/dist/cjs/base/ui/expand_record_picker_async.js +28 -57
  49. package/dist/cjs/base/ui/field_icon.js +15 -33
  50. package/dist/cjs/base/ui/field_picker.js +25 -70
  51. package/dist/cjs/base/ui/field_picker_synced.js +18 -40
  52. package/dist/cjs/base/ui/form_field.js +27 -55
  53. package/dist/cjs/base/ui/geometry/geometry.js +5 -5
  54. package/dist/cjs/base/ui/geometry/point.js +10 -12
  55. package/dist/cjs/base/ui/geometry/rect.js +36 -52
  56. package/dist/cjs/base/ui/geometry/size.js +10 -12
  57. package/dist/cjs/base/ui/global_alert.js +31 -52
  58. package/dist/cjs/base/ui/heading.js +45 -94
  59. package/dist/cjs/base/ui/icon.js +39 -59
  60. package/dist/cjs/base/ui/icon_config.js +6 -12
  61. package/dist/cjs/base/ui/initialize_block.js +16 -35
  62. package/dist/cjs/base/ui/input.js +62 -101
  63. package/dist/cjs/base/ui/input_synced.js +17 -40
  64. package/dist/cjs/base/ui/key_codes.js +2 -3
  65. package/dist/cjs/base/ui/label.js +30 -55
  66. package/dist/cjs/base/ui/link.js +54 -87
  67. package/dist/cjs/base/ui/loader.js +15 -36
  68. package/dist/cjs/base/ui/modal.js +88 -127
  69. package/dist/cjs/base/ui/model_picker_select.js +18 -44
  70. package/dist/cjs/base/ui/popover.js +236 -328
  71. package/dist/cjs/base/ui/progress_bar.js +34 -47
  72. package/dist/cjs/base/ui/record_card.js +389 -478
  73. package/dist/cjs/base/ui/record_card_list.js +150 -224
  74. package/dist/cjs/base/ui/select.js +60 -116
  75. package/dist/cjs/base/ui/select_and_select_buttons_helpers.js +15 -39
  76. package/dist/cjs/base/ui/select_buttons.js +50 -83
  77. package/dist/cjs/base/ui/select_buttons_synced.js +17 -39
  78. package/dist/cjs/base/ui/select_synced.js +17 -39
  79. package/dist/cjs/base/ui/switch.js +42 -71
  80. package/dist/cjs/base/ui/switch_synced.js +16 -38
  81. package/dist/cjs/base/ui/synced.js +27 -48
  82. package/dist/cjs/base/ui/system/all_styles_set.js +4 -12
  83. package/dist/cjs/base/ui/system/appearance/appearance_set.js +10 -13
  84. package/dist/cjs/base/ui/system/appearance/background_color.js +3 -6
  85. package/dist/cjs/base/ui/system/appearance/border.js +3 -6
  86. package/dist/cjs/base/ui/system/appearance/border_radius.js +3 -6
  87. package/dist/cjs/base/ui/system/appearance/box_shadow.js +3 -6
  88. package/dist/cjs/base/ui/system/appearance/opacity.js +3 -6
  89. package/dist/cjs/base/ui/system/dimensions/dimensions_set.js +11 -13
  90. package/dist/cjs/base/ui/system/dimensions/height.js +3 -6
  91. package/dist/cjs/base/ui/system/dimensions/max_height.js +3 -6
  92. package/dist/cjs/base/ui/system/dimensions/max_width.js +3 -6
  93. package/dist/cjs/base/ui/system/dimensions/min_height.js +3 -6
  94. package/dist/cjs/base/ui/system/dimensions/min_width.js +3 -6
  95. package/dist/cjs/base/ui/system/dimensions/width.js +3 -6
  96. package/dist/cjs/base/ui/system/display.js +3 -6
  97. package/dist/cjs/base/ui/system/flex_container/align_content.js +3 -6
  98. package/dist/cjs/base/ui/system/flex_container/align_items.js +3 -6
  99. package/dist/cjs/base/ui/system/flex_container/flex_container_set.js +11 -13
  100. package/dist/cjs/base/ui/system/flex_container/flex_direction.js +3 -6
  101. package/dist/cjs/base/ui/system/flex_container/flex_wrap.js +3 -6
  102. package/dist/cjs/base/ui/system/flex_container/justify_content.js +3 -6
  103. package/dist/cjs/base/ui/system/flex_container/justify_items.js +3 -6
  104. package/dist/cjs/base/ui/system/flex_item/align_self.js +3 -6
  105. package/dist/cjs/base/ui/system/flex_item/flex.js +3 -6
  106. package/dist/cjs/base/ui/system/flex_item/flex_basis.js +3 -6
  107. package/dist/cjs/base/ui/system/flex_item/flex_grow.js +3 -6
  108. package/dist/cjs/base/ui/system/flex_item/flex_item_set.js +12 -13
  109. package/dist/cjs/base/ui/system/flex_item/flex_shrink.js +3 -6
  110. package/dist/cjs/base/ui/system/flex_item/justify_self.js +3 -6
  111. package/dist/cjs/base/ui/system/flex_item/order.js +3 -6
  112. package/dist/cjs/base/ui/system/index.js +104 -416
  113. package/dist/cjs/base/ui/system/overflow.js +3 -6
  114. package/dist/cjs/base/ui/system/position/bottom.js +4 -6
  115. package/dist/cjs/base/ui/system/position/left.js +4 -6
  116. package/dist/cjs/base/ui/system/position/position.js +3 -6
  117. package/dist/cjs/base/ui/system/position/position_set.js +11 -13
  118. package/dist/cjs/base/ui/system/position/right.js +4 -6
  119. package/dist/cjs/base/ui/system/position/top.js +4 -6
  120. package/dist/cjs/base/ui/system/position/z_index.js +3 -6
  121. package/dist/cjs/base/ui/system/spacing/margin.js +4 -6
  122. package/dist/cjs/base/ui/system/spacing/padding.js +4 -6
  123. package/dist/cjs/base/ui/system/spacing/spacing_set.js +7 -13
  124. package/dist/cjs/base/ui/system/typography/font_family.js +3 -6
  125. package/dist/cjs/base/ui/system/typography/font_size.js +3 -6
  126. package/dist/cjs/base/ui/system/typography/font_style.js +3 -6
  127. package/dist/cjs/base/ui/system/typography/font_weight.js +3 -6
  128. package/dist/cjs/base/ui/system/typography/letter_spacing.js +3 -6
  129. package/dist/cjs/base/ui/system/typography/line_height.js +3 -6
  130. package/dist/cjs/base/ui/system/typography/text_align.js +3 -6
  131. package/dist/cjs/base/ui/system/typography/text_color.js +3 -6
  132. package/dist/cjs/base/ui/system/typography/text_decoration.js +3 -6
  133. package/dist/cjs/base/ui/system/typography/text_transform.js +3 -6
  134. package/dist/cjs/base/ui/system/typography/typography_set.js +15 -13
  135. package/dist/cjs/base/ui/system/utils/ensure_numbers_are_within_scale.js +3 -4
  136. package/dist/cjs/base/ui/system/utils/get_style_props_for_responsive_prop.js +47 -87
  137. package/dist/cjs/base/ui/table_picker.js +18 -42
  138. package/dist/cjs/base/ui/table_picker_synced.js +17 -39
  139. package/dist/cjs/base/ui/text.js +40 -73
  140. package/dist/cjs/base/ui/text_button.js +51 -83
  141. package/dist/cjs/base/ui/theme/default_theme/button_variants.js +3 -3
  142. package/dist/cjs/base/ui/theme/default_theme/control_sizes.js +51 -45
  143. package/dist/cjs/base/ui/theme/default_theme/heading_styles.js +1 -1
  144. package/dist/cjs/base/ui/theme/default_theme/index.js +9 -15
  145. package/dist/cjs/base/ui/theme/default_theme/input_variants.js +3 -3
  146. package/dist/cjs/base/ui/theme/default_theme/link_variants.js +3 -3
  147. package/dist/cjs/base/ui/theme/default_theme/select_buttons_variants.js +4 -4
  148. package/dist/cjs/base/ui/theme/default_theme/select_variants.js +8 -17
  149. package/dist/cjs/base/ui/theme/default_theme/switch_variants.js +23 -29
  150. package/dist/cjs/base/ui/theme/default_theme/text_button_variants.js +5 -5
  151. package/dist/cjs/base/ui/theme/default_theme/text_styles.js +1 -1
  152. package/dist/cjs/base/ui/theme/default_theme/tokens.js +14 -14
  153. package/dist/cjs/base/ui/theme/theme_context.js +2 -2
  154. package/dist/cjs/base/ui/theme/use_theme.js +2 -2
  155. package/dist/cjs/base/ui/tooltip.js +134 -174
  156. package/dist/cjs/base/ui/types/aria_props.js +1 -23
  157. package/dist/cjs/base/ui/types/data_attributes_prop.js +1 -18
  158. package/dist/cjs/base/ui/types/tooltip_anchor_props.js +1 -17
  159. package/dist/cjs/base/ui/ui.js +48 -49
  160. package/dist/cjs/base/ui/unstable_standalone_ui.js +27 -27
  161. package/dist/cjs/base/ui/use_base.js +1 -1
  162. package/dist/cjs/base/ui/use_cursor.js +5 -4
  163. package/dist/cjs/base/ui/use_form_field.js +1 -1
  164. package/dist/cjs/base/ui/use_loadable.js +25 -91
  165. package/dist/cjs/base/ui/use_record_action_data.js +4 -3
  166. package/dist/cjs/base/ui/use_records.js +9 -13
  167. package/dist/cjs/base/ui/use_session.js +1 -1
  168. package/dist/cjs/base/ui/use_settings_button.js +4 -3
  169. package/dist/cjs/base/ui/use_styled_system.js +7 -14
  170. package/dist/cjs/base/ui/use_text_color_for_background_color.js +4 -3
  171. package/dist/cjs/base/ui/use_view_metadata.js +4 -4
  172. package/dist/cjs/base/ui/use_viewport.js +2 -2
  173. package/dist/cjs/base/ui/view_picker.js +26 -70
  174. package/dist/cjs/base/ui/view_picker_synced.js +18 -40
  175. package/dist/cjs/base/ui/viewport_constraint.js +67 -114
  176. package/dist/cjs/base/ui/with_styled_system.js +25 -61
  177. package/dist/cjs/base/undo_redo.js +21 -32
  178. package/dist/cjs/base/unstable_testing_utils.js +27 -27
  179. package/dist/cjs/base/viewport.js +268 -312
  180. package/dist/cjs/injected/airtable_interface.js +4 -4
  181. package/dist/cjs/interface/assert_run_context.js +12 -0
  182. package/dist/cjs/interface/index.js +4 -18
  183. package/dist/cjs/interface/models/base.js +15 -34
  184. package/dist/cjs/interface/models/field.js +5 -19
  185. package/dist/cjs/interface/models/models.js +8 -7
  186. package/dist/cjs/interface/models/mutations.js +50 -66
  187. package/dist/cjs/interface/models/record.js +29 -49
  188. package/dist/cjs/interface/models/record_store.js +25 -57
  189. package/dist/cjs/interface/models/session.js +2 -16
  190. package/dist/cjs/interface/models/table.js +66 -95
  191. package/dist/cjs/interface/sdk.js +61 -87
  192. package/dist/cjs/interface/types/airtable_interface.js +2 -2
  193. package/dist/cjs/interface/types/mutations.js +3 -10
  194. package/dist/cjs/interface/ui/block_wrapper.js +56 -48
  195. package/dist/cjs/interface/ui/initialize_block.js +13 -28
  196. package/dist/cjs/interface/ui/ui.js +20 -19
  197. package/dist/cjs/interface/ui/use_base.js +1 -1
  198. package/dist/cjs/interface/ui/use_custom_properties.js +19 -35
  199. package/dist/cjs/interface/ui/use_records.js +6 -5
  200. package/dist/cjs/interface/ui/use_run_info.js +2 -2
  201. package/dist/cjs/interface/ui/use_session.js +1 -1
  202. package/dist/cjs/shared/color_utils.js +9 -16
  203. package/dist/cjs/shared/colors.js +2 -2
  204. package/dist/cjs/shared/error_utils.js +9 -11
  205. package/dist/cjs/shared/event_tracker.js +3 -3
  206. package/dist/cjs/shared/global_config.js +337 -449
  207. package/dist/cjs/shared/models/abstract_model.js +72 -97
  208. package/dist/cjs/shared/models/base_core.js +394 -514
  209. package/dist/cjs/shared/models/field_core.js +236 -279
  210. package/dist/cjs/shared/models/mutations_core.js +283 -379
  211. package/dist/cjs/shared/models/record_core.js +174 -231
  212. package/dist/cjs/shared/models/record_store_core.js +119 -172
  213. package/dist/cjs/shared/models/session_core.js +116 -170
  214. package/dist/cjs/shared/models/table_core.js +1258 -1501
  215. package/dist/cjs/shared/private_utils.js +54 -124
  216. package/dist/cjs/shared/sdk_core.js +68 -70
  217. package/dist/cjs/shared/types/field_core.js +1 -1
  218. package/dist/cjs/shared/types/mutation_constants.js +4 -4
  219. package/dist/cjs/shared/types/mutations_core.js +1 -1
  220. package/dist/cjs/shared/types/permission_levels.js +1 -1
  221. package/dist/cjs/shared/ui/global_config_synced_component_helpers.js +9 -9
  222. package/dist/cjs/shared/ui/loader.js +14 -35
  223. package/dist/cjs/shared/ui/remote_utils.js +5 -7
  224. package/dist/cjs/shared/ui/sdk_context.js +4 -8
  225. package/dist/cjs/shared/ui/use_array_identity.js +2 -2
  226. package/dist/cjs/shared/ui/use_base.js +6 -5
  227. package/dist/cjs/shared/ui/use_color_scheme.js +3 -8
  228. package/dist/cjs/shared/ui/use_global_config.js +5 -4
  229. package/dist/cjs/shared/ui/use_session.js +6 -5
  230. package/dist/cjs/shared/ui/use_synced.js +7 -5
  231. package/dist/cjs/shared/ui/use_watchable.js +13 -42
  232. package/dist/cjs/shared/ui/with_hooks.js +6 -13
  233. package/dist/cjs/shared/unstable_private_utils.js +4 -6
  234. package/dist/cjs/shared/warning.js +5 -5
  235. package/dist/cjs/shared/watchable.js +110 -176
  236. package/dist/cjs/stats/block_stats.js +62 -85
  237. package/dist/cjs/testing/base/abstract_mock_airtable_interface.js +208 -0
  238. package/dist/cjs/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/models.d.ts +1 -0
  244. package/dist/types/src/base/models/models.d.ts.map +1 -1
  245. package/dist/types/src/base/models/mutations.d.ts.map +1 -1
  246. package/dist/types/src/base/sdk.d.ts.map +1 -1
  247. package/dist/types/src/base/ui/block_wrapper.d.ts +1 -1
  248. package/dist/types/src/base/ui/box.d.ts.map +1 -1
  249. package/dist/types/src/base/ui/button.d.ts +0 -5
  250. package/dist/types/src/base/ui/button.d.ts.map +1 -1
  251. package/dist/types/src/base/ui/cell_renderer.d.ts +1 -22
  252. package/dist/types/src/base/ui/cell_renderer.d.ts.map +1 -1
  253. package/dist/types/src/base/ui/choice_token.d.ts +1 -21
  254. package/dist/types/src/base/ui/choice_token.d.ts.map +1 -1
  255. package/dist/types/src/base/ui/collaborator_token.d.ts +0 -20
  256. package/dist/types/src/base/ui/collaborator_token.d.ts.map +1 -1
  257. package/dist/types/src/base/ui/color_palette.d.ts +1 -32
  258. package/dist/types/src/base/ui/color_palette.d.ts.map +1 -1
  259. package/dist/types/src/base/ui/color_palette_synced.d.ts +0 -14
  260. package/dist/types/src/base/ui/color_palette_synced.d.ts.map +1 -1
  261. package/dist/types/src/base/ui/confirmation_dialog.d.ts +0 -17
  262. package/dist/types/src/base/ui/confirmation_dialog.d.ts.map +1 -1
  263. package/dist/types/src/base/ui/control_sizes.d.ts +0 -1
  264. package/dist/types/src/base/ui/control_sizes.d.ts.map +1 -1
  265. package/dist/types/src/base/ui/dialog.d.ts +1 -23
  266. package/dist/types/src/base/ui/dialog.d.ts.map +1 -1
  267. package/dist/types/src/base/ui/dialog_close_button.d.ts +2 -24
  268. package/dist/types/src/base/ui/dialog_close_button.d.ts.map +1 -1
  269. package/dist/types/src/base/ui/field_icon.d.ts +1 -17
  270. package/dist/types/src/base/ui/field_icon.d.ts.map +1 -1
  271. package/dist/types/src/base/ui/field_picker.d.ts +0 -23
  272. package/dist/types/src/base/ui/field_picker.d.ts.map +1 -1
  273. package/dist/types/src/base/ui/field_picker_synced.d.ts.map +1 -1
  274. package/dist/types/src/base/ui/form_field.d.ts +0 -4
  275. package/dist/types/src/base/ui/form_field.d.ts.map +1 -1
  276. package/dist/types/src/base/ui/heading.d.ts +1 -1
  277. package/dist/types/src/base/ui/heading.d.ts.map +1 -1
  278. package/dist/types/src/base/ui/icon.d.ts +0 -16
  279. package/dist/types/src/base/ui/icon.d.ts.map +1 -1
  280. package/dist/types/src/base/ui/icon_config.d.ts +50 -51
  281. package/dist/types/src/base/ui/icon_config.d.ts.map +1 -1
  282. package/dist/types/src/base/ui/initialize_block.d.ts.map +1 -1
  283. package/dist/types/src/base/ui/input.d.ts +12 -46
  284. package/dist/types/src/base/ui/input.d.ts.map +1 -1
  285. package/dist/types/src/base/ui/input_synced.d.ts.map +1 -1
  286. package/dist/types/src/base/ui/label.d.ts.map +1 -1
  287. package/dist/types/src/base/ui/link.d.ts +1 -5
  288. package/dist/types/src/base/ui/link.d.ts.map +1 -1
  289. package/dist/types/src/base/ui/loader.d.ts +3 -20
  290. package/dist/types/src/base/ui/loader.d.ts.map +1 -1
  291. package/dist/types/src/base/ui/modal.d.ts +1 -14
  292. package/dist/types/src/base/ui/modal.d.ts.map +1 -1
  293. package/dist/types/src/base/ui/model_picker_select.d.ts.map +1 -1
  294. package/dist/types/src/base/ui/popover.d.ts +1 -17
  295. package/dist/types/src/base/ui/popover.d.ts.map +1 -1
  296. package/dist/types/src/base/ui/progress_bar.d.ts +1 -24
  297. package/dist/types/src/base/ui/progress_bar.d.ts.map +1 -1
  298. package/dist/types/src/base/ui/record_card.d.ts +1 -23
  299. package/dist/types/src/base/ui/record_card.d.ts.map +1 -1
  300. package/dist/types/src/base/ui/record_card_list.d.ts +1 -18
  301. package/dist/types/src/base/ui/record_card_list.d.ts.map +1 -1
  302. package/dist/types/src/base/ui/select.d.ts +0 -44
  303. package/dist/types/src/base/ui/select.d.ts.map +1 -1
  304. package/dist/types/src/base/ui/select_and_select_buttons_helpers.d.ts +0 -2
  305. package/dist/types/src/base/ui/select_and_select_buttons_helpers.d.ts.map +1 -1
  306. package/dist/types/src/base/ui/select_buttons.d.ts +0 -22
  307. package/dist/types/src/base/ui/select_buttons.d.ts.map +1 -1
  308. package/dist/types/src/base/ui/select_buttons_synced.d.ts.map +1 -1
  309. package/dist/types/src/base/ui/select_synced.d.ts.map +1 -1
  310. package/dist/types/src/base/ui/switch.d.ts +0 -22
  311. package/dist/types/src/base/ui/switch.d.ts.map +1 -1
  312. package/dist/types/src/base/ui/switch_synced.d.ts.map +1 -1
  313. package/dist/types/src/base/ui/synced.d.ts +2 -8
  314. package/dist/types/src/base/ui/synced.d.ts.map +1 -1
  315. package/dist/types/src/base/ui/system/all_styles_set.d.ts +0 -3
  316. package/dist/types/src/base/ui/system/all_styles_set.d.ts.map +1 -1
  317. package/dist/types/src/base/ui/system/appearance/appearance_set.d.ts +0 -1
  318. package/dist/types/src/base/ui/system/appearance/appearance_set.d.ts.map +1 -1
  319. package/dist/types/src/base/ui/system/appearance/background_color.d.ts +0 -1
  320. package/dist/types/src/base/ui/system/appearance/background_color.d.ts.map +1 -1
  321. package/dist/types/src/base/ui/system/appearance/border.d.ts +0 -1
  322. package/dist/types/src/base/ui/system/appearance/border.d.ts.map +1 -1
  323. package/dist/types/src/base/ui/system/appearance/border_radius.d.ts +0 -1
  324. package/dist/types/src/base/ui/system/appearance/border_radius.d.ts.map +1 -1
  325. package/dist/types/src/base/ui/system/appearance/box_shadow.d.ts +0 -1
  326. package/dist/types/src/base/ui/system/appearance/box_shadow.d.ts.map +1 -1
  327. package/dist/types/src/base/ui/system/appearance/opacity.d.ts +0 -1
  328. package/dist/types/src/base/ui/system/appearance/opacity.d.ts.map +1 -1
  329. package/dist/types/src/base/ui/system/dimensions/dimensions_set.d.ts +0 -1
  330. package/dist/types/src/base/ui/system/dimensions/dimensions_set.d.ts.map +1 -1
  331. package/dist/types/src/base/ui/system/dimensions/height.d.ts +0 -1
  332. package/dist/types/src/base/ui/system/dimensions/height.d.ts.map +1 -1
  333. package/dist/types/src/base/ui/system/dimensions/max_height.d.ts +0 -1
  334. package/dist/types/src/base/ui/system/dimensions/max_height.d.ts.map +1 -1
  335. package/dist/types/src/base/ui/system/dimensions/max_width.d.ts +0 -1
  336. package/dist/types/src/base/ui/system/dimensions/max_width.d.ts.map +1 -1
  337. package/dist/types/src/base/ui/system/dimensions/min_height.d.ts +0 -1
  338. package/dist/types/src/base/ui/system/dimensions/min_height.d.ts.map +1 -1
  339. package/dist/types/src/base/ui/system/dimensions/min_width.d.ts +0 -1
  340. package/dist/types/src/base/ui/system/dimensions/min_width.d.ts.map +1 -1
  341. package/dist/types/src/base/ui/system/dimensions/width.d.ts +0 -1
  342. package/dist/types/src/base/ui/system/dimensions/width.d.ts.map +1 -1
  343. package/dist/types/src/base/ui/system/display.d.ts +0 -1
  344. package/dist/types/src/base/ui/system/display.d.ts.map +1 -1
  345. package/dist/types/src/base/ui/system/flex_container/align_content.d.ts +0 -1
  346. package/dist/types/src/base/ui/system/flex_container/align_content.d.ts.map +1 -1
  347. package/dist/types/src/base/ui/system/flex_container/align_items.d.ts +0 -1
  348. package/dist/types/src/base/ui/system/flex_container/align_items.d.ts.map +1 -1
  349. package/dist/types/src/base/ui/system/flex_container/flex_container_set.d.ts +0 -1
  350. package/dist/types/src/base/ui/system/flex_container/flex_container_set.d.ts.map +1 -1
  351. package/dist/types/src/base/ui/system/flex_container/flex_direction.d.ts +0 -1
  352. package/dist/types/src/base/ui/system/flex_container/flex_direction.d.ts.map +1 -1
  353. package/dist/types/src/base/ui/system/flex_container/flex_wrap.d.ts +0 -1
  354. package/dist/types/src/base/ui/system/flex_container/flex_wrap.d.ts.map +1 -1
  355. package/dist/types/src/base/ui/system/flex_container/justify_content.d.ts +0 -1
  356. package/dist/types/src/base/ui/system/flex_container/justify_content.d.ts.map +1 -1
  357. package/dist/types/src/base/ui/system/flex_container/justify_items.d.ts +0 -1
  358. package/dist/types/src/base/ui/system/flex_container/justify_items.d.ts.map +1 -1
  359. package/dist/types/src/base/ui/system/flex_item/align_self.d.ts +0 -1
  360. package/dist/types/src/base/ui/system/flex_item/align_self.d.ts.map +1 -1
  361. package/dist/types/src/base/ui/system/flex_item/flex.d.ts +0 -1
  362. package/dist/types/src/base/ui/system/flex_item/flex.d.ts.map +1 -1
  363. package/dist/types/src/base/ui/system/flex_item/flex_basis.d.ts +0 -1
  364. package/dist/types/src/base/ui/system/flex_item/flex_basis.d.ts.map +1 -1
  365. package/dist/types/src/base/ui/system/flex_item/flex_grow.d.ts +0 -1
  366. package/dist/types/src/base/ui/system/flex_item/flex_grow.d.ts.map +1 -1
  367. package/dist/types/src/base/ui/system/flex_item/flex_item_set.d.ts +0 -1
  368. package/dist/types/src/base/ui/system/flex_item/flex_item_set.d.ts.map +1 -1
  369. package/dist/types/src/base/ui/system/flex_item/flex_shrink.d.ts +0 -1
  370. package/dist/types/src/base/ui/system/flex_item/flex_shrink.d.ts.map +1 -1
  371. package/dist/types/src/base/ui/system/flex_item/justify_self.d.ts +0 -1
  372. package/dist/types/src/base/ui/system/flex_item/justify_self.d.ts.map +1 -1
  373. package/dist/types/src/base/ui/system/flex_item/order.d.ts +0 -1
  374. package/dist/types/src/base/ui/system/flex_item/order.d.ts.map +1 -1
  375. package/dist/types/src/base/ui/system/index.d.ts +52 -52
  376. package/dist/types/src/base/ui/system/index.d.ts.map +1 -1
  377. package/dist/types/src/base/ui/system/overflow.d.ts +0 -1
  378. package/dist/types/src/base/ui/system/overflow.d.ts.map +1 -1
  379. package/dist/types/src/base/ui/system/position/bottom.d.ts +0 -1
  380. package/dist/types/src/base/ui/system/position/bottom.d.ts.map +1 -1
  381. package/dist/types/src/base/ui/system/position/left.d.ts +0 -1
  382. package/dist/types/src/base/ui/system/position/left.d.ts.map +1 -1
  383. package/dist/types/src/base/ui/system/position/position.d.ts +0 -1
  384. package/dist/types/src/base/ui/system/position/position.d.ts.map +1 -1
  385. package/dist/types/src/base/ui/system/position/position_set.d.ts +0 -1
  386. package/dist/types/src/base/ui/system/position/position_set.d.ts.map +1 -1
  387. package/dist/types/src/base/ui/system/position/right.d.ts +0 -1
  388. package/dist/types/src/base/ui/system/position/right.d.ts.map +1 -1
  389. package/dist/types/src/base/ui/system/position/top.d.ts +0 -1
  390. package/dist/types/src/base/ui/system/position/top.d.ts.map +1 -1
  391. package/dist/types/src/base/ui/system/position/z_index.d.ts +0 -1
  392. package/dist/types/src/base/ui/system/position/z_index.d.ts.map +1 -1
  393. package/dist/types/src/base/ui/system/spacing/margin.d.ts +0 -1
  394. package/dist/types/src/base/ui/system/spacing/margin.d.ts.map +1 -1
  395. package/dist/types/src/base/ui/system/spacing/padding.d.ts +0 -1
  396. package/dist/types/src/base/ui/system/spacing/padding.d.ts.map +1 -1
  397. package/dist/types/src/base/ui/system/spacing/spacing_set.d.ts +0 -1
  398. package/dist/types/src/base/ui/system/spacing/spacing_set.d.ts.map +1 -1
  399. package/dist/types/src/base/ui/system/typography/font_family.d.ts +0 -1
  400. package/dist/types/src/base/ui/system/typography/font_family.d.ts.map +1 -1
  401. package/dist/types/src/base/ui/system/typography/font_size.d.ts +0 -1
  402. package/dist/types/src/base/ui/system/typography/font_size.d.ts.map +1 -1
  403. package/dist/types/src/base/ui/system/typography/font_style.d.ts +0 -1
  404. package/dist/types/src/base/ui/system/typography/font_style.d.ts.map +1 -1
  405. package/dist/types/src/base/ui/system/typography/font_weight.d.ts +0 -1
  406. package/dist/types/src/base/ui/system/typography/font_weight.d.ts.map +1 -1
  407. package/dist/types/src/base/ui/system/typography/letter_spacing.d.ts +0 -1
  408. package/dist/types/src/base/ui/system/typography/letter_spacing.d.ts.map +1 -1
  409. package/dist/types/src/base/ui/system/typography/line_height.d.ts +0 -1
  410. package/dist/types/src/base/ui/system/typography/line_height.d.ts.map +1 -1
  411. package/dist/types/src/base/ui/system/typography/text_align.d.ts +0 -1
  412. package/dist/types/src/base/ui/system/typography/text_align.d.ts.map +1 -1
  413. package/dist/types/src/base/ui/system/typography/text_color.d.ts +0 -1
  414. package/dist/types/src/base/ui/system/typography/text_color.d.ts.map +1 -1
  415. package/dist/types/src/base/ui/system/typography/text_decoration.d.ts +0 -1
  416. package/dist/types/src/base/ui/system/typography/text_decoration.d.ts.map +1 -1
  417. package/dist/types/src/base/ui/system/typography/text_transform.d.ts +0 -1
  418. package/dist/types/src/base/ui/system/typography/text_transform.d.ts.map +1 -1
  419. package/dist/types/src/base/ui/system/typography/typography_set.d.ts +0 -1
  420. package/dist/types/src/base/ui/system/typography/typography_set.d.ts.map +1 -1
  421. package/dist/types/src/base/ui/table_picker.d.ts +0 -21
  422. package/dist/types/src/base/ui/table_picker.d.ts.map +1 -1
  423. package/dist/types/src/base/ui/table_picker_synced.d.ts.map +1 -1
  424. package/dist/types/src/base/ui/text.d.ts +0 -3
  425. package/dist/types/src/base/ui/text.d.ts.map +1 -1
  426. package/dist/types/src/base/ui/text_button.d.ts +1 -5
  427. package/dist/types/src/base/ui/text_button.d.ts.map +1 -1
  428. package/dist/types/src/base/ui/theme/default_theme/index.d.ts +1 -1
  429. package/dist/types/src/base/ui/theme/theme_context.d.ts +1 -1
  430. package/dist/types/src/base/ui/theme/use_theme.d.ts +1 -1
  431. package/dist/types/src/base/ui/tooltip.d.ts +0 -16
  432. package/dist/types/src/base/ui/tooltip.d.ts.map +1 -1
  433. package/dist/types/src/base/ui/types/aria_props.d.ts.map +1 -1
  434. package/dist/types/src/base/ui/types/data_attributes_prop.d.ts +0 -4
  435. package/dist/types/src/base/ui/types/data_attributes_prop.d.ts.map +1 -1
  436. package/dist/types/src/base/ui/types/tooltip_anchor_props.d.ts +0 -7
  437. package/dist/types/src/base/ui/types/tooltip_anchor_props.d.ts.map +1 -1
  438. package/dist/types/src/base/ui/ui.d.ts +1 -0
  439. package/dist/types/src/base/ui/ui.d.ts.map +1 -1
  440. package/dist/types/src/base/ui/view_picker.d.ts +0 -23
  441. package/dist/types/src/base/ui/view_picker.d.ts.map +1 -1
  442. package/dist/types/src/base/ui/view_picker_synced.d.ts.map +1 -1
  443. package/dist/types/src/base/ui/viewport_constraint.d.ts +1 -14
  444. package/dist/types/src/base/ui/viewport_constraint.d.ts.map +1 -1
  445. package/dist/types/src/base/unstable_testing_utils.d.ts +1 -1
  446. package/dist/types/src/base/unstable_testing_utils.d.ts.map +1 -1
  447. package/dist/types/src/interface/assert_run_context.d.ts +2 -0
  448. package/dist/types/src/interface/assert_run_context.d.ts.map +1 -0
  449. package/dist/types/src/interface/index.d.ts +1 -6
  450. package/dist/types/src/interface/index.d.ts.map +1 -1
  451. package/dist/types/src/interface/models/models.d.ts +1 -0
  452. package/dist/types/src/interface/models/models.d.ts.map +1 -1
  453. package/dist/types/src/interface/models/mutations.d.ts.map +1 -1
  454. package/dist/types/src/interface/ui/initialize_block.d.ts.map +1 -1
  455. package/dist/types/src/interface/ui/ui.d.ts +1 -0
  456. package/dist/types/src/interface/ui/ui.d.ts.map +1 -1
  457. package/dist/types/src/interface/ui/use_custom_properties.d.ts +1 -1
  458. package/dist/types/src/shared/models/mutations_core.d.ts.map +1 -1
  459. package/dist/types/src/shared/private_utils.d.ts +0 -9
  460. package/dist/types/src/shared/private_utils.d.ts.map +1 -1
  461. package/dist/types/src/shared/ui/global_config_synced_component_helpers.d.ts +0 -2
  462. package/dist/types/src/shared/ui/global_config_synced_component_helpers.d.ts.map +1 -1
  463. package/dist/types/src/shared/ui/loader.d.ts.map +1 -1
  464. package/dist/types/src/shared/ui/with_hooks.d.ts +2 -2
  465. package/dist/types/src/shared/ui/with_hooks.d.ts.map +1 -1
  466. package/dist/types/src/testing/{abstract_mock_airtable_interface.d.ts → base/abstract_mock_airtable_interface.d.ts} +13 -13
  467. package/dist/types/src/testing/base/abstract_mock_airtable_interface.d.ts.map +1 -0
  468. package/dist/types/src/testing/interface/abstract_mock_airtable_interface.d.ts +51 -0
  469. package/dist/types/src/testing/interface/abstract_mock_airtable_interface.d.ts.map +1 -0
  470. package/package.json +13 -13
  471. package/dist/cjs/base/ui/system/utils/create_responsive_prop_type.js +0 -19
  472. package/dist/cjs/base/ui/system/utils/create_style_prop_types.js +0 -24
  473. package/dist/cjs/base/ui/system/utils/enum_prop_type_utils.js +0 -35
  474. package/dist/cjs/testing/abstract_mock_airtable_interface.js +0 -277
  475. package/dist/types/src/base/ui/system/utils/create_responsive_prop_type.d.ts +0 -2
  476. package/dist/types/src/base/ui/system/utils/create_responsive_prop_type.d.ts.map +0 -1
  477. package/dist/types/src/base/ui/system/utils/create_style_prop_types.d.ts +0 -4
  478. package/dist/types/src/base/ui/system/utils/create_style_prop_types.d.ts.map +0 -1
  479. package/dist/types/src/base/ui/system/utils/enum_prop_type_utils.d.ts +0 -21
  480. package/dist/types/src/base/ui/system/utils/enum_prop_type_utils.d.ts.map +0 -1
  481. package/dist/types/src/testing/abstract_mock_airtable_interface.d.ts.map +0 -1
@@ -1,29 +1,13 @@
1
1
  "use strict";
2
2
 
3
- require("core-js/modules/es.symbol.js");
4
- require("core-js/modules/es.symbol.description.js");
5
- require("core-js/modules/es.array.from.js");
6
- require("core-js/modules/es.array.slice.js");
7
- require("core-js/modules/es.regexp.exec.js");
8
- require("core-js/modules/es.regexp.to-string.js");
9
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
10
3
  Object.defineProperty(exports, "__esModule", {
11
4
  value: true
12
5
  });
13
6
  exports.default = void 0;
14
- require("core-js/modules/es.array.concat.js");
15
- require("core-js/modules/es.array.filter.js");
16
- require("core-js/modules/es.array.iterator.js");
17
- require("core-js/modules/es.object.to-string.js");
18
- require("core-js/modules/web.dom-collections.iterator.js");
19
- var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
20
- var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
21
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
22
7
  var _private_utils = require("./private_utils");
23
8
  var _error_utils = require("./error_utils");
24
- function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t.return || t.return(); } finally { if (u) throw o; } } }; }
25
- function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
26
- function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; } /** @module @airtable/blocks/models: Abstract models */ /** */
9
+ /** @module @airtable/blocks/models: Abstract models */ /** */
10
+
27
11
  /**
28
12
  * Abstract superclass for watchable models. All watchable models expose `watch`
29
13
  * and `unwatch` methods that allow consumers to subscribe to changes to that model.
@@ -32,18 +16,24 @@ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length)
32
16
  *
33
17
  * @docsPath models/advanced/Watchable
34
18
  */
35
- var Watchable = /*#__PURE__*/function () {
19
+ class Watchable {
20
+ /** @internal */
21
+ static _className = 'Watchable';
22
+ /** @internal */
23
+ static _isWatchableKey(_key) {
24
+ // Override to return whether `key` is a valid watchable key.
25
+ return false;
26
+ }
27
+ /** @internal */
28
+ _changeCount = 0;
29
+ /** @internal */
30
+ _watchableId = (0, _private_utils.getLocallyUniqueId)();
31
+ /** @internal */
32
+
36
33
  /**
37
34
  * @internal
38
35
  */
39
- function Watchable() {
40
- (0, _classCallCheck2.default)(this, Watchable);
41
- /** @internal */
42
- (0, _defineProperty2.default)(this, "_changeCount", 0);
43
- /** @internal */
44
- (0, _defineProperty2.default)(this, "_watchableId", (0, _private_utils.getLocallyUniqueId)());
45
- /** @internal */
46
- (0, _defineProperty2.default)(this, "_changeWatchersByKey", void 0);
36
+ constructor() {
47
37
  this._changeWatchersByKey = {};
48
38
  }
49
39
  // React integrations (e.g. useSubscription) rely on referential equality (===) to determine
@@ -54,163 +44,107 @@ var Watchable = /*#__PURE__*/function () {
54
44
  /**
55
45
  * @internal
56
46
  */
57
- return (0, _createClass2.default)(Watchable, [{
58
- key: "__getWatchableKey",
59
- value: function __getWatchableKey() {
60
- return "".concat(this._watchableId, " ").concat(this._changeCount);
61
- }
62
- /**
63
- * Helper method to get only the valid watchable keys - or throw if a key is invalid
64
- *
65
- * @param keys
66
- * @internal
67
- */
68
- }, {
69
- key: "_getWatchableValidKeysOrThrow",
70
- value: function _getWatchableValidKeysOrThrow(keys, errorMethodName, shouldWarnInsteadOfThrow) {
71
- var arrayKeys = Array.isArray(keys) ? keys : [keys];
72
- var validKeys = [];
73
- var _iterator = _createForOfIteratorHelper(arrayKeys),
74
- _step;
75
- try {
76
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
77
- var key = _step.value;
78
- if (this.constructor._isWatchableKey(key)) {
79
- validKeys.push(key);
80
- } else {
81
- var className = this.constructor._className;
82
- var errorString = "Invalid key to ".concat(errorMethodName, " for ").concat(className, ": ").concat(key);
83
- if (shouldWarnInsteadOfThrow) {
84
- // eslint-disable-next-line no-console
85
- console.warn(errorString);
86
- } else {
87
- throw (0, _error_utils.spawnError)(errorString);
88
- }
89
- }
90
- }
91
- } catch (err) {
92
- _iterator.e(err);
93
- } finally {
94
- _iterator.f();
95
- }
96
- return validKeys;
97
- }
98
- /**
99
- * Get notified of changes to the model.
100
- *
101
- * Every call to `.watch` should have a matching call to `.unwatch`.
102
- *
103
- * Returns the array of keys that were watched.
104
- *
105
- * @param keys the keys to watch
106
- * @param callback a function to call when those keys change
107
- * @param context an optional context for `this` in `callback`.
108
- */
109
- }, {
110
- key: "watch",
111
- value: function watch(keys, callback, context) {
112
- var validKeys = this._getWatchableValidKeysOrThrow(keys, 'watch');
113
- var _iterator2 = _createForOfIteratorHelper(validKeys),
114
- _step2;
115
- try {
116
- for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
117
- var key = _step2.value;
118
- if (!this._changeWatchersByKey[key]) {
119
- this._changeWatchersByKey[key] = [];
120
- }
121
- // Rather than pushing onto this array, we initialize a new array.
122
- // This is necessary since watches can change as a result of an
123
- // event getting triggered. It would be bad if as we iterate over
124
- // our watchers, new watchers get pushed onto the array that we
125
- // are iterating over.
126
- // TODO(jb): as a perf optimization, we *could* push onto this array
127
- // as long as we are not in the middle of iterating over it.
128
- this._changeWatchersByKey[key] = [...this._changeWatchersByKey[key], {
129
- callback,
130
- context
131
- }];
47
+ __getWatchableKey() {
48
+ return `${this._watchableId} ${this._changeCount}`;
49
+ }
50
+ /**
51
+ * Helper method to get only the valid watchable keys - or throw if a key is invalid
52
+ *
53
+ * @param keys
54
+ * @internal
55
+ */
56
+ _getWatchableValidKeysOrThrow(keys, errorMethodName, shouldWarnInsteadOfThrow) {
57
+ const arrayKeys = Array.isArray(keys) ? keys : [keys];
58
+ const validKeys = [];
59
+ for (const key of arrayKeys) {
60
+ if (this.constructor._isWatchableKey(key)) {
61
+ validKeys.push(key);
62
+ } else {
63
+ const className = this.constructor._className;
64
+ const errorString = `Invalid key to ${errorMethodName} for ${className}: ${key}`;
65
+ if (shouldWarnInsteadOfThrow) {
66
+ // eslint-disable-next-line no-console
67
+ console.warn(errorString);
68
+ } else {
69
+ throw (0, _error_utils.spawnError)(errorString);
132
70
  }
133
- } catch (err) {
134
- _iterator2.e(err);
135
- } finally {
136
- _iterator2.f();
137
71
  }
138
- return validKeys;
139
72
  }
140
- /**
141
- * Unwatch keys watched with `.watch`.
142
- *
143
- * Should be called with the same arguments given to `.watch`.
144
- *
145
- * Returns the array of keys that were unwatched.
146
- *
147
- * @param keys the keys to unwatch
148
- * @param callback the function passed to `.watch` for these keys
149
- * @param context the context that was passed to `.watch` for this `callback`
150
- */
151
- }, {
152
- key: "unwatch",
153
- value: function unwatch(keys, callback, context) {
154
- var validKeys = this._getWatchableValidKeysOrThrow(keys, 'unwatch', true);
155
- var _iterator3 = _createForOfIteratorHelper(validKeys),
156
- _step3;
157
- try {
158
- for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
159
- var key = _step3.value;
160
- var watchers = this._changeWatchersByKey[key];
161
- if (watchers) {
162
- var filteredWatchers = watchers.filter(watcher => {
163
- return watcher.callback !== callback || watcher.context !== context;
164
- });
165
- if (filteredWatchers.length > 0) {
166
- this._changeWatchersByKey[key] = filteredWatchers;
167
- } else {
168
- delete this._changeWatchersByKey[key];
169
- }
170
- }
171
- }
172
- } catch (err) {
173
- _iterator3.e(err);
174
- } finally {
175
- _iterator3.f();
73
+ return validKeys;
74
+ }
75
+ /**
76
+ * Get notified of changes to the model.
77
+ *
78
+ * Every call to `.watch` should have a matching call to `.unwatch`.
79
+ *
80
+ * Returns the array of keys that were watched.
81
+ *
82
+ * @param keys the keys to watch
83
+ * @param callback a function to call when those keys change
84
+ * @param context an optional context for `this` in `callback`.
85
+ */
86
+ watch(keys, callback, context) {
87
+ const validKeys = this._getWatchableValidKeysOrThrow(keys, 'watch');
88
+ for (const key of validKeys) {
89
+ if (!this._changeWatchersByKey[key]) {
90
+ this._changeWatchersByKey[key] = [];
176
91
  }
177
- return validKeys;
92
+ // Rather than pushing onto this array, we initialize a new array.
93
+ // This is necessary since watches can change as a result of an
94
+ // event getting triggered. It would be bad if as we iterate over
95
+ // our watchers, new watchers get pushed onto the array that we
96
+ // are iterating over.
97
+ // TODO(jb): as a perf optimization, we *could* push onto this array
98
+ // as long as we are not in the middle of iterating over it.
99
+ this._changeWatchersByKey[key] = [...this._changeWatchersByKey[key], {
100
+ callback,
101
+ context
102
+ }];
178
103
  }
179
- /**
180
- * @internal
181
- */
182
- }, {
183
- key: "_onChange",
184
- value: function _onChange(key) {
185
- this._changeCount += 1;
186
- var watchers = this._changeWatchersByKey[key];
104
+ return validKeys;
105
+ }
106
+ /**
107
+ * Unwatch keys watched with `.watch`.
108
+ *
109
+ * Should be called with the same arguments given to `.watch`.
110
+ *
111
+ * Returns the array of keys that were unwatched.
112
+ *
113
+ * @param keys the keys to unwatch
114
+ * @param callback the function passed to `.watch` for these keys
115
+ * @param context the context that was passed to `.watch` for this `callback`
116
+ */
117
+ unwatch(keys, callback, context) {
118
+ const validKeys = this._getWatchableValidKeysOrThrow(keys, 'unwatch', true);
119
+ for (const key of validKeys) {
120
+ const watchers = this._changeWatchersByKey[key];
187
121
  if (watchers) {
188
- for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key2 = 1; _key2 < _len; _key2++) {
189
- args[_key2 - 1] = arguments[_key2];
190
- }
191
- var _iterator4 = _createForOfIteratorHelper(watchers),
192
- _step4;
193
- try {
194
- for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
195
- var watcher = _step4.value;
196
- watcher.callback.call(watcher.context, this, key, ...args);
197
- }
198
- } catch (err) {
199
- _iterator4.e(err);
200
- } finally {
201
- _iterator4.f();
122
+ const filteredWatchers = watchers.filter(watcher => {
123
+ return watcher.callback !== callback || watcher.context !== context;
124
+ });
125
+ if (filteredWatchers.length > 0) {
126
+ this._changeWatchersByKey[key] = filteredWatchers;
127
+ } else {
128
+ delete this._changeWatchersByKey[key];
202
129
  }
203
130
  }
204
131
  }
205
- }], [{
206
- key: "_isWatchableKey",
207
- value: /** @internal */
208
- function _isWatchableKey(_key) {
209
- // Override to return whether `key` is a valid watchable key.
210
- return false;
132
+ return validKeys;
133
+ }
134
+ /**
135
+ * @internal
136
+ */
137
+ _onChange(key) {
138
+ this._changeCount += 1;
139
+ const watchers = this._changeWatchersByKey[key];
140
+ if (watchers) {
141
+ for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key2 = 1; _key2 < _len; _key2++) {
142
+ args[_key2 - 1] = arguments[_key2];
143
+ }
144
+ for (const watcher of watchers) {
145
+ watcher.callback.call(watcher.context, this, key, ...args);
146
+ }
211
147
  }
212
- }]);
213
- }();
214
- /** @internal */
215
- (0, _defineProperty2.default)(Watchable, "_className", 'Watchable');
148
+ }
149
+ }
216
150
  var _default = exports.default = Watchable;
@@ -1,96 +1,73 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
3
  Object.defineProperty(exports, "__esModule", {
5
4
  value: true
6
5
  });
7
6
  exports.blockStats = void 0;
8
- var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
9
- var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
10
7
  var _airtable_interface = _interopRequireDefault(require("../injected/airtable_interface"));
8
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
11
9
  // NOTE(richsinn): this client is effectively an implementation of the StatsClient interface
12
10
  // for Datadog. For example, see https://github.com/Hyperbase/hyperbase/blob/development/client_server_shared/stats/stats_client.tsx
11
+
13
12
  /** @hidden */
14
- var BlockStats = /*#__PURE__*/function () {
15
- function BlockStats() {
16
- (0, _classCallCheck2.default)(this, BlockStats);
13
+ class BlockStats {
14
+ increment(stat, tags) {
15
+ this.incrementBy(stat, 1, tags);
16
+ }
17
+ incrementBy(stat, value, tags) {
18
+ (0, _airtable_interface.default)().sendStat({
19
+ metricType: 'incrementBy',
20
+ stat,
21
+ value,
22
+ tags
23
+ });
24
+ }
25
+ decrement(stat, tags) {
26
+ this.decrementBy(stat, 1, tags);
27
+ }
28
+ decrementBy(stat, value, tags) {
29
+ (0, _airtable_interface.default)().sendStat({
30
+ metricType: 'decrementBy',
31
+ stat,
32
+ value,
33
+ tags
34
+ });
35
+ }
36
+ gauge(stat, value, tags) {
37
+ (0, _airtable_interface.default)().sendStat({
38
+ metricType: 'gauge',
39
+ stat,
40
+ value,
41
+ tags
42
+ });
43
+ }
44
+ histogram(stat, value, tags) {
45
+ (0, _airtable_interface.default)().sendStat({
46
+ metricType: 'histogram',
47
+ stat,
48
+ value,
49
+ tags
50
+ });
51
+ }
52
+ distribution(stat, value, tags) {
53
+ (0, _airtable_interface.default)().sendStat({
54
+ metricType: 'distribution',
55
+ stat,
56
+ value,
57
+ tags
58
+ });
59
+ }
60
+ timing(stat, time, tags) {
61
+ (0, _airtable_interface.default)().sendStat({
62
+ metricType: 'timing',
63
+ stat,
64
+ value: time,
65
+ tags
66
+ });
67
+ }
68
+ timingWithSum(stat, time, tags) {
69
+ this.timing(stat, time, tags);
70
+ this.incrementBy(stat + '.sum', time, tags);
17
71
  }
18
- return (0, _createClass2.default)(BlockStats, [{
19
- key: "increment",
20
- value: function increment(stat, tags) {
21
- this.incrementBy(stat, 1, tags);
22
- }
23
- }, {
24
- key: "incrementBy",
25
- value: function incrementBy(stat, value, tags) {
26
- (0, _airtable_interface.default)().sendStat({
27
- metricType: 'incrementBy',
28
- stat,
29
- value,
30
- tags
31
- });
32
- }
33
- }, {
34
- key: "decrement",
35
- value: function decrement(stat, tags) {
36
- this.decrementBy(stat, 1, tags);
37
- }
38
- }, {
39
- key: "decrementBy",
40
- value: function decrementBy(stat, value, tags) {
41
- (0, _airtable_interface.default)().sendStat({
42
- metricType: 'decrementBy',
43
- stat,
44
- value,
45
- tags
46
- });
47
- }
48
- }, {
49
- key: "gauge",
50
- value: function gauge(stat, value, tags) {
51
- (0, _airtable_interface.default)().sendStat({
52
- metricType: 'gauge',
53
- stat,
54
- value,
55
- tags
56
- });
57
- }
58
- }, {
59
- key: "histogram",
60
- value: function histogram(stat, value, tags) {
61
- (0, _airtable_interface.default)().sendStat({
62
- metricType: 'histogram',
63
- stat,
64
- value,
65
- tags
66
- });
67
- }
68
- }, {
69
- key: "distribution",
70
- value: function distribution(stat, value, tags) {
71
- (0, _airtable_interface.default)().sendStat({
72
- metricType: 'distribution',
73
- stat,
74
- value,
75
- tags
76
- });
77
- }
78
- }, {
79
- key: "timing",
80
- value: function timing(stat, time, tags) {
81
- (0, _airtable_interface.default)().sendStat({
82
- metricType: 'timing',
83
- stat,
84
- value: time,
85
- tags
86
- });
87
- }
88
- }, {
89
- key: "timingWithSum",
90
- value: function timingWithSum(stat, time, tags) {
91
- this.timing(stat, time, tags);
92
- this.incrementBy(stat + '.sum', time, tags);
93
- }
94
- }]);
95
- }();
96
- var blockStats = exports.blockStats = new BlockStats();
72
+ }
73
+ const blockStats = exports.blockStats = new BlockStats();
@@ -0,0 +1,208 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.AbstractMockAirtableInterface = void 0;
7
+ var _private_utils = require("../../shared/private_utils");
8
+ var _error_utils = require("../../shared/error_utils");
9
+ // istanbul ignore file
10
+
11
+ const EventEmitter = require('events');
12
+
13
+ /** @internal */
14
+ const aggregators = {
15
+ aggregate(appInterface, summaryFunctionKey, cellValues, fieldData) {
16
+ return null;
17
+ },
18
+ aggregateToString(appInterface, summaryFunctionKey, cellValues, fieldData) {
19
+ return '';
20
+ },
21
+ getAggregatorConfig(summaryFunctionKey) {
22
+ return {
23
+ key: '',
24
+ displayName: '',
25
+ shortDisplayName: ''
26
+ };
27
+ },
28
+ getAllAvailableAggregatorKeys() {
29
+ return [];
30
+ },
31
+ getAvailableAggregatorKeysForField(fieldData) {
32
+ return [];
33
+ }
34
+ };
35
+
36
+ /** @internal */
37
+ const fieldTypeProvider = {
38
+ isComputed(fieldData) {
39
+ return false;
40
+ },
41
+ validateConfigForUpdate: () => {
42
+ return {
43
+ isValid: true
44
+ };
45
+ },
46
+ getConfig: (appInterface, fieldData, fieldNamesById) => {
47
+ return {
48
+ type: fieldData.type,
49
+ options: fieldData.typeOptions
50
+ };
51
+ },
52
+ canBePrimary: () => {
53
+ return true;
54
+ },
55
+ convertStringToCellValue(appInterface, string, fieldData) {
56
+ return '';
57
+ },
58
+ convertCellValueToString(appInterface, cellValue, fieldData) {
59
+ return '';
60
+ },
61
+ getCellRendererData(appInterface, cellValue, fieldData, shouldWrap) {
62
+ return {
63
+ cellValueHtml: `<pre>${JSON.stringify(cellValue)}</pre>`,
64
+ attributes: {}
65
+ };
66
+ },
67
+ validateCellValueForUpdate(appInterface, newCellValue, currentCellValue, fieldData) {
68
+ return {
69
+ isValid: true
70
+ };
71
+ },
72
+ getUiConfig(appInterface, fieldData) {
73
+ return {
74
+ iconName: '',
75
+ desiredCellWidthForRecordCard: 0,
76
+ minimumCellWidthForRecordCard: 0
77
+ };
78
+ }
79
+ };
80
+
81
+ /** @internal */
82
+ const urlConstructor = {
83
+ getTableUrl(tableId) {
84
+ return `https://airtable.test/${tableId}`;
85
+ },
86
+ getViewUrl(viewId, tableId) {
87
+ return `https://airtable.test/${tableId}/${viewId}`;
88
+ },
89
+ getRecordUrl(recordId, tableId) {
90
+ return `https://airtable.test/${tableId}/${recordId}`;
91
+ },
92
+ getAttachmentClientUrl(appInterface, attachmentId, attachmentUrl) {
93
+ return attachmentUrl;
94
+ }
95
+ };
96
+
97
+ /** @internal */
98
+ const globalConfigHelpers = {
99
+ validatePath(path, store) {
100
+ return {
101
+ isValid: true
102
+ };
103
+ },
104
+ validateAndApplyUpdates(updates, store) {
105
+ throw (0, _error_utils.spawnError)('validateAndApplyUpdates unimplemented');
106
+ }
107
+ };
108
+
109
+ /** @internal */
110
+ const idGenerator = {
111
+ generateRecordId: () => 'recGeneratedMockId',
112
+ generateFieldId: () => 'fldGeneratedMockId',
113
+ generateTableId: () => 'tblGeneratedMockId'
114
+ };
115
+
116
+ /**
117
+ * An abstract base class with a common interface exposed to both Blocks SDK's
118
+ * internal automated test suite and the blocks-testing public repo.
119
+ *
120
+ * @hidden
121
+ */
122
+ class AbstractMockAirtableInterface extends EventEmitter {
123
+ constructor(initData) {
124
+ super();
125
+ this._initData = (0, _private_utils.cloneDeep)(initData);
126
+ this.reset();
127
+ }
128
+
129
+ /**
130
+ * Revert the mock interface to its initial state. This includes:
131
+ *
132
+ * - removing all event listeners
133
+ * - restoring the database schema
134
+ */
135
+ reset() {
136
+ this.removeAllListeners();
137
+ this.sdkInitData = (0, _private_utils.cloneDeep)(this._initData);
138
+ }
139
+
140
+ // The following properties are defined using accessors in order to
141
+ // facilitate overriding in subclasses.
142
+ get aggregators() {
143
+ return aggregators;
144
+ }
145
+ get fieldTypeProvider() {
146
+ return fieldTypeProvider;
147
+ }
148
+ get urlConstructor() {
149
+ return urlConstructor;
150
+ }
151
+ get globalConfigHelpers() {
152
+ return globalConfigHelpers;
153
+ }
154
+ get idGenerator() {
155
+ return idGenerator;
156
+ }
157
+ assertAllowedSdkPackageVersion() {}
158
+ applyMutationAsync(mutation, opts) {
159
+ return Promise.resolve();
160
+ }
161
+ checkPermissionsForMutation(mutation) {
162
+ return {
163
+ hasPermission: true
164
+ };
165
+ }
166
+ createVisList(appInterface, recordDatas, fieldDatas, sorts) {
167
+ return {
168
+ removeRecordIds(recordIds) {},
169
+ addRecordData(recordData) {},
170
+ getOrderedRecordIds() {
171
+ return recordDatas.map(_ref => {
172
+ let {
173
+ id
174
+ } = _ref;
175
+ return id;
176
+ });
177
+ }
178
+ };
179
+ }
180
+ subscribeToModelUpdates(fn) {
181
+ this.on('modelupdates', fn);
182
+ }
183
+ setActiveViewOrTable(tableId, viewId) {}
184
+
185
+ // TODO(jugglinmike): Implement
186
+ subscribeToGlobalConfigUpdates() {}
187
+ subscribeToSettingsButtonClick() {}
188
+ subscribeToEnterFullScreen() {}
189
+ subscribeToExitFullScreen() {}
190
+ subscribeToFocus() {}
191
+ triggerModelUpdates(changes) {
192
+ this.emit('modelupdates', {
193
+ changes
194
+ });
195
+ }
196
+
197
+ // TODO(jugglinmike): Implement
198
+ triggerGlobalConfigUpdates() {}
199
+ triggerSettingsButtonClick() {}
200
+ triggerEnterFullScreen() {}
201
+ triggerExitFullScreen() {}
202
+ triggerFocus() {}
203
+ unsubscribeFromCursorData() {}
204
+ unsubscribeFromTableData() {}
205
+ unsubscribeFromCellValuesInFields() {}
206
+ unsubscribeFromViewData() {}
207
+ }
208
+ exports.AbstractMockAirtableInterface = AbstractMockAirtableInterface;