sproutcore 1.5.0.pre.3 → 1.5.0.pre.4
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.
- data/.rspec +1 -0
- data/CHANGELOG +42 -0
- data/README.txt +25 -0
- data/VERSION.yml +1 -1
- data/bin/sc-build +1 -1
- data/bin/sc-build-number +1 -1
- data/bin/sc-docs +1 -1
- data/bin/sc-gen +1 -1
- data/bin/sc-init +1 -1
- data/bin/sc-manifest +1 -1
- data/bin/sc-server +1 -1
- data/bin/sproutcore +1 -1
- data/lib/buildtasks/build.rake +5 -0
- data/lib/buildtasks/manifest.rake +20 -1
- data/lib/frameworks/sproutcore/Buildfile +12 -9
- data/lib/frameworks/sproutcore/CHANGELOG.md +48 -0
- data/lib/frameworks/sproutcore/apps/greenhouse/README +2 -9
- data/lib/frameworks/sproutcore/apps/greenhouse/TODO +11 -27
- data/lib/frameworks/sproutcore/apps/greenhouse/controllers/library.js +3 -10
- data/lib/frameworks/sproutcore/apps/greenhouse/english.lproj/css/main-page.css +4 -31
- data/lib/frameworks/sproutcore/apps/greenhouse/english.lproj/dialogs.js +5 -4
- data/lib/frameworks/sproutcore/apps/greenhouse/models/dir.js +3 -3
- data/lib/frameworks/sproutcore/apps/greenhouse/models/file.js +2 -2
- data/lib/frameworks/sproutcore/apps/greenhouse/states/main.js +31 -14
- data/lib/frameworks/sproutcore/apps/greenhouse/states/modals.js +2 -1
- data/lib/frameworks/sproutcore/apps/greenhouse/states/ready.js +27 -1
- data/lib/frameworks/sproutcore/apps/greenhouse/tests/views/list_item.js +1 -0
- data/lib/frameworks/sproutcore/apps/greenhouse/tests/views/plist_item.js +20 -0
- data/lib/frameworks/sproutcore/apps/greenhouse/theme.js +25 -0
- data/lib/frameworks/sproutcore/apps/greenhouse/views/plist_item.js +161 -24
- data/lib/frameworks/sproutcore/apps/greenhouse/views/tear_off_picker.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/bootstrap/system/browser.js +37 -25
- data/lib/frameworks/sproutcore/frameworks/bootstrap/tests/system/browser.js +135 -26
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/controllers/array.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/controllers/controller.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/controllers/object.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/core.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/ext/object.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/ext/run_loop.js +1 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/mixins/delegate_support.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/mixins/responder_context.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/mixins/selection_support.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/mixins/string.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/panes/keyboard.js +68 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/panes/layout.js +108 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/panes/main.js +2 -2
- data/lib/frameworks/sproutcore/frameworks/core_foundation/panes/manipulation.js +27 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/panes/pane.js +215 -505
- data/lib/frameworks/sproutcore/frameworks/core_foundation/panes/template.js +24 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/panes/visibility.js +11 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/protocols/observable_protocol.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/protocols/sparse_array_delegate.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/resources/core.css +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/resources/view.css +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/system/application.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/system/browser.js +1 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/system/builder.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/system/core_query.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/system/cursor.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/device.js +210 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/system/event.js +5 -5
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/system/json.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/system/locale.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/system/page.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/system/platform.js +31 -5
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/system/ready.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/system/render_context.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/system/responder.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/system/root_responder.js +83 -110
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/system/selection_set.js +7 -4
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/system/sparse_array.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/system/theme.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/system/timer.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/system/utils/rect.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/utils.js +151 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/controllers/array/array_case.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/controllers/array/enum_case.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/controllers/array/null_case.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/controllers/array/selection_support.js +26 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/controllers/array/single_case.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/controllers/object/empty_case.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/controllers/object/multiple_case.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/controllers/object/single_case.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/controllers/object/single_enumerable_case.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/mixins/responder_context.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/mixins/string.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/panes/template.js +14 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/builder.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/core_query/within.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/json.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/locale.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/render_context/begin.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/render_context/element.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/render_context/end.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/render_context/get.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/render_context/helpers_attr.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/render_context/helpers_basic.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/render_context/helpers_className.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/render_context/helpers_style.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/render_context/init.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/render_context/join.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/render_context/push_text.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/render_context/tag.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/render_context/update.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/root_responder/makeKeyPane.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/root_responder/makeMainPane.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/root_responder/makeMenuPane.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/root_responder/root_responder.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/root_responder/targetForAction.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/selection_set/add.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/selection_set/copy.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/selection_set/indexSetForSource.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/selection_set/isEqual.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/selection_set/remove.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/sparse_array.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/theme.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/timer/invalidate.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/timer/invokeLater.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/timer/isPaused.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/timer/performAction.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/timer/schedule.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/utils/normalizeURL.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/system/utils/offset.js +268 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/utils/rect.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/main_pane.js +43 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/views/pane/append_remove.js +107 -18
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/pane/child_view.js +20 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/views/pane/firstResponder.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/views/pane/keyPane.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/views/pane/layout.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/views/pane/sendEvent.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/template/checkbox_support.js +32 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/template/text_field_support.js +73 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/template_view/collection.js +65 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/template_view/core.js +67 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/template_view/handlebars.js +295 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/views/view/animation.js +19 -18
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/views/view/build.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/views/view/build_children.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/views/view/clippingFrame.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/views/view/convertFrames.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/views/view/convertLayouts.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/views/view/createChildViews.js +18 -15
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/views/view/createLayer.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/views/view/destroyLayer.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/views/view/didAppendToDocument.js +11 -8
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/views/view/findLayerInParentLayer.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/views/view/init.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/views/view/insertBefore.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/views/view/isVisible.js +28 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/views/view/isVisibleInWindow.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/keyboard.js +22 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/views/view/layer.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/views/view/layoutChildViews.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/layoutDidChange.js +180 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/layoutStyle.js +640 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/views/view/parentViewDidChange.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/views/view/prepareContext.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/views/view/removeChild.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/render.js +125 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/views/view/render_delegate_support.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/views/view/replaceChild.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/static_layout.js +21 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/views/view/theme.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/views/view/updateLayer.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/views/view/updateLayerLocation.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/views/view/view.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/views/view/viewDidResize.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/template/checkbox_support.js +20 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/template/collection.js +99 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/template/text_field_support.js +35 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/template.js +77 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/animation.js +187 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/base.js +1 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/cursor.js +41 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/enabled.js +57 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/keyboard.js +223 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/layout.js +1150 -0
- data/lib/frameworks/sproutcore/frameworks/{amber/views → core_foundation/views/view}/layout_style.js +93 -1
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/manipulation.js +489 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/theming.js +362 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/touch.js +67 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/visibility.js +113 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view.js +1280 -0
- data/lib/frameworks/sproutcore/frameworks/datastore/models/child_attribute.js +27 -53
- data/lib/frameworks/sproutcore/frameworks/datastore/models/children_attribute.js +13 -19
- data/lib/frameworks/sproutcore/frameworks/datastore/models/many_attribute.js +1 -0
- data/lib/frameworks/sproutcore/frameworks/datastore/models/record.js +183 -71
- data/lib/frameworks/sproutcore/frameworks/datastore/models/record_attribute.js +1 -2
- data/lib/frameworks/sproutcore/frameworks/datastore/system/child_array.js +26 -46
- data/lib/frameworks/sproutcore/frameworks/datastore/system/nested_store.js +25 -4
- data/lib/frameworks/sproutcore/frameworks/datastore/system/store.js +139 -21
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/data_sources/fixtures.js +6 -1
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/integration/cyclical_relationship.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/models/nested_records/{parentless.js → data_store.js} +62 -16
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/models/nested_records/nested_record.js +51 -17
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/models/nested_records/nested_record_array.js +36 -10
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/models/nested_records/nested_record_array_complex.js +11 -11
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/models/nested_records/nested_record_complex.js +8 -8
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/models/record/normalize.js +2 -2
- data/lib/frameworks/sproutcore/frameworks/{foundation/english.lproj → datetime/resources}/strings.js +1 -0
- data/lib/frameworks/sproutcore/frameworks/{foundation → datetime}/system/datetime.js +5 -37
- data/lib/frameworks/sproutcore/frameworks/{foundation → datetime}/tests/system/datetime.js +1 -0
- data/lib/frameworks/sproutcore/frameworks/debug/core.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/designer/controllers/designs.js +1 -2
- data/lib/frameworks/sproutcore/frameworks/designer/designers/object_designer.js +3 -3
- data/lib/frameworks/sproutcore/frameworks/designer/designers/view_designer.js +3 -3
- data/lib/frameworks/sproutcore/frameworks/designer/views/designer_drop_target.js +9 -3
- data/lib/frameworks/sproutcore/frameworks/desktop/english.lproj/segmented.css +71 -70
- data/lib/frameworks/sproutcore/frameworks/desktop/mixins/collection_row_delegate.js +10 -2
- data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/segment.js +4 -19
- data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/segmented.js +33 -14
- data/lib/frameworks/sproutcore/frameworks/desktop/system/drag.js +25 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/date_field/ui.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/segmented/methods.js +25 -103
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/segmented/ui.js +102 -92
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/tab/ui.js +22 -25
- data/lib/frameworks/sproutcore/frameworks/desktop/views/collection.js +38 -25
- data/lib/frameworks/sproutcore/frameworks/desktop/views/date_field.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/desktop/views/scroll.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/desktop/views/segment.js +42 -22
- data/lib/frameworks/sproutcore/frameworks/desktop/views/segmented.js +513 -230
- data/lib/frameworks/sproutcore/frameworks/desktop/views/select_field.js +0 -2
- data/lib/frameworks/sproutcore/frameworks/experimental/README.md +23 -0
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/device_motion/README.md +11 -0
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/device_motion/device.js +215 -0
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/device_motion/platform.js +67 -0
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/polymorphism/README.md +34 -0
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/polymorphism/models/polymorphic_single_attribute.js +183 -0
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/polymorphism/models/record.js +23 -0
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/polymorphism/tests/models/polymorphic/single.js +124 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/mixins/auto_resize.js +0 -2
- data/lib/frameworks/sproutcore/frameworks/foundation/mixins/inner_frame.js +151 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/render_delegates/canvas_image.js +27 -17
- data/lib/frameworks/sproutcore/frameworks/foundation/system/image_queue.js +6 -3
- data/lib/frameworks/sproutcore/frameworks/foundation/system/logger.js +163 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/system/user_defaults.js +6 -3
- data/lib/frameworks/sproutcore/frameworks/foundation/tests/mixins/inline_text_field/beginEditing.js +1 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/tests/system/logger.js +44 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/tests/views/image/ui.js +200 -167
- data/lib/frameworks/sproutcore/frameworks/foundation/tests/views/text_field/ui.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/foundation/views/image.js +52 -137
- data/lib/frameworks/sproutcore/frameworks/foundation/views/text_field.js +7 -11
- data/lib/frameworks/sproutcore/frameworks/handlebars/extensions.js +138 -0
- data/lib/frameworks/sproutcore/frameworks/handlebars/handlebars.js +1338 -0
- data/lib/frameworks/sproutcore/frameworks/runtime/core.js +32 -26
- data/lib/frameworks/sproutcore/frameworks/runtime/debug/test_suites/array/base.js +162 -3
- data/lib/frameworks/sproutcore/frameworks/runtime/mixins/array.js +10 -5
- data/lib/frameworks/sproutcore/frameworks/runtime/mixins/enumerable.js +123 -3
- data/lib/frameworks/sproutcore/frameworks/runtime/mixins/observable.js +12 -5
- data/lib/frameworks/sproutcore/frameworks/runtime/private/chain_observer.js +50 -13
- data/lib/frameworks/sproutcore/frameworks/runtime/system/logger.js +163 -333
- data/lib/frameworks/sproutcore/frameworks/runtime/system/object.js +58 -8
- data/lib/frameworks/sproutcore/frameworks/runtime/system/run_loop.js +2 -0
- data/lib/frameworks/sproutcore/frameworks/runtime/tests/core/itemType.js +9 -6
- data/lib/frameworks/sproutcore/frameworks/runtime/tests/core/makeArray.js +15 -1
- data/lib/frameworks/sproutcore/frameworks/runtime/tests/mixins/array.js +2 -0
- data/lib/frameworks/sproutcore/frameworks/runtime/tests/mixins/observable/chained.js +31 -0
- data/lib/frameworks/sproutcore/frameworks/runtime/tests/mixins/observable/observable.js +18 -0
- data/lib/frameworks/sproutcore/frameworks/runtime/tests/system/logger.js +31 -143
- data/lib/frameworks/sproutcore/frameworks/runtime/tests/system/object/concatenated_properties.js +71 -0
- data/lib/frameworks/sproutcore/frameworks/runtime/tests/system/object/enhance.js +177 -0
- data/lib/frameworks/sproutcore/frameworks/table/views/table.js +5 -4
- data/lib/frameworks/sproutcore/frameworks/table/views/table_header.js +5 -3
- data/lib/frameworks/sproutcore/themes/ace/resources/button/button.js +8 -2
- data/lib/frameworks/sproutcore/themes/ace/resources/menu/menu.css +2 -3
- data/lib/frameworks/sproutcore/themes/ace/resources/segmented/18px/segmented.css +1 -1
- data/lib/frameworks/sproutcore/themes/ace/resources/segmented/24px/segmented.css +1 -1
- data/lib/frameworks/sproutcore/themes/ace/resources/segmented/30px/segmented.css +1 -1
- data/lib/frameworks/sproutcore/themes/ace/resources/segmented/44px/segmented.css +1 -1
- data/lib/frameworks/sproutcore/themes/ace/resources/segmented/segmented.css +2 -2
- data/lib/frameworks/sproutcore/themes/standard_theme/english.lproj/segmented.css +62 -62
- data/lib/gen/html_app/Buildfile +36 -0
- data/lib/gen/html_app/README +1 -0
- data/lib/gen/html_app/USAGE +15 -0
- data/lib/gen/html_app/templates/apps/@target_name@/@target_name@.js +14 -0
- data/lib/gen/html_app/templates/apps/@target_name@/resources/images/.gitkeep +0 -0
- data/lib/gen/html_app/templates/apps/@target_name@/resources/stylesheets/@target_name@.css +0 -0
- data/lib/gen/html_app/templates/apps/@target_name@/resources/templates/@target_name@.handlebars +1 -0
- data/lib/gen/html_project/Buildfile +45 -0
- data/lib/gen/html_project/INIT +3 -0
- data/lib/gen/html_project/README +1 -0
- data/lib/gen/html_project/USAGE +2 -0
- data/lib/gen/html_project/templates/@filename@/Buildfile +8 -0
- data/lib/gen/html_project/templates/@filename@/README +7 -0
- data/lib/sproutcore/builders/handlebars.rb +30 -0
- data/lib/sproutcore/builders.rb +1 -1
- data/lib/sproutcore/helpers/static_helper.rb +3 -3
- data/lib/sproutcore/tools/init.rb +25 -9
- data/spec/buildtasks/manifest/prepare_build_tasks/handlebars_spec.rb +39 -0
- data/spec/fixtures/builder_tests/apps/handlebars_test/template.handlebars +5 -0
- data/spec/fixtures/real_world/frameworks/sproutcore/english.lproj/templates/demo.handlebars +4 -0
- data/spec/lib/builders/handlebars_spec.rb +29 -0
- data/vendor/chance/lib/chance/imagers/data_url.rb +20 -7
- data/vendor/chance/lib/chance/instance.rb +4 -1
- data/vendor/chance/lib/chance/parser.rb +31 -31
- data/vendor/chance/lib/chance/slicing.rb +38 -8
- metadata +195 -225
- data/lib/frameworks/sproutcore/frameworks/amber/system/device.js +0 -143
- data/lib/frameworks/sproutcore/frameworks/amber/system/utils.js +0 -174
- data/lib/frameworks/sproutcore/frameworks/amber/tests/views/main_pane.js +0 -31
- data/lib/frameworks/sproutcore/frameworks/amber/tests/views/pane/sendTouchEvent.js +0 -267
- data/lib/frameworks/sproutcore/frameworks/amber/tests/views/view/layoutDidChange.js +0 -149
- data/lib/frameworks/sproutcore/frameworks/amber/tests/views/view/layoutStyle.js +0 -602
- data/lib/frameworks/sproutcore/frameworks/amber/tests/views/view/render.js +0 -115
- data/lib/frameworks/sproutcore/frameworks/amber/views/base.js +0 -1
- data/lib/frameworks/sproutcore/frameworks/amber/views/view.js +0 -4003
- data/lib/frameworks/sproutcore/frameworks/datastore/models/child_record.js +0 -105
|
@@ -0,0 +1,362 @@
|
|
|
1
|
+
sc_require("views/view");
|
|
2
|
+
|
|
3
|
+
SC.View.reopen(
|
|
4
|
+
/** @scope SC.View.prototype */ {
|
|
5
|
+
|
|
6
|
+
init: function(original) {
|
|
7
|
+
original();
|
|
8
|
+
this._lastTheme = this.get('theme');
|
|
9
|
+
}.enhance(),
|
|
10
|
+
|
|
11
|
+
// ..........................................................
|
|
12
|
+
// THEME SUPPORT
|
|
13
|
+
//
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
Names which theme this view should use; the theme named by this property
|
|
17
|
+
will be set to the view's 'theme' property.
|
|
18
|
+
|
|
19
|
+
Themes are identified by their name. In addition to looking for the
|
|
20
|
+
theme globally, SproutCore will look for the theme inside 'baseTheme',
|
|
21
|
+
which is almost always the parent view's theme.
|
|
22
|
+
|
|
23
|
+
If null (the default), the view will set its 'theme' property to
|
|
24
|
+
be equal to 'baseTheme'.
|
|
25
|
+
|
|
26
|
+
Example: themeName: 'ace'
|
|
27
|
+
|
|
28
|
+
@property {String}
|
|
29
|
+
*/
|
|
30
|
+
themeName: null,
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
Selects which theme to use as a 'base theme'. If null, the 'baseTheme'
|
|
34
|
+
property will be set to the parent's theme. If there is no parent, the theme
|
|
35
|
+
named by SC.defaultTheme is used.
|
|
36
|
+
|
|
37
|
+
This property is private for the time being.
|
|
38
|
+
|
|
39
|
+
@private
|
|
40
|
+
@property {String}
|
|
41
|
+
*/
|
|
42
|
+
baseThemeName: null,
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
The SC.Theme instance which this view should use to render.
|
|
46
|
+
|
|
47
|
+
Note: the actual code for this function is in _themeProperty for backwards-compatibility:
|
|
48
|
+
some older views specify a string value for 'theme', which would override this property,
|
|
49
|
+
breaking it.
|
|
50
|
+
|
|
51
|
+
@property {SC.Theme}
|
|
52
|
+
*/
|
|
53
|
+
theme: function() {
|
|
54
|
+
var base = this.get('baseTheme'), themeName = this.get('themeName');
|
|
55
|
+
|
|
56
|
+
// find theme, if possible
|
|
57
|
+
if (themeName) {
|
|
58
|
+
// Note: theme instance "find" function will search every parent
|
|
59
|
+
// _except_ global (which is not a parent)
|
|
60
|
+
var theme;
|
|
61
|
+
if (base) {
|
|
62
|
+
theme = base.find(themeName);
|
|
63
|
+
if (theme) { return theme; }
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
theme = SC.Theme.find(themeName);
|
|
67
|
+
if (theme) { return theme; }
|
|
68
|
+
|
|
69
|
+
// Create a new invisible subtheme. This will cause the themeName to
|
|
70
|
+
// be applied as a class name.
|
|
71
|
+
return base.invisibleSubtheme(themeName);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
// can't find anything, return base.
|
|
75
|
+
return base;
|
|
76
|
+
}.property('baseTheme', 'themeName').cacheable(),
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
Detects when the theme changes. Replaces the layer if necessary.
|
|
80
|
+
|
|
81
|
+
Also, because
|
|
82
|
+
*/
|
|
83
|
+
_sc_view_themeDidChange: function() {
|
|
84
|
+
if (this._lastTheme === this.get('theme')) { return; }
|
|
85
|
+
this._lastTheme = this.get('theme');
|
|
86
|
+
|
|
87
|
+
// invalidate child view base themes, if present
|
|
88
|
+
var childViews = this.childViews, len = childViews.length, idx;
|
|
89
|
+
for (idx = 0; idx < len; idx++) {
|
|
90
|
+
childViews[idx].notifyPropertyChange('baseTheme');
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
if (this.get('layer')) { this.replaceLayer(); }
|
|
94
|
+
}.observes('theme'),
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
The SC.Theme instance in which the 'theme' property should look for the theme
|
|
98
|
+
named by 'themeName'.
|
|
99
|
+
|
|
100
|
+
For example, if 'baseTheme' is SC.AceTheme, and 'themeName' is 'popover',
|
|
101
|
+
it will look to see if SC.AceTheme has a child theme named 'popover',
|
|
102
|
+
and _then_, if it is not found, look globally.
|
|
103
|
+
|
|
104
|
+
@private
|
|
105
|
+
@property {SC.Theme}
|
|
106
|
+
*/
|
|
107
|
+
baseTheme: function() {
|
|
108
|
+
var parent;
|
|
109
|
+
var baseThemeName = this.get('baseThemeName');
|
|
110
|
+
if (baseThemeName) {
|
|
111
|
+
return SC.Theme.find(baseThemeName);
|
|
112
|
+
} else {
|
|
113
|
+
parent = this.get('parentView');
|
|
114
|
+
var theme = parent && parent.get('theme');
|
|
115
|
+
return theme || SC.Theme.find(SC.defaultTheme);
|
|
116
|
+
}
|
|
117
|
+
}.property('baseThemeName', 'parentView').cacheable(),
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* Returns the named property if it is specified on the view, and
|
|
121
|
+
* otherwise returns the named constant from the view's theme.
|
|
122
|
+
*
|
|
123
|
+
* @param {String} property The property on the view.
|
|
124
|
+
* @param {String} constantName The name of the constant on the theme.
|
|
125
|
+
*/
|
|
126
|
+
getThemedProperty: function(property, constantName){
|
|
127
|
+
var value = this.get(property);
|
|
128
|
+
if (value !== undefined) { return value; }
|
|
129
|
+
|
|
130
|
+
var theme = this.get('theme');
|
|
131
|
+
if (!theme) { return undefined; }
|
|
132
|
+
|
|
133
|
+
return theme[constantName];
|
|
134
|
+
},
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
The object to which rendering and updating the HTML representation of this
|
|
138
|
+
view should be delegated.
|
|
139
|
+
|
|
140
|
+
By default, views are responsible for creating their own HTML
|
|
141
|
+
representation. In some cases, however, you may want to create an object
|
|
142
|
+
that is responsible for rendering all views of a certain type. For example,
|
|
143
|
+
you may want rendering of SC.ButtonView to be controlled by an object that
|
|
144
|
+
is specific to the current theme.
|
|
145
|
+
|
|
146
|
+
By setting a render delegate, the render and update methods will be called
|
|
147
|
+
on that object instead of the view itself.
|
|
148
|
+
|
|
149
|
+
For your convenience, the view will provide its displayProperties to the
|
|
150
|
+
RenderDelegate. In some cases, you may have a conflict between the RenderDelegate's
|
|
151
|
+
API and your view's. For instance, you may have a 'value' property that is
|
|
152
|
+
any number, but the render delegate expects a percentage. Make a 'displayValue'
|
|
153
|
+
property, add _it_ to displayProperties instead of 'value', and the Render Delegate
|
|
154
|
+
will automatically use that when it wants to find 'value.'
|
|
155
|
+
|
|
156
|
+
You can also set the render delegate by using the 'renderDelegateName' property.
|
|
157
|
+
|
|
158
|
+
@property {Object}
|
|
159
|
+
*/
|
|
160
|
+
renderDelegate: function(key, value) {
|
|
161
|
+
if (value) { this._setRenderDelegate = value; }
|
|
162
|
+
if (this._setRenderDelegate) { return this._setRenderDelegate; }
|
|
163
|
+
|
|
164
|
+
// If this view does not have a render delegate but has
|
|
165
|
+
// renderDelegateName set, try to retrieve the render delegate from the
|
|
166
|
+
// theme.
|
|
167
|
+
var renderDelegateName = this.get('renderDelegateName'), renderDelegate;
|
|
168
|
+
|
|
169
|
+
if (renderDelegateName) {
|
|
170
|
+
renderDelegate = this.get('theme')[renderDelegateName];
|
|
171
|
+
if (!renderDelegate) {
|
|
172
|
+
throw "%@: Unable to locate render delegate \"%@\" in theme.".fmt(this, renderDelegateName);
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
return renderDelegate;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
return null;
|
|
179
|
+
}.property('renderDelegateName', 'theme'),
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
The name of the property of the current theme that contains the render
|
|
183
|
+
delegate to use for this view.
|
|
184
|
+
|
|
185
|
+
By default, views are responsible for creating their own HTML
|
|
186
|
+
representation. You can tell the view to instead delegate rendering to the
|
|
187
|
+
theme by setting this property to the name of the corresponding property
|
|
188
|
+
of the theme.
|
|
189
|
+
|
|
190
|
+
For example, to tell the view that it should render using the
|
|
191
|
+
SC.ButtonView render delegate, set this property to
|
|
192
|
+
'buttonRenderDelegate'. When the view is created, it will retrieve the
|
|
193
|
+
buttonRenderDelegate property from its theme and set the renderDelegate
|
|
194
|
+
property to that object.
|
|
195
|
+
*/
|
|
196
|
+
renderDelegateName: null,
|
|
197
|
+
|
|
198
|
+
/**
|
|
199
|
+
[RO] Pass this object as the data source for render delegates. This proxy object
|
|
200
|
+
for the view relays requests for properties like 'title' to 'displayTitle'
|
|
201
|
+
as necessary.
|
|
202
|
+
|
|
203
|
+
If you ever communicate with your view's render delegate, you should pass this
|
|
204
|
+
object as the data source.
|
|
205
|
+
|
|
206
|
+
The proxy that forwards RenderDelegate requests for properties to the view,
|
|
207
|
+
handling display*, keeps track of the delegate's state, etc.
|
|
208
|
+
*/
|
|
209
|
+
renderDelegateProxy: function() {
|
|
210
|
+
return SC.View._RenderDelegateProxy.createForView(this);
|
|
211
|
+
}.property('renderDelegate').cacheable(),
|
|
212
|
+
|
|
213
|
+
/**
|
|
214
|
+
Invoked whenever your view needs to create its HTML representation.
|
|
215
|
+
|
|
216
|
+
You will normally override this method in your subclassed views to
|
|
217
|
+
provide whatever drawing functionality you will need in order to
|
|
218
|
+
render your content.
|
|
219
|
+
|
|
220
|
+
This method is usually only called once per view. After that, the update
|
|
221
|
+
method will be called to allow you to update the existing HTML
|
|
222
|
+
representation.
|
|
223
|
+
|
|
224
|
+
|
|
225
|
+
The default implementation of this method calls renderChildViews().
|
|
226
|
+
|
|
227
|
+
For backwards compatibility, this method will also call the appropriate
|
|
228
|
+
method on a render delegate object, if your view has one.
|
|
229
|
+
|
|
230
|
+
@param {SC.RenderContext} context the render context
|
|
231
|
+
@returns {void}
|
|
232
|
+
*/
|
|
233
|
+
render: function(context, firstTime) {
|
|
234
|
+
var renderDelegate = this.get('renderDelegate');
|
|
235
|
+
|
|
236
|
+
if (renderDelegate) {
|
|
237
|
+
if (firstTime) {
|
|
238
|
+
renderDelegate.render(this.get('renderDelegateProxy'), context);
|
|
239
|
+
} else {
|
|
240
|
+
renderDelegate.update(this.get('renderDelegateProxy'), context.$());
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
},
|
|
244
|
+
|
|
245
|
+
applyAttributesToContext: function(original, context) {
|
|
246
|
+
var theme = this.get('theme');
|
|
247
|
+
var themeClassNames = theme.classNames, idx, len = themeClassNames.length;
|
|
248
|
+
|
|
249
|
+
for (idx = 0; idx < len; idx++) {
|
|
250
|
+
context.addClass(themeClassNames[idx]);
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
original(context);
|
|
254
|
+
|
|
255
|
+
var renderDelegate = this.get('renderDelegate');
|
|
256
|
+
if (renderDelegate && renderDelegate.name) {
|
|
257
|
+
context.addClass(renderDelegate.name);
|
|
258
|
+
}
|
|
259
|
+
}.enhance()
|
|
260
|
+
});
|
|
261
|
+
|
|
262
|
+
/**
|
|
263
|
+
@class
|
|
264
|
+
@private
|
|
265
|
+
View Render Delegate Proxies are tool SC.Views use to:
|
|
266
|
+
|
|
267
|
+
a) limit properties the render delegate can access to the displayProperties
|
|
268
|
+
b) look up 'display*' ('displayTitle' instead of 'title') to help deal with
|
|
269
|
+
differences between the render delegate's API and the view's.
|
|
270
|
+
|
|
271
|
+
RenderDelegateProxies are fully valid data sources for render delegates. They
|
|
272
|
+
act as proxies to the view, interpreting the .get and .didChangeFor commands
|
|
273
|
+
based on the view's displayProperties.
|
|
274
|
+
|
|
275
|
+
This tool is not useful outside of SC.View itself, and as such, is private.
|
|
276
|
+
*/
|
|
277
|
+
SC.View._RenderDelegateProxy = {
|
|
278
|
+
|
|
279
|
+
// for testing:
|
|
280
|
+
isViewRenderDelegateProxy: YES,
|
|
281
|
+
|
|
282
|
+
/**
|
|
283
|
+
* Creates a View Render Delegate Proxy for the specified view.
|
|
284
|
+
*
|
|
285
|
+
* Implementation note: this creates a hash of the view's displayProperties
|
|
286
|
+
* array so that the proxy may quickly determine whether a property is a
|
|
287
|
+
* displayProperty or not. This could cause issues if the view's displayProperties
|
|
288
|
+
* array is modified after instantiation.
|
|
289
|
+
*
|
|
290
|
+
* @param {SC.View} view The view this proxy should proxy to.
|
|
291
|
+
* @returns SC.View._RenderDelegateProxy
|
|
292
|
+
*/
|
|
293
|
+
createForView: function(view) {
|
|
294
|
+
var ret = SC.beget(this);
|
|
295
|
+
|
|
296
|
+
// set up displayProperty lookup for performance
|
|
297
|
+
var dp = view.get('displayProperties'), lookup = {};
|
|
298
|
+
for (var idx = 0, len = dp.length; idx < len; idx++) {
|
|
299
|
+
lookup[dp[idx]] = YES;
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
// also allow the few special properties through
|
|
303
|
+
lookup.theme = YES;
|
|
304
|
+
|
|
305
|
+
ret._displayPropertiesLookup = lookup;
|
|
306
|
+
ret.renderState = {};
|
|
307
|
+
|
|
308
|
+
ret.view = view;
|
|
309
|
+
return ret;
|
|
310
|
+
},
|
|
311
|
+
|
|
312
|
+
|
|
313
|
+
/**
|
|
314
|
+
* Provides the render delegate with any property it needs.
|
|
315
|
+
*
|
|
316
|
+
* This first looks up whether the property exists in the view's
|
|
317
|
+
* displayProperties, and whether it exists prefixed with 'display';
|
|
318
|
+
* for instance, if the render delegate asks for 'title', this will
|
|
319
|
+
* look for 'displayTitle' in the view's displayProperties array.
|
|
320
|
+
*
|
|
321
|
+
* @param {String} property The name of the property the render delegate needs.
|
|
322
|
+
* @returns The value.
|
|
323
|
+
*/
|
|
324
|
+
get: function(property) {
|
|
325
|
+
if (this[property] !== undefined) { return this[property]; }
|
|
326
|
+
|
|
327
|
+
var displayProperty = 'display' + property.capitalize();
|
|
328
|
+
|
|
329
|
+
if (this._displayPropertiesLookup[displayProperty]) {
|
|
330
|
+
return this.view.get(displayProperty);
|
|
331
|
+
} else if (this._displayPropertiesLookup[property]) {
|
|
332
|
+
return this.view.get(property);
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
return undefined;
|
|
336
|
+
},
|
|
337
|
+
|
|
338
|
+
/**
|
|
339
|
+
* Checks if any of the specified properties have changed.
|
|
340
|
+
*
|
|
341
|
+
* For each property passed, this first determines whether to use the
|
|
342
|
+
* 'display' prefix. Then, it calls view.didChangeFor with context and that
|
|
343
|
+
* property name.
|
|
344
|
+
*
|
|
345
|
+
*/
|
|
346
|
+
didChangeFor: function(context) {
|
|
347
|
+
var len = arguments.length, idx;
|
|
348
|
+
for (idx = 1; idx < len; idx++) {
|
|
349
|
+
var property = arguments[idx],
|
|
350
|
+
displayProperty = 'display' + property.capitalize();
|
|
351
|
+
|
|
352
|
+
if (this._displayPropertiesLookup[displayProperty]) {
|
|
353
|
+
if (this.view.didChangeFor(context, displayProperty)) { return YES; }
|
|
354
|
+
} else if (this._displayPropertiesLookup[property]) {
|
|
355
|
+
if (this.view.didChangeFor(context, property)) { return YES; }
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
return NO;
|
|
360
|
+
}
|
|
361
|
+
};
|
|
362
|
+
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
sc_require("views/view");
|
|
2
|
+
|
|
3
|
+
SC.View.reopen(
|
|
4
|
+
/** @scope SC.View.prototype */ {
|
|
5
|
+
|
|
6
|
+
// ..........................................................
|
|
7
|
+
// MULTITOUCH SUPPORT
|
|
8
|
+
//
|
|
9
|
+
/**
|
|
10
|
+
Set to YES if you want to receive touch events for each distinct touch (rather than only
|
|
11
|
+
the first touch start and last touch end).
|
|
12
|
+
*/
|
|
13
|
+
acceptsMultitouch: NO,
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
Is YES if the view is currently being touched. NO otherwise.
|
|
17
|
+
*/
|
|
18
|
+
hasTouch: NO,
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
A boundary set of distances outside which the touch will not be considered "inside" the view anymore.
|
|
22
|
+
|
|
23
|
+
By default, up to 50px on each side.
|
|
24
|
+
*/
|
|
25
|
+
touchBoundary: { left: 50, right: 50, top: 50, bottom: 50 },
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
@private
|
|
29
|
+
A computed property based on frame.
|
|
30
|
+
*/
|
|
31
|
+
_touchBoundaryFrame: function (){
|
|
32
|
+
return this.get("parentView").convertFrameToView(this.get('frame'), null);
|
|
33
|
+
}.property("frame", "parentView").cacheable(),
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
Returns YES if the provided touch is within the boundary.
|
|
37
|
+
*/
|
|
38
|
+
touchIsInBoundary: function(touch) {
|
|
39
|
+
var f = this.get("_touchBoundaryFrame"), maxX = 0, maxY = 0, boundary = this.get("touchBoundary");
|
|
40
|
+
var x = touch.pageX, y = touch.pageY;
|
|
41
|
+
|
|
42
|
+
if (x < f.x) {
|
|
43
|
+
x = f.x - x;
|
|
44
|
+
maxX = boundary.left;
|
|
45
|
+
} else if (x > f.x + f.width) {
|
|
46
|
+
x = x - (f.x + f.width);
|
|
47
|
+
maxX = boundary.right;
|
|
48
|
+
} else {
|
|
49
|
+
x = 0;
|
|
50
|
+
maxX = 1;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
if (y < f.y) {
|
|
54
|
+
y = f.y - y;
|
|
55
|
+
maxY = boundary.top;
|
|
56
|
+
} else if (y > f.y + f.height) {
|
|
57
|
+
y = y - (f.y + f.height);
|
|
58
|
+
maxY = boundary.bottom;
|
|
59
|
+
} else {
|
|
60
|
+
y = 0;
|
|
61
|
+
maxY = 1;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
if (x > 100 || y > 100) return NO;
|
|
65
|
+
return YES;
|
|
66
|
+
}
|
|
67
|
+
});
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
sc_require("views/view");
|
|
2
|
+
|
|
3
|
+
SC.View.reopen(
|
|
4
|
+
/** @scope SC.View.prototype */ {
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
YES only if the view and all of its parent views are currently visible
|
|
8
|
+
in the window. This property is used to optimize certain behaviors in
|
|
9
|
+
the view. For example, updates to the view layer are not performed
|
|
10
|
+
if the view until the view becomes visible in the window.
|
|
11
|
+
*/
|
|
12
|
+
isVisibleInWindow: NO,
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
By default we don't disable the context menu. Overriding this property
|
|
16
|
+
can enable/disable the context menu per view.
|
|
17
|
+
*/
|
|
18
|
+
isContextMenuEnabled: function() {
|
|
19
|
+
return SC.CONTEXT_MENU_ENABLED;
|
|
20
|
+
}.property(),
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
Recomputes the isVisibleInWindow property based on the visibility of the
|
|
24
|
+
view and its parent. If the recomputed value differs from the current
|
|
25
|
+
isVisibleInWindow state, this method will also call
|
|
26
|
+
recomputIsVisibleInWindow() on its child views as well. As an optional
|
|
27
|
+
optimization, you can pass the isVisibleInWindow state of the parentView
|
|
28
|
+
if you already know it.
|
|
29
|
+
|
|
30
|
+
You will not generally need to call or override this method yourself. It
|
|
31
|
+
is used by the SC.View hierarchy to relay window visibility changes up
|
|
32
|
+
and down the chain.
|
|
33
|
+
|
|
34
|
+
@property {Boolean} parentViewIsVisible
|
|
35
|
+
@returns {SC.View} receiver
|
|
36
|
+
*/
|
|
37
|
+
recomputeIsVisibleInWindow: function(parentViewIsVisible) {
|
|
38
|
+
var previous = this.get('isVisibleInWindow'),
|
|
39
|
+
current = this.get('isVisible'),
|
|
40
|
+
parentView;
|
|
41
|
+
|
|
42
|
+
// isVisibleInWindow = isVisible && parentView.isVisibleInWindow
|
|
43
|
+
// this approach only goes up to the parentView if necessary.
|
|
44
|
+
if (current) {
|
|
45
|
+
// If we weren't passed in 'parentViewIsVisible' (we generally aren't;
|
|
46
|
+
// it's an optimization), then calculate it.
|
|
47
|
+
if (parentViewIsVisible === undefined) {
|
|
48
|
+
parentView = this.get('parentView');
|
|
49
|
+
parentViewIsVisible = parentView ? parentView.get('isVisibleInWindow') : NO;
|
|
50
|
+
}
|
|
51
|
+
current = current && parentViewIsVisible;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// If our visibility has changed, then set the new value and notify our
|
|
55
|
+
// child views to update their value.
|
|
56
|
+
if (previous !== current) {
|
|
57
|
+
this.set('isVisibleInWindow', current);
|
|
58
|
+
|
|
59
|
+
var childViews = this.get('childViews'), len = childViews.length, idx, view;
|
|
60
|
+
for(idx=0;idx<len;idx++) {
|
|
61
|
+
view = childViews[idx];
|
|
62
|
+
if(view.recomputeIsVisibleInWindow) { view.recomputeIsVisibleInWindow(current); }
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
// For historical reasons, we'll also layout the child views if
|
|
66
|
+
// necessary.
|
|
67
|
+
if (current) {
|
|
68
|
+
if (this.get('childViewsNeedLayout')) { this.invokeOnce(this.layoutChildViewsIfNeeded); }
|
|
69
|
+
}
|
|
70
|
+
else {
|
|
71
|
+
// Also, if we were previously visible and were the first responder,
|
|
72
|
+
// resign it. This more appropriately belongs in a
|
|
73
|
+
// 'isVisibleInWindow' observer or some such helper method because
|
|
74
|
+
// this work is not strictly related to computing the visibility, but
|
|
75
|
+
// view performance is critical, so avoiding the extra observer is
|
|
76
|
+
// worthwhile.
|
|
77
|
+
if (this.get('isFirstResponder')) { this.resignFirstResponder(); }
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
// If we're in this function, then that means one of our ancestor views
|
|
82
|
+
// changed, or changed its 'isVisibleInWindow' value. That means that if
|
|
83
|
+
// we are out of sync with the layer, then we need to update our state
|
|
84
|
+
// now.
|
|
85
|
+
//
|
|
86
|
+
// For example, say we're isVisible=NO, but we have not yet added the
|
|
87
|
+
// 'hidden' class to the layer because of the "don't update the layer if
|
|
88
|
+
// we're not visible in the window" check. If any of our parent views
|
|
89
|
+
// became visible, our layer would incorrectly be shown!
|
|
90
|
+
this.updateLayerIfNeeded(YES);
|
|
91
|
+
|
|
92
|
+
return this;
|
|
93
|
+
},
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
/** @private
|
|
97
|
+
Whenever the view's visibility changes, we need to recompute whether it is
|
|
98
|
+
actually visible inside the window (a view is only visible in the window
|
|
99
|
+
if it is marked as visibile and its parent view is as well), in addition
|
|
100
|
+
to updating the layer accordingly.
|
|
101
|
+
*/
|
|
102
|
+
_sc_isVisibleDidChange: function() {
|
|
103
|
+
// 'isVisible' is effectively a displayProperty, but we'll call
|
|
104
|
+
// displayDidChange() manually here instead of declaring it as a
|
|
105
|
+
// displayProperty because that avoids having two observers on
|
|
106
|
+
// 'isVisible'. A single observer is:
|
|
107
|
+
// a. More efficient
|
|
108
|
+
// b. More correct, because we can guarantee the order of operations
|
|
109
|
+
this.displayDidChange();
|
|
110
|
+
|
|
111
|
+
this.recomputeIsVisibleInWindow();
|
|
112
|
+
}.observes('isVisible')
|
|
113
|
+
})
|