@airtable/blocks 1.18.1 → 1.18.2
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.
- package/CHANGELOG.md +6 -1
- package/dist/cjs/color_utils.js +21 -23
- package/dist/cjs/colors.js +4 -60
- package/dist/cjs/error_utils.js +15 -25
- package/dist/cjs/event_tracker.js +5 -11
- package/dist/cjs/global_config.js +107 -188
- package/dist/cjs/index.js +16 -40
- package/dist/cjs/injected/airtable_interface.js +1 -6
- package/dist/cjs/models/abstract_model.js +50 -81
- package/dist/cjs/models/abstract_model_with_async_data.js +102 -177
- package/dist/cjs/models/base.js +211 -374
- package/dist/cjs/models/create_aggregators.js +53 -47
- package/dist/cjs/models/cursor.js +125 -201
- package/dist/cjs/models/field.js +256 -303
- package/dist/cjs/models/grouped_record_query_result.js +210 -286
- package/dist/cjs/models/linked_records_query_result.js +276 -454
- package/dist/cjs/models/models.js +36 -50
- package/dist/cjs/models/mutation_constants.js +5 -9
- package/dist/cjs/models/mutations.js +125 -338
- package/dist/cjs/models/object_pool.js +37 -94
- package/dist/cjs/models/record.js +132 -226
- package/dist/cjs/models/record_coloring.js +14 -19
- package/dist/cjs/models/record_query_result.js +323 -282
- package/dist/cjs/models/record_store.js +355 -688
- package/dist/cjs/models/session.js +99 -158
- package/dist/cjs/models/table.js +361 -549
- package/dist/cjs/models/table_or_view_query_result.js +410 -765
- package/dist/cjs/models/view.js +161 -204
- package/dist/cjs/models/view_data_store.js +177 -282
- package/dist/cjs/models/view_metadata_query_result.js +96 -127
- package/dist/cjs/perform_record_action.js +69 -103
- package/dist/cjs/private_utils.js +133 -223
- package/dist/cjs/sdk.js +97 -142
- package/dist/cjs/settings_button.js +30 -57
- package/dist/cjs/stats/block_stats.js +3 -15
- package/dist/cjs/testing/abstract_mock_airtable_interface.js +53 -97
- package/dist/cjs/types/airtable_interface.js +36 -8
- package/dist/cjs/types/field.js +66 -12
- package/dist/cjs/types/mutations.js +99 -6
- package/dist/cjs/types/permission_levels.js +2 -4
- package/dist/cjs/types/undo_redo.js +2 -3
- package/dist/cjs/types/view.js +16 -11
- package/dist/cjs/ui/base_provider.js +14 -9
- package/dist/cjs/ui/baymax_utils.js +107 -1102
- package/dist/cjs/ui/block_wrapper.js +30 -68
- package/dist/cjs/ui/box.js +52 -56
- package/dist/cjs/ui/button.js +60 -77
- package/dist/cjs/ui/cell_renderer.js +78 -139
- package/dist/cjs/ui/choice_token.js +45 -47
- package/dist/cjs/ui/collaborator_token.js +33 -54
- package/dist/cjs/ui/color_palette.js +58 -106
- package/dist/cjs/ui/color_palette_synced.js +41 -52
- package/dist/cjs/ui/confirmation_dialog.js +53 -69
- package/dist/cjs/ui/control_sizes.js +21 -46
- package/dist/cjs/ui/create_detect_element_resize.js +16 -50
- package/dist/cjs/ui/css_helpers.js +3 -10
- package/dist/cjs/ui/dialog.js +44 -71
- package/dist/cjs/ui/dialog_close_button.js +52 -72
- package/dist/cjs/ui/expand_record.js +4 -11
- package/dist/cjs/ui/expand_record_list.js +6 -11
- package/dist/cjs/ui/expand_record_picker_async.js +18 -35
- package/dist/cjs/ui/field_icon.js +25 -28
- package/dist/cjs/ui/field_picker.js +47 -81
- package/dist/cjs/ui/field_picker_synced.js +33 -44
- package/dist/cjs/ui/form_field.js +45 -64
- package/dist/cjs/ui/geometry/geometry.js +6 -10
- package/dist/cjs/ui/geometry/point.js +5 -13
- package/dist/cjs/ui/geometry/rect.js +7 -29
- package/dist/cjs/ui/geometry/size.js +5 -13
- package/dist/cjs/ui/global_alert.js +35 -61
- package/dist/cjs/ui/global_config_synced_component_helpers.js +4 -13
- package/dist/cjs/ui/heading.js +63 -92
- package/dist/cjs/ui/icon.js +44 -66
- package/dist/cjs/ui/icon_config.js +13 -24
- package/dist/cjs/ui/initialize_block.js +23 -36
- package/dist/cjs/ui/input.js +74 -87
- package/dist/cjs/ui/input_synced.js +34 -43
- package/dist/cjs/ui/key_codes.js +4 -9
- package/dist/cjs/ui/label.js +45 -50
- package/dist/cjs/ui/link.js +74 -89
- package/dist/cjs/ui/loader.js +26 -42
- package/dist/cjs/ui/modal.js +63 -89
- package/dist/cjs/ui/model_picker_select.js +29 -47
- package/dist/cjs/ui/popover.js +98 -180
- package/dist/cjs/ui/progress_bar.js +45 -51
- package/dist/cjs/ui/record_card.js +143 -278
- package/dist/cjs/ui/record_card_list.js +117 -165
- package/dist/cjs/ui/remote_utils.js +5 -13
- package/dist/cjs/ui/sdk_context.js +7 -9
- package/dist/cjs/ui/select.js +84 -118
- package/dist/cjs/ui/select_and_select_buttons_helpers.js +27 -45
- package/dist/cjs/ui/select_buttons.js +54 -90
- package/dist/cjs/ui/select_buttons_synced.js +32 -41
- package/dist/cjs/ui/select_synced.js +32 -42
- package/dist/cjs/ui/switch.js +66 -84
- package/dist/cjs/ui/switch_synced.js +32 -38
- package/dist/cjs/ui/synced.js +16 -43
- package/dist/cjs/ui/system/all_styles_set.js +89 -22
- package/dist/cjs/ui/system/appearance/appearance_set.js +15 -26
- package/dist/cjs/ui/system/appearance/background_color.js +6 -12
- package/dist/cjs/ui/system/appearance/border.js +6 -12
- package/dist/cjs/ui/system/appearance/border_radius.js +6 -12
- package/dist/cjs/ui/system/appearance/box_shadow.js +6 -12
- package/dist/cjs/ui/system/appearance/opacity.js +5 -11
- package/dist/cjs/ui/system/dimensions/dimensions_set.js +15 -27
- package/dist/cjs/ui/system/dimensions/height.js +5 -11
- package/dist/cjs/ui/system/dimensions/max_height.js +5 -11
- package/dist/cjs/ui/system/dimensions/max_width.js +5 -11
- package/dist/cjs/ui/system/dimensions/min_height.js +5 -11
- package/dist/cjs/ui/system/dimensions/min_width.js +5 -11
- package/dist/cjs/ui/system/dimensions/width.js +5 -11
- package/dist/cjs/ui/system/display.js +8 -9
- package/dist/cjs/ui/system/flex_container/align_content.js +6 -12
- package/dist/cjs/ui/system/flex_container/align_items.js +6 -12
- package/dist/cjs/ui/system/flex_container/flex_container_set.js +15 -27
- package/dist/cjs/ui/system/flex_container/flex_direction.js +5 -11
- package/dist/cjs/ui/system/flex_container/flex_wrap.js +5 -11
- package/dist/cjs/ui/system/flex_container/justify_content.js +5 -11
- package/dist/cjs/ui/system/flex_container/justify_items.js +5 -11
- package/dist/cjs/ui/system/flex_item/align_self.js +6 -12
- package/dist/cjs/ui/system/flex_item/flex.js +5 -11
- package/dist/cjs/ui/system/flex_item/flex_basis.js +5 -11
- package/dist/cjs/ui/system/flex_item/flex_grow.js +5 -11
- package/dist/cjs/ui/system/flex_item/flex_item_set.js +15 -28
- package/dist/cjs/ui/system/flex_item/flex_shrink.js +5 -11
- package/dist/cjs/ui/system/flex_item/justify_self.js +5 -11
- package/dist/cjs/ui/system/flex_item/order.js +5 -11
- package/dist/cjs/ui/system/index.js +310 -362
- package/dist/cjs/ui/system/overflow.js +8 -9
- package/dist/cjs/ui/system/position/bottom.js +6 -13
- package/dist/cjs/ui/system/position/left.js +5 -12
- package/dist/cjs/ui/system/position/position.js +5 -11
- package/dist/cjs/ui/system/position/position_set.js +15 -27
- package/dist/cjs/ui/system/position/right.js +5 -12
- package/dist/cjs/ui/system/position/top.js +5 -12
- package/dist/cjs/ui/system/position/z_index.js +5 -11
- package/dist/cjs/ui/system/spacing/margin.js +5 -12
- package/dist/cjs/ui/system/spacing/padding.js +5 -12
- package/dist/cjs/ui/system/spacing/spacing_set.js +15 -23
- package/dist/cjs/ui/system/typography/font_family.js +5 -11
- package/dist/cjs/ui/system/typography/font_size.js +5 -11
- package/dist/cjs/ui/system/typography/font_style.js +5 -11
- package/dist/cjs/ui/system/typography/font_weight.js +5 -11
- package/dist/cjs/ui/system/typography/letter_spacing.js +5 -11
- package/dist/cjs/ui/system/typography/line_height.js +5 -11
- package/dist/cjs/ui/system/typography/text_align.js +5 -11
- package/dist/cjs/ui/system/typography/text_color.js +5 -11
- package/dist/cjs/ui/system/typography/text_decoration.js +5 -11
- package/dist/cjs/ui/system/typography/text_transform.js +5 -11
- package/dist/cjs/ui/system/typography/typography_set.js +15 -31
- package/dist/cjs/ui/system/utils/create_responsive_prop_type.js +2 -4
- package/dist/cjs/ui/system/utils/create_style_prop_types.js +5 -13
- package/dist/cjs/ui/system/utils/ensure_numbers_are_within_scale.js +2 -14
- package/dist/cjs/ui/system/utils/get_style_props_for_responsive_prop.js +30 -70
- package/dist/cjs/ui/table_picker.js +26 -43
- package/dist/cjs/ui/table_picker_synced.js +33 -42
- package/dist/cjs/ui/text.js +59 -71
- package/dist/cjs/ui/text_button.js +80 -97
- package/dist/cjs/ui/theme/default_theme/button_variants.js +1 -5
- package/dist/cjs/ui/theme/default_theme/control_sizes.js +29 -42
- package/dist/cjs/ui/theme/default_theme/heading_styles.js +4 -5
- package/dist/cjs/ui/theme/default_theme/index.js +15 -32
- package/dist/cjs/ui/theme/default_theme/input_variants.js +1 -5
- package/dist/cjs/ui/theme/default_theme/link_variants.js +1 -5
- package/dist/cjs/ui/theme/default_theme/select_buttons_variants.js +1 -5
- package/dist/cjs/ui/theme/default_theme/select_variants.js +10 -21
- package/dist/cjs/ui/theme/default_theme/switch_variants.js +8 -20
- package/dist/cjs/ui/theme/default_theme/text_button_variants.js +1 -5
- package/dist/cjs/ui/theme/default_theme/text_styles.js +1 -2
- package/dist/cjs/ui/theme/default_theme/tokens.js +33 -35
- package/dist/cjs/ui/theme/theme_context.js +3 -6
- package/dist/cjs/ui/theme/use_theme.js +1 -7
- package/dist/cjs/ui/tooltip.js +38 -79
- package/dist/cjs/ui/types/aria_props.js +3 -7
- package/dist/cjs/ui/types/data_attributes_prop.js +8 -6
- package/dist/cjs/ui/types/tooltip_anchor_props.js +4 -5
- package/dist/cjs/ui/ui.js +89 -130
- package/dist/cjs/ui/unstable_standalone_ui.js +18 -42
- package/dist/cjs/ui/use_array_identity.js +0 -4
- package/dist/cjs/ui/use_base.js +4 -13
- package/dist/cjs/ui/use_cursor.js +3 -12
- package/dist/cjs/ui/use_form_field.js +4 -6
- package/dist/cjs/ui/use_global_config.js +3 -10
- package/dist/cjs/ui/use_loadable.js +59 -132
- package/dist/cjs/ui/use_record_action_data.js +6 -12
- package/dist/cjs/ui/use_records.js +23 -24
- package/dist/cjs/ui/use_session.js +6 -15
- package/dist/cjs/ui/use_settings_button.js +4 -11
- package/dist/cjs/ui/use_styled_system.js +12 -21
- package/dist/cjs/ui/use_synced.js +0 -7
- package/dist/cjs/ui/use_text_color_for_background_color.js +1 -5
- package/dist/cjs/ui/use_view_metadata.js +5 -8
- package/dist/cjs/ui/use_viewport.js +1 -7
- package/dist/cjs/ui/use_watchable.js +36 -74
- package/dist/cjs/ui/view_picker.js +44 -78
- package/dist/cjs/ui/view_picker_synced.js +33 -44
- package/dist/cjs/ui/viewport_constraint.js +37 -64
- package/dist/cjs/ui/with_hooks.js +17 -22
- package/dist/cjs/ui/with_styled_system.js +33 -60
- package/dist/cjs/undo_redo.js +12 -32
- package/dist/cjs/unstable_private_utils.js +6 -8
- package/dist/cjs/unstable_testing_utils.js +44 -57
- package/dist/cjs/viewport.js +127 -189
- package/dist/cjs/warning.js +5 -6
- package/dist/cjs/watchable.js +66 -148
- package/dist/types/src/colors.d.ts +1 -1
- package/dist/types/src/colors.d.ts.map +1 -1
- package/dist/types/src/global_config.d.ts +1 -1
- package/dist/types/src/global_config.d.ts.map +1 -1
- package/dist/types/src/models/base.d.ts +1 -1
- package/dist/types/src/models/base.d.ts.map +1 -1
- package/dist/types/src/models/cursor.d.ts +1 -1
- package/dist/types/src/models/cursor.d.ts.map +1 -1
- package/dist/types/src/models/field.d.ts +1 -1
- package/dist/types/src/models/field.d.ts.map +1 -1
- package/dist/types/src/models/linked_records_query_result.d.ts.map +1 -1
- package/dist/types/src/models/models.d.ts.map +1 -1
- package/dist/types/src/models/record.d.ts +1 -1
- package/dist/types/src/models/record.d.ts.map +1 -1
- package/dist/types/src/models/record_coloring.d.ts +2 -2
- package/dist/types/src/models/record_coloring.d.ts.map +1 -1
- package/dist/types/src/models/record_query_result.d.ts +3 -3
- package/dist/types/src/models/record_query_result.d.ts.map +1 -1
- package/dist/types/src/models/session.d.ts +1 -1
- package/dist/types/src/models/session.d.ts.map +1 -1
- package/dist/types/src/models/table.d.ts +1 -1
- package/dist/types/src/models/table.d.ts.map +1 -1
- package/dist/types/src/models/view.d.ts +1 -1
- package/dist/types/src/models/view.d.ts.map +1 -1
- package/dist/types/src/models/view_metadata_query_result.d.ts +2 -2
- package/dist/types/src/models/view_metadata_query_result.d.ts.map +1 -1
- package/dist/types/src/perform_record_action.d.ts +1 -1
- package/dist/types/src/perform_record_action.d.ts.map +1 -1
- package/dist/types/src/private_utils.d.ts +8 -8
- package/dist/types/src/private_utils.d.ts.map +1 -1
- package/dist/types/src/sdk.d.ts +1 -1
- package/dist/types/src/sdk.d.ts.map +1 -1
- package/dist/types/src/settings_button.d.ts +1 -1
- package/dist/types/src/settings_button.d.ts.map +1 -1
- package/dist/types/src/types/aggregators.d.ts +1 -1
- package/dist/types/src/types/aggregators.d.ts.map +1 -1
- package/dist/types/src/types/airtable_interface.d.ts +6 -6
- package/dist/types/src/types/airtable_interface.d.ts.map +1 -1
- package/dist/types/src/types/attachment.d.ts +1 -1
- package/dist/types/src/types/attachment.d.ts.map +1 -1
- package/dist/types/src/types/base.d.ts +1 -1
- package/dist/types/src/types/base.d.ts.map +1 -1
- package/dist/types/src/types/block.d.ts +1 -1
- package/dist/types/src/types/block.d.ts.map +1 -1
- package/dist/types/src/types/collaborator.d.ts +1 -1
- package/dist/types/src/types/collaborator.d.ts.map +1 -1
- package/dist/types/src/types/field.d.ts +5 -5
- package/dist/types/src/types/field.d.ts.map +1 -1
- package/dist/types/src/types/global_config.d.ts +6 -6
- package/dist/types/src/types/global_config.d.ts.map +1 -1
- package/dist/types/src/types/mutations.d.ts +4 -4
- package/dist/types/src/types/mutations.d.ts.map +1 -1
- package/dist/types/src/types/permission_levels.d.ts +1 -1
- package/dist/types/src/types/permission_levels.d.ts.map +1 -1
- package/dist/types/src/types/record.d.ts +2 -2
- package/dist/types/src/types/record.d.ts.map +1 -1
- package/dist/types/src/types/record_action_data.d.ts +1 -1
- package/dist/types/src/types/record_action_data.d.ts.map +1 -1
- package/dist/types/src/types/table.d.ts +3 -3
- package/dist/types/src/types/table.d.ts.map +1 -1
- package/dist/types/src/types/undo_redo.d.ts +1 -1
- package/dist/types/src/types/undo_redo.d.ts.map +1 -1
- package/dist/types/src/types/view.d.ts +4 -4
- package/dist/types/src/types/view.d.ts.map +1 -1
- package/dist/types/src/ui/base_provider.d.ts +1 -1
- package/dist/types/src/ui/base_provider.d.ts.map +1 -1
- package/dist/types/src/ui/block_wrapper.d.ts +2 -2
- package/dist/types/src/ui/button.d.ts +1 -1
- package/dist/types/src/ui/button.d.ts.map +1 -1
- package/dist/types/src/ui/cell_renderer.d.ts +2 -2
- package/dist/types/src/ui/choice_token.d.ts +3 -3
- package/dist/types/src/ui/choice_token.d.ts.map +1 -1
- package/dist/types/src/ui/collaborator_token.d.ts +5 -5
- package/dist/types/src/ui/collaborator_token.d.ts.map +1 -1
- package/dist/types/src/ui/color_palette.d.ts +2 -2
- package/dist/types/src/ui/color_palette_synced.d.ts +2 -2
- package/dist/types/src/ui/confirmation_dialog.d.ts +1 -1
- package/dist/types/src/ui/control_sizes.d.ts +2 -2
- package/dist/types/src/ui/control_sizes.d.ts.map +1 -1
- package/dist/types/src/ui/dialog.d.ts +2 -2
- package/dist/types/src/ui/dialog.d.ts.map +1 -1
- package/dist/types/src/ui/dialog_close_button.d.ts +1 -1
- package/dist/types/src/ui/field_icon.d.ts +3 -3
- package/dist/types/src/ui/field_icon.d.ts.map +1 -1
- package/dist/types/src/ui/field_picker.d.ts +1 -1
- package/dist/types/src/ui/global_alert.d.ts +1 -1
- package/dist/types/src/ui/global_alert.d.ts.map +1 -1
- package/dist/types/src/ui/global_config_synced_component_helpers.d.ts +1 -1
- package/dist/types/src/ui/global_config_synced_component_helpers.d.ts.map +1 -1
- package/dist/types/src/ui/heading.d.ts +3 -3
- package/dist/types/src/ui/heading.d.ts.map +1 -1
- package/dist/types/src/ui/icon.d.ts +1 -1
- package/dist/types/src/ui/icon_config.d.ts +39 -39
- package/dist/types/src/ui/icon_config.d.ts.map +1 -1
- package/dist/types/src/ui/initialize_block.d.ts +3 -3
- package/dist/types/src/ui/initialize_block.d.ts.map +1 -1
- package/dist/types/src/ui/input.d.ts +15 -15
- package/dist/types/src/ui/input.d.ts.map +1 -1
- package/dist/types/src/ui/link.d.ts +1 -1
- package/dist/types/src/ui/link.d.ts.map +1 -1
- package/dist/types/src/ui/loader.d.ts +1 -1
- package/dist/types/src/ui/loader.d.ts.map +1 -1
- package/dist/types/src/ui/model_picker_select.d.ts +1 -1
- package/dist/types/src/ui/model_picker_select.d.ts.map +1 -1
- package/dist/types/src/ui/popover.d.ts +5 -5
- package/dist/types/src/ui/popover.d.ts.map +1 -1
- package/dist/types/src/ui/progress_bar.d.ts +1 -1
- package/dist/types/src/ui/progress_bar.d.ts.map +1 -1
- package/dist/types/src/ui/record_card.d.ts +2 -2
- package/dist/types/src/ui/record_card.d.ts.map +1 -1
- package/dist/types/src/ui/record_card_list.d.ts +1 -1
- package/dist/types/src/ui/select.d.ts +4 -4
- package/dist/types/src/ui/select_and_select_buttons_helpers.d.ts +4 -4
- package/dist/types/src/ui/select_and_select_buttons_helpers.d.ts.map +1 -1
- package/dist/types/src/ui/select_buttons.d.ts +4 -4
- package/dist/types/src/ui/switch.d.ts +1 -1
- package/dist/types/src/ui/switch.d.ts.map +1 -1
- package/dist/types/src/ui/synced.d.ts +3 -3
- package/dist/types/src/ui/system/all_styles_set.d.ts +0 -1
- package/dist/types/src/ui/system/all_styles_set.d.ts.map +1 -1
- package/dist/types/src/ui/system/appearance/appearance_set.d.ts +0 -1
- package/dist/types/src/ui/system/appearance/appearance_set.d.ts.map +1 -1
- package/dist/types/src/ui/system/appearance/background_color.d.ts +0 -1
- package/dist/types/src/ui/system/appearance/background_color.d.ts.map +1 -1
- package/dist/types/src/ui/system/appearance/border.d.ts +0 -1
- package/dist/types/src/ui/system/appearance/border.d.ts.map +1 -1
- package/dist/types/src/ui/system/appearance/border_radius.d.ts +0 -1
- package/dist/types/src/ui/system/appearance/border_radius.d.ts.map +1 -1
- package/dist/types/src/ui/system/appearance/box_shadow.d.ts +0 -1
- package/dist/types/src/ui/system/appearance/box_shadow.d.ts.map +1 -1
- package/dist/types/src/ui/system/appearance/opacity.d.ts +0 -1
- package/dist/types/src/ui/system/appearance/opacity.d.ts.map +1 -1
- package/dist/types/src/ui/system/dimensions/dimensions_set.d.ts +0 -1
- package/dist/types/src/ui/system/dimensions/dimensions_set.d.ts.map +1 -1
- package/dist/types/src/ui/system/dimensions/height.d.ts +0 -1
- package/dist/types/src/ui/system/dimensions/height.d.ts.map +1 -1
- package/dist/types/src/ui/system/dimensions/max_height.d.ts +0 -1
- package/dist/types/src/ui/system/dimensions/max_height.d.ts.map +1 -1
- package/dist/types/src/ui/system/dimensions/max_width.d.ts +0 -1
- package/dist/types/src/ui/system/dimensions/max_width.d.ts.map +1 -1
- package/dist/types/src/ui/system/dimensions/min_height.d.ts +0 -1
- package/dist/types/src/ui/system/dimensions/min_height.d.ts.map +1 -1
- package/dist/types/src/ui/system/dimensions/min_width.d.ts +0 -1
- package/dist/types/src/ui/system/dimensions/min_width.d.ts.map +1 -1
- package/dist/types/src/ui/system/dimensions/width.d.ts +0 -1
- package/dist/types/src/ui/system/dimensions/width.d.ts.map +1 -1
- package/dist/types/src/ui/system/display.d.ts +0 -1
- package/dist/types/src/ui/system/display.d.ts.map +1 -1
- package/dist/types/src/ui/system/flex_container/align_content.d.ts +0 -1
- package/dist/types/src/ui/system/flex_container/align_content.d.ts.map +1 -1
- package/dist/types/src/ui/system/flex_container/align_items.d.ts +0 -1
- package/dist/types/src/ui/system/flex_container/align_items.d.ts.map +1 -1
- package/dist/types/src/ui/system/flex_container/flex_container_set.d.ts +0 -1
- package/dist/types/src/ui/system/flex_container/flex_container_set.d.ts.map +1 -1
- package/dist/types/src/ui/system/flex_container/flex_direction.d.ts +0 -1
- package/dist/types/src/ui/system/flex_container/flex_direction.d.ts.map +1 -1
- package/dist/types/src/ui/system/flex_container/flex_wrap.d.ts +0 -1
- package/dist/types/src/ui/system/flex_container/flex_wrap.d.ts.map +1 -1
- package/dist/types/src/ui/system/flex_container/justify_content.d.ts +0 -1
- package/dist/types/src/ui/system/flex_container/justify_content.d.ts.map +1 -1
- package/dist/types/src/ui/system/flex_container/justify_items.d.ts +0 -1
- package/dist/types/src/ui/system/flex_container/justify_items.d.ts.map +1 -1
- package/dist/types/src/ui/system/flex_item/align_self.d.ts +0 -1
- package/dist/types/src/ui/system/flex_item/align_self.d.ts.map +1 -1
- package/dist/types/src/ui/system/flex_item/flex.d.ts +0 -1
- package/dist/types/src/ui/system/flex_item/flex.d.ts.map +1 -1
- package/dist/types/src/ui/system/flex_item/flex_basis.d.ts +0 -1
- package/dist/types/src/ui/system/flex_item/flex_basis.d.ts.map +1 -1
- package/dist/types/src/ui/system/flex_item/flex_grow.d.ts +0 -1
- package/dist/types/src/ui/system/flex_item/flex_grow.d.ts.map +1 -1
- package/dist/types/src/ui/system/flex_item/flex_item_set.d.ts +0 -1
- package/dist/types/src/ui/system/flex_item/flex_item_set.d.ts.map +1 -1
- package/dist/types/src/ui/system/flex_item/flex_shrink.d.ts +0 -1
- package/dist/types/src/ui/system/flex_item/flex_shrink.d.ts.map +1 -1
- package/dist/types/src/ui/system/flex_item/justify_self.d.ts +0 -1
- package/dist/types/src/ui/system/flex_item/justify_self.d.ts.map +1 -1
- package/dist/types/src/ui/system/flex_item/order.d.ts +0 -1
- package/dist/types/src/ui/system/flex_item/order.d.ts.map +1 -1
- package/dist/types/src/ui/system/overflow.d.ts +0 -1
- package/dist/types/src/ui/system/overflow.d.ts.map +1 -1
- package/dist/types/src/ui/system/position/bottom.d.ts +0 -1
- package/dist/types/src/ui/system/position/bottom.d.ts.map +1 -1
- package/dist/types/src/ui/system/position/left.d.ts +0 -1
- package/dist/types/src/ui/system/position/left.d.ts.map +1 -1
- package/dist/types/src/ui/system/position/position.d.ts +0 -1
- package/dist/types/src/ui/system/position/position.d.ts.map +1 -1
- package/dist/types/src/ui/system/position/position_set.d.ts +0 -1
- package/dist/types/src/ui/system/position/position_set.d.ts.map +1 -1
- package/dist/types/src/ui/system/position/right.d.ts +0 -1
- package/dist/types/src/ui/system/position/right.d.ts.map +1 -1
- package/dist/types/src/ui/system/position/top.d.ts +0 -1
- package/dist/types/src/ui/system/position/top.d.ts.map +1 -1
- package/dist/types/src/ui/system/position/z_index.d.ts +0 -1
- package/dist/types/src/ui/system/position/z_index.d.ts.map +1 -1
- package/dist/types/src/ui/system/spacing/margin.d.ts +0 -1
- package/dist/types/src/ui/system/spacing/margin.d.ts.map +1 -1
- package/dist/types/src/ui/system/spacing/padding.d.ts +0 -1
- package/dist/types/src/ui/system/spacing/padding.d.ts.map +1 -1
- package/dist/types/src/ui/system/spacing/spacing_set.d.ts +0 -1
- package/dist/types/src/ui/system/spacing/spacing_set.d.ts.map +1 -1
- package/dist/types/src/ui/system/typography/font_family.d.ts +0 -1
- package/dist/types/src/ui/system/typography/font_family.d.ts.map +1 -1
- package/dist/types/src/ui/system/typography/font_size.d.ts +0 -1
- package/dist/types/src/ui/system/typography/font_size.d.ts.map +1 -1
- package/dist/types/src/ui/system/typography/font_style.d.ts +0 -1
- package/dist/types/src/ui/system/typography/font_style.d.ts.map +1 -1
- package/dist/types/src/ui/system/typography/font_weight.d.ts +0 -1
- package/dist/types/src/ui/system/typography/font_weight.d.ts.map +1 -1
- package/dist/types/src/ui/system/typography/letter_spacing.d.ts +0 -1
- package/dist/types/src/ui/system/typography/letter_spacing.d.ts.map +1 -1
- package/dist/types/src/ui/system/typography/line_height.d.ts +0 -1
- package/dist/types/src/ui/system/typography/line_height.d.ts.map +1 -1
- package/dist/types/src/ui/system/typography/text_align.d.ts +0 -1
- package/dist/types/src/ui/system/typography/text_align.d.ts.map +1 -1
- package/dist/types/src/ui/system/typography/text_color.d.ts +0 -1
- package/dist/types/src/ui/system/typography/text_color.d.ts.map +1 -1
- package/dist/types/src/ui/system/typography/text_decoration.d.ts +0 -1
- package/dist/types/src/ui/system/typography/text_decoration.d.ts.map +1 -1
- package/dist/types/src/ui/system/typography/text_transform.d.ts +0 -1
- package/dist/types/src/ui/system/typography/text_transform.d.ts.map +1 -1
- package/dist/types/src/ui/system/typography/typography_set.d.ts +0 -1
- package/dist/types/src/ui/system/typography/typography_set.d.ts.map +1 -1
- package/dist/types/src/ui/system/utils/create_style_prop_types.d.ts +1 -1
- package/dist/types/src/ui/system/utils/create_style_prop_types.d.ts.map +1 -1
- package/dist/types/src/ui/system/utils/csstype.d.ts +578 -578
- package/dist/types/src/ui/system/utils/csstype.d.ts.map +1 -1
- package/dist/types/src/ui/system/utils/types.d.ts +4 -4
- package/dist/types/src/ui/system/utils/types.d.ts.map +1 -1
- package/dist/types/src/ui/text.d.ts +3 -3
- package/dist/types/src/ui/text.d.ts.map +1 -1
- package/dist/types/src/ui/text_button.d.ts +1 -1
- package/dist/types/src/ui/text_button.d.ts.map +1 -1
- package/dist/types/src/ui/theme/default_theme/heading_styles.d.ts +2 -2
- package/dist/types/src/ui/theme/default_theme/heading_styles.d.ts.map +1 -1
- package/dist/types/src/ui/theme/default_theme/index.d.ts +1 -1
- package/dist/types/src/ui/theme/theme_context.d.ts +1 -3
- package/dist/types/src/ui/theme/theme_context.d.ts.map +1 -1
- package/dist/types/src/ui/theme/use_theme.d.ts +1 -1
- package/dist/types/src/ui/tooltip.d.ts +3 -3
- package/dist/types/src/ui/types/data_attributes_prop.d.ts.map +1 -1
- package/dist/types/src/ui/types/tooltip_anchor_props.d.ts +0 -1
- package/dist/types/src/ui/types/tooltip_anchor_props.d.ts.map +1 -1
- package/dist/types/src/ui/use_base.d.ts.map +1 -1
- package/dist/types/src/ui/use_cursor.d.ts.map +1 -1
- package/dist/types/src/ui/use_form_field.d.ts +0 -2
- package/dist/types/src/ui/use_form_field.d.ts.map +1 -1
- package/dist/types/src/ui/use_records.d.ts +2 -2
- package/dist/types/src/ui/use_records.d.ts.map +1 -1
- package/dist/types/src/ui/use_session.d.ts.map +1 -1
- package/dist/types/src/ui/view_picker.d.ts +2 -2
- package/dist/types/src/ui/view_picker.d.ts.map +1 -1
- package/dist/types/src/ui/viewport_constraint.d.ts +3 -3
- package/dist/types/src/ui/viewport_constraint.d.ts.map +1 -1
- package/dist/types/src/viewport.d.ts +2 -2
- package/dist/types/src/viewport.d.ts.map +1 -1
- package/dist/types/src/warning.d.ts +1 -1
- package/dist/types/src/warning.d.ts.map +1 -1
- package/dist/types/stories/helpers/code_block.d.ts +2 -2
- package/dist/types/stories/helpers/code_block.d.ts.map +1 -1
- package/dist/types/stories/helpers/example.d.ts +5 -5
- package/dist/types/stories/helpers/example.d.ts.map +1 -1
- package/dist/types/stories/helpers/example_code_panel.d.ts +2 -2
- package/dist/types/stories/helpers/example_code_panel.d.ts.map +1 -1
- package/dist/types/stories/helpers/fake_cell_renderer.d.ts +2 -2
- package/dist/types/stories/helpers/fake_cell_renderer.d.ts.map +1 -1
- package/dist/types/stories/helpers/fake_foreign_record.d.ts +1 -1
- package/dist/types/stories/helpers/fake_foreign_record.d.ts.map +1 -1
- package/dist/types/stories/helpers/fake_record_card.d.ts +2 -2
- package/dist/types/stories/helpers/fake_record_card.d.ts.map +1 -1
- package/dist/types/stories/helpers/style_prop_list.d.ts +2 -2
- package/dist/types/stories/helpers/style_prop_list.d.ts.map +1 -1
- package/dist/types/stories/icon_example.d.ts +2 -2
- package/dist/types/stories/icon_example.d.ts.map +1 -1
- package/dist/types/test/airtable_interface_mocks/mock_airtable_interface.d.ts +0 -1
- package/dist/types/test/airtable_interface_mocks/mock_airtable_interface.d.ts.map +1 -1
- package/package.json +26 -25
package/dist/cjs/viewport.js
CHANGED
|
@@ -1,57 +1,37 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
|
-
require("core-js/modules/es.array.from");
|
|
6
|
-
|
|
7
|
-
require("core-js/modules/es.array.includes");
|
|
8
|
-
|
|
9
|
-
require("core-js/modules/es.array.iterator");
|
|
10
|
-
|
|
11
|
-
require("core-js/modules/es.object.to-string");
|
|
12
|
-
|
|
13
|
-
require("core-js/modules/es.set");
|
|
14
|
-
|
|
15
|
-
require("core-js/modules/es.string.includes");
|
|
16
|
-
|
|
17
|
-
require("core-js/modules/web.dom-collections.iterator");
|
|
18
|
-
|
|
19
4
|
Object.defineProperty(exports, "__esModule", {
|
|
20
5
|
value: true
|
|
21
6
|
});
|
|
22
7
|
exports.default = void 0;
|
|
23
|
-
|
|
8
|
+
require("core-js/modules/es.array.from.js");
|
|
9
|
+
require("core-js/modules/es.array.includes.js");
|
|
10
|
+
require("core-js/modules/es.array.iterator.js");
|
|
11
|
+
require("core-js/modules/es.array.reduce.js");
|
|
12
|
+
require("core-js/modules/es.object.to-string.js");
|
|
13
|
+
require("core-js/modules/es.set.js");
|
|
14
|
+
require("core-js/modules/es.string.includes.js");
|
|
15
|
+
require("core-js/modules/web.dom-collections.iterator.js");
|
|
24
16
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
25
|
-
|
|
17
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
26
18
|
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
27
|
-
|
|
28
|
-
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
|
|
29
|
-
|
|
30
|
-
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
31
|
-
|
|
32
19
|
var _get2 = _interopRequireDefault(require("@babel/runtime/helpers/get"));
|
|
33
|
-
|
|
34
|
-
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
35
|
-
|
|
20
|
+
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
36
21
|
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
37
|
-
|
|
38
22
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
39
|
-
|
|
40
23
|
var _watchable = _interopRequireDefault(require("./watchable"));
|
|
41
|
-
|
|
42
24
|
var _private_utils = require("./private_utils");
|
|
43
|
-
|
|
44
25
|
var _error_utils = require("./error_utils");
|
|
45
|
-
|
|
46
|
-
/** @module @airtable/blocks: viewport */
|
|
47
|
-
|
|
48
|
-
/** */
|
|
26
|
+
function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2.default)(o), (0, _possibleConstructorReturn2.default)(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], (0, _getPrototypeOf2.default)(t).constructor) : o.apply(t, e)); }
|
|
27
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } /** @module @airtable/blocks: viewport */ /** */
|
|
49
28
|
var WatchableViewportKeys = Object.freeze({
|
|
50
29
|
isFullscreen: 'isFullscreen',
|
|
51
30
|
size: 'size',
|
|
52
31
|
minSize: 'minSize',
|
|
53
32
|
maxFullscreenSize: 'maxFullscreenSize'
|
|
54
33
|
});
|
|
34
|
+
|
|
55
35
|
/**
|
|
56
36
|
* Watchable keys in {@link Viewport}.
|
|
57
37
|
* - `isFullscreen`
|
|
@@ -60,19 +40,18 @@ var WatchableViewportKeys = Object.freeze({
|
|
|
60
40
|
* - `maxFullscreenSize`
|
|
61
41
|
*/
|
|
62
42
|
|
|
43
|
+
/** */
|
|
44
|
+
|
|
63
45
|
var compareWithNulls = (a, b, compare) => {
|
|
64
46
|
if (a !== null && b !== null) {
|
|
65
47
|
return compare(a, b);
|
|
66
48
|
}
|
|
67
|
-
|
|
68
49
|
if (a === null) {
|
|
69
50
|
return b;
|
|
70
51
|
}
|
|
71
|
-
|
|
72
52
|
if (b === null) {
|
|
73
53
|
return a;
|
|
74
54
|
}
|
|
75
|
-
|
|
76
55
|
return null;
|
|
77
56
|
};
|
|
78
57
|
/**
|
|
@@ -87,53 +66,43 @@ var compareWithNulls = (a, b, compare) => {
|
|
|
87
66
|
* ```
|
|
88
67
|
* @docsPath models/Viewport
|
|
89
68
|
*/
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
var Viewport =
|
|
93
|
-
/*#__PURE__*/
|
|
94
|
-
function (_Watchable) {
|
|
95
|
-
(0, _inherits2.default)(Viewport, _Watchable);
|
|
96
|
-
(0, _createClass2.default)(Viewport, null, [{
|
|
97
|
-
key: "_isWatchableKey",
|
|
98
|
-
|
|
99
|
-
/** @internal */
|
|
100
|
-
|
|
101
|
-
/** @internal */
|
|
102
|
-
value: function _isWatchableKey(key) {
|
|
103
|
-
return (0, _private_utils.isEnumValue)(WatchableViewportKeys, key);
|
|
104
|
-
}
|
|
105
|
-
/** @internal */
|
|
106
|
-
|
|
107
|
-
}]);
|
|
108
|
-
|
|
69
|
+
var Viewport = /*#__PURE__*/function (_Watchable) {
|
|
109
70
|
/** @internal */
|
|
110
71
|
function Viewport(isFullscreen, airtableInterface) {
|
|
111
72
|
var _this;
|
|
112
|
-
|
|
113
73
|
(0, _classCallCheck2.default)(this, Viewport);
|
|
114
|
-
_this = (
|
|
115
|
-
|
|
116
|
-
(0, _defineProperty2.default)(
|
|
117
|
-
|
|
118
|
-
(0, _defineProperty2.default)(
|
|
119
|
-
|
|
120
|
-
(0, _defineProperty2.default)(
|
|
121
|
-
|
|
122
|
-
(0, _defineProperty2.default)(
|
|
74
|
+
_this = _callSuper(this, Viewport);
|
|
75
|
+
/** @internal */
|
|
76
|
+
(0, _defineProperty2.default)(_this, "_isFullscreen", void 0);
|
|
77
|
+
/** @internal */
|
|
78
|
+
(0, _defineProperty2.default)(_this, "_airtableInterface", void 0);
|
|
79
|
+
/** @internal */
|
|
80
|
+
(0, _defineProperty2.default)(_this, "_sizeWatchCount", void 0);
|
|
81
|
+
/** @internal */
|
|
82
|
+
(0, _defineProperty2.default)(_this, "_onSizeChangeDebounced", void 0);
|
|
83
|
+
/** @internal */
|
|
84
|
+
(0, _defineProperty2.default)(_this, "_minSizes", new Set());
|
|
85
|
+
/** @internal */
|
|
86
|
+
(0, _defineProperty2.default)(_this, "_maxFullscreenSizes", new Set());
|
|
87
|
+
/** @internal */
|
|
88
|
+
(0, _defineProperty2.default)(_this, "_cachedMaxFullscreenSize", null);
|
|
89
|
+
/** @internal */
|
|
90
|
+
(0, _defineProperty2.default)(_this, "_cachedMinSize", null);
|
|
123
91
|
_this._isFullscreen = isFullscreen;
|
|
124
|
-
_this._airtableInterface = airtableInterface;
|
|
92
|
+
_this._airtableInterface = airtableInterface;
|
|
93
|
+
|
|
94
|
+
// When size is watched, we'll increment this counter, and we'll decrement
|
|
125
95
|
// it when it is unwatched and the counter is at 0. This way we can lazily
|
|
126
96
|
// add an event listener for window resize and remove it when nobody is
|
|
127
97
|
// listening anymore.
|
|
128
|
-
|
|
129
98
|
_this._sizeWatchCount = 0;
|
|
130
|
-
_this._onSizeChangeDebounced = (0, _private_utils.debounce)(_this._onSizeChange.bind(
|
|
131
|
-
// containing frame
|
|
99
|
+
_this._onSizeChangeDebounced = (0, _private_utils.debounce)(_this._onSizeChange.bind(_this), 200);
|
|
132
100
|
|
|
101
|
+
// whenever maxFullscreenSize changes, we want to sync it back to the
|
|
102
|
+
// containing frame
|
|
133
103
|
_this.watch(WatchableViewportKeys.maxFullscreenSize, () => {
|
|
134
104
|
_this._airtableInterface.setFullscreenMaxSize(_this.maxFullscreenSize);
|
|
135
105
|
});
|
|
136
|
-
|
|
137
106
|
return _this;
|
|
138
107
|
}
|
|
139
108
|
/**
|
|
@@ -143,20 +112,19 @@ function (_Watchable) {
|
|
|
143
112
|
* permission to fullscreen itself. Watch `isFullscreen` to know if the
|
|
144
113
|
* request succeeded.
|
|
145
114
|
*/
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
(0, _createClass2.default)(Viewport, [{
|
|
115
|
+
(0, _inherits2.default)(Viewport, _Watchable);
|
|
116
|
+
return (0, _createClass2.default)(Viewport, [{
|
|
149
117
|
key: "enterFullscreenIfPossible",
|
|
150
118
|
value: function enterFullscreenIfPossible() {
|
|
151
119
|
this._airtableInterface.enterFullscreen();
|
|
152
120
|
}
|
|
153
121
|
/** Request to exit fullscreen mode */
|
|
154
|
-
|
|
155
122
|
}, {
|
|
156
123
|
key: "exitFullscreen",
|
|
157
124
|
value: function exitFullscreen() {
|
|
158
125
|
this._airtableInterface.exitFullscreen();
|
|
159
126
|
}
|
|
127
|
+
|
|
160
128
|
/**
|
|
161
129
|
* The maximum dimensions of the extension when it is in
|
|
162
130
|
* fullscreen mode. Returns the smallest set of dimensions added with
|
|
@@ -166,9 +134,25 @@ function (_Watchable) {
|
|
|
166
134
|
* no max size constraint on that dimension. If `maxFullscreenSize` would be
|
|
167
135
|
* smaller than {@link minSize}, it is constrained to be at least `minSize`.
|
|
168
136
|
*/
|
|
169
|
-
|
|
170
137
|
}, {
|
|
171
|
-
key: "
|
|
138
|
+
key: "maxFullscreenSize",
|
|
139
|
+
get: function get() {
|
|
140
|
+
if (!this._cachedMaxFullscreenSize) {
|
|
141
|
+
var maxFullscreenSize = Array.from(this._maxFullscreenSizes).reduce((memo, size) => ({
|
|
142
|
+
width: compareWithNulls(memo.width, size.width, Math.min),
|
|
143
|
+
height: compareWithNulls(memo.height, size.height, Math.min)
|
|
144
|
+
}), {
|
|
145
|
+
width: null,
|
|
146
|
+
height: null
|
|
147
|
+
});
|
|
148
|
+
var minSize = this.minSize;
|
|
149
|
+
this._cachedMaxFullscreenSize = {
|
|
150
|
+
width: maxFullscreenSize.width !== null && minSize.width !== null ? Math.max(maxFullscreenSize.width, minSize.width) : maxFullscreenSize.width,
|
|
151
|
+
height: maxFullscreenSize.height !== null && minSize.height !== null ? Math.max(maxFullscreenSize.height, minSize.height) : maxFullscreenSize.height
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
return this._cachedMaxFullscreenSize;
|
|
155
|
+
}
|
|
172
156
|
|
|
173
157
|
/**
|
|
174
158
|
* Add a maximum fullscreen size constraint. Use `.maxFullscreenSize` to get
|
|
@@ -180,28 +164,26 @@ function (_Watchable) {
|
|
|
180
164
|
* `width` and `height` are optional - if either is set to null, that means
|
|
181
165
|
* there is no max size in that dimension.
|
|
182
166
|
*/
|
|
167
|
+
}, {
|
|
168
|
+
key: "addMaxFullscreenSize",
|
|
183
169
|
value: function addMaxFullscreenSize(sizeConstraint) {
|
|
184
170
|
var width = sizeConstraint.width,
|
|
185
|
-
|
|
171
|
+
height = sizeConstraint.height;
|
|
186
172
|
var size = Object.freeze({
|
|
187
173
|
width: typeof width === 'number' ? width : null,
|
|
188
174
|
height: typeof height === 'number' ? height : null
|
|
189
175
|
});
|
|
190
176
|
this._cachedMaxFullscreenSize = null;
|
|
191
|
-
|
|
192
177
|
this._maxFullscreenSizes.add(size);
|
|
193
|
-
|
|
194
178
|
this._onChange(WatchableViewportKeys.maxFullscreenSize);
|
|
195
|
-
|
|
196
179
|
return () => {
|
|
197
180
|
(0, _error_utils.invariant)(this._maxFullscreenSizes.has(size), 'UnsetFn can only be called once');
|
|
198
181
|
this._cachedMaxFullscreenSize = null;
|
|
199
|
-
|
|
200
182
|
this._maxFullscreenSizes.delete(size);
|
|
201
|
-
|
|
202
183
|
this._onChange(WatchableViewportKeys.maxFullscreenSize);
|
|
203
184
|
};
|
|
204
185
|
}
|
|
186
|
+
|
|
205
187
|
/**
|
|
206
188
|
* The minimum dimensions of the extension - if the viewport gets smaller than this
|
|
207
189
|
* size, an overlay will be shown asking the user to resize the extension to be bigger.
|
|
@@ -209,9 +191,20 @@ function (_Watchable) {
|
|
|
209
191
|
* The largest set of dimensions added with addMinSize. If `width` or `height` is null, it means
|
|
210
192
|
* there is no minSize constraint on that dimension.
|
|
211
193
|
*/
|
|
212
|
-
|
|
213
194
|
}, {
|
|
214
|
-
key: "
|
|
195
|
+
key: "minSize",
|
|
196
|
+
get: function get() {
|
|
197
|
+
if (!this._cachedMinSize) {
|
|
198
|
+
this._cachedMinSize = Array.from(this._minSizes).reduce((memo, size) => ({
|
|
199
|
+
width: compareWithNulls(memo.width, size.width, Math.max),
|
|
200
|
+
height: compareWithNulls(memo.height, size.height, Math.max)
|
|
201
|
+
}), {
|
|
202
|
+
width: null,
|
|
203
|
+
height: null
|
|
204
|
+
});
|
|
205
|
+
}
|
|
206
|
+
return this._cachedMinSize;
|
|
207
|
+
}
|
|
215
208
|
|
|
216
209
|
/**
|
|
217
210
|
* Add a minimum frame size constraint. Use `.minSize`` to get the aggregate
|
|
@@ -226,47 +219,69 @@ function (_Watchable) {
|
|
|
226
219
|
* and `height` are optional - if either is set to null, that means there is
|
|
227
220
|
* no min size in that dimension.
|
|
228
221
|
*/
|
|
222
|
+
}, {
|
|
223
|
+
key: "addMinSize",
|
|
229
224
|
value: function addMinSize(sizeConstraint) {
|
|
230
225
|
var width = sizeConstraint.width,
|
|
231
|
-
|
|
226
|
+
height = sizeConstraint.height;
|
|
232
227
|
var size = Object.freeze({
|
|
233
228
|
width: typeof width === 'number' ? width : null,
|
|
234
229
|
height: typeof height === 'number' ? height : null
|
|
235
230
|
});
|
|
236
|
-
this._cachedMinSize = null;
|
|
237
|
-
|
|
231
|
+
this._cachedMinSize = null;
|
|
232
|
+
// min size is also a constraint on maxFullscreenSize:
|
|
238
233
|
this._cachedMaxFullscreenSize = null;
|
|
239
|
-
|
|
240
234
|
this._minSizes.add(size);
|
|
241
|
-
|
|
242
235
|
this._onChange(WatchableViewportKeys.minSize);
|
|
243
|
-
|
|
244
236
|
this._onChange(WatchableViewportKeys.maxFullscreenSize);
|
|
245
|
-
|
|
246
237
|
if (this.isSmallerThanMinSize) {
|
|
247
238
|
this.enterFullscreenIfPossible();
|
|
248
239
|
}
|
|
249
|
-
|
|
250
240
|
return () => {
|
|
251
241
|
(0, _error_utils.invariant)(this._minSizes.has(size), 'UnsetFn can only be called once');
|
|
252
242
|
this._cachedMinSize = null;
|
|
253
243
|
this._cachedMaxFullscreenSize = null;
|
|
254
|
-
|
|
255
244
|
this._minSizes.delete(size);
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
245
|
+
this._onChange(WatchableViewportKeys.minSize);
|
|
246
|
+
// min size is also a constraint on maxFullscreenSize:
|
|
260
247
|
this._onChange(WatchableViewportKeys.maxFullscreenSize);
|
|
261
248
|
};
|
|
262
249
|
}
|
|
250
|
+
|
|
263
251
|
/**
|
|
264
252
|
* `true` if the extension frame is smaller than `minSize`, `false` otherwise.
|
|
265
253
|
*/
|
|
266
|
-
|
|
267
254
|
}, {
|
|
268
|
-
key: "
|
|
269
|
-
|
|
255
|
+
key: "isSmallerThanMinSize",
|
|
256
|
+
get: function get() {
|
|
257
|
+
var _this$size = this.size,
|
|
258
|
+
width = _this$size.width,
|
|
259
|
+
height = _this$size.height;
|
|
260
|
+
var isWidthTooSmall = this.minSize.width !== null && this.minSize.width > width;
|
|
261
|
+
var isHeightTooSmall = this.minSize.height !== null && this.minSize.height > height;
|
|
262
|
+
return isWidthTooSmall || isHeightTooSmall;
|
|
263
|
+
}
|
|
264
|
+
/**
|
|
265
|
+
* `true` if the extension is fullscreen, `false` otherwise.
|
|
266
|
+
*/
|
|
267
|
+
}, {
|
|
268
|
+
key: "isFullscreen",
|
|
269
|
+
get: function get() {
|
|
270
|
+
return this._isFullscreen;
|
|
271
|
+
}
|
|
272
|
+
/**
|
|
273
|
+
* The current size of the extension frame.
|
|
274
|
+
*
|
|
275
|
+
* Can be watched.
|
|
276
|
+
*/
|
|
277
|
+
}, {
|
|
278
|
+
key: "size",
|
|
279
|
+
get: function get() {
|
|
280
|
+
return {
|
|
281
|
+
width: window.innerWidth,
|
|
282
|
+
height: window.innerHeight
|
|
283
|
+
};
|
|
284
|
+
}
|
|
270
285
|
/**
|
|
271
286
|
* Get notified of changes to the viewport.
|
|
272
287
|
*
|
|
@@ -284,17 +299,16 @@ function (_Watchable) {
|
|
|
284
299
|
* @param callback a function to call when those keys change
|
|
285
300
|
* @param context an optional context for `this` in `callback`.
|
|
286
301
|
*/
|
|
302
|
+
}, {
|
|
303
|
+
key: "watch",
|
|
287
304
|
value: function watch(keys, callback, context) {
|
|
288
305
|
var validKeys = (0, _get2.default)((0, _getPrototypeOf2.default)(Viewport.prototype), "watch", this).call(this, keys, callback, context);
|
|
289
|
-
|
|
290
306
|
if (validKeys.includes(WatchableViewportKeys.size)) {
|
|
291
307
|
if (this._sizeWatchCount === 0) {
|
|
292
308
|
window.addEventListener('resize', this._onSizeChangeDebounced, false);
|
|
293
309
|
}
|
|
294
|
-
|
|
295
310
|
this._sizeWatchCount++;
|
|
296
311
|
}
|
|
297
|
-
|
|
298
312
|
return validKeys;
|
|
299
313
|
}
|
|
300
314
|
/**
|
|
@@ -308,59 +322,48 @@ function (_Watchable) {
|
|
|
308
322
|
* @param callback the function passed to `.watch` for these keys
|
|
309
323
|
* @param context the context that was passed to `.watch` for this `callback`
|
|
310
324
|
*/
|
|
311
|
-
|
|
312
325
|
}, {
|
|
313
326
|
key: "unwatch",
|
|
314
327
|
value: function unwatch(keys, callback, context) {
|
|
315
328
|
var validKeys = (0, _get2.default)((0, _getPrototypeOf2.default)(Viewport.prototype), "unwatch", this).call(this, keys, callback, context);
|
|
316
|
-
|
|
317
329
|
if (validKeys.includes(WatchableViewportKeys.size)) {
|
|
318
330
|
this._sizeWatchCount--;
|
|
319
|
-
|
|
320
331
|
if (this._sizeWatchCount === 0) {
|
|
321
332
|
window.removeEventListener('resize', this._onSizeChangeDebounced, false);
|
|
322
333
|
}
|
|
323
334
|
}
|
|
324
|
-
|
|
325
335
|
return validKeys;
|
|
326
336
|
}
|
|
327
337
|
/**
|
|
328
338
|
* @internal
|
|
329
339
|
*/
|
|
330
|
-
|
|
331
340
|
}, {
|
|
332
341
|
key: "__onEnterFullscreen",
|
|
333
342
|
value: function __onEnterFullscreen() {
|
|
334
343
|
this._isFullscreen = true;
|
|
335
|
-
|
|
336
344
|
this._onChange(WatchableViewportKeys.isFullscreen);
|
|
337
|
-
|
|
338
345
|
this._onChange(WatchableViewportKeys.size);
|
|
339
346
|
}
|
|
340
347
|
/**
|
|
341
348
|
* @internal
|
|
342
349
|
*/
|
|
343
|
-
|
|
344
350
|
}, {
|
|
345
351
|
key: "__onExitFullscreen",
|
|
346
352
|
value: function __onExitFullscreen() {
|
|
347
353
|
this._isFullscreen = false;
|
|
348
|
-
|
|
349
354
|
this._onChange(WatchableViewportKeys.isFullscreen);
|
|
350
|
-
|
|
351
355
|
this._onChange(WatchableViewportKeys.size);
|
|
352
356
|
}
|
|
353
357
|
/**
|
|
354
358
|
* @internal
|
|
355
359
|
*/
|
|
356
|
-
|
|
357
360
|
}, {
|
|
358
361
|
key: "__focus",
|
|
359
362
|
value: function __focus() {
|
|
360
363
|
var _document = document,
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
+
body = _document.body,
|
|
365
|
+
activeElement = _document.activeElement;
|
|
366
|
+
// See comment in BlockFrame.focusIframe for why we do this.
|
|
364
367
|
if (activeElement && activeElement !== body) {
|
|
365
368
|
// If there's already an activeElement, re-focus it.
|
|
366
369
|
activeElement.focus();
|
|
@@ -376,84 +379,19 @@ function (_Watchable) {
|
|
|
376
379
|
/**
|
|
377
380
|
* @internal
|
|
378
381
|
*/
|
|
379
|
-
|
|
380
382
|
}, {
|
|
381
383
|
key: "_onSizeChange",
|
|
382
384
|
value: function _onSizeChange() {
|
|
383
385
|
this._onChange(WatchableViewportKeys.size);
|
|
384
386
|
}
|
|
385
|
-
}, {
|
|
386
|
-
key: "
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
width: compareWithNulls(memo.width, size.width, Math.min),
|
|
391
|
-
height: compareWithNulls(memo.height, size.height, Math.min)
|
|
392
|
-
}), {
|
|
393
|
-
width: null,
|
|
394
|
-
height: null
|
|
395
|
-
});
|
|
396
|
-
var minSize = this.minSize;
|
|
397
|
-
this._cachedMaxFullscreenSize = {
|
|
398
|
-
width: maxFullscreenSize.width !== null && minSize.width !== null ? Math.max(maxFullscreenSize.width, minSize.width) : maxFullscreenSize.width,
|
|
399
|
-
height: maxFullscreenSize.height !== null && minSize.height !== null ? Math.max(maxFullscreenSize.height, minSize.height) : maxFullscreenSize.height
|
|
400
|
-
};
|
|
401
|
-
}
|
|
402
|
-
|
|
403
|
-
return this._cachedMaxFullscreenSize;
|
|
404
|
-
}
|
|
405
|
-
}, {
|
|
406
|
-
key: "minSize",
|
|
407
|
-
get: function get() {
|
|
408
|
-
if (!this._cachedMinSize) {
|
|
409
|
-
this._cachedMinSize = Array.from(this._minSizes).reduce((memo, size) => ({
|
|
410
|
-
width: compareWithNulls(memo.width, size.width, Math.max),
|
|
411
|
-
height: compareWithNulls(memo.height, size.height, Math.max)
|
|
412
|
-
}), {
|
|
413
|
-
width: null,
|
|
414
|
-
height: null
|
|
415
|
-
});
|
|
416
|
-
}
|
|
417
|
-
|
|
418
|
-
return this._cachedMinSize;
|
|
419
|
-
}
|
|
420
|
-
}, {
|
|
421
|
-
key: "isSmallerThanMinSize",
|
|
422
|
-
get: function get() {
|
|
423
|
-
var _this$size = this.size,
|
|
424
|
-
width = _this$size.width,
|
|
425
|
-
height = _this$size.height;
|
|
426
|
-
var isWidthTooSmall = this.minSize.width !== null && this.minSize.width > width;
|
|
427
|
-
var isHeightTooSmall = this.minSize.height !== null && this.minSize.height > height;
|
|
428
|
-
return isWidthTooSmall || isHeightTooSmall;
|
|
429
|
-
}
|
|
430
|
-
/**
|
|
431
|
-
* `true` if the extension is fullscreen, `false` otherwise.
|
|
432
|
-
*/
|
|
433
|
-
|
|
434
|
-
}, {
|
|
435
|
-
key: "isFullscreen",
|
|
436
|
-
get: function get() {
|
|
437
|
-
return this._isFullscreen;
|
|
438
|
-
}
|
|
439
|
-
/**
|
|
440
|
-
* The current size of the extension frame.
|
|
441
|
-
*
|
|
442
|
-
* Can be watched.
|
|
443
|
-
*/
|
|
444
|
-
|
|
445
|
-
}, {
|
|
446
|
-
key: "size",
|
|
447
|
-
get: function get() {
|
|
448
|
-
return {
|
|
449
|
-
width: window.innerWidth,
|
|
450
|
-
height: window.innerHeight
|
|
451
|
-
};
|
|
387
|
+
}], [{
|
|
388
|
+
key: "_isWatchableKey",
|
|
389
|
+
value: /** @internal */
|
|
390
|
+
function _isWatchableKey(key) {
|
|
391
|
+
return (0, _private_utils.isEnumValue)(WatchableViewportKeys, key);
|
|
452
392
|
}
|
|
453
393
|
}]);
|
|
454
|
-
return Viewport;
|
|
455
394
|
}(_watchable.default);
|
|
456
|
-
|
|
395
|
+
/** @internal */
|
|
457
396
|
(0, _defineProperty2.default)(Viewport, "_className", 'Viewport');
|
|
458
|
-
var _default = Viewport;
|
|
459
|
-
exports.default = _default;
|
|
397
|
+
var _default = exports.default = Viewport;
|
package/dist/cjs/warning.js
CHANGED
|
@@ -6,22 +6,21 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.__injectSdkIntoWarning = __injectSdkIntoWarning;
|
|
7
7
|
exports.default = void 0;
|
|
8
8
|
var usedWarnings = {};
|
|
9
|
-
|
|
10
9
|
var _default = msgLines => {
|
|
11
10
|
var msg = typeof msgLines === 'string' ? msgLines : msgLines.join('\n');
|
|
12
11
|
var mayUseConsole = !sdk || sdk.runInfo.isDevelopmentMode;
|
|
13
|
-
|
|
14
12
|
if (mayUseConsole && usedWarnings[msg] !== true) {
|
|
15
|
-
usedWarnings[msg] = true;
|
|
13
|
+
usedWarnings[msg] = true;
|
|
16
14
|
|
|
15
|
+
// eslint-disable-next-line no-console
|
|
17
16
|
console.warn("[@airtable/blocks] ".concat(msg));
|
|
18
17
|
}
|
|
19
18
|
};
|
|
20
|
-
|
|
21
19
|
exports.default = _default;
|
|
22
|
-
var sdk;
|
|
23
|
-
// circular dependencies at the time of module resolution.
|
|
20
|
+
var sdk;
|
|
24
21
|
|
|
22
|
+
// The application-level Sdk instance must be injected dynamically to avoid
|
|
23
|
+
// circular dependencies at the time of module resolution.
|
|
25
24
|
function __injectSdkIntoWarning(_sdk) {
|
|
26
25
|
sdk = _sdk;
|
|
27
26
|
}
|