sproutcore 1.6.0.beta.3 → 1.6.0.rc.1
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +33 -0
- data/Rakefile +213 -10
- data/VERSION.yml +1 -1
- data/lib/Buildfile +5 -1
- data/lib/buildtasks/manifest.rake +7 -1
- data/lib/frameworks/sproutcore/Buildfile +3 -2
- data/lib/frameworks/sproutcore/CHANGELOG.md +154 -1
- data/lib/frameworks/sproutcore/README.md +1 -1
- data/lib/frameworks/sproutcore/apps/welcome/english.lproj/main_page.css +9 -0
- data/lib/frameworks/sproutcore/frameworks/ajax/system/request.js +254 -207
- data/lib/frameworks/sproutcore/frameworks/ajax/system/response.js +243 -172
- data/lib/frameworks/sproutcore/frameworks/ajax/tests/system/request.js +29 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/controllers/array.js +5 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/controls/button.js +6 -2
- data/lib/frameworks/sproutcore/frameworks/core_foundation/ext/handlebars/bind.js +36 -14
- data/lib/frameworks/sproutcore/frameworks/core_foundation/ext/handlebars/collection.js +3 -3
- data/lib/frameworks/sproutcore/frameworks/core_foundation/panes/pane.js +14 -15
- data/lib/frameworks/sproutcore/frameworks/core_foundation/panes/template.js +14 -14
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/application.js +2 -7
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/event.js +3 -3
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/platform.js +2 -2
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/responder.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/root_responder.js +20 -12
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/string.js +61 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/utils.js +20 -6
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/controllers/array/array_case.js +42 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/controls/button.js +39 -57
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/system/render_context/helpers_style.js +5 -3
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/system/sparse_array.js +32 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/template/collection.js +25 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/template/handlebars.js +28 -17
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/keyboard.js +396 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/view.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/core_foundation/{system → views}/bindable_span.js +2 -1
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/template_collection.js +78 -51
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view.js +4 -3
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/enabled.js +2 -1
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/keyboard.js +233 -67
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/manipulation.js +3 -1
- data/lib/frameworks/sproutcore/frameworks/core_tools/core.js +8 -2
- data/lib/frameworks/sproutcore/frameworks/core_tools/data_source.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/core_tools/models/target.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/datastore/data_sources/data_source.js +15 -8
- data/lib/frameworks/sproutcore/frameworks/datastore/models/child_record.js +2 -2
- data/lib/frameworks/sproutcore/frameworks/datastore/models/record_attribute.js +1 -0
- data/lib/frameworks/sproutcore/frameworks/datastore/system/child_array.js +3 -2
- data/lib/frameworks/sproutcore/frameworks/datastore/system/record_array.js +66 -55
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/data_sources/data_source.js +190 -0
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/models/nested_records/nested_record_array.js +21 -0
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/models/record_attribute.js +15 -1
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/record_array/flush.js +0 -1
- data/lib/frameworks/sproutcore/frameworks/datetime/frameworks/core/system/datetime.js +212 -182
- data/lib/frameworks/sproutcore/frameworks/datetime/frameworks/localized/system/datetime.js +14 -16
- data/lib/frameworks/sproutcore/frameworks/desktop/mixins/collection_row_delegate.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/desktop/panes/menu.js +23 -11
- data/lib/frameworks/sproutcore/frameworks/desktop/resources/alert.css +49 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/{english.lproj → resources}/debug/a_sample_image.jpg +0 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/{english.lproj → resources}/debug/apple-logo1.jpeg +0 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/{english.lproj → resources}/debug/iframe.html +0 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/resources/disclosure.css +20 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/{english.lproj → resources}/drag.css +1 -1
- data/lib/frameworks/sproutcore/frameworks/desktop/resources/icons.css +214 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/{english.lproj → resources}/images/cap.png +0 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/{english.lproj → resources}/images/downbutton.png +0 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/resources/images/icons/sc-icon-alert-16.png +0 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/resources/images/icons/sc-icon-alert-24.png +0 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/resources/images/icons/sc-icon-alert-48.png +0 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/resources/images/icons/sc-icon-bookmark-16.png +0 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/resources/images/icons/sc-icon-bookmark-24.png +0 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/resources/images/icons/sc-icon-cancel-24.png +0 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/resources/images/icons/sc-icon-document-16.png +0 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/resources/images/icons/sc-icon-document-24.png +0 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/resources/images/icons/sc-icon-down-24.png +0 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/resources/images/icons/sc-icon-error-48.png +0 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/resources/images/icons/sc-icon-favorite-16.png +0 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/resources/images/icons/sc-icon-favorite-24.png +0 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/resources/images/icons/sc-icon-folder-16.png +0 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/resources/images/icons/sc-icon-folder-24.png +0 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/resources/images/icons/sc-icon-group-16.png +0 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/resources/images/icons/sc-icon-group-24.png +0 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/resources/images/icons/sc-icon-help-16.png +0 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/resources/images/icons/sc-icon-help-24.png +0 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/resources/images/icons/sc-icon-info-16.png +0 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/resources/images/icons/sc-icon-info-24.png +0 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/resources/images/icons/sc-icon-info-48.png +0 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/resources/images/icons/sc-icon-left-24.png +0 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/resources/images/icons/sc-icon-options-16.png +0 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/resources/images/icons/sc-icon-options-24.png +0 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/resources/images/icons/sc-icon-redo-24.png +0 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/resources/images/icons/sc-icon-right-24.png +0 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/resources/images/icons/sc-icon-tools-24.png +0 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/resources/images/icons/sc-icon-trash-16.png +0 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/resources/images/icons/sc-icon-trash-24.png +0 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/resources/images/icons/sc-icon-undo-24.png +0 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/resources/images/icons/sc-icon-up-24.png +0 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/resources/images/icons/sc-icon-user-16.png +0 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/resources/images/icons/sc-icon-user-24.png +0 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/{english.lproj → resources}/images/thumb-bottom.png +0 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/{english.lproj → resources}/images/thumb-center.png +0 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/{english.lproj → resources}/images/thumb-top.png +0 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/{english.lproj → resources}/images/track.png +0 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/{english.lproj → resources}/images/upbutton.png +0 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/resources/list_item.css +145 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/resources/menu.css +10 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/resources/menu_item_view.css +88 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/{english.lproj → resources}/modal.css +3 -4
- data/lib/frameworks/sproutcore/frameworks/desktop/resources/panel.css +91 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/resources/picker.css +37 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/resources/progress.css +29 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/resources/radio.css +11 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/resources/segmented.css +121 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/resources/separator.css +20 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/resources/slider.css +34 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/{english.lproj → resources}/split.css +0 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/{english.lproj → resources}/split_divider.css +0 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/{english.lproj → resources}/tab.css +0 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/{english.lproj → resources}/toolbar.css +0 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/{english.lproj → resources}/touch-scroller.css +13 -13
- data/lib/frameworks/sproutcore/frameworks/desktop/resources/well.css +65 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/checkbox/methods.js +114 -103
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/static_content.js +3 -2
- data/lib/frameworks/sproutcore/frameworks/desktop/views/checkbox.js +7 -6
- data/lib/frameworks/sproutcore/frameworks/desktop/views/collection.js +18 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/views/popup_button.js +4 -7
- data/lib/frameworks/sproutcore/frameworks/desktop/views/segmented.js +9 -2
- data/lib/frameworks/sproutcore/frameworks/desktop/{panes → views}/select_button.js +43 -0
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/forms/views/form.js +35 -33
- data/lib/frameworks/sproutcore/frameworks/foundation/core.js +2 -2
- data/lib/frameworks/sproutcore/frameworks/foundation/mixins/auto_resize.js +15 -8
- data/lib/frameworks/sproutcore/frameworks/foundation/mixins/button.js +4 -7
- data/lib/frameworks/sproutcore/frameworks/foundation/mixins/flowed_layout.js +55 -13
- data/lib/frameworks/sproutcore/frameworks/foundation/render_delegates/canvas_image.js +3 -1
- data/lib/frameworks/sproutcore/frameworks/foundation/render_delegates/render_delegate.js +7 -7
- data/lib/frameworks/sproutcore/frameworks/foundation/{english.lproj → resources}/benchmark.css +0 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/{english.lproj → resources}/blank.gif +0 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/{english.lproj → resources}/bootstrap.rhtml +0 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/resources/button_view.css +36 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/{english.lproj → resources}/checkbox_view.css +0 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/{english.lproj → resources}/debug/control-test-pane.css +0 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/{english.lproj → resources}/images/favicon.ico +0 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/{english.lproj → resources}/images/sproutcore-logo.png +0 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/{english.lproj → resources}/images/sproutcore-startup-landscape.jpg +0 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/{english.lproj → resources}/images/sproutcore-startup-landscape.png +0 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/{english.lproj → resources}/images/sproutcore-startup-portrait.jpg +0 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/{english.lproj → resources}/images/sproutcore-startup-portrait.png +0 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/{english.lproj → resources}/images/sproutcore-startup.png +0 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/{english.lproj → resources}/images/sproutcore.png +0 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/{english.lproj → resources}/inline_editor.css +0 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/resources/label.css +47 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/{english.lproj → resources}/radio_view.css +0 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/{english.lproj → resources}/static_layout.css +1 -1
- data/lib/frameworks/sproutcore/frameworks/foundation/resources/text_field.css +130 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/system/chance.js +5 -1
- data/lib/frameworks/sproutcore/frameworks/foundation/system/string.js +0 -43
- data/lib/frameworks/sproutcore/frameworks/foundation/system/utils/string_measurement.js +5 -2
- data/lib/frameworks/sproutcore/frameworks/foundation/validators/date.js +4 -4
- data/lib/frameworks/sproutcore/frameworks/foundation/views/container.js +4 -5
- data/lib/frameworks/sproutcore/frameworks/foundation/views/label.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/foundation/views/text_field.js +5 -5
- data/lib/frameworks/sproutcore/frameworks/routing/system/routes.js +6 -3
- data/lib/frameworks/sproutcore/frameworks/routing/tests/system/routes.js +11 -0
- data/lib/frameworks/sproutcore/frameworks/runtime/core.js +2 -2
- data/lib/frameworks/sproutcore/frameworks/runtime/mixins/array.js +2 -2
- data/lib/frameworks/sproutcore/frameworks/runtime/private/property_chain.js +2 -2
- data/lib/frameworks/sproutcore/frameworks/runtime/system/error.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/runtime/system/logger.js +2 -2
- data/lib/frameworks/sproutcore/frameworks/runtime/system/object.js +2 -2
- data/lib/frameworks/sproutcore/frameworks/statechart/debug/monitor.js +4 -73
- data/lib/frameworks/sproutcore/frameworks/statechart/debug/sequence_matcher.js +189 -0
- data/lib/frameworks/sproutcore/frameworks/statechart/ext/function.js +122 -0
- data/lib/frameworks/sproutcore/frameworks/statechart/system/async.js +88 -0
- data/lib/frameworks/sproutcore/frameworks/statechart/system/empty_state.js +34 -0
- data/lib/frameworks/sproutcore/frameworks/statechart/system/history_state.js +97 -0
- data/lib/frameworks/sproutcore/frameworks/statechart/system/state.js +7 -189
- data/lib/frameworks/sproutcore/frameworks/statechart/system/statechart.js +14 -78
- data/lib/frameworks/sproutcore/frameworks/statechart/tests/debug/sequence_matcher.js +464 -0
- data/lib/frameworks/sproutcore/frameworks/statechart/tests/event_handling/basic/with_concurrent_states.js +31 -11
- data/lib/frameworks/sproutcore/frameworks/statechart/tests/state_transitioning/async/with_concurrent_states.js +6 -4
- data/lib/frameworks/sproutcore/frameworks/statechart/tests/state_transitioning/standard/with_concurrent_states/advanced.js +40 -6
- data/lib/frameworks/sproutcore/frameworks/statechart/tests/state_transitioning/standard/with_concurrent_states/basic.js +22 -2
- data/lib/frameworks/sproutcore/frameworks/statechart/tests/state_transitioning/standard/with_concurrent_states/intermediate.js +44 -3
- data/lib/frameworks/sproutcore/frameworks/testing/core.js +61 -9
- data/lib/frameworks/sproutcore/frameworks/testing/{english.lproj → resources}/additions.css +0 -0
- data/lib/frameworks/sproutcore/frameworks/testing/{english.lproj → resources}/runner.css +11 -2
- data/lib/frameworks/sproutcore/frameworks/testing/{english.lproj → resources}/testsuite.css +0 -0
- data/lib/frameworks/sproutcore/frameworks/testing/system/runner.js +66 -27
- data/lib/frameworks/sproutcore/frameworks/testing/tests/spy_on.js +41 -0
- data/lib/frameworks/sproutcore/frameworks/testing/tests/stub_method.js +9 -0
- data/lib/frameworks/sproutcore/frameworks/yuireset/resources/core.css +24 -0
- data/lib/frameworks/sproutcore/frameworks/yuireset/resources/fonts.css +39 -0
- data/lib/frameworks/sproutcore/frameworks/yuireset/resources/reset.css +126 -0
- data/lib/frameworks/sproutcore/frameworks/yuireset/resources/view.css +57 -0
- data/lib/frameworks/sproutcore/lib/index.rhtml +7 -4
- data/lib/frameworks/sproutcore/themes/ace/resources/checkbox/ace/14px/checkbox_checked.png +0 -0
- data/lib/frameworks/sproutcore/themes/ace/resources/checkbox/ace/14px/checkbox_checked_active.png +0 -0
- data/lib/frameworks/sproutcore/themes/ace/resources/checkbox/ace/14px/checkbox_mixed.png +0 -0
- data/lib/frameworks/sproutcore/themes/ace/resources/checkbox/ace/14px/checkbox_mixed_active.png +0 -0
- data/lib/frameworks/sproutcore/themes/ace/resources/checkbox/ace/14px/checkbox_unchecked.png +0 -0
- data/lib/frameworks/sproutcore/themes/ace/resources/checkbox/ace/14px/checkbox_unchecked_active.png +0 -0
- data/lib/frameworks/sproutcore/themes/ace/resources/checkbox/ace/16px/checkbox_checked.png +0 -0
- data/lib/frameworks/sproutcore/themes/ace/resources/checkbox/ace/16px/checkbox_checked_active.png +0 -0
- data/lib/frameworks/sproutcore/themes/ace/resources/checkbox/ace/16px/checkbox_mixed.png +0 -0
- data/lib/frameworks/sproutcore/themes/ace/resources/checkbox/ace/16px/checkbox_mixed_active.png +0 -0
- data/lib/frameworks/sproutcore/themes/ace/resources/checkbox/ace/16px/checkbox_unchecked.png +0 -0
- data/lib/frameworks/sproutcore/themes/ace/resources/checkbox/ace/16px/checkbox_unchecked_active.png +0 -0
- data/lib/frameworks/sproutcore/themes/ace/resources/collection/normal/list.css +13 -4
- data/lib/frameworks/sproutcore/themes/ace/resources/collection/normal/list_item.css +16 -14
- data/lib/frameworks/sproutcore/themes/ace/resources/menu/menu_item.png +0 -0
- data/lib/gen/app/templates/apps/@target_name@/Buildfile +1 -4
- data/lib/gen/app/templates/apps/@target_name@/core.js +1 -4
- data/lib/gen/app/templates/apps/@target_name@/main.js +1 -4
- data/lib/gen/app/templates/apps/@target_name@/resources/main_page.js +1 -4
- data/lib/gen/app/templates/apps/@target_name@/theme.js +1 -4
- data/lib/gen/controller/templates/controllers/{@filename@.js → @filename@_controller.js} +1 -4
- data/lib/gen/controller/templates/tests/controllers/{@filename@.js → @filename@_test.js} +1 -4
- data/lib/gen/data-source/templates/data_sources/{@filename@.js → @filename@_data_source.js} +1 -4
- data/lib/gen/design/templates/resources/@filename@.js +1 -4
- data/lib/gen/framework/templates/frameworks/@target_name@/core.js +1 -4
- data/lib/gen/framework/templates/frameworks/@target_name@/english.lproj/strings.js +1 -4
- data/lib/gen/html_app/templates/apps/@target_name@/@target_name@.js +1 -4
- data/lib/gen/html_app/templates/apps/@target_name@/resources/stylesheets/@target_name@.css +2 -0
- data/lib/gen/html_project/templates/@filename@/Buildfile +1 -4
- data/lib/gen/html_project/templates/@filename@/README +1 -4
- data/lib/gen/language/templates/@filename@/strings.js +1 -4
- data/lib/gen/model/templates/fixtures/{@filename@.js → @filename@_fixtures.js} +2 -5
- data/lib/gen/model/templates/models/{@filename@.js → @filename@_model.js} +1 -4
- data/lib/gen/model/templates/tests/models/{@filename@.js → @filename@_test.js} +1 -4
- data/lib/gen/page/templates/pages/@target_name@/Buildfile +1 -4
- data/lib/gen/page/templates/pages/@target_name@/core.js +1 -4
- data/lib/gen/page/templates/pages/@target_name@/en.lproj/strings.js +1 -4
- data/lib/gen/page/templates/pages/@target_name@/resources/body.css +3 -1
- data/lib/gen/project/templates/@filename@/Buildfile +1 -4
- data/lib/gen/project/templates/@filename@/README +1 -5
- data/lib/gen/responder/templates/states/{@filename@.js → @filename@_state.js} +1 -4
- data/lib/gen/test/templates/tests/{@filename@.js → @filename@_test.js} +1 -4
- data/lib/gen/theme/templates/themes/@target_name@/resources/theme_styles.css +1 -5
- data/lib/gen/theme/templates/themes/@target_name@/theme.js +1 -4
- data/lib/gen/view/templates/tests/views/{@filename@.js → @filename@_test.js} +1 -4
- data/lib/gen/view/templates/views/{@filename@.js → @filename@_view.js} +1 -4
- data/lib/sproutcore.rb +4 -1
- data/lib/sproutcore/builders/handlebars.rb +1 -1
- data/lib/sproutcore/builders/module.rb +2 -2
- data/lib/sproutcore/helpers/static_helper.rb +4 -2
- data/lib/sproutcore/models/generator.rb +22 -0
- data/lib/sproutcore/models/manifest_entry.rb +1 -0
- data/lib/sproutcore/models/target.rb +4 -1
- data/lib/sproutcore/rack/builder.rb +3 -0
- data/lib/sproutcore/tools.rb +11 -11
- data/lib/sproutcore/tools/init.rb +10 -22
- data/lib/sproutcore/tools/manifest.rb +21 -22
- data/spec/buildtasks/manifest/prepare_build_tasks/combine_spec.rb +21 -1
- data/spec/fixtures/ordered_entries/apps/template_style/a.js +0 -0
- data/spec/fixtures/ordered_entries/apps/template_style/template_style.js +0 -0
- data/spec/lib/buildfile_commands/build_task_spec.rb +1 -1
- data/spec/lib/tools/manifest_spec.rb +11 -0
- data/sproutcore.gemspec +2 -2
- data/vendor/chance/lib/chance/instance.rb +3 -1
- metadata +118 -74
- data/lib/frameworks/sproutcore/frameworks/core_foundation/resources/core.css +0 -378
- data/lib/frameworks/sproutcore/frameworks/core_foundation/resources/view.css +0 -57
- data/lib/frameworks/sproutcore/frameworks/desktop/english.lproj/alert.css +0 -56
- data/lib/frameworks/sproutcore/frameworks/desktop/english.lproj/disclosure.css +0 -73
- data/lib/frameworks/sproutcore/frameworks/desktop/english.lproj/icons.css +0 -916
- data/lib/frameworks/sproutcore/frameworks/desktop/english.lproj/images/icons/shared.png +0 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/english.lproj/list_item.css +0 -185
- data/lib/frameworks/sproutcore/frameworks/desktop/english.lproj/menu.css +0 -12
- data/lib/frameworks/sproutcore/frameworks/desktop/english.lproj/menu_item_view.css +0 -101
- data/lib/frameworks/sproutcore/frameworks/desktop/english.lproj/panel.css +0 -91
- data/lib/frameworks/sproutcore/frameworks/desktop/english.lproj/picker.css +0 -35
- data/lib/frameworks/sproutcore/frameworks/desktop/english.lproj/progress.css +0 -33
- data/lib/frameworks/sproutcore/frameworks/desktop/english.lproj/radio.css +0 -10
- data/lib/frameworks/sproutcore/frameworks/desktop/english.lproj/segmented.css +0 -132
- data/lib/frameworks/sproutcore/frameworks/desktop/english.lproj/separator.css +0 -19
- data/lib/frameworks/sproutcore/frameworks/desktop/english.lproj/slider.css +0 -69
- data/lib/frameworks/sproutcore/frameworks/desktop/english.lproj/strings.js +0 -14
- data/lib/frameworks/sproutcore/frameworks/desktop/english.lproj/well.css +0 -71
- data/lib/frameworks/sproutcore/frameworks/foundation/english.lproj/button_view.css +0 -40
- data/lib/frameworks/sproutcore/frameworks/foundation/english.lproj/label.css +0 -47
- data/lib/frameworks/sproutcore/frameworks/foundation/english.lproj/text_field.css +0 -146
- data/lib/frameworks/sproutcore/themes/empty_theme/tests/mini_icons.rhtml +0 -69
@@ -0,0 +1,122 @@
|
|
1
|
+
// ==========================================================================
|
2
|
+
// Project: SC.Statechart - A Statechart Framework for SproutCore
|
3
|
+
// Copyright: ©2010, 2011 Michael Cohen, and contributors.
|
4
|
+
// Portions @2011 Apple Inc. All rights reserved.
|
5
|
+
// License: Licensed under MIT license (see license.js)
|
6
|
+
// ==========================================================================
|
7
|
+
|
8
|
+
/*globals SC */
|
9
|
+
|
10
|
+
/**
|
11
|
+
Extends the JS Function object with the handleEvents method that
|
12
|
+
will provide more advanced event handling capabilities when constructing
|
13
|
+
your statechart's states.
|
14
|
+
|
15
|
+
By default, when you add a method to a state, the state will react to
|
16
|
+
events that matches a method's name, like so:
|
17
|
+
|
18
|
+
{{{
|
19
|
+
|
20
|
+
state = SC.State.extend({
|
21
|
+
|
22
|
+
// Will be invoked when a event named "foo" is sent to this state
|
23
|
+
foo: function(event, sender, context) { ... }
|
24
|
+
|
25
|
+
})
|
26
|
+
|
27
|
+
}}}
|
28
|
+
|
29
|
+
In some situations, it may be advantageous to use one method that can react to
|
30
|
+
multiple events instead of having multiple methods that essentially all do the
|
31
|
+
same thing. In order to set a method to handle more than one event you use
|
32
|
+
the handleEvents method which can be supplied a list of string and/or regular
|
33
|
+
expressions. The following example demonstrates the use of handleEvents:
|
34
|
+
|
35
|
+
{{{
|
36
|
+
|
37
|
+
state = SC.State.extend({
|
38
|
+
|
39
|
+
eventHandlerA: function(event, sender, context) {
|
40
|
+
|
41
|
+
}.handleEvents('foo', 'bar'),
|
42
|
+
|
43
|
+
eventHandlerB: function(event, sender, context) {
|
44
|
+
|
45
|
+
}.handleEvents(/num\d/, 'decimal')
|
46
|
+
|
47
|
+
})
|
48
|
+
|
49
|
+
}}}
|
50
|
+
|
51
|
+
Whenever events 'foo' and 'bar' are sent to the state, the method eventHandlerA
|
52
|
+
will be invoked. When there is an event that matches the regular expression
|
53
|
+
/num\d/ or the event is 'decimal' then eventHandlerB is invoked. In both
|
54
|
+
cases, the name of the event will be supplied to the event handler.
|
55
|
+
|
56
|
+
It should be noted that the use of regular expressions may impact performance
|
57
|
+
since that statechart will not be able to fully optimize the event handling logic based
|
58
|
+
on its use. Therefore the use of regular expression should be used sparingly.
|
59
|
+
|
60
|
+
@param {(String|RegExp)...} args
|
61
|
+
*/
|
62
|
+
Function.prototype.handleEvents = function() {
|
63
|
+
this.isEventHandler = YES;
|
64
|
+
this.events = arguments;
|
65
|
+
return this;
|
66
|
+
};
|
67
|
+
|
68
|
+
/**
|
69
|
+
Extends the JS Function object with the stateObserves method that will
|
70
|
+
create a state observe handler on a given state object.
|
71
|
+
|
72
|
+
Use a stateObserves() instead of the common observes() method when you want a
|
73
|
+
state to observer changes to some property on the state itself or some other
|
74
|
+
object.
|
75
|
+
|
76
|
+
Any method on the state that has stateObserves is considered a state observe
|
77
|
+
handler and behaves just like when you use observes() on a method, but with an
|
78
|
+
important difference. When you apply stateObserves to a method on a state, those
|
79
|
+
methods will be active *only* when the state is entered, otherwise those methods
|
80
|
+
will be inactive. This removes the need for you having to explicitly call
|
81
|
+
addObserver and removeObserver. As an example:
|
82
|
+
|
83
|
+
{{{
|
84
|
+
|
85
|
+
state = SC.State.extend({
|
86
|
+
|
87
|
+
foo: null,
|
88
|
+
|
89
|
+
user: null,
|
90
|
+
|
91
|
+
observeHandlerA: function(target, key) {
|
92
|
+
|
93
|
+
}.stateObserves('MyApp.someController.status'),
|
94
|
+
|
95
|
+
observeHandlerB: function(target, key) {
|
96
|
+
|
97
|
+
}.stateObserves('foo'),
|
98
|
+
|
99
|
+
observeHandlerC: function(target, key) {
|
100
|
+
|
101
|
+
}.stateObserves('.user.name', '.user.salary')
|
102
|
+
|
103
|
+
})
|
104
|
+
|
105
|
+
}}}
|
106
|
+
|
107
|
+
Above, state has three state observe handlers: observeHandlerA, observeHandlerB, and
|
108
|
+
observeHandlerC. When state is entered, the state will automatically add itself as
|
109
|
+
an observer for all of its registered state observe handlers. Therefore when
|
110
|
+
foo changes, observeHandlerB will be invoked, and when MyApp.someController's status
|
111
|
+
changes then observeHandlerA will be invoked. The moment that state is exited then
|
112
|
+
the state will automatically remove itself as an observer for all of its registered
|
113
|
+
state observe handlers. Therefore none of the state observe handlers will be
|
114
|
+
invoked until the next time the state is entered.
|
115
|
+
|
116
|
+
@param {String...} args
|
117
|
+
*/
|
118
|
+
Function.prototype.stateObserves = function() {
|
119
|
+
this.isStateObserveHandler = YES;
|
120
|
+
this.args = SC.A(arguments);
|
121
|
+
return this;
|
122
|
+
};
|
@@ -0,0 +1,88 @@
|
|
1
|
+
// ==========================================================================
|
2
|
+
// Project: SC.Statechart - A Statechart Framework for SproutCore
|
3
|
+
// Copyright: ©2010, 2011 Michael Cohen, and contributors.
|
4
|
+
// Portions @2011 Apple Inc. All rights reserved.
|
5
|
+
// License: Licensed under MIT license (see license.js)
|
6
|
+
// ==========================================================================
|
7
|
+
|
8
|
+
/*globals SC */
|
9
|
+
|
10
|
+
/**
|
11
|
+
@class
|
12
|
+
|
13
|
+
Represents a call that is intended to be asynchronous. This is
|
14
|
+
used during a state transition process when either entering or
|
15
|
+
exiting a state.
|
16
|
+
|
17
|
+
@extends SC.Object
|
18
|
+
@author Michael Cohen
|
19
|
+
*/
|
20
|
+
SC.Async = SC.Object.extend(
|
21
|
+
/** @scope SC.Async.prototype */{
|
22
|
+
|
23
|
+
func: null,
|
24
|
+
|
25
|
+
arg1: null,
|
26
|
+
|
27
|
+
arg2: null,
|
28
|
+
|
29
|
+
/** @private
|
30
|
+
Called by the statechart
|
31
|
+
*/
|
32
|
+
tryToPerform: function(state) {
|
33
|
+
var func = this.get('func'),
|
34
|
+
arg1 = this.get('arg1'),
|
35
|
+
arg2 = this.get('arg2'),
|
36
|
+
funcType = SC.typeOf(func);
|
37
|
+
|
38
|
+
if (funcType === SC.T_STRING) {
|
39
|
+
state.tryToPerform(func, arg1, arg2);
|
40
|
+
}
|
41
|
+
else if (funcType === SC.T_FUNCTION) {
|
42
|
+
func.apply(state, [arg1, arg2]);
|
43
|
+
}
|
44
|
+
}
|
45
|
+
|
46
|
+
});
|
47
|
+
|
48
|
+
/**
|
49
|
+
Singleton
|
50
|
+
*/
|
51
|
+
SC.Async.mixin(/** @scope SC.Async */{
|
52
|
+
|
53
|
+
/**
|
54
|
+
Call in either a state's enterState or exitState method when you
|
55
|
+
want a state to perform an asynchronous action, such as an animation.
|
56
|
+
|
57
|
+
Examples:
|
58
|
+
|
59
|
+
{{
|
60
|
+
|
61
|
+
SC.State.extend({
|
62
|
+
|
63
|
+
enterState: function() {
|
64
|
+
return SC.Async.perform('foo');
|
65
|
+
},
|
66
|
+
|
67
|
+
exitState: function() {
|
68
|
+
return SC.Async.perform('bar', 100);
|
69
|
+
}
|
70
|
+
|
71
|
+
foo: function() { ... },
|
72
|
+
|
73
|
+
bar: function(arg) { ... }
|
74
|
+
|
75
|
+
});
|
76
|
+
|
77
|
+
}}
|
78
|
+
|
79
|
+
@param func {String|Function} the functio to be invoked on a state
|
80
|
+
@param arg1 Optional. An argument to pass to the given function
|
81
|
+
@param arg2 Optional. An argument to pass to the given function
|
82
|
+
@return {SC.Async} a new instance of a SC.Async
|
83
|
+
*/
|
84
|
+
perform: function(func, arg1, arg2) {
|
85
|
+
return SC.Async.create({ func: func, arg1: arg1, arg2: arg2 });
|
86
|
+
}
|
87
|
+
|
88
|
+
});
|
@@ -0,0 +1,34 @@
|
|
1
|
+
// ==========================================================================
|
2
|
+
// Project: SC.Statechart - A Statechart Framework for SproutCore
|
3
|
+
// Copyright: ©2010, 2011 Michael Cohen, and contributors.
|
4
|
+
// Portions @2011 Apple Inc. All rights reserved.
|
5
|
+
// License: Licensed under MIT license (see license.js)
|
6
|
+
// ==========================================================================
|
7
|
+
|
8
|
+
/*globals SC */
|
9
|
+
|
10
|
+
sc_require('system/state');
|
11
|
+
|
12
|
+
/**
|
13
|
+
The default name given to an empty state
|
14
|
+
*/
|
15
|
+
SC.EMPTY_STATE_NAME = "__EMPTY_STATE__";
|
16
|
+
|
17
|
+
/**
|
18
|
+
@class
|
19
|
+
|
20
|
+
Represents an empty state that gets assigned as a state's initial substate
|
21
|
+
if the state does not have an initial substate defined.
|
22
|
+
|
23
|
+
@extends SC.State
|
24
|
+
*/
|
25
|
+
SC.EmptyState = SC.State.extend(/** @scope SC.EmptyState.prototype */{
|
26
|
+
|
27
|
+
name: SC.EMPTY_STATE_NAME,
|
28
|
+
|
29
|
+
enterState: function() {
|
30
|
+
var msg = "No initial substate was defined for state %@. Entering default empty state";
|
31
|
+
this.stateLogWarning(msg.fmt(this.get('parentState')));
|
32
|
+
}
|
33
|
+
|
34
|
+
});
|
@@ -0,0 +1,97 @@
|
|
1
|
+
// ==========================================================================
|
2
|
+
// Project: SC.Statechart - A Statechart Framework for SproutCore
|
3
|
+
// Copyright: ©2010, 2011 Michael Cohen, and contributors.
|
4
|
+
// Portions @2011 Apple Inc. All rights reserved.
|
5
|
+
// License: Licensed under MIT license (see license.js)
|
6
|
+
// ==========================================================================
|
7
|
+
|
8
|
+
/*globals SC */
|
9
|
+
|
10
|
+
sc_require('system/state');
|
11
|
+
|
12
|
+
/**
|
13
|
+
@class
|
14
|
+
|
15
|
+
Represents a history state that can be assigned to a SC.State object's
|
16
|
+
initialSubstate property.
|
17
|
+
|
18
|
+
If a SC.HistoryState object is assigned to a state's initial substate,
|
19
|
+
then after a state is entered the statechart will refer to the history
|
20
|
+
state object to determine the next course of action. If the state has
|
21
|
+
its historyState property assigned then the that state will be entered,
|
22
|
+
otherwise the default state assigned to history state object will be entered.
|
23
|
+
|
24
|
+
An example of how to use:
|
25
|
+
|
26
|
+
stateA: SC.State.design({
|
27
|
+
|
28
|
+
initialSubstate: SC.HistoryState({
|
29
|
+
defaultState: 'stateB'
|
30
|
+
}),
|
31
|
+
|
32
|
+
stateB: SC.State.design({ ... }),
|
33
|
+
|
34
|
+
stateC: SC.State.design({ ... })
|
35
|
+
|
36
|
+
})
|
37
|
+
|
38
|
+
@author Michael Cohen
|
39
|
+
@extends SC.Object
|
40
|
+
*/
|
41
|
+
SC.HistoryState = SC.Object.extend(
|
42
|
+
/** @scope SC.HistoryState.prototype */{
|
43
|
+
|
44
|
+
/**
|
45
|
+
Used to indicate if the statechart should recurse the
|
46
|
+
history states after entering the this object's parent state
|
47
|
+
|
48
|
+
@property {Boolean}
|
49
|
+
*/
|
50
|
+
isRecursive: NO,
|
51
|
+
|
52
|
+
/**
|
53
|
+
The default state to enter if the parent state does not
|
54
|
+
yet have its historyState property assigned to something
|
55
|
+
other than null.
|
56
|
+
|
57
|
+
The value assigned to this property must be the name of an
|
58
|
+
immediate substate that belongs to the parent state. The
|
59
|
+
statechart will manage the property upon initialization.
|
60
|
+
|
61
|
+
@property {String}
|
62
|
+
*/
|
63
|
+
defaultState: null,
|
64
|
+
|
65
|
+
/** @private
|
66
|
+
Managed by the statechart
|
67
|
+
|
68
|
+
The statechart that owns this object.
|
69
|
+
*/
|
70
|
+
statechart: null,
|
71
|
+
|
72
|
+
/** @private
|
73
|
+
Managed by the statechart
|
74
|
+
|
75
|
+
The state that owns this object
|
76
|
+
*/
|
77
|
+
parentState: null,
|
78
|
+
|
79
|
+
/**
|
80
|
+
Used by the statechart during a state transition process.
|
81
|
+
|
82
|
+
Returns a state to enter based on whether the parent state has
|
83
|
+
its historyState property assigned. If not then this object's
|
84
|
+
assigned default state is returned.
|
85
|
+
*/
|
86
|
+
state: function() {
|
87
|
+
var defaultState = this.get('defaultState'),
|
88
|
+
historyState = this.getPath('parentState.historyState');
|
89
|
+
return !!historyState ? historyState : defaultState;
|
90
|
+
}.property().cacheable(),
|
91
|
+
|
92
|
+
/** @private */
|
93
|
+
parentHistoryStateDidChange: function() {
|
94
|
+
this.notifyPropertyChange('state');
|
95
|
+
}.observes('*parentState.historyState')
|
96
|
+
|
97
|
+
});
|
@@ -8,6 +8,7 @@
|
|
8
8
|
/*globals SC */
|
9
9
|
|
10
10
|
/**
|
11
|
+
@class
|
11
12
|
|
12
13
|
Represents a state within a statechart.
|
13
14
|
|
@@ -18,7 +19,7 @@
|
|
18
19
|
state heirarchy and create the states itself.
|
19
20
|
|
20
21
|
@author Michael Cohen
|
21
|
-
|
22
|
+
@extends SC.Object
|
22
23
|
*/
|
23
24
|
SC.State = SC.Object.extend({
|
24
25
|
|
@@ -1025,7 +1026,7 @@ SC.State = SC.Object.extend({
|
|
1025
1026
|
var sc = this.get('statechart');
|
1026
1027
|
sc.statechartLogError(msg);
|
1027
1028
|
}
|
1028
|
-
|
1029
|
+
|
1029
1030
|
});
|
1030
1031
|
|
1031
1032
|
/**
|
@@ -1057,6 +1058,10 @@ SC.State.plugin = function(value) {
|
|
1057
1058
|
var args = SC.A(arguments); args.shift();
|
1058
1059
|
var func = function() {
|
1059
1060
|
var klass = SC.objectForPropertyPath(value);
|
1061
|
+
if (!klass) {
|
1062
|
+
console.error('SC.State.plugin: Unable to determine path %@'.fmt(value));
|
1063
|
+
return undefined;
|
1064
|
+
}
|
1060
1065
|
return klass.extend.apply(klass, args);
|
1061
1066
|
};
|
1062
1067
|
func.statePlugin = YES;
|
@@ -1064,190 +1069,3 @@ SC.State.plugin = function(value) {
|
|
1064
1069
|
};
|
1065
1070
|
|
1066
1071
|
SC.State.design = SC.State.extend;
|
1067
|
-
|
1068
|
-
/**
|
1069
|
-
Extends the JS Function object with the handleEvents method that
|
1070
|
-
will provide more advanced event handling capabilities when constructing
|
1071
|
-
your statechart's states.
|
1072
|
-
|
1073
|
-
By default, when you add a method to a state, the state will react to
|
1074
|
-
events that matches a method's name, like so:
|
1075
|
-
|
1076
|
-
state = SC.State.extend({
|
1077
|
-
// Will be invoked when a event named "foo" is sent to this state
|
1078
|
-
foo: function(event, sender, context) { ... }
|
1079
|
-
});
|
1080
|
-
|
1081
|
-
In some situations, it may be advantageous to use one method that can react to
|
1082
|
-
multiple events instead of having multiple methods that essentially all do the
|
1083
|
-
same thing. In order to set a method to handle more than one event you use
|
1084
|
-
the handleEvents method which can be supplied a list of string and/or regular
|
1085
|
-
expressions. The following example demonstrates the use of handleEvents:
|
1086
|
-
|
1087
|
-
state = SC.State.extend({
|
1088
|
-
eventHandlerA: function(event, sender, context) {
|
1089
|
-
}.handleEvents('foo', 'bar'),
|
1090
|
-
|
1091
|
-
eventHandlerB: function(event, sender, context) {
|
1092
|
-
}.handleEvents(/num\d/, 'decimal')
|
1093
|
-
});
|
1094
|
-
|
1095
|
-
Whenever events 'foo' and 'bar' are sent to the state, the method eventHandlerA
|
1096
|
-
will be invoked. When there is an event that matches the regular expression
|
1097
|
-
/num\d/ or the event is 'decimal' then eventHandlerB is invoked. In both
|
1098
|
-
cases, the name of the event will be supplied to the event handler.
|
1099
|
-
|
1100
|
-
It should be noted that the use of regular expressions may impact performance
|
1101
|
-
since that statechart will not be able to fully optimize the event handling logic based
|
1102
|
-
on its use. Therefore the use of regular expression should be used sparingly.
|
1103
|
-
|
1104
|
-
@param {(String|RegExp)...} args
|
1105
|
-
*/
|
1106
|
-
Function.prototype.handleEvents = function() {
|
1107
|
-
this.isEventHandler = YES;
|
1108
|
-
this.events = arguments;
|
1109
|
-
return this;
|
1110
|
-
};
|
1111
|
-
|
1112
|
-
/**
|
1113
|
-
Extends the JS Function object with the stateObserves method that will
|
1114
|
-
create a state observe handler on a given state object.
|
1115
|
-
|
1116
|
-
Use a stateObserves() instead of the common observes() method when you want a
|
1117
|
-
state to observer changes to some property on the state itself or some other
|
1118
|
-
object.
|
1119
|
-
|
1120
|
-
Any method on the state that has stateObserves is considered a state observe
|
1121
|
-
handler and behaves just like when you use observes() on a method, but with an
|
1122
|
-
important difference. When you apply stateObserves to a method on a state, those
|
1123
|
-
methods will be active *only* when the state is entered, otherwise those methods
|
1124
|
-
will be inactive. This removes the need for you having to explicitly call
|
1125
|
-
addObserver and removeObserver. As an example:
|
1126
|
-
|
1127
|
-
state = SC.State.extend({
|
1128
|
-
foo: null,
|
1129
|
-
user: null,
|
1130
|
-
observeHandlerA: function(target, key) {
|
1131
|
-
}.stateObserves('MyApp.someController.status'),
|
1132
|
-
|
1133
|
-
observeHandlerB: function(target, key) {
|
1134
|
-
}.stateObserves('foo'),
|
1135
|
-
|
1136
|
-
observeHandlerC: function(target, key) {
|
1137
|
-
}.stateObserves('.user.name', '.user.salary')
|
1138
|
-
});
|
1139
|
-
|
1140
|
-
Above, state has three state observe handlers: observeHandlerA, observeHandlerB, and
|
1141
|
-
observeHandlerC. When state is entered, the state will automatically add itself as
|
1142
|
-
an observer for all of its registered state observe handlers. Therefore when
|
1143
|
-
foo changes, observeHandlerB will be invoked, and when MyApp.someController's status
|
1144
|
-
changes then observeHandlerA will be invoked. The moment that state is exited then
|
1145
|
-
the state will automatically remove itself as an observer for all of its registered
|
1146
|
-
state observe handlers. Therefore none of the state observe handlers will be
|
1147
|
-
invoked until the next time the state is entered.
|
1148
|
-
|
1149
|
-
@param {String...} args
|
1150
|
-
*/
|
1151
|
-
Function.prototype.stateObserves = function() {
|
1152
|
-
this.isStateObserveHandler = YES;
|
1153
|
-
this.args = SC.A(arguments);
|
1154
|
-
return this;
|
1155
|
-
};
|
1156
|
-
|
1157
|
-
/**
|
1158
|
-
Represents a history state that can be assigned to a SC.State object's
|
1159
|
-
initialSubstate property.
|
1160
|
-
|
1161
|
-
If a SC.HistoryState object is assigned to a state's initial substate,
|
1162
|
-
then after a state is entered the statechart will refer to the history
|
1163
|
-
state object to determine the next course of action. If the state has
|
1164
|
-
its historyState property assigned then the that state will be entered,
|
1165
|
-
otherwise the default state assigned to history state object will be entered.
|
1166
|
-
|
1167
|
-
An example of how to use:
|
1168
|
-
|
1169
|
-
stateA: SC.State.design({
|
1170
|
-
initialSubstate: SC.HistoryState({
|
1171
|
-
defaultState: 'stateB'
|
1172
|
-
}),
|
1173
|
-
|
1174
|
-
stateB: SC.State.design({ ... }),
|
1175
|
-
|
1176
|
-
stateC: SC.State.design({ ... })
|
1177
|
-
})
|
1178
|
-
*/
|
1179
|
-
SC.HistoryState = SC.Object.extend({
|
1180
|
-
|
1181
|
-
/**
|
1182
|
-
Used to indicate if the statechart should recurse the
|
1183
|
-
history states after entering the this object's parent state
|
1184
|
-
|
1185
|
-
@property {Boolean}
|
1186
|
-
*/
|
1187
|
-
isRecursive: NO,
|
1188
|
-
|
1189
|
-
/**
|
1190
|
-
The default state to enter if the parent state does not
|
1191
|
-
yet have its historyState property assigned to something
|
1192
|
-
other than null.
|
1193
|
-
|
1194
|
-
The value assigned to this property must be the name of an
|
1195
|
-
immediate substate that belongs to the parent state. The
|
1196
|
-
statechart will manage the property upon initialization.
|
1197
|
-
|
1198
|
-
@property {String}
|
1199
|
-
*/
|
1200
|
-
defaultState: null,
|
1201
|
-
|
1202
|
-
/** @private
|
1203
|
-
Managed by the statechart
|
1204
|
-
|
1205
|
-
The statechart that owns this object.
|
1206
|
-
*/
|
1207
|
-
statechart: null,
|
1208
|
-
|
1209
|
-
/** @private
|
1210
|
-
Managed by the statechart
|
1211
|
-
|
1212
|
-
The state that owns this object
|
1213
|
-
*/
|
1214
|
-
parentState: null,
|
1215
|
-
|
1216
|
-
/**
|
1217
|
-
Used by the statechart during a state transition process.
|
1218
|
-
|
1219
|
-
Returns a state to enter based on whether the parent state has
|
1220
|
-
its historyState property assigned. If not then this object's
|
1221
|
-
assigned default state is returned.
|
1222
|
-
*/
|
1223
|
-
state: function() {
|
1224
|
-
var defaultState = this.get('defaultState'),
|
1225
|
-
historyState = this.getPath('parentState.historyState');
|
1226
|
-
return !!historyState ? historyState : defaultState;
|
1227
|
-
}.property().cacheable(),
|
1228
|
-
|
1229
|
-
/** @private */
|
1230
|
-
parentHistoryStateDidChange: function() {
|
1231
|
-
this.notifyPropertyChange('state');
|
1232
|
-
}.observes('*parentState.historyState')
|
1233
|
-
|
1234
|
-
});
|
1235
|
-
|
1236
|
-
/**
|
1237
|
-
The default name given to an empty state
|
1238
|
-
*/
|
1239
|
-
SC.EMPTY_STATE_NAME = "__EMPTY_STATE__";
|
1240
|
-
|
1241
|
-
/**
|
1242
|
-
Represents an empty state that gets assigned as a state's initial substate
|
1243
|
-
if the state does not have an initial substate defined.
|
1244
|
-
*/
|
1245
|
-
SC.EmptyState = SC.State.extend({
|
1246
|
-
|
1247
|
-
name: SC.EMPTY_STATE_NAME,
|
1248
|
-
|
1249
|
-
enterState: function() {
|
1250
|
-
this.stateLogWarning("No initial substate was defined for state %@. Entering default empty state".fmt(this.get('parentState')));
|
1251
|
-
}
|
1252
|
-
|
1253
|
-
});
|